From b061243570217323b0b97f1b1aa981e8527bfadf Mon Sep 17 00:00:00 2001 From: Xavier Stouder Date: Sun, 4 Jan 2026 19:17:27 +0100 Subject: [PATCH 1/3] doc: document process.moduleLoadList process.moduleLoadList was added in the early days but never documented Fixes: https://github.com/nodejs/node/issues/41233 --- doc/api/process.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/doc/api/process.md b/doc/api/process.md index 04ca0eff9c55d4..380efbe991f2df 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -2858,6 +2858,31 @@ console.log(memoryUsage.rss()); // 35655680 ``` +## `process.moduleLoadList` + + + +* Returns: {string\[]} + +The `process.moduleLoadList` property returns an array of internal bindings and core modules that +were loaded during the current Node.js process execution. + +```mjs +import { moduleLoadList } from 'node:process'; + +console.log(moduleLoadList); +// ['Internal Binding builtins', 'Internal Binding module_wrap', 'Internal Binding errors', ...] +``` + +```cjs +const { moduleLoadList } = require('node:process'); + +console.log(moduleLoadList); +// ['Internal Binding builtins', 'Internal Binding module_wrap', 'Internal Binding errors', ...] +``` + ## `process.nextTick(callback[, ...args])` * Returns: {string\[]} diff --git a/lib/internal/bootstrap/realm.js b/lib/internal/bootstrap/realm.js index f49f0814bbc687..a7bc800ff1aa92 100644 --- a/lib/internal/bootstrap/realm.js +++ b/lib/internal/bootstrap/realm.js @@ -74,10 +74,9 @@ const { const moduleLoadList = []; ObjectDefineProperty(process, 'moduleLoadList', { __proto__: null, - value: moduleLoadList, - configurable: true, + get() { return ArrayPrototypeSlice(moduleLoadList); }, enumerable: true, - writable: false, + configurable: true, }); diff --git a/test/parallel/test-process-moduleloadlist.js b/test/parallel/test-process-moduleloadlist.js new file mode 100644 index 00000000000000..0dd456cc047323 --- /dev/null +++ b/test/parallel/test-process-moduleloadlist.js @@ -0,0 +1,7 @@ +'use strict'; + +require('../common'); +const assert = require('assert'); + +assert.ok(Array.isArray(process.moduleLoadList)); +assert.throws(() => process.moduleLoadList = 'foo', /^TypeError: Cannot set property moduleLoadList of # which has only a getter$/); From 8aca3e24b437cbccecf19a3d6d36823d8a3b7023 Mon Sep 17 00:00:00 2001 From: Xavier Stouder Date: Mon, 5 Jan 2026 19:04:34 +0100 Subject: [PATCH 3/3] fix pr url in doc --- doc/api/process.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/process.md b/doc/api/process.md index de4104627f97bb..934b33a5aa024f 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -2864,7 +2864,7 @@ console.log(memoryUsage.rss()); added: v0.5.3 changes: - version: REPLACEME - pr-url: https://github.com/nodejs/node/pull/61276 + pr-url: https://github.com/nodejs/node/pull/61287 description: Now a copy instead of the internal list itself. -->