mirror of https://github.com/nodejs/node.git
cli: support --experimental-top-level-await in NODE_OPTIONS
PR-URL: https://github.com/nodejs/node/pull/33495 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michaël Zasso <targos@protonmail.com>pull/33529/head
parent
1acc14baf9
commit
842a895ebf
|
@ -1187,6 +1187,7 @@ Node.js options that are allowed are:
|
|||
* `--experimental-policy`
|
||||
* `--experimental-repl-await`
|
||||
* `--experimental-specifier-resolution`
|
||||
* `--experimental-top-level-await`
|
||||
* `--experimental-vm-modules`
|
||||
* `--experimental-wasi-unstable-preview1`
|
||||
* `--experimental-wasm-modules`
|
||||
|
|
|
@ -599,7 +599,8 @@ PerIsolateOptionsParser::PerIsolateOptionsParser(
|
|||
|
||||
AddOption("--experimental-top-level-await",
|
||||
"enable experimental support for ECMAScript Top-Level Await",
|
||||
&PerIsolateOptions::experimental_top_level_await);
|
||||
&PerIsolateOptions::experimental_top_level_await,
|
||||
kAllowedInEnvironment);
|
||||
AddOption("--harmony-top-level-await", "", V8Option{});
|
||||
Implies("--experimental-top-level-await", "--harmony-top-level-await");
|
||||
Implies("--harmony-top-level-await", "--experimental-top-level-await");
|
||||
|
|
|
@ -78,6 +78,10 @@ expect('--stack-trace-limit=100',
|
|||
if (!['arm', 'arm64', 's390x'].includes(process.arch))
|
||||
expect('--interpreted-frames-native-stack', 'B\n');
|
||||
|
||||
// Workers can't eval as ES Modules. https://github.com/nodejs/node/issues/30682
|
||||
expectNoWorker('--experimental-top-level-await --input-type=module',
|
||||
'B\n', 'console.log(await "B")');
|
||||
|
||||
function expectNoWorker(opt, want, command, wantsError) {
|
||||
expect(opt, want, command, wantsError, false);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue