@types/node 24.13.6 → 24.19.1

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 (75) hide show
  1. {node v24.13 → node v24.19}/README.md +1 -1
  2. {node v24.13 → node v24.19}/async_hooks.d.ts +18 -22
  3. {node v24.13 → node v24.19}/buffer.buffer.d.ts +10 -5
  4. {node v24.13 → node v24.19}/buffer.d.ts +7 -0
  5. {node v24.13 → node v24.19}/child_process.d.ts +5 -1
  6. {node v24.13 → node v24.19}/crypto.d.ts +114 -47
  7. {node v24.13 → node v24.19}/dgram.d.ts +119 -4
  8. {node v24.13 → node v24.19}/dns/promises.d.ts +5 -5
  9. {node v24.13 → node v24.19}/dns.d.ts +6 -6
  10. {node v24.13 → node v24.19}/events.d.ts +13 -22
  11. {node v24.13 → node v24.19}/fs/promises.d.ts +79 -66
  12. {node v24.13 → node v24.19}/fs.d.ts +153 -90
  13. {node v24.13 → node v24.19}/http.d.ts +94 -2
  14. {node v24.13 → node v24.19}/http2.d.ts +65 -18
  15. {node v24.13 → node v24.19}/inspector.d.ts +47 -1
  16. {node v24.13 → node v24.19}/inspector.generated.d.ts +167 -0
  17. {node v24.13 → node v24.19}/module.d.ts +1 -0
  18. {node v24.13 → node v24.19}/net.d.ts +139 -15
  19. {node v24.13 → node v24.19}/os.d.ts +30 -30
  20. {node v24.13 → node v24.19}/package.json +3 -3
  21. {node v24.13 → node v24.19}/perf_hooks.d.ts +31 -19
  22. {node v24.13 → node v24.19}/process.d.ts +42 -43
  23. {node v24.13 → node v24.19}/sqlite.d.ts +153 -11
  24. {node v24.13 → node v24.19}/stream/consumers.d.ts +7 -0
  25. {node v24.13 → node v24.19}/stream/web.d.ts +19 -0
  26. {node v24.13 → node v24.19}/stream.d.ts +2 -1
  27. {node v24.13 → node v24.19}/test.d.ts +320 -13
  28. {node v24.13 → node v24.19}/tls.d.ts +50 -15
  29. {node v24.13 → node v24.19}/ts5.6/buffer.buffer.d.ts +5 -0
  30. {node v24.13 → node v24.19}/tty.d.ts +4 -3
  31. {node v24.13 → node v24.19}/url.d.ts +27 -3
  32. {node v24.13 → node v24.19}/util.d.ts +42 -2
  33. {node v24.13 → node v24.19}/v8.d.ts +51 -23
  34. {node v24.13 → node v24.19}/vm.d.ts +52 -87
  35. {node v24.13 → node v24.19}/zlib.d.ts +23 -0
  36. {node v24.13 → node v24.19}/LICENSE +0 -0
  37. {node v24.13 → node v24.19}/assert/strict.d.ts +0 -0
  38. {node v24.13 → node v24.19}/assert.d.ts +0 -0
  39. {node v24.13 → node v24.19}/cluster.d.ts +0 -0
  40. {node v24.13 → node v24.19}/compatibility/iterators.d.ts +0 -0
  41. {node v24.13 → node v24.19}/console.d.ts +0 -0
  42. {node v24.13 → node v24.19}/constants.d.ts +0 -0
  43. {node v24.13 → node v24.19}/diagnostics_channel.d.ts +0 -0
  44. {node v24.13 → node v24.19}/domain.d.ts +0 -0
  45. {node v24.13 → node v24.19}/globals.d.ts +0 -0
  46. {node v24.13 → node v24.19}/globals.typedarray.d.ts +0 -0
  47. {node v24.13 → node v24.19}/https.d.ts +0 -0
  48. {node v24.13 → node v24.19}/index.d.ts +0 -0
  49. {node v24.13 → node v24.19}/path.d.ts +0 -0
  50. {node v24.13 → node v24.19}/punycode.d.ts +0 -0
  51. {node v24.13 → node v24.19}/querystring.d.ts +0 -0
  52. {node v24.13 → node v24.19}/readline/promises.d.ts +0 -0
  53. {node v24.13 → node v24.19}/readline.d.ts +0 -0
  54. {node v24.13 → node v24.19}/repl.d.ts +0 -0
  55. {node v24.13 → node v24.19}/sea.d.ts +0 -0
  56. {node v24.13 → node v24.19}/stream/promises.d.ts +0 -0
  57. {node v24.13 → node v24.19}/string_decoder.d.ts +0 -0
  58. {node v24.13 → node v24.19}/timers/promises.d.ts +0 -0
  59. {node v24.13 → node v24.19}/timers.d.ts +0 -0
  60. {node v24.13 → node v24.19}/trace_events.d.ts +0 -0
  61. {node v24.13 → node v24.19}/ts5.6/compatibility/float16array.d.ts +0 -0
  62. {node v24.13 → node v24.19}/ts5.6/globals.typedarray.d.ts +0 -0
  63. {node v24.13 → node v24.19}/ts5.6/index.d.ts +0 -0
  64. {node v24.13 → node v24.19}/ts5.7/compatibility/float16array.d.ts +0 -0
  65. {node v24.13 → node v24.19}/ts5.7/index.d.ts +0 -0
  66. {node v24.13 → node v24.19}/wasi.d.ts +0 -0
  67. {node v24.13 → node v24.19}/web-globals/abortcontroller.d.ts +0 -0
  68. {node v24.13 → node v24.19}/web-globals/crypto.d.ts +0 -0
  69. {node v24.13 → node v24.19}/web-globals/domexception.d.ts +0 -0
  70. {node v24.13 → node v24.19}/web-globals/events.d.ts +0 -0
  71. {node v24.13 → node v24.19}/web-globals/fetch.d.ts +0 -0
  72. {node v24.13 → node v24.19}/web-globals/navigator.d.ts +0 -0
  73. {node v24.13 → node v24.19}/web-globals/storage.d.ts +0 -0
  74. {node v24.13 → node v24.19}/web-globals/streams.d.ts +0 -0
  75. {node v24.13 → node v24.19}/worker_threads.d.ts +0 -0
