-
-
Notifications
You must be signed in to change notification settings - Fork 34.6k
src: support import() and import.meta in embedder-run modules #61654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This adds a embedder_module_hdo for identifying embedder-run modules in the dynamic import handler and import.meta initializer, and a SourceTextModuleTypes for customizing source text module compilation in the JS land via compileSourceTextModule(). Also, refactors the existing embedder module compilation code to reuse the builtin resolution logic.
|
Review requested:
|
| v8::Local<v8::Context> context = isolate_->GetCurrentContext(); | ||
| // Finish the await. | ||
| context->GetMicrotaskQueue()->PerformCheckpoint(isolate_); | ||
| v8::Local<v8::Value> imported_value = result.As<v8::Promise>()->Result(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| v8::Local<v8::Value> imported_value = result.As<v8::Promise>()->Result(); | |
| EXPECT_EQ(result.As<v8::Promise>()->State(), v8::Promise::kFulfilled); | |
| v8::Local<v8::Value> imported_value = result.As<v8::Promise>()->Result(); |
| // Finish the await. | ||
| context->GetMicrotaskQueue()->PerformCheckpoint(isolate_); | ||
|
|
||
| v8::Local<v8::Value> imported_value = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| v8::Local<v8::Value> imported_value = | |
| EXPECT_EQ(result.As<v8::Promise>()->State(), v8::Promise::kFulfilled); | |
| v8::Local<v8::Value> imported_value = |
| kInternal: 'internal', // TODO(joyeecheung): support internal ESM. | ||
| kEmbedder: 'embedder', // Embedder ESM, also used by SEA | ||
| kUser: 'user', // User-land ESM | ||
| kDynamic: 'dynamic', // Currently only used by the facade that proxies WASM module import/exports. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like the term dynamic in ESM could be related to the dynamic import calls. Given that this creates a module with a facade, and this is also not a synthetic module, maybe we should rename it to a facade module.
Nevertheless, this is not a blocker for this PR.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #61654 +/- ##
=======================================
Coverage 89.74% 89.75%
=======================================
Files 674 674
Lines 204348 204431 +83
Branches 39271 39277 +6
=======================================
+ Hits 183396 183480 +84
+ Misses 13262 13255 -7
- Partials 7690 7696 +6
🚀 New features to boost your workflow:
|
This adds a embedder_module_hdo for identifying embedder-run modules in the dynamic import handler and import.meta initializer, and a SourceTextModuleTypes for customizing source text module compilation in the JS land via compileSourceTextModule(). Also, refactors the existing embedder module compilation code to reuse the builtin resolution logic.