@types/node 17.0.44 → 18.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.
node/url.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * ```js
6
6
  * import url from 'url';
7
7
  * ```
8
- * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/url.js)
8
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/url.js)
9
9
  */
10
10
  declare module 'url' {
11
11
  import { Blob } from 'node:buffer';
@@ -205,7 +205,7 @@ declare module 'url' {
205
205
  function format(urlObject: UrlObject | string): string;
206
206
  /**
207
207
  * The `url.resolve()` method resolves a target URL relative to a base URL in a
208
- * manner similar to that of a Web browser resolving an anchor tag HREF.
208
+ * manner similar to that of a web browser resolving an anchor tag.
209
209
  *
210
210
  * ```js
211
211
  * const url = require('url');
@@ -214,7 +214,7 @@ declare module 'url' {
214
214
  * url.resolve('http://example.com/one', '/two'); // 'http://example.com/two'
215
215
  * ```
216
216
  *
217
- * You can achieve the same result using the WHATWG URL API:
217
+ * To achieve the same result using the WHATWG URL API:
218
218
  *
219
219
  * ```js
220
220
  * function resolve(from, to) {
@@ -233,8 +233,8 @@ declare module 'url' {
233
233
  * ```
234
234
  * @since v0.1.25
235
235
  * @deprecated Legacy: Use the WHATWG URL API instead.
236
- * @param from The Base URL being resolved against.
237
- * @param to The HREF URL being resolved.
236
+ * @param from The base URL to use if `to` is a relative URL.
237
+ * @param to The target URL to resolve.
238
238
  */
239
239
  function resolve(from: string, to: string): string;
240
240
  /**
@@ -332,7 +332,7 @@ declare module 'url' {
332
332
  * const myURL = new URL('https://a:b@測試?abc#foo');
333
333
  *
334
334
  * console.log(urlToHttpOptions(myURL));
335
- *
335
+ * /*
336
336
  * {
337
337
  * protocol: 'https:',
338
338
  * hostname: 'xn--g6w251d',
@@ -397,7 +397,8 @@ declare module 'url' {
397
397
  */
398
398
  static createObjectURL(blob: Blob): string;
399
399
  /**
400
- * Removes the stored `Blob` identified by the given ID.
400
+ * Removes the stored `Blob` identified by the given ID. Attempting to revoke a
401
+ * ID that isn’t registered will silently fail.
401
402
  * @since v16.7.0
402
403
  * @experimental
403
404
  * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
@@ -859,7 +860,6 @@ declare module 'url' {
859
860
  values(): IterableIterator<string>;
860
861
  [Symbol.iterator](): IterableIterator<[string, string]>;
861
862
  }
862
-
863
863
  import { URL as _URL, URLSearchParams as _URLSearchParams } from 'url';
864
864
  global {
865
865
  interface URLSearchParams extends _URLSearchParams {}
@@ -873,21 +873,23 @@ declare module 'url' {
873
873
  * https://nodejs.org/api/url.html#the-whatwg-url-api
874
874
  * @since v10.0.0
875
875
  */
876
- var URL:
877
- // For compatibility with "dom" and "webworker" URL declarations
878
- typeof globalThis extends { onmessage: any, URL: infer URL }
879
- ? URL
880
- : typeof _URL;
876
+ var URL: typeof globalThis extends {
877
+ onmessage: any;
878
+ URL: infer URL;
879
+ }
880
+ ? URL
881
+ : typeof _URL;
881
882
  /**
882
883
  * `URLSearchParams` class is a global reference for `require('url').URLSearchParams`
883
884
  * https://nodejs.org/api/url.html#class-urlsearchparams
884
885
  * @since v10.0.0
885
886
  */
886
- var URLSearchParams:
887
- // For compatibility with "dom" and "webworker" URLSearchParams declarations
888
- typeof globalThis extends { onmessage: any, URLSearchParams: infer URLSearchParams }
889
- ? URLSearchParams
890
- : typeof _URLSearchParams;
887
+ var URLSearchParams: typeof globalThis extends {
888
+ onmessage: any;
889
+ URLSearchParams: infer URLSearchParams;
890
+ }
891
+ ? URLSearchParams
892
+ : typeof _URLSearchParams;
891
893
  }
892
894
  }
