@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
@@ -1,9 +1,9 @@
1
1
  /**
2
- * The `trace_events` module provides a mechanism to centralize tracing information
3
- * generated by V8, Node.js core, and userspace code.
2
+ * The `node:trace_events` module provides a mechanism to centralize tracing
3
+ * information generated by V8, Node.js core, and userspace code.
4
4
  *
5
5
  * Tracing can be enabled with the `--trace-event-categories` command-line flag
6
- * or by using the `trace_events` module. The `--trace-event-categories` flag
6
+ * or by using the `node:trace_events` module. The `--trace-event-categories` flag
7
7
  * accepts a list of comma-separated category names.
8
8
  *
9
9
  * The available categories are:
@@ -13,9 +13,19 @@
13
13
  * The `async_hooks` events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property.
14
14
  * * `node.bootstrap`: Enables capture of Node.js bootstrap milestones.
15
15
  * * `node.console`: Enables capture of `console.time()` and `console.count()`output.
16
+ * * `node.threadpoolwork.sync`: Enables capture of trace data for threadpool
17
+ * synchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`.
18
+ * * `node.threadpoolwork.async`: Enables capture of trace data for threadpool
19
+ * asynchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`.
16
20
  * * `node.dns.native`: Enables capture of trace data for DNS queries.
21
+ * * `node.net.native`: Enables capture of trace data for network.
17
22
  * * `node.environment`: Enables capture of Node.js Environment milestones.
18
23
  * * `node.fs.sync`: Enables capture of trace data for file system sync methods.
24
+ * * `node.fs_dir.sync`: Enables capture of trace data for file system sync
25
+ * directory methods.
26
+ * * `node.fs.async`: Enables capture of trace data for file system async methods.
27
+ * * `node.fs_dir.async`: Enables capture of trace data for file system async
28
+ * directory methods.
19
29
  * * `node.perf`: Enables capture of `Performance API` measurements.
20
30
  * * `node.perf.usertiming`: Enables capture of only Performance API User Timing
21
31
  * measures and marks.
@@ -23,8 +33,9 @@
23
33
  * measurements.
24
34
  * * `node.promises.rejections`: Enables capture of trace data tracking the number
25
35
  * of unhandled Promise rejections and handled-after-rejections.
26
- * * `node.vm.script`: Enables capture of trace data for the `vm` module's`runInNewContext()`, `runInContext()`, and `runInThisContext()` methods.
36
+ * * `node.vm.script`: Enables capture of trace data for the `node:vm` module's`runInNewContext()`, `runInContext()`, and `runInThisContext()` methods.
27
37
  * * `v8`: The `V8` events are GC, compiling, and execution related.
38
+ * * `node.http`: Enables capture of trace data for http request / response.
28
39
  *
29
40
  * By default the `node`, `node.async_hooks`, and `v8` categories are enabled.
30
41
  *
@@ -43,10 +54,10 @@
43
54
  * node --trace-event-categories v8,node,node.async_hooks
44
55
  * ```
45
56
  *
46
- * Alternatively, trace events may be enabled using the `trace_events` module:
57
+ * Alternatively, trace events may be enabled using the `node:trace_events` module:
47
58
  *
48
59
  * ```js
49
- * const trace_events = require('trace_events');
60
+ * const trace_events = require('node:trace_events');
50
61
  * const tracing = trace_events.createTracing({ categories: ['node.perf'] });
51
62
  * tracing.enable(); // Enable trace event capture for the 'node.perf' category
52
63
  *
@@ -83,7 +94,7 @@
83
94
  *
84
95
  * The features from this module are not available in `Worker` threads.
85
96
  * @experimental
86
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/trace_events.js)
97
+ * @see [source](https://github.com/nodejs/node/blob/v20.0.0/lib/trace_events.js)
87
98
  */
