@types/node 18.11.5 → 20.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. node/README.md +2 -2
  2. node/assert.d.ts +86 -75
  3. node/async_hooks.d.ts +66 -37
  4. node/buffer.d.ts +193 -100
  5. node/child_process.d.ts +82 -56
  6. node/cluster.d.ts +12 -12
  7. node/console.d.ts +5 -5
  8. node/crypto.d.ts +233 -235
  9. node/dgram.d.ts +15 -15
  10. node/diagnostics_channel.d.ts +59 -21
  11. node/dns/promises.d.ts +50 -6
  12. node/dns.d.ts +26 -17
  13. node/domain.d.ts +4 -4
  14. node/events.d.ts +111 -65
  15. node/fs/promises.d.ts +99 -47
  16. node/fs.d.ts +244 -73
  17. node/globals.d.ts +6 -3
  18. node/http.d.ts +265 -148
  19. node/http2.d.ts +42 -47
  20. node/https.d.ts +53 -153
  21. node/index.d.ts +2 -1
  22. node/inspector.d.ts +10 -3
  23. node/module.d.ts +6 -4
  24. node/net.d.ts +32 -15
  25. node/os.d.ts +27 -16
  26. node/package.json +9 -4
  27. node/path.d.ts +4 -4
  28. node/perf_hooks.d.ts +28 -15
  29. node/process.d.ts +49 -46
  30. node/punycode.d.ts +1 -1
  31. node/querystring.d.ts +5 -5
  32. node/readline/promises.d.ts +65 -63
  33. node/readline.d.ts +32 -159
  34. node/repl.d.ts +20 -20
  35. node/stream/consumers.d.ts +1 -1
  36. node/stream.d.ts +950 -869
  37. node/string_decoder.d.ts +6 -6
  38. node/test.d.ts +877 -139
  39. node/timers/promises.d.ts +26 -1
  40. node/timers.d.ts +125 -4
  41. node/tls.d.ts +120 -29
  42. node/trace_events.d.ts +20 -9
  43. node/ts4.8/assert.d.ts +86 -75
  44. node/ts4.8/async_hooks.d.ts +66 -37
  45. node/ts4.8/buffer.d.ts +193 -101
  46. node/ts4.8/child_process.d.ts +82 -56
  47. node/ts4.8/cluster.d.ts +12 -12
  48. node/ts4.8/console.d.ts +5 -5
  49. node/ts4.8/crypto.d.ts +230 -233
  50. node/ts4.8/dgram.d.ts +15 -15
  51. node/ts4.8/diagnostics_channel.d.ts +59 -21
  52. node/ts4.8/dns/promises.d.ts +50 -6
  53. node/ts4.8/dns.d.ts +26 -17
  54. node/ts4.8/domain.d.ts +4 -4
  55. node/ts4.8/events.d.ts +111 -65
  56. node/ts4.8/fs/promises.d.ts +97 -46
  57. node/ts4.8/fs.d.ts +244 -73
  58. node/ts4.8/globals.d.ts +21 -12
  59. node/ts4.8/http.d.ts +265 -148
  60. node/ts4.8/http2.d.ts +42 -47
  61. node/ts4.8/https.d.ts +53 -153
  62. node/ts4.8/inspector.d.ts +10 -3
  63. node/ts4.8/module.d.ts +6 -4
  64. node/ts4.8/net.d.ts +33 -16
  65. node/ts4.8/os.d.ts +27 -16
  66. node/ts4.8/path.d.ts +4 -4
  67. node/ts4.8/perf_hooks.d.ts +28 -15
  68. node/ts4.8/process.d.ts +49 -46
  69. node/ts4.8/punycode.d.ts +1 -1
  70. node/ts4.8/querystring.d.ts +5 -5
  71. node/ts4.8/readline/promises.d.ts +65 -63
  72. node/ts4.8/readline.d.ts +32 -159
  73. node/ts4.8/repl.d.ts +20 -20
  74. node/ts4.8/stream/consumers.d.ts +1 -1
  75. node/ts4.8/stream.d.ts +192 -140
  76. node/ts4.8/string_decoder.d.ts +6 -6
  77. node/ts4.8/test.d.ts +877 -139
  78. node/ts4.8/timers/promises.d.ts +26 -1
  79. node/ts4.8/timers.d.ts +125 -4
  80. node/ts4.8/tls.d.ts +120 -29
  81. node/ts4.8/trace_events.d.ts +20 -9
  82. node/ts4.8/tty.d.ts +4 -5
  83. node/ts4.8/url.d.ts +46 -42
  84. node/ts4.8/util.d.ts +325 -123
  85. node/ts4.8/v8.d.ts +253 -14
  86. node/ts4.8/vm.d.ts +417 -32
  87. node/ts4.8/wasi.d.ts +13 -19
  88. node/ts4.8/worker_threads.d.ts +38 -34
  89. node/ts4.8/zlib.d.ts +11 -11
  90. node/tty.d.ts +4 -5
  91. node/url.d.ts +46 -42
  92. node/util.d.ts +325 -123
  93. node/v8.d.ts +253 -14
  94. node/vm.d.ts +417 -32
  95. node/wasi.d.ts +13 -19
  96. node/worker_threads.d.ts +38 -34
  97. node/zlib.d.ts +11 -11
