@types/node 18.16.5 → 20.1.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 (111) hide show
  1. node v18.16/README.md → node/README.md +2 -2
  2. node v18.16/ts4.8/assert.d.ts → node/assert.d.ts +71 -75
  3. node v18.16/async_hooks.d.ts → node/async_hooks.d.ts +62 -42
  4. node v18.16/buffer.d.ts → node/buffer.d.ts +127 -99
  5. node v18.16/child_process.d.ts → node/child_process.d.ts +50 -54
  6. node v18.16/ts4.8/cluster.d.ts → node/cluster.d.ts +12 -12
  7. node v18.16/ts4.8/console.d.ts → node/console.d.ts +5 -5
  8. node v18.16/crypto.d.ts → node/crypto.d.ts +209 -220
  9. node v18.16/ts4.8/dgram.d.ts → node/dgram.d.ts +15 -15
  10. node v18.16/diagnostics_channel.d.ts → node/diagnostics_channel.d.ts +25 -26
  11. node v18.16/dns/promises.d.ts → node/dns/promises.d.ts +6 -6
  12. node v18.16/ts4.8/dns.d.ts → node/dns.d.ts +24 -16
  13. node v18.16/domain.d.ts → node/domain.d.ts +4 -4
  14. node v18.16/events.d.ts → node/events.d.ts +60 -60
  15. node v18.16/fs/promises.d.ts → node/fs/promises.d.ts +78 -48
  16. node v18.16/fs.d.ts → node/fs.d.ts +117 -81
  17. node v18.16/http.d.ts → node/http.d.ts +155 -145
  18. node v18.16/ts4.8/http2.d.ts → node/http2.d.ts +42 -46
  19. node v18.16/https.d.ts → node/https.d.ts +52 -153
  20. node v18.16/index.d.ts → node/index.d.ts +1 -1
  21. node v18.16/ts4.8/inspector.d.ts → node/inspector.d.ts +10 -3
  22. node v18.16/ts4.8/module.d.ts → node/module.d.ts +5 -4
  23. node v18.16/ts4.8/net.d.ts → node/net.d.ts +24 -21
  24. node v18.16/ts4.8/os.d.ts → node/os.d.ts +22 -18
  25. node v18.16/package.json → node/package.json +2 -2
  26. node v18.16/ts4.8/path.d.ts → node/path.d.ts +4 -4
  27. node v18.16/perf_hooks.d.ts → node/perf_hooks.d.ts +28 -15
  28. node v18.16/process.d.ts → node/process.d.ts +43 -46
  29. node v18.16/ts4.8/punycode.d.ts → node/punycode.d.ts +1 -1
  30. node v18.16/ts4.8/querystring.d.ts → node/querystring.d.ts +5 -5
  31. node v18.16/readline/promises.d.ts → node/readline/promises.d.ts +6 -4
  32. node v18.16/readline.d.ts → node/readline.d.ts +15 -15
  33. node v18.16/repl.d.ts → node/repl.d.ts +9 -9
  34. node v18.16/stream/consumers.d.ts → node/stream/consumers.d.ts +1 -1
  35. node v18.16/stream.d.ts → node/stream.d.ts +88 -136
  36. node v18.16/ts4.8/string_decoder.d.ts → node/string_decoder.d.ts +6 -6
  37. node v18.16/ts4.8/test.d.ts → node/test.d.ts +423 -186
  38. node v18.16/timers/promises.d.ts → node/timers/promises.d.ts +3 -3
  39. node v18.16/timers.d.ts → node/timers.d.ts +2 -2
  40. node v18.16/ts4.8/tls.d.ts → node/tls.d.ts +24 -16
  41. node v18.16/ts4.8/trace_events.d.ts → node/trace_events.d.ts +20 -9
  42. node v18.16/assert.d.ts → node/ts4.8/assert.d.ts +71 -75
  43. node v18.16/ts4.8/async_hooks.d.ts → node/ts4.8/async_hooks.d.ts +62 -42
  44. node v18.16/ts4.8/buffer.d.ts → node/ts4.8/buffer.d.ts +127 -99
  45. node v18.16/ts4.8/child_process.d.ts → node/ts4.8/child_process.d.ts +50 -54
  46. node v18.16/cluster.d.ts → node/ts4.8/cluster.d.ts +12 -12
  47. node v18.16/console.d.ts → node/ts4.8/console.d.ts +5 -5
  48. node v18.16/ts4.8/crypto.d.ts → node/ts4.8/crypto.d.ts +209 -220
  49. node v18.16/dgram.d.ts → node/ts4.8/dgram.d.ts +15 -15
  50. node v18.16/ts4.8/diagnostics_channel.d.ts → node/ts4.8/diagnostics_channel.d.ts +25 -26
  51. node v18.16/ts4.8/dns/promises.d.ts → node/ts4.8/dns/promises.d.ts +6 -6
  52. node v18.16/dns.d.ts → node/ts4.8/dns.d.ts +24 -16
  53. node v18.16/ts4.8/domain.d.ts → node/ts4.8/domain.d.ts +4 -4
  54. node v18.16/ts4.8/events.d.ts → node/ts4.8/events.d.ts +60 -60
  55. node v18.16/ts4.8/fs/promises.d.ts → node/ts4.8/fs/promises.d.ts +96 -45
  56. node v18.16/ts4.8/fs.d.ts → node/ts4.8/fs.d.ts +203 -67
  57. node v18.16/ts4.8/globals.d.ts → node/ts4.8/globals.d.ts +29 -28
  58. node v18.16/ts4.8/http.d.ts → node/ts4.8/http.d.ts +198 -126
  59. node v18.16/http2.d.ts → node/ts4.8/http2.d.ts +42 -46
  60. node v18.16/ts4.8/https.d.ts → node/ts4.8/https.d.ts +52 -153
  61. node v18.16/inspector.d.ts → node/ts4.8/inspector.d.ts +10 -3
  62. node v18.16/module.d.ts → node/ts4.8/module.d.ts +5 -4
  63. node v18.16/net.d.ts → node/ts4.8/net.d.ts +21 -18
  64. node v18.16/os.d.ts → node/ts4.8/os.d.ts +22 -18
  65. node v18.16/path.d.ts → node/ts4.8/path.d.ts +4 -4
  66. node v18.16/ts4.8/perf_hooks.d.ts → node/ts4.8/perf_hooks.d.ts +28 -15
  67. node v18.16/ts4.8/process.d.ts → node/ts4.8/process.d.ts +43 -46
  68. node v18.16/punycode.d.ts → node/ts4.8/punycode.d.ts +1 -1
  69. node v18.16/querystring.d.ts → node/ts4.8/querystring.d.ts +5 -5
  70. node v18.16/ts4.8/readline/promises.d.ts → node/ts4.8/readline/promises.d.ts +6 -4
  71. node v18.16/ts4.8/readline.d.ts → node/ts4.8/readline.d.ts +15 -15
  72. node v18.16/ts4.8/repl.d.ts → node/ts4.8/repl.d.ts +9 -9
  73. node v18.16/ts4.8/stream/consumers.d.ts → node/ts4.8/stream/consumers.d.ts +1 -1
  74. node v18.16/ts4.8/stream.d.ts → node/ts4.8/stream.d.ts +91 -139
  75. node v18.16/string_decoder.d.ts → node/ts4.8/string_decoder.d.ts +6 -6
  76. node v18.16/test.d.ts → node/ts4.8/test.d.ts +423 -186
  77. node v18.16/ts4.8/timers/promises.d.ts → node/ts4.8/timers/promises.d.ts +3 -3
  78. node v18.16/ts4.8/timers.d.ts → node/ts4.8/timers.d.ts +9 -2
  79. node v18.16/tls.d.ts → node/ts4.8/tls.d.ts +24 -16
  80. node v18.16/trace_events.d.ts → node/ts4.8/trace_events.d.ts +20 -9
  81. node v18.16/tty.d.ts → node/ts4.8/tty.d.ts +4 -5
  82. node v18.16/ts4.8/url.d.ts → node/ts4.8/url.d.ts +26 -36
  83. node v18.16/ts4.8/util.d.ts → node/ts4.8/util.d.ts +143 -116
  84. node v18.16/ts4.8/v8.d.ts → node/ts4.8/v8.d.ts +110 -16
  85. node v18.16/vm.d.ts → node/ts4.8/vm.d.ts +292 -42
  86. node v18.16/wasi.d.ts → node/ts4.8/wasi.d.ts +13 -19
  87. node v18.16/ts4.8/worker_threads.d.ts → node/ts4.8/worker_threads.d.ts +32 -34
  88. node v18.16/zlib.d.ts → node/ts4.8/zlib.d.ts +11 -11
  89. node v18.16/ts4.8/tty.d.ts → node/tty.d.ts +4 -5
  90. node v18.16/url.d.ts → node/url.d.ts +26 -36
  91. node v18.16/util.d.ts → node/util.d.ts +146 -111
  92. node v18.16/v8.d.ts → node/v8.d.ts +110 -16
  93. node v18.16/ts4.8/vm.d.ts → node/vm.d.ts +292 -42
  94. node v18.16/ts4.8/wasi.d.ts → node/wasi.d.ts +13 -19
  95. node v18.16/worker_threads.d.ts → node/worker_threads.d.ts +32 -34
  96. node v18.16/ts4.8/zlib.d.ts → node/zlib.d.ts +11 -11
  97. {node v18.16 → node}/LICENSE +0 -0
  98. {node v18.16 → node}/assert/strict.d.ts +0 -0
  99. {node v18.16 → node}/constants.d.ts +0 -0
  100. {node v18.16 → node}/dom-events.d.ts +0 -0
  101. {node v18.16 → node}/globals.d.ts +0 -0
  102. {node v18.16 → node}/globals.global.d.ts +0 -0
  103. {node v18.16 → node}/stream/promises.d.ts +0 -0
  104. {node v18.16 → node}/stream/web.d.ts +0 -0
  105. {node v18.16 → node}/ts4.8/assert/strict.d.ts +0 -0
  106. {node v18.16 → node}/ts4.8/constants.d.ts +0 -0
  107. {node v18.16 → node}/ts4.8/dom-events.d.ts +0 -0
  108. {node v18.16 → node}/ts4.8/globals.global.d.ts +0 -0
  109. {node v18.16 → node}/ts4.8/index.d.ts +0 -0
  110. {node v18.16 → node}/ts4.8/stream/promises.d.ts +0 -0
  111. {node v18.16 → node}/ts4.8/stream/web.d.ts +0 -0
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The `timers/promises` API provides an alternative set of timer functions
3
- * that return `Promise` objects. The API is accessible via`require('timers/promises')`.
3
+ * that return `Promise` objects. The API is accessible via`require('node:timers/promises')`.
4
4
  *
