Skip to content

feat: support TC39 import defer proposal#1280

Closed
bartlomieju wants to merge 5 commits intodenoland:mainfrom
bartlomieju:feat/import-defer-eval
Closed

feat: support TC39 import defer proposal#1280
bartlomieju wants to merge 5 commits intodenoland:mainfrom
bartlomieju:feat/import-defer-eval

Conversation

@bartlomieju
Copy link
Member

@bartlomieju bartlomieju commented Jan 20, 2026

Summary

  • Adds support for the TC39 "Deferred Module Evaluation" proposal
  • Enables V8 --js-defer-import-eval flag
  • Separates ModuleImportPhase::Defer handling from Evaluation phase in module loading
  • Integration test validates deferred evaluation semantics

Background

The import defer proposal (Stage 3) allows loading modules without immediate execution:

import defer * as ns from "./module.js";
// Module is loaded but NOT executed
console.log(ns.value); // Module executes here, on first property access

Changes

File Change
core/runtime/setup.rs Add --js-defer-import-eval V8 flag
core/modules/map.rs Separate Defer phase handling (instantiate without evaluate)
testing/lib.rs Add import_defer integration test
testing/integration/import_defer/* Test files + implementation notes

Test plan

  • All existing tests pass (cargo test -p deno_core_testing - 55 tests)
  • import_defer test passes with V8 14.6 (rusty_v8 146) runtime support

🤖 Generated with Claude Code

bartlomieju and others added 3 commits January 20, 2026 01:45
Adds initial support for the TC39 "Deferred Module Evaluation" proposal
(https://github.com/tc39/proposal-defer-import-eval).

Changes:
- Enable V8 `--js-defer-import-eval` flag for parser support
- Separate `ModuleImportPhase::Defer` handling from `Evaluation` phase
- Add integration test (disabled until V8 runtime support is complete)

The `import defer` syntax allows loading modules without immediate
execution. The module evaluates synchronously on first property access.

Note: V8 14.5 (rusty_v8 145) has parser support but incomplete runtime
support. The test is disabled until a future V8 version completes the
implementation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
V8 14.6 (rusty_v8 146) now has complete runtime support for the
`import defer` proposal. Enable the previously disabled integration
test and remove outdated V8 version notes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bartlomieju bartlomieju changed the title feat: add foundation for TC39 import defer proposal feat: support TC39 import defer proposal Feb 25, 2026
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.61%. Comparing base (0c7f83e) to head (8c7e545).
⚠️ Report is 437 commits behind head on main.

Files with missing lines Patch % Lines
core/modules/map.rs 0.00% 20 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1280      +/-   ##
==========================================
- Coverage   81.43%   77.61%   -3.82%     
==========================================
  Files          97      105       +8     
  Lines       23877    26813    +2936     
==========================================
+ Hits        19445    20812    +1367     
- Misses       4432     6001    +1569     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

bartlomieju added a commit to bartlomieju/deno that referenced this pull request Feb 27, 2026
Adds support for the TC39 "Deferred Module Evaluation" proposal
(https://github.com/tc39/proposal-defer-import-eval, Stage 3).

Changes:
- Enable V8 `--js-defer-import-eval` flag for parser/runtime support
- Separate `ModuleImportPhase::Defer` handling from `Evaluation` phase:
  deferred modules are instantiated but not evaluated, letting V8 create
  a deferred namespace that triggers evaluation on first property access
- Add integration test validating deferred evaluation semantics

Ported from denoland/deno_core#1280

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bartlomieju
Copy link
Member Author

Closing in favor of denoland/deno#32360

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants