@types/node 22.0.3 → 22.2.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/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Fri, 02 Aug 2024 08:37:31 GMT
11
+ * Last updated: Fri, 09 Aug 2024 18:08:59 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
node/dns/promises.d.ts CHANGED
@@ -346,20 +346,20 @@ declare module "dns/promises" {
346
346
  */
347
347
  function setServers(servers: readonly string[]): void;
348
348
  /**
349
- * Set the default value of `verbatim` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v22.x/api/dns.html#dnspromiseslookuphostname-options).
350
- * The value could be:
349
+ * Set the default value of `order` in `dns.lookup()` and `{@link lookup}`. The value could be:
351
350
  *
352
- * * `ipv4first`: sets default `verbatim` to `false`.
353
- * * `verbatim`: sets default `verbatim` to `true`.
351
+ * * `ipv4first`: sets default `order` to `ipv4first`.
352
+ * * `ipv6first`: sets default `order` to `ipv6first`.
353
+ * * `verbatim`: sets default `order` to `verbatim`.
354
354
  *
355
- * The default is `verbatim` and {@link setDefaultResultOrder} have higher
356
- * priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--dns-result-orderorder). When using
357
- * [worker threads](https://nodejs.org/docs/latest-v22.x/api/worker_threads.html), {@link setDefaultResultOrder} from the main
358
- * thread won't affect the default dns orders in workers.
355
+ * The default is `verbatim` and [dnsPromises.setDefaultResultOrder()](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromisessetdefaultresultorderorder)
356
+ * have higher priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v20.x/api/cli.html#--dns-result-orderorder).
357
+ * When using [worker threads](https://nodejs.org/docs/latest-v20.x/api/worker_threads.html), [`dnsPromises.setDefaultResultOrder()`](https://nodejs.org/docs/latest-v20.x/api/dns.html#dnspromisessetdefaultresultorderorder)
358
+ * from the main thread won't affect the default dns orders in workers.
359
359
  * @since v16.4.0, v14.18.0
360
- * @param order must be `'ipv4first'` or `'verbatim'`.
360
+ * @param order must be `'ipv4first'`, `'ipv6first'` or `'verbatim'`.
361
361
  */
362
- function setDefaultResultOrder(order: "ipv4first" | "verbatim"): void;
362
+ function setDefaultResultOrder(order: "ipv4first" | "ipv6first" | "verbatim"): void;
363
363
  // Error codes
364
364
  const NODATA: "ENODATA";
365
365
  const FORMERR: "EFORMERR";
node/dns.d.ts CHANGED
@@ -80,11 +80,21 @@ declare module "dns" {
80
80
  * @default false
81
81
  */
82
82
  all?: boolean | undefined;
83
+ /**
84
+ * When `verbatim`, the resolved addresses are return unsorted. When `ipv4first`, the resolved addresses are sorted
85
+ * by placing IPv4 addresses before IPv6 addresses. When `ipv6first`, the resolved addresses are sorted by placing IPv6
86
+ * addresses before IPv4 addresses. Default value is configurable using
87
+ * {@link setDefaultResultOrder} or [`--dns-result-order`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--dns-result-orderorder).
88
+ * @default `verbatim` (addresses are not reordered)
89
+ * @since v22.1.0
90
+ */
91
+ order?: "ipv4first" | "ipv6first" | "verbatim" | undefined;
83
92
  /**
84
93
  * When `true`, the callback receives IPv4 and IPv6 addresses in the order the DNS resolver returned them. When `false`, IPv4
85
- * addresses are placed before IPv6 addresses. Default value is configurable using {@link setDefaultResultOrder}
86
- * or [`--dns-result-order`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--dns-result-orderorder).
87
- * @default true
94
+ * addresses are placed before IPv6 addresses. This option will be deprecated in favor of `order`. When both are specified,
95
+ * `order` has higher precedence. New code should only use `order`. Default value is configurable using {@link setDefaultResultOrder}
96
+ * @default true (addresses are not reordered)
97
+ * @deprecated Please use `order` option
88
98
  */
89
99
  verbatim?: boolean | undefined;
90
100
  }
@@ -663,14 +673,15 @@ declare module "dns" {
663
673
  callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void,
664
674
  ): void;
665
675
  /**
666
- * Get the default value for `verbatim` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v22.x/api/dns.html#dnspromiseslookuphostname-options).
676
+ * Get the default value for `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v22.x/api/dns.html#dnspromiseslookuphostname-options).
667
677
  * The value could be:
668
678
  *
669
- * * `ipv4first`: for `verbatim` defaulting to `false`.
670
- * * `verbatim`: for `verbatim` defaulting to `true`.
679
+ * * `ipv4first`: for `order` defaulting to `ipv4first`.
680
+ * * `ipv6first`: for `order` defaulting to `ipv6first`.
681
+ * * `verbatim`: for `order` defaulting to `verbatim`.
671
682
  * @since v18.17.0
672
683
  */
673
- export function getDefaultResultOrder(): "ipv4first" | "verbatim";
684
+ export function getDefaultResultOrder(): "ipv4first" | "ipv6first" | "verbatim";
674
685
  /**
675
686
  * Sets the IP address and port of servers to be used when performing DNS
676
687
  * resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted
@@ -717,19 +728,21 @@ declare module "dns" {
717
728
  */
718
729
  export function getServers(): string[];
719
730
  /**
720
- * Set the default value of `verbatim` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v22.x/api/dns.html#dnspromiseslookuphostname-options).
731
+ * Set the default value of `order` in {@link lookup} and [`dnsPromises.lookup()`](https://nodejs.org/docs/latest-v22.x/api/dns.html#dnspromiseslookuphostname-options).
721
732
  * The value could be:
722
733
  *
723
- * * `ipv4first`: sets default `verbatim` to `false`.
724
- * * `verbatim`: sets default `verbatim` to `true`.
734
+ * * `ipv4first`: sets default `order` to `ipv4first`.
735
+ * * `ipv6first`: sets default `order` to `ipv6first`.
736
+ * * `verbatim`: sets default `order` to `verbatim`.
725
737
  *
726
738
  * The default is `verbatim` and {@link setDefaultResultOrder} have higher
727
739
  * priority than [`--dns-result-order`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--dns-result-orderorder). When using
728
740
  * [worker threads](https://nodejs.org/docs/latest-v22.x/api/worker_threads.html), {@link setDefaultResultOrder} from the main
729
741
  * thread won't affect the default dns orders in workers.
730
742
  * @since v16.4.0, v14.18.0
743
+ * @param order must be `'ipv4first'`, `'ipv6first'` or `'verbatim'`.
731
744
  */
732
- export function setDefaultResultOrder(order: "ipv4first" | "verbatim"): void;
745
+ export function setDefaultResultOrder(order: "ipv4first" | "ipv6first" | "verbatim"): void;
733
746
  // Error codes
734
747
  export const NODATA: "ENODATA";
735
748
  export const FORMERR: "EFORMERR";
node/fs/promises.d.ts CHANGED
@@ -21,6 +21,8 @@ declare module "fs/promises" {
21
21
  Dir,
22
22
  Dirent,
23
23
  GlobOptions,
24
+ GlobOptionsWithFileTypes,
25
+ GlobOptionsWithoutFileTypes,
24
26
  MakeDirectoryOptions,
25
27
  Mode,
26
28
  ObjectEncodingOptions,
@@ -1243,7 +1245,19 @@ declare module "fs/promises" {
1243
1245
  /**
1244
1246
  * Retrieves the files matching the specified pattern.
1245
1247
  */
1246
- function glob(pattern: string | string[], options?: GlobOptions): AsyncIterableIterator<string>;
1248
+ function glob(pattern: string | string[]): AsyncIterableIterator<string>;
1249
+ function glob(
1250
+ pattern: string | string[],
1251
+ opt: GlobOptionsWithFileTypes,
1252
+ ): AsyncIterableIterator<Dirent>;
1253
+ function glob(
1254
+ pattern: string | string[],
1255
+ opt: GlobOptionsWithoutFileTypes,
1256
+ ): AsyncIterableIterator<string>;
1257
+ function glob(
1258
+ pattern: string | string[],
1259
+ opt: GlobOptions,
1260
+ ): AsyncIterableIterator<Dirent> | AsyncIterableIterator<string>;
1247
1261
  }
1248
1262
  declare module "node:fs/promises" {
1249
1263
  export * from "fs/promises";
node/fs.d.ts CHANGED
@@ -4324,6 +4324,18 @@ declare module "fs" {
4324
4324
  * Function to filter out files/directories. Return true to exclude the item, false to include it.
4325
4325
  */
4326
4326
  exclude?: ((fileName: string) => boolean) | undefined;
4327
+ /**
4328
+ * `true` if the glob should return paths as `Dirent`s, `false` otherwise.
4329
+ * @default false
4330
+ * @since v22.2.0
4331
+ */
4332
+ withFileTypes?: boolean | undefined;
4333
+ }
4334
+ export interface GlobOptionsWithFileTypes extends GlobOptions {
4335
+ withFileTypes: true;
4336
+ }
4337
+ export interface GlobOptionsWithoutFileTypes extends GlobOptions {
4338
+ withFileTypes?: false | undefined;
4327
4339
  }
4328
4340
  /**
4329
4341
  * Retrieves the files matching the specified pattern.
@@ -4332,15 +4344,46 @@ declare module "fs" {
4332
4344
  pattern: string | string[],
4333
4345
  callback: (err: NodeJS.ErrnoException | null, matches: string[]) => void,
4334
4346
  ): void;
4347
+ export function glob(
4348
+ pattern: string | string[],
4349
+ options: GlobOptionsWithFileTypes,
4350
+ callback: (
4351
+ err: NodeJS.ErrnoException | null,
4352
+ matches: Dirent[],
4353
+ ) => void,
4354
+ ): void;
4355
+ export function glob(
4356
+ pattern: string | string[],
4357
+ options: GlobOptionsWithoutFileTypes,
4358
+ callback: (
4359
+ err: NodeJS.ErrnoException | null,
4360
+ matches: string[],
4361
+ ) => void,
4362
+ ): void;
4335
4363
  export function glob(
4336
4364
  pattern: string | string[],
4337
4365
  options: GlobOptions,
4338
- callback: (err: NodeJS.ErrnoException | null, matches: string[]) => void,
4366
+ callback: (
4367
+ err: NodeJS.ErrnoException | null,
4368
+ matches: Dirent[] | string[],
4369
+ ) => void,
4339
4370
  ): void;
4340
4371
  /**
4341
4372
  * Retrieves the files matching the specified pattern.
4342
4373
  */
4343
- export function globSync(pattern: string | string[], options?: GlobOptions): string[];
4374
+ export function globSync(pattern: string | string[]): string[];
4375
+ export function globSync(
4376
+ pattern: string | string[],
4377
+ options: GlobOptionsWithFileTypes,
4378
+ ): Dirent[];
4379
+ export function globSync(
4380
+ pattern: string | string[],
4381
+ options: GlobOptionsWithoutFileTypes,
4382
+ ): string[];
4383
+ export function globSync(
4384
+ pattern: string | string[],
4385
+ options: GlobOptions,
4386
+ ): Dirent[] | string[];
4344
4387
  }
4345
4388
  declare module "node:fs" {
4346
4389
  export * from "fs";
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "22.0.3",
3
+ "version": "22.2.0",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -210,8 +210,8 @@
210
210
  },
211
211
  "scripts": {},
212
212
  "dependencies": {
213
- "undici-types": "~6.11.1"
213
+ "undici-types": "~6.13.0"
214
214
  },
215
- "typesPublisherContentHash": "5ae202076a42a690c53ac3c2165c19dbe294320b891c0db8c3b4448171213ce8",
215
+ "typesPublisherContentHash": "e8a1feecc621a4e4c40517dba1262b6a77dcb9cdd874f74c76cb391931926c7c",
216
216
  "typeScriptVersion": "4.8"
217
217
  }
node/perf_hooks.d.ts CHANGED
@@ -31,7 +31,17 @@
31
31
  */
32
32
  declare module "perf_hooks" {
33
33
  import { AsyncResource } from "node:async_hooks";
34
- type EntryType = "node" | "mark" | "measure" | "gc" | "function" | "http2" | "http" | "dns" | "net";
34
+ type EntryType =
35
+ | "dns" // Node.js only
36
+ | "function" // Node.js only
37
+ | "gc" // Node.js only
38
+ | "http2" // Node.js only
39
+ | "http" // Node.js only
40
+ | "mark" // available on the Web
41
+ | "measure" // available on the Web
42
+ | "net" // Node.js only
43
+ | "node" // Node.js only
44
+ | "resource"; // available on the Web
35
45
  interface NodeGCPerformanceDetail {
36
46
  /**
37
47
  * When `performanceEntry.entryType` is equal to 'gc', the `performance.kind` property identifies
@@ -114,6 +124,7 @@ declare module "perf_hooks" {
114
124
  * @since v8.5.0
115
125
  */
116
126
  class PerformanceNodeTiming extends PerformanceEntry {
127
+ readonly entryType: "node";
117
128
  /**
118
129
  * The high resolution millisecond timestamp at which the Node.js process
119
130
  * completed bootstrapping. If bootstrapping has not yet finished, the property
@@ -270,6 +281,30 @@ declare module "perf_hooks" {
270
281
  * @param name
271
282
  */
272
283
  mark(name: string, options?: MarkOptions): PerformanceMark;
284
+ /**
285
+ * Creates a new `PerformanceResourceTiming` entry in the Resource Timeline.
286
+ * A `PerformanceResourceTiming` is a subclass of `PerformanceEntry` whose `performanceEntry.entryType` is always `'resource'`.
287
+ * Performance resources are used to mark moments in the Resource Timeline.
288
+ * @param timingInfo [Fetch Timing Info](https://fetch.spec.whatwg.org/#fetch-timing-info)
289
+ * @param requestedUrl The resource url
290
+ * @param initiatorType The initiator name, e.g: 'fetch'
291
+ * @param global
292
+ * @param cacheMode The cache mode must be an empty string ('') or 'local'
293
+ * @param bodyInfo [Fetch Response Body Info](https://fetch.spec.whatwg.org/#response-body-info)
294
+ * @param responseStatus The response's status code
295
+ * @param deliveryType The delivery type. Default: ''.
296
+ * @since v18.2.0, v16.17.0
297
+ */
298
+ markResourceTiming(
299
+ timingInfo: object,
300
+ requestedUrl: string,
301
+ initiatorType: string,
302
+ global: object,
303
+ cacheMode: "" | "local",
304
+ bodyInfo: object,
305
+ responseStatus: number,
306
+ deliveryType?: string,
307
+ ): PerformanceResourceTiming;
273
308
  /**
274
309
  * Creates a new PerformanceMeasure entry in the Performance Timeline.
275
310
  * A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure',
@@ -543,6 +578,7 @@ declare module "perf_hooks" {
543
578
  * @since v18.2.0, v16.17.0
544
579
  */
545
580
  class PerformanceResourceTiming extends PerformanceEntry {
581
+ readonly entryType: "resource";
546
582
  protected constructor();
547
583
  /**
548
584
  * The high resolution millisecond timestamp at immediately before dispatching the `fetch`
node/test.d.ts CHANGED
@@ -342,6 +342,15 @@ declare module "node:test" {
342
342
  * @default undefined
343
343
  */
344
344
  testNamePatterns?: string | RegExp | ReadonlyArray<string | RegExp> | undefined;
345
+ /**
346
+ * A String, RegExp or a RegExp Array, that can be used to exclude running tests whose
347
+ * name matches the provided pattern. Test name patterns are interpreted as JavaScript
348
+ * regular expressions. For each test that is executed, any corresponding test hooks,
349
+ * such as `beforeEach()`, are also run.
350
+ * @default undefined
351
+ * @since v22.1.0
352
+ */
353
+ testSkipPatterns?: string | RegExp | ReadonlyArray<string | RegExp> | undefined;
345
354
  /**
346
355
  * The number of milliseconds after which the test execution will fail.
347
356
  * If unspecified, subtests inherit this value from their parent.
@@ -452,6 +461,12 @@ declare module "node:test" {
452
461
  * @since v18.0.0, v16.17.0
453
462
  */
454
463
  class TestContext {
464
+ /**
465
+ * An object containing assertion methods bound to the test context.
466
+ * The top-level functions from the `node:assert` module are exposed here for the purpose of creating test plans.
467
+ * @since v22.2.0
468
+ */
469
+ readonly assert: TestContextAssert;
455
470
  /**
456
471
  * This function is used to create a hook running before subtest of the current test.
457
472
  * @param fn The hook function. If the hook uses callbacks, the callback function is passed as the second argument.
@@ -499,6 +514,42 @@ declare module "node:test" {
499
514
  * @since v18.8.0, v16.18.0
500
515
  */
501
516
  readonly name: string;
517
+ /**
518
+ * Used to set the number of assertions and subtests that are expected to run within the test.
519
+ * If the number of assertions and subtests that run does not match the expected count, the test will fail.
520
+ *
521
+ * To make sure assertions are tracked, the assert functions on `context.assert` must be used,
522
+ * instead of importing from the `node:assert` module.
523
+ * ```js
524
+ * test('top level test', (t) => {
525
+ * t.plan(2);
526
+ * t.assert.ok('some relevant assertion here');
527
+ * t.test('subtest', () => {});
528
+ * });
529
+ * ```
530
+ *
531
+ * When working with asynchronous code, the `plan` function can be used to ensure that the correct number of assertions are run:
532
+ * ```js
533
+ * test('planning with streams', (t, done) => {
534
+ * function* generate() {
535
+ * yield 'a';
536
+ * yield 'b';
537
+ * yield 'c';
538
+ * }
539
+ * const expected = ['a', 'b', 'c'];
540
+ * t.plan(expected.length);
541
+ * const stream = Readable.from(generate());
542
+ * stream.on('data', (chunk) => {
543
+ * t.assert.strictEqual(chunk, expected.shift());
544
+ * });
545
+ * stream.on('end', () => {
546
+ * done();
547
+ * });
548
+ * });
549
+ * ```
550
+ * @since v22.2.0
551
+ */
552
+ plan(count: number): void;
502
553
  /**
503
554
  * If `shouldRunOnlyTests` is truthy, the test context will only run tests that
504
555
  * have the `only` option set. Otherwise, all tests are run. If Node.js was not
@@ -575,6 +626,76 @@ declare module "node:test" {
575
626
  */
576
627
  readonly mock: MockTracker;
577
628
  }
629
+ interface TestContextAssert {
630
+ /**
631
+ * Identical to the `deepEqual` function from the `node:assert` module, but bound to the test context.
632
+ */
633
+ deepEqual: typeof import("node:assert").deepEqual;
634
+ /**
635
+ * Identical to the `deepStrictEqual` function from the `node:assert` module, but bound to the test context.
636
+ */
637
+ deepStrictEqual: typeof import("node:assert").deepStrictEqual;
638
+ /**
639
+ * Identical to the `doesNotMatch` function from the `node:assert` module, but bound to the test context.
640
+ */
641
+ doesNotMatch: typeof import("node:assert").doesNotMatch;
642
+ /**
643
+ * Identical to the `doesNotReject` function from the `node:assert` module, but bound to the test context.
644
+ */
645
+ doesNotReject: typeof import("node:assert").doesNotReject;
646
+ /**
647
+ * Identical to the `doesNotThrow` function from the `node:assert` module, but bound to the test context.
648
+ */
649
+ doesNotThrow: typeof import("node:assert").doesNotThrow;
650
+ /**
651
+ * Identical to the `equal` function from the `node:assert` module, but bound to the test context.
652
+ */
653
+ equal: typeof import("node:assert").equal;
654
+ /**
655
+ * Identical to the `fail` function from the `node:assert` module, but bound to the test context.
656
+ */
657
+ fail: typeof import("node:assert").fail;
658
+ /**
659
+ * Identical to the `ifError` function from the `node:assert` module, but bound to the test context.
660
+ */
661
+ ifError: typeof import("node:assert").ifError;
662
+ /**
663
+ * Identical to the `match` function from the `node:assert` module, but bound to the test context.
664
+ */
665
+ match: typeof import("node:assert").match;
666
+ /**
667
+ * Identical to the `notDeepEqual` function from the `node:assert` module, but bound to the test context.
668
+ */
669
+ notDeepEqual: typeof import("node:assert").notDeepEqual;
670
+ /**
671
+ * Identical to the `notDeepStrictEqual` function from the `node:assert` module, but bound to the test context.
672
+ */
673
+ notDeepStrictEqual: typeof import("node:assert").notDeepStrictEqual;
674
+ /**
675
+ * Identical to the `notEqual` function from the `node:assert` module, but bound to the test context.
676
+ */
677
+ notEqual: typeof import("node:assert").notEqual;
678
+ /**
679
+ * Identical to the `notStrictEqual` function from the `node:assert` module, but bound to the test context.
680
+ */
681
+ notStrictEqual: typeof import("node:assert").notStrictEqual;
682
+ /**
683
+ * Identical to the `ok` function from the `node:assert` module, but bound to the test context.
684
+ */
685
+ ok: typeof import("node:assert").ok;
686
+ /**
687
+ * Identical to the `rejects` function from the `node:assert` module, but bound to the test context.
688
+ */
689
+ rejects: typeof import("node:assert").rejects;
690
+ /**
691
+ * Identical to the `strictEqual` function from the `node:assert` module, but bound to the test context.
692
+ */
693
+ strictEqual: typeof import("node:assert").strictEqual;
694
+ /**
695
+ * Identical to the `throws` function from the `node:assert` module, but bound to the test context.
696
+ */
697
+ throws: typeof import("node:assert").throws;
698
+ }
578
699
 
579
700
  /**
580
701
  * An instance of `SuiteContext` is passed to each suite function in order to
@@ -634,6 +755,14 @@ declare module "node:test" {
634
755
  * @default false
635
756
  */
636
757
  todo?: boolean | string | undefined;
758
+ /**
759
+ * The number of assertions and subtests expected to be run in the test.
760
+ * If the number of assertions run in the test does not match the number
761
+ * specified in the plan, the test will fail.
762
+ * @default undefined
763
+ * @since v22.2.0
764
+ */
765
+ plan?: number | undefined;
637
766
  }
638
767
  /**
639
768
  * This function creates a hook that runs before executing a suite.
node/url.d.ts CHANGED
@@ -46,6 +46,22 @@ declare module "url" {
46
46
  interface UrlWithStringQuery extends Url {
47
47
  query: string | null;
48
48
  }
49
+ interface FileUrlToPathOptions {
50
+ /**
51
+ * `true` if the `path` should be return as a windows filepath, `false` for posix, and `undefined` for the system default.
52
+ * @default undefined
53
+ * @since v22.1.0
54
+ */
55
+ windows?: boolean | undefined;
56
+ }
57
+ interface PathToFileUrlOptions {
58
+ /**
59
+ * `true` if the `path` should be return as a windows filepath, `false` for posix, and `undefined` for the system default.
60
+ * @default undefined
61
+ * @since v22.1.0
62
+ */
63
+ windows?: boolean | undefined;
64
+ }
49
65
  /**
50
66
  * The `url.parse()` method takes a URL string, parses it, and returns a URL
51
67
  * object.
@@ -298,7 +314,7 @@ declare module "url" {
298
314
  * @param url The file URL string or URL object to convert to a path.
299
315
  * @return The fully-resolved platform-specific Node.js file path.
300
316
  */
301
- function fileURLToPath(url: string | URL): string;
317
+ function fileURLToPath(url: string | URL, options?: FileUrlToPathOptions): string;
302
318
  /**
303
319
  * This function ensures that `path` is resolved absolutely, and that the URL
304
320
  * control characters are correctly encoded when converting into a File URL.
@@ -316,7 +332,7 @@ declare module "url" {
316
332
  * @param path The path to convert to a File URL.
317
333
  * @return The file URL object.
318
334
  */
319
- function pathToFileURL(path: string): URL;
335
+ function pathToFileURL(path: string, options?: PathToFileUrlOptions): URL;
320
336
  /**
321
337
  * This utility function converts a URL object into an ordinary options object as
322
338
  * expected by the `http.request()` and `https.request()` APIs.
@@ -429,6 +445,15 @@ declare module "url" {
429
445
  * @param base The base URL to resolve against if the `input` is not absolute. If `base` is not a string, it is `converted to a string` first.
430
446
  */
431
447
  static canParse(input: string, base?: string): boolean;
448
+ /**
449
+ * Parses a string as a URL. If `base` is provided, it will be used as the base URL for the purpose of resolving non-absolute `input` URLs.
450
+ * Returns `null` if `input` is not a valid.
451
+ * @param input The absolute or relative input URL to parse. If `input` is relative, then `base` is required. If `input` is absolute, the `base` is ignored. If `input` is not a string, it is
452
+ * `converted to a string` first.
453
+ * @param base The base URL to resolve against if the `input` is not absolute. If `base` is not a string, it is `converted to a string` first.
454
+ * @since v22.1.0
455
+ */
456
+ static parse(input: string, base?: string): URL | null;
432
457
  constructor(input: string | { toString: () => string }, base?: string | URL);
433
458
  /**
434
459
  * Gets and sets the fragment portion of the URL.
node/zlib.d.ts CHANGED
@@ -172,6 +172,15 @@ declare module "zlib" {
172
172
  interface DeflateRaw extends stream.Transform, Zlib, ZlibReset, ZlibParams {}
173
173
  interface InflateRaw extends stream.Transform, Zlib, ZlibReset {}
174
174
  interface Unzip extends stream.Transform, Zlib {}
175
+ /**
176
+ * Computes a 32-bit [Cyclic Redundancy Check](https://en.wikipedia.org/wiki/Cyclic_redundancy_check) checksum of `data`.
177
+ * If `value` is specified, it is used as the starting value of the checksum, otherwise, 0 is used as the starting value.
178
+ * @param data When `data` is a string, it will be encoded as UTF-8 before being used for computation.
179
+ * @param value An optional starting value. It must be a 32-bit unsigned integer. @default 0
180
+ * @returns A 32-bit unsigned integer containing the checksum.
181
+ * @since v22.2.0
182
+ */
183
+ function crc32(data: string | Buffer | NodeJS.ArrayBufferView, value?: number): number;
175
184
  /**
176
185
  * Creates and returns a new `BrotliCompress` object.
177
186
  * @since v11.7.0, v10.16.0