repl: avoid deprecated require.extensions in tab completion

PR-URL: https://github.com/nodejs/node/pull/58653
Fixes: https://github.com/nodejs/node/issues/58641
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Dario Piotrowicz <dario.piotrowicz@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
baki gul 2025-06-23 09:21:47 +03:00 committed by GitHub
parent 910a8af2d2
commit dcfdaab13a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1359,7 +1359,7 @@ function complete(line, callback) {
filter = completeOn;
if (this.allowBlockingCompletions) {
const subdir = match[2] || '';
const extensions = ObjectKeys(this.context.require.extensions);
const extensions = ObjectKeys(CJSModule._extensions);
const indexes = ArrayPrototypeMap(extensions,
(extension) => `index${extension}`);
ArrayPrototypePush(indexes, 'package.json', 'index');