@types/node 20.17.54 → 20.17.56

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 v20.17/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/v20.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Thu, 29 May 2025 23:02:21 GMT
11
+ * Last updated: Fri, 30 May 2025 15:02:22 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
@@ -251,11 +251,6 @@ declare global {
251
251
 
252
252
  // Global DOM types
253
253
 
254
- function structuredClone<T>(
255
- value: T,
256
- transfer?: { transfer: ReadonlyArray<import("worker_threads").TransferListItem> },
257
- ): T;
258
-
259
254
  interface DOMException extends _DOMException {}
260
255
  var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T
261
256
  : NodeDOMExceptionConstructor;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "20.17.54",
3
+ "version": "20.17.56",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -215,6 +215,6 @@
215
215
  "undici-types": "~6.19.2"
216
216
  },
217
217
  "peerDependencies": {},
218
- "typesPublisherContentHash": "a43e3109c08d691a7dcf7ac27c3b5b6351fdc5e35b4b2527f8445c997a154aef",
218
+ "typesPublisherContentHash": "ddf7418b1f0caba5f31ee191d962a78ad585fe35743479485c976575872c2305",
219
219
  "typeScriptVersion": "5.1"
220
220
  }
node v20.17/vm.d.ts CHANGED
@@ -56,6 +56,11 @@ declare module "vm" {
56
56
  */
57
57
  columnOffset?: number | undefined;
58
58
  }
59
+ type DynamicModuleLoader<T> = (
60
+ specifier: string,
61
+ referrer: T,
62
+ importAttributes: ImportAttributes,
63
+ ) => Module | Promise<Module>;
59
64
  interface ScriptOptions extends BaseOptions {
60
65
  /**
61
66
  * Provides an optional data with V8's code cache data for the supplied source.
@@ -69,7 +74,7 @@ declare module "vm" {
69
74
  * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v20.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
70
75
  */
71
76
  importModuleDynamically?:
72
- | ((specifier: string, script: Script, importAttributes: ImportAttributes) => Module | Promise<Module>)
77
+ | DynamicModuleLoader<Script>
73
78
  | typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
74
79
  | undefined;
75
80
  }
@@ -114,14 +119,30 @@ declare module "vm" {
114
119
  * Provides an optional data with V8's code cache data for the supplied source.
115
120
  */
116
121
  cachedData?: ScriptOptions["cachedData"] | undefined;
117
- importModuleDynamically?: ScriptOptions["importModuleDynamically"];
122
+ /**
123
+ * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
124
+ * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
125
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
126
+ */
127
+ importModuleDynamically?:
128
+ | DynamicModuleLoader<Script>
129
+ | typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
130
+ | undefined;
118
131
  }
119
132
  interface RunningCodeInNewContextOptions extends RunningScriptInNewContextOptions {
120
133
  /**
121
134
  * Provides an optional data with V8's code cache data for the supplied source.
122
135
  */
123
136
  cachedData?: ScriptOptions["cachedData"] | undefined;
124
- importModuleDynamically?: ScriptOptions["importModuleDynamically"];
137
+ /**
138
+ * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
139
+ * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
140
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
141
+ */
142
+ importModuleDynamically?:
143
+ | DynamicModuleLoader<Script>
144
+ | typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
145
+ | undefined;
125
146
  }
126
147
  interface CompileFunctionOptions extends BaseOptions {
127
148
  /**
@@ -141,6 +162,15 @@ declare module "vm" {
141
162
  * An array containing a collection of context extensions (objects wrapping the current scope) to be applied while compiling
142
163
  */
143
164
  contextExtensions?: Object[] | undefined;
165
+ /**
166
+ * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
167
+ * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
168
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
169
+ */
170
+ importModuleDynamically?:
171
+ | DynamicModuleLoader<ReturnType<typeof compileFunction>>
172
+ | typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
173
+ | undefined;
144
174
  }
145
175
  interface CreateContextOptions {
146
176
  /**
@@ -175,6 +205,15 @@ declare module "vm" {
175
205
  * If set to `afterEvaluate`, microtasks will be run immediately after the script has run.
176
206
  */
177
207
  microtaskMode?: "afterEvaluate" | undefined;
208
+ /**
209
+ * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
210
+ * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
211
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
212
+ */
213
+ importModuleDynamically?:
214
+ | DynamicModuleLoader<Context>
215
+ | typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
216
+ | undefined;
178
217
  }
179
218
  type MeasureMemoryMode = "summary" | "detailed";
