@types/node 16.4.14 → 16.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- node/README.md +1 -1
- node/assert.d.ts +1 -531
- node/async_hooks.d.ts +16 -16
- node/base.d.ts +1 -1
- node/buffer.d.ts +398 -41
- node/child_process.d.ts +1 -1
- node/cluster.d.ts +13 -7
- node/console.d.ts +1 -1
- node/crypto.d.ts +71 -882
- node/dgram.d.ts +17 -8
- node/diagnostics_channel.d.ts +24 -7
- node/dns.d.ts +5 -1
- node/domain.d.ts +2 -2
- node/events.d.ts +183 -4
- node/fs/promises.d.ts +36 -20
- node/fs.d.ts +127 -62
- node/globals.d.ts +24 -13
- node/http.d.ts +67 -13
- node/http2.d.ts +1 -1
- node/https.d.ts +1 -1
- node/index.d.ts +1 -1
- node/inspector.d.ts +4 -5
- node/net.d.ts +2 -2
- node/os.d.ts +1 -1
- node/package.json +3 -3
- node/path.d.ts +1 -1
- node/perf_hooks.d.ts +3 -3
- node/process.d.ts +110 -35
- node/punycode.d.ts +2 -3
- node/querystring.d.ts +2 -2
- node/readline.d.ts +1 -1
- node/repl.d.ts +1 -1
- node/stream/web.d.ts +6 -0
- node/stream.d.ts +2 -2
- node/string_decoder.d.ts +1 -1
- node/timers/promises.d.ts +0 -45
- node/timers.d.ts +1 -1
- node/tls.d.ts +4 -4
- node/trace_events.d.ts +1 -1
- node/ts3.6/base.d.ts +2 -1
- node/tty.d.ts +4 -4
- node/url.d.ts +37 -76
- node/util.d.ts +3 -3
- node/v8.d.ts +1 -1
- node/vm.d.ts +2 -2
- node/wasi.d.ts +4 -24
- node/worker_threads.d.ts +1 -1
- node/zlib.d.ts +1 -1
node/timers/promises.d.ts
CHANGED
|
@@ -9,14 +9,6 @@
|
|
|
9
9
|
* setInterval,
|
|
10
10
|
* } from 'timers/promises';
|
|
11
11
|
* ```
|
|
12
|
-
*
|
|
13
|
-
* ```js
|
|
14
|
-
* const {
|
|
15
|
-
* setTimeout,
|
|
16
|
-
* setImmediate,
|
|
17
|
-
* setInterval,
|
|
18
|
-
* } = require('timers/promises');
|
|
19
|
-
* ```
|
|
20
12
|
* @since v15.0.0
|
|
21
13
|
*/
|
|
22
14
|
declare module 'timers/promises' {
|
|
@@ -31,16 +23,6 @@ declare module 'timers/promises' {
|
|
|
31
23
|
*
|
|
32
24
|
* console.log(res); // Prints 'result'
|
|
33
25
|
* ```
|
|
34
|
-
*
|
|
35
|
-
* ```js
|
|
36
|
-
* const {
|
|
37
|
-
* setTimeout,
|
|
38
|
-
* } = require('timers/promises');
|
|
39
|
-
*
|
|
40
|
-
* setTimeout(100, 'result').then((res) => {
|
|
41
|
-
* console.log(res); // Prints 'result'
|
|
42
|
-
* });
|
|
43
|
-
* ```
|
|
44
26
|
* @since v15.0.0
|
|
45
27
|
* @param [delay=1] The number of milliseconds to wait before fulfilling the promise.
|
|
46
28
|
* @param value A value with which the promise is fulfilled.
|
|
@@ -56,16 +38,6 @@ declare module 'timers/promises' {
|
|
|
56
38
|
*
|
|
57
39
|
* console.log(res); // Prints 'result'
|
|
58
40
|
* ```
|
|
59
|
-
*
|
|
60
|
-
* ```js
|
|
61
|
-
* const {
|
|
62
|
-
* setImmediate,
|
|
63
|
-
* } = require('timers/promises');
|
|
64
|
-
*
|
|
65
|
-
* setImmediate('result').then((res) => {
|
|
66
|
-
* console.log(res); // Prints 'result'
|
|
67
|
-
* });
|
|
68
|
-
* ```
|
|
69
41
|
* @since v15.0.0
|
|
70
42
|
* @param value A value with which the promise is fulfilled.
|
|
71
43
|
*/
|
|
@@ -87,23 +59,6 @@ declare module 'timers/promises' {
|
|
|
87
59
|
* }
|
|
88
60
|
* console.log(Date.now());
|
|
89
61
|
* ```
|
|
90
|
-
*
|
|
91
|
-
* ```js
|
|
92
|
-
* const {
|
|
93
|
-
* setInterval,
|
|
94
|
-
* } = require('timers/promises');
|
|
95
|
-
* const interval = 100;
|
|
96
|
-
*
|
|
97
|
-
* (async function() {
|
|
98
|
-
* for await (const startTime of setInterval(interval, Date.now())) {
|
|
99
|
-
* const now = Date.now();
|
|
100
|
-
* console.log(now);
|
|
101
|
-
* if ((now - startTime) > 1000)
|
|
102
|
-
* break;
|
|
103
|
-
* }
|
|
104
|
-
* console.log(Date.now());
|
|
105
|
-
* })();
|
|
106
|
-
* ```
|
|
107
62
|
* @since v15.9.0
|
|
108
63
|
*/
|
|
109
64
|
function setInterval<T = void>(delay?: number, value?: T, options?: TimerOptions): AsyncIterable<T>;
|
node/timers.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* The timer functions within Node.js implement a similar API as the timers API
|
|
7
7
|
* provided by Web Browsers but use a different internal implementation that is
|
|
8
8
|
* built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout).
|
|
9
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
9
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/timers.js)
|
|
10
10
|
*/
|
|
11
11
|
declare module 'timers' {
|
|
12
12
|
import { Abortable } from 'node:events';
|
node/tls.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* ```js
|
|
7
7
|
* const tls = require('tls');
|
|
8
8
|
* ```
|
|
9
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
9
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/tls.js)
|
|
10
10
|
*/
|
|
11
11
|
declare module 'tls' {
|
|
12
12
|
import { X509Certificate } from 'node:crypto';
|
|
@@ -348,14 +348,14 @@ declare module 'tls' {
|
|
|
348
348
|
*/
|
|
349
349
|
enableTrace(): void;
|
|
350
350
|
/**
|
|
351
|
-
* Returns the peer certificate as an
|
|
351
|
+
* Returns the peer certificate as an `X509Certificate` object.
|
|
352
352
|
*
|
|
353
353
|
* If there is no peer certificate, or the socket has been destroyed,`undefined` will be returned.
|
|
354
354
|
* @since v15.9.0
|
|
355
355
|
*/
|
|
356
356
|
getPeerX509Certificate(): X509Certificate | undefined;
|
|
357
357
|
/**
|
|
358
|
-
* Returns the local certificate as an
|
|
358
|
+
* Returns the local certificate as an `X509Certificate` object.
|
|
359
359
|
*
|
|
360
360
|
* If there is no local certificate, or the socket has been destroyed,`undefined` will be returned.
|
|
361
361
|
* @since v15.9.0
|
|
@@ -452,7 +452,7 @@ declare module 'tls' {
|
|
|
452
452
|
* SecureContext.) If SNICallback wasn't provided the default callback
|
|
453
453
|
* with high-level API will be used (see below).
|
|
454
454
|
*/
|
|
455
|
-
SNICallback?: ((servername: string, cb: (err: Error | null, ctx
|
|
455
|
+
SNICallback?: ((servername: string, cb: (err: Error | null, ctx?: SecureContext) => void) => void) | undefined;
|
|
456
456
|
/**
|
|
457
457
|
* If true the server will reject any connection which is not
|
|
458
458
|
* authorized with the list of supplied CAs. This option only has an
|
node/trace_events.d.ts
CHANGED
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
*
|
|
74
74
|
* The features from this module are not available in `Worker` threads.
|
|
75
75
|
* @experimental
|
|
76
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
76
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/trace_events.js)
|
|
77
77
|
*/
|
|
78
78
|
declare module 'trace_events' {
|
|
79
79
|
/**
|
node/ts3.6/base.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
// - ~/ts3.6/index.d.ts - Definitions specific to TypeScript 3.6 and earlier with assert pulled in
|
|
8
8
|
|
|
9
9
|
// Reference required types from the default lib:
|
|
10
|
-
/// <reference lib="
|
|
10
|
+
/// <reference lib="es2020" />
|
|
11
11
|
/// <reference lib="esnext.asynciterable" />
|
|
12
12
|
/// <reference lib="esnext.intl" />
|
|
13
13
|
/// <reference lib="esnext.bigint" />
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
/// <reference path="../repl.d.ts" />
|
|
48
48
|
/// <reference path="../stream.d.ts" />
|
|
49
49
|
/// <reference path="../stream/promises.d.ts" />
|
|
50
|
+
/// <reference path="../stream/web.d.ts" />
|
|
50
51
|
/// <reference path="../string_decoder.d.ts" />
|
|
51
52
|
/// <reference path="../timers.d.ts" />
|
|
52
53
|
/// <reference path="../timers/promises.d.ts" />
|
node/tty.d.ts
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*
|
|
23
23
|
* In most cases, there should be little to no reason for an application to
|
|
24
24
|
* manually create instances of the `tty.ReadStream` and `tty.WriteStream`classes.
|
|
25
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
25
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/tty.js)
|
|
26
26
|
*/
|
|
27
27
|
declare module 'tty' {
|
|
28
28
|
import * as net from 'node:net';
|
|
@@ -176,9 +176,9 @@ declare module 'tty' {
|
|
|
176
176
|
hasColors(env?: object): boolean;
|
|
177
177
|
hasColors(count: number, env?: object): boolean;
|
|
178
178
|
/**
|
|
179
|
-
* `writeStream.getWindowSize()` returns the size of the
|
|
180
|
-
* the number
|
|
181
|
-
* of columns and rows in the corresponding
|
|
179
|
+
* `writeStream.getWindowSize()` returns the size of the TTY
|
|
180
|
+
* corresponding to this `WriteStream`. The array is of the type`[numColumns, numRows]` where `numColumns` and `numRows` represent the number
|
|
181
|
+
* of columns and rows in the corresponding TTY.
|
|
182
182
|
* @since v0.7.7
|
|
183
183
|
*/
|
|
184
184
|
getWindowSize(): [number, number];
|
node/url.d.ts
CHANGED
|
@@ -5,13 +5,10 @@
|
|
|
5
5
|
* ```js
|
|
6
6
|
* import url from 'url';
|
|
7
7
|
* ```
|
|
8
|
-
*
|
|
9
|
-
* ```js
|
|
10
|
-
* const url = require('url');
|
|
11
|
-
* ```
|
|
12
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/url.js)
|
|
8
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/url.js)
|
|
13
9
|
*/
|
|
14
10
|
declare module 'url' {
|
|
11
|
+
import { Blob } from 'node:buffer';
|
|
15
12
|
import { ClientRequestArgs } from 'node:http';
|
|
16
13
|
import { ParsedUrlQuery, ParsedUrlQueryInput } from 'node:querystring';
|
|
17
14
|
// Input to `url.format`
|
|
@@ -191,17 +188,6 @@ declare module 'url' {
|
|
|
191
188
|
* console.log(url.domainToASCII('xn--iñvalid.com'));
|
|
192
189
|
* // Prints an empty string
|
|
193
190
|
* ```
|
|
194
|
-
*
|
|
195
|
-
* ```js
|
|
196
|
-
* const url = require('url');
|
|
197
|
-
*
|
|
198
|
-
* console.log(url.domainToASCII('español.com'));
|
|
199
|
-
* // Prints xn--espaol-zwa.com
|
|
200
|
-
* console.log(url.domainToASCII('中文.com'));
|
|
201
|
-
* // Prints xn--fiq228c.com
|
|
202
|
-
* console.log(url.domainToASCII('xn--iñvalid.com'));
|
|
203
|
-
* // Prints an empty string
|
|
204
|
-
* ```
|
|
205
191
|
* @since v7.4.0, v6.13.0
|
|
206
192
|
*/
|
|
207
193
|
function domainToASCII(domain: string): string;
|
|
@@ -223,17 +209,6 @@ declare module 'url' {
|
|
|
223
209
|
* console.log(url.domainToUnicode('xn--iñvalid.com'));
|
|
224
210
|
* // Prints an empty string
|
|
225
211
|
* ```
|
|
226
|
-
*
|
|
227
|
-
* ```js
|
|
228
|
-
* const url = require('url');
|
|
229
|
-
*
|
|
230
|
-
* console.log(url.domainToUnicode('xn--espaol-zwa.com'));
|
|
231
|
-
* // Prints español.com
|
|
232
|
-
* console.log(url.domainToUnicode('xn--fiq228c.com'));
|
|
233
|
-
* // Prints 中文.com
|
|
234
|
-
* console.log(url.domainToUnicode('xn--iñvalid.com'));
|
|
235
|
-
* // Prints an empty string
|
|
236
|
-
* ```
|
|
237
212
|
* @since v7.4.0, v6.13.0
|
|
238
213
|
*/
|
|
239
214
|
function domainToUnicode(domain: string): string;
|
|
@@ -258,21 +233,6 @@ declare module 'url' {
|
|
|
258
233
|
* new URL('file:///hello world').pathname; // Incorrect: /hello%20world
|
|
259
234
|
* fileURLToPath('file:///hello world'); // Correct: /hello world (POSIX)
|
|
260
235
|
* ```
|
|
261
|
-
*
|
|
262
|
-
* ```js
|
|
263
|
-
* const { fileURLToPath } = require('url');
|
|
264
|
-
* new URL('file:///C:/path/').pathname; // Incorrect: /C:/path/
|
|
265
|
-
* fileURLToPath('file:///C:/path/'); // Correct: C:\path\ (Windows)
|
|
266
|
-
*
|
|
267
|
-
* new URL('file://nas/foo.txt').pathname; // Incorrect: /foo.txt
|
|
268
|
-
* fileURLToPath('file://nas/foo.txt'); // Correct: \\nas\foo.txt (Windows)
|
|
269
|
-
*
|
|
270
|
-
* new URL('file:///你好.txt').pathname; // Incorrect: /%E4%BD%A0%E5%A5%BD.txt
|
|
271
|
-
* fileURLToPath('file:///你好.txt'); // Correct: /你好.txt (POSIX)
|
|
272
|
-
*
|
|
273
|
-
* new URL('file:///hello world').pathname; // Incorrect: /hello%20world
|
|
274
|
-
* fileURLToPath('file:///hello world'); // Correct: /hello world (POSIX)
|
|
275
|
-
* ```
|
|
276
236
|
* @since v10.12.0
|
|
277
237
|
* @param url The file URL string or URL object to convert to a path.
|
|
278
238
|
* @return The fully-resolved platform-specific Node.js file path.
|
|
@@ -291,20 +251,6 @@ declare module 'url' {
|
|
|
291
251
|
* new URL('/some/path%.c', 'file:'); // Incorrect: file:///some/path%.c
|
|
292
252
|
* pathToFileURL('/some/path%.c'); // Correct: file:///some/path%25.c (POSIX)
|
|
293
253
|
* ```
|
|
294
|
-
*
|
|
295
|
-
* ```js
|
|
296
|
-
* const { pathToFileURL } = require('url');
|
|
297
|
-
* new URL(__filename); // Incorrect: throws (POSIX)
|
|
298
|
-
* new URL(__filename); // Incorrect: C:\... (Windows)
|
|
299
|
-
* pathToFileURL(__filename); // Correct: file:///... (POSIX)
|
|
300
|
-
* pathToFileURL(__filename); // Correct: file:///C:/... (Windows)
|
|
301
|
-
*
|
|
302
|
-
* new URL('/foo#1', 'file:'); // Incorrect: file:///foo#1
|
|
303
|
-
* pathToFileURL('/foo#1'); // Correct: file:///foo%231 (POSIX)
|
|
304
|
-
*
|
|
305
|
-
* new URL('/some/path%.c', 'file:'); // Incorrect: file:///some/path%.c
|
|
306
|
-
* pathToFileURL('/some/path%.c'); // Correct: file:///some/path%25.c (POSIX)
|
|
307
|
-
* ```
|
|
308
254
|
* @since v10.12.0
|
|
309
255
|
* @param path The path to convert to a File URL.
|
|
310
256
|
* @return The file URL object.
|
|
@@ -318,26 +264,7 @@ declare module 'url' {
|
|
|
318
264
|
* import { urlToHttpOptions } from 'url';
|
|
319
265
|
* const myURL = new URL('https://a:b@測試?abc#foo');
|
|
320
266
|
*
|
|
321
|
-
* console.log(urlToHttpOptions(
|
|
322
|
-
*
|
|
323
|
-
* {
|
|
324
|
-
* protocol: 'https:',
|
|
325
|
-
* hostname: 'xn--g6w251d',
|
|
326
|
-
* hash: '#foo',
|
|
327
|
-
* search: '?abc',
|
|
328
|
-
* pathname: '/',
|
|
329
|
-
* path: '/?abc',
|
|
330
|
-
* href: 'https://a:b@xn--g6w251d/?abc#foo',
|
|
331
|
-
* auth: 'a:b'
|
|
332
|
-
* }
|
|
333
|
-
*
|
|
334
|
-
* ```
|
|
335
|
-
*
|
|
336
|
-
* ```js
|
|
337
|
-
* const { urlToHttpOptions } = require('url');
|
|
338
|
-
* const myURL = new URL('https://a:b@測試?abc#foo');
|
|
339
|
-
*
|
|
340
|
-
* console.log(urlToHttpOptions(myUrl));
|
|
267
|
+
* console.log(urlToHttpOptions(myURL));
|
|
341
268
|
*
|
|
342
269
|
* {
|
|
343
270
|
* protocol: 'https:',
|
|
@@ -375,6 +302,40 @@ declare module 'url' {
|
|
|
375
302
|
* @since v7.0.0, v6.13.0
|
|
376
303
|
*/
|
|
377
304
|
class URL {
|
|
305
|
+
/**
|
|
306
|
+
* Creates a `'blob:nodedata:...'` URL string that represents the given `Blob` object and can be used to retrieve the `Blob` later.
|
|
307
|
+
*
|
|
308
|
+
* ```js
|
|
309
|
+
* const {
|
|
310
|
+
* Blob,
|
|
311
|
+
* resolveObjectURL,
|
|
312
|
+
* } = require('buffer');
|
|
313
|
+
*
|
|
314
|
+
* const blob = new Blob(['hello']);
|
|
315
|
+
* const id = URL.createObjectURL(blob);
|
|
316
|
+
*
|
|
317
|
+
* // later...
|
|
318
|
+
*
|
|
319
|
+
* const otherBlob = resolveObjectURL(id);
|
|
320
|
+
* console.log(otherBlob.size);
|
|
321
|
+
* ```
|
|
322
|
+
*
|
|
323
|
+
* The data stored by the registered `Blob` will be retained in memory until`URL.revokeObjectURL()` is called to remove it.
|
|
324
|
+
*
|
|
325
|
+
* `Blob` objects are registered within the current thread. If using Worker
|
|
326
|
+
* Threads, `Blob` objects registered within one Worker will not be available
|
|
327
|
+
* to other workers or the main thread.
|
|
328
|
+
* @since v16.7.0
|
|
329
|
+
* @experimental
|
|
330
|
+
*/
|
|
331
|
+
static createObjectURL(blob: Blob): string;
|
|
332
|
+
/**
|
|
333
|
+
* Removes the stored `Blob` identified by the given ID.
|
|
334
|
+
* @since v16.7.0
|
|
335
|
+
* @experimental
|
|
336
|
+
* @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
|
|
337
|
+
*/
|
|
338
|
+
static revokeObjectURL(objectUrl: string): void;
|
|
378
339
|
constructor(input: string, base?: string | URL);
|
|
379
340
|
/**
|
|
380
341
|
* Gets and sets the fragment portion of the URL.
|
node/util.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* ```js
|
|
7
7
|
* const util = require('util');
|
|
8
8
|
* ```
|
|
9
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
9
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/util.js)
|
|
10
10
|
*/
|
|
11
11
|
declare module 'util' {
|
|
12
12
|
import * as types from 'node:util/types';
|
|
@@ -1538,12 +1538,12 @@ declare module 'util/types' {
|
|
|
1538
1538
|
*/
|
|
1539
1539
|
function isWeakSet(object: unknown): object is WeakSet<object>;
|
|
1540
1540
|
/**
|
|
1541
|
-
* Returns `true` if `value` is a
|
|
1541
|
+
* Returns `true` if `value` is a `KeyObject`, `false` otherwise.
|
|
1542
1542
|
* @since v16.2.0
|
|
1543
1543
|
*/
|
|
1544
1544
|
function isKeyObject(object: unknown): object is KeyObject;
|
|
1545
1545
|
/**
|
|
1546
|
-
* Returns `true` if `value` is a
|
|
1546
|
+
* Returns `true` if `value` is a `CryptoKey`, `false` otherwise.
|
|
1547
1547
|
* @since v16.2.0
|
|
1548
1548
|
*/
|
|
1549
1549
|
function isCryptoKey(object: unknown): object is webcrypto.CryptoKey;
|
node/v8.d.ts
CHANGED
node/vm.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The `vm` module enables compiling and running code within V8 Virtual
|
|
3
3
|
* Machine contexts. **The `vm` module is not a security mechanism. Do**
|
|
4
|
-
* **not use it to run untrusted code
|
|
4
|
+
* **not use it to run untrusted code.**
|
|
5
5
|
*
|
|
6
6
|
* JavaScript code can be compiled and run immediately or
|
|
7
7
|
* compiled, saved, and run later.
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
*
|
|
33
33
|
* console.log(x); // 1; y is not defined.
|
|
34
34
|
* ```
|
|
35
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
35
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/vm.js)
|
|
36
36
|
*/
|
|
37
37
|
declare module 'vm' {
|
|
38
38
|
interface Context extends NodeJS.Dict<any> {}
|
node/wasi.d.ts
CHANGED
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
* ```js
|
|
6
6
|
* import fs from 'fs';
|
|
7
7
|
* import { WASI } from 'wasi';
|
|
8
|
+
* import { argv, env } from 'process';
|
|
8
9
|
*
|
|
9
10
|
* const wasi = new WASI({
|
|
10
|
-
* args:
|
|
11
|
-
* env
|
|
11
|
+
* args: argv,
|
|
12
|
+
* env,
|
|
12
13
|
* preopens: {
|
|
13
14
|
* '/sandbox': '/some/real/path/that/wasm/can/access'
|
|
14
15
|
* }
|
|
@@ -21,27 +22,6 @@
|
|
|
21
22
|
* wasi.start(instance);
|
|
22
23
|
* ```
|
|
23
24
|
*
|
|
24
|
-
* ```js
|
|
25
|
-
* 'use strict';
|
|
26
|
-
* const fs = require('fs');
|
|
27
|
-
* const { WASI } = require('wasi');
|
|
28
|
-
* const wasi = new WASI({
|
|
29
|
-
* args: process.argv,
|
|
30
|
-
* env: process.env,
|
|
31
|
-
* preopens: {
|
|
32
|
-
* '/sandbox': '/some/real/path/that/wasm/can/access'
|
|
33
|
-
* }
|
|
34
|
-
* });
|
|
35
|
-
* const importObject = { wasi_snapshot_preview1: wasi.wasiImport };
|
|
36
|
-
*
|
|
37
|
-
* (async () => {
|
|
38
|
-
* const wasm = await WebAssembly.compile(fs.readFileSync('./demo.wasm'));
|
|
39
|
-
* const instance = await WebAssembly.instantiate(wasm, importObject);
|
|
40
|
-
*
|
|
41
|
-
* wasi.start(instance);
|
|
42
|
-
* })();
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
25
|
* To run the above example, create a new WebAssembly text format file named`demo.wat`:
|
|
46
26
|
*
|
|
47
27
|
* ```text
|
|
@@ -83,7 +63,7 @@
|
|
|
83
63
|
* The `--experimental-wasi-unstable-preview1` CLI argument is needed for this
|
|
84
64
|
* example to run.
|
|
85
65
|
* @experimental
|
|
86
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
66
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/wasi.js)
|
|
87
67
|
*/
|
|
88
68
|
declare module 'wasi' {
|
|
89
69
|
interface WASIOptions {
|
node/worker_threads.d.ts
CHANGED
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
*
|
|
50
50
|
* Worker threads inherit non-process-specific options by default. Refer to `Worker constructor options` to know how to customize worker thread options,
|
|
51
51
|
* specifically `argv` and `execArgv` options.
|
|
52
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
52
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/worker_threads.js)
|
|
53
53
|
*/
|
|
54
54
|
declare module 'worker_threads' {
|
|
55
55
|
import { Blob } from 'node:buffer';
|
node/zlib.d.ts
CHANGED
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
* });
|
|
89
89
|
* ```
|
|
90
90
|
* @since v0.5.8
|
|
91
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
91
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/zlib.js)
|
|
92
92
|
*/
|
|
93
93
|
declare module 'zlib' {
|
|
94
94
|
import * as stream from 'node:stream';
|