node/child_process.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  /**
2
- * The `child_process` module provides the ability to spawn subprocesses in
2
+ * The `node:child_process` module provides the ability to spawn subprocesses in
3
3
  * a manner that is similar, but not identical, to [`popen(3)`](http://man7.org/linux/man-pages/man3/popen.3.html). This capability
4
4
  * is primarily provided by the {@link spawn} function:
5
5
  *
6
6
  * ```js
7
- * const { spawn } = require('child_process');
7
+ * const { spawn } = require('node:child_process');
8
8
  * const ls = spawn('ls', ['-lh', '/usr']);
9
9
  *
10
10
  * ls.stdout.on('data', (data) => {
@@ -44,8 +44,8 @@
44
44
  * without blocking the Node.js event loop. The {@link spawnSync} function provides equivalent functionality in a synchronous manner that blocks
45
45
  * the event loop until the spawned process either exits or is terminated.
46
46
  *
47
- * For convenience, the `child_process` module provides a handful of synchronous
48
- * and asynchronous alternatives to {@link spawn} and {@link spawnSync}. Each of these alternatives are implemented on
47
+ * For convenience, the `node:child_process` module provides a handful of
48
+ * synchronous and asynchronous alternatives to {@link spawn} and {@link spawnSync}. Each of these alternatives are implemented on
49
49
  * top of {@link spawn} or {@link spawnSync}.
50
50
  *
51
51
  * * {@link exec}: spawns a shell and runs a command within that
@@ -63,7 +63,7 @@
63
63
  * For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however,
64
64
  * the synchronous methods can have significant impact on performance due to
65
65
  * stalling the event loop while spawned processes complete.
66
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/child_process.js)
66
+ * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/child_process.js)
67
67
  */
