@types/node 18.19.51 → 18.19.53
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 v18.19/README.md +1 -1
- node v18.19/buffer.d.ts +15 -8
- node v18.19/child_process.d.ts +35 -30
- node v18.19/cluster.d.ts +1 -1
- node v18.19/console.d.ts +2 -2
- node v18.19/crypto.d.ts +1 -1
- node v18.19/dns/promises.d.ts +6 -5
- node v18.19/dns.d.ts +5 -5
- node v18.19/domain.d.ts +2 -2
- node v18.19/events.d.ts +13 -13
- node v18.19/fs/promises.d.ts +2 -2
- node v18.19/fs.d.ts +1 -1
- node v18.19/http.d.ts +4 -4
- node v18.19/http2.d.ts +24 -24
- node v18.19/https.d.ts +9 -9
- node v18.19/inspector.d.ts +1 -1
- node v18.19/module.d.ts +3 -3
- node v18.19/net.d.ts +2 -2
- node v18.19/os.d.ts +1 -1
- node v18.19/package.json +2 -2
- node v18.19/path.d.ts +1 -1
- node v18.19/perf_hooks.d.ts +11 -11
- node v18.19/punycode.d.ts +1 -1
- node v18.19/querystring.d.ts +1 -1
- node v18.19/readline/promises.d.ts +1 -1
- node v18.19/readline.d.ts +18 -18
- node v18.19/repl.d.ts +4 -4
- node v18.19/stream.d.ts +21 -21
- node v18.19/string_decoder.d.ts +3 -3
- node v18.19/timers/promises.d.ts +1 -1
- node v18.19/timers.d.ts +1 -1
- node v18.19/tls.d.ts +5 -5
- node v18.19/trace_events.d.ts +3 -3
- node v18.19/tty.d.ts +1 -1
- node v18.19/url.d.ts +7 -7
- node v18.19/util.d.ts +41 -41
- node v18.19/v8.d.ts +12 -12
- node v18.19/vm.d.ts +11 -12
- node v18.19/worker_threads.d.ts +22 -22
- node v18.19/zlib.d.ts +8 -8
node v18.19/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/v18.19.0/lib/v8.js)
|
|
8
8
|
*/
|
|
@@ -164,7 +164,7 @@ declare module "v8" {
|
|
|
164
164
|
*
|
|
165
165
|
* ```js
|
|
166
166
|
* // Print GC events to stdout for one minute.
|
|
167
|
-
*
|
|
167
|
+
* import v8 from 'node:v8';
|
|
168
168
|
* v8.setFlagsFromString('--trace_gc');
|
|
169
169
|
* setTimeout(() => { v8.setFlagsFromString('--notrace_gc'); }, 60e3);
|
|
170
170
|
* ```
|
|
@@ -187,7 +187,7 @@ declare module "v8" {
|
|
|
187
187
|
*
|
|
188
188
|
* ```js
|
|
189
189
|
* // Print heap snapshot to the console
|
|
190
|
-
*
|
|
190
|
+
* import v8 from 'node:v8';
|
|
191
191
|
* const stream = v8.getHeapSnapshot();
|
|
192
192
|
* stream.pipe(process.stdout);
|
|
193
193
|
* ```
|
|
@@ -212,12 +212,12 @@ declare module "v8" {
|
|
|
212
212
|
* for a duration depending on the heap size.
|
|
213
213
|
*
|
|
214
214
|
* ```js
|
|
215
|
-
*
|
|
216
|
-
*
|
|
215
|
+
* import { writeHeapSnapshot } from 'node:v8';
|
|
216
|
+
* import {
|
|
217
217
|
* Worker,
|
|
218
218
|
* isMainThread,
|
|
219
219
|
* parentPort,
|
|
220
|
-
* }
|
|
220
|
+
* } from 'node:worker_threads';
|
|
221
221
|
*
|
|
222
222
|
* if (isMainThread) {
|
|
223
223
|
* const worker = new Worker(__filename);
|
|
@@ -494,7 +494,7 @@ declare module "v8" {
|
|
|
494
494
|
* Here's an example.
|
|
495
495
|
*
|
|
496
496
|
* ```js
|
|
497
|
-
*
|
|
497
|
+
* import { GCProfiler } from 'node:v8';
|
|
498
498
|
* const profiler = new GCProfiler();
|
|
499
499
|
* profiler.start();
|
|
500
500
|
* setTimeout(() => {
|
|
@@ -681,12 +681,12 @@ declare module "v8" {
|
|
|
681
681
|
* ```js
|
|
682
682
|
* 'use strict';
|
|
683
683
|
*
|
|
684
|
-
*
|
|
685
|
-
*
|
|
686
|
-
*
|
|
687
|
-
*
|
|
684
|
+
* import fs from 'node:fs';
|
|
685
|
+
* import zlib from 'node:zlib';
|
|
686
|
+
* import path from 'node:path';
|
|
687
|
+
* import assert from 'node:assert';
|
|
688
688
|
*
|
|
689
|
-
*
|
|
689
|
+
* import v8 from 'node:v8';
|
|
690
690
|
*
|
|
691
691
|
* class BookShelf {
|
|
692
692
|
* storage = new Map();
|
node v18.19/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
|
*
|
|
@@ -201,7 +201,7 @@ declare module "vm" {
|
|
|
201
201
|
* The globals are contained in the `context` object.
|
|
202
202
|
*
|
|
203
203
|
* ```js
|
|
204
|
-
*
|
|
204
|
+
* import vm from 'node:vm';
|
|
205
205
|
*
|
|
206
206
|
* const context = {
|
|
207
207
|
* animal: 'cat',
|
|
@@ -237,7 +237,7 @@ declare module "vm" {
|
|
|
237
237
|
* contained within each individual `context`.
|
|
238
238
|
*
|
|
239
239
|
* ```js
|
|
240
|
-
*
|
|
240
|
+
* import vm from 'node:vm';
|
|
241
241
|
*
|
|
242
242
|
* const script = new vm.Script('globalVar = "set"');
|
|
243
243
|
*
|
|
@@ -262,7 +262,7 @@ declare module "vm" {
|
|
|
262
262
|
* executes that code multiple times:
|
|
263
263
|
*
|
|
264
264
|
* ```js
|
|
265
|
-
*
|
|
265
|
+
* import vm from 'node:vm';
|
|
266
266
|
*
|
|
267
267
|
* global.globalVar = 0;
|
|
268
268
|
*
|
|
@@ -319,7 +319,7 @@ declare module "vm" {
|
|
|
319
319
|
* will remain unchanged.
|
|
320
320
|
*
|
|
321
321
|
* ```js
|
|
322
|
-
*
|
|
322
|
+
* import vm from 'node:vm';
|
|
323
323
|
*
|
|
324
324
|
* global.globalVar = 3;
|
|
325
325
|
*
|
|
@@ -366,7 +366,7 @@ declare module "vm" {
|
|
|
366
366
|
* The following example compiles and executes different scripts using a single `contextified` object:
|
|
367
367
|
*
|
|
368
368
|
* ```js
|
|
369
|
-
*
|
|
369
|
+
* import vm from 'node:vm';
|
|
370
370
|
*
|
|
371
371
|
* const contextObject = { globalVar: 1 };
|
|
372
372
|
* vm.createContext(contextObject);
|
|
@@ -395,7 +395,7 @@ declare module "vm" {
|
|
|
395
395
|
* variable and sets a new one. These globals are contained in the `contextObject`.
|
|
396
396
|
*
|
|
397
397
|
* ```js
|
|
398
|
-
*
|
|
398
|
+
* import vm from 'node:vm';
|
|
399
399
|
*
|
|
400
400
|
* const contextObject = {
|
|
401
401
|
* animal: 'cat',
|
|
@@ -427,7 +427,7 @@ declare module "vm" {
|
|
|
427
427
|
* the JavaScript [`eval()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval) function to run the same code:
|
|
428
428
|
*
|
|
429
429
|
* ```js
|
|
430
|
-
*
|
|
430
|
+
* import vm from 'node:vm';
|
|
431
431
|
* let localVar = 'initial value';
|
|
432
432
|
*
|
|
433
433
|
* const vmResult = vm.runInThisContext('localVar = "vm";');
|
|
@@ -454,12 +454,11 @@ declare module "vm" {
|
|
|
454
454
|
*
|
|
455
455
|
* ```js
|
|
456
456
|
* 'use strict';
|
|
457
|
-
*
|
|
457
|
+
* import vm from 'node:vm';
|
|
458
458
|
*
|
|
459
459
|
* const code = `
|
|
460
460
|
* ((require) => {
|
|
461
|
-
* const http = require('http');
|
|
462
|
-
*
|
|
461
|
+
* const http = require('node:http');
|
|
463
462
|
* http.createServer((request, response) => {
|
|
464
463
|
* response.writeHead(200, { 'Content-Type': 'text/plain' });
|
|
465
464
|
* response.end('Hello World\\n');
|
|
@@ -509,7 +508,7 @@ declare module "vm" {
|
|
|
509
508
|
* the memory occupied by each heap space in the current V8 instance.
|
|
510
509
|
*
|
|
511
510
|
* ```js
|
|
512
|
-
*
|
|
511
|
+
* import vm from 'node:vm';
|
|
513
512
|
* // Measure the memory used by the main context.
|
|
514
513
|
* vm.measureMemory({ mode: 'summary' })
|
|
515
514
|
* // This is the same as vm.measureMemory()
|
node v18.19/worker_threads.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* 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` 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
|
|
@@ -333,10 +333,10 @@ declare module "worker_threads" {
|
|
|
333
333
|
* the thread barrier.
|
|
334
334
|
*
|
|
335
335
|
* ```js
|
|
336
|
-
*
|
|
337
|
-
*
|
|
336
|
+
* import assert from 'node:assert';
|
|
337
|
+
* import {
|
|
338
338
|
* Worker, MessageChannel, MessagePort, isMainThread, parentPort
|
|
339
|
-
* }
|
|
339
|
+
* } from 'node:worker_threads';
|
|
340
340
|
* if (isMainThread) {
|
|
341
341
|
* const worker = new Worker(__filename);
|
|
342
342
|
* const subChannel = new MessageChannel();
|
|
@@ -376,7 +376,7 @@ declare module "worker_threads" {
|
|
|
376
376
|
readonly stderr: Readable;
|
|
377
377
|
/**
|
|
378
378
|
* An integer identifier for the referenced thread. Inside the worker thread,
|
|
379
|
-
* it is available as `
|
|
379
|
+
* it is available as `import { threadId } from 'node:worker_threads'`.
|
|
380
380
|
* This value is unique for each `Worker` instance inside a single process.
|
|
381
381
|
* @since v10.5.0
|
|
382
382
|
*/
|
|
@@ -494,11 +494,11 @@ declare module "worker_threads" {
|
|
|
494
494
|
* ```js
|
|
495
495
|
* 'use strict';
|
|
496
496
|
*
|
|
497
|
-
*
|
|
497
|
+
* import {
|
|
498
498
|
* isMainThread,
|
|
499
499
|
* BroadcastChannel,
|
|
500
500
|
* Worker
|
|
501
|
-
* }
|
|
501
|
+
* } from 'node:worker_threads';
|
|
502
502
|
*
|
|
503
503
|
* const bc = new BroadcastChannel('hello');
|
|
504
504
|
*
|
|
@@ -552,7 +552,7 @@ declare module "worker_threads" {
|
|
|
552
552
|
* This operation cannot be undone.
|
|
553
553
|
*
|
|
554
554
|
* ```js
|
|
555
|
-
*
|
|
555
|
+
* import { MessageChannel, markAsUntransferable } from 'node:worker_threads';
|
|
556
556
|
*
|
|
557
557
|
* const pooledBuffer = new ArrayBuffer(8);
|
|
558
558
|
* const typedArray1 = new Uint8Array(pooledBuffer);
|
|
@@ -597,7 +597,7 @@ declare module "worker_threads" {
|
|
|
597
597
|
* that contains the message payload, corresponding to the oldest message in the`MessagePort`’s queue.
|
|
598
598
|
*
|
|
599
599
|
* ```js
|
|
600
|
-
*
|
|
600
|
+
* import { MessageChannel, receiveMessageOnPort } from 'node:worker_threads';
|
|
601
601
|
* const { port1, port2 } = new MessageChannel();
|
|
602
602
|
* port1.postMessage({ hello: 'world' });
|
|
603
603
|
*
|
|
@@ -623,12 +623,12 @@ declare module "worker_threads" {
|
|
|
623
623
|
* automatically.
|
|
624
624
|
*
|
|
625
625
|
* ```js
|
|
626
|
-
*
|
|
626
|
+
* import {
|
|
627
627
|
* Worker,
|
|
628
628
|
* isMainThread,
|
|
629
629
|
* setEnvironmentData,
|
|
630
630
|
* getEnvironmentData,
|
|
631
|
-
* }
|
|
631
|
+
* } from 'node:worker_threads';
|
|
632
632
|
*
|
|
633
633
|
* if (isMainThread) {
|
|
634
634
|
* setEnvironmentData('Hello', 'World!');
|
|
@@ -657,7 +657,7 @@ declare module "worker_threads" {
|
|
|
657
657
|
} from "worker_threads";
|
|
658
658
|
global {
|
|
659
659
|
/**
|
|
660
|
-
* `BroadcastChannel` class is a global reference for `
|
|
660
|
+
* `BroadcastChannel` class is a global reference for `import { BroadcastChannel } from 'node:worker_threads'`
|
|
661
661
|
* https://nodejs.org/api/globals.html#broadcastchannel
|
|
662
662
|
* @since v18.0.0
|
|
663
663
|
*/
|
|
@@ -668,7 +668,7 @@ declare module "worker_threads" {
|
|
|
668
668
|
: typeof _BroadcastChannel;
|
|
669
669
|
|
|
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
|
*/
|
|
@@ -679,7 +679,7 @@ declare module "worker_threads" {
|
|
|
679
679
|
: typeof _MessageChannel;
|
|
680
680
|
|
|
681
681
|
/**
|
|
682
|
-
* `MessagePort` class is a global reference for `
|
|
682
|
+
* `MessagePort` class is a global reference for `import { MessagePort } from 'node:worker_threads'`
|
|
683
683
|
* https://nodejs.org/api/globals.html#messageport
|
|
684
684
|
* @since v15.0.0
|
|
685
685
|
*/
|
node v18.19/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 `Streams API`.
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
* stream:
|
|
16
16
|
*
|
|
17
17
|
* ```js
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* import { createGzip } from 'node:zlib';
|
|
19
|
+
* import { pipeline } from 'node:stream';
|
|
20
|
+
* import {
|
|
21
21
|
* createReadStream,
|
|
22
22
|
* createWriteStream
|
|
23
|
-
* }
|
|
23
|
+
* } from 'node:fs';
|
|
24
24
|
*
|
|
25
25
|
* const gzip = createGzip();
|
|
26
26
|
* const source = createReadStream('input.txt');
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
*
|
|
36
36
|
* // Or, Promisified
|
|
37
37
|
*
|
|
38
|
-
*
|
|
38
|
+
* import { promisify } from 'node:util';
|
|
39
39
|
* const pipe = promisify(pipeline);
|
|
40
40
|
*
|
|
41
41
|
* async function do_gzip(input, output) {
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
* It is also possible to compress or decompress data in a single step:
|
|
56
56
|
*
|
|
57
57
|
* ```js
|
|
58
|
-
*
|
|
58
|
+
* import { deflate, unzip } from 'node:zlib';
|
|
59
59
|
*
|
|
60
60
|
* const input = '.................................';
|
|
61
61
|
* deflate(input, (err, buffer) => {
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
*
|
|
78
78
|
* // Or, Promisified
|
|
79
79
|
*
|
|
80
|
-
*
|
|
80
|
+
* import { promisify } from 'node:util';
|
|
81
81
|
* const do_unzip = promisify(unzip);
|
|
82
82
|
*
|
|
83
83
|
* do_unzip(buffer)
|