@types/node 22.0.3 → 22.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 (6) hide show
  1. node/README.md +1 -1
  2. node/dns/promises.d.ts +10 -10
  3. node/dns.d.ts +24 -11
  4. node/package.json +3 -3
  5. node/test.d.ts +9 -0
  6. node/url.d.ts +27 -2
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, 02 Aug 2024 11:07:10 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "22.0.3",
3
+ "version": "22.1.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": "a016324027de394c0877c1d44c03999bacaa45ed9b7249649d03dd6b9bfe4e5b",
216
216
  "typeScriptVersion": "4.8"
217
217
  }
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.
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.