@idlebox/stripe-node-types 24.0.14-patch.0 → 24.0.15

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 (134) hide show
  1. package/README.md +1 -1
  2. package/assert/strict.d.ts +113 -1
  3. package/assert.d.ts +162 -248
  4. package/async_hooks.d.ts +20 -5
  5. package/buffer.buffer.d.ts +24 -6
  6. package/buffer.d.ts +63 -168
  7. package/child_process.d.ts +117 -223
  8. package/cluster.d.ts +251 -329
  9. package/compatibility/iterators.d.ts +15 -0
  10. package/console.d.ts +60 -346
  11. package/constants.d.ts +15 -1
  12. package/crypto.d.ts +713 -1149
  13. package/dgram.d.ts +30 -50
  14. package/diagnostics_channel.d.ts +16 -3
  15. package/dns/promises.d.ts +15 -0
  16. package/dns.d.ts +150 -131
  17. package/domain.d.ts +25 -14
  18. package/events.d.ts +858 -719
  19. package/fs/promises.d.ts +117 -53
  20. package/fs.d.ts +729 -484
  21. package/globals.d.ts +142 -344
  22. package/globals.typedarray.d.ts +94 -0
  23. package/http.d.ts +358 -246
  24. package/http2.d.ts +578 -711
  25. package/https.d.ts +85 -216
  26. package/index.d.ts +39 -3
  27. package/inspector/promises.d.ts +54 -0
  28. package/inspector.d.ts +180 -3936
  29. package/inspector.generated.d.ts +4242 -0
  30. package/module.d.ts +60 -95
  31. package/my-shim.d.ts +15 -0
  32. package/net.d.ts +102 -186
  33. package/os.d.ts +32 -6
  34. package/package.json +3 -8
  35. package/path/posix.d.ts +20 -0
  36. package/path/win32.d.ts +20 -0
  37. package/path.d.ts +132 -122
  38. package/perf_hooks.d.ts +310 -644
  39. package/process.d.ts +192 -138
  40. package/punycode.d.ts +17 -2
  41. package/querystring.d.ts +16 -1
  42. package/quic.d.ts +926 -0
  43. package/readline/promises.d.ts +16 -1
  44. package/readline.d.ts +80 -118
  45. package/repl.d.ts +98 -96
  46. package/sea.d.ts +25 -1
  47. package/sqlite.d.ts +277 -13
  48. package/stream/consumers.d.ts +22 -7
  49. package/stream/promises.d.ts +148 -12
  50. package/stream/web.d.ts +187 -494
  51. package/stream.d.ts +608 -490
  52. package/string_decoder.d.ts +18 -3
  53. package/test/reporters.d.ts +112 -0
  54. package/test.d.ts +238 -199
  55. package/timers/promises.d.ts +16 -1
  56. package/timers.d.ts +16 -129
  57. package/tls.d.ts +163 -163
  58. package/trace_events.d.ts +21 -6
  59. package/ts5.6/buffer.buffer.d.ts +25 -8
  60. package/ts5.6/compatibility/float16array.d.ts +15 -0
  61. package/ts5.6/globals.typedarray.d.ts +31 -0
  62. package/ts5.6/index.d.ts +39 -3
  63. package/ts5.7/compatibility/float16array.d.ts +15 -0
  64. package/ts5.7/index.d.ts +39 -3
  65. package/tty.d.ts +70 -13
  66. package/undici-types/agent.d.ts +20 -4
  67. package/undici-types/api.d.ts +15 -0
  68. package/undici-types/balanced-pool.d.ts +15 -0
  69. package/undici-types/cache-interceptor.d.ts +15 -0
  70. package/undici-types/cache.d.ts +15 -0
  71. package/undici-types/client-stats.d.ts +31 -0
  72. package/undici-types/client.d.ts +21 -5
  73. package/undici-types/connector.d.ts +15 -0
  74. package/undici-types/content-type.d.ts +15 -0
  75. package/undici-types/cookies.d.ts +15 -0
  76. package/undici-types/diagnostics-channel.d.ts +24 -1
  77. package/undici-types/dispatcher.d.ts +18 -8
  78. package/undici-types/env-http-proxy-agent.d.ts +17 -1
  79. package/undici-types/errors.d.ts +20 -15
  80. package/undici-types/eventsource.d.ts +24 -4
  81. package/undici-types/fetch.d.ts +16 -0
  82. package/undici-types/formdata.d.ts +15 -0
  83. package/undici-types/global-dispatcher.d.ts +15 -0
  84. package/undici-types/global-origin.d.ts +15 -0
  85. package/undici-types/h2c-client.d.ts +15 -2
  86. package/undici-types/handlers.d.ts +16 -1
  87. package/undici-types/header.d.ts +15 -0
  88. package/undici-types/index.d.ts +21 -1
  89. package/undici-types/interceptors.d.ts +20 -0
  90. package/undici-types/mock-agent.d.ts +18 -0
  91. package/undici-types/mock-call-history.d.ts +15 -0
  92. package/undici-types/mock-client.d.ts +17 -0
  93. package/undici-types/mock-errors.d.ts +15 -0
  94. package/undici-types/mock-interceptor.d.ts +17 -1
  95. package/undici-types/mock-pool.d.ts +17 -0
  96. package/undici-types/package.json +1 -1
  97. package/undici-types/patch.d.ts +15 -0
  98. package/undici-types/pool-stats.d.ts +15 -0
  99. package/undici-types/pool.d.ts +17 -0
  100. package/undici-types/proxy-agent.d.ts +16 -0
  101. package/undici-types/readable.d.ts +15 -0
  102. package/undici-types/retry-agent.d.ts +15 -0
  103. package/undici-types/retry-handler.d.ts +24 -0
  104. package/undici-types/snapshot-agent.d.ts +125 -0
  105. package/undici-types/util.d.ts +15 -0
  106. package/undici-types/utility.d.ts +15 -0
  107. package/undici-types/webidl.d.ts +126 -36
  108. package/undici-types/websocket.d.ts +18 -1
  109. package/url.d.ts +107 -587
  110. package/util/types.d.ts +571 -0
  111. package/util.d.ts +158 -792
  112. package/v8.d.ts +82 -7
  113. package/vm.d.ts +267 -108
  114. package/wasi.d.ts +38 -2
  115. package/web-globals/abortcontroller.d.ts +75 -0
  116. package/web-globals/blob.d.ts +39 -0
  117. package/web-globals/console.d.ts +25 -0
  118. package/web-globals/crypto.d.ts +55 -0
  119. package/web-globals/domexception.d.ts +84 -0
  120. package/web-globals/encoding.d.ts +27 -0
  121. package/{dom-events.d.ts → web-globals/events.d.ts} +72 -50
  122. package/web-globals/fetch.d.ts +70 -0
  123. package/web-globals/importmeta.d.ts +29 -0
  124. package/web-globals/messaging.d.ts +39 -0
  125. package/web-globals/navigator.d.ts +41 -0
  126. package/web-globals/performance.d.ts +61 -0
  127. package/web-globals/storage.d.ts +40 -0
  128. package/web-globals/streams.d.ts +131 -0
  129. package/web-globals/timers.d.ts +60 -0
  130. package/web-globals/url.d.ts +40 -0
  131. package/worker_threads.d.ts +306 -349
  132. package/zlib.d.ts +59 -94
  133. package/ts5.1/compatibility/disposable.d.ts +0 -13
  134. package/ts5.1/index.d.ts +0 -100
