@rio-cloud/cdk-v2-constructs 8.2.0-alpha.0 → 8.2.1-alpha.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 (179) hide show
  1. package/.jsii +2 -2
  2. package/node_modules/@types/node/README.md +3 -3
  3. package/node_modules/@types/node/assert/strict.d.ts +105 -2
  4. package/node_modules/@types/node/assert.d.ts +211 -92
  5. package/node_modules/@types/node/async_hooks.d.ts +103 -19
  6. package/node_modules/@types/node/buffer.buffer.d.ts +472 -0
  7. package/node_modules/@types/node/buffer.d.ts +88 -516
  8. package/node_modules/@types/node/child_process.d.ts +167 -231
  9. package/node_modules/@types/node/cluster.d.ts +172 -26
  10. package/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
  11. package/node_modules/@types/node/console.d.ts +66 -28
  12. package/node_modules/@types/node/constants.d.ts +14 -12
  13. package/node_modules/@types/node/crypto.d.ts +1458 -497
  14. package/node_modules/@types/node/dgram.d.ts +44 -30
  15. package/node_modules/@types/node/diagnostics_channel.d.ts +389 -4
  16. package/node_modules/@types/node/dns/promises.d.ts +120 -42
  17. package/node_modules/@types/node/dns.d.ts +209 -95
  18. package/node_modules/@types/node/domain.d.ts +14 -18
  19. package/node_modules/@types/node/events.d.ts +245 -113
  20. package/node_modules/@types/node/fs/promises.d.ts +194 -96
  21. package/node_modules/@types/node/fs.d.ts +695 -270
  22. package/node_modules/@types/node/globals.d.ts +97 -308
  23. package/node_modules/@types/node/globals.typedarray.d.ts +41 -0
  24. package/node_modules/@types/node/http.d.ts +363 -97
  25. package/node_modules/@types/node/http2.d.ts +684 -231
  26. package/node_modules/@types/node/https.d.ts +122 -87
  27. package/node_modules/@types/node/index.d.ts +24 -11
  28. package/node_modules/@types/node/inspector.d.ts +220 -2690
  29. package/node_modules/@types/node/inspector.generated.d.ts +4239 -0
  30. package/node_modules/@types/node/module.d.ts +705 -149
  31. package/node_modules/@types/node/net.d.ts +178 -54
  32. package/node_modules/@types/node/os.d.ts +47 -17
  33. package/node_modules/@types/node/package.json +22 -97
  34. package/node_modules/@types/node/path.d.ts +12 -3
  35. package/node_modules/@types/node/perf_hooks.d.ts +500 -97
  36. package/node_modules/@types/node/process.d.ts +657 -87
  37. package/node_modules/@types/node/punycode.d.ts +5 -5
  38. package/node_modules/@types/node/querystring.d.ts +24 -13
  39. package/node_modules/@types/node/readline/promises.d.ts +25 -14
  40. package/node_modules/@types/node/readline.d.ts +102 -41
  41. package/node_modules/@types/node/repl.d.ts +38 -30
  42. package/node_modules/@types/node/sea.d.ts +162 -0
  43. package/node_modules/@types/node/sqlite.d.ts +1040 -0
  44. package/node_modules/@types/node/stream/consumers.d.ts +33 -7
  45. package/node_modules/@types/node/stream/promises.d.ts +8 -1
  46. package/node_modules/@types/node/stream/web.d.ts +251 -28
  47. package/node_modules/@types/node/stream.d.ts +1060 -1055
  48. package/node_modules/@types/node/string_decoder.d.ts +8 -8
  49. package/node_modules/@types/node/test.d.ts +2133 -1166
  50. package/node_modules/@types/node/timers/promises.d.ts +31 -16
  51. package/node_modules/@types/node/timers.d.ts +159 -114
  52. package/node_modules/@types/node/tls.d.ts +232 -163
  53. package/node_modules/@types/node/trace_events.d.ts +43 -28
  54. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
  55. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  56. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
  57. package/node_modules/@types/node/ts5.6/index.d.ts +103 -0
  58. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  59. package/node_modules/@types/node/ts5.7/index.d.ts +103 -0
  60. package/node_modules/@types/node/tty.d.ts +9 -9
  61. package/node_modules/@types/node/url.d.ts +236 -84
  62. package/node_modules/@types/node/util.d.ts +562 -412
  63. package/node_modules/@types/node/v8.d.ts +368 -21
  64. package/node_modules/@types/node/vm.d.ts +443 -149
  65. package/node_modules/@types/node/wasi.d.ts +62 -18
  66. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  67. package/node_modules/@types/node/web-globals/crypto.d.ts +32 -0
  68. package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  69. package/node_modules/@types/node/web-globals/events.d.ts +97 -0
  70. package/node_modules/@types/node/web-globals/fetch.d.ts +62 -0
  71. package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
  72. package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  73. package/node_modules/@types/node/web-globals/streams.d.ts +22 -0
  74. package/node_modules/@types/node/worker_threads.d.ts +310 -107
  75. package/node_modules/@types/node/zlib.d.ts +301 -73
  76. package/node_modules/undici-types/LICENSE +21 -0
  77. package/node_modules/undici-types/agent.d.ts +13 -12
  78. package/node_modules/undici-types/api.d.ts +26 -26
  79. package/node_modules/undici-types/balanced-pool.d.ts +19 -7
  80. package/node_modules/undici-types/cache-interceptor.d.ts +173 -0
  81. package/node_modules/undici-types/client-stats.d.ts +15 -0
  82. package/node_modules/undici-types/client.d.ts +26 -15
  83. package/node_modules/undici-types/connector.d.ts +2 -2
  84. package/node_modules/undici-types/cookies.d.ts +2 -0
  85. package/node_modules/undici-types/diagnostics-channel.d.ts +19 -12
  86. package/node_modules/undici-types/dispatcher.d.ts +148 -113
  87. package/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
  88. package/node_modules/undici-types/errors.d.ts +79 -46
  89. package/node_modules/undici-types/eventsource.d.ts +66 -0
  90. package/node_modules/undici-types/fetch.d.ts +41 -39
  91. package/node_modules/undici-types/formdata.d.ts +8 -8
  92. package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
  93. package/node_modules/undici-types/global-origin.d.ts +5 -5
  94. package/node_modules/undici-types/h2c-client.d.ts +73 -0
  95. package/node_modules/undici-types/handlers.d.ts +11 -5
  96. package/node_modules/undici-types/header.d.ts +157 -1
  97. package/node_modules/undici-types/index.d.ts +68 -43
  98. package/node_modules/undici-types/interceptors.d.ts +71 -3
  99. package/node_modules/undici-types/mock-agent.d.ts +36 -18
  100. package/node_modules/undici-types/mock-call-history.d.ts +111 -0
  101. package/node_modules/undici-types/mock-client.d.ts +6 -4
  102. package/node_modules/undici-types/mock-errors.d.ts +3 -3
  103. package/node_modules/undici-types/mock-interceptor.d.ts +24 -23
  104. package/node_modules/undici-types/mock-pool.d.ts +6 -4
  105. package/node_modules/undici-types/package.json +1 -1
  106. package/node_modules/undici-types/patch.d.ts +0 -42
  107. package/node_modules/undici-types/pool-stats.d.ts +8 -8
  108. package/node_modules/undici-types/pool.d.ts +21 -8
  109. package/node_modules/undici-types/proxy-agent.d.ts +5 -6
  110. package/node_modules/undici-types/readable.d.ts +24 -17
  111. package/node_modules/undici-types/retry-agent.d.ts +8 -0
  112. package/node_modules/undici-types/retry-handler.d.ts +125 -0
  113. package/node_modules/undici-types/round-robin-pool.d.ts +41 -0
  114. package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
  115. package/node_modules/undici-types/util.d.ts +18 -0
  116. package/node_modules/undici-types/utility.d.ts +7 -0
  117. package/node_modules/undici-types/webidl.d.ts +157 -36
  118. package/node_modules/undici-types/websocket.d.ts +67 -12
  119. package/package.json +9 -60
  120. package/version.json +1 -1
  121. package/node_modules/@types/node/dom-events.d.ts +0 -122
  122. package/node_modules/@types/node/globals.global.d.ts +0 -1
  123. package/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  124. package/node_modules/@types/node/ts4.8/assert.d.ts +0 -996
  125. package/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -539
  126. package/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2362
  127. package/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1540
  128. package/node_modules/@types/node/ts4.8/cluster.d.ts +0 -432
  129. package/node_modules/@types/node/ts4.8/console.d.ts +0 -415
  130. package/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
  131. package/node_modules/@types/node/ts4.8/crypto.d.ts +0 -4455
  132. package/node_modules/@types/node/ts4.8/dgram.d.ts +0 -586
  133. package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -191
  134. package/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -425
  135. package/node_modules/@types/node/ts4.8/dns.d.ts +0 -809
  136. package/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -122
  137. package/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  138. package/node_modules/@types/node/ts4.8/events.d.ts +0 -796
  139. package/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1232
  140. package/node_modules/@types/node/ts4.8/fs.d.ts +0 -4289
  141. package/node_modules/@types/node/ts4.8/globals.d.ts +0 -381
  142. package/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  143. package/node_modules/@types/node/ts4.8/http.d.ts +0 -1888
  144. package/node_modules/@types/node/ts4.8/http2.d.ts +0 -2382
  145. package/node_modules/@types/node/ts4.8/https.d.ts +0 -550
  146. package/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  147. package/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2747
  148. package/node_modules/@types/node/ts4.8/module.d.ts +0 -287
  149. package/node_modules/@types/node/ts4.8/net.d.ts +0 -949
  150. package/node_modules/@types/node/ts4.8/os.d.ts +0 -477
  151. package/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  152. package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -639
  153. package/node_modules/@types/node/ts4.8/process.d.ts +0 -1532
  154. package/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  155. package/node_modules/@types/node/ts4.8/querystring.d.ts +0 -141
  156. package/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -150
  157. package/node_modules/@types/node/ts4.8/readline.d.ts +0 -539
  158. package/node_modules/@types/node/ts4.8/repl.d.ts +0 -430
  159. package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  160. package/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -83
  161. package/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -350
  162. package/node_modules/@types/node/ts4.8/stream.d.ts +0 -1701
  163. package/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  164. package/node_modules/@types/node/ts4.8/test.d.ts +0 -1382
  165. package/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  166. package/node_modules/@types/node/ts4.8/timers.d.ts +0 -240
  167. package/node_modules/@types/node/ts4.8/tls.d.ts +0 -1210
  168. package/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
  169. package/node_modules/@types/node/ts4.8/tty.d.ts +0 -208
  170. package/node_modules/@types/node/ts4.8/url.d.ts +0 -927
  171. package/node_modules/@types/node/ts4.8/util.d.ts +0 -2186
  172. package/node_modules/@types/node/ts4.8/v8.d.ts +0 -635
  173. package/node_modules/@types/node/ts4.8/vm.d.ts +0 -901
  174. package/node_modules/@types/node/ts4.8/wasi.d.ts +0 -158
  175. package/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -691
  176. package/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
  177. package/node_modules/argparse/CHANGELOG.md +0 -216
  178. package/node_modules/undici-types/file.d.ts +0 -39
  179. package/node_modules/undici-types/filereader.d.ts +0 -54