5
5
  * ```js
6
6
  * import {
@@ -44,6 +44,8 @@ declare module 'timers/promises' {
44
44
  function setImmediate<T = void>(value?: T, options?: TimerOptions): Promise<T>;
45
45
  /**
46
46
  * Returns an async iterator that generates values in an interval of `delay` ms.
47
+ * If `ref` is `true`, you need to call `next()` of async iterator explicitly
48
+ * or implicitly to keep the event loop alive.
47
49
  *
48
50
  * ```js
49
51
  * import {
@@ -62,7 +64,6 @@ declare module 'timers/promises' {
62
64
  * @since v15.9.0
63
65
  */
64
66
  function setInterval<T = void>(delay?: number, value?: T, options?: TimerOptions): AsyncIterable<T>;
65
-
66
67
  interface Scheduler {
67
68
  /**
68
69
  * ```js
@@ -85,7 +86,6 @@ declare module 'timers/promises' {
85
86
  */
86
87
  yield: () => Promise<void>;
87
88
  }
88
-
89
89
  const scheduler: Scheduler;
90
90
  }
91
91
  declare module 'node:timers/promises' {
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * The `timer` module exposes a global API for scheduling functions to
3
3
  * be called at some future period of time. Because the timer functions are
4
- * globals, there is no need to call `require('timers')` to use the API.
4
+ * globals, there is no need to call `require('node:timers')` to use the API.
5
5
  *
6
6
  * The timer functions within Node.js implement a similar API as the timers API
7
7
  * provided by Web Browsers but use a different internal implementation that is
8
8
  * built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout).
9
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/timers.js)
9
+ * @see [source](https://github.com/nodejs/node/blob/v20.1.0/lib/timers.js)
10
10
  */
11
11
  declare module 'timers' {
12
12
  import { Abortable } from 'node:events';
@@ -1,12 +1,12 @@
1
1
  /**
2
- * The `tls` module provides an implementation of the Transport Layer Security
2
+ * The `node:tls` module provides an implementation of the Transport Layer Security
3
3
  * (TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL.
4
4
  * The module can be accessed using:
5
5
  *
6
6
  * ```js
7
- * const tls = require('tls');
7
+ * const tls = require('node:tls');
8
8
  * ```
9
- * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/tls.js)
9
+ * @see [source](https://github.com/nodejs/node/blob/v20.1.0/lib/tls.js)
10
10
  */
11
11
  declare module 'tls' {
12
12
  import { X509Certificate } from 'node:crypto';
@@ -212,7 +212,7 @@ declare module 'tls' {
212
212
  *
213
213
  * Instances of `tls.TLSSocket` implement the duplex `Stream` interface.
214
214
  *
215
- * Methods that return TLS connection metadata (e.g.{@link TLSSocket.getPeerCertificate} will only return data while the
215
+ * Methods that return TLS connection metadata (e.g.{@link TLSSocket.getPeerCertificate}) will only return data while the
216
216
  * connection is open.
217
217
  * @since v0.11.4
218
218
  */
@@ -259,13 +259,13 @@ declare module 'tls' {
259
259
  /**
260
260
  * Returns an object containing information on the negotiated cipher suite.
261
261
  *
262
- * For example:
262
+ * For example, a TLSv1.2 protocol with AES256-SHA cipher:
263
263
  *
264
264
  * ```json
265
265
  * {
266
- * "name": "AES128-SHA256",
267
- * "standardName": "TLS_RSA_WITH_AES_128_CBC_SHA256",
268
- * "version": "TLSv1.2"
266
+ * "name": "AES256-SHA",
267
+ * "standardName": "TLS_RSA_WITH_AES_256_CBC_SHA",
268
+ * "version": "SSLv3"
269
269
  * }
270
270
  * ```
271
271
  *
@@ -637,7 +637,8 @@ declare module 'tls' {
637
637
  * used.
638
638
  * @since v0.5.3
639
639
  * @param hostname A SNI host name or wildcard (e.g. `'*'`)
640
- * @param context An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc).
640
+ * @param context An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc), or a TLS context object created
641
+ * with {@link createSecureContext} itself.
641
642
  */
642
643
  addContext(hostname: string, context: SecureContextOptions): void;
643
644
  /**
@@ -912,14 +913,14 @@ declare module 'tls' {
912
913
  * Creates a new {@link Server}. The `secureConnectionListener`, if provided, is
913
914
  * automatically set as a listener for the `'secureConnection'` event.
914
915
  *
915
- * The `ticketKeys` options is automatically shared between `cluster` module
916
+ * The `ticketKeys` options is automatically shared between `node:cluster` module
916
917
  * workers.
917
918
  *
918
919
  * The following illustrates a simple echo server:
919
920
  *
920
921
  * ```js
921
- * const tls = require('tls');
922
- * const fs = require('fs');
922
+ * const tls = require('node:tls');
923
+ * const fs = require('node:fs');
923
924
  *
924
925
  * const options = {
925
926
  * key: fs.readFileSync('server-key.pem'),
@@ -929,7 +930,7 @@ declare module 'tls' {
929
930
  * requestCert: true,
930
931
  *
931
932
  * // This is necessary only if the client uses a self-signed certificate.
932
- * ca: [ fs.readFileSync('client-cert.pem') ]
933
+ * ca: [ fs.readFileSync('client-cert.pem') ],
933
934
  * };
934
935
  *
935
936
  * const server = tls.createServer(options, (socket) => {
@@ -964,8 +965,8 @@ declare module 'tls' {
964
965
  *
965
966
  * ```js
966
967
  * // Assumes an echo server that is listening on port 8000.
967
- * const tls = require('tls');
968
- * const fs = require('fs');
968
+ * const tls = require('node:tls');
969
+ * const fs = require('node:fs');
969
970
  *
970
971
  * const options = {
971
972
  * // Necessary only if the server requires client certificate authentication.
@@ -1041,12 +1042,19 @@ declare module 'tls' {
1041
1042
  * APIs that create secure contexts have no default value.
1042
1043
  *
1043
1044
  * The `tls.createSecureContext()` method creates a `SecureContext` object. It is
1044
- * usable as an argument to several `tls` APIs, such as {@link createServer} and `server.addContext()`, but has no public methods.
1045
+ * usable as an argument to several `tls` APIs, such as `server.addContext()`,
1046
+ * but has no public methods. The {@link Server} constructor and the {@link createServer} method do not support the `secureContext` option.
1045
1047
  *
1046
1048
  * A key is _required_ for ciphers that use certificates. Either `key` or`pfx` can be used to provide it.
1047
1049
  *
1048
1050
  * If the `ca` option is not given, then Node.js will default to using [Mozilla's publicly trusted list of
1049
1051
  * CAs](https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt).
1052
+ *
1053
+ * Custom DHE parameters are discouraged in favor of the new `dhparam: 'auto'`option. When set to `'auto'`, well-known DHE parameters of sufficient strength
1054
+ * will be selected automatically. Otherwise, if necessary, `openssl dhparam` can
1055
+ * be used to create custom parameters. The key length must be greater than or
1056
+ * equal to 1024 bits or else an error will be thrown. Although 1024 bits is
1057
+ * permissible, use 2048 bits or larger for stronger security.
1050
1058
  * @since v0.11.13
1051
1059
  */
1052
1060
  function createSecureContext(options?: SecureContextOptions): SecureContext;
@@ -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.1.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'] });