@types/node 14.11.4 → 14.11.8

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 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: Tue, 06 Oct 2020 00:12:23 GMT
11
+ * Last updated: Fri, 09 Oct 2020 06:51:10 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `Buffer`, `__dirname`, `__filename`, `clearImmediate`, `clearInterval`, `clearTimeout`, `console`, `exports`, `global`, `module`, `process`, `queueMicrotask`, `require`, `setImmediate`, `setInterval`, `setTimeout`
14
14
 
node/assert.d.ts CHANGED
@@ -91,7 +91,29 @@ declare module 'assert' {
91
91
  function match(value: string, regExp: RegExp, message?: string | Error): void;
92
92
  function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
93
93
 
94
- const strict: typeof assert;
94
+ const strict: Omit<
95
+ typeof assert,
96
+ | 'strict'
97
+ | 'deepEqual'
98
+ | 'notDeepEqual'
99
+ | 'equal'
100
+ | 'notEqual'
101
+ | 'ok'
102
+ | 'strictEqual'
103
+ | 'deepStrictEqual'
104
+ | 'ifError'
105
+ > & {
106
+ (value: any, message?: string | Error): asserts value;
107
+ strict: typeof strict;
108
+ deepEqual: typeof deepStrictEqual;
109
+ notDeepEqual: typeof notDeepStrictEqual;
110
+ equal: typeof strictEqual;
111
+ notEqual: typeof notStrictEqual;
112
+ ok(value: any, message?: string | Error): asserts value;
113
+ strictEqual<T>(actual: any, expected: T, message?: string | Error): asserts actual is T;
114
+ deepStrictEqual<T>(actual: any, expected: T, message?: string | Error): asserts actual is T;
115
+ ifError(value: any): asserts value is null | undefined;
116
+ };
95
117
  }
96
118
 
97
119
  export = assert;
