@types/node 18.16.2 → 20.0.0

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 (95) hide show
  1. node/README.md +1 -1
  2. node/assert.d.ts +68 -73
  3. node/async_hooks.d.ts +62 -42
  4. node/buffer.d.ts +123 -95
  5. node/child_process.d.ts +50 -54
  6. node/cluster.d.ts +12 -12
  7. node/console.d.ts +5 -5
  8. node/crypto.d.ts +209 -220
  9. node/dgram.d.ts +15 -15
  10. node/diagnostics_channel.d.ts +25 -26
  11. node/dns/promises.d.ts +6 -6
  12. node/dns.d.ts +16 -16
  13. node/domain.d.ts +3 -3
  14. node/events.d.ts +60 -60
  15. node/fs/promises.d.ts +74 -48
  16. node/fs.d.ts +91 -81
  17. node/http.d.ts +147 -144
  18. node/http2.d.ts +42 -46
  19. node/https.d.ts +52 -153
  20. node/index.d.ts +1 -1
  21. node/inspector.d.ts +10 -3
  22. node/module.d.ts +5 -4
  23. node/net.d.ts +21 -18
  24. node/os.d.ts +22 -18
  25. node/package.json +2 -2
  26. node/path.d.ts +4 -4
  27. node/perf_hooks.d.ts +28 -15
  28. node/process.d.ts +43 -46
  29. node/punycode.d.ts +1 -1
  30. node/querystring.d.ts +5 -5
  31. node/readline/promises.d.ts +6 -4
  32. node/readline.d.ts +15 -15
  33. node/repl.d.ts +9 -9
  34. node/stream/consumers.d.ts +1 -1
  35. node/stream.d.ts +74 -136
  36. node/string_decoder.d.ts +6 -6
  37. node/test.d.ts +0 -76
  38. node/timers/promises.d.ts +3 -3
  39. node/timers.d.ts +2 -2
  40. node/tls.d.ts +29 -15
  41. node/trace_events.d.ts +20 -9
  42. node/ts4.8/assert.d.ts +68 -73
  43. node/ts4.8/async_hooks.d.ts +59 -31
  44. node/ts4.8/buffer.d.ts +123 -95
  45. node/ts4.8/child_process.d.ts +50 -54
  46. node/ts4.8/cluster.d.ts +12 -12
  47. node/ts4.8/console.d.ts +5 -5
  48. node/ts4.8/crypto.d.ts +209 -220
  49. node/ts4.8/dgram.d.ts +15 -15
  50. node/ts4.8/diagnostics_channel.d.ts +25 -26
  51. node/ts4.8/dns/promises.d.ts +6 -6
  52. node/ts4.8/dns.d.ts +16 -16
  53. node/ts4.8/domain.d.ts +3 -3
  54. node/ts4.8/events.d.ts +60 -60
  55. node/ts4.8/fs/promises.d.ts +72 -45
  56. node/ts4.8/fs.d.ts +81 -67
  57. node/ts4.8/http.d.ts +133 -126
  58. node/ts4.8/http2.d.ts +42 -46
  59. node/ts4.8/https.d.ts +52 -153
  60. node/ts4.8/inspector.d.ts +10 -3
  61. node/ts4.8/module.d.ts +5 -4
  62. node/ts4.8/net.d.ts +21 -18
  63. node/ts4.8/os.d.ts +22 -18
  64. node/ts4.8/path.d.ts +4 -4
  65. node/ts4.8/perf_hooks.d.ts +28 -15
  66. node/ts4.8/process.d.ts +43 -46
  67. node/ts4.8/punycode.d.ts +1 -1
  68. node/ts4.8/querystring.d.ts +5 -5
  69. node/ts4.8/readline/promises.d.ts +6 -4
  70. node/ts4.8/readline.d.ts +15 -15
  71. node/ts4.8/repl.d.ts +9 -9
  72. node/ts4.8/stream/consumers.d.ts +1 -1
  73. node/ts4.8/stream.d.ts +77 -139
  74. node/ts4.8/string_decoder.d.ts +6 -6
  75. node/ts4.8/test.d.ts +0 -75
  76. node/ts4.8/timers/promises.d.ts +3 -3
  77. node/ts4.8/timers.d.ts +2 -2
  78. node/ts4.8/tls.d.ts +29 -15
  79. node/ts4.8/trace_events.d.ts +20 -9
  80. node/ts4.8/tty.d.ts +4 -5
  81. node/ts4.8/url.d.ts +26 -36
  82. node/ts4.8/util.d.ts +143 -116
  83. node/ts4.8/v8.d.ts +107 -16
  84. node/ts4.8/vm.d.ts +292 -42
  85. node/ts4.8/wasi.d.ts +8 -14
  86. node/ts4.8/worker_threads.d.ts +32 -34
  87. node/ts4.8/zlib.d.ts +11 -11
  88. node/tty.d.ts +4 -5
  89. node/url.d.ts +26 -36
  90. node/util.d.ts +146 -111
  91. node/v8.d.ts +110 -16
  92. node/vm.d.ts +292 -42
  93. node/wasi.d.ts +8 -14
  94. node/worker_threads.d.ts +32 -34
  95. node/zlib.d.ts +11 -11
