diff --git a/doc/api/cli.md b/doc/api/cli.md index 47e86d0c324395..d9880cda484757 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -48,7 +48,6 @@ entry point, the `node` command will accept as input only files with `.js`, `.mjs`, or `.cjs` extensions. With the following flags, additional file extensions are enabled: -* [`--experimental-wasm-modules`][] for files with `.wasm` extension. * [`--experimental-addon-modules`][] for files with `.node` extension. ## Options @@ -1124,14 +1123,6 @@ changes: Enable experimental WebAssembly System Interface (WASI) support. -### `--experimental-wasm-modules` - - - -Enable experimental WebAssembly module support. - ### `--experimental-webstorage` + > Stability: 1 - Experimental -Importing WebAssembly modules is supported under the -`--experimental-wasm-modules` flag, allowing any `.wasm` files to be +Importing WebAssembly modules is supported, allowing any `.wasm` files to be imported as normal modules while also supporting their module imports. This integration is in line with the @@ -686,7 +692,7 @@ console.log(M); executed under: ```bash -node --experimental-wasm-modules index.mjs +node index.mjs ``` would provide the exports interface for the instantiation of `module.wasm`. diff --git a/doc/node.1 b/doc/node.1 index d33bb82b7670e7..a621e7b377783f 100644 --- a/doc/node.1 +++ b/doc/node.1 @@ -214,9 +214,6 @@ Enable experimental ES module support in VM module. Enable experimental WebAssembly System Interface support. This flag is no longer required as WASI is enabled by default. . -.It Fl -experimental-wasm-modules -Enable experimental WebAssembly module support. -. .It Fl -experimental-quic Enable the experimental QUIC support. . diff --git a/lib/internal/modules/esm/formats.js b/lib/internal/modules/esm/formats.js index ff0bed228d4e74..0f65f7a8350d8f 100644 --- a/lib/internal/modules/esm/formats.js +++ b/lib/internal/modules/esm/formats.js @@ -9,7 +9,6 @@ const { getValidatedPath } = require('internal/fs/utils'); const fsBindings = internalBinding('fs'); const { fs: fsConstants } = internalBinding('constants'); -const experimentalWasmModules = getOptionValue('--experimental-wasm-modules'); const experimentalAddonModules = getOptionValue('--experimental-addon-modules'); const extensionFormatMap = { @@ -18,12 +17,9 @@ const extensionFormatMap = { '.js': 'module', '.json': 'json', '.mjs': 'module', + '.wasm': 'wasm', }; -if (experimentalWasmModules) { - extensionFormatMap['.wasm'] = 'wasm'; -} - if (experimentalAddonModules) { extensionFormatMap['.node'] = 'addon'; } @@ -46,7 +42,7 @@ function mimeToFormat(mime) { ) !== null ) { return 'module'; } if (mime === 'application/json') { return 'json'; } - if (experimentalWasmModules && mime === 'application/wasm') { return 'wasm'; } + if (mime === 'application/wasm') { return 'wasm'; } return null; } @@ -57,7 +53,6 @@ function mimeToFormat(mime) { * @param {URL} url */ function getFormatOfExtensionlessFile(url) { - if (!experimentalWasmModules) { return 'module'; } const path = getValidatedPath(url); switch (fsBindings.getFormatOfExtensionlessFile(path)) { case fsConstants.EXTENSIONLESS_FORMAT_WASM: diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js index 678659aacaad3e..9fcd285412437b 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -480,8 +480,6 @@ translators.set('json', function jsonStrategy(url, source) { // Strategy for loading a wasm module translators.set('wasm', async function(url, source) { - emitExperimentalWarning('Importing WebAssembly modules'); - assertBufferSource(source, false, 'load'); debug(`Translating WASMModule ${url}`); diff --git a/src/node_options.cc b/src/node_options.cc index a6dc00d7d7213f..114010b47a9249 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -466,10 +466,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { kAllowedInEnvvar); AddAlias("--loader", "--experimental-loader"); AddOption("--experimental-modules", "", NoOp{}, kAllowedInEnvvar); - AddOption("--experimental-wasm-modules", - "experimental ES Module support for webassembly modules", - &EnvironmentOptions::experimental_wasm_modules, - kAllowedInEnvvar); + AddOption("--experimental-wasm-modules", "", NoOp{}, kAllowedInEnvvar); AddOption("--experimental-import-meta-resolve", "experimental ES Module import.meta.resolve() parentURL support", &EnvironmentOptions::experimental_import_meta_resolve, diff --git a/test/es-module/test-esm-wasm.mjs b/test/es-module/test-esm-wasm.mjs index da56e221edc1e9..aa47bc7f430393 100644 --- a/test/es-module/test-esm-wasm.mjs +++ b/test/es-module/test-esm-wasm.mjs @@ -1,6 +1,6 @@ import { spawnPromisified } from '../common/index.mjs'; import * as fixtures from '../common/fixtures.mjs'; -import { strictEqual, match } from 'node:assert'; +import { strictEqual } from 'node:assert'; import { execPath } from 'node:process'; import { describe, it } from 'node:test'; @@ -8,8 +8,6 @@ import { describe, it } from 'node:test'; describe('ESM: WASM modules', { concurrency: !process.env.TEST_PARALLEL }, () => { it('should load exports', async () => { const { code, stderr, stdout } = await spawnPromisified(execPath, [ - '--no-warnings', - '--experimental-wasm-modules', '--input-type=module', '--eval', [ @@ -31,8 +29,6 @@ describe('ESM: WASM modules', { concurrency: !process.env.TEST_PARALLEL }, () => it('should not allow code injection through export names', async () => { const { code, stderr, stdout } = await spawnPromisified(execPath, [ - '--no-warnings', - '--experimental-wasm-modules', '--input-type=module', '--eval', `import * as wasmExports from ${JSON.stringify(fixtures.fileURL('es-modules/export-name-code-injection.wasm'))};`, @@ -45,8 +41,6 @@ describe('ESM: WASM modules', { concurrency: !process.env.TEST_PARALLEL }, () => it('should allow non-identifier export names', async () => { const { code, stderr, stdout } = await spawnPromisified(execPath, [ - '--no-warnings', - '--experimental-wasm-modules', '--input-type=module', '--eval', [ @@ -63,8 +57,6 @@ describe('ESM: WASM modules', { concurrency: !process.env.TEST_PARALLEL }, () => it('should properly escape import names as well', async () => { const { code, stderr, stdout } = await spawnPromisified(execPath, [ - '--no-warnings', - '--experimental-wasm-modules', '--input-type=module', '--eval', [ @@ -78,16 +70,4 @@ describe('ESM: WASM modules', { concurrency: !process.env.TEST_PARALLEL }, () => strictEqual(stdout, ''); strictEqual(code, 0); }); - - it('should emit experimental warning', async () => { - const { code, signal, stderr } = await spawnPromisified(execPath, [ - '--experimental-wasm-modules', - fixtures.path('es-modules/wasm-modules.mjs'), - ]); - - strictEqual(code, 0); - strictEqual(signal, null); - match(stderr, /ExperimentalWarning/); - match(stderr, /WebAssembly/); - }); }); diff --git a/test/module-hooks/test-module-hooks-import-wasm.mjs b/test/module-hooks/test-module-hooks-import-wasm.mjs index f2c357cd50390c..00e6cd41265077 100644 --- a/test/module-hooks/test-module-hooks-import-wasm.mjs +++ b/test/module-hooks/test-module-hooks-import-wasm.mjs @@ -1,6 +1,5 @@ -// Flags: --no-experimental-wasm-modules // This tests that module.registerHooks() can be used to support unknown formats, like -// import(wasm) (without --experimental-wasm-modules). +// import(wasm) import '../common/index.mjs'; import assert from 'node:assert'; diff --git a/test/module-hooks/test-module-hooks-require-wasm.js b/test/module-hooks/test-module-hooks-require-wasm.js index b4276bcc749a01..1cf7da6451f218 100644 --- a/test/module-hooks/test-module-hooks-require-wasm.js +++ b/test/module-hooks/test-module-hooks-require-wasm.js @@ -1,8 +1,7 @@ -// Flags: --no-experimental-wasm-modules 'use strict'; // This tests that module.registerHooks() can be used to support unknown formats, like -// require(wasm) and import(wasm) (without --experimental-wasm-modules). +// require(wasm) and import(wasm) const common = require('../common'); const assert = require('assert'); diff --git a/test/parallel/test-process-env-allowed-flags-are-documented.js b/test/parallel/test-process-env-allowed-flags-are-documented.js index 89b41da638f2da..3ee3189c50da18 100644 --- a/test/parallel/test-process-env-allowed-flags-are-documented.js +++ b/test/parallel/test-process-env-allowed-flags-are-documented.js @@ -114,6 +114,7 @@ assert(undocumented.delete('--debug-arraybuffer-allocations')); assert(undocumented.delete('--no-debug-arraybuffer-allocations')); assert(undocumented.delete('--es-module-specifier-resolution')); assert(undocumented.delete('--experimental-fetch')); +assert(undocumented.delete('--experimental-wasm-modules')); assert(undocumented.delete('--experimental-global-customevent')); assert(undocumented.delete('--experimental-global-webcrypto')); assert(undocumented.delete('--experimental-report'));