@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.
- package/README.md +1 -1
- package/assert/strict.d.ts +113 -1
- package/assert.d.ts +162 -248
- package/async_hooks.d.ts +20 -5
- package/buffer.buffer.d.ts +24 -6
- package/buffer.d.ts +63 -168
- package/child_process.d.ts +117 -223
- package/cluster.d.ts +251 -329
- package/compatibility/iterators.d.ts +15 -0
- package/console.d.ts +60 -346
- package/constants.d.ts +15 -1
- package/crypto.d.ts +713 -1149
- package/dgram.d.ts +30 -50
- package/diagnostics_channel.d.ts +16 -3
- package/dns/promises.d.ts +15 -0
- package/dns.d.ts +150 -131
- package/domain.d.ts +25 -14
- package/events.d.ts +858 -719
- package/fs/promises.d.ts +117 -53
- package/fs.d.ts +729 -484
- package/globals.d.ts +142 -344
- package/globals.typedarray.d.ts +94 -0
- package/http.d.ts +358 -246
- package/http2.d.ts +578 -711
- package/https.d.ts +85 -216
- package/index.d.ts +39 -3
- package/inspector/promises.d.ts +54 -0
- package/inspector.d.ts +180 -3936
- package/inspector.generated.d.ts +4242 -0
- package/module.d.ts +60 -95
- package/my-shim.d.ts +15 -0
- package/net.d.ts +102 -186
- package/os.d.ts +32 -6
- package/package.json +3 -8
- package/path/posix.d.ts +20 -0
- package/path/win32.d.ts +20 -0
- package/path.d.ts +132 -122
- package/perf_hooks.d.ts +310 -644
- package/process.d.ts +192 -138
- package/punycode.d.ts +17 -2
- package/querystring.d.ts +16 -1
- package/quic.d.ts +926 -0
- package/readline/promises.d.ts +16 -1
- package/readline.d.ts +80 -118
- package/repl.d.ts +98 -96
- package/sea.d.ts +25 -1
- package/sqlite.d.ts +277 -13
- package/stream/consumers.d.ts +22 -7
- package/stream/promises.d.ts +148 -12
- package/stream/web.d.ts +187 -494
- package/stream.d.ts +608 -490
- package/string_decoder.d.ts +18 -3
- package/test/reporters.d.ts +112 -0
- package/test.d.ts +238 -199
- package/timers/promises.d.ts +16 -1
- package/timers.d.ts +16 -129
- package/tls.d.ts +163 -163
- package/trace_events.d.ts +21 -6
- package/ts5.6/buffer.buffer.d.ts +25 -8
- package/ts5.6/compatibility/float16array.d.ts +15 -0
- package/ts5.6/globals.typedarray.d.ts +31 -0
- package/ts5.6/index.d.ts +39 -3
- package/ts5.7/compatibility/float16array.d.ts +15 -0
- package/ts5.7/index.d.ts +39 -3
- package/tty.d.ts +70 -13
- package/undici-types/agent.d.ts +20 -4
- package/undici-types/api.d.ts +15 -0
- package/undici-types/balanced-pool.d.ts +15 -0
- package/undici-types/cache-interceptor.d.ts +15 -0
- package/undici-types/cache.d.ts +15 -0
- package/undici-types/client-stats.d.ts +31 -0
- package/undici-types/client.d.ts +21 -5
- package/undici-types/connector.d.ts +15 -0
- package/undici-types/content-type.d.ts +15 -0
- package/undici-types/cookies.d.ts +15 -0
- package/undici-types/diagnostics-channel.d.ts +24 -1
- package/undici-types/dispatcher.d.ts +18 -8
- package/undici-types/env-http-proxy-agent.d.ts +17 -1
- package/undici-types/errors.d.ts +20 -15
- package/undici-types/eventsource.d.ts +24 -4
- package/undici-types/fetch.d.ts +16 -0
- package/undici-types/formdata.d.ts +15 -0
- package/undici-types/global-dispatcher.d.ts +15 -0
- package/undici-types/global-origin.d.ts +15 -0
- package/undici-types/h2c-client.d.ts +15 -2
- package/undici-types/handlers.d.ts +16 -1
- package/undici-types/header.d.ts +15 -0
- package/undici-types/index.d.ts +21 -1
- package/undici-types/interceptors.d.ts +20 -0
- package/undici-types/mock-agent.d.ts +18 -0
- package/undici-types/mock-call-history.d.ts +15 -0
- package/undici-types/mock-client.d.ts +17 -0
- package/undici-types/mock-errors.d.ts +15 -0
- package/undici-types/mock-interceptor.d.ts +17 -1
- package/undici-types/mock-pool.d.ts +17 -0
- package/undici-types/package.json +1 -1
- package/undici-types/patch.d.ts +15 -0
- package/undici-types/pool-stats.d.ts +15 -0
- package/undici-types/pool.d.ts +17 -0
- package/undici-types/proxy-agent.d.ts +16 -0
- package/undici-types/readable.d.ts +15 -0
- package/undici-types/retry-agent.d.ts +15 -0
- package/undici-types/retry-handler.d.ts +24 -0
- package/undici-types/snapshot-agent.d.ts +125 -0
- package/undici-types/util.d.ts +15 -0
- package/undici-types/utility.d.ts +15 -0
- package/undici-types/webidl.d.ts +126 -36
- package/undici-types/websocket.d.ts +18 -1
- package/url.d.ts +107 -587
- package/util/types.d.ts +571 -0
- package/util.d.ts +158 -792
- package/v8.d.ts +82 -7
- package/vm.d.ts +267 -108
- package/wasi.d.ts +38 -2
- package/web-globals/abortcontroller.d.ts +75 -0
- package/web-globals/blob.d.ts +39 -0
- package/web-globals/console.d.ts +25 -0
- package/web-globals/crypto.d.ts +55 -0
- package/web-globals/domexception.d.ts +84 -0
- package/web-globals/encoding.d.ts +27 -0
- package/{dom-events.d.ts → web-globals/events.d.ts} +72 -50
- package/web-globals/fetch.d.ts +70 -0
- package/web-globals/importmeta.d.ts +29 -0
- package/web-globals/messaging.d.ts +39 -0
- package/web-globals/navigator.d.ts +41 -0
- package/web-globals/performance.d.ts +61 -0
- package/web-globals/storage.d.ts +40 -0
- package/web-globals/streams.d.ts +131 -0
- package/web-globals/timers.d.ts +60 -0
- package/web-globals/url.d.ts +40 -0
- package/worker_threads.d.ts +306 -349
- package/zlib.d.ts +59 -94
- package/ts5.1/compatibility/disposable.d.ts +0 -13
- 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/
|
|
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 {
|
|
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:
|
|
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?:
|
|
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-
|
|
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
|
|
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-
|
|
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
|
|
137
|
-
|
|
138
|
-
|
|
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-
|
|
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-
|
|
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-
|
|
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():
|
|
387
|
+
createCachedData(): NonSharedBuffer;
|
|
389
388
|
/** @deprecated in favor of `script.createCachedData()` */
|
|
390
|
-
cachedDataProduced?: boolean
|
|
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
|
|
398
|
-
cachedData?:
|
|
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
|
|
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-
|
|
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-
|
|
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`
|
|
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.
|
|
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
|
|
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
|
-
* //
|
|
750
|
-
* //
|
|
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
|
-
* //
|
|
743
|
+
* // array passed to `sourceTextModule.linkRequests(modules)` can be
|
|
744
|
+
* // empty, however.
|
|
760
745
|
* //
|
|
761
|
-
* //
|
|
762
|
-
* //
|
|
763
|
-
* //
|
|
764
|
-
*
|
|
765
|
-
*
|
|
766
|
-
*
|
|
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
|
-
*
|
|
769
|
-
*
|
|
770
|
-
*
|
|
771
|
-
*
|
|
772
|
-
*
|
|
773
|
-
*
|
|
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
|
-
*
|
|
777
|
-
*
|
|
778
|
-
*
|
|
779
|
-
*
|
|
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
|
-
*
|
|
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
|
|
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-
|
|
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
|
|
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-
|
|
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/
|
|
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
|