package/vm.d.ts CHANGED
@@ -1,3 +1,18 @@
1
+ // biome-ignore-all lint: generated file
2
+ // biome-ignore-all assist: generated file
3
+ /* eslint-disable */
4
+ // @ts-ignore
5
+
6
+ /******************************************************************************
7
+ * GENERATED FILE, DO NOT MODIFY
8
+ * 这是生成的文件,千万不要修改
9
+ *
10
+ * @build-script/codegen - The Simple Code Generater
11
+ * https://github.com/GongT/baobao
12
+ *
13
+ ******************************************************************************/
14
+
15
+
1
16
  /**
2
17
  * The `node:vm` module enables compiling and running code within V8 Virtual
3
18
  * Machine contexts.
@@ -34,11 +49,12 @@
34
49
  *
35
50
  * console.log(x); // 1; y is not defined.
36
51
  * ```
37
- * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/vm.js)
52
+ * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/vm.js)
38
53
  */
39
54
 
40
55
  declare module "node:vm" {
41
- import { ImportAttributes } from 'node:module';
56
+ import { NonSharedBuffer } from 'node:buffer';
57
+ import { ImportAttributes, ImportPhase } from 'node:module';
42
58
  interface Context extends NodeJS.Dict<any> {}
43
59
  interface BaseOptions {
44
60
  /**
@@ -61,19 +77,19 @@ declare module "node:vm" {
61
77
  specifier: string,
62
78
  referrer: T,
63
79
  importAttributes: ImportAttributes,
64
- phase: "source" | "evaluation",
80
+ phase: ImportPhase,
65
81
  ) => Module | Promise<Module>;
66
82
  interface ScriptOptions extends BaseOptions {
67
83
  /**
68
84
  * Provides an optional data with V8's code cache data for the supplied source.
69
85
  */
70
- cachedData?: Buffer | NodeJS.ArrayBufferView | undefined;
86
+ cachedData?: NodeJS.ArrayBufferView | undefined;
71
87
  /** @deprecated in favor of `script.createCachedData()` */
72
88
  produceCachedData?: boolean | undefined;
73
89
  /**
74
90
  * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
75
91
  * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
76
- * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v24.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
92
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v25.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
77
93
  * @experimental
78
94
  */
79
95
  importModuleDynamically?:
@@ -100,32 +116,26 @@ declare module "node:vm" {
100
116
  */
101
117
  breakOnSigint?: boolean | undefined;
102
118
  }
103
- interface RunningScriptInNewContextOptions extends RunningScriptOptions {
119
+ interface RunningScriptInNewContextOptions
120
+ extends RunningScriptOptions, Pick<CreateContextOptions, "microtaskMode">
121
+ {
104
122
  /**
105
123
  * Human-readable name of the newly created context.
106
124
  */
107
- contextName?: CreateContextOptions["name"];
125
+ contextName?: CreateContextOptions["name"] | undefined;
108
126
  /**
109
127
  * Origin corresponding to the newly created context for display purposes. The origin should be formatted like a URL,
110
128
  * but with only the scheme, host, and port (if necessary), like the value of the `url.origin` property of a `URL` object.
111
129
  * Most notably, this string should omit the trailing slash, as that denotes a path.
112
130
  */
113
- contextOrigin?: CreateContextOptions["origin"];
114
- contextCodeGeneration?: CreateContextOptions["codeGeneration"];
115
- /**
116
- * If set to `afterEvaluate`, microtasks will be run immediately after the script has run.
117
- */
118
- microtaskMode?: CreateContextOptions["microtaskMode"];
131
+ contextOrigin?: CreateContextOptions["origin"] | undefined;
132
+ contextCodeGeneration?: CreateContextOptions["codeGeneration"] | undefined;
119
133
  }
120
- interface RunningCodeOptions extends RunningScriptOptions {
121
- /**
122
- * Provides an optional data with V8's code cache data for the supplied source.
123
- */
124
- cachedData?: ScriptOptions["cachedData"] | undefined;
134
+ interface RunningCodeOptions extends RunningScriptOptions, Pick<ScriptOptions, "cachedData"> {
125
135
  /**
126
136
  * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
127
137
  * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
128
- * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v24.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
138
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v25.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
129
139
  * @experimental
130
140
  */
131
141
  importModuleDynamically?:
@@ -133,15 +143,13 @@ declare module "node:vm" {
133
143
  | typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
134
144
  | undefined;
135
145
  }
136
- interface RunningCodeInNewContextOptions extends RunningScriptInNewContextOptions {
137
- /**
138
- * Provides an optional data with V8's code cache data for the supplied source.
139
- */
140
- cachedData?: ScriptOptions["cachedData"] | undefined;
146
+ interface RunningCodeInNewContextOptions
147
+ extends RunningScriptInNewContextOptions, Pick<ScriptOptions, "cachedData">
148
+ {
141
149
  /**
142
150
  * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
143
151
  * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
144
- * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v24.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
152
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v25.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
145
153
  * @experimental
146
154
  */
147
155
  importModuleDynamically?:
@@ -149,16 +157,7 @@ declare module "node:vm" {
149
157
  | typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
150
158
  | undefined;
151
159
  }
152
- interface CompileFunctionOptions extends BaseOptions {
153
- /**
154
- * Provides an optional data with V8's code cache data for the supplied source.
155
- */
156
- cachedData?: ScriptOptions["cachedData"] | undefined;
157
- /**
158
- * Specifies whether to produce new cache data.
159
- * @default false
160
- */
161
- produceCachedData?: boolean | undefined;
160
+ interface CompileFunctionOptions extends BaseOptions, Pick<ScriptOptions, "cachedData" | "produceCachedData"> {
162
161
  /**
163
162
  * The sandbox/context in which the said function should be compiled in.
164
163
  */
@@ -170,7 +169,7 @@ declare module "node:vm" {
170
169
  /**
171
170
  * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
172
171
  * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
173
- * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v24.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
172
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v25.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
174
173
  * @experimental
175
174
  */
176
175
  importModuleDynamically?:
@@ -214,7 +213,7 @@ declare module "node:vm" {
214
213
  /**
215
214
  * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
216
215
  * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
217
- * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v24.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
216
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v25.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
218
217
  * @experimental
219
218
  */
220
219
  importModuleDynamically?:
@@ -385,17 +384,17 @@ declare module "node:vm" {
385
384
  * ```
386
385
  * @since v10.6.0
387
386
  */
388
- createCachedData(): Buffer;
387
+ createCachedData(): NonSharedBuffer;
389
388
  /** @deprecated in favor of `script.createCachedData()` */
390
- cachedDataProduced?: boolean | undefined;
389
+ cachedDataProduced?: boolean;
391
390
  /**
392
391
  * When `cachedData` is supplied to create the `vm.Script`, this value will be set
393
392
  * to either `true` or `false` depending on acceptance of the data by V8.
394
393
  * Otherwise the value is `undefined`.
395
394
  * @since v5.7.0
396
395
  */
397
- cachedDataRejected?: boolean | undefined;
398
- cachedData?: Buffer | undefined;
396
+ cachedDataRejected?: boolean;
397
+ cachedData?: NonSharedBuffer;
399
398
  /**
400
399
  * When the script is compiled from a source that contains a source map magic
401
400
  * comment, this property will be set to the URL of the source map.
@@ -413,13 +412,13 @@ declare module "node:vm" {
413
412
  * ```
414
413
  * @since v19.1.0, v18.13.0
415
414
  */
416
- sourceMapURL?: string | undefined;
415
+ sourceMapURL: string | undefined;
417
416
  }
418
417
  /**
419
418
  * If the given `contextObject` is an object, the `vm.createContext()` method will
420
- * [prepare that object](https://nodejs.org/docs/latest-v24.x/api/vm.html#what-does-it-mean-to-contextify-an-object)
419
+ * [prepare that object](https://nodejs.org/docs/latest-v25.x/api/vm.html#what-does-it-mean-to-contextify-an-object)
421
420
  * and return a reference to it so that it can be used in calls to {@link runInContext} or
422
- * [`script.runInContext()`](https://nodejs.org/docs/latest-v24.x/api/vm.html#scriptrunincontextcontextifiedobject-options).
421
+ * [`script.runInContext()`](https://nodejs.org/docs/latest-v25.x/api/vm.html#scriptrunincontextcontextifiedobject-options).
423
422
  * Inside such scripts, the global object will be wrapped by the `contextObject`, retaining all of its
424
423
  * existing properties but also having the built-in objects and functions any standard
425
424
  * [global object](https://es5.github.io/#x15.1) has. Outside of scripts run by the vm module, global
@@ -623,11 +622,7 @@ declare module "node:vm" {
623
622
  code: string,
624
623
  params?: readonly string[],
625
624
  options?: CompileFunctionOptions,
626
- ): Function & {
627
- cachedData?: Script["cachedData"] | undefined;
628
- cachedDataProduced?: Script["cachedDataProduced"] | undefined;
629
- cachedDataRejected?: Script["cachedDataRejected"] | undefined;
630
- };
625
+ ): Function & Pick<Script, "cachedData" | "cachedDataProduced" | "cachedDataRejected">;
631
626
  /**
632
627
  * Measure the memory known to V8 and used by all contexts known to the
633
628
  * current V8 isolate, or the main context.
@@ -684,10 +679,7 @@ declare module "node:vm" {
684
679
  * @experimental
685
680
  */
686
681
  function measureMemory(options?: MeasureMemoryOptions): Promise<MemoryMeasurement>;
687
- interface ModuleEvaluateOptions {
688
- timeout?: RunningScriptOptions["timeout"] | undefined;
689
- breakOnSigint?: RunningScriptOptions["breakOnSigint"] | undefined;
690
- }
682
+ interface ModuleEvaluateOptions extends Pick<RunningScriptOptions, "breakOnSigint" | "timeout"> {}
691
683
  type ModuleLinker = (
692
684
  specifier: string,
693
685
  referencingModule: Module,
@@ -701,14 +693,12 @@ declare module "node:vm" {
701
693
  * flag enabled.
702
694
  *
703
695
  * The `vm.Module` class provides a low-level interface for using
704
- * ECMAScript modules in VM contexts. It is the counterpart of the `vm.Script` class that closely mirrors [Module Record](https://262.ecma-international.org/14.0/#sec-abstract-module-records) s as
705
- * defined in the ECMAScript
696
+ * ECMAScript modules in VM contexts. It is the counterpart of the `vm.Script`
697
+ * class that closely mirrors [Module Record](https://tc39.es/ecma262/#sec-abstract-module-records)s as defined in the ECMAScript
706
698
  * specification.
707
699
  *
708
700
  * Unlike `vm.Script` however, every `vm.Module` object is bound to a context from
709
- * its creation. Operations on `vm.Module` objects are intrinsically asynchronous,
710
- * in contrast with the synchronous nature of `vm.Script` objects. The use of
711
- * 'async' functions can help with manipulating `vm.Module` objects.
701
+ * its creation.
712
702
  *
713
703
  * Using a `vm.Module` object requires three distinct steps: creation/parsing,
714
704
  * linking, and evaluation. These three steps are illustrated in the following
@@ -736,7 +726,7 @@ declare module "node:vm" {
736
726
  * // Here, we attempt to obtain the default export from the module "foo", and
737
727
  * // put it into local binding "secret".
738
728
  *
739
- * const bar = new vm.SourceTextModule(`
729
+ * const rootModule = new vm.SourceTextModule(`
740
730
  * import s from 'foo';
741
731
  * s;
742
732
  * print(s);
@@ -746,39 +736,48 @@ declare module "node:vm" {
746
736
  * //
747
737
  * // "Link" the imported dependencies of this Module to it.
748
738
  * //
749
- * // The provided linking callback (the "linker") accepts two arguments: the
750
- * // parent module (`bar` in this case) and the string that is the specifier of
751
- * // the imported module. The callback is expected to return a Module that
752
- * // corresponds to the provided specifier, with certain requirements documented
753
- * // in `module.link()`.
754
- * //
755
- * // If linking has not started for the returned Module, the same linker
756
- * // callback will be called on the returned Module.
739
+ * // Obtain the requested dependencies of a SourceTextModule by
740
+ * // `sourceTextModule.moduleRequests` and resolve them.
757
741
  * //
758
742
  * // Even top-level Modules without dependencies must be explicitly linked. The
759
- * // callback provided would never be called, however.
743
+ * // array passed to `sourceTextModule.linkRequests(modules)` can be
744
+ * // empty, however.
760
745
  * //
761
- * // The link() method returns a Promise that will be resolved when all the
762
- * // Promises returned by the linker resolve.
763
- * //
764
- * // Note: This is a contrived example in that the linker function creates a new
765
- * // "foo" module every time it is called. In a full-fledged module system, a
766
- * // cache would probably be used to avoid duplicated modules.
746
+ * // Note: This is a contrived example in that the resolveAndLinkDependencies
747
+ * // creates a new "foo" module every time it is called. In a full-fledged
748
+ * // module system, a cache would probably be used to avoid duplicated modules.
749
+ *
750
+ * const moduleMap = new Map([
751
+ * ['root', rootModule],
752
+ * ]);
767
753
  *
768
- * async function linker(specifier, referencingModule) {
769
- * if (specifier === 'foo') {
770
- * return new vm.SourceTextModule(`
771
- * // The "secret" variable refers to the global variable we added to
772
- * // "contextifiedObject" when creating the context.
773
- * export default secret;
774
- * `, { context: referencingModule.context });
754
+ * function resolveAndLinkDependencies(module) {
755
+ * const requestedModules = module.moduleRequests.map((request) => {
756
+ * // In a full-fledged module system, the resolveAndLinkDependencies would
757
+ * // resolve the module with the module cache key `[specifier, attributes]`.
758
+ * // In this example, we just use the specifier as the key.
759
+ * const specifier = request.specifier;
775
760
  *
776
- * // Using `contextifiedObject` instead of `referencingModule.context`
777
- * // here would work as well.
778
- * }
779
- * throw new Error(`Unable to resolve dependency: ${specifier}`);
761
+ * let requestedModule = moduleMap.get(specifier);
762
+ * if (requestedModule === undefined) {
763
+ * requestedModule = new vm.SourceTextModule(`
764
+ * // The "secret" variable refers to the global variable we added to
765
+ * // "contextifiedObject" when creating the context.
766
+ * export default secret;
767
+ * `, { context: referencingModule.context });
768
+ * moduleMap.set(specifier, linkedModule);
769
+ * // Resolve the dependencies of the new module as well.
770
+ * resolveAndLinkDependencies(requestedModule);
771
+ * }
772
+ *
773
+ * return requestedModule;
774
+ * });
775
+ *
776
+ * module.linkRequests(requestedModules);
780
777
  * }
781
- * await bar.link(linker);
778
+ *
779
+ * resolveAndLinkDependencies(rootModule);
780
+ * rootModule.instantiate();
782
781
  *
783
782
  * // Step 3
784
783
  * //
@@ -786,20 +785,12 @@ declare module "node:vm" {
786
785
  * // resolve after the module has finished evaluating.
787
786
  *
788
787
  * // Prints 42.
789
- * await bar.evaluate();
788
+ * await rootModule.evaluate();
790
789
  * ```
791
790
  * @since v13.0.0, v12.16.0
792
791
  * @experimental
793
792
  */
794
793
  class Module {
795
- /**
796
- * The specifiers of all dependencies of this module. The returned array is frozen
797
- * to disallow any changes to it.
798
- *
799
- * Corresponds to the `[[RequestedModules]]` field of [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records) s in
800
- * the ECMAScript specification.
801
- */
802
- dependencySpecifiers: readonly string[];
803
794
  /**
804
795
  * If the `module.status` is `'errored'`, this property contains the exception
805
796
  * thrown by the module during evaluation. If the status is anything else,
@@ -864,6 +855,10 @@ declare module "node:vm" {
864
855
  * Link module dependencies. This method must be called before evaluation, and
865
856
  * can only be called once per module.
866
857
  *
858
+ * Use `sourceTextModule.linkRequests(modules)` and
859
+ * `sourceTextModule.instantiate()` to link modules either synchronously or
860
+ * asynchronously.
861
+ *
867
862
  * The function is expected to return a `Module` object or a `Promise` that
868
863
  * eventually resolves to a `Module` object. The returned `Module` must satisfy the
869
864
  * following two invariants:
@@ -894,19 +889,13 @@ declare module "node:vm" {
894
889
  */
895
890
  link(linker: ModuleLinker): Promise<void>;
896
891
  }
897
- interface SourceTextModuleOptions {
892
+ interface SourceTextModuleOptions extends Pick<ScriptOptions, "cachedData" | "columnOffset" | "lineOffset"> {
898
893
  /**
899
894
  * String used in stack traces.
900
895
  * @default 'vm:module(i)' where i is a context-specific ascending index.
901
896
  */
902
897
  identifier?: string | undefined;
903
- /**
904
- * Provides an optional data with V8's code cache data for the supplied source.
905
- */
906
- cachedData?: ScriptOptions["cachedData"] | undefined;
907
898
  context?: Context | undefined;
908
- lineOffset?: BaseOptions["lineOffset"] | undefined;
909
- columnOffset?: BaseOptions["columnOffset"] | undefined;
910
899
  /**
911
900
  * Called during evaluation of this module to initialize the `import.meta`.
912
901
  */
@@ -914,11 +903,30 @@ declare module "node:vm" {
914
903
  /**
915
904
  * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
916
905
  * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
917
- * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v24.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
906
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v25.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
918
907
  * @experimental
919
908
  */
920
909
  importModuleDynamically?: DynamicModuleLoader<SourceTextModule> | undefined;
921
910
  }
911
+ /**
912
+ * A `ModuleRequest` represents the request to import a module with given import attributes and phase.
913
+ * @since 24.4.0
914
+ */
915
+ interface ModuleRequest {
916
+ /**
917
+ * The specifier of the requested module.
918
+ */
919
+ specifier: string;
920
+ /**
921
+ * The `"with"` value passed to the `WithClause` in a `ImportDeclaration`, or an empty object if no value was
922
+ * provided.
923
+ */
924
+ attributes: ImportAttributes;
925
+ /**
926
+ * The phase of the requested module (`"source"` or `"evaluation"`).
927
+ */
928
+ phase: ImportPhase;
929
+ }
922
930
  /**
923
931
  * This feature is only available with the `--experimental-vm-modules` command
924
932
  * flag enabled.
@@ -931,9 +939,163 @@ declare module "node:vm" {
931
939
  class SourceTextModule extends Module {
932
940
  /**
933
941
  * Creates a new `SourceTextModule` instance.
942
+ *
943
+ * Properties assigned to the `import.meta` object that are objects may
944
+ * allow the module to access information outside the specified `context`. Use
945
+ * `vm.runInContext()` to create objects in a specific context.
946
+ *
947
+ * ```js
948
+ * import vm from 'node:vm';
949
+ *
950
+ * const contextifiedObject = vm.createContext({ secret: 42 });
951
+ *
952
+ * const module = new vm.SourceTextModule(
953
+ * 'Object.getPrototypeOf(import.meta.prop).secret = secret;',
954
+ * {
955
+ * initializeImportMeta(meta) {
956
+ * // Note: this object is created in the top context. As such,
957
+ * // Object.getPrototypeOf(import.meta.prop) points to the
958
+ * // Object.prototype in the top context rather than that in
959
+ * // the contextified object.
960
+ * meta.prop = {};
961
+ * },
962
+ * });
963
+ * // The module has an empty `moduleRequests` array.
964
+ * module.linkRequests([]);
965
+ * module.instantiate();
966
+ * await module.evaluate();
967
+ *
968
+ * // Now, Object.prototype.secret will be equal to 42.
969
+ * //
970
+ * // To fix this problem, replace
971
+ * // meta.prop = {};
972
+ * // above with
973
+ * // meta.prop = vm.runInContext('{}', contextifiedObject);
974
+ * ```
934
975
  * @param code JavaScript Module code to parse
935
976
  */
936
977
  constructor(code: string, options?: SourceTextModuleOptions);
978
+ /**
979
+ * @deprecated Use `sourceTextModule.moduleRequests` instead.
980
+ */
981
+ readonly dependencySpecifiers: readonly string[];
982
+ /**
983
+ * Iterates over the dependency graph and returns `true` if any module in its
984
+ * dependencies or this module itself contains top-level `await` expressions,
985
+ * otherwise returns `false`.
986
+ *
987
+ * The search may be slow if the graph is big enough.
988
+ *
989
+ * This requires the module to be instantiated first. If the module is not
990
+ * instantiated yet, an error will be thrown.
991
+ * @since v24.9.0
992
+ */
993
+ hasAsyncGraph(): boolean;
994
+ /**
995
+ * Returns whether the module itself contains any top-level `await` expressions.
996
+ *
997
+ * This corresponds to the field `[[HasTLA]]` in [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records) in the
998
+ * ECMAScript specification.
999
+ * @since v24.9.0
1000
+ */
1001
+ hasTopLevelAwait(): boolean;
1002
+ /**
1003
+ * Instantiate the module with the linked requested modules.
1004
+ *
1005
+ * This resolves the imported bindings of the module, including re-exported
1006
+ * binding names. When there are any bindings that cannot be resolved,
1007
+ * an error would be thrown synchronously.
1008
+ *
1009
+ * If the requested modules include cyclic dependencies, the
1010
+ * `sourceTextModule.linkRequests(modules)` method must be called on all
1011
+ * modules in the cycle before calling this method.
1012
+ * @since v24.8.0
1013
+ */
1014
+ instantiate(): void;
1015
+ /**
1016
+ * Link module dependencies. This method must be called before evaluation, and
1017
+ * can only be called once per module.
1018
+ *
1019
+ * The order of the module instances in the `modules` array should correspond to the order of
1020
+ * `sourceTextModule.moduleRequests` being resolved. If two module requests have the same
1021
+ * specifier and import attributes, they must be resolved with the same module instance or an
1022
+ * `ERR_MODULE_LINK_MISMATCH` would be thrown. For example, when linking requests for this
1023
+ * module:
1024
+ *
1025
+ * ```js
1026
+ * import foo from 'foo';
1027
+ * import source Foo from 'foo';
1028
+ * ```
1029
+ *
1030
+ * The `modules` array must contain two references to the same instance, because the two
1031
+ * module requests are identical but in two phases.
1032
+ *
1033
+ * If the module has no dependencies, the `modules` array can be empty.
1034
+ *
1035
+ * Users can use `sourceTextModule.moduleRequests` to implement the host-defined
1036
+ * [HostLoadImportedModule](https://tc39.es/ecma262/#sec-HostLoadImportedModule) abstract operation in the ECMAScript specification,
1037
+ * and using `sourceTextModule.linkRequests()` to invoke specification defined
1038
+ * [FinishLoadingImportedModule](https://tc39.es/ecma262/#sec-FinishLoadingImportedModule), on the module with all dependencies in a batch.
1039
+ *
1040
+ * It's up to the creator of the `SourceTextModule` to determine if the resolution
1041
+ * of the dependencies is synchronous or asynchronous.
1042
+ *
1043
+ * After each module in the `modules` array is linked, call
1044
+ * `sourceTextModule.instantiate()`.
1045
+ * @since v24.8.0
1046
+ * @param modules Array of `vm.Module` objects that this module depends on.
1047
+ * The order of the modules in the array is the order of
1048
+ * `sourceTextModule.moduleRequests`.
1049
+ */
1050
+ linkRequests(modules: readonly Module[]): void;
1051
+ /**
1052
+ * The requested import dependencies of this module. The returned array is frozen
1053
+ * to disallow any changes to it.
1054
+ *
1055
+ * For example, given a source text:
1056
+ *
1057
+ * ```js
1058
+ * import foo from 'foo';
1059
+ * import fooAlias from 'foo';
1060
+ * import bar from './bar.js';
1061
+ * import withAttrs from '../with-attrs.ts' with { arbitraryAttr: 'attr-val' };
1062
+ * import source Module from 'wasm-mod.wasm';
1063
+ * ```
1064
+ *
1065
+ * The value of the `sourceTextModule.moduleRequests` will be:
1066
+ *
1067
+ * ```js
1068
+ * [
1069
+ * {
1070
+ * specifier: 'foo',
1071
+ * attributes: {},
1072
+ * phase: 'evaluation',
1073
+ * },
1074
+ * {
1075
+ * specifier: 'foo',
1076
+ * attributes: {},
1077
+ * phase: 'evaluation',
1078
+ * },
1079
+ * {
1080
+ * specifier: './bar.js',
1081
+ * attributes: {},
1082
+ * phase: 'evaluation',
1083
+ * },
1084
+ * {
1085
+ * specifier: '../with-attrs.ts',
1086
+ * attributes: { arbitraryAttr: 'attr-val' },
1087
+ * phase: 'evaluation',
1088
+ * },
1089
+ * {
1090
+ * specifier: 'wasm-mod.wasm',
1091
+ * attributes: {},
1092
+ * phase: 'source',
1093
+ * },
1094
+ * ];
1095
+ * ```
1096
+ * @since v24.4.0
1097
+ */
1098
+ readonly moduleRequests: readonly ModuleRequest[];
937
1099
  }
938
1100
  interface SyntheticModuleOptions {
939
1101
  /**
@@ -981,9 +1143,7 @@ declare module "node:vm" {
981
1143
  options?: SyntheticModuleOptions,
982
1144
  );
983
1145
  /**
984
- * This method is used after the module is linked to set the values of exports. If
985
- * it is called before the module is linked, an `ERR_VM_MODULE_STATUS` error
986
- * will be thrown.
1146
+ * This method sets the module export binding slots with the given value.
987
1147
  *
988
1148
  * ```js
989
1149
  * import vm from 'node:vm';
@@ -992,7 +1152,6 @@ declare module "node:vm" {
992
1152
  * m.setExport('x', 1);
993
1153
  * });
994
1154
  *
995
- * await m.link(() => {});
996
1155
  * await m.evaluate();
997
1156
  *
998
1157
  * assert.strictEqual(m.namespace.x, 1);
@@ -1013,7 +1172,7 @@ declare module "node:vm" {
1013
1172
  * and `vm.compileFunction()` so that Node.js uses the default ESM loader from the main
1014
1173
  * context to load the requested module.
1015
1174
  *
1016
- * For detailed information, see [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v24.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
1175
+ * For detailed information, see [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v25.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
1017
1176
  * @since v21.7.0, v20.12.0
1018
1177
  */
1019
1178
  const USE_MAIN_CONTEXT_DEFAULT_LOADER: number;
package/wasi.d.ts CHANGED
@@ -1,3 +1,18 @@
1
+ // biome-ignore-all lint: generated file
2
+ // biome-ignore-all assist: generated file
3
+ /* eslint-disable */
4
+ // @ts-ignore
5
+
6
+ /******************************************************************************
7
+ * GENERATED FILE, DO NOT MODIFY
8
+ * 这是生成的文件,千万不要修改
9
+ *
10
+ * @build-script/codegen - The Simple Code Generater
11
+ * https://github.com/GongT/baobao
12
+ *
13
+ ******************************************************************************/
14
+
15
+
1
16
  /**
2
17
  * **The `node:wasi` module does not currently provide the**
3
18
  * **comprehensive file system security properties provided by some WASI runtimes.**
@@ -67,7 +82,7 @@
67
82
  * wat2wasm demo.wat
68
83
  * ```
69
84
  * @experimental
70
- * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/wasi.js)
85
+ * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/wasi.js)
71
86
  */
72
87
 
73
88
  declare module "node:wasi" {
@@ -78,7 +93,7 @@ declare module "node:wasi" {
78
93
  * WASI command itself.
79
94
  * @default []
80
95
  */
81
- args?: string[] | undefined;
96
+ args?: readonly string[] | undefined;
82
97
  /**
83
98
  * An object similar to `process.env` that the WebAssembly
84
99
  * application will see as its environment.
@@ -122,6 +137,12 @@ declare module "node:wasi" {
122
137
  */
123
138
  version: "unstable" | "preview1";
124
139
  }
140
+ interface FinalizeBindingsOptions {
141
+ /**
142
+ * @default instance.exports.memory
143
+ */
144
+ memory?: object | undefined;
145
+ }
125
146
  /**
126
147
  * The `WASI` class provides the WASI system call API and additional convenience
127
148
  * methods for working with WASI-based applications. Each `WASI` instance
@@ -168,6 +189,21 @@ declare module "node:wasi" {
168
189
  * @since v14.6.0, v12.19.0
169
190
  */
170
191
  initialize(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib.
192
+ /**
193
+ * Set up WASI host bindings to `instance` without calling `initialize()`
194
+ * or `start()`. This method is useful when the WASI module is instantiated in
195
+ * child threads for sharing the memory across threads.
196
+ *
197
+ * `finalizeBindings()` requires that either `instance` exports a
198
+ * [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) named `memory` or user specify a
199
+ * [`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
200
+ * an exception is thrown.
201
+ *
202
+ * `start()` and `initialize()` will call `finalizeBindings()` internally.
203
+ * If `finalizeBindings()` is called more than once, an exception is thrown.
204
+ * @since v24.4.0
205
+ */
206
+ finalizeBindings(instance: object, options?: FinalizeBindingsOptions): void;
171
207
  /**
172
208
  * `wasiImport` is an object that implements the WASI system call API. This object
173
209
  * should be passed as the `wasi_snapshot_preview1` import during the instantiation