88
99
  declare module 'trace_events' {
89
100
  /**
@@ -132,7 +143,7 @@ declare module 'trace_events' {
132
143
  * Creates and returns a `Tracing` object for the given set of `categories`.
133
144
  *
134
145
  * ```js
135
- * const trace_events = require('trace_events');
146
+ * const trace_events = require('node:trace_events');
136
147
  * const categories = ['node.perf', 'node.async_hooks'];
137
148
  * const tracing = trace_events.createTracing({ categories });
138
149
  * tracing.enable();
@@ -152,7 +163,7 @@ declare module 'trace_events' {
152
163
  * Given the file `test.js` below, the command`node --trace-event-categories node.perf test.js` will print`'node.async_hooks,node.perf'` to the console.
153
164
  *
154
165
  * ```js
155
- * const trace_events = require('trace_events');
166
+ * const trace_events = require('node:trace_events');
156
167
  * const t1 = trace_events.createTracing({ categories: ['node.async_hooks'] });
157
168
  * const t2 = trace_events.createTracing({ categories: ['node.perf'] });
158
169
  * const t3 = trace_events.createTracing({ categories: ['v8'] });
node/ts4.8/tty.d.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  /**
2
- * The `tty` module provides the `tty.ReadStream` and `tty.WriteStream` classes.
3
- * In most cases, it will not be necessary or possible to use this module directly.
4
- * However, it can be accessed using:
2
+ * The `node:tty` module provides the `tty.ReadStream` and `tty.WriteStream`classes. In most cases, it will not be necessary or possible to use this module
3
+ * directly. However, it can be accessed using:
5
4
  *
6
5
  * ```js
7
- * const tty = require('tty');
6
+ * const tty = require('node:tty');
8
7
  * ```
9
8
  *
10
9
  * When Node.js detects that it is being run with a text terminal ("TTY")
@@ -22,7 +21,7 @@
22
21
  *
23
22
  * In most cases, there should be little to no reason for an application to
24
23
  * manually create instances of the `tty.ReadStream` and `tty.WriteStream`classes.
25
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/tty.js)
24
+ * @see [source](https://github.com/nodejs/node/blob/v20.0.0/lib/tty.js)
26
25
  */
27
26
  declare module 'tty' {
28
27
  import * as net from 'node:net';
node/ts4.8/url.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  /**
2
- * The `url` module provides utilities for URL resolution and parsing. It can be
3
- * accessed using:
2
+ * The `node:url` module provides utilities for URL resolution and parsing. It can
3
+ * be accessed using:
4
4
  *
5
5
  * ```js
6
- * import url from 'url';
6
+ * import url from 'node:url';
7
7
  * ```
8
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/url.js)
8
+ * @see [source](https://github.com/nodejs/node/blob/v20.0.0/lib/url.js)
9
9
  */
10
10
  declare module 'url' {
11
11
  import { Blob as NodeBlob } from 'node:buffer';
@@ -54,17 +54,11 @@ declare module 'url' {
54
54
  *
55
55
  * A `URIError` is thrown if the `auth` property is present but cannot be decoded.
56
56
  *
57
- * Use of the legacy `url.parse()` method is discouraged. Users should
58
- * use the WHATWG `URL` API. Because the `url.parse()` method uses a
59
- * lenient, non-standard algorithm for parsing URL strings, security
60
- * issues can be introduced. Specifically, issues with [host name spoofing](https://hackerone.com/reports/678487) and
61
- * incorrect handling of usernames and passwords have been identified.
62
- *
63
- * Deprecation of this API has been shelved for now primarily due to the the
64
- * inability of the [WHATWG API to parse relative URLs](https://github.com/nodejs/node/issues/12682#issuecomment-1154492373).
65
- * [Discussions are ongoing](https://github.com/whatwg/url/issues/531) for the best way to resolve this.
66
- *
57
+ * `url.parse()` uses a lenient, non-standard algorithm for parsing URL
58
+ * strings. It is prone to security issues such as [host name spoofing](https://hackerone.com/reports/678487) and incorrect handling of usernames and passwords. Do not use with untrusted
59
+ * input. CVEs are not issued for `url.parse()` vulnerabilities. Use the `WHATWG URL` API instead.
67
60
  * @since v0.1.25
61
+ * @deprecated Use the WHATWG URL API instead.
68
62
  * @param urlString The URL string to parse.
69
63
  * @param [parseQueryString=false] If `true`, the `query` property will always be set to an object returned by the {@link querystring} module's `parse()` method. If `false`, the `query` property
70
64
  * on the returned URL object will be an unparsed, undecoded string.
@@ -79,15 +73,15 @@ declare module 'url' {
79
73
  * The `url.format()` method returns a formatted URL string derived from`urlObject`.
80
74
  *
81
75
  * ```js
82
- * const url = require('url');
76
+ * const url = require('node:url');
83
77
  * url.format({
84
78
  * protocol: 'https',
85
79
  * hostname: 'example.com',
86
80
  * pathname: '/some/path',
87
81
  * query: {
88
82
  * page: 1,
89
- * format: 'json'
90
- * }
83
+ * format: 'json',
84
+ * },
91
85
  * });
92
86
  *
93
87
  * // => 'https://example.com/some/path?page=1&format=json'
@@ -208,7 +202,7 @@ declare module 'url' {
208
202
  * manner similar to that of a web browser resolving an anchor tag.
209
203
  *
210
204
  * ```js
211
- * const url = require('url');
205
+ * const url = require('node:url');
212
206
  * url.resolve('/one/two/three', 'four'); // '/one/two/four'
213
207
  * url.resolve('http://example.com/', '/one'); // 'http://example.com/one'
214
208
  * url.resolve('http://example.com/one', '/two'); // 'http://example.com/two'
@@ -243,10 +237,8 @@ declare module 'url' {
243
237
  *
244
238
  * It performs the inverse operation to {@link domainToUnicode}.
245
239
  *
246
- * This feature is only available if the `node` executable was compiled with `ICU` enabled. If not, the domain names are passed through unchanged.
247
- *
248
240
  * ```js
249
- * import url from 'url';
241
+ * import url from 'node:url';
250
242
  *
251
243
  * console.log(url.domainToASCII('español.com'));
252
244
  * // Prints xn--espaol-zwa.com
@@ -264,10 +256,8 @@ declare module 'url' {
264
256
  *
265
257
  * It performs the inverse operation to {@link domainToASCII}.
266
258
  *
267
- * This feature is only available if the `node` executable was compiled with `ICU` enabled. If not, the domain names are passed through unchanged.
268
- *
269
259
  * ```js
270
- * import url from 'url';
260
+ * import url from 'node:url';
271
261
  *
272
262
  * console.log(url.domainToUnicode('xn--espaol-zwa.com'));
273
263
  * // Prints español.com
@@ -284,7 +274,7 @@ declare module 'url' {
284
274
  * well as ensuring a cross-platform valid absolute path string.
285
275
  *
286
276
  * ```js
287
- * import { fileURLToPath } from 'url';
277
+ * import { fileURLToPath } from 'node:url';
288
278
  *
289
279
  * const __filename = fileURLToPath(import.meta.url);
290
280
  *
@@ -310,7 +300,7 @@ declare module 'url' {
310
300
  * control characters are correctly encoded when converting into a File URL.
311
301
  *
312
302
  * ```js
313
- * import { pathToFileURL } from 'url';
303
+ * import { pathToFileURL } from 'node:url';
314
304
  *
315
305
  * new URL('/foo#1', 'file:'); // Incorrect: file:///foo#1
316
306
  * pathToFileURL('/foo#1'); // Correct: file:///foo%231 (POSIX)
@@ -328,7 +318,7 @@ declare module 'url' {
328
318
  * expected by the `http.request()` and `https.request()` APIs.
329
319
  *
330
320
  * ```js
331
- * import { urlToHttpOptions } from 'url';
321
+ * import { urlToHttpOptions } from 'node:url';
332
322
  * const myURL = new URL('https://a:b@測試?abc#foo');
333
323
  *
334
324
  * console.log(urlToHttpOptions(myURL));
@@ -376,7 +366,7 @@ declare module 'url' {
376
366
  * const {
377
367
  * Blob,
378
368
  * resolveObjectURL,
379
- * } = require('buffer');
369
+ * } = require('node:buffer');
380
370
  *
381
371
  * const blob = new Blob(['hello']);
382
372
  * const id = URL.createObjectURL(blob);
@@ -398,7 +388,7 @@ declare module 'url' {
398
388
  static createObjectURL(blob: NodeBlob): string;
399
389
  /**
400
390
  * Removes the stored `Blob` identified by the given ID. Attempting to revoke a
401
- * ID that isnt registered will silently fail.
391
+ * ID that isn't registered will silently fail.
402
392
  * @since v16.7.0
403
393
  * @experimental
404
394
  * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
@@ -449,7 +439,7 @@ declare module 'url' {
449
439
  * // Prints example.org
450
440
  *
451
441
  * // Setting the hostname does not change the port
452
- * myURL.hostname = 'example.com:82';
442
+ * myURL.hostname = 'example.com';
453
443
  * console.log(myURL.href);
454
444
  * // Prints https://example.com:81/foo
455
445
  *
@@ -512,7 +502,7 @@ declare module 'url' {
512
502
  *
513
503
  * myURL.password = '123';
514
504
  * console.log(myURL.href);
515
- * // Prints https://abc:123@example.com
505
+ * // Prints https://abc:123@example.com/
516
506
  * ```
517
507
  *
518
508
  * Invalid URL characters included in the value assigned to the `password` property
@@ -656,14 +646,14 @@ declare module 'url' {
656
646
  * character, while `URLSearchParams` will always encode it:
657
647
  *
658
648
  * ```js
659
- * const myUrl = new URL('https://example.org/abc?foo=~bar');
649
+ * const myURL = new URL('https://example.org/abc?foo=~bar');
660
650
  *
661
- * console.log(myUrl.search); // prints ?foo=~bar
651
+ * console.log(myURL.search); // prints ?foo=~bar
662
652
  *
663
653
  * // Modify the URL via searchParams...
664
- * myUrl.searchParams.sort();
654
+ * myURL.searchParams.sort();
665
655
  *
666
- * console.log(myUrl.search); // prints ?foo=%7Ebar
656
+ * console.log(myURL.search); // prints ?foo=%7Ebar
667
657
  * ```
668
658
  */
669
659
  readonly searchParams: URLSearchParams;
@@ -835,7 +825,7 @@ declare module 'url' {
835
825
  set(name: string, value: string): void;
836
826
  /**
837
827
  * The total number of parameter entries.
838
- * @since v18.16.0
828
+ * @since v19.8.0
839
829
  */
840
830
  readonly size: number;
841
831
  /**