node/worker_threads.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
- * The `worker_threads` module enables the use of threads that execute JavaScript
3
- * in parallel. To access it:
2
+ * The `node:worker_threads` module enables the use of threads that execute
3
+ * JavaScript in parallel. To access it:
4
4
  *
5
5
  * ```js
6
- * const worker = require('worker_threads');
6
+ * const worker = require('node:worker_threads');
7
7
  * ```
8
8
  *
9
9
  * Workers (threads) are useful for performing CPU-intensive JavaScript operations.
@@ -15,14 +15,14 @@
15
15
  *
16
16
  * ```js
17
17
  * const {
18
- * Worker, isMainThread, parentPort, workerData
19
- * } = require('worker_threads');
18
+ * Worker, isMainThread, parentPort, workerData,
19
+ * } = require('node:worker_threads');
20
20
  *
21
21
  * if (isMainThread) {
22
22
  * module.exports = function parseJSAsync(script) {
23
23
  * return new Promise((resolve, reject) => {
24
24
  * const worker = new Worker(__filename, {
25
- * workerData: script
25
+ * workerData: script,
26
26
  * });
27
27
  * worker.on('message', resolve);
28
28
  * worker.on('error', reject);
@@ -49,7 +49,7 @@
49
49
  *
50
50
  * Worker threads inherit non-process-specific options by default. Refer to `Worker constructor options` to know how to customize worker thread options,
51
51
  * specifically `argv` and `execArgv` options.
52
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/worker_threads.js)
52
+ * @see [source](https://github.com/nodejs/node/blob/v20.0.0/lib/worker_threads.js)
53
53
  */
54
54
  declare module 'worker_threads' {
55
55
  import { Blob } from 'node:buffer';
@@ -72,7 +72,7 @@ declare module 'worker_threads' {
72
72
  * The `MessageChannel` has no methods of its own. `new MessageChannel()`yields an object with `port1` and `port2` properties, which refer to linked `MessagePort` instances.
73
73
  *
74
74
  * ```js
75
- * const { MessageChannel } = require('worker_threads');
75
+ * const { MessageChannel } = require('node:worker_threads');
76
76
  *
77
77
  * const { port1, port2 } = new MessageChannel();
78
78
  * port1.on('message', (message) => console.log('received', message));