@@ -2,11 +2,12 @@
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
- * const v8 = require('node:v8');
5
+ * import v8 from 'node:v8';
6
6
  * ```
7
- * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/v8.js)
7
+ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/v8.js)
8
8
  */
9
9
  declare module "v8" {
10
+ import { NonSharedBuffer } from "node:buffer";
10
11
  import { Readable } from "node:stream";
11
12
  interface HeapSpaceInfo {
12
13
  space_name: string;
@@ -38,6 +39,18 @@ declare module "v8" {
38
39
  bytecode_and_metadata_size: number;
39
40
  external_script_source_size: number;
40
41
  }
42
+ interface HeapSnapshotOptions {
43
+ /**
44
+ * If true, expose internals in the heap snapshot.
45
+ * @default false
46
+ */
47
+ exposeInternals?: boolean | undefined;
48
+ /**
49
+ * If true, expose numeric values in artificial fields.
50
+ * @default false
51
+ */
52
+ exposeNumericValues?: boolean | undefined;
53
+ }
41
54
  /**
42
55
  * Returns an integer representing a version tag derived from the V8 version,
43
56
  * command-line flags, and detected CPU features. This is useful for determining
@@ -58,7 +71,7 @@ declare module "v8" {
58
71
  /**
59
72
  * Returns an object with the following properties:
60
73
  *
61
- * `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
+ * `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
62
75
  * garbage with a bit pattern. The RSS footprint (resident set size) gets bigger
63
76
  * because it continuously touches all heap pages and that makes them less likely
64
77
  * to get swapped out by the operating system.
@@ -101,11 +114,92 @@ declare module "v8" {
101
114
  * @since v1.0.0
102
115
  */
103
116
  function getHeapStatistics(): HeapInfo;
117
+ /**
118
+ * It returns an object with a structure similar to the
119
+ * [`cppgc::HeapStatistics`](https://v8docs.nodesource.com/node-22.4/d7/d51/heap-statistics_8h_source.html)
120
+ * object. See the [V8 documentation](https://v8docs.nodesource.com/node-22.4/df/d2f/structcppgc_1_1_heap_statistics.html)
121
+ * for more information about the properties of the object.
122
+ *
123
+ * ```js
124
+ * // Detailed
125
+ * ({
126
+ * committed_size_bytes: 131072,
127
+ * resident_size_bytes: 131072,
128
+ * used_size_bytes: 152,
129
+ * space_statistics: [
130
+ * {
131
+ * name: 'NormalPageSpace0',
132
+ * committed_size_bytes: 0,
133
+ * resident_size_bytes: 0,
134
+ * used_size_bytes: 0,
135
+ * page_stats: [{}],
136
+ * free_list_stats: {},
137
+ * },
138
+ * {
139
+ * name: 'NormalPageSpace1',
140
+ * committed_size_bytes: 131072,
141
+ * resident_size_bytes: 131072,
142
+ * used_size_bytes: 152,
143
+ * page_stats: [{}],
144
+ * free_list_stats: {},
145
+ * },
146
+ * {
147
+ * name: 'NormalPageSpace2',
148
+ * committed_size_bytes: 0,
149
+ * resident_size_bytes: 0,
150
+ * used_size_bytes: 0,
151
+ * page_stats: [{}],
152
+ * free_list_stats: {},
153
+ * },
154
+ * {
155
+ * name: 'NormalPageSpace3',
156
+ * committed_size_bytes: 0,
157
+ * resident_size_bytes: 0,
158
+ * used_size_bytes: 0,
159
+ * page_stats: [{}],
160
+ * free_list_stats: {},
161
+ * },
162
+ * {
163
+ * name: 'LargePageSpace',
164
+ * committed_size_bytes: 0,
165
+ * resident_size_bytes: 0,
166
+ * used_size_bytes: 0,
167
+ * page_stats: [{}],
168
+ * free_list_stats: {},
169
+ * },
170
+ * ],
171
+ * type_names: [],
172
+ * detail_level: 'detailed',
173
+ * });
174
+ * ```
175
+ *
176
+ * ```js
177
+ * // Brief
178
+ * ({
179
+ * committed_size_bytes: 131072,
180
+ * resident_size_bytes: 131072,
181
+ * used_size_bytes: 128864,
182
+ * space_statistics: [],
183
+ * type_names: [],
184
+ * detail_level: 'brief',
185
+ * });
186
+ * ```
187
+ * @since v22.15.0
188
+ * @param detailLevel **Default:** `'detailed'`. Specifies the level of detail in the returned statistics.
189
+ * Accepted values are:
190
+ * * `'brief'`: Brief statistics contain only the top-level
191
+ * allocated and used
192
+ * memory statistics for the entire heap.
193
+ * * `'detailed'`: Detailed statistics also contain a break
194
+ * down per space and page, as well as freelist statistics
195
+ * and object type histograms.
196
+ */
197
+ function getCppHeapStatistics(detailLevel?: "brief" | "detailed"): object;
104
198
  /**
105
199
  * Returns statistics about the V8 heap spaces, i.e. the segments which make up
106
200
  * the V8 heap. Neither the ordering of heap spaces, nor the availability of a
107
201
  * heap space can be guaranteed as the statistics are provided via the
108
- * V8[`GetHeapSpaceStatistics`](https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#ac673576f24fdc7a33378f8f57e1d13a4) function and may change from one V8 version to the
202
+ * V8 [`GetHeapSpaceStatistics`](https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#ac673576f24fdc7a33378f8f57e1d13a4) function and may change from one V8 version to the
109
203
  * next.
110
204
  *
111
205
  * The value returned is an array of objects containing the following properties:
@@ -158,19 +252,62 @@ declare module "v8" {
158
252
  * after the VM has started may result in unpredictable behavior, including
159
253
  * crashes and data loss; or it may simply do nothing.
160
254
  *
161
- * The V8 options available for a version of Node.js may be determined by running`node --v8-options`.
255
+ * The V8 options available for a version of Node.js may be determined by running `node --v8-options`.
162
256
  *
163
257
  * Usage:
164
258
  *
165
259
  * ```js
