Skip to content

Conversation

@gulbaki
Copy link
Contributor

This PR replaces the usage of require.extensions in the REPL autocompletion logic with Module._extensions.

require.extensions has been runtime-deprecated under DEP0039, and its usage triggers a warning in recent Node.js versions. Since require.extensions is just a user-land alias for Module._extensions, we can safely access the same object via Module._extensions without any behavioral change or deprecation warning.

Changes:

  • this.context.require.extensions → Module._extensions in the REPL complete() function
  • Adds an inline comment explaining the deprecation and replacement
  • No functional behavior change

Fixes: #58641

@nodejs-github-botnodejs-github-bot added needs-ci PRs that need a full CI run. repl Issues and PRs related to the REPL subsystem. labels Jun 9, 2025
Copy link
Member

@dario-piotrowiczdario-piotrowicz left a comment

Choose a reason for hiding this comment

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

Very nice, thanks for the PR @gulbaki 😃🙏

I've left a couple of small comments

Copy link
Contributor

@Ethan-ArrowoodEthan-Arrowood left a comment

Choose a reason for hiding this comment

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

Could you also include a test for this? Here is an example of how I tested process warnings: https://github.com/nodejs/node/blob/main/test/parallel/test-process-warnings.mjs

lib/repl.js Outdated
// `require.extensions` is runtime-deprecated (DEP0039).
// Use `Module._extensions` to access the same extension map
// without triggering the deprecation warning.
constModule=require('module');
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider moving this to the top of the file.

@marco-ippolito
Copy link
Member

marco-ippolito commented Jun 10, 2025

Could you also include a test for this? Here is an example of how I tested process warnings: https://github.com/nodejs/node/blob/main/test/parallel/test-process-warnings.mjs

It's not runtime deprecated (doc only) so it's not possible to capture the experimental warning

Copy link
Member

@dario-piotrowiczdario-piotrowicz left a comment

Choose a reason for hiding this comment

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

LGTM 🙂

@codecov
Copy link

codecovbot commented Jun 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.14%. Comparing base (905a722) to head (5cb5079).
Report is 71 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #58653 +/- ## ========================================== - Coverage 90.15% 90.14% -0.01%  ========================================== Files 636 636 Lines 188040 188057 +17 Branches 36903 36895 -8 ========================================== - Hits 169535 169532 -3 - Misses 11239 11278 +39 + Partials 7266 7247 -19 
Files with missing linesCoverage Δ
lib/repl.js95.13% <100.00%> (ø)

... and 36 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.

@marco-ippolitomarco-ippolito added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 11, 2025
@github-actionsgithub-actionsbot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 11, 2025
@nodejs-github-bot
Copy link
Collaborator

@juanarboljuanarbol added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Jun 13, 2025
@marco-ippolitomarco-ippolito added the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 23, 2025
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 23, 2025
@nodejs-github-botnodejs-github-bot merged commit dcfdaab into nodejs:mainJun 23, 2025
72 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in dcfdaab

RafaelGSS pushed a commit that referenced this pull request Jun 23, 2025
PR-URL: #58653Fixes: #58641 Reviewed-By: Ethan Arrowood <[email protected]> Reviewed-By: Dario Piotrowicz <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
aduh95 pushed a commit that referenced this pull request Jul 21, 2025
PR-URL: #58653Fixes: #58641 Reviewed-By: Ethan Arrowood <[email protected]> Reviewed-By: Dario Piotrowicz <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
aduh95 pushed a commit that referenced this pull request Jul 24, 2025
PR-URL: #58653Fixes: #58641 Reviewed-By: Ethan Arrowood <[email protected]> Reviewed-By: Dario Piotrowicz <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
marco-ippolito pushed a commit that referenced this pull request Aug 18, 2025
PR-URL: #58653Fixes: #58641 Reviewed-By: Ethan Arrowood <[email protected]> Reviewed-By: Dario Piotrowicz <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
marco-ippolito pushed a commit that referenced this pull request Aug 20, 2025
PR-URL: #58653Fixes: #58641 Reviewed-By: Ethan Arrowood <[email protected]> Reviewed-By: Dario Piotrowicz <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
marco-ippolito pushed a commit that referenced this pull request Aug 20, 2025
PR-URL: #58653Fixes: #58641 Reviewed-By: Ethan Arrowood <[email protected]> Reviewed-By: Dario Piotrowicz <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
marco-ippolito pushed a commit that referenced this pull request Aug 23, 2025
PR-URL: #58653Fixes: #58641 Reviewed-By: Ethan Arrowood <[email protected]> Reviewed-By: Dario Piotrowicz <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
marco-ippolito pushed a commit that referenced this pull request Aug 25, 2025
PR-URL: #58653Fixes: #58641 Reviewed-By: Ethan Arrowood <[email protected]> Reviewed-By: Dario Piotrowicz <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
marco-ippolito pushed a commit that referenced this pull request Aug 25, 2025
PR-URL: #58653Fixes: #58641 Reviewed-By: Ethan Arrowood <[email protected]> Reviewed-By: Dario Piotrowicz <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
marco-ippolito pushed a commit that referenced this pull request Aug 25, 2025
PR-URL: #58653Fixes: #58641 Reviewed-By: Ethan Arrowood <[email protected]> Reviewed-By: Dario Piotrowicz <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
marco-ippolito pushed a commit that referenced this pull request Aug 25, 2025
PR-URL: #58653Fixes: #58641 Reviewed-By: Ethan Arrowood <[email protected]> Reviewed-By: Dario Piotrowicz <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
marco-ippolito pushed a commit that referenced this pull request Aug 26, 2025
PR-URL: #58653Fixes: #58641 Reviewed-By: Ethan Arrowood <[email protected]> Reviewed-By: Dario Piotrowicz <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
marco-ippolito pushed a commit that referenced this pull request Aug 27, 2025
PR-URL: #58653Fixes: #58641 Reviewed-By: Ethan Arrowood <[email protected]> Reviewed-By: Dario Piotrowicz <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
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.needs-ciPRs that need a full CI run.replIssues and PRs related to the REPL subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

repl: don't rely on require.extensions

9 participants

@gulbaki@marco-ippolito@nodejs-github-bot@lpinca@Ethan-Arrowood@juanarbol@mertcanaltin@avivkeller@dario-piotrowicz