@@ -121,7 +121,7 @@ declare module 'worker_threads' {
121
121
  * * `value` may not contain native (C++-backed) objects other than:
122
122
  *
123
123
  * ```js
124
- * const { MessageChannel } = require('worker_threads');
124
+ * const { MessageChannel } = require('node:worker_threads');
125
125
  * const { port1, port2 } = new MessageChannel();
126
126
  *
127
127
  * port1.on('message', (message) => console.log(message));
@@ -132,7 +132,7 @@ declare module 'worker_threads' {
132
132
  * port2.postMessage(circularData);
133
133
  * ```
134
134
  *
135
- * `transferList` may be a list of [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer), `MessagePort` and `FileHandle` objects.
135
+ * `transferList` may be a list of [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer), `MessagePort`, and `FileHandle` objects.
136
136
  * After transferring, they are not usable on the sending side of the channel
137
137
  * anymore (even if they are not contained in `value`). Unlike with `child processes`, transferring handles such as network sockets is currently
138
138
  * not supported.
@@ -143,7 +143,7 @@ declare module 'worker_threads' {
143
143
  * `value` may still contain `ArrayBuffer` instances that are not in`transferList`; in that case, the underlying memory is copied rather than moved.
144
144
  *
145
145
  * ```js
146
- * const { MessageChannel } = require('worker_threads');
146
+ * const { MessageChannel } = require('node:worker_threads');
147
147
  * const { port1, port2 } = new MessageChannel();
148
148
  *
149
149
  * port1.on('message', (message) => console.log(message));
@@ -170,7 +170,7 @@ declare module 'worker_threads' {
170
170
  * posting without having side effects.
171
171
  *
172
172
  * For more information on the serialization and deserialization mechanisms
173
- * behind this API, see the `serialization API of the v8 module`.
173
+ * behind this API, see the `serialization API of the node:v8 module`.
174
174
  * @since v10.5.0
175
175
  */
176
176
  postMessage(value: any, transferList?: ReadonlyArray<TransferListItem>): void;
@@ -294,9 +294,9 @@ declare module 'worker_threads' {
294
294
  *
295
295
  * Notable differences inside a Worker environment are:
296
296
  *
297
- * * The `process.stdin`, `process.stdout` and `process.stderr` may be redirected by the parent thread.
298
- * * The `require('worker_threads').isMainThread` property is set to `false`.
299
- * * The `require('worker_threads').parentPort` message port is available.
297
+ * * The `process.stdin`, `process.stdout`, and `process.stderr` streams may be redirected by the parent thread.
298
+ * * The `require('node:worker_threads').isMainThread` property is set to `false`.
299
+ * * The `require('node:worker_threads').parentPort` message port is available.
300
300
  * * `process.exit()` does not stop the whole program, just the single thread,
301
301
  * and `process.abort()` is not available.
302
302
  * * `process.chdir()` and `process` methods that set group or user ids
@@ -313,11 +313,11 @@ declare module 'worker_threads' {
313
313
  *
314
314
  * Creating `Worker` instances inside of other `Worker`s is possible.
315
315
  *
316
- * Like [Web Workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) and the `cluster module`, two-way communication can be
317
- * achieved through inter-thread message passing. Internally, a `Worker` has a
318
- * built-in pair of `MessagePort` s that are already associated with each other
319
- * when the `Worker` is created. While the `MessagePort` object on the parent side
320
- * is not directly exposed, its functionalities are exposed through `worker.postMessage()` and the `worker.on('message')` event
316
+ * Like [Web Workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API) and the `node:cluster module`, two-way communication
317
+ * can be achieved through inter-thread message passing. Internally, a `Worker` has
318
+ * a built-in pair of `MessagePort` s that are already associated with each
319
+ * other when the `Worker` is created. While the `MessagePort` object on the parent
320
+ * side is not directly exposed, its functionalities are exposed through `worker.postMessage()` and the `worker.on('message')` event
321
321
  * on the `Worker` object for the parent thread.
322
322
  *
323
323
  * To create custom messaging channels (which is encouraged over using the default
@@ -330,10 +330,10 @@ declare module 'worker_threads' {
330
330
  * the thread barrier.
331
331
  *
332
332
  * ```js
333
- * const assert = require('assert');
333
+ * const assert = require('node:assert');
334
334
  * const {
335
- * Worker, MessageChannel, MessagePort, isMainThread, parentPort
336
- * } = require('worker_threads');
335
+ * Worker, MessageChannel, MessagePort, isMainThread, parentPort,
336
+ * } = require('node:worker_threads');
337
337
  * if (isMainThread) {
338
338
  * const worker = new Worker(__filename);
339
339
  * const subChannel = new MessageChannel();
@@ -373,7 +373,7 @@ declare module 'worker_threads' {
373
373
  readonly stderr: Readable;
374
374
  /**
375
375
  * An integer identifier for the referenced thread. Inside the worker thread,
376
- * it is available as `require('worker_threads').threadId`.
376
+ * it is available as `require('node:worker_threads').threadId`.
377
377
  * This value is unique for each `Worker` instance inside a single process.
378
378
  * @since v10.5.0
379
379
  */
@@ -400,7 +400,7 @@ declare module 'worker_threads' {
400
400
  */
401
401
  constructor(filename: string | URL, options?: WorkerOptions);
402
402
  /**
403
- * Send a message to the worker that is received via `require('worker_threads').parentPort.on('message')`.
403
+ * Send a message to the worker that is received via `require('node:worker_threads').parentPort.on('message')`.
404
404
  * See `port.postMessage()` for more details.
405
405
  * @since v10.5.0
406
406
  */
@@ -494,8 +494,8 @@ declare module 'worker_threads' {
494
494
  * const {
495
495
  * isMainThread,
496
496
  * BroadcastChannel,
497
- * Worker
498
- * } = require('worker_threads');
497
+ * Worker,
498
+ * } = require('node:worker_threads');
499
499
  *
500
500
  * const bc = new BroadcastChannel('hello');
501
501
  *
@@ -549,7 +549,7 @@ declare module 'worker_threads' {
549
549
  * This operation cannot be undone.
550
550
  *
551
551
  * ```js
552
- * const { MessageChannel, markAsUntransferable } = require('worker_threads');
552
+ * const { MessageChannel, markAsUntransferable } = require('node:worker_threads');
553
553
  *
554
554
  * const pooledBuffer = new ArrayBuffer(8);
555
555
  * const typedArray1 = new Uint8Array(pooledBuffer);
@@ -591,10 +591,10 @@ declare module 'worker_threads' {
591
591
  function moveMessagePortToContext(port: MessagePort, contextifiedSandbox: Context): MessagePort;
592
592
  /**
593
593
  * Receive a single message from a given `MessagePort`. If no message is available,`undefined` is returned, otherwise an object with a single `message` property
594
- * that contains the message payload, corresponding to the oldest message in the`MessagePort`’s queue.
594
+ * that contains the message payload, corresponding to the oldest message in the`MessagePort`'s queue.
595
595
  *
596
596
  * ```js
597
- * const { MessageChannel, receiveMessageOnPort } = require('worker_threads');
597
+ * const { MessageChannel, receiveMessageOnPort } = require('node:worker_threads');
598
598
  * const { port1, port2 } = new MessageChannel();
599
599
  * port1.postMessage({ hello: 'world' });
600
600
  *
@@ -625,7 +625,7 @@ declare module 'worker_threads' {
625
625
  * isMainThread,
626
626
  * setEnvironmentData,
627
627
  * getEnvironmentData,
628
- * } = require('worker_threads');
628
+ * } = require('node:worker_threads');
629
629
  *
630
630
  * if (isMainThread) {
631
631
  * setEnvironmentData('Hello', 'World!');
@@ -664,7 +664,6 @@ declare module 'worker_threads' {
664
664
  }
665
665
  ? T
666
666
  : typeof _BroadcastChannel;
667
-
668
667
  /**
669
668
  * `MessageChannel` class is a global reference for `require('worker_threads').MessageChannel`
670
669
  * https://nodejs.org/api/globals.html#messagechannel
@@ -676,13 +675,12 @@ declare module 'worker_threads' {
676
675
  }
677
676
  ? T
678
677
  : typeof _MessageChannel;
679
-
680
678
  /**
681
679
  * `MessagePort` class is a global reference for `require('worker_threads').MessagePort`
682
680
  * https://nodejs.org/api/globals.html#messageport
683
681
  * @since v15.0.0
684
682
  */
685
- var MessagePort: typeof globalThis extends {
683
+ var MessagePort: typeof globalThis extends {
686
684
  onmessage: any;
687
685
  MessagePort: infer T;
688
686
  }
node/zlib.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
- * The `zlib` module provides compression functionality implemented using Gzip,
3
- * Deflate/Inflate, and Brotli.
2
+ * The `node:zlib` module provides compression functionality implemented using
3
+ * Gzip, Deflate/Inflate, and Brotli.
4
4
  *
5
5
  * To access it:
6
6
  *
7
7
  * ```js
8
- * const zlib = require('zlib');
8
+ * const zlib = require('node:zlib');
9
9
  * ```
10
10
  *
11
11
  * Compression and decompression are built around the Node.js `Streams API`.
@@ -15,12 +15,12 @@
15
15
  * stream:
16
16
  *
17
17
  * ```js
18
- * const { createGzip } = require('zlib');
19
- * const { pipeline } = require('stream');
18
+ * const { createGzip } = require('node:zlib');
19
+ * const { pipeline } = require('node:stream');
20
20
  * const {
21
21
  * createReadStream,
22
- * createWriteStream
23
- * } = require('fs');
22
+ * createWriteStream,
23
+ * } = require('node:fs');
24
24
  *
25
25
  * const gzip = createGzip();
26
26
  * const source = createReadStream('input.txt');
@@ -35,7 +35,7 @@
35
35
  *
36
36
  * // Or, Promisified
37
37
  *
38
- * const { promisify } = require('util');
38
+ * const { promisify } = require('node:util');
39
39
  * const pipe = promisify(pipeline);
40
40
  *
41
41
  * async function do_gzip(input, output) {
@@ -55,7 +55,7 @@
55
55
  * It is also possible to compress or decompress data in a single step:
56
56
  *
57
57
  * ```js
58
- * const { deflate, unzip } = require('zlib');
58
+ * const { deflate, unzip } = require('node:zlib');
59
59
  *
60
60
  * const input = '.................................';
61
61
  * deflate(input, (err, buffer) => {
@@ -77,7 +77,7 @@
77
77
  *
78
78
  * // Or, Promisified
79
79
  *
80
- * const { promisify } = require('util');
80
+ * const { promisify } = require('node:util');
81
81
  * const do_unzip = promisify(unzip);
82
82
  *
83
83
  * do_unzip(buffer)
@@ -88,7 +88,7 @@
88
88
  * });
89
89
  * ```
90
90
  * @since v0.5.8
91
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/zlib.js)
91
+ * @see [source](https://github.com/nodejs/node/blob/v20.0.0/lib/zlib.js)
92
92
  */
93
93
  declare module 'zlib' {
94
94
  import * as stream from 'node:stream';