166
260
  * // Print GC events to stdout for one minute.
167
- * const v8 = require('node:v8');
261
+ * import v8 from 'node:v8';
168
262
  * v8.setFlagsFromString('--trace_gc');
169
263
  * setTimeout(() => { v8.setFlagsFromString('--notrace_gc'); }, 60e3);
170
264
  * ```
171
265
  * @since v1.0.0
172
266
  */
173
267
  function setFlagsFromString(flags: string): void;
268
+ /**
269
+ * This is similar to the [`queryObjects()` console API](https://developer.chrome.com/docs/devtools/console/utilities#queryObjects-function)
270
+ * provided by the Chromium DevTools console. It can be used to search for objects that have the matching constructor on its prototype chain
271
+ * in the heap after a full garbage collection, which can be useful for memory leak regression tests. To avoid surprising results, users should
272
+ * avoid using this API on constructors whose implementation they don't control, or on constructors that can be invoked by other parties in the
273
+ * application.
274
+ *
275
+ * To avoid accidental leaks, this API does not return raw references to the objects found. By default, it returns the count of the objects
276
+ * found. If `options.format` is `'summary'`, it returns an array containing brief string representations for each object. The visibility provided
277
+ * in this API is similar to what the heap snapshot provides, while users can save the cost of serialization and parsing and directly filter the
278
+ * target objects during the search.
279
+ *
280
+ * Only objects created in the current execution context are included in the results.
281
+ *
282
+ * ```js
283
+ * import { queryObjects } from 'node:v8';
284
+ * class A { foo = 'bar'; }
285
+ * console.log(queryObjects(A)); // 0
286
+ * const a = new A();
287
+ * console.log(queryObjects(A)); // 1
288
+ * // [ "A { foo: 'bar' }" ]
289
+ * console.log(queryObjects(A, { format: 'summary' }));
290
+ *
291
+ * class B extends A { bar = 'qux'; }
292
+ * const b = new B();
293
+ * console.log(queryObjects(B)); // 1
294
+ * // [ "B { foo: 'bar', bar: 'qux' }" ]
295
+ * console.log(queryObjects(B, { format: 'summary' }));
296
+ *
297
+ * // Note that, when there are child classes inheriting from a constructor,
298
+ * // the constructor also shows up in the prototype chain of the child
299
+ * // classes's prototoype, so the child classes's prototoype would also be
300
+ * // included in the result.
301
+ * console.log(queryObjects(A)); // 3
302
+ * // [ "B { foo: 'bar', bar: 'qux' }", 'A {}', "A { foo: 'bar' }" ]
303
+ * console.log(queryObjects(A, { format: 'summary' }));
304
+ * ```
305
+ * @param ctor The constructor that can be used to search on the prototype chain in order to filter target objects in the heap.
306
+ * @since v20.13.0
307
+ */
308
+ function queryObjects(ctor: Function): number | string[];
309
+ function queryObjects(ctor: Function, options: { format: "count" }): number;
310
+ function queryObjects(ctor: Function, options: { format: "summary" }): string[];
174
311
  /**
175
312
  * Generates a snapshot of the current V8 heap and returns a Readable
176
313
  * Stream that may be used to read the JSON serialized representation.
@@ -187,14 +324,14 @@ declare module "v8" {
187
324
  *
188
325
  * ```js
