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