@@ -238,9 +238,31 @@ declare module "url" {
238
238
  * * `result` is returned.
239
239
  * @since v0.1.25
240
240
  * @legacy Use the WHATWG URL API instead.
241
- * @param urlObject A URL object (as returned by `url.parse()` or constructed otherwise). If a string, it is converted to an object by passing it to `url.parse()`.
241
+ * @param urlObject A URL object (as returned by `url.parse()` or constructed otherwise).
242
242
  */
243
- function format(urlObject: UrlObject | string): string;
243
+ function format(urlObject: UrlObject): string;
244
+ /**
245
+ * `url.format(urlString)` is shorthand for `url.format(url.parse(urlString))`.
246
+ *
247
+ * Because it invokes the deprecated `url.parse()` internally, passing a string argument
248
+ * to `url.format()` is itself deprecated.
249
+ *
250
+ * Canonicalizing a URL string can be performed using the WHATWG URL API, by
251
+ * constructing a new URL object and calling `url.toString()`.
252
+ *
253
+ * ```js
254
+ * import { URL } from 'node:url';
255
+ *
256
+ * const unformatted = 'http://[fe80:0:0:0:0:0:0:1]:/a/b?a=b#abc';
257
+ * const formatted = new URL(unformatted).toString();
258
+ *
259
+ * console.log(formatted); // Prints: http://[fe80::1]/a/b?a=b#abc
260
+ * ```
261
+ * @since v0.1.25
262
+ * @deprecated Use the WHATWG URL API instead.
263
+ * @param urlString A string that will be passed to `url.parse()` and then formatted.
264
+ */
265
+ function format(urlString: string): string;
244
266
  /**
245
267
  * The `url.resolve()` method resolves a target URL relative to a base URL in a
246
268
  * manner similar to that of a web browser resolving an anchor tag.
@@ -252,6 +274,8 @@ declare module "url" {
252
274
  * url.resolve('http://example.com/one', '/two'); // 'http://example.com/two'
253
275
  * ```
254
276
  *
277
+ * Because it invokes the deprecated `url.parse()` internally, `url.resolve()` is itself deprecated.
278
+ *
255
279
  * To achieve the same result using the WHATWG URL API:
256
280
  *
257
281
  * ```js
@@ -270,7 +294,7 @@ declare module "url" {
270
294
  * resolve('http://example.com/one', '/two'); // 'http://example.com/two'
271
295
  * ```
272
296
  * @since v0.1.25
273
- * @legacy Use the WHATWG URL API instead.
297
+ * @deprecated Use the WHATWG URL API instead.
274
298
  * @param from The base URL to use if `to` is a relative URL.
275
299
  * @param to The target URL to resolve.
276
300
  */
@@ -707,6 +707,28 @@ declare module "util" {
707
707
  * @legacy Use ES2015 class syntax and `extends` keyword instead.
708
708
  */
709
709
  export function inherits(constructor: unknown, superConstructor: unknown): void;
710
+ /**
711
+ * The `util.convertProcessSignalToExitCode()` method converts a signal name to its
712
+ * corresponding POSIX exit code. Following the POSIX standard, the exit code
713
+ * for a process terminated by a signal is calculated as `128 + signal number`.
714
+ *
715
+ * If `signal` is not a valid signal name, then an error will be thrown. See
716
+ * [`signal(7)`](https://man7.org/linux/man-pages/man7/signal.7.html) for a list of valid signals.
717
+ *
718
+ * ```js
719
+ * import { convertProcessSignalToExitCode } from 'node:util';
720
+ *
721
+ * console.log(convertProcessSignalToExitCode('SIGTERM')); // 143 (128 + 15)
722
+ * console.log(convertProcessSignalToExitCode('SIGKILL')); // 137 (128 + 9)
723
+ * ```
724
+ *
725
+ * This is particularly useful when working with processes to determine
726
+ * the exit code based on the signal that terminated the process.
727
+ * @since v24.14.0
728
+ * @param signal A signal name (e.g. `'SIGTERM'`)
729
+ * @returns The exit code corresponding to `signal`
730
+ */
731
+ export function convertProcessSignalToExitCode(signal: NodeJS.Signals): number;
710
732
  export type DebugLoggerFunction = (msg: string, ...param: unknown[]) => void;
711
733
  export interface DebugLogger extends DebugLoggerFunction {
712
734
  /**
@@ -929,6 +951,8 @@ declare module "util" {
929
951
  * `reason`.
930
952
  *
931
953
  * ```js
954
+ * import util from 'node:util';
955
+ *
932
956
  * function fn() {
933
957
  * return Promise.reject(null);
934
958
  * }
@@ -1256,8 +1280,23 @@ declare module "util" {
1256
1280
  *
1257
1281
  * The special format value `none` applies no additional styling to the text.
1258
1282
  *
1283
+ * In addition to predefined color names, `util.styleText()` supports hex color
1284
+ * strings using ANSI TrueColor (24-bit) escape sequences. Hex colors can be
1285
+ * specified in either 3-digit (`#RGB`) or 6-digit (`#RRGGBB`) format:
1286
+ *
1287
+ * ```js
1288
+ * import { styleText } from 'node:util';
1289
+ *
1290
+ * // 6-digit hex color
1291
+ * console.log(styleText('#ff5733', 'Orange text'));
1292
+ *
1293
+ * // 3-digit hex color (shorthand)
1294
+ * console.log(styleText('#f00', 'Red text'));
1295
+ * ```
1296
+ *
1259
1297
  * The full list of formats can be found in [modifiers](https://nodejs.org/docs/latest-v24.x/api/util.html#modifiers).
1260
- * @param format A text format or an Array of text formats defined in `util.inspect.colors`.
1298
+ * @param format A text format or an Array of text formats defined in `util.inspect.colors`, or a hex color in `#RGB`
1299
+ * or `#RRGGBB` form.
1261
1300
  * @param text The text to to be formatted.
1262
1301
  * @since v20.12.0
1263
1302
  */
@@ -1266,7 +1305,8 @@ declare module "util" {
1266
1305
  | ForegroundColors
1267
1306
  | BackgroundColors
1268
1307
  | Modifiers
1269
- | Array<ForegroundColors | BackgroundColors | Modifiers>,
1308
+ | Array<ForegroundColors | BackgroundColors | Modifiers>
1309
+ | `#${string}`,
1270
1310
  text: string,
1271
1311
  options?: StyleTextOptions,
1272
1312
  ): string;
@@ -71,7 +71,37 @@ declare module "v8" {
71
71
  /**
72
72
  * Returns an object with the following properties:
73
73
  *
74
- * `does_zap_garbage` is a 0/1 boolean, which signifies whether the `--zap_code_space` option is enabled or not. This makes V8 overwrite heap
74
+ * `total_heap_size` The value of total\_heap\_size is the number of bytes V8 has
75
+ * allocated for the heap. This can grow if used\_heap needs more memory.
76
+ *
77
+ * `total_heap_size_executable` The value of total\_heap\_size\_executable is the
78
+ * portion of the heap that can contain executable code, in bytes. This includes
79
+ * memory used by JIT-compiled code and any memory that must be kept executable.
80
+ *
81
+ * `total_physical_size` The value of total\_physical\_size is the actual physical memory
82
+ * used by the V8 heap, in bytes. This is the amount of memory that is committed
83
+ * (or in use) rather than reserved.
84
+ *
85
+ * `total_available_size` The value of total\_available\_size is the number of
86
+ * bytes of memory available to the V8 heap. This value represents how much
87
+ * more memory V8 can use before it exceeds the heap limit.
88
+ *
89
+ * `used_heap_size` The value of used\_heap\_size is number of bytes currently
90
+ * being used by V8’s JavaScript objects. This is the actual memory in use and
91
+ * does not include memory that has been allocated but not yet used.
92
+ *
93
+ * `heap_size_limit` The value of heap\_size\_limit is the maximum size of the V8
94
+ * heap, in bytes (either the default limit, determined by system resources, or
95
+ * the value passed to the `--max_old_space_size` option).
96
+ *
97
+ * `malloced_memory` The value of malloced\_memory is the number of bytes allocated
98
+ * through `malloc` by V8.
99
+ *
100
+ * `peak_malloced_memory` The value of peak\_malloced\_memory is the peak number of
101
+ * bytes allocated through `malloc` by V8 during the lifetime of the process.
102
+ *
103
+ * `does_zap_garbage` is a 0/1 boolean, which signifies whether the
104
+ * `--zap_code_space` option is enabled or not. This makes V8 overwrite heap
75
105
  * garbage with a bit pattern. The RSS footprint (resident set size) gets bigger
76
106
  * because it continuously touches all heap pages and that makes them less likely
77
107
  * to get swapped out by the operating system.
@@ -93,22 +123,22 @@ declare module "v8" {
93
123
  * `external_memory` The value of external\_memory is the memory size of array
94
124
  * buffers and external strings.
95
125
  *
96
- * ```js
126
+ * ```json
97
127
  * {
98
- * total_heap_size: 7326976,
99
- * total_heap_size_executable: 4194304,
100
- * total_physical_size: 7326976,
101
- * total_available_size: 1152656,
102
- * used_heap_size: 3476208,
103
- * heap_size_limit: 1535115264,
104
- * malloced_memory: 16384,
105
- * peak_malloced_memory: 1127496,
106
- * does_zap_garbage: 0,
107
- * number_of_native_contexts: 1,
108
- * number_of_detached_contexts: 0,
109
- * total_global_handles_size: 8192,
110
- * used_global_handles_size: 3296,
111
- * external_memory: 318824
128
+ * "total_heap_size": 7326976,
129
+ * "total_heap_size_executable": 4194304,
130
+ * "total_physical_size": 7326976,
131
+ * "total_available_size": 1152656,
132
+ * "used_heap_size": 3476208,
133
+ * "heap_size_limit": 1535115264,
134
+ * "malloced_memory": 16384,
135
+ * "peak_malloced_memory": 1127496,
136
+ * "does_zap_garbage": 0,
137
+ * "number_of_native_contexts": 1,
138
+ * "number_of_detached_contexts": 0,
139
+ * "total_global_handles_size": 8192,
140
+ * "used_global_handles_size": 3296,
141
+ * "external_memory": 318824
112
142
  * }
113
143
  * ```
114
144
  * @since v1.0.0
@@ -389,12 +419,12 @@ declare module "v8" {
389
419
  * V8 [`GetHeapCodeAndMetadataStatistics`](https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#a6079122af17612ef54ef3348ce170866) API. Returns an object with the
390
420
  * following properties:
391
421
  *
392
- * ```js
422
+ * ```json
393
423
  * {
394
- * code_and_metadata_size: 212208,
395
- * bytecode_and_metadata_size: 161368,
396
- * external_script_source_size: 1410794,
397
- * cpu_profiler_metadata_size: 0,
424
+ * "code_and_metadata_size": 212208,
425
+ * "bytecode_and_metadata_size": 161368,
426
+ * "external_script_source_size": 1410794,
427
+ * "cpu_profiler_metadata_size": 0
398
428
  * }
399
429
  * ```
400
430
  * @since v12.8.0
@@ -883,8 +913,6 @@ declare module "v8" {
883
913
  * For example, if the `entry.js` contains the following script:
884
914
  *
885
915
  * ```js
886
- * 'use strict';
887
- *
888
916
  * import fs from 'node:fs';
889
917
  * import zlib from 'node:zlib';
890
918
  * import path from 'node:path';
@@ -238,16 +238,16 @@ declare module "vm" {
238
238
  * The globals are contained in the `context` object.
239
239
  *
240
240
  * ```js
241
- * import vm from 'node:vm';
241
+ * import { createContext, Script } from 'node:vm';
242
242
  *
243
243
  * const context = {
244
244
  * animal: 'cat',
245
245
  * count: 2,
246
246
  * };
247
247
  *
248
- * const script = new vm.Script('count += 1; name = "kitty";');
248
+ * const script = new Script('count += 1; name = "kitty";');
249
249
  *
250
- * vm.createContext(context);
250
+ * createContext(context);
251
251
  * for (let i = 0; i < 10; ++i) {
252
252
  * script.runInContext(context);
253
253
  * }
@@ -281,9 +281,9 @@ declare module "vm" {
281
281
  * contained within each individual `context`.
282
282
  *
283
283
  * ```js
284
- * const vm = require('node:vm');
284
+ * import { constants, Script } from 'node:vm';
285
285
  *
286
- * const script = new vm.Script('globalVar = "set"');
286
+ * const script = new Script('globalVar = "set"');
287
287
  *
288
288
  * const contexts = [{}, {}, {}];
289
289
  * contexts.forEach((context) => {
@@ -294,10 +294,10 @@ declare module "vm" {
294
294
  * // Prints: [{ globalVar: 'set' }, { globalVar: 'set' }, { globalVar: 'set' }]
295
295
  *
296
296
  * // This would throw if the context is created from a contextified object.
297
- * // vm.constants.DONT_CONTEXTIFY allows creating contexts with ordinary
297
+ * // constants.DONT_CONTEXTIFY allows creating contexts with ordinary
298
298
  * // global objects that can be frozen.
299
- * const freezeScript = new vm.Script('Object.freeze(globalThis); globalThis;');
300
- * const frozenContext = freezeScript.runInNewContext(vm.constants.DONT_CONTEXTIFY);
299
+ * const freezeScript = new Script('Object.freeze(globalThis); globalThis;');
300
+ * const frozenContext = freezeScript.runInNewContext(constants.DONT_CONTEXTIFY);
301
301
  * ```
302
302
  * @since v0.3.1
303
303
  * @param contextObject Either `vm.constants.DONT_CONTEXTIFY` or an object that will be contextified.
@@ -316,11 +316,11 @@ declare module "vm" {
316
316
  * executes that code multiple times:
317
317
  *
318
318
  * ```js
319
- * import vm from 'node:vm';
319
+ * import { Script } from 'node:vm';
320
320
  *
321
321
  * global.globalVar = 0;
322
322
  *
323
- * const script = new vm.Script('globalVar += 1', { filename: 'myfile.vm' });
323
+ * const script = new Script('globalVar += 1', { filename: 'myfile.vm' });
324
324
  *
325
325
  * for (let i = 0; i < 1000; ++i) {
326
326
  * script.runInThisContext();
@@ -409,14 +409,14 @@ declare module "vm" {
409
409
  * variables will remain unchanged.
410
410
  *
411
411
  * ```js
412
- * const vm = require('node:vm');
412
+ * import { createContext, runInContext } from 'node:vm';
413
413
  *
414
414
  * global.globalVar = 3;
415
415
  *
416
416
  * const context = { globalVar: 1 };
417
- * vm.createContext(context);
417
+ * createContext(context);
418
418
  *
419
- * vm.runInContext('globalVar *= 2;', context);
419
+ * runInContext('globalVar *= 2;', context);
420
420
  *
421
421
  * console.log(context);
422
422
  * // Prints: { globalVar: 2 }
@@ -467,13 +467,13 @@ declare module "vm" {
467
467
  * The following example compiles and executes different scripts using a single `contextified` object:
468
468
  *
469
469
  * ```js
470
- * import vm from 'node:vm';
470
+ * import { createContext, runInContext } from 'node:vm';
471
471
  *
472
472
  * const contextObject = { globalVar: 1 };
473
- * vm.createContext(contextObject);
473
+ * createContext(contextObject);
474
474
  *
475
475
  * for (let i = 0; i < 10; ++i) {
476
- * vm.runInContext('globalVar *= 2;', contextObject);
476
+ * runInContext('globalVar *= 2;', contextObject);
477
477
  * }
478
478
  * console.log(contextObject);
479
479
  * // Prints: { globalVar: 1024 }
@@ -504,21 +504,24 @@ declare module "vm" {
504
504
  * variable and sets a new one. These globals are contained in the `contextObject`.
505
505
  *
506
506
  * ```js
507
- * const vm = require('node:vm');
507
+ * import { runInNewContext, constants } from 'node:vm';
508
508
  *
509
509
  * const contextObject = {
510
510
  * animal: 'cat',
511
511
  * count: 2,
512
512
  * };
513
513
  *
514
- * vm.runInNewContext('count += 1; name = "kitty"', contextObject);
514
+ * runInNewContext('count += 1; name = "kitty"', contextObject);
515
515
  * console.log(contextObject);
516
516
  * // Prints: { animal: 'cat', count: 3, name: 'kitty' }
517
517
  *
518
518
  * // This would throw if the context is created from a contextified object.
519
519
  * // vm.constants.DONT_CONTEXTIFY allows creating contexts with ordinary global objects that
520
520
  * // can be frozen.
521
- * const frozenContext = vm.runInNewContext('Object.freeze(globalThis); globalThis;', vm.constants.DONT_CONTEXTIFY);
521
+ * const frozenContext = runInNewContext(
522
+ * 'Object.freeze(globalThis); globalThis;',
523
+ * constants.DONT_CONTEXTIFY,
524
+ * );
522
525
  * ```
523
526
  * @since v0.3.1
524
527
  * @param code The JavaScript code to compile and run.
@@ -542,10 +545,10 @@ declare module "vm" {
542
545
  * the JavaScript [`eval()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval) function to run the same code:
543
546
  *
544
547
  * ```js
545
- * import vm from 'node:vm';
548
+ * import { runInThisContext } from 'node:vm';
546
549
  * let localVar = 'initial value';
547
550
  *
548
- * const vmResult = vm.runInThisContext('localVar = "vm";');
551
+ * const vmResult = runInThisContext('localVar = "vm";');
549
552
  * console.log(`vmResult: '${vmResult}', localVar: '${localVar}'`);
550
553
  * // Prints: vmResult: 'vm', localVar: 'initial value'
551
554
  *
@@ -557,38 +560,6 @@ declare module "vm" {
557
560
  * Because `vm.runInThisContext()` does not have access to the local scope, `localVar` is unchanged. In contrast,
558
561
  * [`eval()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval) _does_ have access to the
559
562
  * local scope, so the value `localVar` is changed. In this way `vm.runInThisContext()` is much like an [indirect `eval()` call](https://es5.github.io/#x10.4.2), e.g.`(0,eval)('code')`.
560
- *
561
- * ## Example: Running an HTTP server within a VM
562
- *
563
- * When using either `script.runInThisContext()` or {@link runInThisContext}, the code is executed within the current V8 global
564
- * context. The code passed to this VM context will have its own isolated scope.
565
- *
566
- * In order to run a simple web server using the `node:http` module the code passed
567
- * to the context must either import `node:http` on its own, or have a
568
- * reference to the `node:http` module passed to it. For instance:
569
- *
570
- * ```js
571
- * 'use strict';
572
- * import vm from 'node:vm';
573
- *
574
- * const code = `
575
- * ((require) => {
576
- * const http = require('node:http');
577
- *
578
- * http.createServer((request, response) => {
579
- * response.writeHead(200, { 'Content-Type': 'text/plain' });
580
- * response.end('Hello World\\n');
581
- * }).listen(8124);
582
- *
583
- * console.log('Server running at http://127.0.0.1:8124/');
584
- * })`;
585
- *
586
- * vm.runInThisContext(code)(require);
587
- * ```
588
- *
589
- * The `require()` in the above case shares the state with the context it is
590
- * passed from. This may introduce risks when untrusted code is executed, e.g.
591
- * altering objects in the context in unwanted ways.
592
563
  * @since v0.3.1
593
564
  * @param code The JavaScript code to compile and run.
594
565
  * @return the result of the very last statement executed in the script.
@@ -620,44 +591,32 @@ declare module "vm" {
620
591
  * the memory occupied by each heap space in the current V8 instance.
621
592
  *
622
593
  * ```js
623
- * import vm from 'node:vm';
594
+ * import { createContext, measureMemory } from 'node:vm';
624
595
  * // Measure the memory used by the main context.
625
- * vm.measureMemory({ mode: 'summary' })
596
+ * measureMemory({ mode: 'summary' })
626
597
  * // This is the same as vm.measureMemory()
627
598
  * .then((result) => {
628
599
  * // The current format is:
629
600
  * // {
630
- * // total: {
631
- * // jsMemoryEstimate: 2418479, jsMemoryRange: [ 2418479, 2745799 ]
632
- * // }
601
+ * // total: { jsMemoryEstimate: 1601828, jsMemoryRange: [1601828, 5275288] },
602
+ * // WebAssembly: { code: 0, metadata: 33962 },
633
603
  * // }
634
604
  * console.log(result);
635
605
  * });
636
606
  *
637
- * const context = vm.createContext({ a: 1 });
638
- * vm.measureMemory({ mode: 'detailed', execution: 'eager' })
639
- * .then((result) => {
640
- * // Reference the context here so that it won't be GC'ed
641
- * // until the measurement is complete.
642
- * console.log(context.a);
643
- * // {
644
- * // total: {
645
- * // jsMemoryEstimate: 2574732,
646
- * // jsMemoryRange: [ 2574732, 2904372 ]
647
- * // },
648
- * // current: {
649
- * // jsMemoryEstimate: 2438996,
650
- * // jsMemoryRange: [ 2438996, 2768636 ]
651
- * // },
652
- * // other: [
653
- * // {
654
- * // jsMemoryEstimate: 135736,
655
- * // jsMemoryRange: [ 135736, 465376 ]
656
- * // }
657
- * // ]
658
- * // }
659
- * console.log(result);
660
- * });
607
+ * const context = createContext({ a: 1 });
608
+ * measureMemory({ mode: 'detailed', execution: 'eager' }).then((result) => {
609
+ * // Reference the context here so that it won't be GC'ed
610
+ * // until the measurement is complete.
611
+ * console.log('Context:', context.a);
612
+ * // {
613
+ * // total: { jsMemoryEstimate: 1767100, jsMemoryRange: [1767100, 5440560] },
614
+ * // WebAssembly: { code: 0, metadata: 33962 },
615
+ * // current: { jsMemoryEstimate: 1601828, jsMemoryRange: [1601828, 5275288] },
616
+ * // other: [{ jsMemoryEstimate: 165272, jsMemoryRange: [Array] }],
617
+ * // }
618
+ * console.log(result);
619
+ * });
661
620
  * ```
662
621
  * @since v13.10.0
663
622
  * @experimental
@@ -819,8 +778,8 @@ declare module "vm" {
819
778
  */
820
779
  status: ModuleStatus;
821
780
  /**
822
- * Evaluate the module and its depenendencies. Corresponds to the [Evaluate() concrete method](https://tc39.es/ecma262/#sec-moduleevaluation)
823
- * field of [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records)s in the ECMAScript specification.
781
+ * Evaluate the module and its dependencies. Corresponds to the [Evaluate() concrete method](https://tc39.es/ecma262/#sec-moduleevaluation) field of
782
+ * [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records)s in the ECMAScript specification.
824
783
  *
825
784
  * If the module is a `vm.SourceTextModule`, `evaluate()` must be called after the module has been instantiated;
826
785
  * otherwise `evaluate()` will return a rejected promise.
@@ -1117,15 +1076,21 @@ declare module "vm" {
1117
1076
  * module graphs.
1118
1077
  *
1119
1078
  * ```js
1120
- * import vm from 'node:vm';
1079
+ * import { SyntheticModule } from 'node:vm';
1121
1080
  *
1122
1081
  * const source = '{ "a": 1 }';
1123
- * const module = new vm.SyntheticModule(['default'], function() {
1082
+ * const syntheticModule = new SyntheticModule(['default'], function() {
1124
1083
  * const obj = JSON.parse(source);
1125
1084
  * this.setExport('default', obj);
1126
1085
  * });
1127
1086
  *
1128
- * // Use `module` in linking...
1087
+ * // Use `syntheticModule` in linking
1088
+ * (async () => {
1089
+ * await syntheticModule.link(() => {});
1090
+ * await syntheticModule.evaluate();
1091
+ *
1092
+ * console.log('Default export:', syntheticModule.namespace.default);
1093
+ * })();
1129
1094
  * ```
1130
1095
  * @since v13.0.0, v12.16.0
1131
1096
  * @experimental
@@ -125,6 +125,13 @@ declare module "zlib" {
125
125
  * @default buffer.kMaxLength
126
126
  */
127
127
  maxOutputLength?: number | undefined;
128
+ /**
129
+ * If `true`, decompression fails when
130
+ * trailing input is detected after the end of the compressed stream. This
131
+ * includes unreadable bytes and, when decompressing gzip, additional gzip
132
+ * members following the first member. **Default:** `false`
133
+ */
134
+ rejectGarbageAfterEnd?: boolean | undefined;
128
135
  }
129
136
  interface BrotliOptions {
130
137
  /**
@@ -156,6 +163,11 @@ declare module "zlib" {
156
163
  * If `true`, returns an object with `buffer` and `engine`.
157
164
  */
158
165
  info?: boolean | undefined;
166
+ /**
167
+ * If `true`, decompression fails when
168
+ * input remains after the first complete compressed stream. **Default:** `false`
169
+ */
170
+ rejectGarbageAfterEnd?: boolean | undefined;
159
171
  }
160
172
  interface ZstdOptions {
161
173
  /**
@@ -175,6 +187,12 @@ declare module "zlib" {
175
187
  * [Zstd parameters](https://nodejs.org/docs/latest-v24.x/api/zlib.html#zstd-constants).
176
188
  */
177
189
  params?: { [key: number]: number | boolean } | undefined;
190
+ /**
191
+ * Expected total size of the uncompressed input. Must match the input size
192
+ * when compression finishes. Only applicable to Zstd compressors.
193
+ * @since v22.15.0
194
+ */
195
+ pledgedSrcSize?: number | undefined;
178
196
  /**
179
197
  * Limits output size when using
180
198
  * [convenience methods](https://nodejs.org/docs/latest-v24.x/api/zlib.html#convenience-methods).
@@ -191,6 +209,11 @@ declare module "zlib" {
191
209
  * @since v24.6.0
192
210
  */
193
211
  dictionary?: NodeJS.ArrayBufferView | undefined;
212
+ /**
213
+ * If `true`, decompression fails when
214
+ * input remains after the first complete compressed stream. **Default:** `false`
215
+ */
216
+ rejectGarbageAfterEnd?: boolean | undefined;
194
217
  }
195
218
  interface Zlib {
196
219
  readonly bytesWritten: number;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes