Skip to content

doc: document process.moduleLoadList - #61276

Closed
Xstoudi wants to merge 3 commits into
nodejs:mainfrom
Xstoudi:fix/module-load-list
Closed

doc: document process.moduleLoadList#61276
Xstoudi wants to merge 3 commits into
nodejs:mainfrom
Xstoudi:fix/module-load-list

Conversation

@Xstoudi

@XstoudiXstoudi commented Jan 4, 2026

Copy link
Copy Markdown
Contributor

process.moduleLoadList was added in the early days but never documented

Fixes: #41233

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/loaders
  • @nodejs/startup

@nodejs-github-botnodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Jan 4, 2026
@Xstoudi
Xstoudiforce-pushed the fix/module-load-list branch from bcf2e77 to 984da23CompareJanuary 4, 2026 20:35
@codecov

codecovBot commented Jan 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.52%. Comparing base (282d30e) to head (1080338).
⚠️ Report is 21 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #61276 +/- ##
==========================================
- Coverage 88.53% 88.52% -0.02% 
==========================================
Files 704 704 Lines 208759 208750 -9 Branches 40277 40279 +2 ==========================================
- Hits 184825 184790 -35 - Misses 15934 15971 +37 + Partials 8000 7989 -11 
Files with missing linesCoverage Δ
lib/internal/bootstrap/realm.js96.29% <100.00%> (+0.29%)⬆️

... and 45 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment threadlib/internal/bootstrap/realm.js Outdated
Comment threadlib/internal/bootstrap/realm.js Outdated
Comment threadlib/internal/bootstrap/realm.js Outdated
@avivkeller

Copy link
Copy Markdown
Member

I'm okay with the doc changes, but any changes to functionality should be in a separate PR, IMO

@Xstoudi
Xstoudiforce-pushed the fix/module-load-list branch from e3e19f1 to 3e1972eCompareJanuary 5, 2026 17:57
process.moduleLoadList was added in the early days but never documented
Fixes: nodejs#41233
@Xstoudi
Xstoudiforce-pushed the fix/module-load-list branch from ea0665b to b061243CompareJanuary 5, 2026 17:57
Xstoudi added a commit to Xstoudi/node that referenced this pull request Jan 5, 2026
process.moduleLoadList was provided as-is instead of a copy of it
Refs: nodejs#41233
Refs: nodejs#61276
@XstoudiXstoudi changed the title lib,doc: make process.moduleLoadList immutable and document itdoc: document process.moduleLoadListJan 5, 2026
@Xstoudi

Xstoudi commented Jan 5, 2026

Copy link
Copy Markdown
ContributorAuthor

Doc change is here, code change moved to this draft: #61287
I'll remove the draft state once this one is merged and other branch rebased.

Sorry for the commit soup

Comment threaddoc/api/process.md Outdated
@Renegade334Renegade334 added doc Issues and PRs related to the documentations. and removed lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Jan 5, 2026
@Renegade334Renegade334 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Jan 5, 2026
Comment threaddoc/api/process.md Outdated
import { moduleLoadList } from 'node:process';

console.log(moduleLoadList);
// ['Internal Binding builtins', 'Internal Binding module_wrap', 'Internal Binding errors', ...]

@joyeecheungjoyeecheungJan 6, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the current shape of the API isn't very suitable to be a proper, public API - for example the types and the module names are mixed into a string, and there are no guarantees about when the types would change or what types there are; the names of the modules are also highly volatile and cannot be reliably depended on, and this might backfire if users start to claim changes to this array - removing/adding internal modules or their types - are supposed to be semver-major, just because this is a documented API.

IMO a documented version of this should either expose enum-like constants for types, and/or just filter out all the internals in the array.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review!

I also feel like it would be better to have something like { type: 'INTERNAL' | 'BUILTIN', name: string } in this list instead of concatened strings albeit as far as I understand, it wouldn't fix the concern regarding the removing/adding of internal modules being claimed as major changes. Or am I mistaken here?

Filtering out the internals is also a good option: tests do not rely on them being present anyway. Could this list become as list of builtins name in the form of ['foo', 'bar', 'baz'] instead of ['Internal Binding builtins', 'Internal Binding module_wrap', 'NativeModule foo', 'NativeModule bar', 'NativeModule baz'] ?

What's option seems the safest to you regarding the concerns you mentionned?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Third option: leave is as is, untouched and undocumented on purpose.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @aduh95 (#41233 (comment)) – don't know whether you still have an opinion?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW it wasn't added in #24775, as suggested in the changelog in this PR this dates back to the 0.x days when everything got exposed on process without a lot of thoughts into what's public and what's internal.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I think my personal preference would be: a separate list of strings with public modules only, and document that instead > leave it as is > a separate list of objects with enum + names (including internals) > document the current API

Comment threaddoc/api/process.md
* Type: {string\[]}

The `process.moduleLoadList` property returns an array of internal bindings and core modules that
were loaded during the current Node.js process execution.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small wording nit: "process execution" feels slightly redundant. "during the current process" might be cleaner.

  • that were loaded during the current Node.js process execution.
  • that were loaded during the current process.

Comment threaddoc/api/process.md Outdated

* Type: {string\[]}

The `process.moduleLoadList` property returns an array of internal bindings and core modules that

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Since the documentation text specifically refers to process.moduleLoadList, should the example use process.moduleLoadList directly instead of destructuring?

importprocessfrom'node:process';console.log(process.moduleLoadList);

lpinca
lpinca previously approved these changes Jan 7, 2026
@Xstoudi

Copy link
Copy Markdown
ContributorAuthor

Closed in favor of #61330

Xstoudi added a commit to Xstoudi/node that referenced this pull request Jan 9, 2026
Add a new `process.loadedModules` property that returns an array
of public core module names that have been loaded during the current
Node.js process execution. This provides a cleaner, documented API
for accessing loaded module information compared to the undocumented
`process.moduleLoadList`.
Fixes: nodejs#41233
Refs: nodejs#61276
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.commit-queue-squashAdd this label to instruct the Commit Queue to squash all the PR commits into the first one.docIssues and PRs related to the documentations.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doc: process.moduleLoadList not documented

10 participants

@Xstoudi@nodejs-github-bot@avivkeller@lpinca@anonrig@joyeecheung@UlisesGascon@Renegade334@aduh95@Hardanish-Singh