@types/node 18.16.3 → 20.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- node/README.md +1 -1
- node/assert.d.ts +71 -75
- node/async_hooks.d.ts +62 -42
- node/buffer.d.ts +127 -99
- node/child_process.d.ts +50 -54
- node/cluster.d.ts +12 -12
- node/console.d.ts +5 -5
- node/crypto.d.ts +209 -220
- node/dgram.d.ts +15 -15
- node/diagnostics_channel.d.ts +25 -26
- node/dns/promises.d.ts +6 -6
- node/dns.d.ts +24 -16
- node/domain.d.ts +4 -4
- node/events.d.ts +60 -60
- node/fs/promises.d.ts +78 -48
- node/fs.d.ts +117 -81
- node/http.d.ts +158 -147
- node/http2.d.ts +42 -46
- node/https.d.ts +52 -153
- node/index.d.ts +1 -1
- node/inspector.d.ts +10 -3
- node/module.d.ts +5 -4
- node/net.d.ts +21 -18
- node/os.d.ts +22 -18
- node/package.json +2 -2
- node/path.d.ts +4 -4
- node/perf_hooks.d.ts +28 -15
- node/process.d.ts +43 -46
- node/punycode.d.ts +1 -1
- node/querystring.d.ts +5 -5
- node/readline/promises.d.ts +6 -4
- node/readline.d.ts +15 -15
- node/repl.d.ts +9 -9
- node/stream/consumers.d.ts +1 -1
- node/stream.d.ts +88 -136
- node/string_decoder.d.ts +6 -6
- node/test.d.ts +423 -186
- node/timers/promises.d.ts +3 -3
- node/timers.d.ts +2 -2
- node/tls.d.ts +24 -16
- node/trace_events.d.ts +20 -9
- node/ts4.8/assert.d.ts +71 -75
- node/ts4.8/async_hooks.d.ts +62 -42
- node/ts4.8/buffer.d.ts +127 -99
- node/ts4.8/child_process.d.ts +50 -54
- node/ts4.8/cluster.d.ts +12 -12
- node/ts4.8/console.d.ts +5 -5
- node/ts4.8/crypto.d.ts +209 -220
- node/ts4.8/dgram.d.ts +15 -15
- node/ts4.8/diagnostics_channel.d.ts +25 -26
- node/ts4.8/dns/promises.d.ts +6 -6
- node/ts4.8/dns.d.ts +24 -16
- node/ts4.8/domain.d.ts +4 -4
- node/ts4.8/events.d.ts +60 -60
- node/ts4.8/fs/promises.d.ts +96 -45
- node/ts4.8/fs.d.ts +203 -67
- node/ts4.8/globals.d.ts +29 -28
- node/ts4.8/http.d.ts +198 -126
- node/ts4.8/http2.d.ts +42 -46
- node/ts4.8/https.d.ts +52 -153
- node/ts4.8/inspector.d.ts +10 -3
- node/ts4.8/module.d.ts +5 -4
- node/ts4.8/net.d.ts +24 -21
- node/ts4.8/os.d.ts +22 -18
- node/ts4.8/path.d.ts +4 -4
- node/ts4.8/perf_hooks.d.ts +28 -15
- node/ts4.8/process.d.ts +43 -46
- node/ts4.8/punycode.d.ts +1 -1
- node/ts4.8/querystring.d.ts +5 -5
- node/ts4.8/readline/promises.d.ts +6 -4
- node/ts4.8/readline.d.ts +15 -15
- node/ts4.8/repl.d.ts +9 -9
- node/ts4.8/stream/consumers.d.ts +1 -1
- node/ts4.8/stream.d.ts +91 -139
- node/ts4.8/string_decoder.d.ts +6 -6
- node/ts4.8/test.d.ts +423 -186
- node/ts4.8/timers/promises.d.ts +3 -3
- node/ts4.8/timers.d.ts +9 -2
- node/ts4.8/tls.d.ts +24 -16
- node/ts4.8/trace_events.d.ts +20 -9
- node/ts4.8/tty.d.ts +4 -5
- node/ts4.8/url.d.ts +26 -36
- node/ts4.8/util.d.ts +143 -116
- node/ts4.8/v8.d.ts +110 -16
- node/ts4.8/vm.d.ts +292 -42
- node/ts4.8/wasi.d.ts +13 -19
- node/ts4.8/worker_threads.d.ts +32 -34
- node/ts4.8/zlib.d.ts +11 -11
- node/tty.d.ts +4 -5
- node/url.d.ts +26 -36
- node/util.d.ts +146 -111
- node/v8.d.ts +110 -16
- node/vm.d.ts +292 -42
- node/wasi.d.ts +13 -19
- node/worker_threads.d.ts +32 -34
- node/zlib.d.ts +11 -11
node/v8.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `v8` module exposes APIs that are specific to the version of [V8](https://developers.google.com/v8/) built into the Node.js binary. It can be accessed using:
|
|
2
|
+
* The `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
|
-
* const v8 = require('v8');
|
|
5
|
+
* const v8 = require('node:v8');
|
|
6
6
|
* ```
|
|
7
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
7
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.1.0/lib/v8.js)
|
|
8
8
|
*/
|
|
9
9
|
declare module 'v8' {
|
|
10
10
|
import { Readable } from 'node:stream';
|
|
@@ -29,6 +29,9 @@ declare module 'v8' {
|
|
|
29
29
|
does_zap_garbage: DoesZapCodeSpaceFlag;
|
|
30
30
|
number_of_native_contexts: number;
|
|
31
31
|
number_of_detached_contexts: number;
|
|
32
|
+
total_global_handles_size: number;
|
|
33
|
+
used_global_handles_size: number;
|
|
34
|
+
external_memory: number;
|
|
32
35
|
}
|
|
33
36
|
interface HeapCodeStatistics {
|
|
34
37
|
code_and_metadata_size: number;
|
|
@@ -68,6 +71,15 @@ declare module 'v8' {
|
|
|
68
71
|
* of contexts that were detached and not yet garbage collected. This number
|
|
69
72
|
* being non-zero indicates a potential memory leak.
|
|
70
73
|
*
|
|
74
|
+
* `total_global_handles_size` The value of total\_global\_handles\_size is the
|
|
75
|
+
* total memory size of V8 global handles.
|
|
76
|
+
*
|
|
77
|
+
* `used_global_handles_size` The value of used\_global\_handles\_size is the
|
|
78
|
+
* used memory size of V8 global handles.
|
|
79
|
+
*
|
|
80
|
+
* `external_memory` The value of external\_memory is the memory size of array
|
|
81
|
+
* buffers and external strings.
|
|
82
|
+
*
|
|
71
83
|
* ```js
|
|
72
84
|
* {
|
|
73
85
|
* total_heap_size: 7326976,
|
|
@@ -80,7 +92,10 @@ declare module 'v8' {
|
|
|
80
92
|
* peak_malloced_memory: 1127496,
|
|
81
93
|
* does_zap_garbage: 0,
|
|
82
94
|
* number_of_native_contexts: 1,
|
|
83
|
-
* number_of_detached_contexts: 0
|
|
95
|
+
* number_of_detached_contexts: 0,
|
|
96
|
+
* total_global_handles_size: 8192,
|
|
97
|
+
* used_global_handles_size: 3296,
|
|
98
|
+
* external_memory: 318824
|
|
84
99
|
* }
|
|
85
100
|
* ```
|
|
86
101
|
* @since v1.0.0
|
|
@@ -149,7 +164,7 @@ declare module 'v8' {
|
|
|
149
164
|
*
|
|
150
165
|
* ```js
|
|
151
166
|
* // Print GC events to stdout for one minute.
|
|
152
|
-
* const v8 = require('v8');
|
|
167
|
+
* const v8 = require('node:v8');
|
|
153
168
|
* v8.setFlagsFromString('--trace_gc');
|
|
154
169
|
* setTimeout(() => { v8.setFlagsFromString('--notrace_gc'); }, 60e3);
|
|
155
170
|
* ```
|
|
@@ -172,12 +187,12 @@ declare module 'v8' {
|
|
|
172
187
|
*
|
|
173
188
|
* ```js
|
|
174
189
|
* // Print heap snapshot to the console
|
|
175
|
-
* const v8 = require('v8');
|
|
190
|
+
* const v8 = require('node:v8');
|
|
176
191
|
* const stream = v8.getHeapSnapshot();
|
|
177
192
|
* stream.pipe(process.stdout);
|
|
178
193
|
* ```
|
|
179
194
|
* @since v11.13.0
|
|
180
|
-
* @return A Readable
|
|
195
|
+
* @return A Readable containing the V8 heap snapshot.
|
|
181
196
|
*/
|
|
182
197
|
function getHeapSnapshot(): Readable;
|
|
183
198
|
/**
|
|
@@ -197,12 +212,12 @@ declare module 'v8' {
|
|
|
197
212
|
* for a duration depending on the heap size.
|
|
198
213
|
*
|
|
199
214
|
* ```js
|
|
200
|
-
* const { writeHeapSnapshot } = require('v8');
|
|
215
|
+
* const { writeHeapSnapshot } = require('node:v8');
|
|
201
216
|
* const {
|
|
202
217
|
* Worker,
|
|
203
218
|
* isMainThread,
|
|
204
|
-
* parentPort
|
|
205
|
-
* } = require('worker_threads');
|
|
219
|
+
* parentPort,
|
|
220
|
+
* } = require('node:worker_threads');
|
|
206
221
|
*
|
|
207
222
|
* if (isMainThread) {
|
|
208
223
|
* const worker = new Worker(__filename);
|
|
@@ -233,13 +248,16 @@ declare module 'v8' {
|
|
|
233
248
|
*/
|
|
234
249
|
function writeHeapSnapshot(filename?: string): string;
|
|
235
250
|
/**
|
|
236
|
-
*
|
|
251
|
+
* Get statistics about code and its metadata in the heap, see
|
|
252
|
+
* V8[`GetHeapCodeAndMetadataStatistics`](https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#a6079122af17612ef54ef3348ce170866) API. Returns an object with the
|
|
253
|
+
* following properties:
|
|
237
254
|
*
|
|
238
255
|
* ```js
|
|
239
256
|
* {
|
|
240
257
|
* code_and_metadata_size: 212208,
|
|
241
258
|
* bytecode_and_metadata_size: 161368,
|
|
242
|
-
* external_script_source_size: 1410794
|
|
259
|
+
* external_script_source_size: 1410794,
|
|
260
|
+
* cpu_profiler_metadata_size: 0,
|
|
243
261
|
* }
|
|
244
262
|
* ```
|
|
245
263
|
* @since v12.8.0
|
|
@@ -289,7 +307,7 @@ declare module 'v8' {
|
|
|
289
307
|
*/
|
|
290
308
|
writeDouble(value: number): void;
|
|
291
309
|
/**
|
|
292
|
-
* Write raw bytes into the serializer
|
|
310
|
+
* Write raw bytes into the serializer's internal buffer. The deserializer
|
|
293
311
|
* will require a way to compute the length of the buffer.
|
|
294
312
|
* For use inside of a custom `serializer._writeHostObject()`.
|
|
295
313
|
*/
|
|
@@ -345,7 +363,7 @@ declare module 'v8' {
|
|
|
345
363
|
*/
|
|
346
364
|
readDouble(): number;
|
|
347
365
|
/**
|
|
348
|
-
* Read raw bytes from the deserializer
|
|
366
|
+
* Read raw bytes from the deserializer's internal buffer. The `length` parameter
|
|
349
367
|
* must correspond to the length of the buffer that was passed to `serializer.writeRawBytes()`.
|
|
350
368
|
* For use inside of a custom `deserializer._readHostObject()`.
|
|
351
369
|
*/
|
|
@@ -390,17 +408,93 @@ declare module 'v8' {
|
|
|
390
408
|
* @since v15.1.0, v14.18.0, v12.22.0
|
|
391
409
|
*/
|
|
392
410
|
function stopCoverage(): void;
|
|
393
|
-
|
|
394
411
|
/**
|
|
395
412
|
* This API collects GC data in current thread.
|
|
413
|
+
* @since v19.6.0, v18.15.0
|
|
396
414
|
*/
|
|
397
415
|
class GCProfiler {
|
|
398
416
|
/**
|
|
399
417
|
* Start collecting GC data.
|
|
418
|
+
* @since v19.6.0, v18.15.0
|
|
400
419
|
*/
|
|
401
420
|
start(): void;
|
|
402
421
|
/**
|
|
403
|
-
* Stop collecting GC data and return
|
|
422
|
+
* Stop collecting GC data and return an object.The content of object
|
|
423
|
+
* is as follows.
|
|
424
|
+
*
|
|
425
|
+
* ```json
|
|
426
|
+
* {
|
|
427
|
+
* "version": 1,
|
|
428
|
+
* "startTime": 1674059033862,
|
|
429
|
+
* "statistics": [
|
|
430
|
+
* {
|
|
431
|
+
* "gcType": "Scavenge",
|
|
432
|
+
* "beforeGC": {
|
|
433
|
+
* "heapStatistics": {
|
|
434
|
+
* "totalHeapSize": 5005312,
|
|
435
|
+
* "totalHeapSizeExecutable": 524288,
|
|
436
|
+
* "totalPhysicalSize": 5226496,
|
|
437
|
+
* "totalAvailableSize": 4341325216,
|
|
438
|
+
* "totalGlobalHandlesSize": 8192,
|
|
439
|
+
* "usedGlobalHandlesSize": 2112,
|
|
440
|
+
* "usedHeapSize": 4883840,
|
|
441
|
+
* "heapSizeLimit": 4345298944,
|
|
442
|
+
* "mallocedMemory": 254128,
|
|
443
|
+
* "externalMemory": 225138,
|
|
444
|
+
* "peakMallocedMemory": 181760
|
|
445
|
+
* },
|
|
446
|
+
* "heapSpaceStatistics": [
|
|
447
|
+
* {
|
|
448
|
+
* "spaceName": "read_only_space",
|
|
449
|
+
* "spaceSize": 0,
|
|
450
|
+
* "spaceUsedSize": 0,
|
|
451
|
+
* "spaceAvailableSize": 0,
|
|
452
|
+
* "physicalSpaceSize": 0
|
|
453
|
+
* }
|
|
454
|
+
* ]
|
|
455
|
+
* },
|
|
456
|
+
* "cost": 1574.14,
|
|
457
|
+
* "afterGC": {
|
|
458
|
+
* "heapStatistics": {
|
|
459
|
+
* "totalHeapSize": 6053888,
|
|
460
|
+
* "totalHeapSizeExecutable": 524288,
|
|
461
|
+
* "totalPhysicalSize": 5500928,
|
|
462
|
+
* "totalAvailableSize": 4341101384,
|
|
463
|
+
* "totalGlobalHandlesSize": 8192,
|
|
464
|
+
* "usedGlobalHandlesSize": 2112,
|
|
465
|
+
* "usedHeapSize": 4059096,
|
|
466
|
+
* "heapSizeLimit": 4345298944,
|
|
467
|
+
* "mallocedMemory": 254128,
|
|
468
|
+
* "externalMemory": 225138,
|
|
469
|
+
* "peakMallocedMemory": 181760
|
|
470
|
+
* },
|
|
471
|
+
* "heapSpaceStatistics": [
|
|
472
|
+
* {
|
|
473
|
+
* "spaceName": "read_only_space",
|
|
474
|
+
* "spaceSize": 0,
|
|
475
|
+
* "spaceUsedSize": 0,
|
|
476
|
+
* "spaceAvailableSize": 0,
|
|
477
|
+
* "physicalSpaceSize": 0
|
|
478
|
+
* }
|
|
479
|
+
* ]
|
|
480
|
+
* }
|
|
481
|
+
* }
|
|
482
|
+
* ],
|
|
483
|
+
* "endTime": 1674059036865
|
|
484
|
+
* }
|
|
485
|
+
* ```
|
|
486
|
+
*
|
|
487
|
+
* Here's an example.
|
|
488
|
+
*
|
|
489
|
+
* ```js
|
|
490
|
+
* const { GCProfiler } = require('v8');
|
|
491
|
+
* const profiler = new GCProfiler();
|
|
492
|
+
* profiler.start();
|
|
493
|
+
* setTimeout(() => {
|
|
494
|
+
* console.log(profiler.stop());
|
|
495
|
+
* }, 1000);
|
|
496
|
+
* ```
|
|
497
|
+
* @since v19.6.0, v18.15.0
|
|
404
498
|
*/
|
|
405
499
|
stop(): GCProfilerResult;
|
|
406
500
|
}
|