893
895
  declare module 'node:url' {
node/util.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  * ```js
7
7
  * const util = require('util');
8
8
  * ```
9
- * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/util.js)
9
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/util.js)
10
10
  */
11
11
  declare module 'util' {
12
12
  import * as types from 'node:util/types';
@@ -309,6 +309,21 @@ declare module 'util' {
309
309
  * );
310
310
  * ```
311
311
  *
312
+ * The `numericSeparator` option adds an underscore every three digits to all
313
+ * numbers.
314
+ *
315
+ * ```js
316
+ * const { inspect } = require('util');
317
+ *
318
+ * const thousand = 1_000;
319
+ * const million = 1_000_000;
320
+ * const bigNumber = 123_456_789n;
321
+ * const bigDecimal = 1_234.123_45;
322
+ *
323
+ * console.log(thousand, million, bigNumber, bigDecimal);
324
+ * // 1_000 1_000_000 123_456_789n 1_234.123_45
325
+ * ```
326
+ *
312
327
  * `util.inspect()` is a synchronous method intended for debugging. Its maximum
313
328
  * output length is approximately 128 MB. Inputs that result in longer output will
314
329
  * be truncated.
@@ -859,7 +874,7 @@ declare module 'util' {
859
874
  * callbackFunction((err, ret) => {
860
875
  * // When the Promise was rejected with `null` it is wrapped with an Error and
861
876
  * // the original value is stored in `reason`.
862
- * err &#x26;&#x26; err.hasOwnProperty('reason') &#x26;&#x26; err.reason === null; // true
877
+ * err &#x26;&#x26; Object.hasOwn(err, 'reason') &#x26;&#x26; err.reason === null; // true
863
878
  * });
864
879
  * ```
865
880
  * @since v8.2.0
@@ -998,13 +1013,9 @@ declare module 'util' {
998
1013
  * An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextDecoder` API.
999
1014
  *
1000
1015
  * ```js
1001
- * const decoder = new TextDecoder('shift_jis');
1002
- * let string = '';
1003
- * let buffer;
1004
- * while (buffer = getNextChunkSomehow()) {
1005
- * string += decoder.decode(buffer, { stream: true });
1006
- * }
1007
- * string += decoder.decode(); // end-of-stream
1016
+ * const decoder = new TextDecoder();
1017
+ * const u8arr = new Uint8Array([72, 101, 108, 108, 111]);
1018
+ * console.log(decoder.decode(u8arr)); // Hello
1008
1019
  * ```
1009
1020
  * @since v8.3.0
1010
1021
  */
node/v8.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * ```js
5
5
  * const v8 = require('v8');
6
6
  * ```
7
- * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/v8.js)
7
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/v8.js)
8
8
  */
9
9
  declare module 'v8' {
10
10
  import { Readable } from 'node:stream';
@@ -163,6 +163,13 @@ declare module 'v8' {
163
163
  * Chrome DevTools. The JSON schema is undocumented and specific to the
164
164
  * V8 engine. Therefore, the schema may change from one version of V8 to the next.
165
165
  *
166
+ * Creating a heap snapshot requires memory about twice the size of the heap at
167
+ * the time the snapshot is created. This results in the risk of OOM killers
168
+ * terminating the process.
169
+ *
170
+ * Generating a snapshot is a synchronous operation which blocks the event loop
171
+ * for a duration depending on the heap size.
172
+ *
166
173
  * ```js
167
174
  * // Print heap snapshot to the console
168
175
  * const v8 = require('v8');
@@ -182,6 +189,13 @@ declare module 'v8' {
182
189
  * A heap snapshot is specific to a single V8 isolate. When using `worker threads`, a heap snapshot generated from the main thread will
183
190
  * not contain any information about the workers, and vice versa.
184
191
  *
192
+ * Creating a heap snapshot requires memory about twice the size of the heap at
193
+ * the time the snapshot is created. This results in the risk of OOM killers
194
+ * terminating the process.
195
+ *
196
+ * Generating a snapshot is a synchronous operation which blocks the event loop
197
+ * for a duration depending on the heap size.
198
+ *
185
199
  * ```js
186
200
  * const { writeHeapSnapshot } = require('v8');
187
201
  * const {
@@ -344,6 +358,10 @@ declare module 'v8' {
344
358
  class DefaultDeserializer extends Deserializer {}
345
359
  /**
346
360
  * Uses a `DefaultSerializer` to serialize `value` into a buffer.
361
+ *
362
+ * `ERR_BUFFER_TOO_LARGE` will be thrown when trying to
363
+ * serialize a huge object which requires buffer
364
+ * larger than `buffer.constants.MAX_LENGTH`.
347
365
  * @since v8.0.0
348
366
  */
349
367
  function serialize(value: any): Buffer;
node/vm.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * The `vm` module enables compiling and running code within V8 Virtual
3
- * Machine contexts. **The `vm` module is not a security mechanism. Do**
4
- * **not use it to run untrusted code.**
3
+ * Machine contexts.
4
+ *
5
+ * **The `vm` module is not a security**
6
+ * **mechanism. Do not use it to run untrusted code.**
5
7
  *
6
8
  * JavaScript code can be compiled and run immediately or
7
9
  * compiled, saved, and run later.
@@ -32,7 +34,7 @@
32
34
  *
33
35
  * console.log(x); // 1; y is not defined.
34
36
  * ```
35
- * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/vm.js)
37
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/vm.js)
36
38
  */
37
39
  declare module 'vm' {
38
40
  interface Context extends NodeJS.Dict<any> {}
node/wasi.d.ts CHANGED
@@ -68,7 +68,7 @@
68
68
  * The `--experimental-wasi-unstable-preview1` CLI argument is needed for this
69
69
  * example to run.
70
70
  * @experimental
71
- * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/wasi.js)
71
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/wasi.js)
72
72
  */
