Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2019-12-14 19:14:02 +0300
committerDaniel Bevenius <daniel.bevenius@gmail.com>2019-12-17 08:02:04 +0300
commitefb908409eae37c32d7a71ec267c5fec2bcc4c8a (patch)
tree762124f0378ee6530b5c64c0f7f9c43ab122bbf0 /lib
parentce49f90e14212cd900aba69bac76a8af288d2b58 (diff)
wasi: require CLI flag to require() wasi module
This commit ensures that the WASI module cannot be require()'ed without a CLI flag while the module is still experimental. This fixes a regression from https://github.com/nodejs/node/pull/30778. PR-URL: https://github.com/nodejs/node/pull/30963 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/internal/bootstrap/pre_execution.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js
index 0529bd65852..47c709b424e 100644
--- a/lib/internal/bootstrap/pre_execution.js
+++ b/lib/internal/bootstrap/pre_execution.js
@@ -401,11 +401,10 @@ function initializePolicy() {
}
function initializeWASI() {
- if (getOptionValue('--experimental-wasi-unstable-preview0')) {
- const { NativeModule } = require('internal/bootstrap/loaders');
- const mod = NativeModule.map.get('wasi');
- mod.canBeRequiredByUsers = true;
- }
+ const { NativeModule } = require('internal/bootstrap/loaders');
+ const mod = NativeModule.map.get('wasi');
+ mod.canBeRequiredByUsers =
+ getOptionValue('--experimental-wasi-unstable-preview0');
}
function initializeCJSLoader() {