68
68
  declare module 'child_process' {
69
69
  import { ObjectEncodingOptions } from 'node:fs';
@@ -94,8 +94,7 @@ declare module 'child_process' {
94
94
  * `subprocess.stdin` is an alias for `subprocess.stdio[0]`. Both properties will
95
95
  * refer to the same value.
96
96
  *
97
- * The `subprocess.stdin` property can be `undefined` if the child process could
98
- * not be successfully spawned.
97
+ * The `subprocess.stdin` property can be `null` or `undefined`if the child process could not be successfully spawned.
99
98
  * @since v0.1.90
100
99
  */
101
100
  stdin: Writable | null;
@@ -109,7 +108,7 @@ declare module 'child_process' {
109
108
  * refer to the same value.
110
109
  *
111
110
  * ```js
112
- * const { spawn } = require('child_process');
111
+ * const { spawn } = require('node:child_process');
113
112
  *
114
113
  * const subprocess = spawn('ls');
115
114
  *
@@ -118,8 +117,7 @@ declare module 'child_process' {
118
117
  * });
119
118
  * ```
120
119
  *
121
- * The `subprocess.stdout` property can be `null` if the child process could
122
- * not be successfully spawned.
120
+ * The `subprocess.stdout` property can be `null` or `undefined`if the child process could not be successfully spawned.
123
121
  * @since v0.1.90
124
122
  */
125
123
  stdout: Readable | null;
@@ -132,14 +130,13 @@ declare module 'child_process' {
132
130
  * `subprocess.stderr` is an alias for `subprocess.stdio[2]`. Both properties will
133
131
  * refer to the same value.
134
132
  *
135
- * The `subprocess.stderr` property can be `null` if the child process could
136
- * not be successfully spawned.
133
+ * The `subprocess.stderr` property can be `null` or `undefined`if the child process could not be successfully spawned.
137
134
  * @since v0.1.90
138
135
  */
139
136
  stderr: Readable | null;
140
137
  /**
141
138
  * The `subprocess.channel` property is a reference to the child's IPC channel. If
142
- * no IPC channel currently exists, this property is `undefined`.
139
+ * no IPC channel exists, this property is `undefined`.
143
140
  * @since v7.1.0
144
141
  */
145
142
  readonly channel?: Pipe | null | undefined;
@@ -154,16 +151,16 @@ declare module 'child_process' {
154
151
  * in the array are `null`.
155
152
  *
156
153
  * ```js
157
- * const assert = require('assert');
158
- * const fs = require('fs');
159
- * const child_process = require('child_process');
154
+ * const assert = require('node:assert');
155
+ * const fs = require('node:fs');
156
+ * const child_process = require('node:child_process');
160
157
  *
161
158
  * const subprocess = child_process.spawn('ls', {
162
159
  * stdio: [
163
160
  * 0, // Use parent's stdin for child.
164
161
  * 'pipe', // Pipe child's stdout to parent.
165
162
  * fs.openSync('err.out', 'w'), // Direct child's stderr to a file.
166
- * ]
163
+ * ],
167
164
  * });
168
165
  *
169
166
  * assert.strictEqual(subprocess.stdio[0], null);
@@ -204,7 +201,7 @@ declare module 'child_process' {
204
201
  * emitted.
205
202
  *
206
203
  * ```js
207
- * const { spawn } = require('child_process');
204
+ * const { spawn } = require('node:child_process');
208
205
  * const grep = spawn('grep', ['ssh']);
209
206
  *
210
207
  * console.log(`Spawned child pid: ${grep.pid}`);
@@ -251,7 +248,7 @@ declare module 'child_process' {
251
248
  * returns `true` if [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) succeeds, and `false` otherwise.
252
249
  *
253
250
  * ```js
254
- * const { spawn } = require('child_process');
251
+ * const { spawn } = require('node:child_process');
255
252
  * const grep = spawn('grep', ['ssh']);
256
253
  *
257
254
  * grep.on('close', (code, signal) => {
@@ -284,7 +281,7 @@ declare module 'child_process' {
284
281
  *
285
282
  * ```js
286
283
  * 'use strict';
287
- * const { spawn } = require('child_process');
284
+ * const { spawn } = require('node:child_process');
288
285
  *
289
286
  * const subprocess = spawn(
290
287
  * 'sh',
@@ -294,8 +291,8 @@ declare module 'child_process' {
294
291
  * console.log(process.pid, 'is alive')
295
292
  * }, 500);"`,
296
293
  * ], {
297
- * stdio: ['inherit', 'inherit', 'inherit']
298
- * }
294
+ * stdio: ['inherit', 'inherit', 'inherit'],
295
+ * },
299
296
  * );
300
297
  *
301
298
  * setTimeout(() => {
@@ -317,7 +314,7 @@ declare module 'child_process' {
317
314
  * For example, in the parent script:
318
315
  *
319
316
  * ```js
320
- * const cp = require('child_process');
317
+ * const cp = require('node:child_process');
321
318
  * const n = cp.fork(`${__dirname}/sub.js`);
322
319
  *
323
320
  * n.on('message', (m) => {
@@ -371,10 +368,10 @@ declare module 'child_process' {
371
368
  * a TCP server object to the child process as illustrated in the example below:
372
369
  *
373
370
  * ```js
374
- * const subprocess = require('child_process').fork('subprocess.js');
371
+ * const subprocess = require('node:child_process').fork('subprocess.js');
375
372
  *
376
373
  * // Open up the server object and send the handle.
377
- * const server = require('net').createServer();
374
+ * const server = require('node:net').createServer();
378
375
  * server.on('connection', (socket) => {
379
376
  * socket.end('handled by parent');
380
377
  * });
@@ -398,10 +395,9 @@ declare module 'child_process' {
398
395
  * Once the server is now shared between the parent and child, some connections
399
396
  * can be handled by the parent and some by the child.
400
397
  *
401
- * While the example above uses a server created using the `net` module, `dgram`module servers use exactly the same workflow with the exceptions of listening on
402
- * a `'message'` event instead of `'connection'` and using `server.bind()` instead
403
- * of `server.listen()`. This is, however, currently only supported on Unix
404
- * platforms.
398
+ * While the example above uses a server created using the `node:net` module,`node:dgram` module servers use exactly the same workflow with the exceptions of
399
+ * listening on a `'message'` event instead of `'connection'` and using`server.bind()` instead of `server.listen()`. This is, however, only
400
+ * supported on Unix platforms.
405
401
  *
406
402
  * #### Example: sending a socket object
407
403
  *
@@ -410,13 +406,13 @@ declare module 'child_process' {
410
406
  * handle connections with "normal" or "special" priority:
411
407
  *
412
408
  * ```js
413
- * const { fork } = require('child_process');
409
+ * const { fork } = require('node:child_process');
414
410
  * const normal = fork('subprocess.js', ['normal']);
415
411
  * const special = fork('subprocess.js', ['special']);
416
412
  *
417
413
  * // Open up the server and send sockets to child. Use pauseOnConnect to prevent
418
414
  * // the sockets from being read before they are sent to the child process.
419
- * const server = require('net').createServer({ pauseOnConnect: true });
415
+ * const server = require('node:net').createServer({ pauseOnConnect: true });
420
416
  * server.on('connection', (socket) => {
421
417
  *
422
418
  * // If this is special priority...
@@ -482,11 +478,11 @@ declare module 'child_process' {
482
478
  * the child and the parent.
483
479
  *
484
480
  * ```js
485
- * const { spawn } = require('child_process');
481
+ * const { spawn } = require('node:child_process');
486
482
  *
487
483
  * const subprocess = spawn(process.argv[0], ['child_program.js'], {
488
484
  * detached: true,
489
- * stdio: 'ignore'
485
+ * stdio: 'ignore',
490
486
  * });
491
487
  *
492
488
  * subprocess.unref();
@@ -500,11 +496,11 @@ declare module 'child_process' {
500
496
  * to wait for the child to exit before exiting itself.
501
497
  *
502
498
  * ```js
503
- * const { spawn } = require('child_process');
499
+ * const { spawn } = require('node:child_process');
504
500
  *
505
501
  * const subprocess = spawn(process.argv[0], ['child_program.js'], {
506
502
  * detached: true,
507
- * stdio: 'ignore'
503
+ * stdio: 'ignore',
508
504
  * });
509
505
  *
510
506
  * subprocess.unref();
@@ -624,7 +620,7 @@ declare module 'child_process' {
624
620
  }
625
621
  interface CommonOptions extends ProcessEnvOptions {
626
622
  /**
627
- * @default true
623
+ * @default false
628
624
  */
629
625
  windowsHide?: boolean | undefined;
630
626
  /**
@@ -634,6 +630,15 @@ declare module 'child_process' {
634
630
  }
635
631
  interface CommonSpawnOptions extends CommonOptions, MessagingOptions, Abortable {
636
632
  argv0?: string | undefined;
633
+ /**
634
+ * Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings.
635
+ * If passed as an array, the first element is used for `stdin`, the second for
636
+ * `stdout`, and the third for `stderr`. A fourth element can be used to
637
+ * specify the `stdio` behavior beyond the standard streams. See
638
+ * {@link ChildProcess.stdio} for more information.
639
+ *
640
+ * @default 'pipe'
641
+ */
637
642
  stdio?: StdioOptions | undefined;
638
643
  shell?: boolean | string | undefined;
639
644
  windowsVerbatimArguments?: boolean | undefined;
@@ -663,7 +668,7 @@ declare module 'child_process' {
663
668
  * ```js
664
669
  * const defaults = {
665
670
  * cwd: undefined,
666
- * env: process.env
671
+ * env: process.env,
667
672
  * };
668
673
  * ```
669
674
  *
@@ -682,7 +687,7 @@ declare module 'child_process' {
682
687
  * exit code:
683
688
  *
684
689
  * ```js
685
- * const { spawn } = require('child_process');
690
+ * const { spawn } = require('node:child_process');
686
691
  * const ls = spawn('ls', ['-lh', '/usr']);
687
692
  *
688
693
  * ls.stdout.on('data', (data) => {
@@ -701,7 +706,7 @@ declare module 'child_process' {
701
706
  * Example: A very elaborate way to run `ps ax | grep ssh`
702
707
  *
703
708
  * ```js
704
- * const { spawn } = require('child_process');
709
+ * const { spawn } = require('node:child_process');
705
710
  * const ps = spawn('ps', ['ax']);
706
711
  * const grep = spawn('grep', ['ssh']);
707
712
  *
@@ -738,7 +743,7 @@ declare module 'child_process' {
738
743
  * Example of checking for failed `spawn`:
739
744
  *
740
745
  * ```js
741
- * const { spawn } = require('child_process');
746
+ * const { spawn } = require('node:child_process');
742
747
  * const subprocess = spawn('bad_command');
743
748
  *
744
749
  * subprocess.on('error', (err) => {
@@ -749,14 +754,14 @@ declare module 'child_process' {
749
754
  * Certain platforms (macOS, Linux) will use the value of `argv[0]` for the process
750
755
  * title while others (Windows, SunOS) will use `command`.
751
756
  *
752
- * Node.js currently overwrites `argv[0]` with `process.execPath` on startup, so`process.argv[0]` in a Node.js child process will not match the `argv0`parameter passed to `spawn` from the parent,
753
- * retrieve it with the`process.argv0` property instead.
757
+ * Node.js overwrites `argv[0]` with `process.execPath` on startup, so`process.argv[0]` in a Node.js child process will not match the `argv0`parameter passed to `spawn` from the parent. Retrieve
758
+ * it with the`process.argv0` property instead.
754
759
  *
755
760
  * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except
756
761
  * the error passed to the callback will be an `AbortError`:
757
762
  *
758
763
  * ```js
759
- * const { spawn } = require('child_process');
764
+ * const { spawn } = require('node:child_process');
760
765
  * const controller = new AbortController();
761
766
  * const { signal } = controller;
762
767
  * const grep = spawn('grep', ['ssh'], { signal });
@@ -815,7 +820,7 @@ declare module 'child_process' {
815
820
  * need to be dealt with accordingly:
816
821
  *
817
822
  * ```js
818
- * const { exec } = require('child_process');
823
+ * const { exec } = require('node:child_process');
819
824
  *
820
825
  * exec('"/path/to/test file/test.sh" arg1 arg2');
821
826
  * // Double quotes are used so that the space in the path is not interpreted as
@@ -841,7 +846,7 @@ declare module 'child_process' {
841
846
  * encoding, `Buffer` objects will be passed to the callback instead.
842
847
  *
843
848
  * ```js
844
- * const { exec } = require('child_process');
849
+ * const { exec } = require('node:child_process');
845
850
  * exec('cat *.js missing_file | wc -l', (error, stdout, stderr) => {
846
851
  * if (error) {
847
852
  * console.error(`exec error: ${error}`);
@@ -866,8 +871,8 @@ declare module 'child_process' {
866
871
  * callback, but with two additional properties `stdout` and `stderr`.
867
872
  *
868
873
  * ```js
869
- * const util = require('util');
870
- * const exec = util.promisify(require('child_process').exec);
874
+ * const util = require('node:util');
875
+ * const exec = util.promisify(require('node:child_process').exec);
871
876
  *
872
877
  * async function lsExample() {
873
878
  * const { stdout, stderr } = await exec('ls');
@@ -881,11 +886,11 @@ declare module 'child_process' {
881
886
  * the error passed to the callback will be an `AbortError`:
882
887
  *
883
888
  * ```js
884
- * const { exec } = require('child_process');
889
+ * const { exec } = require('node:child_process');
885
890
  * const controller = new AbortController();
886
891
  * const { signal } = controller;
887
892
  * const child = exec('grep ssh', { signal }, (error) => {
888
- * console.log(error); // an AbortError
893
+ * console.error(error); // an AbortError
889
894
  * });
890
895
  * controller.abort();
891
896
  * ```
@@ -984,7 +989,10 @@ declare module 'child_process' {
984
989
  interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions {
985
990
  encoding: BufferEncoding;
986
991
  }
987
- type ExecFileException = ExecException & NodeJS.ErrnoException;
992
+ type ExecFileException =
993
+ & Omit<ExecException, 'code'>
994
+ & Omit<NodeJS.ErrnoException, 'code'>
995
+ & { code?: string | number | undefined | null };
988
996
  /**
989
997
  * The `child_process.execFile()` function is similar to {@link exec} except that it does not spawn a shell by default. Rather, the specified
990
998
  * executable `file` is spawned directly as a new process making it slightly more
@@ -995,7 +1003,7 @@ declare module 'child_process' {
995
1003
  * supported.
996
1004
  *
997
1005
  * ```js
998
- * const { execFile } = require('child_process');
1006
+ * const { execFile } = require('node:child_process');
999
1007
  * const child = execFile('node', ['--version'], (error, stdout, stderr) => {
1000
1008
  * if (error) {
1001
1009
  * throw error;
@@ -1018,8 +1026,8 @@ declare module 'child_process' {
1018
1026
  * callback, but with two additional properties `stdout` and `stderr`.
1019
1027
  *
1020
1028
  * ```js
1021
- * const util = require('util');
1022
- * const execFile = util.promisify(require('child_process').execFile);
1029
+ * const util = require('node:util');
1030
+ * const execFile = util.promisify(require('node:child_process').execFile);
1023
1031
  * async function getVersion() {
1024
1032
  * const { stdout } = await execFile('node', ['--version']);
1025
1033
  * console.log(stdout);
@@ -1035,11 +1043,11 @@ declare module 'child_process' {
1035
1043
  * the error passed to the callback will be an `AbortError`:
1036
1044
  *
1037
1045
  * ```js
1038
- * const { execFile } = require('child_process');
1046
+ * const { execFile } = require('node:child_process');
1039
1047
  * const controller = new AbortController();
1040
1048
  * const { signal } = controller;
1041
1049
  * const child = execFile('node', ['--version'], { signal }, (error) => {
1042
- * console.log(error); // an AbortError
1050
+ * console.error(error); // an AbortError
1043
1051
  * });
1044
1052
  * controller.abort();
1045
1053
  * ```
@@ -1192,6 +1200,15 @@ declare module 'child_process' {
1192
1200
  execPath?: string | undefined;
1193
1201
  execArgv?: string[] | undefined;
1194
1202
  silent?: boolean | undefined;
1203
+ /**
1204
+ * Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings.
1205
+ * If passed as an array, the first element is used for `stdin`, the second for
1206
+ * `stdout`, and the third for `stderr`. A fourth element can be used to
1207
+ * specify the `stdio` behavior beyond the standard streams. See
1208
+ * {@link ChildProcess.stdio} for more information.
1209
+ *
1210
+ * @default 'pipe'
1211
+ */
1195
1212
  stdio?: StdioOptions | undefined;
1196
1213
  detached?: boolean | undefined;
1197
1214
  windowsVerbatimArguments?: boolean | undefined;
@@ -1231,7 +1248,7 @@ declare module 'child_process' {
1231
1248
  * console.log(`Hello from ${process.argv[2]}!`);
1232
1249
  * }, 1_000);
1233
1250
  * } else {
1234
- * const { fork } = require('child_process');
1251
+ * const { fork } = require('node:child_process');
1235
1252
  * const controller = new AbortController();
1236
1253
  * const { signal } = controller;
1237
1254
  * const child = fork(__filename, ['child'], { signal });
@@ -1292,6 +1309,15 @@ declare module 'child_process' {
1292
1309
  function spawnSync(command: string, args?: ReadonlyArray<string>, options?: SpawnSyncOptions): SpawnSyncReturns<string | Buffer>;
1293
1310
  interface CommonExecOptions extends CommonOptions {
1294
1311
  input?: string | NodeJS.ArrayBufferView | undefined;
1312
+ /**
1313
+ * Can be set to 'pipe', 'inherit, or 'ignore', or an array of these strings.
1314
+ * If passed as an array, the first element is used for `stdin`, the second for
1315
+ * `stdout`, and the third for `stderr`. A fourth element can be used to
1316
+ * specify the `stdio` behavior beyond the standard streams. See
1317
+ * {@link ChildProcess.stdio} for more information.
1318
+ *
1319
+ * @default 'pipe'
1320
+ */
1295
1321
  stdio?: StdioOptions | undefined;
1296
1322
  killSignal?: NodeJS.Signals | number | undefined;
1297
1323
  maxBuffer?: number | undefined;
node/cluster.d.ts CHANGED
@@ -8,12 +8,12 @@
8
8
  * server ports.
9
9
  *
10
10
  * ```js
11
- * import cluster from 'cluster';
12
- * import http from 'http';
13
- * import { cpus } from 'os';
14
- * import process from 'process';
11
+ * import cluster from 'node:cluster';
12
+ * import http from 'node:http';
13
+ * import { availableParallelism } from 'node:os';
14
+ * import process from 'node:process';
15
15
  *
16
- * const numCPUs = cpus().length;
16
+ * const numCPUs = availableParallelism();
17
17
  *
18
18
  * if (cluster.isPrimary) {
19
19
  * console.log(`Primary ${process.pid} is running`);
@@ -50,7 +50,7 @@
50
50
  * ```
51
51
  *
52
52
  * On Windows, it is not yet possible to set up a named pipe server in a worker.
53
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/cluster.js)
53
+ * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/cluster.js)
54
54
  */
55
55
  declare module 'cluster' {
56
56
  import * as child from 'node:child_process';
@@ -183,7 +183,7 @@ declare module 'cluster' {
183
183
  * });
184
184
  *
185
185
  * } else if (cluster.isWorker) {
186
- * const net = require('net');
186
+ * const net = require('node:net');
187
187
  * const server = net.createServer((socket) => {
188
188
  * // Connections never end
189
189
  * });
@@ -213,12 +213,12 @@ declare module 'cluster' {
213
213
  * because of exiting or being signaled). Otherwise, it returns `false`.
214
214
  *
215
215
  * ```js
216
- * import cluster from 'cluster';
217
- * import http from 'http';
218
- * import { cpus } from 'os';
219
- * import process from 'process';
216
+ * import cluster from 'node:cluster';
217
+ * import http from 'node:http';
218
+ * import { availableParallelism } from 'node:os';
219
+ * import process from 'node:process';
220
220
  *
221
- * const numCPUs = cpus().length;
221
+ * const numCPUs = availableParallelism();
222
222
  *
223
223
  * if (cluster.isPrimary) {
224
224
  * console.log(`Primary ${process.pid} is running`);
node/console.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
- * The `console` module provides a simple debugging console that is similar to the
3
- * JavaScript console mechanism provided by web browsers.
2
+ * The `node:console` module provides a simple debugging console that is similar to
3
+ * the JavaScript console mechanism provided by web browsers.
4
4
  *
5
5
  * The module exports two specific components:
6
6
  *
7
- * * A `Console` class with methods such as `console.log()`, `console.error()` and`console.warn()` that can be used to write to any Node.js stream.
8
- * * A global `console` instance configured to write to `process.stdout` and `process.stderr`. The global `console` can be used without calling`require('console')`.
7
+ * * A `Console` class with methods such as `console.log()`, `console.error()`, and`console.warn()` that can be used to write to any Node.js stream.
8
+ * * A global `console` instance configured to write to `process.stdout` and `process.stderr`. The global `console` can be used without calling`require('node:console')`.
9
9
  *
10
10
  * _**Warning**_: The global console object's methods are neither consistently
11
11
  * synchronous like the browser APIs they resemble, nor are they consistently
@@ -53,7 +53,7 @@
53
53
  * myConsole.warn(`Danger ${name}! Danger!`);
54
54
  * // Prints: Danger Will Robinson! Danger!, to err
55
55
  * ```
56
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/console.js)
56
+ * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/console.js)
57
57
  */
58
58
  declare module 'console' {
59
59
  import console = require('node:console');