@types/node 24.3.0 → 24.7.2

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/tls.d.ts CHANGED
@@ -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?(socket: TLSSocket, identity: string): DataView | NodeJS.TypedArray | null;
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?(hint: string | null): PSKCallbackNegotation | null;
630
+ pskCallback?: ((hint: string | null) => PSKCallbackNegotation | null) | undefined;
631
631
  }
632
632
  /**
633
633
  * Accepts encrypted connections using TLS or SSL.
@@ -1162,6 +1162,38 @@ declare module "tls" {
1162
1162
  * @since v0.10.2
1163
1163
  */
1164
1164
  function getCiphers(): string[];
1165
+ /**
1166
+ * Sets the default CA certificates used by Node.js TLS clients. If the provided
1167
+ * certificates are parsed successfully, they will become the default CA
1168
+ * certificate list returned by {@link getCACertificates} and used
1169
+ * by subsequent TLS connections that don't specify their own CA certificates.
1170
+ * The certificates will be deduplicated before being set as the default.
1171
+ *
1172
+ * This function only affects the current Node.js thread. Previous
1173
+ * sessions cached by the HTTPS agent won't be affected by this change, so
1174
+ * this method should be called before any unwanted cachable TLS connections are
1175
+ * made.
1176
+ *
1177
+ * To use system CA certificates as the default:
1178
+ *
1179
+ * ```js
1180
+ * import tls from 'node:tls';
1181
+ * tls.setDefaultCACertificates(tls.getCACertificates('system'));
1182
+ * ```
1183
+ *
1184
+ * This function completely replaces the default CA certificate list. To add additional
1185
+ * certificates to the existing defaults, get the current certificates and append to them:
1186
+ *
1187
+ * ```js
1188
+ * import tls from 'node:tls';
1189
+ * const currentCerts = tls.getCACertificates('default');
1190
+ * const additionalCerts = ['-----BEGIN CERTIFICATE-----\n...'];
1191
+ * tls.setDefaultCACertificates([...currentCerts, ...additionalCerts]);
1192
+ * ```
1193
+ * @since v24.5.0
1194
+ * @param certs An array of CA certificates in PEM format.
1195
+ */
1196
+ function setDefaultCACertificates(certs: ReadonlyArray<string | NodeJS.ArrayBufferView>): void;
1165
1197
  /**
1166
1198
  * The default curve name to use for ECDH key agreement in a tls server.
1167
1199
  * The default value is `'auto'`. See `{@link createSecureContext()}` for further
node/ts5.6/index.d.ts CHANGED
@@ -40,6 +40,14 @@
40
40
 
41
41
  // Definitions for Node.js modules that are not specific to any version of TypeScript:
42
42
  /// <reference path="../globals.d.ts" />
43
+ /// <reference path="../web-globals/abortcontroller.d.ts" />
44
+ /// <reference path="../web-globals/crypto.d.ts" />
45
+ /// <reference path="../web-globals/domexception.d.ts" />
46
+ /// <reference path="../web-globals/events.d.ts" />
47
+ /// <reference path="../web-globals/fetch.d.ts" />
48
+ /// <reference path="../web-globals/navigator.d.ts" />
49
+ /// <reference path="../web-globals/storage.d.ts" />
50
+ /// <reference path="../web-globals/streams.d.ts" />
43
51
  /// <reference path="../assert.d.ts" />
44
52
  /// <reference path="../assert/strict.d.ts" />
45
53
  /// <reference path="../async_hooks.d.ts" />
@@ -53,9 +61,7 @@
53
61
  /// <reference path="../diagnostics_channel.d.ts" />
54
62
  /// <reference path="../dns.d.ts" />
55
63
  /// <reference path="../dns/promises.d.ts" />
56
- /// <reference path="../dns/promises.d.ts" />
57
64
  /// <reference path="../domain.d.ts" />
58
- /// <reference path="../dom-events.d.ts" />
59
65
  /// <reference path="../events.d.ts" />
60
66
  /// <reference path="../fs.d.ts" />
61
67
  /// <reference path="../fs/promises.d.ts" />
@@ -63,6 +69,7 @@
63
69
  /// <reference path="../http2.d.ts" />
64
70
  /// <reference path="../https.d.ts" />
65
71
  /// <reference path="../inspector.d.ts" />
72
+ /// <reference path="../inspector.generated.d.ts" />
66
73
  /// <reference path="../module.d.ts" />
67
74
  /// <reference path="../net.d.ts" />
68
75
  /// <reference path="../os.d.ts" />
node/ts5.7/index.d.ts CHANGED
@@ -40,6 +40,14 @@
40
40
 
41
41
  // Definitions for Node.js modules that are not specific to any version of TypeScript:
42
42
  /// <reference path="../globals.d.ts" />
43
+ /// <reference path="../web-globals/abortcontroller.d.ts" />
44
+ /// <reference path="../web-globals/crypto.d.ts" />
45
+ /// <reference path="../web-globals/domexception.d.ts" />
46
+ /// <reference path="../web-globals/events.d.ts" />
47
+ /// <reference path="../web-globals/fetch.d.ts" />
48
+ /// <reference path="../web-globals/navigator.d.ts" />
49
+ /// <reference path="../web-globals/storage.d.ts" />
50
+ /// <reference path="../web-globals/streams.d.ts" />
43
51
  /// <reference path="../assert.d.ts" />
44
52
  /// <reference path="../assert/strict.d.ts" />
45
53
  /// <reference path="../async_hooks.d.ts" />
@@ -53,9 +61,7 @@
53
61
  /// <reference path="../diagnostics_channel.d.ts" />
54
62
  /// <reference path="../dns.d.ts" />
55
63
  /// <reference path="../dns/promises.d.ts" />
56
- /// <reference path="../dns/promises.d.ts" />
57
64
  /// <reference path="../domain.d.ts" />
58
- /// <reference path="../dom-events.d.ts" />
59
65
  /// <reference path="../events.d.ts" />
60
66
  /// <reference path="../fs.d.ts" />
61
67
  /// <reference path="../fs/promises.d.ts" />
@@ -63,6 +69,7 @@
63
69
  /// <reference path="../http2.d.ts" />
64
70
  /// <reference path="../https.d.ts" />
65
71
  /// <reference path="../inspector.d.ts" />
72
+ /// <reference path="../inspector.generated.d.ts" />
66
73
  /// <reference path="../module.d.ts" />
67
74
  /// <reference path="../net.d.ts" />
68
75
  /// <reference path="../os.d.ts" />
node/url.d.ts CHANGED
@@ -455,12 +455,15 @@ declare module "url" {
455
455
  */
