File tree 4 files changed +17
-8
lines changed
4 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -160,9 +160,6 @@ function NativeModule(id) {
160
160
this . loaded = false ;
161
161
this . loading = false ;
162
162
this . canBeRequiredByUsers = ! id . startsWith ( 'internal/' ) ;
163
-
164
- if ( id === 'wasi' )
165
- this . canBeRequiredByUsers = ! ! internalBinding ( 'config' ) . experimentalWasi ;
166
163
}
167
164
168
165
// To be called during pre-execution when --expose-internals is on.
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ function prepareMainThreadExecution(expandArgv1 = false) {
62
62
initializeClusterIPC ( ) ;
63
63
64
64
initializeDeprecations ( ) ;
65
+ initializeWASI ( ) ;
65
66
initializeCJSLoader ( ) ;
66
67
initializeESMLoader ( ) ;
67
68
@@ -400,6 +401,14 @@ function initializePolicy() {
400
401
}
401
402
}
402
403
404
+ function initializeWASI ( ) {
405
+ if ( getOptionValue ( '--experimental-wasi-unstable-preview0' ) ) {
406
+ const { NativeModule } = require ( 'internal/bootstrap/loaders' ) ;
407
+ const mod = NativeModule . map . get ( 'wasi' ) ;
408
+ mod . canBeRequiredByUsers = true ;
409
+ }
410
+ }
411
+
403
412
function initializeCJSLoader ( ) {
404
413
const CJSLoader = require ( 'internal/modules/cjs/loader' ) ;
405
414
CJSLoader . Module . _initPaths ( ) ;
@@ -466,5 +475,6 @@ module.exports = {
466
475
setupTraceCategoryState,
467
476
setupInspectorHooks,
468
477
initializeReport,
469
- initializeCJSLoader
478
+ initializeCJSLoader,
479
+ initializeWASI
470
480
} ;
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ const {
14
14
setupWarningHandler,
15
15
setupDebugEnv,
16
16
initializeDeprecations,
17
+ initializeWASI,
17
18
initializeCJSLoader,
18
19
initializeESMLoader,
19
20
initializeFrozenIntrinsics,
@@ -109,6 +110,7 @@ port.on('message', (message) => {
109
110
require ( 'internal/process/policy' ) . setup ( manifestSrc , manifestURL ) ;
110
111
}
111
112
initializeDeprecations ( ) ;
113
+ initializeWASI ( ) ;
112
114
initializeCJSLoader ( ) ;
113
115
initializeESMLoader ( ) ;
114
116
Original file line number Diff line number Diff line change @@ -15,11 +15,14 @@ using v8::Number;
15
15
using v8::Object;
16
16
using v8::Value;
17
17
18
- // The config binding is used to provide an internal view of compile or runtime
18
+ // The config binding is used to provide an internal view of compile time
19
19
// config options that are required internally by lib/*.js code. This is an
20
20
// alternative to dropping additional properties onto the process object as
21
21
// has been the practice previously in node.cc.
22
22
23
+ // Command line arguments are already accessible in the JS land via
24
+ // require('internal/options').getOptionValue('--some-option'). Do not add them
25
+ // here.
23
26
static void Initialize (Local<Object> target,
24
27
Local<Value> unused,
25
28
Local<Context> context,
@@ -84,9 +87,6 @@ static void Initialize(Local<Object> target,
84
87
85
88
READONLY_PROPERTY (target, " hasCachedBuiltins" ,
86
89
v8::Boolean::New (isolate, native_module::has_code_cache));
87
-
88
- if (env->options ()->experimental_wasi )
89
- READONLY_TRUE_PROPERTY (target, " experimentalWasi" );
90
90
} // InitConfig
91
91
92
92
} // namespace node
You can’t perform that action at this time.
0 commit comments