73
73
  declare module 'wasi' {
74
74
  interface WASIOptions {
node/worker_threads.d.ts CHANGED
@@ -39,7 +39,7 @@
39
39
  * }
40
40
  * ```
41
41
  *
42
- * The above example spawns a Worker thread for each `parse()` call. In actual
42
+ * The above example spawns a Worker thread for each `parseJSAsync()` call. In
43
43
  * practice, use a pool of Workers for these kinds of tasks. Otherwise, the
44
44
  * overhead of creating Workers would likely exceed their benefit.
45
45
  *
@@ -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/v17.0.0/lib/worker_threads.js)
52
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/worker_threads.js)
53
53
  */
54
54
  declare module 'worker_threads' {
55
55
  import { Blob } from 'node:buffer';
@@ -507,7 +507,6 @@ declare module 'worker_threads' {
507
507
  * }
508
508
  * ```
509
509
  * @since v15.4.0
510
- * @experimental
511
510
  */
512
511
  class BroadcastChannel {
513
512
  readonly name: string;
@@ -630,14 +629,12 @@ declare module 'worker_threads' {
630
629
  * }
631
630
  * ```
632
631
  * @since v15.12.0, v14.18.0
633
- * @experimental
634
632
  * @param key Any arbitrary, cloneable JavaScript value that can be used as a {Map} key.
635
633
  */
636
634
  function getEnvironmentData(key: Serializable): Serializable;
637
635
  /**
638
636
  * The `worker.setEnvironmentData()` API sets the content of`worker.getEnvironmentData()` in the current thread and all new `Worker`instances spawned from the current context.
639
637
  * @since v15.12.0, v14.18.0
640
- * @experimental
641
638
  * @param key Any arbitrary, cloneable JavaScript value that can be used as a {Map} key.
642
639
  * @param value Any arbitrary, cloneable JavaScript value that will be cloned and passed automatically to all new `Worker` instances. If `value` is passed as `undefined`, any previously set value
643
640
  * for the `key` will be deleted.
node/zlib.d.ts CHANGED
@@ -88,7 +88,7 @@
88
88
  * });
89
89
  * ```
90
90
  * @since v0.5.8
91
- * @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/zlib.js)
91
+ * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/zlib.js)
92
92
  */
93
93
  declare module 'zlib' {
94
94
  import * as stream from 'node:stream';