189
326
  * // Print heap snapshot to the console
190
- * const v8 = require('node:v8');
327
+ * import v8 from 'node:v8';
191
328
  * const stream = v8.getHeapSnapshot();
192
329
  * stream.pipe(process.stdout);
193
330
  * ```
194
331
  * @since v11.13.0
195
332
  * @return A Readable containing the V8 heap snapshot.
196
333
  */
197
- function getHeapSnapshot(): Readable;
334
+ function getHeapSnapshot(options?: HeapSnapshotOptions): Readable;
198
335
  /**
199
336
  * Generates a snapshot of the current V8 heap and writes it to a JSON
200
337
  * file. This file is intended to be used with tools such as Chrome
@@ -212,12 +349,12 @@ declare module "v8" {
212
349
  * for a duration depending on the heap size.
213
350
  *
214
351
  * ```js
215
- * const { writeHeapSnapshot } = require('node:v8');
216
- * const {
352
+ * import { writeHeapSnapshot } from 'node:v8';
353
+ * import {
217
354
  * Worker,
218
355
  * isMainThread,
219
356
  * parentPort,
220
- * } = require('node:worker_threads');
357
+ * } from 'node:worker_threads';
221
358
  *
222
359
  * if (isMainThread) {
223
360
  * const worker = new Worker(__filename);
@@ -246,10 +383,10 @@ declare module "v8" {
246
383
  * worker thread.
247
384
  * @return The filename where the snapshot was saved.
248
385
  */
249
- function writeHeapSnapshot(filename?: string): string;
386
+ function writeHeapSnapshot(filename?: string, options?: HeapSnapshotOptions): string;
250
387
  /**
251
388
  * 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
389
+ * V8 [`GetHeapCodeAndMetadataStatistics`](https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#a6079122af17612ef54ef3348ce170866) API. Returns an object with the
253
390
  * following properties:
254
391
  *
255
392
  * ```js
@@ -263,6 +400,97 @@ declare module "v8" {
263
400
  * @since v12.8.0
264
401
  */
265
402
  function getHeapCodeStatistics(): HeapCodeStatistics;
403
+ /**
404
+ * @since v24.12.0
405
+ */
406
+ interface SyncCPUProfileHandle {
407
+ /**
408
+ * Stopping collecting the profile and return the profile data.
409
+ * @since v24.12.0
410
+ */
411
+ stop(): string;
412
+ /**
413
+ * Stopping collecting the profile and the profile will be discarded.
414
+ * @since v24.12.0
415
+ */
416
+ [Symbol.dispose](): void;
417
+ }
418
+ /**
419
+ * @since v24.8.0
420
+ */
421
+ interface CPUProfileHandle {
422
+ /**
423
+ * Stopping collecting the profile, then return a Promise that fulfills with an error or the
424
+ * profile data.
425
+ * @since v24.8.0
426
+ */
427
+ stop(): Promise<string>;
428
+ /**
429
+ * Stopping collecting the profile and the profile will be discarded.
430
+ * @since v24.8.0
431
+ */
432
+ [Symbol.asyncDispose](): Promise<void>;
433
+ }
434
+ /**
435
+ * @since v24.9.0
436
+ */
437
+ interface HeapProfileHandle {
438
+ /**
439
+ * Stopping collecting the profile, then return a Promise that fulfills with an error or the
440
+ * profile data.
441
+ * @since v24.9.0
442
+ */
443
+ stop(): Promise<string>;
444
+ /**
445
+ * Stopping collecting the profile and the profile will be discarded.
446
+ * @since v24.9.0
447
+ */
448
+ [Symbol.asyncDispose](): Promise<void>;
449
+ }
450
+ /**
451
+ * V8 only supports `Latin-1/ISO-8859-1` and `UTF16` as the underlying representation of a string.
452
+ * If the `content` uses `Latin-1/ISO-8859-1` as the underlying representation, this function will return true;
453
+ * otherwise, it returns false.
454
+ *
455
+ * If this method returns false, that does not mean that the string contains some characters not in `Latin-1/ISO-8859-1`.
456
+ * Sometimes a `Latin-1` string may also be represented as `UTF16`.
457
+ *
458
+ * ```js
459
+ * const { isStringOneByteRepresentation } = require('node:v8');
460
+ *
461
+ * const Encoding = {
462
+ * latin1: 1,
463
+ * utf16le: 2,
464
+ * };
465
+ * const buffer = Buffer.alloc(100);
466
+ * function writeString(input) {
467
+ * if (isStringOneByteRepresentation(input)) {
468
+ * buffer.writeUint8(Encoding.latin1);
469
+ * buffer.writeUint32LE(input.length, 1);
470
+ * buffer.write(input, 5, 'latin1');
471
+ * } else {
472
+ * buffer.writeUint8(Encoding.utf16le);
473
+ * buffer.writeUint32LE(input.length * 2, 1);
474
+ * buffer.write(input, 5, 'utf16le');
475
+ * }
476
+ * }
477
+ * writeString('hello');
478
+ * writeString('你好');
479
+ * ```
480
+ * @since v23.10.0, v22.15.0
481
+ */
482
+ function isStringOneByteRepresentation(content: string): boolean;
483
+ /**
484
+ * Starting a CPU profile then return a `SyncCPUProfileHandle` object. This API supports `using` syntax.
485
+ *
486
+ * ```js
487
+ * const handle = v8.startCpuProfile();
488
+ * const profile = handle.stop();
489
+ * console.log(profile);
490
+ * ```
491
+ * @since v24.12.0
492
+ */
493
+ function startCpuProfile(): SyncCPUProfileHandle;
266
494
  /**
267
495
  * @since v8.0.0
268
496
  */
@@ -283,7 +511,7 @@ declare module "v8" {
283
511
  * the buffer is released. Calling this method results in undefined behavior
284
512
  * if a previous write has failed.
285
513
  */
286
- releaseBuffer(): Buffer;
514
+ releaseBuffer(): NonSharedBuffer;
287
515
  /**
288
516
  * Marks an `ArrayBuffer` as having its contents transferred out of band.
289
517
  * Pass the corresponding `ArrayBuffer` in the deserializing context to `deserializer.transferArrayBuffer()`.
@@ -311,7 +539,7 @@ declare module "v8" {
311
539
  * will require a way to compute the length of the buffer.
312
540
  * For use inside of a custom `serializer._writeHostObject()`.
313
541
  */
314
- writeRawBytes(buffer: NodeJS.TypedArray): void;
542
+ writeRawBytes(buffer: NodeJS.ArrayBufferView): void;
315
543
  }
316
544
  /**
317
545
  * A subclass of `Serializer` that serializes `TypedArray`(in particular `Buffer`) and `DataView` objects as host objects, and only
@@ -344,7 +572,7 @@ declare module "v8" {
344
572
  transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void;
345
573
  /**
346
574
  * Reads the underlying wire format version. Likely mostly to be useful to
347
- * legacy code reading old wire format versions. May not be called before`.readHeader()`.
575
+ * legacy code reading old wire format versions. May not be called before `.readHeader()`.
348
576
  */
349
577
  getWireFormatVersion(): number;
350
578
  /**
@@ -353,7 +581,7 @@ declare module "v8" {
353
581
  */
354
582
  readUint32(): number;
355
583
  /**
356
- * Read a raw 64-bit unsigned integer and return it as an array `[hi, lo]`with two 32-bit unsigned integer entries.
584
+ * Read a raw 64-bit unsigned integer and return it as an array `[hi, lo]` with two 32-bit unsigned integer entries.
357
585
  * For use inside of a custom `deserializer._readHostObject()`.
358
586
  */
359
587
  readUint64(): [number, number];
@@ -382,14 +610,14 @@ declare module "v8" {
382
610
  * larger than `buffer.constants.MAX_LENGTH`.
383
611
  * @since v8.0.0
384
612
  */
385
- function serialize(value: any): Buffer;
613
+ function serialize(value: any): NonSharedBuffer;
386
614
  /**
387
615
  * Uses a `DefaultDeserializer` with default options to read a JS value
388
616
  * from a buffer.
389
617
  * @since v8.0.0
390
618
  * @param buffer A buffer returned by {@link serialize}.
391
619
  */
392
- function deserialize(buffer: NodeJS.TypedArray): any;
620
+ function deserialize(buffer: NodeJS.ArrayBufferView): any;
393
621
  /**
394
622
  * The `v8.takeCoverage()` method allows the user to write the coverage started by `NODE_V8_COVERAGE` to disk on demand. This method can be invoked multiple
395
623
  * times during the lifetime of the process. Each time the execution counter will
@@ -408,6 +636,12 @@ declare module "v8" {
408
636
  * @since v15.1.0, v14.18.0, v12.22.0
409
637
  */
410
638
  function stopCoverage(): void;
639
+ /**
640
+ * The API is a no-op if `--heapsnapshot-near-heap-limit` is already set from the command line or the API is called more than once.
641
+ * `limit` must be a positive integer. See [`--heapsnapshot-near-heap-limit`](https://nodejs.org/docs/latest-v24.x/api/cli.html#--heapsnapshot-near-heap-limitmax_count) for more information.
642
+ * @since v18.10.0, v16.18.0
643
+ */
644
+ function setHeapSnapshotNearHeapLimit(limit: number): void;
411
645
  /**
412
646
  * This API collects GC data in current thread.
413
647
  * @since v19.6.0, v18.15.0
@@ -419,7 +653,7 @@ declare module "v8" {
419
653
  */
420
654
  start(): void;
421
655
  /**
422
- * Stop collecting GC data and return an object.The content of object
656
+ * Stop collecting GC data and return an object. The content of object
423
657
  * is as follows.
424
658
  *
425
659
  * ```json
@@ -487,7 +721,7 @@ declare module "v8" {
487
721
  * Here's an example.
488
722
  *
489
723
  * ```js
490
- * const { GCProfiler } = require('v8');
724
+ * import { GCProfiler } from 'node:v8';
491
725
  * const profiler = new GCProfiler();
492
726
  * profiler.start();
493
727
  * setTimeout(() => {
@@ -497,6 +731,11 @@ declare module "v8" {
497
731
  * @since v19.6.0, v18.15.0
498
732
  */
499
733
  stop(): GCProfilerResult;
734
+ /**
735
+ * Stop collecting GC data, and discard the profile.
736
+ * @since v24.13.0
737
+ */
738
+ [Symbol.dispose](): void;
500
739
  }
501
740
  interface GCProfilerResult {
502
741
  version: number;
@@ -629,6 +868,114 @@ declare module "v8" {
629
868
  * @since v17.1.0, v16.14.0
630
869
  */
631
870
  const promiseHooks: PromiseHooks;
871
+ type StartupSnapshotCallbackFn = (args: any) => any;
872
+ /**
873
+ * The `v8.startupSnapshot` interface can be used to add serialization and deserialization hooks for custom startup snapshots.
874
+ *
875
+ * ```bash
876
+ * $ node --snapshot-blob snapshot.blob --build-snapshot entry.js
877
+ * # This launches a process with the snapshot
878
+ * $ node --snapshot-blob snapshot.blob
879
+ * ```
880
+ *
881
+ * In the example above, `entry.js` can use methods from the `v8.startupSnapshot` interface to specify how to save information for custom objects
882
+ * in the snapshot during serialization and how the information can be used to synchronize these objects during deserialization of the snapshot.
883
+ * For example, if the `entry.js` contains the following script:
884
+ *
885
+ * ```js
886
+ * 'use strict';
887
+ *
888
+ * import fs from 'node:fs';
889
+ * import zlib from 'node:zlib';
890
+ * import path from 'node:path';
891
+ * import assert from 'node:assert';
892
+ *
893
+ * import v8 from 'node:v8';
894
+ *
895
+ * class BookShelf {
896
+ * storage = new Map();
897
+ *
898
+ * // Reading a series of files from directory and store them into storage.
899
+ * constructor(directory, books) {
900
+ * for (const book of books) {
901
+ * this.storage.set(book, fs.readFileSync(path.join(directory, book)));
902
+ * }
903
+ * }
904
+ *
905
+ * static compressAll(shelf) {
906
+ * for (const [ book, content ] of shelf.storage) {
907
+ * shelf.storage.set(book, zlib.gzipSync(content));
908
+ * }
909
+ * }
910
+ *
911
+ * static decompressAll(shelf) {
912
+ * for (const [ book, content ] of shelf.storage) {
913
+ * shelf.storage.set(book, zlib.gunzipSync(content));
914
+ * }
915
+ * }
916
+ * }
917
+ *
918
+ * // __dirname here is where the snapshot script is placed
919
+ * // during snapshot building time.
920
+ * const shelf = new BookShelf(__dirname, [
921
+ * 'book1.en_US.txt',
922
+ * 'book1.es_ES.txt',
923
+ * 'book2.zh_CN.txt',
924
+ * ]);
925
+ *
926
+ * assert(v8.startupSnapshot.isBuildingSnapshot());
927
+ * // On snapshot serialization, compress the books to reduce size.
928
+ * v8.startupSnapshot.addSerializeCallback(BookShelf.compressAll, shelf);
929
+ * // On snapshot deserialization, decompress the books.
930
+ * v8.startupSnapshot.addDeserializeCallback(BookShelf.decompressAll, shelf);
931
+ * v8.startupSnapshot.setDeserializeMainFunction((shelf) => {
932
+ * // process.env and process.argv are refreshed during snapshot
933
+ * // deserialization.
934
+ * const lang = process.env.BOOK_LANG || 'en_US';
935
+ * const book = process.argv[1];
936
+ * const name = `${book}.${lang}.txt`;
937
+ * console.log(shelf.storage.get(name));
938
+ * }, shelf);
939
+ * ```
940
+ *
941
+ * The resulted binary will get print the data deserialized from the snapshot during start up, using the refreshed `process.env` and `process.argv` of the launched process:
942
+ *
943
+ * ```bash
944
+ * $ BOOK_LANG=es_ES node --snapshot-blob snapshot.blob book1
945
+ * # Prints content of book1.es_ES.txt deserialized from the snapshot.
946
+ * ```
947
+ *
948
+ * Currently the application deserialized from a user-land snapshot cannot be snapshotted again, so these APIs are only available to applications that are not deserialized from a user-land snapshot.
949
+ *
950
+ * @since v18.6.0, v16.17.0
951
+ */
952
+ namespace startupSnapshot {
953
+ /**
954
+ * Add a callback that will be called when the Node.js instance is about to get serialized into a snapshot and exit.
955
+ * This can be used to release resources that should not or cannot be serialized or to convert user data into a form more suitable for serialization.
956
+ * @since v18.6.0, v16.17.0
957
+ */
958
+ function addSerializeCallback(callback: StartupSnapshotCallbackFn, data?: any): void;
959
+ /**
960
+ * Add a callback that will be called when the Node.js instance is deserialized from a snapshot.
961
+ * The `callback` and the `data` (if provided) will be serialized into the snapshot, they can be used to re-initialize the state of the application or
962
+ * to re-acquire resources that the application needs when the application is restarted from the snapshot.
963
+ * @since v18.6.0, v16.17.0
964
+ */
965
+ function addDeserializeCallback(callback: StartupSnapshotCallbackFn, data?: any): void;
966
+ /**
967
+ * This sets the entry point of the Node.js application when it is deserialized from a snapshot. This can be called only once in the snapshot building script.
968
+ * If called, the deserialized application no longer needs an additional entry point script to start up and will simply invoke the callback along with the deserialized
969
+ * data (if provided), otherwise an entry point script still needs to be provided to the deserialized application.
970
+ * @since v18.6.0, v16.17.0
971
+ */
972
+ function setDeserializeMainFunction(callback: StartupSnapshotCallbackFn, data?: any): void;
973
+ /**
974
+ * Returns true if the Node.js instance is run to build a snapshot.
975
+ * @since v18.6.0, v16.17.0
976
+ */
977
+ function isBuildingSnapshot(): boolean;
978
+ }
632
979
  }
633
980
  declare module "node:v8" {
634
981
  export * from "v8";