repl: avoid deprecated `require.extensions` in tab completion
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: https://github.com/nodejs/node/issues/58641
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
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
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 lines | Coverage Ξ | |
|---|---|---|
| lib/repl.js | 95.13% <100.00%> (ΓΈ) |
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
CI: https://ci.nodejs.org/job/node-test-pull-request/67409/
Landed in dcfdaab13aa674d88712ca853551fb432dcc77c8