@types/node 15.6.1 → 15.12.1
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/buffer.d.ts +62 -0
- node/child_process.d.ts +9 -4
- node/crypto.d.ts +129 -7
- node/dgram.d.ts +2 -2
- node/fs/promises.d.ts +34 -0
- node/fs.d.ts +19 -46
- node/globals.d.ts +5 -3
- node/http.d.ts +14 -6
- node/http2.d.ts +7 -0
- node/index.d.ts +6 -6
- node/os.d.ts +1 -1
- node/package.json +4 -3
- node/perf_hooks.d.ts +60 -24
- node/process.d.ts +1 -1
- node/readline.d.ts +23 -2
- node/stream.d.ts +1 -1
- node/timers/promises.d.ts +10 -2
- node/timers.d.ts +3 -6
- node/tls.d.ts +11 -0
- node/ts3.6/base.d.ts +4 -4
- node/ts3.6/index.d.ts +1 -1
- node/wasi.d.ts +3 -3
- node/worker_threads.d.ts +22 -4
node/README.md
CHANGED
|
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (http://nodejs.org/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Fri, 04 Jun 2021 16:31:37 GMT
|
|
12
12
|
* Dependencies: none
|
|
13
13
|
* Global values: `AbortController`, `AbortSignal`, `Buffer`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
|
|
14
14
|
|
node/buffer.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
declare module 'buffer' {
|
|
2
|
+
import { BinaryLike } from 'crypto';
|
|
3
|
+
|
|
2
4
|
export const INSPECT_MAX_BYTES: number;
|
|
3
5
|
export const kMaxLength: number;
|
|
4
6
|
export const kStringMaxLength: number;
|
|
@@ -19,4 +21,64 @@ declare module 'buffer' {
|
|
|
19
21
|
};
|
|
20
22
|
|
|
21
23
|
export { BuffType as Buffer };
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @experimental
|
|
27
|
+
*/
|
|
28
|
+
export interface BlobOptions {
|
|
29
|
+
/**
|
|
30
|
+
* @default 'utf8'
|
|
31
|
+
*/
|
|
32
|
+
encoding?: BufferEncoding;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The Blob content-type. The intent is for `type` to convey
|
|
36
|
+
* the MIME media type of the data, however no validation of the type format
|
|
37
|
+
* is performed.
|
|
38
|
+
*/
|
|
39
|
+
type?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @experimental
|
|
44
|
+
*/
|
|
45
|
+
export class Blob {
|
|
46
|
+
/**
|
|
47
|
+
* Returns a promise that fulfills with an {ArrayBuffer} containing a copy of the `Blob` data.
|
|
48
|
+
*/
|
|
49
|
+
readonly size: number;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The content-type of the `Blob`.
|
|
53
|
+
*/
|
|
54
|
+
readonly type: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Creates a new `Blob` object containing a concatenation of the given sources.
|
|
58
|
+
*
|
|
59
|
+
* {ArrayBuffer}, {TypedArray}, {DataView}, and {Buffer} sources are copied into
|
|
60
|
+
* the 'Blob' and can therefore be safely modified after the 'Blob' is created.
|
|
61
|
+
*
|
|
62
|
+
* String sources are also copied into the `Blob`.
|
|
63
|
+
*/
|
|
64
|
+
constructor(sources: Array<(BinaryLike | Blob)>, options?: BlobOptions);
|
|
65
|
+
|
|
66
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @param start The starting index.
|
|
70
|
+
* @param end The ending index.
|
|
71
|
+
* @param type The content-type for the new `Blob`
|
|
72
|
+
*/
|
|
73
|
+
slice(start?: number, end?: number, type?: string): Blob;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Returns a promise that resolves the contents of the `Blob` decoded as a UTF-8 string.
|
|
77
|
+
*/
|
|
78
|
+
text(): Promise<string>;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
declare module 'node:buffer' {
|
|
83
|
+
export * from 'buffer';
|
|
22
84
|
}
|
node/child_process.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ declare module 'child_process' {
|
|
|
4
4
|
import * as net from 'net';
|
|
5
5
|
import { Writable, Readable, Stream, Pipe } from 'stream';
|
|
6
6
|
|
|
7
|
-
type Serializable = string | object | number | boolean;
|
|
7
|
+
type Serializable = string | object | number | boolean | bigint;
|
|
8
8
|
type SendHandle = net.Socket | net.Server;
|
|
9
9
|
|
|
10
10
|
interface ChildProcess extends EventEmitter {
|
|
@@ -20,7 +20,7 @@ declare module 'child_process' {
|
|
|
20
20
|
Readable | Writable | null | undefined // extra
|
|
21
21
|
];
|
|
22
22
|
readonly killed: boolean;
|
|
23
|
-
readonly pid
|
|
23
|
+
readonly pid?: number;
|
|
24
24
|
readonly connected: boolean;
|
|
25
25
|
readonly exitCode: number | null;
|
|
26
26
|
readonly signalCode: NodeJS.Signals | null;
|
|
@@ -135,12 +135,18 @@ declare module 'child_process' {
|
|
|
135
135
|
|
|
136
136
|
type SerializationType = 'json' | 'advanced';
|
|
137
137
|
|
|
138
|
-
interface MessagingOptions {
|
|
138
|
+
interface MessagingOptions extends Abortable {
|
|
139
139
|
/**
|
|
140
140
|
* Specify the kind of serialization used for sending messages between processes.
|
|
141
141
|
* @default 'json'
|
|
142
142
|
*/
|
|
143
143
|
serialization?: SerializationType;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* The signal value to be used when the spawned process will be killed by the abort signal.
|
|
147
|
+
* @default 'SIGTERM'
|
|
148
|
+
*/
|
|
149
|
+
killSignal?: NodeJS.Signals | number;
|
|
144
150
|
}
|
|
145
151
|
|
|
146
152
|
interface ProcessEnvOptions {
|
|
@@ -451,7 +457,6 @@ declare module 'child_process' {
|
|
|
451
457
|
|
|
452
458
|
interface SpawnSyncOptions extends CommonSpawnOptions {
|
|
453
459
|
input?: string | NodeJS.ArrayBufferView;
|
|
454
|
-
killSignal?: NodeJS.Signals | number;
|
|
455
460
|
maxBuffer?: number;
|
|
456
461
|
encoding?: BufferEncoding | 'buffer' | null;
|
|
457
462
|
}
|
node/crypto.d.ts
CHANGED
|
@@ -197,6 +197,45 @@ declare module 'crypto' {
|
|
|
197
197
|
passphrase?: string | Buffer;
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
+
interface JwkKeyExportOptions {
|
|
201
|
+
format: 'jwk';
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
interface JsonWebKey {
|
|
205
|
+
crv?: string;
|
|
206
|
+
d?: string;
|
|
207
|
+
dp?: string;
|
|
208
|
+
dq?: string;
|
|
209
|
+
e?: string;
|
|
210
|
+
k?: string;
|
|
211
|
+
kty?: string;
|
|
212
|
+
n?: string;
|
|
213
|
+
p?: string;
|
|
214
|
+
q?: string;
|
|
215
|
+
qi?: string;
|
|
216
|
+
x?: string;
|
|
217
|
+
y?: string;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
interface AsymmetricKeyDetails {
|
|
221
|
+
/**
|
|
222
|
+
* Key size in bits (RSA, DSA).
|
|
223
|
+
*/
|
|
224
|
+
modulusLength?: number;
|
|
225
|
+
/**
|
|
226
|
+
* Public exponent (RSA).
|
|
227
|
+
*/
|
|
228
|
+
publicExponent?: bigint;
|
|
229
|
+
/**
|
|
230
|
+
* Size of q in bits (DSA).
|
|
231
|
+
*/
|
|
232
|
+
divisorLength?: number;
|
|
233
|
+
/**
|
|
234
|
+
* Name of the curve (EC).
|
|
235
|
+
*/
|
|
236
|
+
namedCurve?: string;
|
|
237
|
+
}
|
|
238
|
+
|
|
200
239
|
class KeyObject {
|
|
201
240
|
private constructor();
|
|
202
241
|
asymmetricKeyType?: KeyType;
|
|
@@ -205,6 +244,13 @@ declare module 'crypto' {
|
|
|
205
244
|
* bytes. This property is `undefined` for symmetric keys.
|
|
206
245
|
*/
|
|
207
246
|
asymmetricKeySize?: number;
|
|
247
|
+
/**
|
|
248
|
+
* This property exists only on asymmetric keys. Depending on the type of the key,
|
|
249
|
+
* this object contains information about the key. None of the information obtained
|
|
250
|
+
* through this property can be used to uniquely identify a key or to compromise the
|
|
251
|
+
* security of the key.
|
|
252
|
+
*/
|
|
253
|
+
asymmetricKeyDetails?: AsymmetricKeyDetails;
|
|
208
254
|
export(options: KeyExportOptions<'pem'>): string | Buffer;
|
|
209
255
|
export(options?: KeyExportOptions<'der'>): Buffer;
|
|
210
256
|
symmetricKeySize?: number;
|
|
@@ -1163,22 +1209,28 @@ declare module 'crypto' {
|
|
|
1163
1209
|
* algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is
|
|
1164
1210
|
* dependent upon the key type (especially Ed25519 and Ed448).
|
|
1165
1211
|
*
|
|
1166
|
-
* If `key` is not a
|
|
1167
|
-
* passed to
|
|
1212
|
+
* If `key` is not a `KeyObject`, this function behaves as if `key` had been
|
|
1213
|
+
* passed to `crypto.createPrivateKey().
|
|
1168
1214
|
*/
|
|
1169
1215
|
function sign(
|
|
1170
1216
|
algorithm: string | null | undefined,
|
|
1171
1217
|
data: NodeJS.ArrayBufferView,
|
|
1172
1218
|
key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput,
|
|
1173
1219
|
): Buffer;
|
|
1220
|
+
function sign(
|
|
1221
|
+
algorithm: string | null | undefined,
|
|
1222
|
+
data: NodeJS.ArrayBufferView,
|
|
1223
|
+
key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput,
|
|
1224
|
+
callback: (error: Error | null, data: Buffer) => void
|
|
1225
|
+
): void;
|
|
1174
1226
|
|
|
1175
1227
|
/**
|
|
1176
1228
|
* Calculates and returns the signature for `data` using the given private key and
|
|
1177
1229
|
* algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is
|
|
1178
1230
|
* dependent upon the key type (especially Ed25519 and Ed448).
|
|
1179
1231
|
*
|
|
1180
|
-
* If `key` is not a
|
|
1181
|
-
* passed to
|
|
1232
|
+
* If `key` is not a `KeyObject`, this function behaves as if `key` had been
|
|
1233
|
+
* passed to `crypto.createPublicKey()`.
|
|
1182
1234
|
*/
|
|
1183
1235
|
function verify(
|
|
1184
1236
|
algorithm: string | null | undefined,
|
|
@@ -1186,6 +1238,13 @@ declare module 'crypto' {
|
|
|
1186
1238
|
key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput,
|
|
1187
1239
|
signature: NodeJS.ArrayBufferView,
|
|
1188
1240
|
): boolean;
|
|
1241
|
+
function verify(
|
|
1242
|
+
algorithm: string | null | undefined,
|
|
1243
|
+
data: NodeJS.ArrayBufferView,
|
|
1244
|
+
key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput,
|
|
1245
|
+
signature: NodeJS.ArrayBufferView,
|
|
1246
|
+
callback: (error: Error | null, result: boolean) => void
|
|
1247
|
+
): void;
|
|
1189
1248
|
|
|
1190
1249
|
/**
|
|
1191
1250
|
* Computes the Diffie-Hellman secret based on a privateKey and a publicKey.
|
|
@@ -1254,7 +1313,7 @@ declare module 'crypto' {
|
|
|
1254
1313
|
*
|
|
1255
1314
|
* The supplied `callback` function is called with two arguments: `err` and `derivedKey`.
|
|
1256
1315
|
* If an errors occurs while deriving the key, `err` will be set; otherwise `err` will be `null`.
|
|
1257
|
-
* The successfully generated `derivedKey` will be passed to the callback as an
|
|
1316
|
+
* The successfully generated `derivedKey` will be passed to the callback as an `ArrayBuffer`.
|
|
1258
1317
|
* An error will be thrown if any of the input aguments specify invalid values or types.
|
|
1259
1318
|
*/
|
|
1260
1319
|
function hkdf(digest: string, key: BinaryLike | KeyObject, salt: BinaryLike, info: BinaryLike, keylen: number, callback: (err: Error | null, derivedKey: ArrayBuffer) => any): void;
|
|
@@ -1263,7 +1322,7 @@ declare module 'crypto' {
|
|
|
1263
1322
|
* Provides a synchronous HKDF key derivation function as defined in RFC 5869.
|
|
1264
1323
|
* The given `key`, `salt` and `info` are used with the `digest` to derive a key of `keylen` bytes.
|
|
1265
1324
|
*
|
|
1266
|
-
* The successfully generated `derivedKey` will be returned as an
|
|
1325
|
+
* The successfully generated `derivedKey` will be returned as an `ArrayBuffer`.
|
|
1267
1326
|
* An error will be thrown if any of the input aguments specify invalid values or types,
|
|
1268
1327
|
* or if the derived key cannot be generated.
|
|
1269
1328
|
*/
|
|
@@ -1372,6 +1431,16 @@ declare module 'crypto' {
|
|
|
1372
1431
|
*/
|
|
1373
1432
|
readonly keyUsage: string[];
|
|
1374
1433
|
|
|
1434
|
+
/**
|
|
1435
|
+
* The issuer identification included in this certificate.
|
|
1436
|
+
*/
|
|
1437
|
+
readonly issuer: string;
|
|
1438
|
+
|
|
1439
|
+
/**
|
|
1440
|
+
* The issuer certificate or `undefined` if the issuer certificate is not available.
|
|
1441
|
+
*/
|
|
1442
|
+
readonly issuerCertificate?: X509Certificate;
|
|
1443
|
+
|
|
1375
1444
|
/**
|
|
1376
1445
|
* The public key for this certificate.
|
|
1377
1446
|
*/
|
|
@@ -1438,7 +1507,7 @@ declare module 'crypto' {
|
|
|
1438
1507
|
toJSON(): string;
|
|
1439
1508
|
|
|
1440
1509
|
/**
|
|
1441
|
-
* Returns information about this certificate using the legacy
|
|
1510
|
+
* Returns information about this certificate using the legacy certificate object encoding.
|
|
1442
1511
|
*/
|
|
1443
1512
|
toLegacyObject(): PeerCertificate;
|
|
1444
1513
|
|
|
@@ -1453,4 +1522,57 @@ declare module 'crypto' {
|
|
|
1453
1522
|
*/
|
|
1454
1523
|
verify(publicKey: KeyObject): boolean;
|
|
1455
1524
|
}
|
|
1525
|
+
|
|
1526
|
+
type LargeNumberLike = NodeJS.ArrayBufferView | SharedArrayBuffer | ArrayBuffer | bigint;
|
|
1527
|
+
|
|
1528
|
+
interface GeneratePrimeOptions {
|
|
1529
|
+
add?: LargeNumberLike;
|
|
1530
|
+
rem?: LargeNumberLike;
|
|
1531
|
+
/**
|
|
1532
|
+
* @default false
|
|
1533
|
+
*/
|
|
1534
|
+
safe?: boolean;
|
|
1535
|
+
bigint?: boolean;
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
interface GeneratePrimeOptionsBigInt extends GeneratePrimeOptions {
|
|
1539
|
+
bigint: true;
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
interface GeneratePrimeOptionsArrayBuffer extends GeneratePrimeOptions {
|
|
1543
|
+
bigint?: false;
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
function generatePrime(size: number, callback: (err: Error | null, prime: ArrayBuffer) => void): void;
|
|
1547
|
+
function generatePrime(size: number, options: GeneratePrimeOptionsBigInt, callback: (err: Error | null, prime: bigint) => void): void;
|
|
1548
|
+
function generatePrime(size: number, options: GeneratePrimeOptionsArrayBuffer, callback: (err: Error | null, prime: ArrayBuffer) => void): void;
|
|
1549
|
+
function generatePrime(size: number, options: GeneratePrimeOptions, callback: (err: Error | null, prime: ArrayBuffer | bigint) => void): void;
|
|
1550
|
+
|
|
1551
|
+
function generatePrimeSync(size: number): ArrayBuffer;
|
|
1552
|
+
function generatePrimeSync(size: number, options: GeneratePrimeOptionsBigInt): bigint;
|
|
1553
|
+
function generatePrimeSync(size: number, options: GeneratePrimeOptionsArrayBuffer): ArrayBuffer;
|
|
1554
|
+
function generatePrimeSync(size: number, options: GeneratePrimeOptions): ArrayBuffer | bigint;
|
|
1555
|
+
|
|
1556
|
+
interface CheckPrimeOptions {
|
|
1557
|
+
/**
|
|
1558
|
+
* The number of Miller-Rabin probabilistic primality iterations to perform.
|
|
1559
|
+
* When the value is 0 (zero), a number of checks is used that yields a false positive rate of at most 2-64 for random input.
|
|
1560
|
+
* Care must be used when selecting a number of checks.
|
|
1561
|
+
* Refer to the OpenSSL documentation for the BN_is_prime_ex function nchecks options for more details.
|
|
1562
|
+
*
|
|
1563
|
+
* @default 0
|
|
1564
|
+
*/
|
|
1565
|
+
checks?: number;
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
/**
|
|
1569
|
+
* Checks the primality of the candidate.
|
|
1570
|
+
*/
|
|
1571
|
+
function checkPrime(value: LargeNumberLike, callback: (err: Error | null, result: boolean) => void): void;
|
|
1572
|
+
function checkPrime(value: LargeNumberLike, options: CheckPrimeOptions, callback: (err: Error | null, result: boolean) => void): void;
|
|
1573
|
+
|
|
1574
|
+
/**
|
|
1575
|
+
* Checks the primality of the candidate.
|
|
1576
|
+
*/
|
|
1577
|
+
function checkPrimeSync(value: LargeNumberLike, options?: CheckPrimeOptions): boolean;
|
|
1456
1578
|
}
|
node/dgram.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare module 'dgram' {
|
|
2
2
|
import { AddressInfo } from 'net';
|
|
3
3
|
import * as dns from 'dns';
|
|
4
|
-
import EventEmitter
|
|
4
|
+
import { EventEmitter, Abortable } from 'events';
|
|
5
5
|
|
|
6
6
|
interface RemoteInfo {
|
|
7
7
|
address: string;
|
|
@@ -19,7 +19,7 @@ declare module 'dgram' {
|
|
|
19
19
|
|
|
20
20
|
type SocketType = "udp4" | "udp6";
|
|
21
21
|
|
|
22
|
-
interface SocketOptions {
|
|
22
|
+
interface SocketOptions extends Abortable {
|
|
23
23
|
type: SocketType;
|
|
24
24
|
reuseAddr?: boolean;
|
|
25
25
|
/**
|
node/fs/promises.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ declare module 'fs/promises' {
|
|
|
17
17
|
BufferEncodingOption,
|
|
18
18
|
OpenMode,
|
|
19
19
|
Mode,
|
|
20
|
+
WatchOptions,
|
|
20
21
|
} from 'fs';
|
|
21
22
|
|
|
22
23
|
interface FileHandle {
|
|
@@ -555,4 +556,37 @@ declare module 'fs/promises' {
|
|
|
555
556
|
function readFile(path: PathLike | FileHandle, options?: BaseEncodingOptions & Abortable & { flag?: OpenMode } | BufferEncoding | null): Promise<string | Buffer>;
|
|
556
557
|
|
|
557
558
|
function opendir(path: string, options?: OpenDirOptions): Promise<Dir>;
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
562
|
+
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
563
|
+
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
|
|
564
|
+
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
|
565
|
+
* If `persistent` is not supplied, the default of `true` is used.
|
|
566
|
+
* If `recursive` is not supplied, the default of `false` is used.
|
|
567
|
+
*/
|
|
568
|
+
function watch(filename: PathLike, options: WatchOptions & { encoding: "buffer" } | "buffer"): AsyncIterable<Buffer>;
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
572
|
+
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
573
|
+
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
|
|
574
|
+
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
|
575
|
+
* If `persistent` is not supplied, the default of `true` is used.
|
|
576
|
+
* If `recursive` is not supplied, the default of `false` is used.
|
|
577
|
+
*/
|
|
578
|
+
function watch(
|
|
579
|
+
filename: PathLike,
|
|
580
|
+
options?: WatchOptions | BufferEncoding
|
|
581
|
+
): AsyncIterable<string>;
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
585
|
+
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
586
|
+
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
|
|
587
|
+
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
|
588
|
+
* If `persistent` is not supplied, the default of `true` is used.
|
|
589
|
+
* If `recursive` is not supplied, the default of `false` is used.
|
|
590
|
+
*/
|
|
591
|
+
function watch(filename: PathLike, options: WatchOptions | string): AsyncIterable<string> | AsyncIterable<Buffer>;
|
|
558
592
|
}
|
node/fs.d.ts
CHANGED
|
@@ -276,9 +276,7 @@ declare module 'fs' {
|
|
|
276
276
|
/**
|
|
277
277
|
* Asynchronous rename(2) - Change the name or location of a file or directory.
|
|
278
278
|
* @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
279
|
-
* URL support is _experimental_.
|
|
280
279
|
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
281
|
-
* URL support is _experimental_.
|
|
282
280
|
*/
|
|
283
281
|
export function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
|
|
284
282
|
|
|
@@ -297,9 +295,7 @@ declare module 'fs' {
|
|
|
297
295
|
/**
|
|
298
296
|
* Synchronous rename(2) - Change the name or location of a file or directory.
|
|
299
297
|
* @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
300
|
-
* URL support is _experimental_.
|
|
301
298
|
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
302
|
-
* URL support is _experimental_.
|
|
303
299
|
*/
|
|
304
300
|
export function renameSync(oldPath: PathLike, newPath: PathLike): void;
|
|
305
301
|
|
|
@@ -313,7 +309,6 @@ declare module 'fs' {
|
|
|
313
309
|
/**
|
|
314
310
|
* Asynchronous truncate(2) - Truncate a file to a specified length.
|
|
315
311
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
316
|
-
* URL support is _experimental_.
|
|
317
312
|
*/
|
|
318
313
|
export function truncate(path: PathLike, callback: NoParamCallback): void;
|
|
319
314
|
|
|
@@ -1242,7 +1237,7 @@ declare module 'fs' {
|
|
|
1242
1237
|
* Asynchronous close(2) - close a file descriptor.
|
|
1243
1238
|
* @param fd A file descriptor.
|
|
1244
1239
|
*/
|
|
1245
|
-
export function close(fd: number, callback
|
|
1240
|
+
export function close(fd: number, callback?: NoParamCallback): void;
|
|
1246
1241
|
|
|
1247
1242
|
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
|
|
1248
1243
|
export namespace close {
|
|
@@ -1487,6 +1482,8 @@ declare module 'fs' {
|
|
|
1487
1482
|
*/
|
|
1488
1483
|
export function writeSync(fd: number, string: string, position?: number | null, encoding?: BufferEncoding | null): number;
|
|
1489
1484
|
|
|
1485
|
+
export type ReadPosition = number | bigint;
|
|
1486
|
+
|
|
1490
1487
|
/**
|
|
1491
1488
|
* Asynchronously reads data from the file referenced by the supplied file descriptor.
|
|
1492
1489
|
* @param fd A file descriptor.
|
|
@@ -1500,7 +1497,7 @@ declare module 'fs' {
|
|
|
1500
1497
|
buffer: TBuffer,
|
|
1501
1498
|
offset: number,
|
|
1502
1499
|
length: number,
|
|
1503
|
-
position:
|
|
1500
|
+
position: ReadPosition | null,
|
|
1504
1501
|
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
|
|
1505
1502
|
): void;
|
|
1506
1503
|
|
|
@@ -1534,7 +1531,7 @@ declare module 'fs' {
|
|
|
1534
1531
|
/**
|
|
1535
1532
|
* @default null
|
|
1536
1533
|
*/
|
|
1537
|
-
position?:
|
|
1534
|
+
position?: ReadPosition | null;
|
|
1538
1535
|
}
|
|
1539
1536
|
|
|
1540
1537
|
/**
|
|
@@ -1545,7 +1542,7 @@ declare module 'fs' {
|
|
|
1545
1542
|
* @param length The number of bytes to read.
|
|
1546
1543
|
* @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position.
|
|
1547
1544
|
*/
|
|
1548
|
-
export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, offset: number, length: number, position:
|
|
1545
|
+
export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, offset: number, length: number, position: ReadPosition | null): number;
|
|
1549
1546
|
|
|
1550
1547
|
/**
|
|
1551
1548
|
* Similar to the above `fs.readSync` function, this version takes an optional `options` object.
|
|
@@ -1569,7 +1566,6 @@ declare module 'fs' {
|
|
|
1569
1566
|
/**
|
|
1570
1567
|
* Asynchronously reads the entire contents of a file.
|
|
1571
1568
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1572
|
-
* URL support is _experimental_.
|
|
1573
1569
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
1574
1570
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1575
1571
|
* If a flag is not provided, it defaults to `'r'`.
|
|
@@ -1583,7 +1579,6 @@ declare module 'fs' {
|
|
|
1583
1579
|
/**
|
|
1584
1580
|
* Asynchronously reads the entire contents of a file.
|
|
1585
1581
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1586
|
-
* URL support is _experimental_.
|
|
1587
1582
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
1588
1583
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1589
1584
|
* If a flag is not provided, it defaults to `'r'`.
|
|
@@ -1637,7 +1632,6 @@ declare module 'fs' {
|
|
|
1637
1632
|
/**
|
|
1638
1633
|
* Synchronously reads the entire contents of a file.
|
|
1639
1634
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1640
|
-
* URL support is _experimental_.
|
|
1641
1635
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
1642
1636
|
* @param options An object that may contain an optional flag. If a flag is not provided, it defaults to `'r'`.
|
|
1643
1637
|
*/
|
|
@@ -1646,7 +1640,6 @@ declare module 'fs' {
|
|
|
1646
1640
|
/**
|
|
1647
1641
|
* Synchronously reads the entire contents of a file.
|
|
1648
1642
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1649
|
-
* URL support is _experimental_.
|
|
1650
1643
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
1651
1644
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1652
1645
|
* If a flag is not provided, it defaults to `'r'`.
|
|
@@ -1656,7 +1649,6 @@ declare module 'fs' {
|
|
|
1656
1649
|
/**
|
|
1657
1650
|
* Synchronously reads the entire contents of a file.
|
|
1658
1651
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1659
|
-
* URL support is _experimental_.
|
|
1660
1652
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
1661
1653
|
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
|
1662
1654
|
* If a flag is not provided, it defaults to `'r'`.
|
|
@@ -1668,7 +1660,6 @@ declare module 'fs' {
|
|
|
1668
1660
|
/**
|
|
1669
1661
|
* Asynchronously writes data to a file, replacing the file if it already exists.
|
|
1670
1662
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1671
|
-
* URL support is _experimental_.
|
|
1672
1663
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
1673
1664
|
* @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
|
|
1674
1665
|
* @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
|
|
@@ -1682,7 +1673,6 @@ declare module 'fs' {
|
|
|
1682
1673
|
/**
|
|
1683
1674
|
* Asynchronously writes data to a file, replacing the file if it already exists.
|
|
1684
1675
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1685
|
-
* URL support is _experimental_.
|
|
1686
1676
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
1687
1677
|
* @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
|
|
1688
1678
|
*/
|
|
@@ -1708,7 +1698,6 @@ declare module 'fs' {
|
|
|
1708
1698
|
/**
|
|
1709
1699
|
* Synchronously writes data to a file, replacing the file if it already exists.
|
|
1710
1700
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1711
|
-
* URL support is _experimental_.
|
|
1712
1701
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
1713
1702
|
* @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
|
|
1714
1703
|
* @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
|
|
@@ -1722,7 +1711,6 @@ declare module 'fs' {
|
|
|
1722
1711
|
/**
|
|
1723
1712
|
* Asynchronously append data to a file, creating the file if it does not exist.
|
|
1724
1713
|
* @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1725
|
-
* URL support is _experimental_.
|
|
1726
1714
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
1727
1715
|
* @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
|
|
1728
1716
|
* @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
|
|
@@ -1736,7 +1724,6 @@ declare module 'fs' {
|
|
|
1736
1724
|
/**
|
|
1737
1725
|
* Asynchronously append data to a file, creating the file if it does not exist.
|
|
1738
1726
|
* @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1739
|
-
* URL support is _experimental_.
|
|
1740
1727
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
1741
1728
|
* @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
|
|
1742
1729
|
*/
|
|
@@ -1762,7 +1749,6 @@ declare module 'fs' {
|
|
|
1762
1749
|
/**
|
|
1763
1750
|
* Synchronously append data to a file, creating the file if it does not exist.
|
|
1764
1751
|
* @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1765
|
-
* URL support is _experimental_.
|
|
1766
1752
|
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
|
1767
1753
|
* @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
|
|
1768
1754
|
* @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
|
|
@@ -1781,36 +1767,36 @@ declare module 'fs' {
|
|
|
1781
1767
|
/**
|
|
1782
1768
|
* Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
|
|
1783
1769
|
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
1784
|
-
* URL support is _experimental_.
|
|
1785
1770
|
*/
|
|
1786
1771
|
export function watchFile(filename: PathLike, listener: (curr: Stats, prev: Stats) => void): void;
|
|
1787
1772
|
|
|
1788
1773
|
/**
|
|
1789
1774
|
* Stop watching for changes on `filename`.
|
|
1790
1775
|
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
1791
|
-
* URL support is _experimental_.
|
|
1792
1776
|
*/
|
|
1793
1777
|
export function unwatchFile(filename: PathLike, listener?: (curr: Stats, prev: Stats) => void): void;
|
|
1794
1778
|
|
|
1779
|
+
export interface WatchOptions extends Abortable {
|
|
1780
|
+
encoding?: BufferEncoding | "buffer";
|
|
1781
|
+
persistent?: boolean;
|
|
1782
|
+
recursive?: boolean;
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
export type WatchListener<T> = (event: "rename" | "change", filename: T) => void;
|
|
1786
|
+
|
|
1795
1787
|
/**
|
|
1796
1788
|
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
1797
1789
|
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
1798
|
-
* URL support is _experimental_.
|
|
1799
1790
|
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
|
|
1800
1791
|
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
|
1801
1792
|
* If `persistent` is not supplied, the default of `true` is used.
|
|
1802
1793
|
* If `recursive` is not supplied, the default of `false` is used.
|
|
1803
1794
|
*/
|
|
1804
|
-
export function watch(
|
|
1805
|
-
filename: PathLike,
|
|
1806
|
-
options: { encoding?: BufferEncoding | null, persistent?: boolean, recursive?: boolean } | BufferEncoding | undefined | null,
|
|
1807
|
-
listener?: (event: "rename" | "change", filename: string) => void,
|
|
1808
|
-
): FSWatcher;
|
|
1795
|
+
export function watch(filename: PathLike, options: WatchOptions & { encoding: "buffer" } | "buffer", listener?: WatchListener<Buffer>): FSWatcher;
|
|
1809
1796
|
|
|
1810
1797
|
/**
|
|
1811
1798
|
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
1812
1799
|
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
1813
|
-
* URL support is _experimental_.
|
|
1814
1800
|
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
|
|
1815
1801
|
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
|
1816
1802
|
* If `persistent` is not supplied, the default of `true` is used.
|
|
@@ -1818,37 +1804,30 @@ declare module 'fs' {
|
|
|
1818
1804
|
*/
|
|
1819
1805
|
export function watch(
|
|
1820
1806
|
filename: PathLike,
|
|
1821
|
-
options
|
|
1822
|
-
listener?:
|
|
1807
|
+
options?: WatchOptions | BufferEncoding | null,
|
|
1808
|
+
listener?: WatchListener<string>,
|
|
1823
1809
|
): FSWatcher;
|
|
1824
1810
|
|
|
1825
1811
|
/**
|
|
1826
1812
|
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
1827
1813
|
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
1828
|
-
* URL support is _experimental_.
|
|
1829
1814
|
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
|
|
1830
1815
|
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
|
1831
1816
|
* If `persistent` is not supplied, the default of `true` is used.
|
|
1832
1817
|
* If `recursive` is not supplied, the default of `false` is used.
|
|
1833
1818
|
*/
|
|
1834
|
-
export function watch(
|
|
1835
|
-
filename: PathLike,
|
|
1836
|
-
options: { encoding?: BufferEncoding | null, persistent?: boolean, recursive?: boolean } | string | null,
|
|
1837
|
-
listener?: (event: "rename" | "change", filename: string | Buffer) => void,
|
|
1838
|
-
): FSWatcher;
|
|
1819
|
+
export function watch(filename: PathLike, options: WatchOptions | string, listener?: WatchListener<string | Buffer>): FSWatcher;
|
|
1839
1820
|
|
|
1840
1821
|
/**
|
|
1841
1822
|
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
1842
1823
|
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
1843
|
-
* URL support is _experimental_.
|
|
1844
1824
|
*/
|
|
1845
|
-
export function watch(filename: PathLike, listener?:
|
|
1825
|
+
export function watch(filename: PathLike, listener?: WatchListener<string>): FSWatcher;
|
|
1846
1826
|
|
|
1847
1827
|
/**
|
|
1848
1828
|
* Asynchronously tests whether or not the given path exists by checking with the file system.
|
|
1849
1829
|
* @deprecated since v1.0.0 Use `fs.stat()` or `fs.access()` instead
|
|
1850
1830
|
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
1851
|
-
* URL support is _experimental_.
|
|
1852
1831
|
*/
|
|
1853
1832
|
export function exists(path: PathLike, callback: (exists: boolean) => void): void;
|
|
1854
1833
|
|
|
@@ -1864,7 +1843,6 @@ declare module 'fs' {
|
|
|
1864
1843
|
/**
|
|
1865
1844
|
* Synchronously tests whether or not the given path exists by checking with the file system.
|
|
1866
1845
|
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
1867
|
-
* URL support is _experimental_.
|
|
1868
1846
|
*/
|
|
1869
1847
|
export function existsSync(path: PathLike): boolean;
|
|
1870
1848
|
|
|
@@ -2034,14 +2012,12 @@ declare module 'fs' {
|
|
|
2034
2012
|
/**
|
|
2035
2013
|
* Asynchronously tests a user's permissions for the file specified by path.
|
|
2036
2014
|
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
2037
|
-
* URL support is _experimental_.
|
|
2038
2015
|
*/
|
|
2039
2016
|
export function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void;
|
|
2040
2017
|
|
|
2041
2018
|
/**
|
|
2042
2019
|
* Asynchronously tests a user's permissions for the file specified by path.
|
|
2043
2020
|
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
2044
|
-
* URL support is _experimental_.
|
|
2045
2021
|
*/
|
|
2046
2022
|
export function access(path: PathLike, callback: NoParamCallback): void;
|
|
2047
2023
|
|
|
@@ -2058,7 +2034,6 @@ declare module 'fs' {
|
|
|
2058
2034
|
/**
|
|
2059
2035
|
* Synchronously tests a user's permissions for the file specified by path.
|
|
2060
2036
|
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
2061
|
-
* URL support is _experimental_.
|
|
2062
2037
|
*/
|
|
2063
2038
|
export function accessSync(path: PathLike, mode?: number): void;
|
|
2064
2039
|
|
|
@@ -2083,14 +2058,12 @@ declare module 'fs' {
|
|
|
2083
2058
|
/**
|
|
2084
2059
|
* Returns a new `ReadStream` object.
|
|
2085
2060
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2086
|
-
* URL support is _experimental_.
|
|
2087
2061
|
*/
|
|
2088
2062
|
export function createReadStream(path: PathLike, options?: string | ReadStreamOptions): ReadStream;
|
|
2089
2063
|
|
|
2090
2064
|
/**
|
|
2091
2065
|
* Returns a new `WriteStream` object.
|
|
2092
2066
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
2093
|
-
* URL support is _experimental_.
|
|
2094
2067
|
*/
|
|
2095
2068
|
export function createWriteStream(path: PathLike, options?: string | StreamOptions): WriteStream;
|
|
2096
2069
|
|
node/globals.d.ts
CHANGED
|
@@ -37,9 +37,9 @@ interface ImportMeta {
|
|
|
37
37
|
------------------------------------------------*/
|
|
38
38
|
|
|
39
39
|
// For backwards compability
|
|
40
|
-
interface NodeRequire extends NodeJS.Require {}
|
|
41
|
-
interface RequireResolve extends NodeJS.RequireResolve {}
|
|
42
|
-
interface NodeModule extends NodeJS.Module {}
|
|
40
|
+
interface NodeRequire extends NodeJS.Require { }
|
|
41
|
+
interface RequireResolve extends NodeJS.RequireResolve { }
|
|
42
|
+
interface NodeModule extends NodeJS.Module { }
|
|
43
43
|
|
|
44
44
|
declare var process: NodeJS.Process;
|
|
45
45
|
declare var console: Console;
|
|
@@ -318,6 +318,7 @@ interface AbortController {
|
|
|
318
318
|
/**
|
|
319
319
|
* Returns the AbortSignal object associated with this object.
|
|
320
320
|
*/
|
|
321
|
+
|
|
321
322
|
readonly signal: AbortSignal;
|
|
322
323
|
/**
|
|
323
324
|
* Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
|
|
@@ -341,6 +342,7 @@ declare var AbortController: {
|
|
|
341
342
|
declare var AbortSignal: {
|
|
342
343
|
prototype: AbortSignal;
|
|
343
344
|
new(): AbortSignal;
|
|
345
|
+
// TODO: Add abort() static
|
|
344
346
|
};
|
|
345
347
|
//#endregion borrowed
|
|
346
348
|
|
node/http.d.ts
CHANGED
|
@@ -107,7 +107,7 @@ declare module 'http' {
|
|
|
107
107
|
ServerResponse?: typeof ServerResponse;
|
|
108
108
|
/**
|
|
109
109
|
* Optionally overrides the value of
|
|
110
|
-
*
|
|
110
|
+
* `--max-http-header-size` for requests received by this server, i.e.
|
|
111
111
|
* the maximum length of request headers in bytes.
|
|
112
112
|
* @default 8192
|
|
113
113
|
*/
|
|
@@ -156,7 +156,8 @@ declare module 'http' {
|
|
|
156
156
|
|
|
157
157
|
// https://github.com/nodejs/node/blob/master/lib/_http_outgoing.js
|
|
158
158
|
class OutgoingMessage extends stream.Writable {
|
|
159
|
-
|
|
159
|
+
readonly req: IncomingMessage;
|
|
160
|
+
|
|
160
161
|
chunkedEncoding: boolean;
|
|
161
162
|
shouldKeepAlive: boolean;
|
|
162
163
|
useChunkedEncodingByDefault: boolean;
|
|
@@ -165,12 +166,12 @@ declare module 'http' {
|
|
|
165
166
|
* @deprecated Use `writableEnded` instead.
|
|
166
167
|
*/
|
|
167
168
|
finished: boolean;
|
|
168
|
-
headersSent: boolean;
|
|
169
|
+
readonly headersSent: boolean;
|
|
169
170
|
/**
|
|
170
171
|
* @deprecated Use `socket` instead.
|
|
171
172
|
*/
|
|
172
|
-
connection: Socket | null;
|
|
173
|
-
socket: Socket | null;
|
|
173
|
+
readonly connection: Socket | null;
|
|
174
|
+
readonly socket: Socket | null;
|
|
174
175
|
|
|
175
176
|
constructor();
|
|
176
177
|
|
|
@@ -420,7 +421,14 @@ declare module 'http' {
|
|
|
420
421
|
|
|
421
422
|
/**
|
|
422
423
|
* Read-only property specifying the maximum allowed size of HTTP headers in bytes.
|
|
423
|
-
* Defaults to 16KB. Configurable using the
|
|
424
|
+
* Defaults to 16KB. Configurable using the `--max-http-header-size` CLI option.
|
|
424
425
|
*/
|
|
425
426
|
const maxHeaderSize: number;
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
*
|
|
430
|
+
* This utility function converts a URL object into an ordinary options object as
|
|
431
|
+
* expected by the `http.request()` and `https.request()` APIs.
|
|
432
|
+
*/
|
|
433
|
+
function urlToHttpOptions(url: URL): ClientRequestArgs;
|
|
426
434
|
}
|
node/http2.d.ts
CHANGED
|
@@ -438,6 +438,13 @@ declare module 'http2' {
|
|
|
438
438
|
paddingStrategy?: number;
|
|
439
439
|
peerMaxConcurrentStreams?: number;
|
|
440
440
|
settings?: Settings;
|
|
441
|
+
/**
|
|
442
|
+
* Specifies a timeout in milliseconds that
|
|
443
|
+
* a server should wait when an [`'unknownProtocol'`][] is emitted. If the
|
|
444
|
+
* socket has not been destroyed by that time the server will destroy it.
|
|
445
|
+
* @default 100000
|
|
446
|
+
*/
|
|
447
|
+
unknownProtocolTimeout?: number;
|
|
441
448
|
|
|
442
449
|
selectPadding?(frameLen: number, maxFrameLen: number): number;
|
|
443
450
|
createConnection?(authority: url.URL, option: SessionOptions): stream.Duplex;
|
node/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for non-npm package Node.js 15.
|
|
1
|
+
// Type definitions for non-npm package Node.js 15.12
|
|
2
2
|
// Project: http://nodejs.org/
|
|
3
3
|
// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
|
|
4
4
|
// DefinitelyTyped <https://github.com/DefinitelyTyped>
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
|
|
51
51
|
// NOTE: TypeScript version-specific augmentations can be found in the following paths:
|
|
52
52
|
// - ~/base.d.ts - Shared definitions common to all TypeScript versions
|
|
53
|
-
// - ~/index.d.ts - Definitions specific to TypeScript
|
|
54
|
-
// - ~/ts3.
|
|
53
|
+
// - ~/index.d.ts - Definitions specific to TypeScript 3.7
|
|
54
|
+
// - ~/ts3.6/index.d.ts - Definitions specific to TypeScript 3.6
|
|
55
55
|
|
|
56
|
-
// NOTE: Augmentations for TypeScript 3.
|
|
57
|
-
// within the respective ~/ts3.
|
|
58
|
-
// prior to TypeScript 3.
|
|
56
|
+
// NOTE: Augmentations for TypeScript 3.6 and later should use individual files for overrides
|
|
57
|
+
// within the respective ~/ts3.6 (or later) folder. However, this is disallowed for versions
|
|
58
|
+
// prior to TypeScript 3.6, so the older definitions will be found here.
|
node/os.d.ts
CHANGED
|
@@ -212,7 +212,7 @@ declare module 'os' {
|
|
|
212
212
|
/**
|
|
213
213
|
* Returns a string identifying the kernel version.
|
|
214
214
|
* On POSIX systems, the operating system release is determined by calling
|
|
215
|
-
*
|
|
215
|
+
* uname(3). On Windows, `pRtlGetVersion` is used, and if it is not available,
|
|
216
216
|
* `GetVersionExW()` will be used. See
|
|
217
217
|
* https://en.wikipedia.org/wiki/Uname#Examples for more information.
|
|
218
218
|
*/
|
node/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.12.1",
|
|
4
4
|
"description": "TypeScript definitions for Node.js",
|
|
5
|
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
5
6
|
"license": "MIT",
|
|
6
7
|
"contributors": [
|
|
7
8
|
{
|
|
@@ -226,6 +227,6 @@
|
|
|
226
227
|
},
|
|
227
228
|
"scripts": {},
|
|
228
229
|
"dependencies": {},
|
|
229
|
-
"typesPublisherContentHash": "
|
|
230
|
-
"typeScriptVersion": "3.
|
|
230
|
+
"typesPublisherContentHash": "c5eebcafad4271376ee5a2d516756464cef353232ac06db91239887b14f7f29a",
|
|
231
|
+
"typeScriptVersion": "3.6"
|
|
231
232
|
}
|
node/perf_hooks.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ declare module 'perf_hooks' {
|
|
|
3
3
|
|
|
4
4
|
type EntryType = 'node' | 'mark' | 'measure' | 'gc' | 'function' | 'http2' | 'http';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
class PerformanceEntry {
|
|
7
|
+
protected constructor();
|
|
7
8
|
/**
|
|
8
9
|
* The total number of milliseconds elapsed for this entry.
|
|
9
10
|
* This value will not be meaningful for all Performance Entry types.
|
|
@@ -41,7 +42,7 @@ declare module 'perf_hooks' {
|
|
|
41
42
|
readonly flags?: number;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
class PerformanceNodeTiming extends PerformanceEntry {
|
|
45
46
|
/**
|
|
46
47
|
* The high resolution millisecond timestamp at which the Node.js process completed bootstrap.
|
|
47
48
|
*/
|
|
@@ -88,7 +89,10 @@ declare module 'perf_hooks' {
|
|
|
88
89
|
* @param util1 The result of a previous call to eventLoopUtilization()
|
|
89
90
|
* @param util2 The result of a previous call to eventLoopUtilization() prior to util1
|
|
90
91
|
*/
|
|
91
|
-
type EventLoopUtilityFunction = (
|
|
92
|
+
type EventLoopUtilityFunction = (
|
|
93
|
+
util1?: EventLoopUtilization,
|
|
94
|
+
util2?: EventLoopUtilization,
|
|
95
|
+
) => EventLoopUtilization;
|
|
92
96
|
|
|
93
97
|
interface Performance {
|
|
94
98
|
/**
|
|
@@ -122,7 +126,7 @@ declare module 'perf_hooks' {
|
|
|
122
126
|
* @param startMark
|
|
123
127
|
* @param endMark
|
|
124
128
|
*/
|
|
125
|
-
measure(name: string, startMark
|
|
129
|
+
measure(name: string, startMark?: string, endMark?: string): void;
|
|
126
130
|
|
|
127
131
|
/**
|
|
128
132
|
* An instance of the PerformanceNodeTiming class that provides performance metrics for specific Node.js operational milestones.
|
|
@@ -218,15 +222,36 @@ declare module 'perf_hooks' {
|
|
|
218
222
|
resolution?: number;
|
|
219
223
|
}
|
|
220
224
|
|
|
221
|
-
interface
|
|
225
|
+
interface Histogram {
|
|
222
226
|
/**
|
|
223
|
-
*
|
|
227
|
+
* A `Map` object detailing the accumulated percentile distribution.
|
|
224
228
|
*/
|
|
225
|
-
|
|
229
|
+
readonly percentiles: Map<number, number>;
|
|
230
|
+
|
|
226
231
|
/**
|
|
227
|
-
*
|
|
232
|
+
* The number of times the event loop delay exceeded the maximum 1 hour eventloop delay threshold.
|
|
228
233
|
*/
|
|
229
|
-
|
|
234
|
+
readonly exceeds: number;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* The minimum recorded event loop delay.
|
|
238
|
+
*/
|
|
239
|
+
readonly min: number;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* The maximum recorded event loop delay.
|
|
243
|
+
*/
|
|
244
|
+
readonly max: number;
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* The mean of the recorded event loop delays.
|
|
248
|
+
*/
|
|
249
|
+
readonly mean: number;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* The standard deviation of the recorded event loop delays.
|
|
253
|
+
*/
|
|
254
|
+
readonly stddev: number;
|
|
230
255
|
|
|
231
256
|
/**
|
|
232
257
|
* Resets the collected histogram data.
|
|
@@ -238,37 +263,48 @@ declare module 'perf_hooks' {
|
|
|
238
263
|
* @param percentile A percentile value between 1 and 100.
|
|
239
264
|
*/
|
|
240
265
|
percentile(percentile: number): number;
|
|
266
|
+
}
|
|
241
267
|
|
|
268
|
+
interface IntervalHistogram extends Histogram {
|
|
242
269
|
/**
|
|
243
|
-
*
|
|
270
|
+
* Enables the event loop delay sample timer. Returns `true` if the timer was started, `false` if it was already started.
|
|
244
271
|
*/
|
|
245
|
-
|
|
246
|
-
|
|
272
|
+
enable(): boolean;
|
|
247
273
|
/**
|
|
248
|
-
*
|
|
274
|
+
* Disables the event loop delay sample timer. Returns `true` if the timer was stopped, `false` if it was already stopped.
|
|
249
275
|
*/
|
|
250
|
-
|
|
276
|
+
disable(): boolean;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
interface RecordableHistogram extends Histogram {
|
|
280
|
+
record(val: number | bigint): void;
|
|
251
281
|
|
|
252
282
|
/**
|
|
253
|
-
*
|
|
283
|
+
* Calculates the amount of time (in nanoseconds) that has passed since the previous call to recordDelta() and records that amount in the histogram.
|
|
254
284
|
*/
|
|
255
|
-
|
|
285
|
+
recordDelta(): void;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function monitorEventLoopDelay(options?: EventLoopMonitorOptions): IntervalHistogram;
|
|
256
289
|
|
|
290
|
+
interface CreateHistogramOptions {
|
|
257
291
|
/**
|
|
258
|
-
* The
|
|
292
|
+
* The minimum recordable value. Must be an integer value greater than 0.
|
|
293
|
+
* @default 1
|
|
259
294
|
*/
|
|
260
|
-
|
|
295
|
+
min?: number | bigint;
|
|
261
296
|
|
|
262
297
|
/**
|
|
263
|
-
* The
|
|
298
|
+
* The maximum recordable value. Must be an integer value greater than min.
|
|
299
|
+
* @default Number.MAX_SAFE_INTEGER
|
|
264
300
|
*/
|
|
265
|
-
|
|
266
|
-
|
|
301
|
+
max?: number | bigint;
|
|
267
302
|
/**
|
|
268
|
-
* The
|
|
303
|
+
* The number of accuracy digits. Must be a number between 1 and 5.
|
|
304
|
+
* @default 3
|
|
269
305
|
*/
|
|
270
|
-
|
|
306
|
+
figures?: number;
|
|
271
307
|
}
|
|
272
308
|
|
|
273
|
-
function
|
|
309
|
+
function createHistogram(options?: CreateHistogramOptions): RecordableHistogram;
|
|
274
310
|
}
|
node/process.d.ts
CHANGED
|
@@ -336,7 +336,7 @@ declare module 'process' {
|
|
|
336
336
|
|
|
337
337
|
/**
|
|
338
338
|
* The `process.allowedNodeEnvironmentFlags` property is a special,
|
|
339
|
-
* read-only `Set` of flags allowable within the
|
|
339
|
+
* read-only `Set` of flags allowable within the `NODE_OPTIONS`
|
|
340
340
|
* environment variable.
|
|
341
341
|
*/
|
|
342
342
|
allowedNodeEnvironmentFlags: ReadonlySet<string>;
|
node/readline.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare module 'readline' {
|
|
2
|
-
import EventEmitter
|
|
2
|
+
import { Abortable, EventEmitter } from 'events';
|
|
3
3
|
|
|
4
4
|
interface Key {
|
|
5
5
|
sequence?: string;
|
|
@@ -42,6 +42,7 @@ declare module 'readline' {
|
|
|
42
42
|
setPrompt(prompt: string): void;
|
|
43
43
|
prompt(preserveCursor?: boolean): void;
|
|
44
44
|
question(query: string, callback: (answer: string) => void): void;
|
|
45
|
+
question(query: string, options: Abortable, callback: (answer: string) => void): void;
|
|
45
46
|
pause(): this;
|
|
46
47
|
resume(): this;
|
|
47
48
|
close(): void;
|
|
@@ -63,8 +64,8 @@ declare module 'readline' {
|
|
|
63
64
|
* 5. SIGCONT
|
|
64
65
|
* 6. SIGINT
|
|
65
66
|
* 7. SIGTSTP
|
|
67
|
+
* 8. history
|
|
66
68
|
*/
|
|
67
|
-
|
|
68
69
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
69
70
|
addListener(event: "close", listener: () => void): this;
|
|
70
71
|
addListener(event: "line", listener: (input: string) => void): this;
|
|
@@ -73,6 +74,7 @@ declare module 'readline' {
|
|
|
73
74
|
addListener(event: "SIGCONT", listener: () => void): this;
|
|
74
75
|
addListener(event: "SIGINT", listener: () => void): this;
|
|
75
76
|
addListener(event: "SIGTSTP", listener: () => void): this;
|
|
77
|
+
addListener(event: "history", listener: (history: string[]) => void): this;
|
|
76
78
|
|
|
77
79
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
78
80
|
emit(event: "close"): boolean;
|
|
@@ -82,6 +84,7 @@ declare module 'readline' {
|
|
|
82
84
|
emit(event: "SIGCONT"): boolean;
|
|
83
85
|
emit(event: "SIGINT"): boolean;
|
|
84
86
|
emit(event: "SIGTSTP"): boolean;
|
|
87
|
+
emit(event: "history", history: string[]): boolean;
|
|
85
88
|
|
|
86
89
|
on(event: string, listener: (...args: any[]) => void): this;
|
|
87
90
|
on(event: "close", listener: () => void): this;
|
|
@@ -91,6 +94,7 @@ declare module 'readline' {
|
|
|
91
94
|
on(event: "SIGCONT", listener: () => void): this;
|
|
92
95
|
on(event: "SIGINT", listener: () => void): this;
|
|
93
96
|
on(event: "SIGTSTP", listener: () => void): this;
|
|
97
|
+
on(event: "history", listener: (history: string[]) => void): this;
|
|
94
98
|
|
|
95
99
|
once(event: string, listener: (...args: any[]) => void): this;
|
|
96
100
|
once(event: "close", listener: () => void): this;
|
|
@@ -100,6 +104,7 @@ declare module 'readline' {
|
|
|
100
104
|
once(event: "SIGCONT", listener: () => void): this;
|
|
101
105
|
once(event: "SIGINT", listener: () => void): this;
|
|
102
106
|
once(event: "SIGTSTP", listener: () => void): this;
|
|
107
|
+
once(event: "history", listener: (history: string[]) => void): this;
|
|
103
108
|
|
|
104
109
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
105
110
|
prependListener(event: "close", listener: () => void): this;
|
|
@@ -109,6 +114,7 @@ declare module 'readline' {
|
|
|
109
114
|
prependListener(event: "SIGCONT", listener: () => void): this;
|
|
110
115
|
prependListener(event: "SIGINT", listener: () => void): this;
|
|
111
116
|
prependListener(event: "SIGTSTP", listener: () => void): this;
|
|
117
|
+
prependListener(event: "history", listener: (history: string[]) => void): this;
|
|
112
118
|
|
|
113
119
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
114
120
|
prependOnceListener(event: "close", listener: () => void): this;
|
|
@@ -118,6 +124,8 @@ declare module 'readline' {
|
|
|
118
124
|
prependOnceListener(event: "SIGCONT", listener: () => void): this;
|
|
119
125
|
prependOnceListener(event: "SIGINT", listener: () => void): this;
|
|
120
126
|
prependOnceListener(event: "SIGTSTP", listener: () => void): this;
|
|
127
|
+
prependOnceListener(event: "history", listener: (history: string[]) => void): this;
|
|
128
|
+
|
|
121
129
|
[Symbol.asyncIterator](): AsyncIterableIterator<string>;
|
|
122
130
|
}
|
|
123
131
|
|
|
@@ -133,9 +141,22 @@ declare module 'readline' {
|
|
|
133
141
|
output?: NodeJS.WritableStream;
|
|
134
142
|
completer?: Completer | AsyncCompleter;
|
|
135
143
|
terminal?: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Initial list of history lines. This option makes sense
|
|
146
|
+
* only if `terminal` is set to `true` by the user or by an internal `output`
|
|
147
|
+
* check, otherwise the history caching mechanism is not initialized at all.
|
|
148
|
+
* @default []
|
|
149
|
+
*/
|
|
150
|
+
history?: string[];
|
|
136
151
|
historySize?: number;
|
|
137
152
|
prompt?: string;
|
|
138
153
|
crlfDelay?: number;
|
|
154
|
+
/**
|
|
155
|
+
* If `true`, when a new input line added
|
|
156
|
+
* to the history list duplicates an older one, this removes the older line
|
|
157
|
+
* from the list.
|
|
158
|
+
* @default false
|
|
159
|
+
*/
|
|
139
160
|
removeHistoryDuplicates?: boolean;
|
|
140
161
|
escapeCodeTimeout?: number;
|
|
141
162
|
tabSize?: number;
|
node/stream.d.ts
CHANGED
|
@@ -301,7 +301,7 @@ declare module 'stream' {
|
|
|
301
301
|
*/
|
|
302
302
|
function addAbortSignal<T extends Stream>(signal: AbortSignal, stream: T): T;
|
|
303
303
|
|
|
304
|
-
interface FinishedOptions {
|
|
304
|
+
interface FinishedOptions extends Abortable {
|
|
305
305
|
error?: boolean;
|
|
306
306
|
readable?: boolean;
|
|
307
307
|
writable?: boolean;
|
node/timers/promises.d.ts
CHANGED
|
@@ -3,11 +3,19 @@ declare module 'timers/promises' {
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Returns a promise that resolves after the specified delay in milliseconds.
|
|
6
|
+
* @param delay defaults to 1
|
|
6
7
|
*/
|
|
7
|
-
function setTimeout<T>(delay
|
|
8
|
+
function setTimeout<T = void>(delay?: number, value?: T, options?: TimerOptions): Promise<T>;
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Returns a promise that resolves in the next tick.
|
|
11
12
|
*/
|
|
12
|
-
function setImmediate<T>(value
|
|
13
|
+
function setImmediate<T = void>(value?: T, options?: TimerOptions): Promise<T>;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* Returns an async iterator that generates values in an interval of delay ms.
|
|
18
|
+
* @param delay defaults to 1
|
|
19
|
+
*/
|
|
20
|
+
function setInterval<T = void>(delay?: number, value?: T, options?: TimerOptions): AsyncIterable<T>;
|
|
13
21
|
}
|
node/timers.d.ts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
declare module 'timers' {
|
|
2
|
-
|
|
2
|
+
import { Abortable } from 'events';
|
|
3
|
+
|
|
4
|
+
interface TimerOptions extends Abortable {
|
|
3
5
|
/**
|
|
4
6
|
* Set to `false` to indicate that the scheduled `Timeout`
|
|
5
7
|
* should not require the Node.js event loop to remain active.
|
|
6
8
|
* @default true
|
|
7
9
|
*/
|
|
8
10
|
ref?: boolean;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* An optional `AbortSignal` that can be used to cancel the scheduled `Timeout`.
|
|
12
|
-
*/
|
|
13
|
-
signal?: AbortSignal;
|
|
14
11
|
}
|
|
15
12
|
|
|
16
13
|
function setTimeout(callback: (...args: any[]) => void, ms?: number, ...args: any[]): NodeJS.Timeout;
|
node/tls.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
declare module 'tls' {
|
|
2
|
+
import { X509Certificate } from 'crypto';
|
|
2
3
|
import * as net from 'net';
|
|
3
4
|
|
|
4
5
|
const CLIENT_RENEG_LIMIT: number;
|
|
@@ -295,6 +296,16 @@ declare module 'tls' {
|
|
|
295
296
|
*/
|
|
296
297
|
enableTrace(): void;
|
|
297
298
|
|
|
299
|
+
/**
|
|
300
|
+
* If there is no peer certificate, or the socket has been destroyed, `undefined` will be returned.
|
|
301
|
+
*/
|
|
302
|
+
getPeerX509Certificate(): X509Certificate | undefined;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* If there is no local certificate, or the socket has been destroyed, `undefined` will be returned.
|
|
306
|
+
*/
|
|
307
|
+
getX509Certificate(): X509Certificate | undefined;
|
|
308
|
+
|
|
298
309
|
/**
|
|
299
310
|
* @param length number of bytes to retrieve from keying material
|
|
300
311
|
* @param label an application specific label, typically this will be a value from the
|
node/ts3.6/base.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// NOTE: TypeScript version-specific augmentations can be found in the following paths:
|
|
4
4
|
// - ~/base.d.ts - Shared definitions common to all TypeScript versions
|
|
5
5
|
// - ~/index.d.ts - Definitions specific to TypeScript 3.7 and above
|
|
6
|
-
// - ~/ts3.
|
|
7
|
-
// - ~/ts3.
|
|
6
|
+
// - ~/ts3.6/base.d.ts - Definitions specific to TypeScript 3.6 and earlier
|
|
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
10
|
/// <reference lib="es2018" />
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
/// <reference path="../worker_threads.d.ts" />
|
|
62
62
|
/// <reference path="../zlib.d.ts" />
|
|
63
63
|
|
|
64
|
-
// TypeScript 3.
|
|
64
|
+
// TypeScript 3.6-specific augmentations:
|
|
65
65
|
/// <reference path="../globals.global.d.ts" />
|
|
66
66
|
|
|
67
|
-
// TypeScript 3.
|
|
67
|
+
// TypeScript 3.6-specific augmentations:
|
|
68
68
|
/// <reference path="../wasi.d.ts" />
|
node/ts3.6/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// NOTE: These definitions support NodeJS and TypeScript 3.
|
|
1
|
+
// NOTE: These definitions support NodeJS and TypeScript 3.6.
|
|
2
2
|
// This is required to enable typing assert in ts3.7 without causing errors
|
|
3
3
|
// Typically type modifications should be made in base.d.ts instead of here
|
|
4
4
|
|
node/wasi.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ declare module 'wasi' {
|
|
|
58
58
|
* invoke the `__wasi_unstable_reactor_start()` export. If neither of those exports
|
|
59
59
|
* is present on `instance`, then `start()` does nothing.
|
|
60
60
|
*
|
|
61
|
-
* `start()` requires that `instance` exports a
|
|
61
|
+
* `start()` requires that `instance` exports a `WebAssembly.Memory` named
|
|
62
62
|
* `memory`. If `instance` does not have a `memory` export an exception is thrown.
|
|
63
63
|
*
|
|
64
64
|
* If `start()` is called more than once, an exception is thrown.
|
|
@@ -69,7 +69,7 @@ declare module 'wasi' {
|
|
|
69
69
|
* Attempt to initialize `instance` as a WASI reactor by invoking its `_initialize()` export, if it is present.
|
|
70
70
|
* If `instance` contains a `_start()` export, then an exception is thrown.
|
|
71
71
|
*
|
|
72
|
-
* `start()` requires that `instance` exports a
|
|
72
|
+
* `start()` requires that `instance` exports a `WebAssembly.Memory` named
|
|
73
73
|
* `memory`. If `instance` does not have a `memory` export an exception is thrown.
|
|
74
74
|
*
|
|
75
75
|
* If `initialize()` is called more than once, an exception is thrown.
|
|
@@ -79,7 +79,7 @@ declare module 'wasi' {
|
|
|
79
79
|
/**
|
|
80
80
|
* Is an object that implements the WASI system call API. This object
|
|
81
81
|
* should be passed as the `wasi_snapshot_preview1` import during the instantiation of a
|
|
82
|
-
*
|
|
82
|
+
* `WebAssembly.Instance`.
|
|
83
83
|
*/
|
|
84
84
|
readonly wasiImport: NodeJS.Dict<any>; // TODO: Narrow to DOM types
|
|
85
85
|
}
|
node/worker_threads.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
declare module 'worker_threads' {
|
|
2
|
+
import { Blob } from 'node:buffer';
|
|
2
3
|
import { Context } from 'vm';
|
|
3
4
|
import { EventEmitter } from 'events';
|
|
4
5
|
import { EventLoopUtilityFunction } from 'perf_hooks';
|
|
@@ -23,7 +24,7 @@ declare module 'worker_threads' {
|
|
|
23
24
|
eventLoopUtilization: EventLoopUtilityFunction;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
type TransferListItem = ArrayBuffer | MessagePort | FileHandle | X509Certificate;
|
|
27
|
+
type TransferListItem = ArrayBuffer | MessagePort | FileHandle | X509Certificate | Blob;
|
|
27
28
|
|
|
28
29
|
class MessagePort extends EventEmitter {
|
|
29
30
|
close(): void;
|
|
@@ -145,11 +146,11 @@ declare module 'worker_threads' {
|
|
|
145
146
|
|
|
146
147
|
/**
|
|
147
148
|
* Returns a readable stream for a V8 snapshot of the current state of the Worker.
|
|
148
|
-
* See
|
|
149
|
+
* See `v8.getHeapSnapshot()` for more details.
|
|
149
150
|
*
|
|
150
151
|
* If the Worker thread is no longer running, which may occur before the
|
|
151
|
-
*
|
|
152
|
-
* immediately with an
|
|
152
|
+
* `'exit'` event is emitted, the returned `Promise` will be rejected
|
|
153
|
+
* immediately with an `ERR_WORKER_NOT_RUNNING` error
|
|
153
154
|
*/
|
|
154
155
|
getHeapSnapshot(): Promise<Readable>;
|
|
155
156
|
|
|
@@ -261,4 +262,21 @@ declare module 'worker_threads' {
|
|
|
261
262
|
* `MessagePort`’s queue.
|
|
262
263
|
*/
|
|
263
264
|
function receiveMessageOnPort(port: MessagePort): { message: any } | undefined;
|
|
265
|
+
|
|
266
|
+
type Serializable = string | object | number | boolean | bigint;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* @param key Any arbitrary, cloneable JavaScript value that can be used as a {Map} key.
|
|
270
|
+
* @experimental
|
|
271
|
+
*/
|
|
272
|
+
function getEnvironmentData(key: Serializable): Serializable;
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* @param key Any arbitrary, cloneable JavaScript value that can be used as a {Map} key.
|
|
276
|
+
* @param value Any arbitrary, cloneable JavaScript value that will be cloned
|
|
277
|
+
* and passed automatically to all new `Worker` instances. If `value` is passed
|
|
278
|
+
* as `undefined`, any previously set value for the `key` will be deleted.
|
|
279
|
+
* @experimental
|
|
280
|
+
*/
|
|
281
|
+
function setEnvironmentData(key: Serializable, value: Serializable): void;
|
|
264
282
|
}
|