456
456
  static canParse(input: string, base?: string): boolean;
457
457
  /**
458
- * Parses a string as a URL. If `base` is provided, it will be used as the base URL for the purpose of resolving non-absolute `input` URLs.
459
- * Returns `null` if `input` is not a valid.
460
- * @param input The absolute or relative input URL to parse. If `input` is relative, then `base` is required. If `input` is absolute, the `base` is ignored. If `input` is not a string, it is
461
- * `converted to a string` first.
462
- * @param base The base URL to resolve against if the `input` is not absolute. If `base` is not a string, it is `converted to a string` first.
458
+ * Parses a string as a URL. If `base` is provided, it will be used as the base
459
+ * URL for the purpose of resolving non-absolute `input` URLs. Returns `null`
460
+ * if the parameters can't be resolved to a valid URL.
463
461
  * @since v22.1.0
462
+ * @param input The absolute or relative input URL to parse. If `input`
463
+ * is relative, then `base` is required. If `input` is absolute, the `base`
464
+ * is ignored. If `input` is not a string, it is [converted to a string](https://tc39.es/ecma262/#sec-tostring) first.
465
+ * @param base The base URL to resolve against if the `input` is not
466
+ * absolute. If `base` is not a string, it is [converted to a string](https://tc39.es/ecma262/#sec-tostring) first.
464
467
  */
465
468
  static parse(input: string, base?: string): URL | null;
466
469
  constructor(input: string | { toString: () => string }, base?: string | URL);
