@types/node 18.19.25 → 18.19.27
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 v18.19/README.md +1 -1
- node v18.19/cluster.d.ts +176 -30
- node v18.19/package.json +2 -2
- node v18.19/wasi.d.ts +11 -9
node v18.19/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/v18.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Sat, 30 Mar 2024 04:35:27 GMT
|
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
|
13
13
|
|
|
14
14
|
# Credits
|
node v18.19/cluster.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Clusters of Node.js processes can be used to run multiple instances of Node.js
|
|
3
|
-
* that can distribute workloads among their application threads. When process
|
|
4
|
-
*
|
|
5
|
-
* allows running multiple application threads within a single Node.js instance.
|
|
3
|
+
* that can distribute workloads among their application threads. When process isolation
|
|
4
|
+
* is not needed, use the [`worker_threads`](https://nodejs.org/docs/latest-v18.x/api/worker_threads.html)
|
|
5
|
+
* module instead, which allows running multiple application threads within a single Node.js instance.
|
|
6
6
|
*
|
|
7
7
|
* The cluster module allows easy creation of child processes that all share
|
|
8
8
|
* server ports.
|
|
9
9
|
*
|
|
10
10
|
* ```js
|
|
11
|
-
* import cluster from 'cluster';
|
|
12
|
-
* import http from 'http';
|
|
13
|
-
* import {
|
|
14
|
-
* import process from 'process';
|
|
11
|
+
* import cluster from 'node:cluster';
|
|
12
|
+
* import http from 'node:http';
|
|
13
|
+
* import { availableParallelism } from 'node:os';
|
|
14
|
+
* import process from 'node:process';
|
|
15
15
|
*
|
|
16
|
-
* const numCPUs =
|
|
16
|
+
* const numCPUs = availableParallelism();
|
|
17
17
|
*
|
|
18
18
|
* if (cluster.isPrimary) {
|
|
19
19
|
* console.log(`Primary ${process.pid} is running`);
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
* ```
|
|
51
51
|
*
|
|
52
52
|
* On Windows, it is not yet possible to set up a named pipe server in a worker.
|
|
53
|
-
* @see [source](https://github.com/nodejs/node/blob/v18.
|
|
53
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.19.1/lib/cluster.js)
|
|
54
54
|
*/
|
|
55
55
|
declare module "cluster" {
|
|
56
56
|
import * as child from "node:child_process";
|
|
@@ -58,22 +58,74 @@ declare module "cluster" {
|
|
|
58
58
|
import * as net from "node:net";
|
|
59
59
|
type SerializationType = "json" | "advanced";
|
|
60
60
|
export interface ClusterSettings {
|
|
61
|
-
|
|
61
|
+
/**
|
|
62
|
+
* List of string arguments passed to the Node.js executable.
|
|
63
|
+
* @default process.execArgv
|
|
64
|
+
*/
|
|
65
|
+
execArgv?: string[] | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* File path to worker file.
|
|
68
|
+
* @default process.argv[1]
|
|
69
|
+
*/
|
|
62
70
|
exec?: string | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* String arguments passed to worker.
|
|
73
|
+
* @default process.argv.slice(2)
|
|
74
|
+
*/
|
|
63
75
|
args?: string[] | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Whether or not to send output to parent's stdio.
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
64
80
|
silent?: boolean | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Configures the stdio of forked processes. Because the cluster module relies on IPC to function, this configuration must
|
|
83
|
+
* contain an `'ipc'` entry. When this option is provided, it overrides `silent`. See [`child_prcess.spawn()`](https://nodejs.org/docs/latest-v18.x/api/child_process.html#child_processspawncommand-args-options)'s
|
|
84
|
+
* [`stdio`](https://nodejs.org/docs/latest-v18.x/api/child_process.html#optionsstdio).
|
|
85
|
+
*/
|
|
65
86
|
stdio?: any[] | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Sets the user identity of the process. (See [`setuid(2)`](https://man7.org/linux/man-pages/man2/setuid.2.html).)
|
|
89
|
+
*/
|
|
66
90
|
uid?: number | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Sets the group identity of the process. (See [`setgid(2)`](https://man7.org/linux/man-pages/man2/setgid.2.html).)
|
|
93
|
+
*/
|
|
67
94
|
gid?: number | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Sets inspector port of worker. This can be a number, or a function that takes no arguments and returns a number.
|
|
97
|
+
* By default each worker gets its own port, incremented from the primary's `process.debugPort`.
|
|
98
|
+
*/
|
|
68
99
|
inspectPort?: number | (() => number) | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Specify the kind of serialization used for sending messages between processes. Possible values are `'json'` and `'advanced'`.
|
|
102
|
+
* See [Advanced serialization for `child_process`](https://nodejs.org/docs/latest-v18.x/api/child_process.html#advanced-serialization) for more details.
|
|
103
|
+
* @default false
|
|
104
|
+
*/
|
|
69
105
|
serialization?: SerializationType | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Current working directory of the worker process.
|
|
108
|
+
* @default undefined (inherits from parent process)
|
|
109
|
+
*/
|
|
70
110
|
cwd?: string | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* Hide the forked processes console window that would normally be created on Windows systems.
|
|
113
|
+
* @default false
|
|
114
|
+
*/
|
|
71
115
|
windowsHide?: boolean | undefined;
|
|
72
116
|
}
|
|
73
117
|
export interface Address {
|
|
74
118
|
address: string;
|
|
75
119
|
port: number;
|
|
76
|
-
|
|
120
|
+
/**
|
|
121
|
+
* The `addressType` is one of:
|
|
122
|
+
*
|
|
123
|
+
* * `4` (TCPv4)
|
|
124
|
+
* * `6` (TCPv6)
|
|
125
|
+
* * `-1` (Unix domain socket)
|
|
126
|
+
* * `'udp4'` or `'udp6'` (UDPv4 or UDPv6)
|
|
127
|
+
*/
|
|
128
|
+
addressType: 4 | 6 | -1 | "udp4" | "udp6";
|
|
77
129
|
}
|
|
78
130
|
/**
|
|
79
131
|
* A `Worker` object contains all public information and method about a worker.
|
|
@@ -83,17 +135,17 @@ declare module "cluster" {
|
|
|
83
135
|
*/
|
|
84
136
|
export class Worker extends EventEmitter {
|
|
85
137
|
/**
|
|
86
|
-
* Each new worker is given its own unique id, this id is stored in the`id`.
|
|
138
|
+
* Each new worker is given its own unique id, this id is stored in the `id`.
|
|
87
139
|
*
|
|
88
|
-
* While a worker is alive, this is the key that indexes it in`cluster.workers`.
|
|
140
|
+
* While a worker is alive, this is the key that indexes it in `cluster.workers`.
|
|
89
141
|
* @since v0.8.0
|
|
90
142
|
*/
|
|
91
143
|
id: number;
|
|
92
144
|
/**
|
|
93
|
-
* All workers are created using `child_process.fork()
|
|
94
|
-
* from this function is stored as `.process`. In a worker, the global `process`is stored.
|
|
145
|
+
* All workers are created using [`child_process.fork()`](https://nodejs.org/docs/latest-v18.x/api/child_process.html#child_processforkmodulepath-args-options), the returned object
|
|
146
|
+
* from this function is stored as `.process`. In a worker, the global `process` is stored.
|
|
95
147
|
*
|
|
96
|
-
* See:
|
|
148
|
+
* See: [Child Process module](https://nodejs.org/docs/latest-v18.x/api/child_process.html#child_processforkmodulepath-args-options).
|
|
97
149
|
*
|
|
98
150
|
* Workers will call `process.exit(0)` if the `'disconnect'` event occurs
|
|
99
151
|
* on `process` and `.exitedAfterDisconnect` is not `true`. This protects against
|
|
@@ -104,9 +156,9 @@ declare module "cluster" {
|
|
|
104
156
|
/**
|
|
105
157
|
* Send a message to a worker or primary, optionally with a handle.
|
|
106
158
|
*
|
|
107
|
-
* In the primary, this sends a message to a specific worker. It is identical to `ChildProcess.send()
|
|
159
|
+
* In the primary, this sends a message to a specific worker. It is identical to [`ChildProcess.send()`](https://nodejs.org/docs/latest-v18.x/api/child_process.html#subprocesssendmessage-sendhandle-options-callback).
|
|
108
160
|
*
|
|
109
|
-
* In a worker, this sends a message to the primary. It is identical to`process.send()`.
|
|
161
|
+
* In a worker, this sends a message to the primary. It is identical to `process.send()`.
|
|
110
162
|
*
|
|
111
163
|
* This example will echo back all messages from the primary:
|
|
112
164
|
*
|
|
@@ -122,7 +174,7 @@ declare module "cluster" {
|
|
|
122
174
|
* }
|
|
123
175
|
* ```
|
|
124
176
|
* @since v0.7.0
|
|
125
|
-
* @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles.
|
|
177
|
+
* @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles.
|
|
126
178
|
*/
|
|
127
179
|
send(message: child.Serializable, callback?: (error: Error | null) => void): boolean;
|
|
128
180
|
send(
|
|
@@ -138,7 +190,7 @@ declare module "cluster" {
|
|
|
138
190
|
): boolean;
|
|
139
191
|
/**
|
|
140
192
|
* This function will kill the worker. In the primary worker, it does this by
|
|
141
|
-
* disconnecting the `worker.process`, and once disconnected, killing with`signal`. In the worker, it does it by killing the process with `signal`.
|
|
193
|
+
* disconnecting the `worker.process`, and once disconnected, killing with `signal`. In the worker, it does it by killing the process with `signal`.
|
|
142
194
|
*
|
|
143
195
|
* The `kill()` function kills the worker process without waiting for a graceful
|
|
144
196
|
* disconnect, it has the same behavior as `worker.process.kill()`.
|
|
@@ -146,7 +198,7 @@ declare module "cluster" {
|
|
|
146
198
|
* This method is aliased as `worker.destroy()` for backwards compatibility.
|
|
147
199
|
*
|
|
148
200
|
* In a worker, `process.kill()` exists, but it is not this function;
|
|
149
|
-
* it is `kill()
|
|
201
|
+
* it is [`kill()`](https://nodejs.org/docs/latest-v18.x/api/process.html#processkillpid-signal).
|
|
150
202
|
* @since v0.9.12
|
|
151
203
|
* @param [signal='SIGTERM'] Name of the kill signal to send to the worker process.
|
|
152
204
|
*/
|
|
@@ -156,7 +208,7 @@ declare module "cluster" {
|
|
|
156
208
|
* In a worker, this function will close all servers, wait for the `'close'` event
|
|
157
209
|
* on those servers, and then disconnect the IPC channel.
|
|
158
210
|
*
|
|
159
|
-
* In the primary, an internal message is sent to the worker causing it to call`.disconnect()` on itself.
|
|
211
|
+
* In the primary, an internal message is sent to the worker causing it to call `.disconnect()` on itself.
|
|
160
212
|
*
|
|
161
213
|
* Causes `.exitedAfterDisconnect` to be set.
|
|
162
214
|
*
|
|
@@ -196,7 +248,7 @@ declare module "cluster" {
|
|
|
196
248
|
* });
|
|
197
249
|
*
|
|
198
250
|
* } else if (cluster.isWorker) {
|
|
199
|
-
* const net = require('net');
|
|
251
|
+
* const net = require('node:net');
|
|
200
252
|
* const server = net.createServer((socket) => {
|
|
201
253
|
* // Connections never end
|
|
202
254
|
* });
|
|
@@ -226,12 +278,12 @@ declare module "cluster" {
|
|
|
226
278
|
* because of exiting or being signaled). Otherwise, it returns `false`.
|
|
227
279
|
*
|
|
228
280
|
* ```js
|
|
229
|
-
* import cluster from 'cluster';
|
|
230
|
-
* import http from 'http';
|
|
231
|
-
* import {
|
|
232
|
-
* import process from 'process';
|
|
281
|
+
* import cluster from 'node:cluster';
|
|
282
|
+
* import http from 'node:http';
|
|
283
|
+
* import { availableParallelism } from 'node:os';
|
|
284
|
+
* import process from 'node:process';
|
|
233
285
|
*
|
|
234
|
-
* const numCPUs =
|
|
286
|
+
* const numCPUs = availableParallelism();
|
|
235
287
|
*
|
|
236
288
|
* if (cluster.isPrimary) {
|
|
237
289
|
* console.log(`Primary ${process.pid} is running`);
|
|
@@ -336,20 +388,114 @@ declare module "cluster" {
|
|
|
336
388
|
}
|
|
337
389
|
export interface Cluster extends EventEmitter {
|
|
338
390
|
disconnect(callback?: () => void): void;
|
|
391
|
+
/**
|
|
392
|
+
* Spawn a new worker process.
|
|
393
|
+
*
|
|
394
|
+
* This can only be called from the primary process.
|
|
395
|
+
* @param env Key/value pairs to add to worker process environment.
|
|
396
|
+
* @since v0.6.0
|
|
397
|
+
*/
|
|
339
398
|
fork(env?: any): Worker;
|
|
340
399
|
/** @deprecated since v16.0.0 - use isPrimary. */
|
|
341
400
|
readonly isMaster: boolean;
|
|
401
|
+
/**
|
|
402
|
+
* True if the process is a primary. This is determined by the `process.env.NODE_UNIQUE_ID`. If `process.env.NODE_UNIQUE_ID`
|
|
403
|
+
* is undefined, then `isPrimary` is `true`.
|
|
404
|
+
* @since v16.0.0
|
|
405
|
+
*/
|
|
342
406
|
readonly isPrimary: boolean;
|
|
407
|
+
/**
|
|
408
|
+
* True if the process is not a primary (it is the negation of `cluster.isPrimary`).
|
|
409
|
+
* @since v0.6.0
|
|
410
|
+
*/
|
|
343
411
|
readonly isWorker: boolean;
|
|
412
|
+
/**
|
|
413
|
+
* The scheduling policy, either `cluster.SCHED_RR` for round-robin or `cluster.SCHED_NONE` to leave it to the operating system. This is a global
|
|
414
|
+
* setting and effectively frozen once either the first worker is spawned, or [`.setupPrimary()`](https://nodejs.org/docs/latest-v18.x/api/cluster.html#clustersetupprimarysettings)
|
|
415
|
+
* is called, whichever comes first.
|
|
416
|
+
*
|
|
417
|
+
* `SCHED_RR` is the default on all operating systems except Windows. Windows will change to `SCHED_RR` once libuv is able to effectively distribute
|
|
418
|
+
* IOCP handles without incurring a large performance hit.
|
|
419
|
+
*
|
|
420
|
+
* `cluster.schedulingPolicy` can also be set through the `NODE_CLUSTER_SCHED_POLICY` environment variable. Valid values are `'rr'` and `'none'`.
|
|
421
|
+
* @since v0.11.2
|
|
422
|
+
*/
|
|
344
423
|
schedulingPolicy: number;
|
|
424
|
+
/**
|
|
425
|
+
* After calling [`.setupPrimary()`](https://nodejs.org/docs/latest-v18.x/api/cluster.html#clustersetupprimarysettings)
|
|
426
|
+
* (or [`.fork()`](https://nodejs.org/docs/latest-v18.x/api/cluster.html#clusterforkenv)) this settings object will contain
|
|
427
|
+
* the settings, including the default values.
|
|
428
|
+
*
|
|
429
|
+
* This object is not intended to be changed or set manually.
|
|
430
|
+
* @since v0.7.1
|
|
431
|
+
*/
|
|
345
432
|
readonly settings: ClusterSettings;
|
|
346
|
-
/** @deprecated since v16.0.0 - use setupPrimary. */
|
|
433
|
+
/** @deprecated since v16.0.0 - use [`.setupPrimary()`](https://nodejs.org/docs/latest-v18.x/api/cluster.html#clustersetupprimarysettings) instead. */
|
|
347
434
|
setupMaster(settings?: ClusterSettings): void;
|
|
348
435
|
/**
|
|
349
|
-
* `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in cluster.settings
|
|
436
|
+
* `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in `cluster.settings`.
|
|
437
|
+
*
|
|
438
|
+
* Any settings changes only affect future calls to [`.fork()`](https://nodejs.org/docs/latest-v18.x/api/cluster.html#clusterforkenv)
|
|
439
|
+
* and have no effect on workers that are already running.
|
|
440
|
+
*
|
|
441
|
+
* The only attribute of a worker that cannot be set via `.setupPrimary()` is the `env` passed to
|
|
442
|
+
* [`.fork()`](https://nodejs.org/docs/latest-v18.x/api/cluster.html#clusterforkenv).
|
|
443
|
+
*
|
|
444
|
+
* The defaults above apply to the first call only; the defaults for later calls are the current values at the time of
|
|
445
|
+
* `cluster.setupPrimary()` is called.
|
|
446
|
+
*
|
|
447
|
+
* ```js
|
|
448
|
+
* import cluster from 'node:cluster';
|
|
449
|
+
*
|
|
450
|
+
* cluster.setupPrimary({
|
|
451
|
+
* exec: 'worker.js',
|
|
452
|
+
* args: ['--use', 'https'],
|
|
453
|
+
* silent: true,
|
|
454
|
+
* });
|
|
455
|
+
* cluster.fork(); // https worker
|
|
456
|
+
* cluster.setupPrimary({
|
|
457
|
+
* exec: 'worker.js',
|
|
458
|
+
* args: ['--use', 'http'],
|
|
459
|
+
* });
|
|
460
|
+
* cluster.fork(); // http worker
|
|
461
|
+
* ```
|
|
462
|
+
*
|
|
463
|
+
* This can only be called from the primary process.
|
|
464
|
+
* @since v16.0.0
|
|
350
465
|
*/
|
|
351
466
|
setupPrimary(settings?: ClusterSettings): void;
|
|
467
|
+
/**
|
|
468
|
+
* A reference to the current worker object. Not available in the primary process.
|
|
469
|
+
*
|
|
470
|
+
* ```js
|
|
471
|
+
* import cluster from 'node:cluster';
|
|
472
|
+
*
|
|
473
|
+
* if (cluster.isPrimary) {
|
|
474
|
+
* console.log('I am primary');
|
|
475
|
+
* cluster.fork();
|
|
476
|
+
* cluster.fork();
|
|
477
|
+
* } else if (cluster.isWorker) {
|
|
478
|
+
* console.log(`I am worker #${cluster.worker.id}`);
|
|
479
|
+
* }
|
|
480
|
+
* ```
|
|
481
|
+
* @since v0.7.0
|
|
482
|
+
*/
|
|
352
483
|
readonly worker?: Worker | undefined;
|
|
484
|
+
/**
|
|
485
|
+
* A hash that stores the active worker objects, keyed by `id` field. This makes it easy to loop through all the workers. It is only available in the primary process.
|
|
486
|
+
*
|
|
487
|
+
* A worker is removed from `cluster.workers` after the worker has disconnected _and_ exited. The order between these two events cannot be determined in advance. However, it
|
|
488
|
+
* is guaranteed that the removal from the `cluster.workers` list happens before the last `'disconnect'` or `'exit'` event is emitted.
|
|
489
|
+
*
|
|
490
|
+
* ```js
|
|
491
|
+
* import cluster from 'node:cluster';
|
|
492
|
+
*
|
|
493
|
+
* for (const worker of Object.values(cluster.workers)) {
|
|
494
|
+
* worker.send('big announcement to all workers');
|
|
495
|
+
* }
|
|
496
|
+
* ```
|
|
497
|
+
* @since v0.7.0
|
|
498
|
+
*/
|
|
353
499
|
readonly workers?: NodeJS.Dict<Worker> | undefined;
|
|
354
500
|
readonly SCHED_NONE: number;
|
|
355
501
|
readonly SCHED_RR: number;
|
node v18.19/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "18.19.
|
|
3
|
+
"version": "18.19.27",
|
|
4
4
|
"description": "TypeScript definitions for node",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -217,6 +217,6 @@
|
|
|
217
217
|
"dependencies": {
|
|
218
218
|
"undici-types": "~5.26.4"
|
|
219
219
|
},
|
|
220
|
-
"typesPublisherContentHash": "
|
|
220
|
+
"typesPublisherContentHash": "648298bf71af62613252491fa7be91598b0111a286e6995ec728f57556350ff9",
|
|
221
221
|
"typeScriptVersion": "4.7"
|
|
222
222
|
}
|
node v18.19/wasi.d.ts
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* underlying operating system via a collection of POSIX-like functions.
|
|
4
4
|
*
|
|
5
5
|
* ```js
|
|
6
|
-
* import { readFile } from 'fs/promises';
|
|
6
|
+
* import { readFile } from 'node:fs/promises';
|
|
7
7
|
* import { WASI } from 'wasi';
|
|
8
|
-
* import { argv, env } from 'process';
|
|
8
|
+
* import { argv, env } from 'node:process';
|
|
9
9
|
*
|
|
10
10
|
* const wasi = new WASI({
|
|
11
11
|
* args: argv,
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* wasi.start(instance);
|
|
28
28
|
* ```
|
|
29
29
|
*
|
|
30
|
-
* To run the above example, create a new WebAssembly text format file named`demo.wat`:
|
|
30
|
+
* To run the above example, create a new WebAssembly text format file named `demo.wat`:
|
|
31
31
|
*
|
|
32
32
|
* ```text
|
|
33
33
|
* (module
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
* The `--experimental-wasi-unstable-preview1` CLI argument is needed for this
|
|
69
69
|
* example to run.
|
|
70
70
|
* @experimental
|
|
71
|
-
* @see [source](https://github.com/nodejs/node/blob/v18.
|
|
71
|
+
* @see [source](https://github.com/nodejs/node/blob/v18.19.1/lib/wasi.js)
|
|
72
72
|
*/
|
|
73
73
|
declare module "wasi" {
|
|
74
74
|
interface WASIOptions {
|
|
@@ -76,11 +76,13 @@ declare module "wasi" {
|
|
|
76
76
|
* An array of strings that the WebAssembly application will
|
|
77
77
|
* see as command line arguments. The first argument is the virtual path to the
|
|
78
78
|
* WASI command itself.
|
|
79
|
+
* @default []
|
|
79
80
|
*/
|
|
80
81
|
args?: string[] | undefined;
|
|
81
82
|
/**
|
|
82
83
|
* An object similar to `process.env` that the WebAssembly
|
|
83
84
|
* application will see as its environment.
|
|
85
|
+
* @default {}
|
|
84
86
|
*/
|
|
85
87
|
env?: object | undefined;
|
|
86
88
|
/**
|
|
@@ -117,17 +119,17 @@ declare module "wasi" {
|
|
|
117
119
|
/**
|
|
118
120
|
* The `WASI` class provides the WASI system call API and additional convenience
|
|
119
121
|
* methods for working with WASI-based applications. Each `WASI` instance
|
|
120
|
-
* represents a distinct sandbox environment. For security purposes, each `WASI`instance must have its command-line arguments, environment variables, and
|
|
122
|
+
* represents a distinct sandbox environment. For security purposes, each `WASI` instance must have its command-line arguments, environment variables, and
|
|
121
123
|
* sandbox directory structure configured explicitly.
|
|
122
124
|
* @since v13.3.0, v12.16.0
|
|
123
125
|
*/
|
|
124
126
|
class WASI {
|
|
125
127
|
constructor(options?: WASIOptions);
|
|
126
128
|
/**
|
|
127
|
-
* Attempt to begin execution of `instance` as a WASI command by invoking its`_start()` export. If `instance` does not contain a `_start()` export, or if`instance` contains an `_initialize()`
|
|
129
|
+
* Attempt to begin execution of `instance` as a WASI command by invoking its `_start()` export. If `instance` does not contain a `_start()` export, or if `instance` contains an `_initialize()`
|
|
128
130
|
* export, then an exception is thrown.
|
|
129
131
|
*
|
|
130
|
-
* `start()` requires that `instance` exports a [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) named`memory`. If
|
|
132
|
+
* `start()` requires that `instance` exports a [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) named `memory`. If
|
|
131
133
|
* `instance` does not have a `memory` export an exception is thrown.
|
|
132
134
|
*
|
|
133
135
|
* If `start()` is called more than once, an exception is thrown.
|
|
@@ -135,9 +137,9 @@ declare module "wasi" {
|
|
|
135
137
|
*/
|
|
136
138
|
start(instance: object): number; // TODO: avoid DOM dependency until WASM moved to own lib.
|
|
137
139
|
/**
|
|
138
|
-
* Attempt to initialize `instance` as a WASI reactor by invoking its`_initialize()` export, if it is present. If `instance` contains a `_start()`export, then an exception is thrown.
|
|
140
|
+
* Attempt to initialize `instance` as a WASI reactor by invoking its `_initialize()` export, if it is present. If `instance` contains a `_start()` export, then an exception is thrown.
|
|
139
141
|
*
|
|
140
|
-
* `initialize()` requires that `instance` exports a [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) named`memory`.
|
|
142
|
+
* `initialize()` requires that `instance` exports a [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) named `memory`.
|
|
141
143
|
* If `instance` does not have a `memory` export an exception is thrown.
|
|
142
144
|
*
|
|
143
145
|
* If `initialize()` is called more than once, an exception is thrown.
|