@types/node 20.16.7 → 20.16.9
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 v20.16/README.md +1 -1
- node v20.16/buffer.d.ts +16 -9
- node v20.16/child_process.d.ts +32 -28
- node v20.16/cluster.d.ts +1 -1
- node v20.16/console.d.ts +2 -2
- node v20.16/crypto.d.ts +3 -3
- node v20.16/dns/promises.d.ts +6 -5
- node v20.16/dns.d.ts +5 -5
- node v20.16/domain.d.ts +2 -2
- node v20.16/fs/promises.d.ts +2 -2
- node v20.16/fs.d.ts +1 -1
- node v20.16/http.d.ts +2 -2
- node v20.16/http2.d.ts +24 -24
- node v20.16/https.d.ts +9 -9
- node v20.16/module.d.ts +3 -3
- node v20.16/net.d.ts +2 -2
- node v20.16/os.d.ts +1 -1
- node v20.16/package.json +2 -2
- node v20.16/path.d.ts +1 -1
- node v20.16/perf_hooks.d.ts +19 -19
- node v20.16/punycode.d.ts +1 -1
- node v20.16/querystring.d.ts +1 -1
- node v20.16/readline/promises.d.ts +1 -1
- node v20.16/readline.d.ts +9 -9
- node v20.16/repl.d.ts +4 -4
- node v20.16/stream.d.ts +15 -15
- node v20.16/string_decoder.d.ts +3 -3
- node v20.16/timers/promises.d.ts +1 -1
- node v20.16/timers.d.ts +1 -1
- node v20.16/tls.d.ts +5 -5
- node v20.16/trace_events.d.ts +4 -4
- node v20.16/tty.d.ts +1 -1
- node v20.16/url.d.ts +7 -7
- node v20.16/util.d.ts +45 -45
- node v20.16/v8.d.ts +12 -12
- node v20.16/vm.d.ts +11 -12
- node v20.16/worker_threads.d.ts +22 -22
- node v20.16/zlib.d.ts +8 -8
node v20.16/v8.d.ts
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
* The `node:v8` module exposes APIs that are specific to the version of [V8](https://developers.google.com/v8/) built into the Node.js binary. It can be accessed using:
|
3
3
|
*
|
4
4
|
* ```js
|
5
|
-
*
|
5
|
+
* import v8 from 'node:v8';
|
6
6
|
* ```
|
7
7
|
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/v8.js)
|
8
8
|
*/
|
@@ -176,7 +176,7 @@ declare module "v8" {
|
|
176
176
|
*
|
177
177
|
* ```js
|
178
178
|
* // Print GC events to stdout for one minute.
|
179
|
-
*
|
179
|
+
* import v8 from 'node:v8';
|
180
180
|
* v8.setFlagsFromString('--trace_gc');
|
181
181
|
* setTimeout(() => { v8.setFlagsFromString('--notrace_gc'); }, 60e3);
|
182
182
|
* ```
|
@@ -243,7 +243,7 @@ declare module "v8" {
|
|
243
243
|
*
|
244
244
|
* ```js
|
245
245
|
* // Print heap snapshot to the console
|
246
|
-
*
|
246
|
+
* import v8 from 'node:v8';
|
247
247
|
* const stream = v8.getHeapSnapshot();
|
248
248
|
* stream.pipe(process.stdout);
|
249
249
|
* ```
|
@@ -268,12 +268,12 @@ declare module "v8" {
|
|
268
268
|
* for a duration depending on the heap size.
|
269
269
|
*
|
270
270
|
* ```js
|
271
|
-
*
|
272
|
-
*
|
271
|
+
* import { writeHeapSnapshot } from 'node:v8';
|
272
|
+
* import {
|
273
273
|
* Worker,
|
274
274
|
* isMainThread,
|
275
275
|
* parentPort,
|
276
|
-
* }
|
276
|
+
* } from 'node:worker_threads';
|
277
277
|
*
|
278
278
|
* if (isMainThread) {
|
279
279
|
* const worker = new Worker(__filename);
|
@@ -550,7 +550,7 @@ declare module "v8" {
|
|
550
550
|
* Here's an example.
|
551
551
|
*
|
552
552
|
* ```js
|
553
|
-
*
|
553
|
+
* import { GCProfiler } from 'node:v8';
|
554
554
|
* const profiler = new GCProfiler();
|
555
555
|
* profiler.start();
|
556
556
|
* setTimeout(() => {
|
@@ -736,12 +736,12 @@ declare module "v8" {
|
|
736
736
|
* ```js
|
737
737
|
* 'use strict';
|
738
738
|
*
|
739
|
-
*
|
740
|
-
*
|
741
|
-
*
|
742
|
-
*
|
739
|
+
* import fs from 'node:fs';
|
740
|
+
* import zlib from 'node:zlib';
|
741
|
+
* import path from 'node:path';
|
742
|
+
* import assert from 'node:assert';
|
743
743
|
*
|
744
|
-
*
|
744
|
+
* import v8 from 'node:v8';
|
745
745
|
*
|
746
746
|
* class BookShelf {
|
747
747
|
* storage = new Map();
|
node v20.16/vm.d.ts
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
* code are reflected in the context object.
|
18
18
|
*
|
19
19
|
* ```js
|
20
|
-
*
|
20
|
+
* import vm from 'node:vm';
|
21
21
|
*
|
22
22
|
* const x = 1;
|
23
23
|
*
|
@@ -203,7 +203,7 @@ declare module "vm" {
|
|
203
203
|
* The globals are contained in the `context` object.
|
204
204
|
*
|
205
205
|
* ```js
|
206
|
-
*
|
206
|
+
* import vm from 'node:vm';
|
207
207
|
*
|
208
208
|
* const context = {
|
209
209
|
* animal: 'cat',
|
@@ -239,7 +239,7 @@ declare module "vm" {
|
|
239
239
|
* contained within each individual `context`.
|
240
240
|
*
|
241
241
|
* ```js
|
242
|
-
*
|
242
|
+
* import vm from 'node:vm';
|
243
243
|
*
|
244
244
|
* const script = new vm.Script('globalVar = "set"');
|
245
245
|
*
|
@@ -264,7 +264,7 @@ declare module "vm" {
|
|
264
264
|
* executes that code multiple times:
|
265
265
|
*
|
266
266
|
* ```js
|
267
|
-
*
|
267
|
+
* import vm from 'node:vm';
|
268
268
|
*
|
269
269
|
* global.globalVar = 0;
|
270
270
|
*
|
@@ -357,7 +357,7 @@ declare module "vm" {
|
|
357
357
|
* variables will remain unchanged.
|
358
358
|
*
|
359
359
|
* ```js
|
360
|
-
*
|
360
|
+
* import vm from 'node:vm';
|
361
361
|
*
|
362
362
|
* global.globalVar = 3;
|
363
363
|
*
|
@@ -404,7 +404,7 @@ declare module "vm" {
|
|
404
404
|
* The following example compiles and executes different scripts using a single `contextified` object:
|
405
405
|
*
|
406
406
|
* ```js
|
407
|
-
*
|
407
|
+
* import vm from 'node:vm';
|
408
408
|
*
|
409
409
|
* const contextObject = { globalVar: 1 };
|
410
410
|
* vm.createContext(contextObject);
|
@@ -433,7 +433,7 @@ declare module "vm" {
|
|
433
433
|
* variable and sets a new one. These globals are contained in the `contextObject`.
|
434
434
|
*
|
435
435
|
* ```js
|
436
|
-
*
|
436
|
+
* import vm from 'node:vm';
|
437
437
|
*
|
438
438
|
* const contextObject = {
|
439
439
|
* animal: 'cat',
|
@@ -465,7 +465,7 @@ declare module "vm" {
|
|
465
465
|
* the JavaScript [`eval()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval) function to run the same code:
|
466
466
|
*
|
467
467
|
* ```js
|
468
|
-
*
|
468
|
+
* import vm from 'node:vm';
|
469
469
|
* let localVar = 'initial value';
|
470
470
|
*
|
471
471
|
* const vmResult = vm.runInThisContext('localVar = "vm";');
|
@@ -492,12 +492,11 @@ declare module "vm" {
|
|
492
492
|
*
|
493
493
|
* ```js
|
494
494
|
* 'use strict';
|
495
|
-
*
|
495
|
+
* import vm from 'node:vm';
|
496
496
|
*
|
497
497
|
* const code = `
|
498
498
|
* ((require) => {
|
499
499
|
* const http = require('node:http');
|
500
|
-
*
|
501
500
|
* http.createServer((request, response) => {
|
502
501
|
* response.writeHead(200, { 'Content-Type': 'text/plain' });
|
503
502
|
* response.end('Hello World\\n');
|
@@ -547,7 +546,7 @@ declare module "vm" {
|
|
547
546
|
* the memory occupied by each heap space in the current V8 instance.
|
548
547
|
*
|
549
548
|
* ```js
|
550
|
-
*
|
549
|
+
* import vm from 'node:vm';
|
551
550
|
* // Measure the memory used by the main context.
|
552
551
|
* vm.measureMemory({ mode: 'summary' })
|
553
552
|
* // This is the same as vm.measureMemory()
|
@@ -855,7 +854,7 @@ declare module "vm" {
|
|
855
854
|
* module graphs.
|
856
855
|
*
|
857
856
|
* ```js
|
858
|
-
*
|
857
|
+
* import vm from 'node:vm';
|
859
858
|
*
|
860
859
|
* const source = '{ "a": 1 }';
|
861
860
|
* const module = new vm.SyntheticModule(['default'], function() {
|
node v20.16/worker_threads.d.ts
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
* JavaScript in parallel. To access it:
|
4
4
|
*
|
5
5
|
* ```js
|
6
|
-
*
|
6
|
+
* import worker from 'node:worker_threads';
|
7
7
|
* ```
|
8
8
|
*
|
9
9
|
* Workers (threads) are useful for performing CPU-intensive JavaScript operations.
|
@@ -14,9 +14,10 @@
|
|
14
14
|
* so by transferring `ArrayBuffer` instances or sharing `SharedArrayBuffer` instances.
|
15
15
|
*
|
16
16
|
* ```js
|
17
|
-
*
|
17
|
+
* import {
|
18
18
|
* Worker, isMainThread, parentPort, workerData,
|
19
|
-
* }
|
19
|
+
* } from 'node:worker_threads';
|
20
|
+
* import { parse } = from 'some-js-parsing-library';
|
20
21
|
*
|
21
22
|
* if (isMainThread) {
|
22
23
|
* module.exports = function parseJSAsync(script) {
|
@@ -33,7 +34,6 @@
|
|
33
34
|
* });
|
34
35
|
* };
|
35
36
|
* } else {
|
36
|
-
* const { parse } = require('some-js-parsing-library');
|
37
37
|
* const script = workerData;
|
38
38
|
* parentPort.postMessage(parse(script));
|
39
39
|
* }
|
@@ -72,7 +72,7 @@ declare module "worker_threads" {
|
|
72
72
|
* The `MessageChannel` has no methods of its own. `new MessageChannel()` yields an object with `port1` and `port2` properties, which refer to linked `MessagePort` instances.
|
73
73
|
*
|
74
74
|
* ```js
|
75
|
-
*
|
75
|
+
* import { MessageChannel } from 'node:worker_threads';
|
76
76
|
*
|
77
77
|
* const { port1, port2 } = new MessageChannel();
|
78
78
|
* port1.on('message', (message) => console.log('received', message));
|
@@ -121,7 +121,7 @@ declare module "worker_threads" {
|
|
121
121
|
* * `value` may not contain native (C++-backed) objects other than:
|
122
122
|
*
|
123
123
|
* ```js
|
124
|
-
*
|
124
|
+
* import { MessageChannel } from 'node:worker_threads';
|
125
125
|
* const { port1, port2 } = new MessageChannel();
|
126
126
|
*
|
127
127
|
* port1.on('message', (message) => console.log(message));
|
@@ -143,7 +143,7 @@ declare module "worker_threads" {
|
|
143
143
|
* `value` may still contain `ArrayBuffer` instances that are not in `transferList`; in that case, the underlying memory is copied rather than moved.
|
144
144
|
*
|
145
145
|
* ```js
|
146
|
-
*
|
146
|
+
* import { MessageChannel } from 'node:worker_threads';
|
147
147
|
* const { port1, port2 } = new MessageChannel();
|
148
148
|
*
|
149
149
|
* port1.on('message', (message) => console.log(message));
|
@@ -298,8 +298,8 @@ declare module "worker_threads" {
|
|
298
298
|
* Notable differences inside a Worker environment are:
|
299
299
|
*
|
300
300
|
* * The `process.stdin`, `process.stdout`, and `process.stderr` streams may be redirected by the parent thread.
|
301
|
-
* * The `
|
302
|
-
* * The `
|
301
|
+
* * The `import { isMainThread } from 'node:worker_threads'` property is set to `false`.
|
302
|
+
* * The `import { parentPort } from 'node:worker_threads'` message port is available.
|
303
303
|
* * `process.exit()` does not stop the whole program, just the single thread,
|
304
304
|
* and `process.abort()` is not available.
|
305
305
|
* * `process.chdir()` and `process` methods that set group or user ids
|
@@ -334,10 +334,10 @@ declare module "worker_threads" {
|
|
334
334
|
* the thread barrier.
|
335
335
|
*
|
336
336
|
* ```js
|
337
|
-
*
|
338
|
-
*
|
337
|
+
* import assert from 'node:assert';
|
338
|
+
* import {
|
339
339
|
* Worker, MessageChannel, MessagePort, isMainThread, parentPort,
|
340
|
-
* }
|
340
|
+
* } from 'node:worker_threads';
|
341
341
|
* if (isMainThread) {
|
342
342
|
* const worker = new Worker(__filename);
|
343
343
|
* const subChannel = new MessageChannel();
|
@@ -377,7 +377,7 @@ declare module "worker_threads" {
|
|
377
377
|
readonly stderr: Readable;
|
378
378
|
/**
|
379
379
|
* An integer identifier for the referenced thread. Inside the worker thread,
|
380
|
-
* it is available as `
|
380
|
+
* it is available as `import { threadId } from 'node:node:worker_threads'`.
|
381
381
|
* This value is unique for each `Worker` instance inside a single process.
|
382
382
|
* @since v10.5.0
|
383
383
|
*/
|
@@ -495,11 +495,11 @@ declare module "worker_threads" {
|
|
495
495
|
* ```js
|
496
496
|
* 'use strict';
|
497
497
|
*
|
498
|
-
*
|
498
|
+
* import {
|
499
499
|
* isMainThread,
|
500
500
|
* BroadcastChannel,
|
501
501
|
* Worker,
|
502
|
-
* }
|
502
|
+
* } from 'node:worker_threads';
|
503
503
|
*
|
504
504
|
* const bc = new BroadcastChannel('hello');
|
505
505
|
*
|
@@ -553,7 +553,7 @@ declare module "worker_threads" {
|
|
553
553
|
* This operation cannot be undone.
|
554
554
|
*
|
555
555
|
* ```js
|
556
|
-
*
|
556
|
+
* import { MessageChannel, markAsUntransferable } from 'node:worker_threads';
|
557
557
|
*
|
558
558
|
* const pooledBuffer = new ArrayBuffer(8);
|
559
559
|
* const typedArray1 = new Uint8Array(pooledBuffer);
|
@@ -598,7 +598,7 @@ declare module "worker_threads" {
|
|
598
598
|
* that contains the message payload, corresponding to the oldest message in the `MessagePort`'s queue.
|
599
599
|
*
|
600
600
|
* ```js
|
601
|
-
*
|
601
|
+
* import { MessageChannel, receiveMessageOnPort } from 'node:worker_threads';
|
602
602
|
* const { port1, port2 } = new MessageChannel();
|
603
603
|
* port1.postMessage({ hello: 'world' });
|
604
604
|
*
|
@@ -624,12 +624,12 @@ declare module "worker_threads" {
|
|
624
624
|
* automatically.
|
625
625
|
*
|
626
626
|
* ```js
|
627
|
-
*
|
627
|
+
* import {
|
628
628
|
* Worker,
|
629
629
|
* isMainThread,
|
630
630
|
* setEnvironmentData,
|
631
631
|
* getEnvironmentData,
|
632
|
-
* }
|
632
|
+
* } from 'node:worker_threads';
|
633
633
|
*
|
634
634
|
* if (isMainThread) {
|
635
635
|
* setEnvironmentData('Hello', 'World!');
|
@@ -658,7 +658,7 @@ declare module "worker_threads" {
|
|
658
658
|
} from "worker_threads";
|
659
659
|
global {
|
660
660
|
/**
|
661
|
-
* `BroadcastChannel` class is a global reference for `
|
661
|
+
* `BroadcastChannel` class is a global reference for `import { BroadcastChannel } from 'node:worker_threads'`
|
662
662
|
* https://nodejs.org/api/globals.html#broadcastchannel
|
663
663
|
* @since v18.0.0
|
664
664
|
*/
|
@@ -668,7 +668,7 @@ declare module "worker_threads" {
|
|
668
668
|
} ? T
|
669
669
|
: typeof _BroadcastChannel;
|
670
670
|
/**
|
671
|
-
* `MessageChannel` class is a global reference for `
|
671
|
+
* `MessageChannel` class is a global reference for `import { MessageChannel } from 'node:worker_threads'`
|
672
672
|
* https://nodejs.org/api/globals.html#messagechannel
|
673
673
|
* @since v15.0.0
|
674
674
|
*/
|
@@ -678,7 +678,7 @@ declare module "worker_threads" {
|
|
678
678
|
} ? T
|
679
679
|
: typeof _MessageChannel;
|
680
680
|
/**
|
681
|
-
* `MessagePort` class is a global reference for `
|
681
|
+
* `MessagePort` class is a global reference for `import { MessagePort } from 'node:worker_threads'`
|
682
682
|
* https://nodejs.org/api/globals.html#messageport
|
683
683
|
* @since v15.0.0
|
684
684
|
*/
|
node v20.16/zlib.d.ts
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
* To access it:
|
6
6
|
*
|
7
7
|
* ```js
|
8
|
-
*
|
8
|
+
* import zlib from 'node:zlib';
|
9
9
|
* ```
|
10
10
|
*
|
11
11
|
* Compression and decompression are built around the Node.js
|
@@ -16,12 +16,12 @@
|
|
16
16
|
* stream:
|
17
17
|
*
|
18
18
|
* ```js
|
19
|
-
*
|
20
|
-
*
|
21
|
-
*
|
19
|
+
* import { createGzip } from 'node:zlib';
|
20
|
+
* import { pipeline } from 'node:stream';
|
21
|
+
* import {
|
22
22
|
* createReadStream,
|
23
23
|
* createWriteStream,
|
24
|
-
* }
|
24
|
+
* } from 'node:fs';
|
25
25
|
*
|
26
26
|
* const gzip = createGzip();
|
27
27
|
* const source = createReadStream('input.txt');
|
@@ -36,7 +36,7 @@
|
|
36
36
|
*
|
37
37
|
* // Or, Promisified
|
38
38
|
*
|
39
|
-
*
|
39
|
+
* import { promisify } from 'node:util';
|
40
40
|
* const pipe = promisify(pipeline);
|
41
41
|
*
|
42
42
|
* async function do_gzip(input, output) {
|
@@ -56,7 +56,7 @@
|
|
56
56
|
* It is also possible to compress or decompress data in a single step:
|
57
57
|
*
|
58
58
|
* ```js
|
59
|
-
*
|
59
|
+
* import { deflate, unzip } from 'node:zlib';
|
60
60
|
*
|
61
61
|
* const input = '.................................';
|
62
62
|
* deflate(input, (err, buffer) => {
|
@@ -78,7 +78,7 @@
|
|
78
78
|
*
|
79
79
|
* // Or, Promisified
|
80
80
|
*
|
81
|
-
*
|
81
|
+
* import { promisify } from 'node:util';
|
82
82
|
* const do_unzip = promisify(unzip);
|
83
83
|
*
|
84
84
|
* do_unzip(buffer)
|