180
219
  interface MeasureMemoryOptions {
@@ -824,13 +863,12 @@ declare module "vm" {
824
863
  * Called during evaluation of this module to initialize the `import.meta`.
825
864
  */
826
865
  initializeImportMeta?: ((meta: ImportMeta, module: SourceTextModule) => void) | undefined;
827
- importModuleDynamically?:
828
- | ((
829
- specifier: string,
830
- referrer: SourceTextModule,
831
- importAttributes: ImportAttributes,
832
- ) => Module | Promise<Module>)
833
- | undefined;
866
+ /**
867
+ * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
868
+ * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
869
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
870
+ */
871
+ importModuleDynamically?: DynamicModuleLoader<SourceTextModule> | undefined;
834
872
  }
835
873
  /**
836
874
  * This feature is only available with the `--experimental-vm-modules` command
@@ -52,14 +52,13 @@
52
52
  * @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/worker_threads.js)
53
53
  */
54
54
  declare module "worker_threads" {
55
- import { Blob } from "node:buffer";
56
55
  import { Context } from "node:vm";
57
56
  import { EventEmitter } from "node:events";
58
57
  import { EventLoopUtilityFunction } from "node:perf_hooks";
59
58
  import { FileHandle } from "node:fs/promises";
60
59
  import { Readable, Writable } from "node:stream";
60
+ import { ReadableStream, TransformStream, WritableStream } from "node:stream/web";
61
61
  import { URL } from "node:url";
62
- import { X509Certificate } from "node:crypto";
63
62
  const isMainThread: boolean;
64
63
  const parentPort: null | MessagePort;
65
64
  const resourceLimits: ResourceLimits;
@@ -88,7 +87,16 @@ declare module "worker_threads" {
88
87
  interface WorkerPerformance {
89
88
  eventLoopUtilization: EventLoopUtilityFunction;
90
89
  }
91
- type TransferListItem = ArrayBuffer | MessagePort | FileHandle | X509Certificate | Blob;
90
+ type Transferable =
91
+ | ArrayBuffer
92
+ | MessagePort
93
+ | AbortSignal
94
+ | FileHandle
95
+ | ReadableStream
96
+ | WritableStream
97
+ | TransformStream;
98
+ /** @deprecated Use `import { Transferable } from "node:worker_threads"` instead. */
99
+ type TransferListItem = Transferable;
92
100
  /**
93
101
  * Instances of the `worker.MessagePort` class represent one end of an
94
102
  * asynchronous, two-way communications channel. It can be used to transfer
@@ -173,7 +181,7 @@ declare module "worker_threads" {
173
181
  * behind this API, see the `serialization API of the node:v8 module`.
174
182
  * @since v10.5.0
175
183
  */
176
- postMessage(value: any, transferList?: readonly TransferListItem[]): void;
184
+ postMessage(value: any, transferList?: readonly Transferable[]): void;
177
185
  /**
178
186
  * Opposite of `unref()`. Calling `ref()` on a previously `unref()`ed port does _not_ let the program exit if it's the only active handle left (the default
179
187
  * behavior). If the port is `ref()`ed, calling `ref()` again has no effect.
@@ -260,7 +268,7 @@ declare module "worker_threads" {
260
268
  /**
261
269
  * Additional data to send in the first worker message.
262
270
  */
263
- transferList?: TransferListItem[] | undefined;
271
+ transferList?: Transferable[] | undefined;
264
272
  /**
265
273
  * @default true
266
274
  */
@@ -408,7 +416,7 @@ declare module "worker_threads" {
408
416
  * See `port.postMessage()` for more details.
409
417
  * @since v10.5.0
410
418
  */
411
- postMessage(value: any, transferList?: readonly TransferListItem[]): void;
419
+ postMessage(value: any, transferList?: readonly Transferable[]): void;
412
420
  /**
413
421
  * Opposite of `unref()`, calling `ref()` on a previously `unref()`ed worker does _not_ let the program exit if it's the only active handle left (the default
414
422
  * behavior). If the worker is `ref()`ed, calling `ref()` again has
@@ -657,6 +665,10 @@ declare module "worker_threads" {
657
665
  MessagePort as _MessagePort,
658
666
  } from "worker_threads";
659
667
  global {
668
+ function structuredClone<T>(
669
+ value: T,
670
+ options?: { transfer?: Transferable[] },
671
+ ): T;
660
672
  /**
661
673
  * `BroadcastChannel` class is a global reference for `import { BroadcastChannel } from 'node:worker_threads'`
662
674
  * https://nodejs.org/api/globals.html#broadcastchannel