Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b999983

Browse filesBrowse files
cola119danielleadams
authored andcommitted
repl: do not define wasi on global with no flag
PR-URL: #45595 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent ebc89f1 commit b999983
Copy full SHA for b999983

File tree

Expand file treeCollapse file tree

2 files changed

+17
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+17
-1
lines changed
Open diff view settings
Collapse file

‎lib/internal/main/repl.js‎

Copy file name to clipboardExpand all lines: lib/internal/main/repl.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const {
88
markBootstrapComplete
99
} = require('internal/process/pre_execution');
1010

11-
const esmLoader = require('internal/process/esm_loader');
1211
const {
1312
evalScript
1413
} = require('internal/process/execution');
@@ -34,6 +33,7 @@ if (process.env.NODE_REPL_EXTERNAL_MODULE) {
3433
process.exit(1);
3534
}
3635

36+
const esmLoader = require('internal/process/esm_loader');
3737
esmLoader.loadESM(() => {
3838
console.log(`Welcome to Node.js ${process.version}.\n` +
3939
'Type ".help" for more information.');
Collapse file

‎test/parallel/test-repl-built-in-modules.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-repl-built-in-modules.js
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,19 @@ assert.doesNotMatch(
3030
stdout,
3131
/Uncaught Error: Cannot find module 'wasi'[\w\W]+- <repl>\n/);
3232
assert.match(stdout, /{ WASI: \[class WASI\] }/);
33+
34+
{
35+
const res = cp.execFileSync(process.execPath, ['-i'], {
36+
input: "'wasi' in global",
37+
encoding: 'utf8',
38+
});
39+
// `wasi` shouldn't be defined on global when the flag is not set
40+
assert.match(res, /false\n/);
41+
}
42+
{
43+
const res = cp.execFileSync(process.execPath, ['-i', '--experimental-wasi-unstable-preview1'], {
44+
input: "'wasi' in global",
45+
encoding: 'utf8',
46+
});
47+
assert.match(res, /true\n/);
48+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.