repl: avoid deprecated require.extensions in tab completion#58653
repl: avoid deprecated require.extensions in tab completion#58653nodejs-github-bot merged 3 commits intonodejs:mainfrom
require.extensions in tab completion#58653Conversation
dario-piotrowicz
left a comment
There was a problem hiding this comment.
Very nice, thanks for the PR @gulbaki 😃🙏
I've left a couple of small comments
Ethan-Arrowood
left a comment
There was a problem hiding this comment.
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. | ||
| const Module = require('module'); |
There was a problem hiding this comment.
Consider moving this to the top of the file.
It's not runtime deprecated (doc only) so it's not possible to capture the experimental warning |
Codecov ReportAll modified and coverable lines are covered by tests ✅
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
🚀 New features to boost your workflow:
|
|
Landed in dcfdaab |
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:
Fixes: #58641