@types/node 24.3.3 → 24.5.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/module.d.ts CHANGED
@@ -359,6 +359,7 @@ declare module "module" {
359
359
  interface ImportAttributes extends NodeJS.Dict<string> {
360
360
  type?: string | undefined;
361
361
  }
362
+ type ImportPhase = "source" | "evaluation";
362
363
  type ModuleFormat =
363
364
  | "addon"
364
365
  | "builtin"
node/net.d.ts CHANGED
@@ -805,6 +805,27 @@ declare module "net" {
805
805
  * @param value Any JS value
806
806
  */
807
807
  static isBlockList(value: unknown): value is BlockList;
808
+ /**
809
+ * ```js
810
+ * const blockList = new net.BlockList();
811
+ * const data = [
812
+ * 'Subnet: IPv4 192.168.1.0/24',
813
+ * 'Address: IPv4 10.0.0.5',
814
+ * 'Range: IPv4 192.168.2.1-192.168.2.10',
815
+ * 'Range: IPv4 10.0.0.1-10.0.0.10',
816
+ * ];
817
+ * blockList.fromJSON(data);
818
+ * blockList.fromJSON(JSON.stringify(data));
819
+ * ```
820
+ * @since v24.5.0
821
+ * @experimental
822
+ */
823
+ fromJSON(data: string | readonly string[]): void;
824
+ /**
825
+ * @since v24.5.0
826
+ * @experimental
827
+ */
828
+ toJSON(): readonly string[];
808
829
  }
809
830
  interface TcpNetConnectOpts extends TcpSocketConnectOpts, SocketConstructorOpts {
810
831
  timeout?: number | undefined;
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "24.3.3",
3
+ "version": "24.5.0",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -147,9 +147,9 @@
147
147
  },
148
148
  "scripts": {},
149
149
  "dependencies": {
150
- "undici-types": "~7.10.0"
150
+ "undici-types": "~7.12.0"
151
151
  },
152
152
  "peerDependencies": {},
153
- "typesPublisherContentHash": "a3f14f4b918a5a1f39810be4400298da6dfce73b2b13de8e6fabb50fd07f6d07",
153
+ "typesPublisherContentHash": "9e50bdbd01c40dff0305ada6ea13f1c2663dcbfc108ae09fab45726ac985531a",
154
154
  "typeScriptVersion": "5.2"
155
155
  }
node/sqlite.d.ts CHANGED
@@ -97,6 +97,33 @@ declare module "node:sqlite" {
97
97
  * @default 0
98
98
  */
99
99
  timeout?: number | undefined;
100
+ /**
101
+ * If `true`, integer fields are read as JavaScript `BigInt` values. If `false`,
102
+ * integer fields are read as JavaScript numbers.
103
+ * @since v24.4.0
104
+ * @default false
105
+ */
106
+ readBigInts?: boolean | undefined;
107
+ /**
108
+ * If `true`, query results are returned as arrays instead of objects.
109
+ * @since v24.4.0
110
+ * @default false
111
+ */
112
+ returnArrays?: boolean | undefined;
113
+ /**
114
+ * If `true`, allows binding named parameters without the prefix
115
+ * character (e.g., `foo` instead of `:foo`).
116
+ * @since v24.4.40
117
+ * @default true
118
+ */
119
+ allowBareNamedParameters?: boolean | undefined;
120
+ /**
121
+ * If `true`, unknown named parameters are ignored when binding.
122
+ * If `false`, an exception is thrown for unknown named parameters.
123
+ * @since v24.4.40
124
+ * @default false
125
+ */
126
+ allowUnknownNamedParameters?: boolean | undefined;
100
127
  }