@@ -1017,7 +1020,12 @@ declare module "url" {
1017
1020
  interface URLPatternInit extends _URLPatternInit {}
1018
1021
  interface URLPatternResult extends _URLPatternResult {}
1019
1022
  interface URLPattern extends _URLPattern {}
1020
- var URLPattern: typeof _URLPattern;
1023
+ var URLPattern: typeof globalThis extends {
1024
+ onmessage: any;
1025
+ scheduler: any; // Must be a var introduced at the same time as URLPattern.
1026
+ URLPattern: infer T;
1027
+ } ? T
1028
+ : typeof _URLPattern;
1021
1029
  }
1022
1030
  }
1023
1031
  declare module "node:url" {
node/util.d.ts CHANGED
@@ -338,6 +338,11 @@ declare module "util" {
338
338
  * @since v9.7.0
339
339
  */
340
340
  export function getSystemErrorName(err: number): string;
341
+ /**
342
+ * Enable or disable printing a stack trace on `SIGINT`. The API is only available on the main thread.
343
+ * @since 24.6.0
344
+ */
345
+ export function setTraceSigInt(enable: boolean): void;
341
346
  /**
342
347
  * Returns a Map of all system error codes available from the Node.js API.
343
348
  * The mapping between error codes and error names is platform-dependent.
@@ -1420,10 +1425,12 @@ declare module "util" {
1420
1425
  */
1421
1426
  short?: string | undefined;
1422
1427
  /**
1423
- * The default value to
1424
- * be used if (and only if) the option does not appear in the arguments to be
1425
- * parsed. It must be of the same type as the `type` property. When `multiple`
1426
- * is `true`, it must be an array.
1428
+ * The value to assign to
1429
+ * the option if it does not appear in the arguments to be parsed. The value
1430
+ * must match the type specified by the `type` property. If `multiple` is
1431
+ * `true`, it must be an array. No default value is applied when the option
1432
+ * does appear in the arguments to be parsed, even if the provided value
1433
+ * is falsy.
1427
1434
  * @since v18.11.0
1428
1435
  */
1429
1436
  default?: string | boolean | string[] | boolean[] | undefined;
node/v8.d.ts CHANGED
@@ -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,
node/vm.d.ts CHANGED
@@ -37,7 +37,7 @@
37
37
  * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/vm.js)
38
38
  */
39
39
  declare module "vm" {
40
- import { ImportAttributes } from "node:module";
40
+ import { ImportAttributes, ImportPhase } from "node:module";
41
41
  interface Context extends NodeJS.Dict<any> {}
42
42
  interface BaseOptions {
43
43
  /**
@@ -60,7 +60,7 @@ declare module "vm" {
60
60
  specifier: string,
61
61
  referrer: T,
62
62
  importAttributes: ImportAttributes,
63
- phase: "source" | "evaluation",
63
+ phase: ImportPhase,
64
64
  ) => Module | Promise<Module>;
65
65
  interface ScriptOptions extends BaseOptions {
66
66
  /**
@@ -99,28 +99,22 @@ declare module "vm" {
99
99
  */
100
100
  breakOnSigint?: boolean | undefined;
101
101
  }
102
- interface RunningScriptInNewContextOptions extends RunningScriptOptions {
102
+ interface RunningScriptInNewContextOptions
103
+ extends RunningScriptOptions, Pick<CreateContextOptions, "microtaskMode">
104
+ {
103
105
  /**
104
106
  * Human-readable name of the newly created context.
105
107
  */
106
- contextName?: CreateContextOptions["name"];
108
+ contextName?: CreateContextOptions["name"] | undefined;
107
109
  /**
108
110
  * Origin corresponding to the newly created context for display purposes. The origin should be formatted like a URL,
109
111
  * but with only the scheme, host, and port (if necessary), like the value of the `url.origin` property of a `URL` object.
110
112
  * Most notably, this string should omit the trailing slash, as that denotes a path.
111
113
  */
112
- contextOrigin?: CreateContextOptions["origin"];
113
- contextCodeGeneration?: CreateContextOptions["codeGeneration"];
114
- /**
115
- * If set to `afterEvaluate`, microtasks will be run immediately after the script has run.
116
- */
117
- microtaskMode?: CreateContextOptions["microtaskMode"];
114
+ contextOrigin?: CreateContextOptions["origin"] | undefined;
115
+ contextCodeGeneration?: CreateContextOptions["codeGeneration"] | undefined;
118
116
  }
119
- interface RunningCodeOptions extends RunningScriptOptions {
120
- /**
121
- * Provides an optional data with V8's code cache data for the supplied source.
122
- */
123
- cachedData?: ScriptOptions["cachedData"] | undefined;
117
+ interface RunningCodeOptions extends RunningScriptOptions, Pick<ScriptOptions, "cachedData"> {
124
118
  /**
125
119
  * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
126
120
  * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
@@ -132,11 +126,9 @@ declare module "vm" {
132
126
  | typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
133
127
  | undefined;
134
128
  }
135
- interface RunningCodeInNewContextOptions extends RunningScriptInNewContextOptions {
136
- /**
137
- * Provides an optional data with V8's code cache data for the supplied source.
138
- */
139
- cachedData?: ScriptOptions["cachedData"] | undefined;
129
+ interface RunningCodeInNewContextOptions
130
+ extends RunningScriptInNewContextOptions, Pick<ScriptOptions, "cachedData">
131
+ {
140
132
  /**
141
133
  * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
142
134
  * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
@@ -148,16 +140,7 @@ declare module "vm" {
148
140
  | typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
149
141
  | undefined;
150
142
  }
151
- interface CompileFunctionOptions extends BaseOptions {
152
- /**
153
- * Provides an optional data with V8's code cache data for the supplied source.
154
- */
155
- cachedData?: ScriptOptions["cachedData"] | undefined;
156
- /**
157
- * Specifies whether to produce new cache data.
158
- * @default false
159
- */
160
- produceCachedData?: boolean | undefined;
143
+ interface CompileFunctionOptions extends BaseOptions, Pick<ScriptOptions, "cachedData" | "produceCachedData"> {
161
144
  /**
162
145
  * The sandbox/context in which the said function should be compiled in.
163
146
  */
@@ -386,15 +369,15 @@ declare module "vm" {
386
369
  */
387
370
  createCachedData(): Buffer;
388
371
  /** @deprecated in favor of `script.createCachedData()` */
389
- cachedDataProduced?: boolean | undefined;
372
+ cachedDataProduced?: boolean;
390
373
  /**
391
374
  * When `cachedData` is supplied to create the `vm.Script`, this value will be set
392
375
  * to either `true` or `false` depending on acceptance of the data by V8.
393
376
  * Otherwise the value is `undefined`.
394
377
  * @since v5.7.0
395
378
  */
396
- cachedDataRejected?: boolean | undefined;
397
- cachedData?: Buffer | undefined;
379
+ cachedDataRejected?: boolean;
380
+ cachedData?: Buffer;
398
381
  /**
399
382
  * When the script is compiled from a source that contains a source map magic
400
383
  * comment, this property will be set to the URL of the source map.
@@ -412,7 +395,7 @@ declare module "vm" {
412
395
  * ```
413
396
  * @since v19.1.0, v18.13.0
414
397
  */
415
- sourceMapURL?: string | undefined;
398
+ sourceMapURL: string | undefined;
416
399
  }
417
400
  /**
418
401
  * If the given `contextObject` is an object, the `vm.createContext()` method will
@@ -622,11 +605,7 @@ declare module "vm" {
622
605
  code: string,
623
606
  params?: readonly string[],
624
607
  options?: CompileFunctionOptions,
625
- ): Function & {
626
- cachedData?: Script["cachedData"] | undefined;
627
- cachedDataProduced?: Script["cachedDataProduced"] | undefined;
628
- cachedDataRejected?: Script["cachedDataRejected"] | undefined;
629
- };
608
+ ): Function & Pick<Script, "cachedData" | "cachedDataProduced" | "cachedDataRejected">;
630
609
  /**
631
610
  * Measure the memory known to V8 and used by all contexts known to the
632
611
  * current V8 isolate, or the main context.
@@ -683,10 +662,7 @@ declare module "vm" {
683
662
  * @experimental
684
663
  */
685
664
  function measureMemory(options?: MeasureMemoryOptions): Promise<MemoryMeasurement>;
686
- interface ModuleEvaluateOptions {
687
- timeout?: RunningScriptOptions["timeout"] | undefined;
688
- breakOnSigint?: RunningScriptOptions["breakOnSigint"] | undefined;
689
- }
665
+ interface ModuleEvaluateOptions extends Pick<RunningScriptOptions, "breakOnSigint" | "timeout"> {}
690
666
  type ModuleLinker = (
691
667
  specifier: string,
692
668
  referencingModule: Module,
@@ -791,14 +767,6 @@ declare module "vm" {
791
767
  * @experimental
792
768
  */
793
769
  class Module {
794
- /**
795
- * The specifiers of all dependencies of this module. The returned array is frozen
796
- * to disallow any changes to it.
797
- *
798
- * Corresponds to the `[[RequestedModules]]` field of [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records) s in
799
- * the ECMAScript specification.
800
- */
801
- dependencySpecifiers: readonly string[];
802
770
  /**
803
771
  * If the `module.status` is `'errored'`, this property contains the exception
804
772
  * thrown by the module during evaluation. If the status is anything else,
@@ -893,19 +861,13 @@ declare module "vm" {
893
861
  */
894
862
  link(linker: ModuleLinker): Promise<void>;
895
863
  }
896
- interface SourceTextModuleOptions {
864
+ interface SourceTextModuleOptions extends Pick<ScriptOptions, "cachedData" | "columnOffset" | "lineOffset"> {
897
865
  /**
898
866
  * String used in stack traces.
899
867
  * @default 'vm:module(i)' where i is a context-specific ascending index.
900
868
  */
901
869
  identifier?: string | undefined;
902
- /**
903
- * Provides an optional data with V8's code cache data for the supplied source.
904
- */
905
- cachedData?: ScriptOptions["cachedData"] | undefined;
906
870
  context?: Context | undefined;
907
- lineOffset?: BaseOptions["lineOffset"] | undefined;
908
- columnOffset?: BaseOptions["columnOffset"] | undefined;
909
871
  /**
910
872
  * Called during evaluation of this module to initialize the `import.meta`.
911
873
  */
@@ -918,6 +880,25 @@ declare module "vm" {
918
880
  */
919
881
  importModuleDynamically?: DynamicModuleLoader<SourceTextModule> | undefined;
920
882
  }
883
+ /**
884
+ * A `ModuleRequest` represents the request to import a module with given import attributes and phase.
885
+ * @since 24.4.0
886
+ */
887
+ interface ModuleRequest {
888
+ /**
889
+ * The specifier of the requested module.
890
+ */
891
+ specifier: string;
892
+ /**
893
+ * The `"with"` value passed to the `WithClause` in a `ImportDeclaration`, or an empty object if no value was
894
+ * provided.
895
+ */
896
+ attributes: ImportAttributes;
897
+ /**
898
+ * The phase of the requested module (`"source"` or `"evaluation"`).
899
+ */
900
+ phase: ImportPhase;
901
+ }
921
902
  /**
922
903
  * This feature is only available with the `--experimental-vm-modules` command
923
904
  * flag enabled.
@@ -933,6 +914,58 @@ declare module "vm" {
933
914
  * @param code JavaScript Module code to parse
934
915
  */
935
916
  constructor(code: string, options?: SourceTextModuleOptions);
917
+ /**
918
+ * @deprecated Use `sourceTextModule.moduleRequests` instead.
919
+ */
920
+ readonly dependencySpecifiers: readonly string[];
921
+ /**
922
+ * The requested import dependencies of this module. The returned array is frozen
923
+ * to disallow any changes to it.
924
+ *
925
+ * For example, given a source text:
926
+ *
927
+ * ```js
928
+ * import foo from 'foo';
929
+ * import fooAlias from 'foo';
930
+ * import bar from './bar.js';
931
+ * import withAttrs from '../with-attrs.ts' with { arbitraryAttr: 'attr-val' };
932
+ * import source Module from 'wasm-mod.wasm';
933
+ * ```
934
+ *
935
+ * The value of the `sourceTextModule.moduleRequests` will be:
936
+ *
937
+ * ```js
938
+ * [
939
+ * {
940
+ * specifier: 'foo',
941
+ * attributes: {},
942
+ * phase: 'evaluation',
943
+ * },
944
+ * {
945
+ * specifier: 'foo',
946
+ * attributes: {},
947
+ * phase: 'evaluation',
948
+ * },
949
+ * {
950
+ * specifier: './bar.js',
951
+ * attributes: {},
952
+ * phase: 'evaluation',
953
+ * },
954
+ * {
955
+ * specifier: '../with-attrs.ts',
956
+ * attributes: { arbitraryAttr: 'attr-val' },
957
+ * phase: 'evaluation',
958
+ * },
959
+ * {
960
+ * specifier: 'wasm-mod.wasm',
961
+ * attributes: {},
962
+ * phase: 'source',
963
+ * },
964
+ * ];
965
+ * ```
966
+ * @since v24.4.0
967
+ */
968
+ readonly moduleRequests: readonly ModuleRequest[];
936
969
  }
937
970
  interface SyntheticModuleOptions {
938
971
  /**
node/wasi.d.ts CHANGED
@@ -121,6 +121,12 @@ declare module "wasi" {
121
121
  */
122
122
  version: "unstable" | "preview1";
123
123
  }
124
+ interface FinalizeBindingsOptions {
125
+ /**
126
+ * @default instance.exports.memory
127
+ */
128
+ memory?: object | undefined;
129
+ }
124
130
  /**
125
131
  * The `WASI` class provides the WASI system call API and additional convenience
126
132
  * methods for working with WASI-based applications. Each `WASI` instance
@@ -167,6 +173,21 @@ declare module "wasi" {
167
173
  * @since v14.6.0, v12.19.0
168
174
  */
169
175
  initialize(instance: object): void; // TODO: avoid DOM dependency until WASM moved to own lib.
176
+ /**
177
+ * Set up WASI host bindings to `instance` without calling `initialize()`
178
+ * or `start()`. This method is useful when the WASI module is instantiated in
179
+ * child threads for sharing the memory across threads.
180
+ *
181
+ * `finalizeBindings()` requires that either `instance` exports a
182
+ * [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) named `memory` or user specify a
183
+ * [`WebAssembly.Memory`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) object in `options.memory`. If the `memory` is invalid
184
+ * an exception is thrown.
185
+ *
186
+ * `start()` and `initialize()` will call `finalizeBindings()` internally.
187
+ * If `finalizeBindings()` is called more than once, an exception is thrown.
188
+ * @since v24.4.0
189
+ */
190
+ finalizeBindings(instance: object, options?: FinalizeBindingsOptions): void;
170
191
  /**
171
192
  * `wasiImport` is an object that implements the WASI system call API. This object
172
193
  * should be passed as the `wasi_snapshot_preview1` import during the instantiation
@@ -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,32 @@
1
+ export {};
2
+
3
+ import { webcrypto } from "crypto";
4
+
5
+ declare global {
6
+ var Crypto: typeof globalThis extends { onmessage: any; Crypto: infer T } ? T : {
7
+ prototype: webcrypto.Crypto;
8
+ new(): webcrypto.Crypto;
9
+ };
10
+
11
+ var CryptoKey: typeof globalThis extends { onmessage: any; CryptoKey: infer T } ? T : {
12
+ prototype: webcrypto.CryptoKey;
13
+ new(): webcrypto.CryptoKey;
14
+ };
15
+
16
+ var SubtleCrypto: typeof globalThis extends { onmessage: any; SubtleCrypto: infer T } ? T : {
17
+ prototype: webcrypto.SubtleCrypto;
18
+ new(): webcrypto.SubtleCrypto;
19
+ supports(
20
+ operation: string,
21
+ algorithm: webcrypto.AlgorithmIdentifier,
22
+ length?: number,
23
+ ): boolean;
24
+ supports(
25
+ operation: string,
26
+ algorithm: webcrypto.AlgorithmIdentifier,
27
+ additionalAlgorithm: webcrypto.AlgorithmIdentifier,
28
+ ): boolean;
29
+ };
30
+
31
+ var crypto: typeof globalThis extends { onmessage: any; crypto: infer T } ? T : webcrypto.Crypto;
32
+ }
@@ -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
+ }