From f7e35aec460f2d4a1abf9266e1461ae7e79fb58f Mon Sep 17 00:00:00 2001 From: Lucas Garron Date: Thu, 6 Feb 2025 19:46:15 -0800 Subject: [PATCH 1/8] Prefix `node` built-in module imports with `node:`. This makes the imports diistinguishable from the corresponding `npm` packages, which can help with: - Development ergonomics: - Marking all `node:*` packages as external in a bundler. - Tracking the dependency graph - Supply chain security (avoiding risks from name squatting). The `node:` protocol prefix is supported in LTS versions all the way back to `node` 12: https://nodejs.org/api/esm.html#node-imports --- src/lib/libatomic.js | 2 +- src/lib/libcore.js | 2 +- src/lib/libsockfs.js | 4 ++-- src/lib/libwasi.js | 2 +- src/lib/libwasm_worker.js | 2 +- src/preamble.js | 2 +- src/proxyClient.js | 2 +- src/runtime_shared.js | 2 +- src/shell.js | 8 ++++---- src/shell_minimal.js | 4 ++-- src/wasm_worker.js | 6 +++--- tools/file_packager.py | 4 ++-- tools/link.py | 4 ++-- 13 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/lib/libatomic.js b/src/lib/libatomic.js index c4e89706f7dc4..a39129f832525 100644 --- a/src/lib/libatomic.js +++ b/src/lib/libatomic.js @@ -153,7 +153,7 @@ addToLibrary({ emscripten_num_logical_cores: () => #if ENVIRONMENT_MAY_BE_NODE - ENVIRONMENT_IS_NODE ? require('os').cpus().length : + ENVIRONMENT_IS_NODE ? require('node:os').cpus().length : #endif navigator['hardwareConcurrency'], }); diff --git a/src/lib/libcore.js b/src/lib/libcore.js index c122b623f13eb..d4936f43e06c1 100644 --- a/src/lib/libcore.js +++ b/src/lib/libcore.js @@ -352,7 +352,7 @@ addToLibrary({ var cmdstr = UTF8ToString(command); if (!cmdstr.length) return 0; // this is what glibc seems to do (shell works test?) - var cp = require('child_process'); + var cp = require('node:child_process'); var ret = cp.spawnSync(cmdstr, [], {shell:true, stdio:'inherit'}); var _W_EXITCODE = (ret, sig) => ((ret) << 8 | (sig)); diff --git a/src/lib/libsockfs.js b/src/lib/libsockfs.js index e5c1b8674c883..72de95b4dac62 100644 --- a/src/lib/libsockfs.js +++ b/src/lib/libsockfs.js @@ -208,7 +208,7 @@ addToLibrary({ var WebSocketConstructor; #if ENVIRONMENT_MAY_BE_NODE if (ENVIRONMENT_IS_NODE) { - WebSocketConstructor = /** @type{(typeof WebSocket)} */(require('ws')); + WebSocketConstructor = /** @type{(typeof WebSocket)} */(require('node:ws')); } else #endif // ENVIRONMENT_MAY_BE_NODE { @@ -503,7 +503,7 @@ addToLibrary({ if (sock.server) { throw new FS.ErrnoError({{{ cDefs.EINVAL }}}); // already listening } - var WebSocketServer = require('ws').Server; + var WebSocketServer = require('node:ws').Server; var host = sock.saddr; #if SOCKET_DEBUG dbg(`websocket: listen: ${host}:${sock.sport}`); diff --git a/src/lib/libwasi.js b/src/lib/libwasi.js index ba23c6f12e736..dafbf05992068 100644 --- a/src/lib/libwasi.js +++ b/src/lib/libwasi.js @@ -564,7 +564,7 @@ var WasiLibrary = { #if ENVIRONMENT_MAY_BE_NODE && MIN_NODE_VERSION < 190000 // This block is not needed on v19+ since crypto.getRandomValues is builtin if (ENVIRONMENT_IS_NODE) { - var nodeCrypto = require('crypto'); + var nodeCrypto = require('node:crypto'); return (view) => nodeCrypto.randomFillSync(view); } #endif // ENVIRONMENT_MAY_BE_NODE diff --git a/src/lib/libwasm_worker.js b/src/lib/libwasm_worker.js index 32107a07bdc0d..2ddcfbba285d3 100644 --- a/src/lib/libwasm_worker.js +++ b/src/lib/libwasm_worker.js @@ -286,7 +286,7 @@ if (ENVIRONMENT_IS_WASM_WORKER emscripten_navigator_hardware_concurrency: () => { #if ENVIRONMENT_MAY_BE_NODE - if (ENVIRONMENT_IS_NODE) return require('os').cpus().length; + if (ENVIRONMENT_IS_NODE) return require('node:os').cpus().length; #endif return navigator['hardwareConcurrency']; }, diff --git a/src/preamble.js b/src/preamble.js index 98e0af7358d03..7b82233c2e500 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -654,7 +654,7 @@ function instantiateSync(file, info) { var binary = getBinarySync(file); #if NODE_CODE_CACHING if (ENVIRONMENT_IS_NODE) { - var v8 = require('v8'); + var v8 = require('node:v8'); // Include the V8 version in the cache name, so that we don't try to // load cached code from another version, which fails silently (it seems // to load ok, but we do actually recompile the binary every time). diff --git a/src/proxyClient.js b/src/proxyClient.js index 828ce4f381083..db5218893ce62 100644 --- a/src/proxyClient.js +++ b/src/proxyClient.js @@ -18,7 +18,7 @@ #if ENVIRONMENT_MAY_BE_NODE var ENVIRONMENT_IS_NODE = typeof process == 'object' && typeof process.versions == 'object' && typeof process.versions.node == 'string' && process.type != 'renderer'; if (ENVIRONMENT_IS_NODE) { - var NodeWorker = require('worker_threads').Worker; + var NodeWorker = require('node:worker_threads').Worker; global.Worker = function(url, options) { // Special handling for `data:` URL argument, to match the behaviour // of the Web API. diff --git a/src/runtime_shared.js b/src/runtime_shared.js index 850e0859ae051..032d8f3d7f2bf 100644 --- a/src/runtime_shared.js +++ b/src/runtime_shared.js @@ -91,6 +91,6 @@ if (ENVIRONMENT_IS_NODE) { // depends on it for accurate timing. // Use `global` rather than `globalThis` here since older versions of node // don't have `globalThis`. - global.performance ??= require('perf_hooks').performance; + global.performance ??= require('node:perf_hooks').performance; } #endif diff --git a/src/shell.js b/src/shell.js index d7432a26e71a7..adbea243b1101 100644 --- a/src/shell.js +++ b/src/shell.js @@ -103,13 +103,13 @@ if (ENVIRONMENT_IS_NODE) { #if EXPORT_ES6 // When building an ES module `require` is not normally available. // We need to use `createRequire()` to construct the require()` function. - const { createRequire } = await import('module'); + const { createRequire } = await import('node:module'); /** @suppress{duplicate} */ var require = createRequire(import.meta.url); #endif #if PTHREADS || WASM_WORKERS - var worker_threads = require('worker_threads'); + var worker_threads = require('node:worker_threads'); global.Worker = worker_threads.Worker; ENVIRONMENT_IS_WORKER = !worker_threads.isMainThread; #if PTHREADS @@ -196,8 +196,8 @@ if (ENVIRONMENT_IS_NODE) { // These modules will usually be used on Node.js. Load them eagerly to avoid // the complexity of lazy-loading. - var fs = require('fs'); - var nodePath = require('path'); + var fs = require('node:fs'); + var nodePath = require('node:path'); #if EXPORT_ES6 // EXPORT_ES6 + ENVIRONMENT_IS_NODE always requires use of import.meta.url, diff --git a/src/shell_minimal.js b/src/shell_minimal.js index 60c7089602559..5146c527c5509 100644 --- a/src/shell_minimal.js +++ b/src/shell_minimal.js @@ -94,7 +94,7 @@ if (ENVIRONMENT_IS_NODE && ENVIRONMENT_IS_SHELL) { var defaultPrint = console.log.bind(console); var defaultPrintErr = console.error.bind(console); if (ENVIRONMENT_IS_NODE) { - var fs = require('fs'); + var fs = require('node:fs'); defaultPrint = (...args) => fs.writeSync(1, args.join(' ') + '\n'); defaultPrintErr = (...args) => fs.writeSync(2, args.join(' ') + '\n'); } @@ -167,7 +167,7 @@ if (!ENVIRONMENT_IS_PTHREAD) { // Wasm or Wasm2JS loading: if (ENVIRONMENT_IS_NODE) { - var fs = require('fs'); + var fs = require('node:fs'); #if WASM == 2 if (typeof WebAssembly != 'undefined') Module['wasm'] = fs.readFileSync(__dirname + '/{{{ TARGET_BASENAME }}}.wasm'); else eval(fs.readFileSync(__dirname + '/{{{ TARGET_BASENAME }}}.wasm.js')+''); diff --git a/src/wasm_worker.js b/src/wasm_worker.js index 57ac4a6d7925f..f1afa4773688d 100644 --- a/src/wasm_worker.js +++ b/src/wasm_worker.js @@ -10,7 +10,7 @@ var ENVIRONMENT_IS_NODE = typeof process == 'object' && typeof process.versions if (ENVIRONMENT_IS_NODE) { // Create as web-worker-like an environment as we can. - var nodeWorkerThreads = require('worker_threads'); + var nodeWorkerThreads = require('node:worker_threads'); var parentPort = nodeWorkerThreads.parentPort; @@ -28,8 +28,8 @@ if (ENVIRONMENT_IS_NODE) { return f; } - var fs = require('fs'); - var vm = require('vm'); + var fs = require('node:fs'); + var vm = require('node:vm'); Object.assign(global, { self: global, diff --git a/tools/file_packager.py b/tools/file_packager.py index 8ea047b797c9c..d80ae5566eb6f 100755 --- a/tools/file_packager.py +++ b/tools/file_packager.py @@ -950,7 +950,7 @@ def generate_js(data_target, data_files, metadata): if options.support_node: node_support_code = ''' if (isNode) { - require('fs').readFile(packageName, (err, contents) => { + require('node:fs').readFile(packageName, (err, contents) => { if (err) { errback(err); } else { @@ -1108,7 +1108,7 @@ def generate_js(data_target, data_files, metadata): if options.support_node: node_support_code = ''' if (isNode) { - require('fs').readFile(metadataUrl, 'utf8', (err, contents) => { + require('node:fs').readFile(metadataUrl, 'utf8', (err, contents) => { if (err) { return Promise.reject(err); } else { diff --git a/tools/link.py b/tools/link.py index 6c8e64fc3ebe0..5a5551b6bc125 100644 --- a/tools/link.py +++ b/tools/link.py @@ -2361,9 +2361,9 @@ def node_pthread_detection(): # Under node we detect that we are running in a pthread by checking the # workerData property. if settings.EXPORT_ES6: - return "(await import('worker_threads')).workerData === 'em-pthread';\n" + return "(await import('node:worker_threads')).workerData === 'em-pthread';\n" else: - return "require('worker_threads').workerData === 'em-pthread'\n" + return "require('node:worker_threads').workerData === 'em-pthread'\n" def modularize(): From f0ecfd64048d25a73479bc81c72ace29d05dc94a Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Sat, 10 Jan 2026 16:27:11 +0100 Subject: [PATCH 2/8] Remove `node:` prefix when targeting Node.js < 16 --- src/babel-plugins/strip-node-prefix.js | 37 ++++++++++++++++++++++++++ test/test_other.py | 9 +++++++ tools/building.py | 7 +++++ 3 files changed, 53 insertions(+) create mode 100644 src/babel-plugins/strip-node-prefix.js diff --git a/src/babel-plugins/strip-node-prefix.js b/src/babel-plugins/strip-node-prefix.js new file mode 100644 index 0000000000000..24cdb7ed7c14f --- /dev/null +++ b/src/babel-plugins/strip-node-prefix.js @@ -0,0 +1,37 @@ +import { types as t } from '@babel/core'; + +export default function () { + return { + name: 'strip-node-prefix', + visitor: { + // e.g. `import fs from 'node:fs'` + ImportDeclaration({ node }) { + if (node.source.value.startsWith('node:')) { + node.source.value = node.source.value.slice(5); + } + }, + + // e.g. `await import('node:fs')` + // Note: only here for reference, it's mangled with EMSCRIPTEN$AWAIT$IMPORT below. + ImportExpression({ node }) { + if (t.isStringLiteral(node.source) && node.source.value.startsWith('node:')) { + node.source.value = node.source.value.slice(5); + } + }, + + // e.g. `require('node:fs')` or EMSCRIPTEN$AWAIT$IMPORT('node:fs') + CallExpression({ node }) { + if ( + (t.isIdentifier(node.callee, { name: 'require' }) || + // Special placeholder for `await import` + // FIXME: Remove after PR https://github.com/emscripten-core/emscripten/pull/23730 is landed. + t.isIdentifier(node.callee, { name: 'EMSCRIPTEN$AWAIT$IMPORT' })) && + t.isStringLiteral(node.arguments[0]) && + node.arguments[0].value.startsWith('node:') + ) { + node.arguments[0].value = node.arguments[0].value.slice(5); + } + }, + }, + }; +} diff --git a/test/test_other.py b/test/test_other.py index cf5172cc00044..4acf335c916b9 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -13301,6 +13301,15 @@ def check_for_es6(filename, expect): self.do_runf('test.c', expected, cflags=['--closure=1'], output_basename='test_closure') check_for_es6('test_closure.js', False) + def test_node_prefix_transpile(self): + self.run_process([EMCC, test_file('hello_world.c'), '-sEXPORT_ES6']) + content = read_file('a.out.js') + self.assertContained('node:', content) + + self.run_process([EMCC, test_file('hello_world.c'), '-sEXPORT_ES6', '-sMIN_NODE_VERSION=150000']) + content = read_file('a.out.js') + self.assertNotContained('node:', content) + def test_gmtime_noleak(self): # Confirm that gmtime_r does not leak when called in isolation. self.cflags.append('-fsanitize=leak') diff --git a/tools/building.py b/tools/building.py index dcdc03fc458ef..8b82aea457649 100644 --- a/tools/building.py +++ b/tools/building.py @@ -545,7 +545,13 @@ def transpile(filename): config = { 'sourceType': 'script', 'presets': ['@babel/preset-env'], + 'plugins': [], 'targets': {}, + 'parserOpts': { + # FIXME: Remove when updating to Babel 8, see: + # https://babeljs.io/docs/v8-migration-api#javascript-nodes + 'createImportExpressions': True + }, } if settings.MIN_CHROME_VERSION != UNSUPPORTED: config['targets']['chrome'] = str(settings.MIN_CHROME_VERSION) @@ -555,6 +561,7 @@ def transpile(filename): config['targets']['safari'] = version_split(settings.MIN_SAFARI_VERSION) if settings.MIN_NODE_VERSION != UNSUPPORTED: config['targets']['node'] = version_split(settings.MIN_NODE_VERSION) + config['plugins'] = [path_from_root('src/babel-plugins/strip-node-prefix.js')] config_json = json.dumps(config, indent=2) outfile = shared.get_temp_files().get('babel.js').name config_file = shared.get_temp_files().get('babel_config.json').name From 8e55dd789da44f1e44b1aa809d8457d5b1009ade Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Sat, 10 Jan 2026 21:22:49 +0000 Subject: [PATCH 3/8] Automatic rebaseline of codesize expectations. NFC This is an automatic change generated by tools/maint/rebaseline_tests.py. The following (48) test expectation files were updated by running the tests with `--rebaseline`: ``` codesize/test_codesize_cxx_ctors1.json: 149109 => 149119 [+10 bytes / +0.01%] codesize/test_codesize_cxx_ctors2.json: 148513 => 148523 [+10 bytes / +0.01%] codesize/test_codesize_cxx_except.json: 194578 => 194588 [+10 bytes / +0.01%] codesize/test_codesize_cxx_except_wasm.json: 164093 => 164098 [+5 bytes / +0.00%] codesize/test_codesize_cxx_except_wasm_legacy.json: 161751 => 161761 [+10 bytes / +0.01%] codesize/test_codesize_cxx_lto.json: 125441 => 125451 [+10 bytes / +0.01%] codesize/test_codesize_cxx_mangle.json: 258655 => 258665 [+10 bytes / +0.00%] codesize/test_codesize_cxx_noexcept.json: 151526 => 151536 [+10 bytes / +0.01%] codesize/test_codesize_cxx_wasmfs.json: 177088 => 177098 [+10 bytes / +0.01%] test/codesize/test_codesize_file_preload.expected.js updated codesize/test_codesize_file_preload.json: 24242 => 24252 [+10 bytes / +0.04%] codesize/test_codesize_files_js_fs.json: 18654 => 18664 [+10 bytes / +0.05%] codesize/test_codesize_files_wasmfs.json: 56055 => 56065 [+10 bytes / +0.02%] codesize/test_codesize_hello_O0.json: 39358 => 39363 [+5 bytes / +0.01%] codesize/test_codesize_hello_O1.json: 9020 => 9025 [+5 bytes / +0.06%] codesize/test_codesize_hello_O2.json: 6246 => 6251 [+5 bytes / +0.08%] codesize/test_codesize_hello_O3.json: 5942 => 5947 [+5 bytes / +0.08%] codesize/test_codesize_hello_Os.json: 5932 => 5937 [+5 bytes / +0.08%] codesize/test_codesize_hello_Oz.json: 5101 => 5106 [+5 bytes / +0.10%] codesize/test_codesize_hello_dylink.json: 44425 => 44435 [+10 bytes / +0.02%] codesize/test_codesize_hello_dylink_all.json: 822630 => 822655 [+25 bytes / +0.00%] codesize/test_codesize_hello_export_nothing.json: 3215 => 3220 [+5 bytes / +0.16%] codesize/test_codesize_hello_single_file.json: 5366 => 5371 [+5 bytes / +0.09%] codesize/test_codesize_hello_wasmfs.json: 5942 => 5947 [+5 bytes / +0.08%] codesize/test_codesize_libcxxabi_message_O3.json: 3612 => 3617 [+5 bytes / +0.14%] codesize/test_codesize_libcxxabi_message_O3_standalone.json: 3702 => 3707 [+5 bytes / +0.14%] codesize/test_codesize_mem_O3.json: 9610 => 9615 [+5 bytes / +0.05%] codesize/test_codesize_mem_O3_grow.json: 9896 => 9901 [+5 bytes / +0.05%] codesize/test_codesize_mem_O3_grow_standalone.json: 9649 => 9654 [+5 bytes / +0.05%] codesize/test_codesize_mem_O3_standalone.json: 9507 => 9512 [+5 bytes / +0.05%] codesize/test_codesize_mem_O3_standalone_lib.json: 8802 => 8807 [+5 bytes / +0.06%] codesize/test_codesize_mem_O3_standalone_narg.json: 8835 => 8840 [+5 bytes / +0.06%] codesize/test_codesize_mem_O3_standalone_narg_flto.json: 7777 => 7782 [+5 bytes / +0.06%] codesize/test_codesize_minimal_64.json: 2679 => 2684 [+5 bytes / +0.19%] test/codesize/test_codesize_minimal_O0.expected.js updated codesize/test_codesize_minimal_O0.json: 20629 => 20634 [+5 bytes / +0.02%] codesize/test_codesize_minimal_O1.json: 3510 => 3515 [+5 bytes / +0.14%] codesize/test_codesize_minimal_O2.json: 2632 => 2637 [+5 bytes / +0.19%] codesize/test_codesize_minimal_O3.json: 2368 => 2373 [+5 bytes / +0.21%] codesize/test_codesize_minimal_Os.json: 2368 => 2373 [+5 bytes / +0.21%] codesize/test_codesize_minimal_Os_mr.json: 572 => 577 [+5 bytes / +0.87%] codesize/test_codesize_minimal_Oz-ctors.json: 2336 => 2341 [+5 bytes / +0.21%] codesize/test_codesize_minimal_Oz.json: 2368 => 2373 [+5 bytes / +0.21%] codesize/test_codesize_minimal_esm.json: 2504 => 2524 [+20 bytes / +0.80%] codesize/test_codesize_minimal_pthreads.json: 27298 => 27313 [+15 bytes / +0.05%] codesize/test_codesize_minimal_pthreads_memgrowth.json: 27721 => 27737 [+16 bytes / +0.06%] codesize/test_codesize_minimal_wasmfs.json: 2368 => 2373 [+5 bytes / +0.21%] codesize/test_unoptimized_code_size.json: 180979 => 180994 [+15 bytes / +0.01%] Average change: +0.11% (+0.00% - +0.87%) ``` --- test/codesize/test_codesize_cxx_ctors1.json | 8 ++++---- test/codesize/test_codesize_cxx_ctors2.json | 8 ++++---- test/codesize/test_codesize_cxx_except.json | 8 ++++---- test/codesize/test_codesize_cxx_except_wasm.json | 8 ++++---- .../test_codesize_cxx_except_wasm_legacy.json | 8 ++++---- test/codesize/test_codesize_cxx_lto.json | 8 ++++---- test/codesize/test_codesize_cxx_mangle.json | 8 ++++---- test/codesize/test_codesize_cxx_noexcept.json | 8 ++++---- test/codesize/test_codesize_cxx_wasmfs.json | 8 ++++---- .../test_codesize_file_preload.expected.js | 4 ++-- test/codesize/test_codesize_file_preload.json | 8 ++++---- test/codesize/test_codesize_files_js_fs.json | 8 ++++---- test/codesize/test_codesize_files_wasmfs.json | 8 ++++---- test/codesize/test_codesize_hello_O0.json | 8 ++++---- test/codesize/test_codesize_hello_O1.json | 8 ++++---- test/codesize/test_codesize_hello_O2.json | 8 ++++---- test/codesize/test_codesize_hello_O3.json | 8 ++++---- test/codesize/test_codesize_hello_Os.json | 8 ++++---- test/codesize/test_codesize_hello_Oz.json | 8 ++++---- test/codesize/test_codesize_hello_dylink.json | 8 ++++---- .../codesize/test_codesize_hello_dylink_all.json | 4 ++-- .../test_codesize_hello_export_nothing.json | 8 ++++---- .../test_codesize_hello_single_file.json | 4 ++-- test/codesize/test_codesize_hello_wasmfs.json | 8 ++++---- .../test_codesize_libcxxabi_message_O3.json | 8 ++++---- ...codesize_libcxxabi_message_O3_standalone.json | 8 ++++---- test/codesize/test_codesize_mem_O3.json | 8 ++++---- test/codesize/test_codesize_mem_O3_grow.json | 8 ++++---- .../test_codesize_mem_O3_grow_standalone.json | 8 ++++---- .../test_codesize_mem_O3_standalone.json | 8 ++++---- .../test_codesize_mem_O3_standalone_lib.json | 8 ++++---- .../test_codesize_mem_O3_standalone_narg.json | 8 ++++---- ...est_codesize_mem_O3_standalone_narg_flto.json | 8 ++++---- test/codesize/test_codesize_minimal_64.json | 8 ++++---- .../test_codesize_minimal_O0.expected.js | 2 +- test/codesize/test_codesize_minimal_O0.json | 8 ++++---- test/codesize/test_codesize_minimal_O1.json | 8 ++++---- test/codesize/test_codesize_minimal_O2.json | 8 ++++---- test/codesize/test_codesize_minimal_O3.json | 8 ++++---- test/codesize/test_codesize_minimal_Os.json | 8 ++++---- test/codesize/test_codesize_minimal_Os_mr.json | 8 ++++---- .../codesize/test_codesize_minimal_Oz-ctors.json | 8 ++++---- test/codesize/test_codesize_minimal_Oz.json | 8 ++++---- test/codesize/test_codesize_minimal_esm.json | 8 ++++---- .../codesize/test_codesize_minimal_pthreads.json | 4 ++-- ...test_codesize_minimal_pthreads_memgrowth.json | 8 ++++---- test/codesize/test_codesize_minimal_wasmfs.json | 8 ++++---- test/codesize/test_unoptimized_code_size.json | 16 ++++++++-------- 48 files changed, 185 insertions(+), 185 deletions(-) diff --git a/test/codesize/test_codesize_cxx_ctors1.json b/test/codesize/test_codesize_cxx_ctors1.json index dba0aa4e9fc8c..c7fb3ee610c30 100644 --- a/test/codesize/test_codesize_cxx_ctors1.json +++ b/test/codesize/test_codesize_cxx_ctors1.json @@ -1,10 +1,10 @@ { - "a.out.js": 19654, - "a.out.js.gz": 8145, + "a.out.js": 19664, + "a.out.js.gz": 8146, "a.out.nodebug.wasm": 129455, "a.out.nodebug.wasm.gz": 49210, - "total": 149109, - "total_gz": 57355, + "total": 149119, + "total_gz": 57356, "sent": [ "__cxa_throw", "_abort_js", diff --git a/test/codesize/test_codesize_cxx_ctors2.json b/test/codesize/test_codesize_cxx_ctors2.json index 4ac37d943f09e..51bb0101384da 100644 --- a/test/codesize/test_codesize_cxx_ctors2.json +++ b/test/codesize/test_codesize_cxx_ctors2.json @@ -1,10 +1,10 @@ { - "a.out.js": 19631, - "a.out.js.gz": 8132, + "a.out.js": 19641, + "a.out.js.gz": 8133, "a.out.nodebug.wasm": 128882, "a.out.nodebug.wasm.gz": 48854, - "total": 148513, - "total_gz": 56986, + "total": 148523, + "total_gz": 56987, "sent": [ "__cxa_throw", "_abort_js", diff --git a/test/codesize/test_codesize_cxx_except.json b/test/codesize/test_codesize_cxx_except.json index 15cb284562627..b065f8233d12a 100644 --- a/test/codesize/test_codesize_cxx_except.json +++ b/test/codesize/test_codesize_cxx_except.json @@ -1,10 +1,10 @@ { - "a.out.js": 23315, - "a.out.js.gz": 9125, + "a.out.js": 23325, + "a.out.js.gz": 9127, "a.out.nodebug.wasm": 171263, "a.out.nodebug.wasm.gz": 57315, - "total": 194578, - "total_gz": 66440, + "total": 194588, + "total_gz": 66442, "sent": [ "__cxa_begin_catch", "__cxa_end_catch", diff --git a/test/codesize/test_codesize_cxx_except_wasm.json b/test/codesize/test_codesize_cxx_except_wasm.json index 617b3ba6f4c9d..afd0bc39e3036 100644 --- a/test/codesize/test_codesize_cxx_except_wasm.json +++ b/test/codesize/test_codesize_cxx_except_wasm.json @@ -1,10 +1,10 @@ { - "a.out.js": 19470, - "a.out.js.gz": 8070, + "a.out.js": 19475, + "a.out.js.gz": 8072, "a.out.nodebug.wasm": 144623, "a.out.nodebug.wasm.gz": 54880, - "total": 164093, - "total_gz": 62950, + "total": 164098, + "total_gz": 62952, "sent": [ "_abort_js", "_tzset_js", diff --git a/test/codesize/test_codesize_cxx_except_wasm_legacy.json b/test/codesize/test_codesize_cxx_except_wasm_legacy.json index 9b485ecfe69ea..2871a90de0a15 100644 --- a/test/codesize/test_codesize_cxx_except_wasm_legacy.json +++ b/test/codesize/test_codesize_cxx_except_wasm_legacy.json @@ -1,10 +1,10 @@ { - "a.out.js": 19539, - "a.out.js.gz": 8089, + "a.out.js": 19549, + "a.out.js.gz": 8091, "a.out.nodebug.wasm": 142212, "a.out.nodebug.wasm.gz": 54344, - "total": 161751, - "total_gz": 62433, + "total": 161761, + "total_gz": 62435, "sent": [ "_abort_js", "_tzset_js", diff --git a/test/codesize/test_codesize_cxx_lto.json b/test/codesize/test_codesize_cxx_lto.json index f940e9bb676e5..d79f825fb708d 100644 --- a/test/codesize/test_codesize_cxx_lto.json +++ b/test/codesize/test_codesize_cxx_lto.json @@ -1,10 +1,10 @@ { - "a.out.js": 18993, - "a.out.js.gz": 7823, + "a.out.js": 19003, + "a.out.js.gz": 7825, "a.out.nodebug.wasm": 106448, "a.out.nodebug.wasm.gz": 42638, - "total": 125441, - "total_gz": 50461, + "total": 125451, + "total_gz": 50463, "sent": [ "a (emscripten_resize_heap)", "b (_setitimer_js)", diff --git a/test/codesize/test_codesize_cxx_mangle.json b/test/codesize/test_codesize_cxx_mangle.json index a7dc6f34822f3..3c4a33bcb7c61 100644 --- a/test/codesize/test_codesize_cxx_mangle.json +++ b/test/codesize/test_codesize_cxx_mangle.json @@ -1,10 +1,10 @@ { - "a.out.js": 23365, - "a.out.js.gz": 9145, + "a.out.js": 23375, + "a.out.js.gz": 9147, "a.out.nodebug.wasm": 235290, "a.out.nodebug.wasm.gz": 78917, - "total": 258655, - "total_gz": 88062, + "total": 258665, + "total_gz": 88064, "sent": [ "__cxa_begin_catch", "__cxa_end_catch", diff --git a/test/codesize/test_codesize_cxx_noexcept.json b/test/codesize/test_codesize_cxx_noexcept.json index 04ad444871798..3ec0e9711c96a 100644 --- a/test/codesize/test_codesize_cxx_noexcept.json +++ b/test/codesize/test_codesize_cxx_noexcept.json @@ -1,10 +1,10 @@ { - "a.out.js": 19654, - "a.out.js.gz": 8145, + "a.out.js": 19664, + "a.out.js.gz": 8146, "a.out.nodebug.wasm": 131872, "a.out.nodebug.wasm.gz": 50209, - "total": 151526, - "total_gz": 58354, + "total": 151536, + "total_gz": 58355, "sent": [ "__cxa_throw", "_abort_js", diff --git a/test/codesize/test_codesize_cxx_wasmfs.json b/test/codesize/test_codesize_cxx_wasmfs.json index 273f67c8ec3e1..45f5678e3b516 100644 --- a/test/codesize/test_codesize_cxx_wasmfs.json +++ b/test/codesize/test_codesize_cxx_wasmfs.json @@ -1,10 +1,10 @@ { - "a.out.js": 7043, - "a.out.js.gz": 3322, + "a.out.js": 7053, + "a.out.js.gz": 3325, "a.out.nodebug.wasm": 170045, "a.out.nodebug.wasm.gz": 62927, - "total": 177088, - "total_gz": 66249, + "total": 177098, + "total_gz": 66252, "sent": [ "__cxa_throw", "_abort_js", diff --git a/test/codesize/test_codesize_file_preload.expected.js b/test/codesize/test_codesize_file_preload.expected.js index 6f271cf72afc0..133664706cd2c 100644 --- a/test/codesize/test_codesize_file_preload.expected.js +++ b/test/codesize/test_codesize_file_preload.expected.js @@ -190,7 +190,7 @@ var readAsync, readBinary; if (ENVIRONMENT_IS_NODE) { // These modules will usually be used on Node.js. Load them eagerly to avoid // the complexity of lazy-loading. - var fs = require("fs"); + var fs = require("node:fs"); scriptDirectory = __dirname + "/"; // include: node_shell_read.js readBinary = filename => { @@ -603,7 +603,7 @@ var PATH = { var initRandomFill = () => { // This block is not needed on v19+ since crypto.getRandomValues is builtin if (ENVIRONMENT_IS_NODE) { - var nodeCrypto = require("crypto"); + var nodeCrypto = require("node:crypto"); return view => nodeCrypto.randomFillSync(view); } return view => crypto.getRandomValues(view); diff --git a/test/codesize/test_codesize_file_preload.json b/test/codesize/test_codesize_file_preload.json index 3a486bce4d356..f3f9b8b4c2060 100644 --- a/test/codesize/test_codesize_file_preload.json +++ b/test/codesize/test_codesize_file_preload.json @@ -1,10 +1,10 @@ { - "a.out.js": 22561, - "a.out.js.gz": 9336, + "a.out.js": 22571, + "a.out.js.gz": 9339, "a.out.nodebug.wasm": 1681, "a.out.nodebug.wasm.gz": 960, - "total": 24242, - "total_gz": 10296, + "total": 24252, + "total_gz": 10299, "sent": [ "a (fd_write)" ], diff --git a/test/codesize/test_codesize_files_js_fs.json b/test/codesize/test_codesize_files_js_fs.json index 1e6532c6790b5..394c9faa62526 100644 --- a/test/codesize/test_codesize_files_js_fs.json +++ b/test/codesize/test_codesize_files_js_fs.json @@ -1,10 +1,10 @@ { - "a.out.js": 18273, - "a.out.js.gz": 7462, + "a.out.js": 18283, + "a.out.js.gz": 7464, "a.out.nodebug.wasm": 381, "a.out.nodebug.wasm.gz": 260, - "total": 18654, - "total_gz": 7722, + "total": 18664, + "total_gz": 7724, "sent": [ "a (fd_write)", "b (fd_read)", diff --git a/test/codesize/test_codesize_files_wasmfs.json b/test/codesize/test_codesize_files_wasmfs.json index 92c970d70925d..0d99686c8764b 100644 --- a/test/codesize/test_codesize_files_wasmfs.json +++ b/test/codesize/test_codesize_files_wasmfs.json @@ -1,10 +1,10 @@ { - "a.out.js": 5465, - "a.out.js.gz": 2576, + "a.out.js": 5475, + "a.out.js.gz": 2578, "a.out.nodebug.wasm": 50590, "a.out.nodebug.wasm.gz": 18089, - "total": 56055, - "total_gz": 20665, + "total": 56065, + "total_gz": 20667, "sent": [ "a (emscripten_date_now)", "b (emscripten_err)", diff --git a/test/codesize/test_codesize_hello_O0.json b/test/codesize/test_codesize_hello_O0.json index 1937b4808b565..ae1c3e5fc6f88 100644 --- a/test/codesize/test_codesize_hello_O0.json +++ b/test/codesize/test_codesize_hello_O0.json @@ -1,10 +1,10 @@ { - "a.out.js": 24220, - "a.out.js.gz": 8700, + "a.out.js": 24225, + "a.out.js.gz": 8703, "a.out.nodebug.wasm": 15138, "a.out.nodebug.wasm.gz": 7455, - "total": 39358, - "total_gz": 16155, + "total": 39363, + "total_gz": 16158, "sent": [ "fd_write" ], diff --git a/test/codesize/test_codesize_hello_O1.json b/test/codesize/test_codesize_hello_O1.json index 9525cad3cc8c3..9c4d7260067b2 100644 --- a/test/codesize/test_codesize_hello_O1.json +++ b/test/codesize/test_codesize_hello_O1.json @@ -1,10 +1,10 @@ { - "a.out.js": 6345, - "a.out.js.gz": 2460, + "a.out.js": 6350, + "a.out.js.gz": 2462, "a.out.nodebug.wasm": 2675, "a.out.nodebug.wasm.gz": 1491, - "total": 9020, - "total_gz": 3951, + "total": 9025, + "total_gz": 3953, "sent": [ "fd_write" ], diff --git a/test/codesize/test_codesize_hello_O2.json b/test/codesize/test_codesize_hello_O2.json index c0f30e38d682c..c22ad426dd9a4 100644 --- a/test/codesize/test_codesize_hello_O2.json +++ b/test/codesize/test_codesize_hello_O2.json @@ -1,10 +1,10 @@ { - "a.out.js": 4319, - "a.out.js.gz": 2131, + "a.out.js": 4324, + "a.out.js.gz": 2134, "a.out.nodebug.wasm": 1927, "a.out.nodebug.wasm.gz": 1138, - "total": 6246, - "total_gz": 3269, + "total": 6251, + "total_gz": 3272, "sent": [ "fd_write" ], diff --git a/test/codesize/test_codesize_hello_O3.json b/test/codesize/test_codesize_hello_O3.json index 1b9f5f4d33fd2..29437d2ab4ab1 100644 --- a/test/codesize/test_codesize_hello_O3.json +++ b/test/codesize/test_codesize_hello_O3.json @@ -1,10 +1,10 @@ { - "a.out.js": 4261, - "a.out.js.gz": 2091, + "a.out.js": 4266, + "a.out.js.gz": 2093, "a.out.nodebug.wasm": 1681, "a.out.nodebug.wasm.gz": 960, - "total": 5942, - "total_gz": 3051, + "total": 5947, + "total_gz": 3053, "sent": [ "a (fd_write)" ], diff --git a/test/codesize/test_codesize_hello_Os.json b/test/codesize/test_codesize_hello_Os.json index 560a05125f5ce..5f6563e9658b4 100644 --- a/test/codesize/test_codesize_hello_Os.json +++ b/test/codesize/test_codesize_hello_Os.json @@ -1,10 +1,10 @@ { - "a.out.js": 4261, - "a.out.js.gz": 2091, + "a.out.js": 4266, + "a.out.js.gz": 2093, "a.out.nodebug.wasm": 1671, "a.out.nodebug.wasm.gz": 964, - "total": 5932, - "total_gz": 3055, + "total": 5937, + "total_gz": 3057, "sent": [ "a (fd_write)" ], diff --git a/test/codesize/test_codesize_hello_Oz.json b/test/codesize/test_codesize_hello_Oz.json index 257881bb2e175..cbddd1fb6b2ae 100644 --- a/test/codesize/test_codesize_hello_Oz.json +++ b/test/codesize/test_codesize_hello_Oz.json @@ -1,10 +1,10 @@ { - "a.out.js": 3896, - "a.out.js.gz": 1895, + "a.out.js": 3901, + "a.out.js.gz": 1899, "a.out.nodebug.wasm": 1205, "a.out.nodebug.wasm.gz": 740, - "total": 5101, - "total_gz": 2635, + "total": 5106, + "total_gz": 2639, "sent": [ "a (fd_write)" ], diff --git a/test/codesize/test_codesize_hello_dylink.json b/test/codesize/test_codesize_hello_dylink.json index 6ce5218a1b710..e3faee66565a1 100644 --- a/test/codesize/test_codesize_hello_dylink.json +++ b/test/codesize/test_codesize_hello_dylink.json @@ -1,10 +1,10 @@ { - "a.out.js": 26695, - "a.out.js.gz": 11394, + "a.out.js": 26705, + "a.out.js.gz": 11396, "a.out.nodebug.wasm": 17730, "a.out.nodebug.wasm.gz": 8957, - "total": 44425, - "total_gz": 20351, + "total": 44435, + "total_gz": 20353, "sent": [ "__syscall_stat64", "emscripten_resize_heap", diff --git a/test/codesize/test_codesize_hello_dylink_all.json b/test/codesize/test_codesize_hello_dylink_all.json index 0ba509a1d7f0c..ba41ce7cb9548 100644 --- a/test/codesize/test_codesize_hello_dylink_all.json +++ b/test/codesize/test_codesize_hello_dylink_all.json @@ -1,7 +1,7 @@ { - "a.out.js": 244848, + "a.out.js": 244873, "a.out.nodebug.wasm": 577782, - "total": 822630, + "total": 822655, "sent": [ "IMG_Init", "IMG_Load", diff --git a/test/codesize/test_codesize_hello_export_nothing.json b/test/codesize/test_codesize_hello_export_nothing.json index a5690f5c08997..fbfe75ffeaff4 100644 --- a/test/codesize/test_codesize_hello_export_nothing.json +++ b/test/codesize/test_codesize_hello_export_nothing.json @@ -1,10 +1,10 @@ { - "a.out.js": 3172, - "a.out.js.gz": 1479, + "a.out.js": 3177, + "a.out.js.gz": 1483, "a.out.nodebug.wasm": 43, "a.out.nodebug.wasm.gz": 59, - "total": 3215, - "total_gz": 1538, + "total": 3220, + "total_gz": 1542, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_hello_single_file.json b/test/codesize/test_codesize_hello_single_file.json index 14add49122037..531826ef78b44 100644 --- a/test/codesize/test_codesize_hello_single_file.json +++ b/test/codesize/test_codesize_hello_single_file.json @@ -1,6 +1,6 @@ { - "a.out.js": 5366, - "a.out.js.gz": 2982, + "a.out.js": 5371, + "a.out.js.gz": 2984, "sent": [ "a (fd_write)" ] diff --git a/test/codesize/test_codesize_hello_wasmfs.json b/test/codesize/test_codesize_hello_wasmfs.json index 1b9f5f4d33fd2..29437d2ab4ab1 100644 --- a/test/codesize/test_codesize_hello_wasmfs.json +++ b/test/codesize/test_codesize_hello_wasmfs.json @@ -1,10 +1,10 @@ { - "a.out.js": 4261, - "a.out.js.gz": 2091, + "a.out.js": 4266, + "a.out.js.gz": 2093, "a.out.nodebug.wasm": 1681, "a.out.nodebug.wasm.gz": 960, - "total": 5942, - "total_gz": 3051, + "total": 5947, + "total_gz": 3053, "sent": [ "a (fd_write)" ], diff --git a/test/codesize/test_codesize_libcxxabi_message_O3.json b/test/codesize/test_codesize_libcxxabi_message_O3.json index 0f93dc4a08eca..bb31d9d714f0f 100644 --- a/test/codesize/test_codesize_libcxxabi_message_O3.json +++ b/test/codesize/test_codesize_libcxxabi_message_O3.json @@ -1,10 +1,10 @@ { - "a.out.js": 3523, - "a.out.js.gz": 1666, + "a.out.js": 3528, + "a.out.js.gz": 1668, "a.out.nodebug.wasm": 89, "a.out.nodebug.wasm.gz": 98, - "total": 3612, - "total_gz": 1764, + "total": 3617, + "total_gz": 1766, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_libcxxabi_message_O3_standalone.json b/test/codesize/test_codesize_libcxxabi_message_O3_standalone.json index 6ba822d4f6864..7c642202b392d 100644 --- a/test/codesize/test_codesize_libcxxabi_message_O3_standalone.json +++ b/test/codesize/test_codesize_libcxxabi_message_O3_standalone.json @@ -1,10 +1,10 @@ { - "a.out.js": 3570, - "a.out.js.gz": 1701, + "a.out.js": 3575, + "a.out.js.gz": 1704, "a.out.nodebug.wasm": 132, "a.out.nodebug.wasm.gz": 140, - "total": 3702, - "total_gz": 1841, + "total": 3707, + "total_gz": 1844, "sent": [ "proc_exit" ], diff --git a/test/codesize/test_codesize_mem_O3.json b/test/codesize/test_codesize_mem_O3.json index ece3f64d2aef4..9624d708670c0 100644 --- a/test/codesize/test_codesize_mem_O3.json +++ b/test/codesize/test_codesize_mem_O3.json @@ -1,10 +1,10 @@ { - "a.out.js": 4350, - "a.out.js.gz": 2094, + "a.out.js": 4355, + "a.out.js.gz": 2096, "a.out.nodebug.wasm": 5260, "a.out.nodebug.wasm.gz": 2419, - "total": 9610, - "total_gz": 4513, + "total": 9615, + "total_gz": 4515, "sent": [ "a (emscripten_resize_heap)" ], diff --git a/test/codesize/test_codesize_mem_O3_grow.json b/test/codesize/test_codesize_mem_O3_grow.json index 66585626670b6..ad537a5e34f18 100644 --- a/test/codesize/test_codesize_mem_O3_grow.json +++ b/test/codesize/test_codesize_mem_O3_grow.json @@ -1,10 +1,10 @@ { - "a.out.js": 4635, - "a.out.js.gz": 2243, + "a.out.js": 4640, + "a.out.js.gz": 2246, "a.out.nodebug.wasm": 5261, "a.out.nodebug.wasm.gz": 2419, - "total": 9896, - "total_gz": 4662, + "total": 9901, + "total_gz": 4665, "sent": [ "a (emscripten_resize_heap)" ], diff --git a/test/codesize/test_codesize_mem_O3_grow_standalone.json b/test/codesize/test_codesize_mem_O3_grow_standalone.json index 1c403f7649388..0ff54ce0ef04b 100644 --- a/test/codesize/test_codesize_mem_O3_grow_standalone.json +++ b/test/codesize/test_codesize_mem_O3_grow_standalone.json @@ -1,10 +1,10 @@ { - "a.out.js": 4102, - "a.out.js.gz": 1990, + "a.out.js": 4107, + "a.out.js.gz": 1992, "a.out.nodebug.wasm": 5547, "a.out.nodebug.wasm.gz": 2598, - "total": 9649, - "total_gz": 4588, + "total": 9654, + "total_gz": 4590, "sent": [ "args_get", "args_sizes_get", diff --git a/test/codesize/test_codesize_mem_O3_standalone.json b/test/codesize/test_codesize_mem_O3_standalone.json index d47c439e4f8c3..d861394930631 100644 --- a/test/codesize/test_codesize_mem_O3_standalone.json +++ b/test/codesize/test_codesize_mem_O3_standalone.json @@ -1,10 +1,10 @@ { - "a.out.js": 4035, - "a.out.js.gz": 1954, + "a.out.js": 4040, + "a.out.js.gz": 1956, "a.out.nodebug.wasm": 5472, "a.out.nodebug.wasm.gz": 2539, - "total": 9507, - "total_gz": 4493, + "total": 9512, + "total_gz": 4495, "sent": [ "args_get", "args_sizes_get", diff --git a/test/codesize/test_codesize_mem_O3_standalone_lib.json b/test/codesize/test_codesize_mem_O3_standalone_lib.json index 0b146e54484df..7d7fbbd10778e 100644 --- a/test/codesize/test_codesize_mem_O3_standalone_lib.json +++ b/test/codesize/test_codesize_mem_O3_standalone_lib.json @@ -1,10 +1,10 @@ { - "a.out.js": 3563, - "a.out.js.gz": 1689, + "a.out.js": 3568, + "a.out.js.gz": 1692, "a.out.nodebug.wasm": 5239, "a.out.nodebug.wasm.gz": 2359, - "total": 8802, - "total_gz": 4048, + "total": 8807, + "total_gz": 4051, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_mem_O3_standalone_narg.json b/test/codesize/test_codesize_mem_O3_standalone_narg.json index d69a63960fdb0..6a8940ba4291f 100644 --- a/test/codesize/test_codesize_mem_O3_standalone_narg.json +++ b/test/codesize/test_codesize_mem_O3_standalone_narg.json @@ -1,10 +1,10 @@ { - "a.out.js": 3570, - "a.out.js.gz": 1701, + "a.out.js": 3575, + "a.out.js.gz": 1704, "a.out.nodebug.wasm": 5265, "a.out.nodebug.wasm.gz": 2396, - "total": 8835, - "total_gz": 4097, + "total": 8840, + "total_gz": 4100, "sent": [ "proc_exit" ], diff --git a/test/codesize/test_codesize_mem_O3_standalone_narg_flto.json b/test/codesize/test_codesize_mem_O3_standalone_narg_flto.json index f94ad7a45f75b..e20a8e385dfc4 100644 --- a/test/codesize/test_codesize_mem_O3_standalone_narg_flto.json +++ b/test/codesize/test_codesize_mem_O3_standalone_narg_flto.json @@ -1,10 +1,10 @@ { - "a.out.js": 3570, - "a.out.js.gz": 1701, + "a.out.js": 3575, + "a.out.js.gz": 1704, "a.out.nodebug.wasm": 4207, "a.out.nodebug.wasm.gz": 2104, - "total": 7777, - "total_gz": 3805, + "total": 7782, + "total_gz": 3808, "sent": [ "proc_exit" ], diff --git a/test/codesize/test_codesize_minimal_64.json b/test/codesize/test_codesize_minimal_64.json index 2fcaae6dada80..a3efe1f7f92d7 100644 --- a/test/codesize/test_codesize_minimal_64.json +++ b/test/codesize/test_codesize_minimal_64.json @@ -1,10 +1,10 @@ { - "a.out.js": 2604, - "a.out.js.gz": 1247, + "a.out.js": 2609, + "a.out.js.gz": 1250, "a.out.nodebug.wasm": 75, "a.out.nodebug.wasm.gz": 88, - "total": 2679, - "total_gz": 1335, + "total": 2684, + "total_gz": 1338, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_minimal_O0.expected.js b/test/codesize/test_codesize_minimal_O0.expected.js index 7f5e25905054a..fa80bc9356d67 100644 --- a/test/codesize/test_codesize_minimal_O0.expected.js +++ b/test/codesize/test_codesize_minimal_O0.expected.js @@ -107,7 +107,7 @@ if (ENVIRONMENT_IS_NODE) { // These modules will usually be used on Node.js. Load them eagerly to avoid // the complexity of lazy-loading. - var fs = require('fs'); + var fs = require('node:fs'); scriptDirectory = __dirname + '/'; diff --git a/test/codesize/test_codesize_minimal_O0.json b/test/codesize/test_codesize_minimal_O0.json index f8a4d00f4cb4e..0358131d79bc2 100644 --- a/test/codesize/test_codesize_minimal_O0.json +++ b/test/codesize/test_codesize_minimal_O0.json @@ -1,10 +1,10 @@ { - "a.out.js": 19493, - "a.out.js.gz": 7010, + "a.out.js": 19498, + "a.out.js.gz": 7013, "a.out.nodebug.wasm": 1136, "a.out.nodebug.wasm.gz": 659, - "total": 20629, - "total_gz": 7669, + "total": 20634, + "total_gz": 7672, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_minimal_O1.json b/test/codesize/test_codesize_minimal_O1.json index 392b4ac27d486..1ee812afcbccf 100644 --- a/test/codesize/test_codesize_minimal_O1.json +++ b/test/codesize/test_codesize_minimal_O1.json @@ -1,10 +1,10 @@ { - "a.out.js": 3061, - "a.out.js.gz": 1300, + "a.out.js": 3066, + "a.out.js.gz": 1302, "a.out.nodebug.wasm": 449, "a.out.nodebug.wasm.gz": 337, - "total": 3510, - "total_gz": 1637, + "total": 3515, + "total_gz": 1639, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_minimal_O2.json b/test/codesize/test_codesize_minimal_O2.json index afc724bf811ee..ab0eb13fd26e5 100644 --- a/test/codesize/test_codesize_minimal_O2.json +++ b/test/codesize/test_codesize_minimal_O2.json @@ -1,10 +1,10 @@ { - "a.out.js": 2352, - "a.out.js.gz": 1171, + "a.out.js": 2357, + "a.out.js.gz": 1175, "a.out.nodebug.wasm": 280, "a.out.nodebug.wasm.gz": 226, - "total": 2632, - "total_gz": 1397, + "total": 2637, + "total_gz": 1401, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_minimal_O3.json b/test/codesize/test_codesize_minimal_O3.json index b7ab6c28df39a..2bc3eca6c115a 100644 --- a/test/codesize/test_codesize_minimal_O3.json +++ b/test/codesize/test_codesize_minimal_O3.json @@ -1,10 +1,10 @@ { - "a.out.js": 2293, - "a.out.js.gz": 1137, + "a.out.js": 2298, + "a.out.js.gz": 1140, "a.out.nodebug.wasm": 75, "a.out.nodebug.wasm.gz": 87, - "total": 2368, - "total_gz": 1224, + "total": 2373, + "total_gz": 1227, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_minimal_Os.json b/test/codesize/test_codesize_minimal_Os.json index b7ab6c28df39a..2bc3eca6c115a 100644 --- a/test/codesize/test_codesize_minimal_Os.json +++ b/test/codesize/test_codesize_minimal_Os.json @@ -1,10 +1,10 @@ { - "a.out.js": 2293, - "a.out.js.gz": 1137, + "a.out.js": 2298, + "a.out.js.gz": 1140, "a.out.nodebug.wasm": 75, "a.out.nodebug.wasm.gz": 87, - "total": 2368, - "total_gz": 1224, + "total": 2373, + "total_gz": 1227, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_minimal_Os_mr.json b/test/codesize/test_codesize_minimal_Os_mr.json index ba8b6e7923c80..2f947a492386e 100644 --- a/test/codesize/test_codesize_minimal_Os_mr.json +++ b/test/codesize/test_codesize_minimal_Os_mr.json @@ -1,10 +1,10 @@ { - "a.out.js": 497, - "a.out.js.gz": 297, + "a.out.js": 502, + "a.out.js.gz": 299, "a.out.nodebug.wasm": 75, "a.out.nodebug.wasm.gz": 87, - "total": 572, - "total_gz": 384, + "total": 577, + "total_gz": 386, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_minimal_Oz-ctors.json b/test/codesize/test_codesize_minimal_Oz-ctors.json index d60fdef1cca9b..f299e2edd82f8 100644 --- a/test/codesize/test_codesize_minimal_Oz-ctors.json +++ b/test/codesize/test_codesize_minimal_Oz-ctors.json @@ -1,10 +1,10 @@ { - "a.out.js": 2272, - "a.out.js.gz": 1122, + "a.out.js": 2277, + "a.out.js.gz": 1126, "a.out.nodebug.wasm": 64, "a.out.nodebug.wasm.gz": 80, - "total": 2336, - "total_gz": 1202, + "total": 2341, + "total_gz": 1206, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_minimal_Oz.json b/test/codesize/test_codesize_minimal_Oz.json index b7ab6c28df39a..2bc3eca6c115a 100644 --- a/test/codesize/test_codesize_minimal_Oz.json +++ b/test/codesize/test_codesize_minimal_Oz.json @@ -1,10 +1,10 @@ { - "a.out.js": 2293, - "a.out.js.gz": 1137, + "a.out.js": 2298, + "a.out.js.gz": 1140, "a.out.nodebug.wasm": 75, "a.out.nodebug.wasm.gz": 87, - "total": 2368, - "total_gz": 1224, + "total": 2373, + "total_gz": 1227, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_minimal_esm.json b/test/codesize/test_codesize_minimal_esm.json index 71dc359fe1e37..5a870e26915e3 100644 --- a/test/codesize/test_codesize_minimal_esm.json +++ b/test/codesize/test_codesize_minimal_esm.json @@ -1,10 +1,10 @@ { - "a.out.js": 2429, - "a.out.js.gz": 1168, + "a.out.js": 2449, + "a.out.js.gz": 1174, "a.out.nodebug.wasm": 75, "a.out.nodebug.wasm.gz": 87, - "total": 2504, - "total_gz": 1255, + "total": 2524, + "total_gz": 1261, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_minimal_pthreads.json b/test/codesize/test_codesize_minimal_pthreads.json index d1e1883b60cdc..c25a6b597ddee 100644 --- a/test/codesize/test_codesize_minimal_pthreads.json +++ b/test/codesize/test_codesize_minimal_pthreads.json @@ -1,9 +1,9 @@ { - "a.out.js": 7694, + "a.out.js": 7709, "a.out.js.gz": 3815, "a.out.nodebug.wasm": 19604, "a.out.nodebug.wasm.gz": 9079, - "total": 27298, + "total": 27313, "total_gz": 12894, "sent": [ "a (memory)", diff --git a/test/codesize/test_codesize_minimal_pthreads_memgrowth.json b/test/codesize/test_codesize_minimal_pthreads_memgrowth.json index 5f7594e62933d..f5a03aa70a272 100644 --- a/test/codesize/test_codesize_minimal_pthreads_memgrowth.json +++ b/test/codesize/test_codesize_minimal_pthreads_memgrowth.json @@ -1,10 +1,10 @@ { - "a.out.js": 8116, - "a.out.js.gz": 4015, + "a.out.js": 8132, + "a.out.js.gz": 4016, "a.out.nodebug.wasm": 19605, "a.out.nodebug.wasm.gz": 9080, - "total": 27721, - "total_gz": 13095, + "total": 27737, + "total_gz": 13096, "sent": [ "a (memory)", "b (emscripten_get_now)", diff --git a/test/codesize/test_codesize_minimal_wasmfs.json b/test/codesize/test_codesize_minimal_wasmfs.json index b7ab6c28df39a..2bc3eca6c115a 100644 --- a/test/codesize/test_codesize_minimal_wasmfs.json +++ b/test/codesize/test_codesize_minimal_wasmfs.json @@ -1,10 +1,10 @@ { - "a.out.js": 2293, - "a.out.js.gz": 1137, + "a.out.js": 2298, + "a.out.js.gz": 1140, "a.out.nodebug.wasm": 75, "a.out.nodebug.wasm.gz": 87, - "total": 2368, - "total_gz": 1224, + "total": 2373, + "total_gz": 1227, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_unoptimized_code_size.json b/test/codesize/test_unoptimized_code_size.json index b1c6db56dd000..f17d61b3d3268 100644 --- a/test/codesize/test_unoptimized_code_size.json +++ b/test/codesize/test_unoptimized_code_size.json @@ -1,16 +1,16 @@ { - "hello_world.js": 56957, - "hello_world.js.gz": 17711, + "hello_world.js": 56962, + "hello_world.js.gz": 17713, "hello_world.wasm": 15138, "hello_world.wasm.gz": 7455, - "no_asserts.js": 26627, - "no_asserts.js.gz": 8882, + "no_asserts.js": 26632, + "no_asserts.js.gz": 8885, "no_asserts.wasm": 12187, "no_asserts.wasm.gz": 5984, - "strict.js": 54932, - "strict.js.gz": 17044, + "strict.js": 54937, + "strict.js.gz": 17046, "strict.wasm": 15138, "strict.wasm.gz": 7450, - "total": 180979, - "total_gz": 64526 + "total": 180994, + "total_gz": 64533 } From 71002eebdc33a6e3ad57540adfc2e9e87d20bbd5 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Sun, 11 Jan 2026 10:46:20 +0100 Subject: [PATCH 4/8] Fix tests --- .../{strip-node-prefix.js => strip-node-prefix.mjs} | 0 src/lib/libsockfs.js | 4 ++-- test/test_other.py | 2 +- tools/building.py | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) rename src/babel-plugins/{strip-node-prefix.js => strip-node-prefix.mjs} (100%) diff --git a/src/babel-plugins/strip-node-prefix.js b/src/babel-plugins/strip-node-prefix.mjs similarity index 100% rename from src/babel-plugins/strip-node-prefix.js rename to src/babel-plugins/strip-node-prefix.mjs diff --git a/src/lib/libsockfs.js b/src/lib/libsockfs.js index 7e61f807ba7e1..c226972c9c331 100644 --- a/src/lib/libsockfs.js +++ b/src/lib/libsockfs.js @@ -216,7 +216,7 @@ addToLibrary({ var WebSocketConstructor; #if ENVIRONMENT_MAY_BE_NODE if (ENVIRONMENT_IS_NODE) { - WebSocketConstructor = /** @type{(typeof WebSocket)} */(require('node:ws')); + WebSocketConstructor = /** @type{(typeof WebSocket)} */(require('ws')); } else #endif // ENVIRONMENT_MAY_BE_NODE { @@ -519,7 +519,7 @@ addToLibrary({ if (sock.server) { throw new FS.ErrnoError({{{ cDefs.EINVAL }}}); // already listening } - var WebSocketServer = require('node:ws').Server; + var WebSocketServer = require('ws').Server; var host = sock.saddr; #if SOCKET_DEBUG dbg(`websocket: listen: ${host}:${sock.sport}`); diff --git a/test/test_other.py b/test/test_other.py index 4acf335c916b9..267e4ff94394e 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -13306,7 +13306,7 @@ def test_node_prefix_transpile(self): content = read_file('a.out.js') self.assertContained('node:', content) - self.run_process([EMCC, test_file('hello_world.c'), '-sEXPORT_ES6', '-sMIN_NODE_VERSION=150000']) + self.run_process([EMCC, test_file('hello_world.c'), '-sEXPORT_ES6', '-sMIN_NODE_VERSION=150000', '-Wno-transpile']) content = read_file('a.out.js') self.assertNotContained('node:', content) diff --git a/tools/building.py b/tools/building.py index 8b82aea457649..69f788b0412e7 100644 --- a/tools/building.py +++ b/tools/building.py @@ -550,7 +550,7 @@ def transpile(filename): 'parserOpts': { # FIXME: Remove when updating to Babel 8, see: # https://babeljs.io/docs/v8-migration-api#javascript-nodes - 'createImportExpressions': True + 'createImportExpressions': True, }, } if settings.MIN_CHROME_VERSION != UNSUPPORTED: @@ -561,7 +561,7 @@ def transpile(filename): config['targets']['safari'] = version_split(settings.MIN_SAFARI_VERSION) if settings.MIN_NODE_VERSION != UNSUPPORTED: config['targets']['node'] = version_split(settings.MIN_NODE_VERSION) - config['plugins'] = [path_from_root('src/babel-plugins/strip-node-prefix.js')] + config['plugins'] = [path_from_root('src/babel-plugins/strip-node-prefix.mjs')] config_json = json.dumps(config, indent=2) outfile = shared.get_temp_files().get('babel.js').name config_file = shared.get_temp_files().get('babel_config.json').name From 466a9624d599f4381675a5974d51eefbe168510c Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Fri, 16 Jan 2026 10:57:16 +0100 Subject: [PATCH 5/8] CI: add two previously failing tests to Deno's test suite --- .circleci/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2b52e86414582..b92b0d71870e1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -907,6 +907,8 @@ jobs: core0.test_hello_world core0.test_hello_argc_pthreads core2.test_pthread_create + other.test_esm + other.test_esm_pthreads " test-jsc: executor: linux-python From b907301b3966d3cb76f179a9e7e2720424f458b5 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Fri, 16 Jan 2026 18:50:40 +0100 Subject: [PATCH 6/8] Incorporate review comments --- .circleci/config.yml | 2 ++ src/babel-plugins/strip-node-prefix.mjs | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index b92b0d71870e1..07deb4e66083a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -889,6 +889,8 @@ jobs: core0.test_hello_world core0.test_hello_argc_pthreads core2.test_pthread_create + other.test_esm + other.test_esm_pthreads " test-deno: executor: linux-python diff --git a/src/babel-plugins/strip-node-prefix.mjs b/src/babel-plugins/strip-node-prefix.mjs index 24cdb7ed7c14f..cb60cef088e7a 100644 --- a/src/babel-plugins/strip-node-prefix.mjs +++ b/src/babel-plugins/strip-node-prefix.mjs @@ -1,3 +1,11 @@ +/** + * @license + * Copyright 2026 The Emscripten Authors + * SPDX-License-Identifier: MIT + */ + +// A babel plugin to remove the leading `node:` prefix from all imports. + import { types as t } from '@babel/core'; export default function () { From f9a587e3913370fdc6b55aa18b45d2cf2af6457e Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Fri, 16 Jan 2026 18:51:24 +0100 Subject: [PATCH 7/8] Avoid import --- src/babel-plugins/strip-node-prefix.mjs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/babel-plugins/strip-node-prefix.mjs b/src/babel-plugins/strip-node-prefix.mjs index cb60cef088e7a..c79871a1e3e45 100644 --- a/src/babel-plugins/strip-node-prefix.mjs +++ b/src/babel-plugins/strip-node-prefix.mjs @@ -6,9 +6,7 @@ // A babel plugin to remove the leading `node:` prefix from all imports. -import { types as t } from '@babel/core'; - -export default function () { +export default function ({ types: t }) { return { name: 'strip-node-prefix', visitor: { From dd1f9c0cbe262f47d5510a6423832bd51ed996ff Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Fri, 16 Jan 2026 18:57:28 +0100 Subject: [PATCH 8/8] Make plugin future-proof Transpiling takes only place when targeting Node.js < 16. Ensure the Babel plugin becomes a no-op when the minimum Node.js target is increased. --- src/babel-plugins/strip-node-prefix.mjs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/babel-plugins/strip-node-prefix.mjs b/src/babel-plugins/strip-node-prefix.mjs index c79871a1e3e45..191fce47951ee 100644 --- a/src/babel-plugins/strip-node-prefix.mjs +++ b/src/babel-plugins/strip-node-prefix.mjs @@ -6,7 +6,12 @@ // A babel plugin to remove the leading `node:` prefix from all imports. -export default function ({ types: t }) { +export default function ({ types: t, targets }) { + // Skip this plugin for Node.js >= 16 + if (+targets().node.split('.')[0] >= 16) { + return {}; + } + return { name: 'strip-node-prefix', visitor: {