101
128
  interface CreateSessionOptions {
102
129
  /**
@@ -566,6 +593,13 @@ declare module "node:sqlite" {
566
593
  * @param enabled Enables or disables support for unknown named parameters.
567
594
  */
568
595
  setAllowUnknownNamedParameters(enabled: boolean): void;
596
+ /**
597
+ * When enabled, query results returned by the `all()`, `get()`, and `iterate()` methods will be returned as arrays instead
598
+ * of objects.
599
+ * @since v24.0.0
600
+ * @param enabled Enables or disables the return of query results as arrays.
601
+ */
602
+ setReturnArrays(enabled: boolean): void;
569
603
  /**
570
604
  * When reading from the database, SQLite `INTEGER`s are mapped to JavaScript
571
605
  * numbers by default. However, SQLite `INTEGER`s can store values larger than
node/tls.d.ts CHANGED
@@ -1162,6 +1162,38 @@ declare module "tls" {
1162
1162
  * @since v0.10.2
1163
1163
  */
1164
1164
  function getCiphers(): string[];
1165
+ /**
1166
+ * Sets the default CA certificates used by Node.js TLS clients. If the provided
1167
+ * certificates are parsed successfully, they will become the default CA
1168
+ * certificate list returned by {@link getCACertificates} and used
1169
+ * by subsequent TLS connections that don't specify their own CA certificates.
1170
+ * The certificates will be deduplicated before being set as the default.
1171
+ *
1172
+ * This function only affects the current Node.js thread. Previous
1173
+ * sessions cached by the HTTPS agent won't be affected by this change, so
1174
+ * this method should be called before any unwanted cachable TLS connections are
1175
+ * made.
1176
+ *
1177
+ * To use system CA certificates as the default:
1178
+ *
1179
+ * ```js
1180
+ * import tls from 'node:tls';
1181
+ * tls.setDefaultCACertificates(tls.getCACertificates('system'));
1182
+ * ```
1183
+ *
1184
+ * This function completely replaces the default CA certificate list. To add additional
1185
+ * certificates to the existing defaults, get the current certificates and append to them:
1186
+ *
1187
+ * ```js
1188
+ * import tls from 'node:tls';
1189
+ * const currentCerts = tls.getCACertificates('default');
1190
+ * const additionalCerts = ['-----BEGIN CERTIFICATE-----\n...'];
1191
+ * tls.setDefaultCACertificates([...currentCerts, ...additionalCerts]);
1192
+ * ```
1193
+ * @since v24.5.0
1194
+ * @param certs An array of CA certificates in PEM format.
1195
+ */
1196
+ function setDefaultCACertificates(certs: ReadonlyArray<string | NodeJS.ArrayBufferView>): void;
1165
1197
  /**
1166
1198
  * The default curve name to use for ECDH key agreement in a tls server.
1167
1199
  * The default value is `'auto'`. See `{@link createSecureContext()}` for further
node/ts5.6/index.d.ts CHANGED
@@ -59,7 +59,6 @@
59
59
  /// <reference path="../diagnostics_channel.d.ts" />
60
60
  /// <reference path="../dns.d.ts" />
61
61
  /// <reference path="../dns/promises.d.ts" />
62
- /// <reference path="../dns/promises.d.ts" />
63
62
  /// <reference path="../domain.d.ts" />
64
63
  /// <reference path="../events.d.ts" />
65
64
  /// <reference path="../fs.d.ts" />
@@ -68,6 +67,7 @@
68
67
  /// <reference path="../http2.d.ts" />
69
68
  /// <reference path="../https.d.ts" />
70
69
  /// <reference path="../inspector.d.ts" />
70
+ /// <reference path="../inspector.generated.d.ts" />
71
71
  /// <reference path="../module.d.ts" />
72
72
  /// <reference path="../net.d.ts" />
73
73
  /// <reference path="../os.d.ts" />
node/ts5.7/index.d.ts CHANGED
@@ -59,7 +59,6 @@
59
59
  /// <reference path="../diagnostics_channel.d.ts" />
60
60
  /// <reference path="../dns.d.ts" />
61
61
  /// <reference path="../dns/promises.d.ts" />
62
- /// <reference path="../dns/promises.d.ts" />
63
62
  /// <reference path="../domain.d.ts" />
64
63
  /// <reference path="../events.d.ts" />
65
64
  /// <reference path="../fs.d.ts" />
@@ -68,6 +67,7 @@
68
67
  /// <reference path="../http2.d.ts" />
69
68
  /// <reference path="../https.d.ts" />
70
69
  /// <reference path="../inspector.d.ts" />
70
+ /// <reference path="../inspector.generated.d.ts" />
71
71
  /// <reference path="../module.d.ts" />
72
72
  /// <reference path="../net.d.ts" />
73
73
  /// <reference path="../os.d.ts" />
node/url.d.ts CHANGED
@@ -455,12 +455,15 @@ declare module "url" {
455
455
  */
456
456
  static canParse(input: string, base?: string): boolean;
457
457
  /**
458
- * 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.
459
- * Returns `null` if `input` is not a valid.
460
- * @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
461
- * `converted to a string` first.
462
- * @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.
458
+ * Parses a string as a URL. If `base` is provided, it will be used as the base
459
+ * URL for the purpose of resolving non-absolute `input` URLs. Returns `null`
460
+ * if the parameters can't be resolved to a valid URL.
463
461
  * @since v22.1.0
462
+ * @param input The absolute or relative input URL to parse. If `input`
463
+ * is relative, then `base` is required. If `input` is absolute, the `base`
464
+ * is ignored. If `input` is not a string, it is [converted to a string](https://tc39.es/ecma262/#sec-tostring) first.
465
+ * @param base The base URL to resolve against if the `input` is not
466
+ * absolute. If `base` is not a string, it is [converted to a string](https://tc39.es/ecma262/#sec-tostring) first.
464
467
  */
465
468
  static parse(input: string, base?: string): URL | null;
466
469
  constructor(input: string | { toString: () => string }, base?: string | URL);
node/util.d.ts CHANGED
@@ -1420,10 +1420,12 @@ declare module "util" {
1420
1420
  */
1421
1421
  short?: string | undefined;
1422
1422
  /**
1423
- * The default value to
1424
- * be used if (and only if) the option does not appear in the arguments to be
1425
- * parsed. It must be of the same type as the `type` property. When `multiple`
1426
- * is `true`, it must be an array.
1423
+ * The value to assign to
1424
+ * the option if it does not appear in the arguments to be parsed. The value
1425
+ * must match the type specified by the `type` property. If `multiple` is
1426
+ * `true`, it must be an array. No default value is applied when the option
1427
+ * does appear in the arguments to be parsed, even if the provided value
1428
+ * is falsy.
1427
1429
  * @since v18.11.0
1428
1430
  */
1429
1431
  default?: string | boolean | string[] | boolean[] | undefined;
node/vm.d.ts CHANGED
@@ -37,7 +37,7 @@
37
37
  * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/vm.js)
38
38
  */
39
39
  declare module "vm" {
40
- import { ImportAttributes } from "node:module";
40
+ import { ImportAttributes, ImportPhase } from "node:module";
41
41
  interface Context extends NodeJS.Dict<any> {}
42
42
  interface BaseOptions {
43
43
  /**
@@ -60,7 +60,7 @@ declare module "vm" {
60
60
  specifier: string,
61
61
  referrer: T,
62
62
  importAttributes: ImportAttributes,
63
- phase: "source" | "evaluation",
63
+ phase: ImportPhase,
64
64
  ) => Module | Promise<Module>;
65
65
  interface ScriptOptions extends BaseOptions {
66
66
  /**
@@ -791,14 +791,6 @@ declare module "vm" {
791
791
  * @experimental
792
792
  */
793
793
  class Module {
794
- /**
795
- * The specifiers of all dependencies of this module. The returned array is frozen
796
- * to disallow any changes to it.
797
- *
798
- * Corresponds to the `[[RequestedModules]]` field of [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records) s in
799
- * the ECMAScript specification.
800
- */
801
- dependencySpecifiers: readonly string[];
802
794
  /**
803
795
  * If the `module.status` is `'errored'`, this property contains the exception
804
796
  * thrown by the module during evaluation. If the status is anything else,
@@ -918,6 +910,25 @@ declare module "vm" {
918
910
  */
919
911
  importModuleDynamically?: DynamicModuleLoader<SourceTextModule> | undefined;
920
912
  }
913
+ /**
914
+ * A `ModuleRequest` represents the request to import a module with given import attributes and phase.
915
+ * @since 24.4.0
916
+ */
917
+ interface ModuleRequest {
918
+ /**
919
+ * The specifier of the requested module.
920
+ */
921
+ specifier: string;
922
+ /**
923
+ * The `"with"` value passed to the `WithClause` in a `ImportDeclaration`, or an empty object if no value was
924
+ * provided.
925
+ */
926
+ attributes: ImportAttributes;
927
+ /**
928
+ * The phase of the requested module (`"source"` or `"evaluation"`).
929
+ */
930
+ phase: ImportPhase;
931
+ }
921
932
  /**
922
933
  * This feature is only available with the `--experimental-vm-modules` command
923
934
  * flag enabled.
@@ -933,6 +944,58 @@ declare module "vm" {
933
944
  * @param code JavaScript Module code to parse
934
945
  */
935
946
  constructor(code: string, options?: SourceTextModuleOptions);
947
+ /**
948
+ * @deprecated Use `sourceTextModule.moduleRequests` instead.
949
+ */
950
+ readonly dependencySpecifiers: readonly string[];
951
+ /**
952
+ * The requested import dependencies of this module. The returned array is frozen
953
+ * to disallow any changes to it.
954
+ *
955
+ * For example, given a source text:
956
+ *
957
+ * ```js
958
+ * import foo from 'foo';
959
+ * import fooAlias from 'foo';
960
+ * import bar from './bar.js';
961
+ * import withAttrs from '../with-attrs.ts' with { arbitraryAttr: 'attr-val' };
962
+ * import source Module from 'wasm-mod.wasm';
963
+ * ```
964
+ *
965
+ * The value of the `sourceTextModule.moduleRequests` will be:
966
+ *
967
+ * ```js
968
+ * [
969
+ * {
970
+ * specifier: 'foo',
971
+ * attributes: {},
972
+ * phase: 'evaluation',
973
+ * },
974
+ * {
975
+ * specifier: 'foo',
976
+ * attributes: {},
977
+ * phase: 'evaluation',
978
+ * },
979
+ * {
980
+ * specifier: './bar.js',
981
+ * attributes: {},
982
+ * phase: 'evaluation',
983
+ * },
984
+ * {
985
+ * specifier: '../with-attrs.ts',
986
+ * attributes: { arbitraryAttr: 'attr-val' },
987
+ * phase: 'evaluation',
988
+ * },
989
+ * {
990
+ * specifier: 'wasm-mod.wasm',
991
+ * attributes: {},
992
+ * phase: 'source',
993
+ * },
994
+ * ];
995
+ * ```
996
+ * @since v24.4.0
997
+ */
998
+ readonly moduleRequests: readonly ModuleRequest[];
936
999
  }
937
1000
  interface SyntheticModuleOptions {
938
1001
  /**
node/wasi.d.ts CHANGED
@@ -121,6 +121,12 @@ declare module "wasi" {
121
121
  */
122
122
  version: "unstable" | "preview1";
123
123
  }
124
+ interface FinalizeBindingsOptions {
125
+ /**
126
+ * @default instance.exports.memory
127
+ */
128
+ memory?: object | undefined;
129
+ }
124
130
  /**
125
131
  * The `WASI` class provides the WASI system call API and additional convenience
126
132
  * methods for working with WASI-based applications. Each `WASI` instance
@@ -167,6 +173,21 @@ declare module "wasi" {
167
173
  * @since v14.6.0, v12.19.0
168
174
  */
169
175
  initialize(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib.
176
+ /**
177
+ * Set up WASI host bindings to `instance` without calling `initialize()`
178
+ * or `start()`. This method is useful when the WASI module is instantiated in
179
+ * child threads for sharing the memory across threads.
180
+ *
181
+ * `finalizeBindings()` requires that either `instance` exports a
182
+ * [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) named `memory` or user specify a
183
+ * [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) object in `options.memory`. If the `memory` is invalid
184
+ * an exception is thrown.
185
+ *
186
+ * `start()` and `initialize()` will call `finalizeBindings()` internally.
187
+ * If `finalizeBindings()` is called more than once, an exception is thrown.
188
+ * @since v24.4.0
189
+ */
190
+ finalizeBindings(instance: object, options?: FinalizeBindingsOptions): void;
170
191
  /**
171
192
  * `wasiImport` is an object that implements the WASI system call API. This object
172
193
  * should be passed as the `wasi_snapshot_preview1` import during the instantiation
@@ -1,11 +1,14 @@
1
1
  export {};
2
2
 
3
+ import { LockManager } from "worker_threads";
4
+
3
5
  // lib.webworker has `WorkerNavigator` rather than `Navigator`, so conditionals use `onabort` instead of `onmessage`
4
6
  type _Navigator = typeof globalThis extends { onabort: any } ? {} : Navigator;
5
7
  interface Navigator {
6
8
  readonly hardwareConcurrency: number;
7
9
  readonly language: string;
8
10
  readonly languages: readonly string[];
11
+ readonly locks: LockManager;
9
12
  readonly platform: string;
10
13
  readonly userAgent: string;
11
14
  }
node/worker_threads.d.ts CHANGED
@@ -598,6 +598,35 @@ declare module "worker_threads" {
598
598
  */
599
599
  postMessage(message: unknown): void;
600
600
  }
601
+ interface Lock {
602
+ readonly mode: LockMode;
603
+ readonly name: string;
604
+ }
605
+ interface LockGrantedCallback<T> {
606
+ (lock: Lock | null): T;
607
+ }
608
+ interface LockInfo {
609
+ clientId: string;
610
+ mode: LockMode;
611
+ name: string;
612
+ }
613
+ interface LockManager {
614
+ query(): Promise<LockManagerSnapshot>;
615
+ request<T>(name: string, callback: LockGrantedCallback<T>): Promise<Awaited<T>>;
616
+ request<T>(name: string, options: LockOptions, callback: LockGrantedCallback<T>): Promise<Awaited<T>>;
617
+ }
618
+ interface LockManagerSnapshot {
619
+ held: LockInfo[];
620
+ pending: LockInfo[];
621
+ }
622
+ type LockMode = "exclusive" | "shared";
623
+ interface LockOptions {
624
+ ifAvailable?: boolean;
625
+ mode?: LockMode;
626
+ signal?: AbortSignal;
627
+ steal?: boolean;
628
+ }
629
+ var locks: LockManager;
601
630
  /**
602
631
  * Mark an object as not transferable. If `object` occurs in the transfer list of
603
632
  * a `port.postMessage()` call, it is ignored.