GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — wasi: require CLI flag to require() wasi module · nodejs/node@5d2ae05

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/bootstrap
    • pre_execution.js
  • src
    • node_native_module.cc
  • test/wasi
    • test-wasi-require-flag.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/bootstrap/pre_execution.js‎

Copy file name to clipboardExpand all lines: lib/internal/bootstrap/pre_execution.js
+4-5Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,11 +402,10 @@ function initializePolicy() {
402402
}
403403

404404
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-
}
405+
const { NativeModule } = require('internal/bootstrap/loaders');
406+
const mod = NativeModule.map.get('wasi');
407+
mod.canBeRequiredByUsers =
408+
getOptionValue('--experimental-wasi-unstable-preview0');
410409
}
411410

412411
function initializeCJSLoader() {
Collapse file

‎src/node_native_module.cc‎

Copy file name to clipboardExpand all lines: src/node_native_module.cc
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ void NativeModuleLoader::InitializeModuleCategories() {
9898
#endif // !HAVE_OPENSSL
9999

100100
"sys", // Deprecated.
101+
"wasi", // Experimental.
101102
"internal/test/binding",
102103
"internal/v8_prof_polyfill",
103104
"internal/v8_prof_processor",
Collapse file

‎test/wasi/test-wasi-require-flag.js‎

Copy file name to clipboard
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use strict';
2+
// This test verifies that the WASI module cannot be require()'ed without a
3+
// CLI flag while it is still experimental.
4+
require('../common');
5+
const assert = require('assert');
6+
7+
assert.throws(() => {
8+
require('wasi');
9+
}, /^Error: Cannot find module 'wasi'/);

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.