repl: deprecate `repl.builtinModules` · nodejs/node@160da87 · GitHub
Skip to content

Commit 160da87

Browse files
dario-piotrowiczaduh95
authored andcommitted
repl: deprecate repl.builtinModules
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #57508 Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Xuguang Mei <meixuguang@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
1 parent f4572f0 commit 160da87

4 files changed

Lines changed: 37 additions & 4 deletions

File tree

doc/api/deprecations.md

Lines changed: 18 additions & 0 deletions

doc/api/repl.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,11 +666,14 @@ with REPL instances programmatically.
666666

667667
<!-- YAML
668668
added: v14.5.0
669+
deprecated: REPLACEME
669670
-->
670671

672+
> Stability: 0 - Deprecated. Use [`module.builtinModules`][] instead.
673+
671674
* {string\[]}
672675

673-
A list of the names of all Node.js modules, e.g., `'http'`.
676+
A list of the names of some Node.js modules, e.g., `'http'`.
674677

675678
## `repl.start([options])`
676679

@@ -929,6 +932,7 @@ avoiding open network interfaces.
929932
[`ERR_INVALID_REPL_INPUT`]: errors.md#err_invalid_repl_input
930933
[`curl(1)`]: https://curl.haxx.se/docs/manpage.html
931934
[`domain`]: domain.md
935+
[`module.builtinModules`]: module.md#modulebuiltinmodules
932936
[`process.setUncaughtExceptionCaptureCallback()`]: process.md#processsetuncaughtexceptioncapturecallbackfn
933937
[`readline.InterfaceCompleter`]: readline.md#use-of-the-completer-function
934938
[`repl.ReplServer`]: #class-replserver

lib/repl.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,9 +1858,17 @@ module.exports = {
18581858

18591859
ObjectDefineProperty(module.exports, 'builtinModules', {
18601860
__proto__: null,
1861-
get: () => _builtinLibs,
1862-
set: (val) => _builtinLibs = val,
1863-
enumerable: true,
1861+
get: pendingDeprecation ? deprecate(
1862+
() => _builtinLibs,
1863+
'repl.builtinModules is deprecated. Check module.builtinModules instead',
1864+
'DEP0191',
1865+
) : () => _builtinLibs,
1866+
set: pendingDeprecation ? deprecate(
1867+
(val) => _builtinLibs = val,
1868+
'repl.builtinModules is deprecated. Check module.builtinModules instead',
1869+
'DEP0191',
1870+
) : (val) => _builtinLibs = val,
1871+
enumerable: false,
18641872
configurable: true,
18651873
});
18661874

test/parallel/test-repl-options.js

Lines changed: 3 additions & 0 deletions

0 commit comments

Comments
 (0)