-
-
Notifications
You must be signed in to change notification settings - Fork 16
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededlet's do it
Description
Description
Since repl.builtinModules
is deprecated in Node.js v24.2.0, we should provide a codemod to replace it.
- The codemod should replace all instances of
repl.builtinModules
withmodule.builtinModules
. - The codemod should also replace
const repl = require('node:repl');
withconst module = require('node:module');
(also ESM import statement) if it exists in the file. And if repl is used for something else, don't replace it. - if the
node:repl
import is destructured, it should be replaced withnode:module
destructured import. And it's should not replace the whole import if there are other imports fromnode:repl
that are notbuiltinModules
.
Additional Information
Note that repl.builtinModules
is deprecated in favor of module.builtinModules
. But module.builtinModules
have more api listed than repl.builtinModules
, so we need to document that so if the user is using repl.builtinModules
to get the list of builtin modules, they should be aware that the list will be different.
Examples
Case 1:
Before:
const { builtinModules } = require('node:repl');
console.log(builtinModules);
After:
const { builtinModules } = require('node:module');
console.log(builtinModules);
Case 2:
Before:
const repl = require('node:repl');
console.log(repl.builtinModules);
After:
const module = require('node:module');
console.log(module.builtinModules);
Case 3:
Before:
const { builtinModules, foo } = require('node:repl');
console.log(builtinModules);
foo(); // does something else
After:
const { foo } = require('node:repl');
const { builtinModules } = require('node:module');
console.log(builtinModules);
foo(); // does something else
REFS
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is neededlet's do it
Type
Projects
Status
🏗 In progress