@types/node 22.15.21 → 22.18.10
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 v22.18/README.md +15 -0
- node/assert.d.ts → node v22.18/assert.d.ts +19 -0
- node/buffer.d.ts → node v22.18/buffer.d.ts +6 -2
- node/child_process.d.ts → node v22.18/child_process.d.ts +41 -131
- node/cluster.d.ts → node v22.18/cluster.d.ts +3 -4
- node/compatibility/disposable.d.ts → node v22.18/compatibility/disposable.d.ts +0 -2
- node/compatibility/indexable.d.ts → node v22.18/compatibility/indexable.d.ts +0 -3
- node/compatibility/iterators.d.ts → node v22.18/compatibility/iterators.d.ts +0 -1
- node/crypto.d.ts → node v22.18/crypto.d.ts +52 -36
- node/diagnostics_channel.d.ts → node v22.18/diagnostics_channel.d.ts +17 -12
- node/dns/promises.d.ts → node v22.18/dns/promises.d.ts +36 -9
- node/dns.d.ts → node v22.18/dns.d.ts +74 -21
- node/events.d.ts → node v22.18/events.d.ts +80 -35
- node/fs/promises.d.ts → node v22.18/fs/promises.d.ts +44 -39
- node/fs.d.ts → node v22.18/fs.d.ts +67 -56
- node v22.18/globals.d.ts +172 -0
- node/http.d.ts → node v22.18/http.d.ts +71 -10
- node/http2.d.ts → node v22.18/http2.d.ts +85 -5
- node/https.d.ts → node v22.18/https.d.ts +14 -12
- node/index.d.ts → node v22.18/index.d.ts +7 -3
- node/inspector.d.ts → node v22.18/inspector.generated.d.ts +219 -10
- node/module.d.ts → node v22.18/module.d.ts +136 -17
- node/net.d.ts → node v22.18/net.d.ts +5 -5
- node/os.d.ts → node v22.18/os.d.ts +13 -3
- node/package.json → node v22.18/package.json +3 -83
- node/perf_hooks.d.ts → node v22.18/perf_hooks.d.ts +8 -10
- node/process.d.ts → node v22.18/process.d.ts +10 -23
- node/readline/promises.d.ts → node v22.18/readline/promises.d.ts +1 -2
- node/repl.d.ts → node v22.18/repl.d.ts +3 -5
- node/sqlite.d.ts → node v22.18/sqlite.d.ts +207 -0
- node/stream/web.d.ts → node v22.18/stream/web.d.ts +8 -0
- node/stream.d.ts → node v22.18/stream.d.ts +34 -32
- node v22.18/test.d.ts +2162 -0
- node/tls.d.ts → node v22.18/tls.d.ts +2 -2
- node/ts5.6/index.d.ts → node v22.18/ts5.6/index.d.ts +7 -3
- node/url.d.ts → node v22.18/url.d.ts +12 -3
- node/util.d.ts → node v22.18/util.d.ts +20 -5
- node/v8.d.ts → node v22.18/v8.d.ts +62 -32
- node/vm.d.ts → node v22.18/vm.d.ts +62 -54
- node v22.18/web-globals/abortcontroller.d.ts +34 -0
- node v22.18/web-globals/domexception.d.ts +68 -0
- node v22.18/web-globals/events.d.ts +97 -0
- node v22.18/web-globals/fetch.d.ts +46 -0
- node v22.18/web-globals/navigator.d.ts +22 -0
- node v22.18/web-globals/storage.d.ts +24 -0
- node/worker_threads.d.ts → node v22.18/worker_threads.d.ts +105 -74
- node/zlib.d.ts → node v22.18/zlib.d.ts +8 -2
- node/README.md +0 -15
- node/dom-events.d.ts +0 -124
- node/globals.d.ts +0 -371
- node/test.d.ts +0 -2280
- {node → node v22.18}/LICENSE +0 -0
- {node → node v22.18}/assert/strict.d.ts +0 -0
- node/async_hooks.d.ts → node v22.18/async_hooks.d.ts +1 -1
- {node → node v22.18}/buffer.buffer.d.ts +0 -0
- {node → node v22.18}/compatibility/index.d.ts +0 -0
- {node → node v22.18}/console.d.ts +0 -0
- {node → node v22.18}/constants.d.ts +0 -0
- {node → node v22.18}/dgram.d.ts +0 -0
- {node → node v22.18}/domain.d.ts +0 -0
- {node → node v22.18}/globals.typedarray.d.ts +0 -0
- {node → node v22.18}/path.d.ts +0 -0
- {node → node v22.18}/punycode.d.ts +0 -0
- {node → node v22.18}/querystring.d.ts +0 -0
- {node → node v22.18}/readline.d.ts +0 -0
- {node → node v22.18}/sea.d.ts +0 -0
- {node → node v22.18}/stream/consumers.d.ts +0 -0
- {node → node v22.18}/stream/promises.d.ts +0 -0
- {node → node v22.18}/string_decoder.d.ts +0 -0
- {node → node v22.18}/timers/promises.d.ts +0 -0
- {node → node v22.18}/timers.d.ts +0 -0
- {node → node v22.18}/trace_events.d.ts +0 -0
- {node → node v22.18}/ts5.6/buffer.buffer.d.ts +0 -0
- {node → node v22.18}/ts5.6/globals.typedarray.d.ts +0 -0
- {node → node v22.18}/tty.d.ts +0 -0
- {node → node v22.18}/wasi.d.ts +0 -0
|
@@ -586,7 +586,7 @@ declare module "tls" {
|
|
|
586
586
|
* requires explicitly specifying a cipher suite with the `ciphers` option.
|
|
587
587
|
* More information can be found in the RFC 4279.
|
|
588
588
|
*/
|
|
589
|
-
pskCallback
|
|
589
|
+
pskCallback?: ((socket: TLSSocket, identity: string) => NodeJS.ArrayBufferView | null) | undefined;
|
|
590
590
|
/**
|
|
591
591
|
* hint to send to a client to help
|
|
592
592
|
* with selecting the identity during TLS-PSK negotiation. Will be ignored
|
|
@@ -627,7 +627,7 @@ declare module "tls" {
|
|
|
627
627
|
* compatible with the selected cipher's digest.
|
|
628
628
|
* `identity` must use UTF-8 encoding.
|
|
629
629
|
*/
|
|
630
|
-
pskCallback
|
|
630
|
+
pskCallback?: ((hint: string | null) => PSKCallbackNegotation | null) | undefined;
|
|
631
631
|
}
|
|
632
632
|
/**
|
|
633
633
|
* Accepts encrypted connections using TLS or SSL.
|
|
@@ -36,6 +36,12 @@
|
|
|
36
36
|
|
|
37
37
|
// Definitions for Node.js modules that are not specific to any version of TypeScript:
|
|
38
38
|
/// <reference path="../globals.d.ts" />
|
|
39
|
+
/// <reference path="../web-globals/abortcontroller.d.ts" />
|
|
40
|
+
/// <reference path="../web-globals/domexception.d.ts" />
|
|
41
|
+
/// <reference path="../web-globals/events.d.ts" />
|
|
42
|
+
/// <reference path="../web-globals/fetch.d.ts" />
|
|
43
|
+
/// <reference path="../web-globals/navigator.d.ts" />
|
|
44
|
+
/// <reference path="../web-globals/storage.d.ts" />
|
|
39
45
|
/// <reference path="../assert.d.ts" />
|
|
40
46
|
/// <reference path="../assert/strict.d.ts" />
|
|
41
47
|
/// <reference path="../async_hooks.d.ts" />
|
|
@@ -49,16 +55,14 @@
|
|
|
49
55
|
/// <reference path="../diagnostics_channel.d.ts" />
|
|
50
56
|
/// <reference path="../dns.d.ts" />
|
|
51
57
|
/// <reference path="../dns/promises.d.ts" />
|
|
52
|
-
/// <reference path="../dns/promises.d.ts" />
|
|
53
58
|
/// <reference path="../domain.d.ts" />
|
|
54
|
-
/// <reference path="../dom-events.d.ts" />
|
|
55
59
|
/// <reference path="../events.d.ts" />
|
|
56
60
|
/// <reference path="../fs.d.ts" />
|
|
57
61
|
/// <reference path="../fs/promises.d.ts" />
|
|
58
62
|
/// <reference path="../http.d.ts" />
|
|
59
63
|
/// <reference path="../http2.d.ts" />
|
|
60
64
|
/// <reference path="../https.d.ts" />
|
|
61
|
-
/// <reference path="../inspector.d.ts" />
|
|
65
|
+
/// <reference path="../inspector.generated.d.ts" />
|
|
62
66
|
/// <reference path="../module.d.ts" />
|
|
63
67
|
/// <reference path="../net.d.ts" />
|
|
64
68
|
/// <reference path="../os.d.ts" />
|
|
@@ -315,6 +315,17 @@ declare module "url" {
|
|
|
315
315
|
* @return The fully-resolved platform-specific Node.js file path.
|
|
316
316
|
*/
|
|
317
317
|
function fileURLToPath(url: string | URL, options?: FileUrlToPathOptions): string;
|
|
318
|
+
/**
|
|
319
|
+
* Like `url.fileURLToPath(...)` except that instead of returning a string
|
|
320
|
+
* representation of the path, a `Buffer` is returned. This conversion is
|
|
321
|
+
* helpful when the input URL contains percent-encoded segments that are
|
|
322
|
+
* not valid UTF-8 / Unicode sequences.
|
|
323
|
+
* @since v22.18.0
|
|
324
|
+
* @param url The file URL string or URL object to convert to a path.
|
|
325
|
+
* @returns The fully-resolved platform-specific Node.js file path
|
|
326
|
+
* as a `Buffer`.
|
|
327
|
+
*/
|
|
328
|
+
function fileURLToPathBuffer(url: string | URL, options?: FileUrlToPathOptions): Buffer;
|
|
318
329
|
/**
|
|
319
330
|
* This function ensures that `path` is resolved absolutely, and that the URL
|
|
320
331
|
* control characters are correctly encoded when converting into a File URL.
|
|
@@ -420,14 +431,12 @@ declare module "url" {
|
|
|
420
431
|
* Threads, `Blob` objects registered within one Worker will not be available
|
|
421
432
|
* to other workers or the main thread.
|
|
422
433
|
* @since v16.7.0
|
|
423
|
-
* @experimental
|
|
424
434
|
*/
|
|
425
435
|
static createObjectURL(blob: NodeBlob): string;
|
|
426
436
|
/**
|
|
427
437
|
* Removes the stored `Blob` identified by the given ID. Attempting to revoke a
|
|
428
438
|
* ID that isn't registered will silently fail.
|
|
429
439
|
* @since v16.7.0
|
|
430
|
-
* @experimental
|
|
431
440
|
* @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
|
|
432
441
|
*/
|
|
433
442
|
static revokeObjectURL(id: string): void;
|
|
@@ -828,7 +837,7 @@ declare module "url" {
|
|
|
828
837
|
* Returns an ES6 `Iterator` over each of the name-value pairs in the query.
|
|
829
838
|
* Each item of the iterator is a JavaScript `Array`. The first item of the `Array` is the `name`, the second item of the `Array` is the `value`.
|
|
830
839
|
*
|
|
831
|
-
* Alias for `urlSearchParams[
|
|
840
|
+
* Alias for `urlSearchParams[Symbol.iterator]()`.
|
|
832
841
|
*/
|
|
833
842
|
entries(): URLSearchParamsIterator<[string, string]>;
|
|
834
843
|
/**
|
|
@@ -433,7 +433,6 @@ declare module "util" {
|
|
|
433
433
|
* });
|
|
434
434
|
* ```
|
|
435
435
|
* @since v19.7.0
|
|
436
|
-
* @experimental
|
|
437
436
|
* @param resource Any non-null object tied to the abortable operation and held weakly.
|
|
438
437
|
* If `resource` is garbage collected before the `signal` aborts, the promise remains pending,
|
|
439
438
|
* allowing Node.js to stop tracking it.
|
|
@@ -445,8 +444,8 @@ declare module "util" {
|
|
|
445
444
|
* intended for debugging. The output of `util.inspect` may change at any time
|
|
446
445
|
* and should not be depended upon programmatically. Additional `options` may be
|
|
447
446
|
* passed that alter the result.
|
|
448
|
-
* `util.inspect()` will use the constructor's name and/or
|
|
449
|
-
* an identifiable tag for an inspected value.
|
|
447
|
+
* `util.inspect()` will use the constructor's name and/or `Symbol.toStringTag`
|
|
448
|
+
* property to make an identifiable tag for an inspected value.
|
|
450
449
|
*
|
|
451
450
|
* ```js
|
|
452
451
|
* class Foo {
|
|
@@ -1411,7 +1410,7 @@ declare module "util" {
|
|
|
1411
1410
|
* @param content The raw contents of a `.env` file.
|
|
1412
1411
|
* @since v20.12.0
|
|
1413
1412
|
*/
|
|
1414
|
-
export function parseEnv(content: string):
|
|
1413
|
+
export function parseEnv(content: string): NodeJS.Dict<string>;
|
|
1415
1414
|
// https://nodejs.org/docs/latest/api/util.html#foreground-colors
|
|
1416
1415
|
type ForegroundColors =
|
|
1417
1416
|
| "black"
|
|
@@ -1462,6 +1461,7 @@ declare module "util" {
|
|
|
1462
1461
|
| "hidden"
|
|
1463
1462
|
| "inverse"
|
|
1464
1463
|
| "italic"
|
|
1464
|
+
| "none"
|
|
1465
1465
|
| "overlined"
|
|
1466
1466
|
| "reset"
|
|
1467
1467
|
| "strikethrough"
|
|
@@ -1481,7 +1481,7 @@ declare module "util" {
|
|
|
1481
1481
|
/**
|
|
1482
1482
|
* This function returns a formatted text considering the `format` passed
|
|
1483
1483
|
* for printing in a terminal. It is aware of the terminal's capabilities
|
|
1484
|
-
* and acts according to the configuration set via `
|
|
1484
|
+
* and acts according to the configuration set via `NO_COLOR`,
|
|
1485
1485
|
* `NODE_DISABLE_COLORS` and `FORCE_COLOR` environment variables.
|
|
1486
1486
|
*
|
|
1487
1487
|
* ```js
|
|
@@ -1518,6 +1518,8 @@ declare module "util" {
|
|
|
1518
1518
|
* );
|
|
1519
1519
|
* ```
|
|
1520
1520
|
*
|
|
1521
|
+
* The special format value `none` applies no additional styling to the text.
|
|
1522
|
+
*
|
|
1521
1523
|
* The full list of formats can be found in [modifiers](https://nodejs.org/docs/latest-v22.x/api/util.html#modifiers).
|
|
1522
1524
|
* @param format A text format or an Array of text formats defined in `util.inspect.colors`.
|
|
1523
1525
|
* @param text The text to to be formatted.
|
|
@@ -2226,6 +2228,19 @@ declare module "util/types" {
|
|
|
2226
2228
|
* @since v10.0.0
|
|
2227
2229
|
*/
|
|
2228
2230
|
function isExternal(object: unknown): boolean;
|
|
2231
|
+
/**
|
|
2232
|
+
* Returns `true` if the value is a built-in `Float16Array` instance.
|
|
2233
|
+
*
|
|
2234
|
+
* ```js
|
|
2235
|
+
* util.types.isFloat16Array(new ArrayBuffer()); // Returns false
|
|
2236
|
+
* util.types.isFloat16Array(new Float16Array()); // Returns true
|
|
2237
|
+
* util.types.isFloat16Array(new Float32Array()); // Returns false
|
|
2238
|
+
* ```
|
|
2239
|
+
* @since v22.16.0
|
|
2240
|
+
*/
|
|
2241
|
+
// This does NOT return a type predicate in v22.x.
|
|
2242
|
+
// The Float16Array feature does not yet exist in this version of Node.js.
|
|
2243
|
+
function isFloat16Array(object: unknown): boolean;
|
|
2229
2244
|
/**
|
|
2230
2245
|
* Returns `true` if the value is a built-in [`Float32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array) instance.
|
|
2231
2246
|
*
|
|
@@ -43,12 +43,12 @@ declare module "v8" {
|
|
|
43
43
|
* If true, expose internals in the heap snapshot.
|
|
44
44
|
* @default false
|
|
45
45
|
*/
|
|
46
|
-
exposeInternals?: boolean;
|
|
46
|
+
exposeInternals?: boolean | undefined;
|
|
47
47
|
/**
|
|
48
48
|
* If true, expose numeric values in artificial fields.
|
|
49
49
|
* @default false
|
|
50
50
|
*/
|
|
51
|
-
exposeNumericValues?: boolean;
|
|
51
|
+
exposeNumericValues?: boolean | undefined;
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* Returns an integer representing a version tag derived from the V8 version,
|
|
@@ -400,6 +400,39 @@ declare module "v8" {
|
|
|
400
400
|
* @since v12.8.0
|
|
401
401
|
*/
|
|
402
402
|
function getHeapCodeStatistics(): HeapCodeStatistics;
|
|
403
|
+
/**
|
|
404
|
+
* V8 only supports `Latin-1/ISO-8859-1` and `UTF16` as the underlying representation of a string.
|
|
405
|
+
* If the `content` uses `Latin-1/ISO-8859-1` as the underlying representation, this function will return true;
|
|
406
|
+
* otherwise, it returns false.
|
|
407
|
+
*
|
|
408
|
+
* If this method returns false, that does not mean that the string contains some characters not in `Latin-1/ISO-8859-1`.
|
|
409
|
+
* Sometimes a `Latin-1` string may also be represented as `UTF16`.
|
|
410
|
+
*
|
|
411
|
+
* ```js
|
|
412
|
+
* const { isStringOneByteRepresentation } = require('node:v8');
|
|
413
|
+
*
|
|
414
|
+
* const Encoding = {
|
|
415
|
+
* latin1: 1,
|
|
416
|
+
* utf16le: 2,
|
|
417
|
+
* };
|
|
418
|
+
* const buffer = Buffer.alloc(100);
|
|
419
|
+
* function writeString(input) {
|
|
420
|
+
* if (isStringOneByteRepresentation(input)) {
|
|
421
|
+
* buffer.writeUint8(Encoding.latin1);
|
|
422
|
+
* buffer.writeUint32LE(input.length, 1);
|
|
423
|
+
* buffer.write(input, 5, 'latin1');
|
|
424
|
+
* } else {
|
|
425
|
+
* buffer.writeUint8(Encoding.utf16le);
|
|
426
|
+
* buffer.writeUint32LE(input.length * 2, 1);
|
|
427
|
+
* buffer.write(input, 5, 'utf16le');
|
|
428
|
+
* }
|
|
429
|
+
* }
|
|
430
|
+
* writeString('hello');
|
|
431
|
+
* writeString('你好');
|
|
432
|
+
* ```
|
|
433
|
+
* @since v22.15.0
|
|
434
|
+
*/
|
|
435
|
+
function isStringOneByteRepresentation(content: string): boolean;
|
|
403
436
|
/**
|
|
404
437
|
* @since v8.0.0
|
|
405
438
|
*/
|
|
@@ -548,7 +581,6 @@ declare module "v8" {
|
|
|
548
581
|
/**
|
|
549
582
|
* 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.
|
|
550
583
|
* `limit` must be a positive integer. See [`--heapsnapshot-near-heap-limit`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--heapsnapshot-near-heap-limitmax_count) for more information.
|
|
551
|
-
* @experimental
|
|
552
584
|
* @since v18.10.0, v16.18.0
|
|
553
585
|
*/
|
|
554
586
|
function setHeapSnapshotNearHeapLimit(limit: number): void;
|
|
@@ -774,33 +806,6 @@ declare module "v8" {
|
|
|
774
806
|
*/
|
|
775
807
|
const promiseHooks: PromiseHooks;
|
|
776
808
|
type StartupSnapshotCallbackFn = (args: any) => any;
|
|
777
|
-
interface StartupSnapshot {
|
|
778
|
-
/**
|
|
779
|
-
* Add a callback that will be called when the Node.js instance is about to get serialized into a snapshot and exit.
|
|
780
|
-
* 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.
|
|
781
|
-
* @since v18.6.0, v16.17.0
|
|
782
|
-
*/
|
|
783
|
-
addSerializeCallback(callback: StartupSnapshotCallbackFn, data?: any): void;
|
|
784
|
-
/**
|
|
785
|
-
* Add a callback that will be called when the Node.js instance is deserialized from a snapshot.
|
|
786
|
-
* 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
|
|
787
|
-
* to re-acquire resources that the application needs when the application is restarted from the snapshot.
|
|
788
|
-
* @since v18.6.0, v16.17.0
|
|
789
|
-
*/
|
|
790
|
-
addDeserializeCallback(callback: StartupSnapshotCallbackFn, data?: any): void;
|
|
791
|
-
/**
|
|
792
|
-
* 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.
|
|
793
|
-
* 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
|
|
794
|
-
* data (if provided), otherwise an entry point script still needs to be provided to the deserialized application.
|
|
795
|
-
* @since v18.6.0, v16.17.0
|
|
796
|
-
*/
|
|
797
|
-
setDeserializeMainFunction(callback: StartupSnapshotCallbackFn, data?: any): void;
|
|
798
|
-
/**
|
|
799
|
-
* Returns true if the Node.js instance is run to build a snapshot.
|
|
800
|
-
* @since v18.6.0, v16.17.0
|
|
801
|
-
*/
|
|
802
|
-
isBuildingSnapshot(): boolean;
|
|
803
|
-
}
|
|
804
809
|
/**
|
|
805
810
|
* The `v8.startupSnapshot` interface can be used to add serialization and deserialization hooks for custom startup snapshots.
|
|
806
811
|
*
|
|
@@ -879,10 +884,35 @@ declare module "v8" {
|
|
|
879
884
|
*
|
|
880
885
|
* 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.
|
|
881
886
|
*
|
|
882
|
-
* @experimental
|
|
883
887
|
* @since v18.6.0, v16.17.0
|
|
884
888
|
*/
|
|
885
|
-
|
|
889
|
+
namespace startupSnapshot {
|
|
890
|
+
/**
|
|
891
|
+
* Add a callback that will be called when the Node.js instance is about to get serialized into a snapshot and exit.
|
|
892
|
+
* 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.
|
|
893
|
+
* @since v18.6.0, v16.17.0
|
|
894
|
+
*/
|
|
895
|
+
function addSerializeCallback(callback: StartupSnapshotCallbackFn, data?: any): void;
|
|
896
|
+
/**
|
|
897
|
+
* Add a callback that will be called when the Node.js instance is deserialized from a snapshot.
|
|
898
|
+
* 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
|
|
899
|
+
* to re-acquire resources that the application needs when the application is restarted from the snapshot.
|
|
900
|
+
* @since v18.6.0, v16.17.0
|
|
901
|
+
*/
|
|
902
|
+
function addDeserializeCallback(callback: StartupSnapshotCallbackFn, data?: any): void;
|
|
903
|
+
/**
|
|
904
|
+
* 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.
|
|
905
|
+
* 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
|
|
906
|
+
* data (if provided), otherwise an entry point script still needs to be provided to the deserialized application.
|
|
907
|
+
* @since v18.6.0, v16.17.0
|
|
908
|
+
*/
|
|
909
|
+
function setDeserializeMainFunction(callback: StartupSnapshotCallbackFn, data?: any): void;
|
|
910
|
+
/**
|
|
911
|
+
* Returns true if the Node.js instance is run to build a snapshot.
|
|
912
|
+
* @since v18.6.0, v16.17.0
|
|
913
|
+
*/
|
|
914
|
+
function isBuildingSnapshot(): boolean;
|
|
915
|
+
}
|
|
886
916
|
}
|
|
887
917
|
declare module "node:v8" {
|
|
888
918
|
export * from "v8";
|
|
@@ -56,6 +56,11 @@ declare module "vm" {
|
|
|
56
56
|
*/
|
|
57
57
|
columnOffset?: number | undefined;
|
|
58
58
|
}
|
|
59
|
+
type DynamicModuleLoader<T> = (
|
|
60
|
+
specifier: string,
|
|
61
|
+
referrer: T,
|
|
62
|
+
importAttributes: ImportAttributes,
|
|
63
|
+
) => Module | Promise<Module>;
|
|
59
64
|
interface ScriptOptions extends BaseOptions {
|
|
60
65
|
/**
|
|
61
66
|
* Provides an optional data with V8's code cache data for the supplied source.
|
|
@@ -69,7 +74,7 @@ declare module "vm" {
|
|
|
69
74
|
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
|
|
70
75
|
*/
|
|
71
76
|
importModuleDynamically?:
|
|
72
|
-
|
|
|
77
|
+
| DynamicModuleLoader<Script>
|
|
73
78
|
| typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
|
|
74
79
|
| undefined;
|
|
75
80
|
}
|
|
@@ -92,47 +97,46 @@ declare module "vm" {
|
|
|
92
97
|
*/
|
|
93
98
|
breakOnSigint?: boolean | undefined;
|
|
94
99
|
}
|
|
95
|
-
interface RunningScriptInNewContextOptions
|
|
100
|
+
interface RunningScriptInNewContextOptions
|
|
101
|
+
extends RunningScriptOptions, Pick<CreateContextOptions, "microtaskMode">
|
|
102
|
+
{
|
|
96
103
|
/**
|
|
97
104
|
* Human-readable name of the newly created context.
|
|
98
105
|
*/
|
|
99
|
-
contextName?: CreateContextOptions["name"];
|
|
106
|
+
contextName?: CreateContextOptions["name"] | undefined;
|
|
100
107
|
/**
|
|
101
108
|
* Origin corresponding to the newly created context for display purposes. The origin should be formatted like a URL,
|
|
102
109
|
* but with only the scheme, host, and port (if necessary), like the value of the `url.origin` property of a `URL` object.
|
|
103
110
|
* Most notably, this string should omit the trailing slash, as that denotes a path.
|
|
104
111
|
*/
|
|
105
|
-
contextOrigin?: CreateContextOptions["origin"];
|
|
106
|
-
contextCodeGeneration?: CreateContextOptions["codeGeneration"];
|
|
107
|
-
/**
|
|
108
|
-
* If set to `afterEvaluate`, microtasks will be run immediately after the script has run.
|
|
109
|
-
*/
|
|
110
|
-
microtaskMode?: CreateContextOptions["microtaskMode"];
|
|
112
|
+
contextOrigin?: CreateContextOptions["origin"] | undefined;
|
|
113
|
+
contextCodeGeneration?: CreateContextOptions["codeGeneration"] | undefined;
|
|
111
114
|
}
|
|
112
|
-
interface RunningCodeOptions extends RunningScriptOptions {
|
|
115
|
+
interface RunningCodeOptions extends RunningScriptOptions, Pick<ScriptOptions, "cachedData"> {
|
|
113
116
|
/**
|
|
114
|
-
*
|
|
117
|
+
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
|
|
118
|
+
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
|
|
119
|
+
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
|
|
115
120
|
*/
|
|
116
|
-
|
|
117
|
-
|
|
121
|
+
importModuleDynamically?:
|
|
122
|
+
| DynamicModuleLoader<Script>
|
|
123
|
+
| typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
|
|
124
|
+
| undefined;
|
|
118
125
|
}
|
|
119
|
-
interface RunningCodeInNewContextOptions
|
|
126
|
+
interface RunningCodeInNewContextOptions
|
|
127
|
+
extends RunningScriptInNewContextOptions, Pick<ScriptOptions, "cachedData">
|
|
128
|
+
{
|
|
120
129
|
/**
|
|
121
|
-
*
|
|
130
|
+
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
|
|
131
|
+
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
|
|
132
|
+
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
|
|
122
133
|
*/
|
|
123
|
-
|
|
124
|
-
|
|
134
|
+
importModuleDynamically?:
|
|
135
|
+
| DynamicModuleLoader<Script>
|
|
136
|
+
| typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
|
|
137
|
+
| undefined;
|
|
125
138
|
}
|
|
126
|
-
interface CompileFunctionOptions extends BaseOptions {
|
|
127
|
-
/**
|
|
128
|
-
* Provides an optional data with V8's code cache data for the supplied source.
|
|
129
|
-
*/
|
|
130
|
-
cachedData?: ScriptOptions["cachedData"] | undefined;
|
|
131
|
-
/**
|
|
132
|
-
* Specifies whether to produce new cache data.
|
|
133
|
-
* @default false
|
|
134
|
-
*/
|
|
135
|
-
produceCachedData?: boolean | undefined;
|
|
139
|
+
interface CompileFunctionOptions extends BaseOptions, Pick<ScriptOptions, "cachedData" | "produceCachedData"> {
|
|
136
140
|
/**
|
|
137
141
|
* The sandbox/context in which the said function should be compiled in.
|
|
138
142
|
*/
|
|
@@ -141,6 +145,15 @@ declare module "vm" {
|
|
|
141
145
|
* An array containing a collection of context extensions (objects wrapping the current scope) to be applied while compiling
|
|
142
146
|
*/
|
|
143
147
|
contextExtensions?: Object[] | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
|
|
150
|
+
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
|
|
151
|
+
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
|
|
152
|
+
*/
|
|
153
|
+
importModuleDynamically?:
|
|
154
|
+
| DynamicModuleLoader<ReturnType<typeof compileFunction>>
|
|
155
|
+
| typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
|
|
156
|
+
| undefined;
|
|
144
157
|
}
|
|
145
158
|
interface CreateContextOptions {
|
|
146
159
|
/**
|
|
@@ -175,6 +188,15 @@ declare module "vm" {
|
|
|
175
188
|
* If set to `afterEvaluate`, microtasks will be run immediately after the script has run.
|
|
176
189
|
*/
|
|
177
190
|
microtaskMode?: "afterEvaluate" | undefined;
|
|
191
|
+
/**
|
|
192
|
+
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
|
|
193
|
+
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
|
|
194
|
+
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
|
|
195
|
+
*/
|
|
196
|
+
importModuleDynamically?:
|
|
197
|
+
| DynamicModuleLoader<Context>
|
|
198
|
+
| typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
|
|
199
|
+
| undefined;
|
|
178
200
|
}
|
|
179
201
|
type MeasureMemoryMode = "summary" | "detailed";
|
|
180
202
|
interface MeasureMemoryOptions {
|
|
@@ -341,15 +363,15 @@ declare module "vm" {
|
|
|
341
363
|
*/
|
|
342
364
|
createCachedData(): Buffer;
|
|
343
365
|
/** @deprecated in favor of `script.createCachedData()` */
|
|
344
|
-
cachedDataProduced?: boolean
|
|
366
|
+
cachedDataProduced?: boolean;
|
|
345
367
|
/**
|
|
346
368
|
* When `cachedData` is supplied to create the `vm.Script`, this value will be set
|
|
347
369
|
* to either `true` or `false` depending on acceptance of the data by V8.
|
|
348
370
|
* Otherwise the value is `undefined`.
|
|
349
371
|
* @since v5.7.0
|
|
350
372
|
*/
|
|
351
|
-
cachedDataRejected?: boolean
|
|
352
|
-
cachedData?: Buffer
|
|
373
|
+
cachedDataRejected?: boolean;
|
|
374
|
+
cachedData?: Buffer;
|
|
353
375
|
/**
|
|
354
376
|
* When the script is compiled from a source that contains a source map magic
|
|
355
377
|
* comment, this property will be set to the URL of the source map.
|
|
@@ -367,7 +389,7 @@ declare module "vm" {
|
|
|
367
389
|
* ```
|
|
368
390
|
* @since v19.1.0, v18.13.0
|
|
369
391
|
*/
|
|
370
|
-
sourceMapURL
|
|
392
|
+
sourceMapURL: string | undefined;
|
|
371
393
|
}
|
|
372
394
|
/**
|
|
373
395
|
* If the given `contextObject` is an object, the `vm.createContext()` method will
|
|
@@ -577,11 +599,7 @@ declare module "vm" {
|
|
|
577
599
|
code: string,
|
|
578
600
|
params?: readonly string[],
|
|
579
601
|
options?: CompileFunctionOptions,
|
|
580
|
-
): Function &
|
|
581
|
-
cachedData?: Script["cachedData"] | undefined;
|
|
582
|
-
cachedDataProduced?: Script["cachedDataProduced"] | undefined;
|
|
583
|
-
cachedDataRejected?: Script["cachedDataRejected"] | undefined;
|
|
584
|
-
};
|
|
602
|
+
): Function & Pick<Script, "cachedData" | "cachedDataProduced" | "cachedDataRejected">;
|
|
585
603
|
/**
|
|
586
604
|
* Measure the memory known to V8 and used by all contexts known to the
|
|
587
605
|
* current V8 isolate, or the main context.
|
|
@@ -638,10 +656,7 @@ declare module "vm" {
|
|
|
638
656
|
* @experimental
|
|
639
657
|
*/
|
|
640
658
|
function measureMemory(options?: MeasureMemoryOptions): Promise<MemoryMeasurement>;
|
|
641
|
-
interface ModuleEvaluateOptions {
|
|
642
|
-
timeout?: RunningScriptOptions["timeout"] | undefined;
|
|
643
|
-
breakOnSigint?: RunningScriptOptions["breakOnSigint"] | undefined;
|
|
644
|
-
}
|
|
659
|
+
interface ModuleEvaluateOptions extends Pick<RunningScriptOptions, "breakOnSigint" | "timeout"> {}
|
|
645
660
|
type ModuleLinker = (
|
|
646
661
|
specifier: string,
|
|
647
662
|
referencingModule: Module,
|
|
@@ -848,30 +863,23 @@ declare module "vm" {
|
|
|
848
863
|
*/
|
|
849
864
|
link(linker: ModuleLinker): Promise<void>;
|
|
850
865
|
}
|
|
851
|
-
interface SourceTextModuleOptions {
|
|
866
|
+
interface SourceTextModuleOptions extends Pick<ScriptOptions, "cachedData" | "columnOffset" | "lineOffset"> {
|
|
852
867
|
/**
|
|
853
868
|
* String used in stack traces.
|
|
854
869
|
* @default 'vm:module(i)' where i is a context-specific ascending index.
|
|
855
870
|
*/
|
|
856
871
|
identifier?: string | undefined;
|
|
857
|
-
/**
|
|
858
|
-
* Provides an optional data with V8's code cache data for the supplied source.
|
|
859
|
-
*/
|
|
860
|
-
cachedData?: ScriptOptions["cachedData"] | undefined;
|
|
861
872
|
context?: Context | undefined;
|
|
862
|
-
lineOffset?: BaseOptions["lineOffset"] | undefined;
|
|
863
|
-
columnOffset?: BaseOptions["columnOffset"] | undefined;
|
|
864
873
|
/**
|
|
865
874
|
* Called during evaluation of this module to initialize the `import.meta`.
|
|
866
875
|
*/
|
|
867
876
|
initializeImportMeta?: ((meta: ImportMeta, module: SourceTextModule) => void) | undefined;
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
| undefined;
|
|
877
|
+
/**
|
|
878
|
+
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
|
|
879
|
+
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
|
|
880
|
+
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
|
|
881
|
+
*/
|
|
882
|
+
importModuleDynamically?: DynamicModuleLoader<SourceTextModule> | undefined;
|
|
875
883
|
}
|
|
876
884
|
/**
|
|
877
885
|
* This feature is only available with the `--experimental-vm-modules` command
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
|
|
3
|
+
type _AbortController = typeof globalThis extends { onmessage: any } ? {} : AbortController;
|
|
4
|
+
interface AbortController {
|
|
5
|
+
readonly signal: AbortSignal;
|
|
6
|
+
abort(reason?: any): void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type _AbortSignal = typeof globalThis extends { onmessage: any } ? {} : AbortSignal;
|
|
10
|
+
interface AbortSignal extends EventTarget {
|
|
11
|
+
readonly aborted: boolean;
|
|
12
|
+
onabort: ((this: AbortSignal, ev: Event) => any) | null;
|
|
13
|
+
readonly reason: any;
|
|
14
|
+
throwIfAborted(): void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
declare global {
|
|
18
|
+
interface AbortController extends _AbortController {}
|
|
19
|
+
var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T
|
|
20
|
+
: {
|
|
21
|
+
prototype: AbortController;
|
|
22
|
+
new(): AbortController;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
interface AbortSignal extends _AbortSignal {}
|
|
26
|
+
var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T
|
|
27
|
+
: {
|
|
28
|
+
prototype: AbortSignal;
|
|
29
|
+
new(): AbortSignal;
|
|
30
|
+
abort(reason?: any): AbortSignal;
|
|
31
|
+
any(signals: AbortSignal[]): AbortSignal;
|
|
32
|
+
timeout(milliseconds: number): AbortSignal;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
|
|
3
|
+
type _DOMException = typeof globalThis extends { onmessage: any } ? {} : DOMException;
|
|
4
|
+
interface DOMException extends Error {
|
|
5
|
+
readonly code: number;
|
|
6
|
+
readonly message: string;
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly INDEX_SIZE_ERR: 1;
|
|
9
|
+
readonly DOMSTRING_SIZE_ERR: 2;
|
|
10
|
+
readonly HIERARCHY_REQUEST_ERR: 3;
|
|
11
|
+
readonly WRONG_DOCUMENT_ERR: 4;
|
|
12
|
+
readonly INVALID_CHARACTER_ERR: 5;
|
|
13
|
+
readonly NO_DATA_ALLOWED_ERR: 6;
|
|
14
|
+
readonly NO_MODIFICATION_ALLOWED_ERR: 7;
|
|
15
|
+
readonly NOT_FOUND_ERR: 8;
|
|
16
|
+
readonly NOT_SUPPORTED_ERR: 9;
|
|
17
|
+
readonly INUSE_ATTRIBUTE_ERR: 10;
|
|
18
|
+
readonly INVALID_STATE_ERR: 11;
|
|
19
|
+
readonly SYNTAX_ERR: 12;
|
|
20
|
+
readonly INVALID_MODIFICATION_ERR: 13;
|
|
21
|
+
readonly NAMESPACE_ERR: 14;
|
|
22
|
+
readonly INVALID_ACCESS_ERR: 15;
|
|
23
|
+
readonly VALIDATION_ERR: 16;
|
|
24
|
+
readonly TYPE_MISMATCH_ERR: 17;
|
|
25
|
+
readonly SECURITY_ERR: 18;
|
|
26
|
+
readonly NETWORK_ERR: 19;
|
|
27
|
+
readonly ABORT_ERR: 20;
|
|
28
|
+
readonly URL_MISMATCH_ERR: 21;
|
|
29
|
+
readonly QUOTA_EXCEEDED_ERR: 22;
|
|
30
|
+
readonly TIMEOUT_ERR: 23;
|
|
31
|
+
readonly INVALID_NODE_TYPE_ERR: 24;
|
|
32
|
+
readonly DATA_CLONE_ERR: 25;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare global {
|
|
36
|
+
interface DOMException extends _DOMException {}
|
|
37
|
+
var DOMException: typeof globalThis extends { onmessage: any; DOMException: infer T } ? T
|
|
38
|
+
: {
|
|
39
|
+
prototype: DOMException;
|
|
40
|
+
new(message?: string, name?: string): DOMException;
|
|
41
|
+
new(message?: string, options?: { name?: string; cause?: unknown }): DOMException;
|
|
42
|
+
readonly INDEX_SIZE_ERR: 1;
|
|
43
|
+
readonly DOMSTRING_SIZE_ERR: 2;
|
|
44
|
+
readonly HIERARCHY_REQUEST_ERR: 3;
|
|
45
|
+
readonly WRONG_DOCUMENT_ERR: 4;
|
|
46
|
+
readonly INVALID_CHARACTER_ERR: 5;
|
|
47
|
+
readonly NO_DATA_ALLOWED_ERR: 6;
|
|
48
|
+
readonly NO_MODIFICATION_ALLOWED_ERR: 7;
|
|
49
|
+
readonly NOT_FOUND_ERR: 8;
|
|
50
|
+
readonly NOT_SUPPORTED_ERR: 9;
|
|
51
|
+
readonly INUSE_ATTRIBUTE_ERR: 10;
|
|
52
|
+
readonly INVALID_STATE_ERR: 11;
|
|
53
|
+
readonly SYNTAX_ERR: 12;
|
|
54
|
+
readonly INVALID_MODIFICATION_ERR: 13;
|
|
55
|
+
readonly NAMESPACE_ERR: 14;
|
|
56
|
+
readonly INVALID_ACCESS_ERR: 15;
|
|
57
|
+
readonly VALIDATION_ERR: 16;
|
|
58
|
+
readonly TYPE_MISMATCH_ERR: 17;
|
|
59
|
+
readonly SECURITY_ERR: 18;
|
|
60
|
+
readonly NETWORK_ERR: 19;
|
|
61
|
+
readonly ABORT_ERR: 20;
|
|
62
|
+
readonly URL_MISMATCH_ERR: 21;
|
|
63
|
+
readonly QUOTA_EXCEEDED_ERR: 22;
|
|
64
|
+
readonly TIMEOUT_ERR: 23;
|
|
65
|
+
readonly INVALID_NODE_TYPE_ERR: 24;
|
|
66
|
+
readonly DATA_CLONE_ERR: 25;
|
|
67
|
+
};
|
|
68
|
+
}
|