From 0d3d65c13e30898b0187dbcf1f3ad9d9013cd4fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9?= Date: Thu, 28 May 2026 11:12:47 +0100 Subject: [PATCH 1/3] meta: add `vfs` subsystem label PR-URL: https://github.com/nodejs/node/pull/62331 Refs: https://github.com/nodejs/node/pull/61478 Reviewed-By: Matteo Collina Reviewed-By: James M Snell Reviewed-By: Aviv Keller Reviewed-By: Chemi Atlow Signed-off-by: Renegade334 --- .github/label-pr-config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/label-pr-config.yml b/.github/label-pr-config.yml index 4ff8bee4c56d64..551bee55ababce 100644 --- a/.github/label-pr-config.yml +++ b/.github/label-pr-config.yml @@ -214,6 +214,7 @@ allJsSubSystems: - url - util - v8 + - vfs - vm - wasi - worker From 2cd9d2c845ba301575995da8b5e90da195f6ff35 Mon Sep 17 00:00:00 2001 From: Rafael Gonzaga Date: Thu, 28 May 2026 08:53:20 -0300 Subject: [PATCH 2/3] doc: drop --experimental from --permission Signed-off-by: RafaelGSS PR-URL: https://github.com/nodejs/node/pull/63583 Reviewed-By: Marco Ippolito Reviewed-By: Luigi Pinca Reviewed-By: Matteo Collina --- SECURITY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SECURITY.md b/SECURITY.md index ef2509102fe6a3..55251f7da7993b 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -377,7 +377,7 @@ the community they pose. #### Permission Model Boundaries (`--permission`) The Node.js [Permission Model](https://nodejs.org/api/permissions.html) -(`--experimental-permission`) is an opt-in mechanism that limits which +(`--permission`) is an opt-in mechanism that limits which resources a Node.js process may access. It is designed to reduce the blast radius of mistakes in trusted application code, **not** to act as a security boundary against intentional misuse or a compromised process. From d85421229c53bd256dd46777a6a538c19e109c8f Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Thu, 28 May 2026 16:22:50 +0200 Subject: [PATCH 3/3] module: load ESM helpers eagerly in the snapshot Since the ESM loader is captured in the snapshot now, there's no need to lazy load the helpers. Load them eagerly to capture them into the snapshot. This also reduces the noise coming out of --print-bytecode since we no longer compile the helper functions at run time. Signed-off-by: Joyee Cheung PR-URL: https://github.com/nodejs/node/pull/63550 Reviewed-By: Chengzhong Wu Reviewed-By: Geoffrey Booth --- lib/internal/modules/esm/loader.js | 28 ++++--------------------- test/parallel/test-bootstrap-modules.js | 2 ++ 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/lib/internal/modules/esm/loader.js b/lib/internal/modules/esm/loader.js index b39b29fff7779b..5099bc44f8a207 100644 --- a/lib/internal/modules/esm/loader.js +++ b/lib/internal/modules/esm/loader.js @@ -14,7 +14,8 @@ const { hardenRegExp, } = primordials; - +const { LoadCache, ResolveCache } = require('internal/modules/esm/module_map'); +const { ModuleJob, ModuleJobSync } = require('internal/modules/esm/module_job'); // This is needed to avoid cycles in esm/resolve <-> cjs/loader const { kIsExecuting, @@ -85,24 +86,6 @@ const { isPromise } = require('internal/util/types'); * @typedef {import('url').URL} URL */ -/** - * Lazy loads the module_map module and returns a new instance of ResolveCache. - * @returns {import('./module_map.js').ResolveCache} - */ -function newResolveCache() { - const { ResolveCache } = require('internal/modules/esm/module_map'); - return new ResolveCache(); -} - -/** - * Generate a load cache (to store the final result of a load-chain for a particular module). - * @returns {import('./module_map.js').LoadCache} - */ -function newLoadCache() { - const { LoadCache } = require('internal/modules/esm/module_map'); - return new LoadCache(); -} - const { translators } = require('internal/modules/esm/translators'); const { defaultResolve } = require('internal/modules/esm/resolve'); const { defaultLoadSync, throwUnknownModuleFormat } = require('internal/modules/esm/load'); @@ -161,12 +144,12 @@ class ModuleLoader { /** * Registry of resolved specifiers */ - #resolveCache = newResolveCache(); + #resolveCache = new ResolveCache(); /** * Registry of loaded modules, akin to `require.cache` */ - loadCache = newLoadCache(); + loadCache = new LoadCache(); /** * @see {AsyncLoaderHooks.isForAsyncLoaderHookWorker} @@ -238,7 +221,6 @@ class ModuleLoader { * @returns {Promise} The module object. */ async executeModuleJob(url, wrap, isEntryPoint = false) { - const { ModuleJob } = require('internal/modules/esm/module_job'); const module = await onImport.tracePromise(async () => { const job = new ModuleJob(this, url, undefined, wrap, kEvaluationPhase, false, false, kImportInImportedESM); this.loadCache.set(url, undefined, job); @@ -357,7 +339,6 @@ class ModuleLoader { const wrap = compileSourceTextModule(url, source, kUser); const inspectBrk = (isMain && getOptionValue('--inspect-brk')); - const { ModuleJobSync } = require('internal/modules/esm/module_job'); job = new ModuleJobSync(this, url, kEmptyObject, wrap, kEvaluationPhase, isMain, inspectBrk, kImportInRequiredESM); this.loadCache.set(url, kImplicitTypeAttribute, job); @@ -587,7 +568,6 @@ class ModuleLoader { assert(moduleOrModulePromise instanceof ModuleWrap, `Expected ModuleWrap for loading ${url}`); } - const { ModuleJob, ModuleJobSync } = require('internal/modules/esm/module_job'); // TODO(joyeecheung): use ModuleJobSync for kRequireInImportedCJS too. const ModuleJobCtor = (requestType === kImportInRequiredESM ? ModuleJobSync : ModuleJob); const isMain = (parentURL === undefined); diff --git a/test/parallel/test-bootstrap-modules.js b/test/parallel/test-bootstrap-modules.js index 92bf3be1f612ff..69f1d9f44c9c6c 100644 --- a/test/parallel/test-bootstrap-modules.js +++ b/test/parallel/test-bootstrap-modules.js @@ -133,6 +133,8 @@ if (isMainThread) { 'NativeModule internal/modules/esm/load', 'NativeModule internal/modules/esm/resolve', 'NativeModule internal/modules/esm/translators', + 'NativeModule internal/modules/esm/module_job', + 'NativeModule internal/modules/esm/module_map', 'NativeModule url', ].forEach(expected.beforePreExec.add.bind(expected.beforePreExec)); } else { // Worker.