GeezerVison is showing github.com — repl: deprecate `repl.builtinModules` · nodejs/node@160da87
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: doc/api/deprecations.md +18Lines changed: 18 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -3879,6 +3879,24 @@ Type: Runtime | 3879 | 3879 | When an `args` array is passed to [`child_process.execFile`][] or [`child_process.spawn`][] with the option | 3880 | 3880 | `{ shell: true }`, the values are not escaped, only space-separated, which can lead to shell injection. | 3881 | 3881 |
| | 3882 | +### DEP0191: `repl.builtinModules` | | 3883 | + | | 3884 | +<!-- YAML | | 3885 | +changes: | | 3886 | + - version: REPLACEME | | 3887 | + pr-url: https://github.com/nodejs/node/pull/57508 | | 3888 | + description: Documentation-only deprecation | | 3889 | + with `--pending-deprecation` support. | | 3890 | +--> | | 3891 | + | | 3892 | +Type: Documentation-only (supports [`--pending-deprecation`][]) | | 3893 | + | | 3894 | +The `node:repl` module exports a `builtinModules` property that contains an array | | 3895 | +of built-in modules. This was incomplete and matched the already deprecated | | 3896 | +`repl._builtinLibs` ([DEP0142][]) instead it's better to rely | | 3897 | +upon `require('node:module').builtinModules`. | | 3898 | + | | 3899 | +[DEP0142]: #dep0142-repl_builtinlibs | 3882 | 3900 | [NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf | 3883 | 3901 | [RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3 | 3884 | 3902 | [RFC 8247 Section 2.4]: https://www.rfc-editor.org/rfc/rfc8247#section-2.4 | |
Collapse file Copy file name to clipboardExpand all lines: doc/api/repl.md +5-1Lines changed: 5 additions & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -666,11 +666,14 @@ with REPL instances programmatically. | 666 | 666 |
| 667 | 667 | <!-- YAML | 668 | 668 | added: v14.5.0 | | 669 | +deprecated: REPLACEME | 669 | 670 | --> | 670 | 671 |
| | 672 | +> Stability: 0 - Deprecated. Use [`module.builtinModules`][] instead. | | 673 | +
| 671 | 674 | * {string\[]} | 672 | 675 |
| 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'`. | 674 | 677 |
| 675 | 678 | ## `repl.start([options])` | 676 | 679 |
| @@ -929,6 +932,7 @@ avoiding open network interfaces. | 929 | 932 | [`ERR_INVALID_REPL_INPUT`]: errors.md#err_invalid_repl_input | 930 | 933 | [`curl(1)`]: https://curl.haxx.se/docs/manpage.html | 931 | 934 | [`domain`]: domain.md | | 935 | +[`module.builtinModules`]: module.md#modulebuiltinmodules | 932 | 936 | [`process.setUncaughtExceptionCaptureCallback()`]: process.md#processsetuncaughtexceptioncapturecallbackfn | 933 | 937 | [`readline.InterfaceCompleter`]: readline.md#use-of-the-completer-function | 934 | 938 | [`repl.ReplServer`]: #class-replserver | |
Collapse file Copy file name to clipboardExpand all lines: lib/repl.js +11-3Lines changed: 11 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1858,9 +1858,17 @@ module.exports = { | 1858 | 1858 |
| 1859 | 1859 | ObjectDefineProperty(module.exports, 'builtinModules', { | 1860 | 1860 | __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, | 1864 | 1872 | configurable: true, | 1865 | 1873 | }); | 1866 | 1874 |
| |
Collapse file Copy file name to clipboardExpand all lines: test/parallel/test-repl-options.js +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -29,12 +29,15 @@ const repl = require('repl'); | 29 | 29 | const cp = require('child_process'); | 30 | 30 |
| 31 | 31 | assert.strictEqual(repl.repl, undefined); | | 32 | + | 32 | 33 | repl._builtinLibs; // eslint-disable-line no-unused-expressions | | 34 | +repl.builtinModules; // eslint-disable-line no-unused-expressions | 33 | 35 |
| 34 | 36 | common.expectWarning({ | 35 | 37 | DeprecationWarning: { | 36 | 38 | DEP0142: | 37 | 39 | 'repl._builtinLibs is deprecated. Check module.builtinModules instead', | | 40 | + DEP0191: 'repl.builtinModules is deprecated. Check module.builtinModules instead', | 38 | 41 | DEP0141: 'repl.inputStream and repl.outputStream are deprecated. ' + | 39 | 42 | 'Use repl.input and repl.output instead', | 40 | 43 | } | |
|