Skip to content

feat: add Module::EvaluateForImportDefer and GetModuleNamespace with phase#1965

Merged
bartlomieju merged 1 commit into
mainfrom
feat/import-defer-eval-api
Apr 19, 2026
Merged

feat: add Module::EvaluateForImportDefer and GetModuleNamespace with phase#1965
bartlomieju merged 1 commit into
mainfrom
feat/import-defer-eval-api

Conversation

@bartlomieju
Copy link
Copy Markdown
Member

Summary

Add Rust bindings for V8 APIs needed for dynamic import.defer() support (TC39 import defer proposal):

  • Module::evaluate_for_import_defer(scope)Option<Local<Value>> - Evaluates async transitive dependencies eagerly so deferred namespace access can be synchronous. Returns a Promise.

  • Module::get_module_namespace_with_phase(phase)Local<Value> - Returns the module namespace for a given ModuleImportPhase. For kDefer, returns a deferred namespace that triggers evaluation on first property access.

These wrap the V8 C++ APIs added in v8/v8@f2016e19.

Needed by denoland/deno#32360.

🤖 Generated with Claude Code

…phase

Add Rust bindings for V8 APIs needed for dynamic `import.defer()`:

- `Module::evaluate_for_import_defer()` - evaluates async transitive
  dependencies eagerly so deferred namespace access can be synchronous.
  Returns a Promise that resolves when dependencies are ready.

- `Module::get_module_namespace_with_phase()` - returns the module
  namespace for a given import phase. For `ModuleImportPhase::kDefer`,
  returns a deferred namespace that triggers evaluation on first
  property access.

These APIs were added to V8 in commit f2016e19b33a (v8/v8@f2016e19).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bartlomieju bartlomieju force-pushed the feat/import-defer-eval-api branch from 9919521 to 816a55f Compare April 19, 2026 09:14
@bartlomieju bartlomieju merged commit 83d95ea into main Apr 19, 2026
30 checks passed
@bartlomieju bartlomieju deleted the feat/import-defer-eval-api branch April 19, 2026 10:35
@bartlomieju bartlomieju restored the feat/import-defer-eval-api branch April 19, 2026 11:11
@bartlomieju bartlomieju deleted the feat/import-defer-eval-api branch April 19, 2026 11:38
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.

1 participant