@types/node 16.9.3 → 16.10.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 -1
- node/async_hooks.d.ts +1 -1
- node/buffer.d.ts +3 -3
- node/child_process.d.ts +30 -20
- node/cluster.d.ts +1 -1
- node/console.d.ts +1 -1
- node/crypto.d.ts +83 -19
- node/dgram.d.ts +2 -2
- node/diagnostics_channel.d.ts +1 -1
- node/dns/promises.d.ts +1 -1
- node/dns.d.ts +2 -2
- node/domain.d.ts +1 -1
- node/events.d.ts +2 -2
- node/fs/promises.d.ts +19 -12
- node/fs.d.ts +52 -27
- node/http.d.ts +14 -4
- node/http2.d.ts +2 -2
- node/https.d.ts +1 -1
- node/index.d.ts +1 -1
- node/inspector.d.ts +2 -2
- node/net.d.ts +1 -1
- node/os.d.ts +5 -5
- node/package.json +2 -2
- node/path.d.ts +1 -1
- node/perf_hooks.d.ts +2 -2
- node/process.d.ts +3 -3
- node/punycode.d.ts +3 -3
- node/querystring.d.ts +9 -9
- node/readline.d.ts +1 -1
- node/repl.d.ts +1 -1
- node/stream.d.ts +38 -7
- node/string_decoder.d.ts +1 -1
- node/timers.d.ts +1 -1
- node/tls.d.ts +6 -6
- node/trace_events.d.ts +2 -2
- node/tty.d.ts +2 -4
- node/url.d.ts +1 -1
- node/util.d.ts +11 -12
- node/v8.d.ts +2 -2
- node/vm.d.ts +3 -4
- node/wasi.d.ts +9 -4
- node/worker_threads.d.ts +4 -4
- node/zlib.d.ts +1 -1
node/stream.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*
|
|
15
15
|
* The `stream` module is useful for creating new types of stream instances. It is
|
|
16
16
|
* usually not necessary to use the `stream` module to consume streams.
|
|
17
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
17
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/stream.js)
|
|
18
18
|
*/
|
|
19
19
|
declare module 'stream' {
|
|
20
20
|
import { EventEmitter, Abortable } from 'node:events';
|
|
@@ -60,6 +60,7 @@ declare module 'stream' {
|
|
|
60
60
|
/**
|
|
61
61
|
* Returns whether the stream was destroyed or errored before emitting `'end'`.
|
|
62
62
|
* @since v16.8.0
|
|
63
|
+
* @experimental
|
|
63
64
|
*/
|
|
64
65
|
readonly readableAborted: boolean;
|
|
65
66
|
/**
|
|
@@ -71,6 +72,7 @@ declare module 'stream' {
|
|
|
71
72
|
/**
|
|
72
73
|
* Returns whether `'data'` has been emitted.
|
|
73
74
|
* @since v16.7.0
|
|
75
|
+
* @experimental
|
|
74
76
|
*/
|
|
75
77
|
readonly readableDidRead: boolean;
|
|
76
78
|
/**
|
|
@@ -805,6 +807,15 @@ declare module 'stream' {
|
|
|
805
807
|
readonly writableLength: number;
|
|
806
808
|
readonly writableObjectMode: boolean;
|
|
807
809
|
readonly writableCorked: number;
|
|
810
|
+
/**
|
|
811
|
+
* If `false` then the stream will automatically end the writable side when the
|
|
812
|
+
* readable side ends. Set initially by the `allowHalfOpen` constructor option,
|
|
813
|
+
* which defaults to `false`.
|
|
814
|
+
*
|
|
815
|
+
* This can be changed manually to change the half-open behavior of an existing`Duplex` stream instance, but must be changed before the `'end'` event is
|
|
816
|
+
* emitted.
|
|
817
|
+
* @since v0.9.4
|
|
818
|
+
*/
|
|
808
819
|
allowHalfOpen: boolean;
|
|
809
820
|
constructor(opts?: DuplexOptions);
|
|
810
821
|
/**
|
|
@@ -1072,16 +1083,14 @@ declare module 'stream' {
|
|
|
1072
1083
|
*
|
|
1073
1084
|
* async function run() {
|
|
1074
1085
|
* const ac = new AbortController();
|
|
1075
|
-
* const
|
|
1076
|
-
* signal: ac.signal,
|
|
1077
|
-
* };
|
|
1086
|
+
* const signal = ac.signal;
|
|
1078
1087
|
*
|
|
1079
1088
|
* setTimeout(() => ac.abort(), 1);
|
|
1080
1089
|
* await pipeline(
|
|
1081
1090
|
* fs.createReadStream('archive.tar'),
|
|
1082
1091
|
* zlib.createGzip(),
|
|
1083
1092
|
* fs.createWriteStream('archive.tar.gz'),
|
|
1084
|
-
*
|
|
1093
|
+
* { signal },
|
|
1085
1094
|
* );
|
|
1086
1095
|
* }
|
|
1087
1096
|
*
|
|
@@ -1097,10 +1106,10 @@ declare module 'stream' {
|
|
|
1097
1106
|
* async function run() {
|
|
1098
1107
|
* await pipeline(
|
|
1099
1108
|
* fs.createReadStream('lowercase.txt'),
|
|
1100
|
-
* async function* (source) {
|
|
1109
|
+
* async function* (source, signal) {
|
|
1101
1110
|
* source.setEncoding('utf8'); // Work with strings rather than `Buffer`s.
|
|
1102
1111
|
* for await (const chunk of source) {
|
|
1103
|
-
* yield chunk
|
|
1112
|
+
* yield await processChunk(chunk, { signal });
|
|
1104
1113
|
* }
|
|
1105
1114
|
* },
|
|
1106
1115
|
* fs.createWriteStream('uppercase.txt')
|
|
@@ -1111,6 +1120,28 @@ declare module 'stream' {
|
|
|
1111
1120
|
* run().catch(console.error);
|
|
1112
1121
|
* ```
|
|
1113
1122
|
*
|
|
1123
|
+
* Remember to handle the `signal` argument passed into the async generator.
|
|
1124
|
+
* Especially in the case where the async generator is the source for the
|
|
1125
|
+
* pipeline (i.e. first argument) or the pipeline will never complete.
|
|
1126
|
+
*
|
|
1127
|
+
* ```js
|
|
1128
|
+
* const { pipeline } = require('stream/promises');
|
|
1129
|
+
* const fs = require('fs');
|
|
1130
|
+
*
|
|
1131
|
+
* async function run() {
|
|
1132
|
+
* await pipeline(
|
|
1133
|
+
* async function * (signal) {
|
|
1134
|
+
* await someLongRunningfn({ signal });
|
|
1135
|
+
* yield 'asd';
|
|
1136
|
+
* },
|
|
1137
|
+
* fs.createWriteStream('uppercase.txt')
|
|
1138
|
+
* );
|
|
1139
|
+
* console.log('Pipeline succeeded.');
|
|
1140
|
+
* }
|
|
1141
|
+
*
|
|
1142
|
+
* run().catch(console.error);
|
|
1143
|
+
* ```
|
|
1144
|
+
*
|
|
1114
1145
|
* `stream.pipeline()` will call `stream.destroy(err)` on all streams except:
|
|
1115
1146
|
*
|
|
1116
1147
|
* * `Readable` streams which have emitted `'end'` or `'close'`.
|
node/string_decoder.d.ts
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
* decoder.write(Buffer.from([0x82]));
|
|
37
37
|
* console.log(decoder.end(Buffer.from([0xAC])));
|
|
38
38
|
* ```
|
|
39
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
39
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/string_decoder.js)
|
|
40
40
|
*/
|
|
41
41
|
declare module 'string_decoder' {
|
|
42
42
|
class StringDecoder {
|
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.9.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.9.0/lib/tls.js)
|
|
10
10
|
*/
|
|
11
11
|
declare module 'tls' {
|
|
12
12
|
import { X509Certificate } from 'node:crypto';
|
|
@@ -189,7 +189,7 @@ declare module 'tls' {
|
|
|
189
189
|
* }
|
|
190
190
|
* ```
|
|
191
191
|
*
|
|
192
|
-
* See[SSL\_CIPHER\_get\_name](https://www.openssl.org/docs/man1.1.1/man3/SSL_CIPHER_get_name.html)for more information.
|
|
192
|
+
* See [SSL\_CIPHER\_get\_name](https://www.openssl.org/docs/man1.1.1/man3/SSL_CIPHER_get_name.html) for more information.
|
|
193
193
|
* @since v0.11.4
|
|
194
194
|
*/
|
|
195
195
|
getCipher(): CipherNameAndProtocol;
|
|
@@ -274,7 +274,7 @@ declare module 'tls' {
|
|
|
274
274
|
*/
|
|
275
275
|
getSession(): Buffer | undefined;
|
|
276
276
|
/**
|
|
277
|
-
* See[SSL\_get\_shared\_sigalgs](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_shared_sigalgs.html)for more information.
|
|
277
|
+
* See [SSL\_get\_shared\_sigalgs](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_shared_sigalgs.html) for more information.
|
|
278
278
|
* @since v12.11.0
|
|
279
279
|
* @return List of signature algorithms shared between the server and the client in the order of decreasing preference.
|
|
280
280
|
*/
|
|
@@ -810,8 +810,8 @@ declare module 'tls' {
|
|
|
810
810
|
/**
|
|
811
811
|
* Verifies the certificate `cert` is issued to `hostname`.
|
|
812
812
|
*
|
|
813
|
-
* Returns [
|
|
814
|
-
* failure. On success, returns [
|
|
813
|
+
* Returns [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object, populating it with `reason`, `host`, and `cert` on
|
|
814
|
+
* failure. On success, returns [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type).
|
|
815
815
|
*
|
|
816
816
|
* This function can be overwritten by providing alternative function as part of
|
|
817
817
|
* the `options.checkServerIdentity` option passed to `tls.connect()`. The
|
|
@@ -962,7 +962,7 @@ declare module 'tls' {
|
|
|
962
962
|
*
|
|
963
963
|
* A key is _required_ for ciphers that use certificates. Either `key` or`pfx` can be used to provide it.
|
|
964
964
|
*
|
|
965
|
-
* If the `ca` option is not given, then Node.js will default to using[Mozilla's publicly trusted list of
|
|
965
|
+
* If the `ca` option is not given, then Node.js will default to using [Mozilla's publicly trusted list of
|
|
966
966
|
* CAs](https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt).
|
|
967
967
|
* @since v0.11.13
|
|
968
968
|
*/
|
node/trace_events.d.ts
CHANGED
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
* ```
|
|
57
57
|
*
|
|
58
58
|
* Running Node.js with tracing enabled will produce log files that can be opened
|
|
59
|
-
* in the [`chrome://tracing`](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool)tab of Chrome.
|
|
59
|
+
* in the [`chrome://tracing`](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) tab of Chrome.
|
|
60
60
|
*
|
|
61
61
|
* The logging file is by default called `node_trace.${rotation}.log`, where`${rotation}` is an incrementing log-rotation id. The filepath pattern can
|
|
62
62
|
* be specified with `--trace-event-file-pattern` that accepts a template
|
|
@@ -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.9.0/lib/trace_events.js)
|
|
77
77
|
*/
|
|
78
78
|
declare module 'trace_events' {
|
|
79
79
|
/**
|
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.9.0/lib/tty.js)
|
|
26
26
|
*/
|
|
27
27
|
declare module 'tty' {
|
|
28
28
|
import * as net from 'node:net';
|
|
@@ -129,9 +129,7 @@ declare module 'tty' {
|
|
|
129
129
|
* * `1` for 2,
|
|
130
130
|
* * `4` for 16,
|
|
131
131
|
* * `8` for 256,
|
|
132
|
-
* * `24` for 16,777,216
|
|
133
|
-
*
|
|
134
|
-
* colors supported.
|
|
132
|
+
* * `24` for 16,777,216 colors supported.
|
|
135
133
|
*
|
|
136
134
|
* Use this to determine what colors the terminal supports. Due to the nature of
|
|
137
135
|
* colors in terminals it is possible to either have false positives or false
|
node/url.d.ts
CHANGED
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.9.0/lib/util.js)
|
|
10
10
|
*/
|
|
11
11
|
declare module 'util' {
|
|
12
12
|
import * as types from 'node:util/types';
|
|
@@ -145,7 +145,6 @@ declare module 'util' {
|
|
|
145
145
|
* Returns the `string` after replacing any surrogate code points
|
|
146
146
|
* (or equivalently, any unpaired surrogate code units) with the
|
|
147
147
|
* Unicode "replacement character" U+FFFD.
|
|
148
|
-
*
|
|
149
148
|
* @since v16.8.0
|
|
150
149
|
*/
|
|
151
150
|
export function toUSVString(string: string): string;
|
|
@@ -253,7 +252,7 @@ declare module 'util' {
|
|
|
253
252
|
* The `showHidden` option allows [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) and
|
|
254
253
|
* [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) entries to be
|
|
255
254
|
* inspected. If there are more entries than `maxArrayLength`, there is no
|
|
256
|
-
* guarantee which entries are displayed. That means retrieving the same[`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) entries twice may
|
|
255
|
+
* guarantee which entries are displayed. That means retrieving the same [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) entries twice may
|
|
257
256
|
* result in different output. Furthermore, entries
|
|
258
257
|
* with no remaining strong references may be garbage collected at any time.
|
|
259
258
|
*
|
|
@@ -965,7 +964,7 @@ declare module 'util' {
|
|
|
965
964
|
const custom: unique symbol;
|
|
966
965
|
}
|
|
967
966
|
/**
|
|
968
|
-
* An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/)`TextDecoder` API.
|
|
967
|
+
* An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextDecoder` API.
|
|
969
968
|
*
|
|
970
969
|
* ```js
|
|
971
970
|
* const decoder = new TextDecoder('shift_jis');
|
|
@@ -1027,7 +1026,7 @@ declare module 'util' {
|
|
|
1027
1026
|
}
|
|
1028
1027
|
export { types };
|
|
1029
1028
|
/**
|
|
1030
|
-
* An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/)`TextEncoder` API. All
|
|
1029
|
+
* An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextEncoder` API. All
|
|
1031
1030
|
* instances of `TextEncoder` only support UTF-8 encoding.
|
|
1032
1031
|
*
|
|
1033
1032
|
* ```js
|
|
@@ -1071,8 +1070,8 @@ declare module 'util/types' {
|
|
|
1071
1070
|
declare module 'util/types' {
|
|
1072
1071
|
import { KeyObject, webcrypto } from 'node:crypto';
|
|
1073
1072
|
/**
|
|
1074
|
-
* Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)
|
|
1075
|
-
*
|
|
1073
|
+
* Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) or
|
|
1074
|
+
* [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instance.
|
|
1076
1075
|
*
|
|
1077
1076
|
* See also `util.types.isArrayBuffer()` and `util.types.isSharedArrayBuffer()`.
|
|
1078
1077
|
*
|
|
@@ -1107,9 +1106,9 @@ declare module 'util/types' {
|
|
|
1107
1106
|
*/
|
|
1108
1107
|
function isArrayBuffer(object: unknown): object is ArrayBuffer;
|
|
1109
1108
|
/**
|
|
1110
|
-
* Returns `true` if the value is an instance of one of the [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)views, such as typed
|
|
1111
|
-
* objects or [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView). Equivalent
|
|
1112
|
-
*
|
|
1109
|
+
* Returns `true` if the value is an instance of one of the [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) views, such as typed
|
|
1110
|
+
* array objects or [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView). Equivalent to
|
|
1111
|
+
* [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView).
|
|
1113
1112
|
*
|
|
1114
1113
|
* ```js
|
|
1115
1114
|
* util.types.isArrayBufferView(new Int8Array()); // true
|
|
@@ -1337,7 +1336,7 @@ declare module 'util/types' {
|
|
|
1337
1336
|
*/
|
|
1338
1337
|
function isMap<T>(object: T | {}): object is T extends ReadonlyMap<any, any> ? (unknown extends T ? never : ReadonlyMap<any, any>) : Map<unknown, unknown>;
|
|
1339
1338
|
/**
|
|
1340
|
-
* Returns `true` if the value is an iterator returned for a built-in[`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) instance.
|
|
1339
|
+
* Returns `true` if the value is an iterator returned for a built-in [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) instance.
|
|
1341
1340
|
*
|
|
1342
1341
|
* ```js
|
|
1343
1342
|
* const map = new Map();
|
|
@@ -1423,7 +1422,7 @@ declare module 'util/types' {
|
|
|
1423
1422
|
*/
|
|
1424
1423
|
function isSet<T>(object: T | {}): object is T extends ReadonlySet<any> ? (unknown extends T ? never : ReadonlySet<any>) : Set<unknown>;
|
|
1425
1424
|
/**
|
|
1426
|
-
* Returns `true` if the value is an iterator returned for a built-in[`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) instance.
|
|
1425
|
+
* Returns `true` if the value is an iterator returned for a built-in [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) instance.
|
|
1427
1426
|
*
|
|
1428
1427
|
* ```js
|
|
1429
1428
|
* const set = new Set();
|
node/v8.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `v8` module exposes APIs that are specific to the version of [V8](https://developers.google.com/v8/)built into the Node.js binary. It can be accessed using:
|
|
2
|
+
* The `v8` module exposes APIs that are specific to the version of [V8](https://developers.google.com/v8/) built into the Node.js binary. It can be accessed using:
|
|
3
3
|
*
|
|
4
4
|
* ```js
|
|
5
5
|
* const v8 = require('v8');
|
|
6
6
|
* ```
|
|
7
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
7
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/v8.js)
|
|
8
8
|
*/
|
|
9
9
|
declare module 'v8' {
|
|
10
10
|
import { Readable } from 'node:stream';
|
node/vm.d.ts
CHANGED
|
@@ -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.9.0/lib/vm.js)
|
|
36
36
|
*/
|
|
37
37
|
declare module 'vm' {
|
|
38
38
|
interface Context extends NodeJS.Dict<any> {}
|
|
@@ -267,7 +267,6 @@ declare module 'vm' {
|
|
|
267
267
|
* @since v10.6.0
|
|
268
268
|
*/
|
|
269
269
|
createCachedData(): Buffer;
|
|
270
|
-
|
|
271
270
|
/** @deprecated in favor of `script.createCachedData()` */
|
|
272
271
|
cachedDataProduced?: boolean | undefined;
|
|
273
272
|
cachedDataRejected?: boolean | undefined;
|
|
@@ -277,7 +276,7 @@ declare module 'vm' {
|
|
|
277
276
|
* If given a `contextObject`, the `vm.createContext()` method will `prepare
|
|
278
277
|
* that object` so that it can be used in calls to {@link runInContext} or `script.runInContext()`. Inside such scripts,
|
|
279
278
|
* the `contextObject` will be the global object, retaining all of its existing
|
|
280
|
-
* properties but also having the built-in objects and functions any standard[global object](https://es5.github.io/#x15.1) has. Outside of scripts run by the vm module, global variables
|
|
279
|
+
* properties but also having the built-in objects and functions any standard [global object](https://es5.github.io/#x15.1) has. Outside of scripts run by the vm module, global variables
|
|
281
280
|
* will remain unchanged.
|
|
282
281
|
*
|
|
283
282
|
* ```js
|
|
@@ -398,7 +397,7 @@ declare module 'vm' {
|
|
|
398
397
|
* ```
|
|
399
398
|
*
|
|
400
399
|
* Because `vm.runInThisContext()` does not have access to the local scope,`localVar` is unchanged. In contrast,
|
|
401
|
-
* [`eval()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval)_does_ have access to the
|
|
400
|
+
* [`eval()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval) _does_ have access to the
|
|
402
401
|
* local scope, so the value `localVar` is changed. In this way`vm.runInThisContext()` is much like an [indirect `eval()` call](https://es5.github.io/#x10.4.2), e.g.`(0,eval)('code')`.
|
|
403
402
|
*
|
|
404
403
|
* ## Example: Running an HTTP server within a VM
|
node/wasi.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The WASI API provides an implementation of the [WebAssembly System Interface](https://wasi.dev/)specification. WASI gives sandboxed WebAssembly applications access to the
|
|
2
|
+
* The WASI API provides an implementation of the [WebAssembly System Interface](https://wasi.dev/) specification. WASI gives sandboxed WebAssembly applications access to the
|
|
3
3
|
* underlying operating system via a collection of POSIX-like functions.
|
|
4
4
|
*
|
|
5
5
|
* ```js
|
|
6
|
-
* import
|
|
6
|
+
* import { readFile } from 'fs/promises';
|
|
7
7
|
* import { WASI } from 'wasi';
|
|
8
8
|
* import { argv, env } from 'process';
|
|
9
9
|
*
|
|
@@ -14,9 +14,14 @@
|
|
|
14
14
|
* '/sandbox': '/some/real/path/that/wasm/can/access'
|
|
15
15
|
* }
|
|
16
16
|
* });
|
|
17
|
+
*
|
|
18
|
+
* // Some WASI binaries require:
|
|
19
|
+
* // const importObject = { wasi_unstable: wasi.wasiImport };
|
|
17
20
|
* const importObject = { wasi_snapshot_preview1: wasi.wasiImport };
|
|
18
21
|
*
|
|
19
|
-
* const wasm = await WebAssembly.compile(
|
|
22
|
+
* const wasm = await WebAssembly.compile(
|
|
23
|
+
* await readFile(new URL('./demo.wasm', import.meta.url))
|
|
24
|
+
* );
|
|
20
25
|
* const instance = await WebAssembly.instantiate(wasm, importObject);
|
|
21
26
|
*
|
|
22
27
|
* wasi.start(instance);
|
|
@@ -63,7 +68,7 @@
|
|
|
63
68
|
* The `--experimental-wasi-unstable-preview1` CLI argument is needed for this
|
|
64
69
|
* example to run.
|
|
65
70
|
* @experimental
|
|
66
|
-
* @see [source](https://github.com/nodejs/node/blob/v16.
|
|
71
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/wasi.js)
|
|
67
72
|
*/
|
|
68
73
|
declare module 'wasi' {
|
|
69
74
|
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.9.0/lib/worker_threads.js)
|
|
53
53
|
*/
|
|
54
54
|
declare module 'worker_threads' {
|
|
55
55
|
import { Blob } from 'node:buffer';
|
|
@@ -94,7 +94,7 @@ declare module 'worker_threads' {
|
|
|
94
94
|
* asynchronous, two-way communications channel. It can be used to transfer
|
|
95
95
|
* structured data, memory regions and other `MessagePort`s between different `Worker` s.
|
|
96
96
|
*
|
|
97
|
-
* This implementation matches [browser `MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort)s.
|
|
97
|
+
* This implementation matches [browser `MessagePort`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort) s.
|
|
98
98
|
* @since v10.5.0
|
|
99
99
|
*/
|
|
100
100
|
class MessagePort extends EventEmitter {
|
|
@@ -572,11 +572,11 @@ declare module 'worker_threads' {
|
|
|
572
572
|
* takes its place.
|
|
573
573
|
*
|
|
574
574
|
* The returned `MessagePort` is an object in the target context and
|
|
575
|
-
* inherits from its global `Object` class. Objects passed to the[`port.onmessage()`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort/onmessage) listener are also created in the
|
|
575
|
+
* inherits from its global `Object` class. Objects passed to the [`port.onmessage()`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort/onmessage) listener are also created in the
|
|
576
576
|
* target context
|
|
577
577
|
* and inherit from its global `Object` class.
|
|
578
578
|
*
|
|
579
|
-
* However, the created `MessagePort` no longer inherits from[`EventTarget`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget), and only
|
|
579
|
+
* However, the created `MessagePort` no longer inherits from [`EventTarget`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget), and only
|
|
580
580
|
* [`port.onmessage()`](https://developer.mozilla.org/en-US/docs/Web/API/MessagePort/onmessage) can be used to receive
|
|
581
581
|
* events using it.
|
|
582
582
|
* @since v11.13.0
|
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.9.0/lib/zlib.js)
|
|
92
92
|
*/
|
|
93
93
|
declare module 'zlib' {
|
|
94
94
|
import * as stream from 'node:stream';
|