@types/node 22.15.13 → 22.18.9
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 +26 -122
- 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 +17 -1
- node/diagnostics_channel.d.ts → node v22.18/diagnostics_channel.d.ts +18 -13
- node/dns/promises.d.ts → node v22.18/dns/promises.d.ts +36 -9
- node/dns.d.ts → node v22.18/dns.d.ts +73 -20
- node/events.d.ts → node v22.18/events.d.ts +79 -34
- node/fs/promises.d.ts → node v22.18/fs/promises.d.ts +57 -39
- node/fs.d.ts → node v22.18/fs.d.ts +98 -47
- node v22.18/globals.d.ts +172 -0
- node/http.d.ts → node v22.18/http.d.ts +72 -6
- node/http2.d.ts → node v22.18/http2.d.ts +81 -2
- node/https.d.ts → node v22.18/https.d.ts +5 -0
- 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 +3 -3
- node/package.json → node v22.18/package.json +3 -83
- node/perf_hooks.d.ts → node v22.18/perf_hooks.d.ts +2 -2
- node/process.d.ts → node v22.18/process.d.ts +3 -4
- node/readline/promises.d.ts → node v22.18/readline/promises.d.ts +0 -1
- 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 +5 -10
- node v22.18/test.d.ts +2162 -0
- 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 +60 -30
- node/vm.d.ts → node v22.18/vm.d.ts +61 -8
- 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}/cluster.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}/os.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}/tls.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
|
@@ -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
|
*
|
|
@@ -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,9 +56,14 @@ 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
|
-
* V8's code cache data for the supplied source.
|
|
66
|
+
* Provides an optional data with V8's code cache data for the supplied source.
|
|
62
67
|
*/
|
|
63
68
|
cachedData?: Buffer | NodeJS.ArrayBufferView | undefined;
|
|
64
69
|
/** @deprecated in favor of `script.createCachedData()` */
|
|
@@ -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
|
}
|
|
@@ -110,18 +115,40 @@ declare module "vm" {
|
|
|
110
115
|
microtaskMode?: CreateContextOptions["microtaskMode"];
|
|
111
116
|
}
|
|
112
117
|
interface RunningCodeOptions extends RunningScriptOptions {
|
|
113
|
-
|
|
114
|
-
|
|
118
|
+
/**
|
|
119
|
+
* Provides an optional data with V8's code cache data for the supplied source.
|
|
120
|
+
*/
|
|
121
|
+
cachedData?: ScriptOptions["cachedData"] | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
|
|
124
|
+
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
|
|
125
|
+
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
|
|
126
|
+
*/
|
|
127
|
+
importModuleDynamically?:
|
|
128
|
+
| DynamicModuleLoader<Script>
|
|
129
|
+
| typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
|
|
130
|
+
| undefined;
|
|
115
131
|
}
|
|
116
132
|
interface RunningCodeInNewContextOptions extends RunningScriptInNewContextOptions {
|
|
117
|
-
|
|
118
|
-
|
|
133
|
+
/**
|
|
134
|
+
* Provides an optional data with V8's code cache data for the supplied source.
|
|
135
|
+
*/
|
|
136
|
+
cachedData?: ScriptOptions["cachedData"] | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
|
|
139
|
+
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
|
|
140
|
+
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
|
|
141
|
+
*/
|
|
142
|
+
importModuleDynamically?:
|
|
143
|
+
| DynamicModuleLoader<Script>
|
|
144
|
+
| typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
|
|
145
|
+
| undefined;
|
|
119
146
|
}
|
|
120
147
|
interface CompileFunctionOptions extends BaseOptions {
|
|
121
148
|
/**
|
|
122
149
|
* Provides an optional data with V8's code cache data for the supplied source.
|
|
123
150
|
*/
|
|
124
|
-
cachedData?:
|
|
151
|
+
cachedData?: ScriptOptions["cachedData"] | undefined;
|
|
125
152
|
/**
|
|
126
153
|
* Specifies whether to produce new cache data.
|
|
127
154
|
* @default false
|
|
@@ -135,6 +162,15 @@ declare module "vm" {
|
|
|
135
162
|
* An array containing a collection of context extensions (objects wrapping the current scope) to be applied while compiling
|
|
136
163
|
*/
|
|
137
164
|
contextExtensions?: Object[] | undefined;
|
|
165
|
+
/**
|
|
166
|
+
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
|
|
167
|
+
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
|
|
168
|
+
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
|
|
169
|
+
*/
|
|
170
|
+
importModuleDynamically?:
|
|
171
|
+
| DynamicModuleLoader<ReturnType<typeof compileFunction>>
|
|
172
|
+
| typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
|
|
173
|
+
| undefined;
|
|
138
174
|
}
|
|
139
175
|
interface CreateContextOptions {
|
|
140
176
|
/**
|
|
@@ -169,6 +205,15 @@ declare module "vm" {
|
|
|
169
205
|
* If set to `afterEvaluate`, microtasks will be run immediately after the script has run.
|
|
170
206
|
*/
|
|
171
207
|
microtaskMode?: "afterEvaluate" | undefined;
|
|
208
|
+
/**
|
|
209
|
+
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
|
|
210
|
+
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
|
|
211
|
+
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
|
|
212
|
+
*/
|
|
213
|
+
importModuleDynamically?:
|
|
214
|
+
| DynamicModuleLoader<Context>
|
|
215
|
+
| typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
|
|
216
|
+
| undefined;
|
|
172
217
|
}
|
|
173
218
|
type MeasureMemoryMode = "summary" | "detailed";
|
|
174
219
|
interface MeasureMemoryOptions {
|
|
@@ -848,6 +893,9 @@ declare module "vm" {
|
|
|
848
893
|
* @default 'vm:module(i)' where i is a context-specific ascending index.
|
|
849
894
|
*/
|
|
850
895
|
identifier?: string | undefined;
|
|
896
|
+
/**
|
|
897
|
+
* Provides an optional data with V8's code cache data for the supplied source.
|
|
898
|
+
*/
|
|
851
899
|
cachedData?: ScriptOptions["cachedData"] | undefined;
|
|
852
900
|
context?: Context | undefined;
|
|
853
901
|
lineOffset?: BaseOptions["lineOffset"] | undefined;
|
|
@@ -856,7 +904,12 @@ declare module "vm" {
|
|
|
856
904
|
* Called during evaluation of this module to initialize the `import.meta`.
|
|
857
905
|
*/
|
|
858
906
|
initializeImportMeta?: ((meta: ImportMeta, module: SourceTextModule) => void) | undefined;
|
|
859
|
-
|
|
907
|
+
/**
|
|
908
|
+
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
|
|
909
|
+
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
|
|
910
|
+
* [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
|
|
911
|
+
*/
|
|
912
|
+
importModuleDynamically?: DynamicModuleLoader<SourceTextModule> | undefined;
|
|
860
913
|
}
|
|
861
914
|
/**
|
|
862
915
|
* 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
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
|
|
3
|
+
interface AddEventListenerOptions extends EventListenerOptions {
|
|
4
|
+
once?: boolean;
|
|
5
|
+
passive?: boolean;
|
|
6
|
+
signal?: AbortSignal;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type _CustomEvent<T = any> = typeof globalThis extends { onmessage: any } ? {} : CustomEvent<T>;
|
|
10
|
+
interface CustomEvent<T = any> extends Event {
|
|
11
|
+
readonly detail: T;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface CustomEventInit<T = any> extends EventInit {
|
|
15
|
+
detail?: T;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type _Event = typeof globalThis extends { onmessage: any } ? {} : Event;
|
|
19
|
+
interface Event {
|
|
20
|
+
readonly bubbles: boolean;
|
|
21
|
+
cancelBubble: boolean;
|
|
22
|
+
readonly cancelable: boolean;
|
|
23
|
+
readonly composed: boolean;
|
|
24
|
+
readonly currentTarget: EventTarget | null;
|
|
25
|
+
readonly defaultPrevented: boolean;
|
|
26
|
+
readonly eventPhase: 0 | 2;
|
|
27
|
+
readonly isTrusted: boolean;
|
|
28
|
+
returnValue: boolean;
|
|
29
|
+
readonly srcElement: EventTarget | null;
|
|
30
|
+
readonly target: EventTarget | null;
|
|
31
|
+
readonly timeStamp: number;
|
|
32
|
+
readonly type: string;
|
|
33
|
+
composedPath(): [EventTarget?];
|
|
34
|
+
initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void;
|
|
35
|
+
preventDefault(): void;
|
|
36
|
+
stopImmediatePropagation(): void;
|
|
37
|
+
stopPropagation(): void;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface EventInit {
|
|
41
|
+
bubbles?: boolean;
|
|
42
|
+
cancelable?: boolean;
|
|
43
|
+
composed?: boolean;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface EventListener {
|
|
47
|
+
(evt: Event): void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface EventListenerObject {
|
|
51
|
+
handleEvent(object: Event): void;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
type _EventListenerOptions = typeof globalThis extends { onmessage: any } ? {} : EventListenerOptions;
|
|
55
|
+
interface EventListenerOptions {
|
|
56
|
+
capture?: boolean;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
type _EventTarget = typeof globalThis extends { onmessage: any } ? {} : EventTarget;
|
|
60
|
+
interface EventTarget {
|
|
61
|
+
addEventListener(
|
|
62
|
+
type: string,
|
|
63
|
+
listener: EventListener | EventListenerObject,
|
|
64
|
+
options?: AddEventListenerOptions | boolean,
|
|
65
|
+
): void;
|
|
66
|
+
dispatchEvent(event: Event): boolean;
|
|
67
|
+
removeEventListener(
|
|
68
|
+
type: string,
|
|
69
|
+
listener: EventListener | EventListenerObject,
|
|
70
|
+
options?: EventListenerOptions | boolean,
|
|
71
|
+
): void;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
declare global {
|
|
75
|
+
interface CustomEvent<T = any> extends _CustomEvent<T> {}
|
|
76
|
+
var CustomEvent: typeof globalThis extends { onmessage: any; CustomEvent: infer T } ? T
|
|
77
|
+
: {
|
|
78
|
+
prototype: CustomEvent;
|
|
79
|
+
new<T>(type: string, eventInitDict?: CustomEventInit<T>): CustomEvent<T>;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
interface Event extends _Event {}
|
|
83
|
+
var Event: typeof globalThis extends { onmessage: any; Event: infer T } ? T
|
|
84
|
+
: {
|
|
85
|
+
prototype: Event;
|
|
86
|
+
new(type: string, eventInitDict?: EventInit): Event;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
interface EventListenerOptions extends _EventListenerOptions {}
|
|
90
|
+
|
|
91
|
+
interface EventTarget extends _EventTarget {}
|
|
92
|
+
var EventTarget: typeof globalThis extends { onmessage: any; EventTarget: infer T } ? T
|
|
93
|
+
: {
|
|
94
|
+
prototype: EventTarget;
|
|
95
|
+
new(): EventTarget;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
|
|
3
|
+
import * as undici from "undici-types";
|
|
4
|
+
|
|
5
|
+
type _EventSource = typeof globalThis extends { onmessage: any } ? {} : undici.EventSource;
|
|
6
|
+
type _FormData = typeof globalThis extends { onmessage: any } ? {} : undici.FormData;
|
|
7
|
+
type _Headers = typeof globalThis extends { onmessage: any } ? {} : undici.Headers;
|
|
8
|
+
type _MessageEvent = typeof globalThis extends { onmessage: any } ? {} : undici.MessageEvent;
|
|
9
|
+
type _Request = typeof globalThis extends { onmessage: any } ? {} : undici.Request;
|
|
10
|
+
type _RequestInit = typeof globalThis extends { onmessage: any } ? {} : undici.RequestInit;
|
|
11
|
+
type _Response = typeof globalThis extends { onmessage: any } ? {} : undici.Response;
|
|
12
|
+
type _ResponseInit = typeof globalThis extends { onmessage: any } ? {} : undici.ResponseInit;
|
|
13
|
+
type _WebSocket = typeof globalThis extends { onmessage: any } ? {} : undici.WebSocket;
|
|
14
|
+
|
|
15
|
+
declare global {
|
|
16
|
+
function fetch(
|
|
17
|
+
input: string | URL | Request,
|
|
18
|
+
init?: RequestInit,
|
|
19
|
+
): Promise<Response>;
|
|
20
|
+
|
|
21
|
+
interface EventSource extends _EventSource {}
|
|
22
|
+
var EventSource: typeof globalThis extends { onmessage: any; EventSource: infer T } ? T : typeof undici.EventSource;
|
|
23
|
+
|
|
24
|
+
interface FormData extends _FormData {}
|
|
25
|
+
var FormData: typeof globalThis extends { onmessage: any; FormData: infer T } ? T : typeof undici.FormData;
|
|
26
|
+
|
|
27
|
+
interface Headers extends _Headers {}
|
|
28
|
+
var Headers: typeof globalThis extends { onmessage: any; Headers: infer T } ? T : typeof undici.Headers;
|
|
29
|
+
|
|
30
|
+
interface MessageEvent extends _MessageEvent {}
|
|
31
|
+
var MessageEvent: typeof globalThis extends { onmessage: any; MessageEvent: infer T } ? T
|
|
32
|
+
: typeof undici.MessageEvent;
|
|
33
|
+
|
|
34
|
+
interface Request extends _Request {}
|
|
35
|
+
var Request: typeof globalThis extends { onmessage: any; Request: infer T } ? T : typeof undici.Request;
|
|
36
|
+
|
|
37
|
+
interface RequestInit extends _RequestInit {}
|
|
38
|
+
|
|
39
|
+
interface Response extends _Response {}
|
|
40
|
+
var Response: typeof globalThis extends { onmessage: any; Response: infer T } ? T : typeof undici.Response;
|
|
41
|
+
|
|
42
|
+
interface ResponseInit extends _ResponseInit {}
|
|
43
|
+
|
|
44
|
+
interface WebSocket extends _WebSocket {}
|
|
45
|
+
var WebSocket: typeof globalThis extends { onmessage: any; WebSocket: infer T } ? T : typeof undici.WebSocket;
|
|
46
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
|
|
3
|
+
// lib.webworker has `WorkerNavigator` rather than `Navigator`, so conditionals use `onabort` instead of `onmessage`
|
|
4
|
+
type _Navigator = typeof globalThis extends { onabort: any } ? {} : Navigator;
|
|
5
|
+
interface Navigator {
|
|
6
|
+
readonly hardwareConcurrency: number;
|
|
7
|
+
readonly language: string;
|
|
8
|
+
readonly languages: readonly string[];
|
|
9
|
+
readonly platform: string;
|
|
10
|
+
readonly userAgent: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare global {
|
|
14
|
+
interface Navigator extends _Navigator {}
|
|
15
|
+
var Navigator: typeof globalThis extends { onabort: any; Navigator: infer T } ? T : {
|
|
16
|
+
prototype: Navigator;
|
|
17
|
+
new(): Navigator;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// Needs conditional inference for lib.dom and lib.webworker compatibility
|
|
21
|
+
var navigator: typeof globalThis extends { onmessage: any; navigator: infer T } ? T : Navigator;
|
|
22
|
+
}
|