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? |
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
503ed1f to
930f23f
Compare
Yep, done. |
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