node/crypto.d.ts CHANGED
@@ -278,7 +278,7 @@ declare module "crypto" {
278
278
 
279
279
  function createPrivateKey(key: PrivateKeyInput | string | Buffer): KeyObject;
280
280
  function createPublicKey(key: PublicKeyInput | string | Buffer | KeyObject): KeyObject;
281
- function createSecretKey(key: Buffer): KeyObject;
281
+ function createSecretKey(key: NodeJS.ArrayBufferView): KeyObject;
282
282
 
283
283
  function createSign(algorithm: string, options?: stream.WritableOptions): Signer;
284
284
 
@@ -448,7 +448,7 @@ declare module "crypto" {
448
448
  /** @deprecated since v10.0.0 */
449
449
  const DEFAULT_ENCODING: BufferEncoding;
450
450
 
451
- type KeyType = 'rsa' | 'dsa' | 'ec' | 'ed25519' | 'x25519';
451
+ type KeyType = 'rsa' | 'dsa' | 'ec' | 'ed25519' | 'ed448' | 'x25519' | 'x448';
452
452
  type KeyFormat = 'pem' | 'der';
453
453
 
454
454
  interface BasePrivateKeyEncodingOptions<T extends KeyFormat> {
@@ -468,12 +468,24 @@ declare module "crypto" {
468
468
  */
469
469
  }
470
470
 
471
+ interface ED448KeyPairKeyObjectOptions {
472
+ /**
473
+ * No options.
474
+ */
475
+ }
476
+
471
477
  interface X25519KeyPairKeyObjectOptions {
472
478
  /**
473
479
  * No options.
474
480
  */
475
481
  }
476
482
 
483
+ interface X448KeyPairKeyObjectOptions {
484
+ /**
485
+ * No options.
486
+ */
487
+ }
488
+
477
489
  interface ECKeyPairKeyObjectOptions {
478
490
  /**
479
491
  * Name of the curve to use.
@@ -568,6 +580,16 @@ declare module "crypto" {
568
580
  };
569
581
  }
570
582
 
583
+ interface ED448KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
584
+ publicKeyEncoding: {
585
+ type: 'spki';
586
+ format: PubF;
587
+ };
588
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
589
+ type: 'pkcs8';
590
+ };
591
+ }
592
+
571
593
  interface X25519KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
572
594
  publicKeyEncoding: {
573
595
  type: 'spki';
@@ -578,6 +600,16 @@ declare module "crypto" {
578
600
  };
579
601
  }
580
602
 
603
+ interface X448KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
604
+ publicKeyEncoding: {
605
+ type: 'spki';
606
+ format: PubF;
607
+ };
608
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
609
+ type: 'pkcs8';
610
+ };
611
+ }
612
+
581
613
  interface KeyPairSyncResult<T1 extends string | Buffer, T2 extends string | Buffer> {
582
614
  publicKey: T1;
583
615
  privateKey: T2;
@@ -605,13 +637,25 @@ declare module "crypto" {
605
637
  function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
606
638
  function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
607
639
  function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
608
- function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
640
+ function generateKeyPairSync(type: 'ed25519', options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
641
+
642
+ function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
643
+ function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
644
+ function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
645
+ function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
646
+ function generateKeyPairSync(type: 'ed448', options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
609
647
 
610
648
  function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
611
649
  function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
612
650
  function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
613
651
  function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
614
- function generateKeyPairSync(type: 'x25519', options: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
652
+ function generateKeyPairSync(type: 'x25519', options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
653
+
654
+ function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult<string, string>;
655
+ function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'pem', 'der'>): KeyPairSyncResult<string, Buffer>;
656
+ function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'der', 'pem'>): KeyPairSyncResult<Buffer, string>;
657
+ function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'der', 'der'>): KeyPairSyncResult<Buffer, Buffer>;
658
+ function generateKeyPairSync(type: 'x448', options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
615
659
 
616
660
  function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
617
661
  function generateKeyPair(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
@@ -635,13 +679,25 @@ declare module "crypto" {
635
679
  function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
636
680
  function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
637
681
  function generateKeyPair(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
638
- function generateKeyPair(type: 'ed25519', options: ED25519KeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
682
+ function generateKeyPair(type: 'ed25519', options: ED25519KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
683
+
684
+ function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
685
+ function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
686
+ function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
687
+ function generateKeyPair(type: 'ed448', options: ED448KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
688
+ function generateKeyPair(type: 'ed448', options: ED448KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
639
689
 
640
690
  function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
641
691
  function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
642
692
  function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
643
693
  function generateKeyPair(type: 'x25519', options: X25519KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
644
- function generateKeyPair(type: 'x25519', options: X25519KeyPairKeyObjectOptions, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
694
+ function generateKeyPair(type: 'x25519', options: X25519KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
695
+
696
+ function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'pem', 'pem'>, callback: (err: Error | null, publicKey: string, privateKey: string) => void): void;
697
+ function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'pem', 'der'>, callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void): void;
698
+ function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'der', 'pem'>, callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void): void;
699
+ function generateKeyPair(type: 'x448', options: X448KeyPairOptions<'der', 'der'>, callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void): void;
700
+ function generateKeyPair(type: 'x448', options: X448KeyPairKeyObjectOptions | undefined, callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void): void;
645
701
 
646
702
  namespace generateKeyPair {
647
703
  function __promisify__(type: "rsa", options: RSAKeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>;
@@ -666,13 +722,25 @@ declare module "crypto" {
666
722
  function __promisify__(type: "ed25519", options: ED25519KeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>;
667
723
  function __promisify__(type: "ed25519", options: ED25519KeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>;
668
724
  function __promisify__(type: "ed25519", options: ED25519KeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>;
669
- function __promisify__(type: "ed25519", options: ED25519KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
725
+ function __promisify__(type: "ed25519", options?: ED25519KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
726
+
727
+ function __promisify__(type: "ed448", options: ED448KeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>;
728
+ function __promisify__(type: "ed448", options: ED448KeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>;
729
+ function __promisify__(type: "ed448", options: ED448KeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>;
730
+ function __promisify__(type: "ed448", options: ED448KeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>;
731
+ function __promisify__(type: "ed448", options?: ED448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
670
732
 
671
733
  function __promisify__(type: "x25519", options: X25519KeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>;
672
734
  function __promisify__(type: "x25519", options: X25519KeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>;
673
735
  function __promisify__(type: "x25519", options: X25519KeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>;
674
736
  function __promisify__(type: "x25519", options: X25519KeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>;
675
- function __promisify__(type: "x25519", options: X25519KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
737
+ function __promisify__(type: "x25519", options?: X25519KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
738
+
739
+ function __promisify__(type: "x448", options: X448KeyPairOptions<'pem', 'pem'>): Promise<{ publicKey: string, privateKey: string }>;
740
+ function __promisify__(type: "x448", options: X448KeyPairOptions<'pem', 'der'>): Promise<{ publicKey: string, privateKey: Buffer }>;
741
+ function __promisify__(type: "x448", options: X448KeyPairOptions<'der', 'pem'>): Promise<{ publicKey: Buffer, privateKey: string }>;
742
+ function __promisify__(type: "x448", options: X448KeyPairOptions<'der', 'der'>): Promise<{ publicKey: Buffer, privateKey: Buffer }>;
743
+ function __promisify__(type: "x448", options?: X448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
676
744
  }
677
745
 
678
746
  /**
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "14.11.4",
3
+ "version": "14.11.8",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -246,6 +246,6 @@
246
246
  },
247
247
  "scripts": {},
248
248
  "dependencies": {},
249
- "typesPublisherContentHash": "c9f281dca3a2c83d3ec1cb1962cf197c93097f9401920f7d394a27de75625caa",
249
+ "typesPublisherContentHash": "2648fdcf6d0b183d3a081cb17833d47c55084f5245aa4f9a8ea246ed71a45a8b",
250
250
  "typeScriptVersion": "3.2"
251
251
  }
node/punycode.d.ts CHANGED
@@ -1,12 +1,68 @@
1
1
  declare module "punycode" {
2
+ /**
3
+ * @deprecated since v7.0.0
4
+ * The version of the punycode module bundled in Node.js is being deprecated.
5
+ * In a future major version of Node.js this module will be removed.
6
+ * Users currently depending on the punycode module should switch to using
7
+ * the userland-provided Punycode.js module instead.
8
+ */
2
9
  function decode(string: string): string;
10
+ /**
11
+ * @deprecated since v7.0.0
12
+ * The version of the punycode module bundled in Node.js is being deprecated.
13
+ * In a future major version of Node.js this module will be removed.
14
+ * Users currently depending on the punycode module should switch to using
15
+ * the userland-provided Punycode.js module instead.
16
+ */
3
17
  function encode(string: string): string;
18
+ /**
19
+ * @deprecated since v7.0.0
20
+ * The version of the punycode module bundled in Node.js is being deprecated.
21
+ * In a future major version of Node.js this module will be removed.
22
+ * Users currently depending on the punycode module should switch to using
23
+ * the userland-provided Punycode.js module instead.
24
+ */
4
25
  function toUnicode(domain: string): string;
26
+ /**
27
+ * @deprecated since v7.0.0
28
+ * The version of the punycode module bundled in Node.js is being deprecated.
29
+ * In a future major version of Node.js this module will be removed.
30
+ * Users currently depending on the punycode module should switch to using
31
+ * the userland-provided Punycode.js module instead.
32
+ */
5
33
  function toASCII(domain: string): string;
34
+ /**
35
+ * @deprecated since v7.0.0
36
+ * The version of the punycode module bundled in Node.js is being deprecated.
37
+ * In a future major version of Node.js this module will be removed.
38
+ * Users currently depending on the punycode module should switch to using
39
+ * the userland-provided Punycode.js module instead.
40
+ */
6
41
  const ucs2: ucs2;
7
42
  interface ucs2 {
43
+ /**
44
+ * @deprecated since v7.0.0
45
+ * The version of the punycode module bundled in Node.js is being deprecated.
46
+ * In a future major version of Node.js this module will be removed.
47
+ * Users currently depending on the punycode module should switch to using
48
+ * the userland-provided Punycode.js module instead.
49
+ */
8
50
  decode(string: string): number[];
51
+ /**
52
+ * @deprecated since v7.0.0
53
+ * The version of the punycode module bundled in Node.js is being deprecated.
54
+ * In a future major version of Node.js this module will be removed.
55
+ * Users currently depending on the punycode module should switch to using
56
+ * the userland-provided Punycode.js module instead.
57
+ */
9
58
  encode(codePoints: number[]): string;
10
59
  }
60
+ /**
61
+ * @deprecated since v7.0.0
62
+ * The version of the punycode module bundled in Node.js is being deprecated.
63
+ * In a future major version of Node.js this module will be removed.
64
+ * Users currently depending on the punycode module should switch to using
65
+ * the userland-provided Punycode.js module instead.
66
+ */
11
67
  const version: string;
12
68
  }
node/wasi.d.ts CHANGED
@@ -6,11 +6,13 @@ declare module 'wasi' {
6
6
  * WASI command itself.
7
7
  */
8
8
  args?: string[];
9
+
9
10
  /**
10
11
  * An object similar to `process.env` that the WebAssembly
11
12
  * application will see as its environment.
12
13
  */
13
14
  env?: object;
15
+
14
16
  /**
15
17
  * This object represents the WebAssembly application's
16
18
  * sandbox directory structure. The string keys of `preopens` are treated as
@@ -27,6 +29,24 @@ declare module 'wasi' {
27
29
  * @default false
28
30
  */
29
31
  returnOnExit?: boolean;
32
+
33
+ /**
34
+ * The file descriptor used as standard input in the WebAssembly application.
35
+ * @default 0
36
+ */
37
+ stdin?: number;
38
+
39
+ /**
40
+ * The file descriptor used as standard output in the WebAssembly application.
41
+ * @default 1
42
+ */
43
+ stdout?: number;
44
+
45
+ /**
46
+ * The file descriptor used as standard error in the WebAssembly application.
47
+ * @default 2
48
+ */
49
+ stderr?: number;
30
50
  }
31
51
 
32
52
  class WASI {
@@ -40,11 +60,25 @@ declare module 'wasi' {
40
60
  *
41
61
  * `start()` requires that `instance` exports a [`WebAssembly.Memory`][] named
42
62
  * `memory`. If `instance` does not have a `memory` export an exception is thrown.
63
+ *
64
+ * If `start()` is called more than once, an exception is thrown.
43
65
  */
44
66
  start(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib.
67
+
68
+ /**
69
+ * Attempt to initialize `instance` as a WASI reactor by invoking its `_initialize()` export, if it is present.
70
+ * If `instance` contains a `_start()` export, then an exception is thrown.
71
+ *
72
+ * `start()` requires that `instance` exports a [`WebAssembly.Memory`][] named
73
+ * `memory`. If `instance` does not have a `memory` export an exception is thrown.
74
+ *
75
+ * If `initialize()` is called more than once, an exception is thrown.
76
+ */
77
+ initialize(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib.
78
+
45
79
  /**
46
80
  * Is an object that implements the WASI system call API. This object
47
- * should be passed as the `wasi_unstable` import during the instantiation of a
81
+ * should be passed as the `wasi_snapshot_preview1` import during the instantiation of a
48
82
  * [`WebAssembly.Instance`][].
49
83
  */
50
84
  readonly wasiImport: NodeJS.Dict<any>; // TODO: Narrow to DOM types
node/worker_threads.d.ts CHANGED
@@ -3,9 +3,11 @@ declare module "worker_threads" {
3
3
  import { EventEmitter } from "events";
4
4
  import { Readable, Writable } from "stream";
5
5
  import { URL } from "url";
6
+ import { FileHandle } from "fs/promises";
6
7
 
7
8
  const isMainThread: boolean;
8
9
  const parentPort: null | MessagePort;
10
+ const resourceLimits: ResourceLimits;
9
11
  const SHARE_ENV: unique symbol;
10
12
  const threadId: number;
11
13
  const workerData: any;
@@ -15,43 +17,53 @@ declare module "worker_threads" {
15
17
  readonly port2: MessagePort;
16
18
  }
17
19
 
20
+ type TransferListItem = ArrayBuffer | MessagePort | FileHandle;
21
+
18
22
  class MessagePort extends EventEmitter {
19
23
  close(): void;
20
- postMessage(value: any, transferList?: Array<ArrayBuffer | MessagePort>): void;
24
+ postMessage(value: any, transferList?: TransferListItem[]): void;
21
25
  ref(): void;
22
26
  unref(): void;
23
27
  start(): void;
24
28
 
25
29
  addListener(event: "close", listener: () => void): this;
26
30
  addListener(event: "message", listener: (value: any) => void): this;
31
+ addListener(event: "messageerror", listener: (error: Error) => void): this;
27
32
  addListener(event: string | symbol, listener: (...args: any[]) => void): this;
28
33
 
29
34
  emit(event: "close"): boolean;
30
35
  emit(event: "message", value: any): boolean;
36
+ emit(event: "messageerror", error: Error): boolean;
31
37
  emit(event: string | symbol, ...args: any[]): boolean;
32
38
 
33
39
  on(event: "close", listener: () => void): this;
34
40
  on(event: "message", listener: (value: any) => void): this;
41
+ on(event: "messageerror", listener: (error: Error) => void): this;
35
42
  on(event: string | symbol, listener: (...args: any[]) => void): this;
36
43
 
37
44
  once(event: "close", listener: () => void): this;
38
45
  once(event: "message", listener: (value: any) => void): this;
46
+ once(event: "messageerror", listener: (error: Error) => void): this;
39
47
  once(event: string | symbol, listener: (...args: any[]) => void): this;
40
48
 
41
49
  prependListener(event: "close", listener: () => void): this;
42
50
  prependListener(event: "message", listener: (value: any) => void): this;
51
+ prependListener(event: "messageerror", listener: (error: Error) => void): this;
43
52
  prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
44
53
 
45
54
  prependOnceListener(event: "close", listener: () => void): this;
46
55
  prependOnceListener(event: "message", listener: (value: any) => void): this;
56
+ prependOnceListener(event: "messageerror", listener: (error: Error) => void): this;
47
57
  prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
48
58
 
49
59
  removeListener(event: "close", listener: () => void): this;
50
60
  removeListener(event: "message", listener: (value: any) => void): this;
61
+ removeListener(event: "messageerror", listener: (error: Error) => void): this;
51
62
  removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
52
63
 
53
64
  off(event: "close", listener: () => void): this;
54
65
  off(event: "message", listener: (value: any) => void): this;
66
+ off(event: "messageerror", listener: (error: Error) => void): this;
55
67
  off(event: string | symbol, listener: (...args: any[]) => void): this;
56
68
  }
57
69
 
@@ -74,14 +86,28 @@ declare module "worker_threads" {
74
86
  /**
75
87
  * Additional data to send in the first worker message.
76
88
  */
77
- transferList?: Array<ArrayBuffer | MessagePort>;
89
+ transferList?: TransferListItem[];
78
90
  trackUnmanagedFds?: boolean;
79
91
  }
80
92
 
81
93
  interface ResourceLimits {
94
+ /**
95
+ * The maximum size of a heap space for recently created objects.
96
+ */
82
97
  maxYoungGenerationSizeMb?: number;
98
+ /**
99
+ * The maximum size of the main heap in MB.
100
+ */
83
101
  maxOldGenerationSizeMb?: number;
102
+ /**
103
+ * The size of a pre-allocated memory range used for generated code.
104
+ */
84
105
  codeRangeSizeMb?: number;
106
+ /**
107
+ * The default maximum stack size for the thread. Small values may lead to unusable Worker instances.
108
+ * @default 4
109
+ */
110
+ stackSizeMb?: number;
85
111
  }
86
112
 
87
113
  class Worker extends EventEmitter {
@@ -98,7 +124,7 @@ declare module "worker_threads" {
98
124
  */
99
125
  constructor(filename: string | URL, options?: WorkerOptions);
100
126
 
101
- postMessage(value: any, transferList?: Array<ArrayBuffer | MessagePort>): void;
127
+ postMessage(value: any, transferList?: TransferListItem[]): void;
102
128
  ref(): void;
103
129
  unref(): void;
104
130
  /**
@@ -120,52 +146,72 @@ declare module "worker_threads" {
120
146
  addListener(event: "error", listener: (err: Error) => void): this;
121
147
  addListener(event: "exit", listener: (exitCode: number) => void): this;
122
148
  addListener(event: "message", listener: (value: any) => void): this;
149
+ addListener(event: "messageerror", listener: (error: Error) => void): this;
123
150
  addListener(event: "online", listener: () => void): this;
124
151
  addListener(event: string | symbol, listener: (...args: any[]) => void): this;
125
152
 
126
153
  emit(event: "error", err: Error): boolean;
127
154
  emit(event: "exit", exitCode: number): boolean;
128
155
  emit(event: "message", value: any): boolean;
156
+ emit(event: "messageerror", error: Error): boolean;
129
157
  emit(event: "online"): boolean;
130
158
  emit(event: string | symbol, ...args: any[]): boolean;
131
159
 
132
160
  on(event: "error", listener: (err: Error) => void): this;
133
161
  on(event: "exit", listener: (exitCode: number) => void): this;
134
162
  on(event: "message", listener: (value: any) => void): this;
163
+ on(event: "messageerror", listener: (error: Error) => void): this;
135
164
  on(event: "online", listener: () => void): this;
136
165
  on(event: string | symbol, listener: (...args: any[]) => void): this;
137
166
 
138
167
  once(event: "error", listener: (err: Error) => void): this;
139
168
  once(event: "exit", listener: (exitCode: number) => void): this;
140
169
  once(event: "message", listener: (value: any) => void): this;
170
+ once(event: "messageerror", listener: (error: Error) => void): this;
141
171
  once(event: "online", listener: () => void): this;
142
172
  once(event: string | symbol, listener: (...args: any[]) => void): this;
143
173
 
144
174
  prependListener(event: "error", listener: (err: Error) => void): this;
145
175
  prependListener(event: "exit", listener: (exitCode: number) => void): this;
146
176
  prependListener(event: "message", listener: (value: any) => void): this;
177
+ prependListener(event: "messageerror", listener: (error: Error) => void): this;
147
178
  prependListener(event: "online", listener: () => void): this;
148
179
  prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
149
180
 
150
181
  prependOnceListener(event: "error", listener: (err: Error) => void): this;
151
182
  prependOnceListener(event: "exit", listener: (exitCode: number) => void): this;
152
183
  prependOnceListener(event: "message", listener: (value: any) => void): this;
184
+ prependOnceListener(event: "messageerror", listener: (error: Error) => void): this;
153
185
  prependOnceListener(event: "online", listener: () => void): this;
154
186
  prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
155
187
 
156
188
  removeListener(event: "error", listener: (err: Error) => void): this;
157
189
  removeListener(event: "exit", listener: (exitCode: number) => void): this;
158
190
  removeListener(event: "message", listener: (value: any) => void): this;
191
+ removeListener(event: "messageerror", listener: (error: Error) => void): this;
159
192
  removeListener(event: "online", listener: () => void): this;
160
193
  removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
161
194
 
162
195
  off(event: "error", listener: (err: Error) => void): this;
163
196
  off(event: "exit", listener: (exitCode: number) => void): this;
164
197
  off(event: "message", listener: (value: any) => void): this;
198
+ off(event: "messageerror", listener: (error: Error) => void): this;
165
199
  off(event: "online", listener: () => void): this;
166
200
  off(event: string | symbol, listener: (...args: any[]) => void): this;
167
201
  }
168
202
 
203
+ /**
204
+ * Mark an object as not transferable.
205
+ * If `object` occurs in the transfer list of a `port.postMessage()` call, it will be ignored.
206
+ *
207
+ * In particular, this makes sense for objects that can be cloned, rather than transferred,
208
+ * and which are used by other objects on the sending side. For example, Node.js marks
209
+ * the `ArrayBuffer`s it uses for its Buffer pool with this.
210
+ *
211
+ * This operation cannot be undone.
212
+ */
213
+ function markAsUntransferable(object: object): void;
214
+
169
215
  /**
170
216
  * Transfer a `MessagePort` to a different `vm` Context. The original `port`
171
217
  * object will be rendered unusable, and the returned `MessagePort` instance will
node/zlib.d.ts CHANGED
@@ -19,6 +19,8 @@ declare module "zlib" {
19
19
  memLevel?: number; // compression only
20
20
  strategy?: number; // compression only
21
21
  dictionary?: NodeJS.ArrayBufferView | ArrayBuffer; // deflate/inflate only, empty dictionary by default
22
+ info?: boolean;
23
+ maxOutputLength?: number;
22
24
  }
23
25
 
24
26
  interface BrotliOptions {
@@ -40,6 +42,7 @@ declare module "zlib" {
40
42
  */
41
43
  [key: number]: boolean | number;
42
44
  };
45
+ maxOutputLength?: number;
43
46
  }
44
47
 
45
48
  interface Zlib {
@@ -111,6 +114,43 @@ declare module "zlib" {
111
114
  function unzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
112
115
  function unzipSync(buf: InputType, options?: ZlibOptions): Buffer;
113
116
 
117
+ namespace brotliCompress {
118
+ function __promisify__(buffer: InputType, options: BrotliOptions): Promise<Buffer>;
119
+ function __promisify__(buffer: InputType): Promise<Buffer>;
120
+ }
121
+ namespace brotliDecompress {
122
+ function __promisify__(buffer: InputType, options: BrotliOptions): Promise<Buffer>;
123
+ function __promisify__(buffer: InputType): Promise<Buffer>;
124
+ }
125
+ namespace deflate {
126
+ function __promisify__(buffer: InputType): Promise<Buffer>;
127
+ function __promisify__(buffer: InputType, options: ZlibOptions): Promise<Buffer>;
128
+ }
129
+ namespace deflateRaw {
130
+ function __promisify__(buffer: InputType): Promise<Buffer>;
131
+ function __promisify__(buffer: InputType, options: ZlibOptions): Promise<Buffer>;
132
+ }
133
+ namespace gzip {
134
+ function __promisify__(buffer: InputType): Promise<Buffer>;
135
+ function __promisify__(buffer: InputType, options: ZlibOptions): Promise<Buffer>;
136
+ }
137
+ namespace gunzip {
138
+ function __promisify__(buffer: InputType): Promise<Buffer>;
139
+ function __promisify__(buffer: InputType, options: ZlibOptions): Promise<Buffer>;
140
+ }
141
+ namespace inflate {
142
+ function __promisify__(buffer: InputType): Promise<Buffer>;
143
+ function __promisify__(buffer: InputType, options: ZlibOptions): Promise<Buffer>;
144
+ }
145
+ namespace inflateRaw {
146
+ function __promisify__(buffer: InputType): Promise<Buffer>;
147
+ function __promisify__(buffer: InputType, options: ZlibOptions): Promise<Buffer>;
148
+ }
149
+ namespace unzip {
150
+ function __promisify__(buffer: InputType): Promise<Buffer>;
151
+ function __promisify__(buffer: InputType, options: ZlibOptions): Promise<Buffer>;
152
+ }
153
+
114
154
  namespace constants {
115
155
  const BROTLI_DECODE: number;
116
156
  const BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: number;