Repository navigation
modules: implement deferred import for dynamic modules - #66727
MayaLekova wants to merge 1 commit into
Conversation
|
Review requested:
|
f8ef554 to
503ed1f
Compare
|
I tried fixing the @joyeecheung just FYI, I'll keep trying to fix it. |
| "});" | ||
| "await m.link(() => 0);" | ||
| "await m.evaluate();" | ||
| "await m.evaluate(-1, false, 3);" |
There was a problem hiding this comment.
This is the public API for the vm API, which is not used by the built-in loader at all, and it's not the same as the module wrap's evaluate, which is internal and used by both. There's no need to touch this.
There was a problem hiding this comment.
Gotcha, I don't know why exactly it hits the changed version of ModuleWrap::Evaluate. Without it, the same test crashes, but with different error:
[ RUN ] EnvironmentTest.EnvironmentWithESMLoader
(node:156113) ExperimentalWarning: VM Modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
# Node.js[156113]: static void node::loader::ModuleWrap::Evaluate(const v8::FunctionCallbackInfo<v8::Value>&) at ../../src/module_wrap.cc:789
# Assertion failed: (args.Length()) == (3)
----- Native stack trace -----
1: 0x5eb63c38fce4 [out/Release/cctest]
2: 0x5eb63c3909f9 node::Assert(node::AssertionInfo const&) [out/Release/cctest]
3: 0x5eb63c30ddd4 node::loader::ModuleWrap::Evaluate(v8::FunctionCallbackInfo<v8::Value> const&) [out/Release/cctest]
4: 0x785c5e58ffe9
----- JavaScript stack trace -----
1: evaluate (node:internal/vm/module:233:26)
2: /home/maya/Work/node/out/Release/cctest:1:328
3: processTicksAndRejections (node:internal/process/task_queues:104:5)
Aborted (core dumped)
There was a problem hiding this comment.
That is the public API wrapper, I think you need to pass in kEvaluationPhase in
node/lib/internal/vm/module.js
Line 233 in 46dc5d7
|
Can you drop the amaro update commit? I don't think that's supposed to be in this PR? |
503ed1f to
930f23f
Compare
Yep, done. |
|
Hi @joyeecheung , could you please take a look again? This is the first version, with the cctest failure before my change to the test. |
930f23f to
cb19e4a
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #66727 +/- ##
========================================
Coverage 90.50% 90.50%
========================================
Files 797 797
Lines 277652 278244 +592
Branches 53345 53465 +120
========================================
+ Hits 251282 251822 +540
- Misses 16758 16799 +41
- Partials 9612 9623 +11
🚀 New features to boost your workflow:
|
3a0f329 to
1ecb21a
Compare
This PR adds support for deferring the import of modules in additional cases, such as importing a dynamic module. It also adds a test for this case. Refs: https://github.com/tc39/proposal-defer-import-eval Signed-off-by: Maya Lekova <maya@igalia.com>
1ecb21a to
236b046
Compare
|
Hi @joyeecheung, the PR seems in a good shape already. Could you please take a look? Also @guybedford, could you take a look as well? Just saw you were landing other module-related changes. This is wiring the Thank you both! |
modules: implement deferred import for dynamic modules
This PR adds support for deferring the import of modules in additional
cases, such as importing a dynamic module. It also adds a test for
this case.
Refs: https://github.com/tc39/proposal-defer-import-eval
Signed-off-by: Maya Lekova maya@igalia.com