@contrast/agent-bundle 5.45.1 → 5.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/node_modules/@contrast/agent/README.md +1 -1
- package/node_modules/@contrast/agent/package.json +12 -12
- package/node_modules/@contrast/agentify/package.json +15 -15
- package/node_modules/@contrast/architecture-components/package.json +5 -5
- package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/common.js +1 -1
- package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/handlers.js +24 -11
- package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/index.js +6 -4
- package/node_modules/@contrast/assess/lib/configuration-analysis/install/apollo-server.js +92 -0
- package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/install/express-session.js +2 -2
- package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/install/fastify-cookie.js +2 -2
- package/node_modules/@contrast/assess/lib/configuration-analysis/install/graphql-yoga.js +90 -0
- package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/install/hapi.js +2 -2
- package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/install/koa.js +3 -3
- package/node_modules/@contrast/assess/lib/dataflow/propagation/install/string/substring.js +1 -1
- package/node_modules/@contrast/assess/lib/dataflow/sources/handler.js +30 -26
- package/node_modules/@contrast/assess/lib/dataflow/sources/index.js +2 -0
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/fastify-websocket.js +63 -0
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/http.js +42 -38
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/koa/index.js +1 -1
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/koa/koa-bodyparsers.js +76 -48
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/koa/koa-multer.js +1 -1
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/koa/koa-routers.js +2 -2
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/koa/{koa2.js → koa.js} +3 -3
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/socket.io.js +80 -0
- package/node_modules/@contrast/assess/lib/get-source-context.js +10 -21
- package/node_modules/@contrast/assess/lib/index.d.ts +4 -3
- package/node_modules/@contrast/assess/lib/index.js +2 -2
- package/node_modules/@contrast/assess/lib/make-source-context.js +5 -10
- package/node_modules/@contrast/assess/lib/policy.js +400 -0
- package/node_modules/@contrast/assess/lib/response-scanning/handlers/index.js +10 -14
- package/node_modules/@contrast/assess/package.json +12 -12
- package/node_modules/@contrast/common/lib/constants.d.ts +12 -4
- package/node_modules/@contrast/common/lib/constants.js +16 -7
- package/node_modules/@contrast/common/lib/types.d.ts +5 -1
- package/node_modules/@contrast/common/package.json +1 -1
- package/node_modules/@contrast/config/lib/common.js +1 -0
- package/node_modules/@contrast/config/lib/options.js +14 -0
- package/node_modules/@contrast/config/package.json +3 -3
- package/node_modules/@contrast/core/package.json +5 -5
- package/node_modules/@contrast/deadzones/package.json +5 -5
- package/node_modules/@contrast/dep-hooks/lib/package-finder.d.ts +2 -2
- package/node_modules/@contrast/dep-hooks/lib/package-finder.js +3 -2
- package/node_modules/@contrast/dep-hooks/package.json +4 -4
- package/node_modules/@contrast/esm-hooks/README.md +2 -2
- package/node_modules/@contrast/esm-hooks/package.json +6 -6
- package/node_modules/@contrast/instrumentation/package.json +5 -5
- package/node_modules/@contrast/library-analysis/lib/install/library-reporting/dep.json +149 -149
- package/node_modules/@contrast/library-analysis/lib/install/library-reporting/index.js +2 -11
- package/node_modules/@contrast/library-analysis/lib/install/library-reporting/utils.js +2 -0
- package/node_modules/@contrast/library-analysis/lib/install/library-usage/index.js +3 -1
- package/node_modules/@contrast/library-analysis/lib/util.js +0 -2
- package/node_modules/@contrast/library-analysis/package.json +4 -4
- package/node_modules/@contrast/logger/package.json +3 -3
- package/node_modules/@contrast/metrics/package.json +6 -6
- package/node_modules/@contrast/patcher/package.json +2 -2
- package/node_modules/@contrast/protect/lib/error-handlers/index.js +1 -1
- package/node_modules/@contrast/protect/lib/error-handlers/install/{koa2.js → koa.js} +4 -4
- package/node_modules/@contrast/protect/lib/index.d.ts +1 -1
- package/node_modules/@contrast/protect/lib/input-analysis/handlers.js +1 -12
- package/node_modules/@contrast/protect/lib/input-analysis/index.js +2 -3
- package/node_modules/@contrast/protect/lib/input-analysis/install/koa-bodyparsers.js +92 -0
- package/node_modules/@contrast/protect/lib/input-analysis/install/{koa2.js → koa.js} +5 -5
- package/node_modules/@contrast/protect/package.json +11 -11
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/translations.js +6 -10
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/routes-observed.js +4 -0
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/index.d.ts +1 -1
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/index.js +1 -1
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/translations.d.ts +1 -1
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/translations.js +22 -9
- package/node_modules/@contrast/reporter/lib/reporters/file.js +1 -1
- package/node_modules/@contrast/reporter/package.json +6 -6
- package/node_modules/@contrast/rewriter/package.json +5 -5
- package/node_modules/@contrast/route-coverage/lib/index.d.ts +0 -2
- package/node_modules/@contrast/route-coverage/lib/index.js +10 -1
- package/node_modules/@contrast/route-coverage/lib/install/express/express5.js +16 -1
- package/node_modules/@contrast/route-coverage/lib/install/fastify.js +25 -15
- package/node_modules/@contrast/route-coverage/lib/install/graphql.js +6 -1
- package/node_modules/@contrast/route-coverage/lib/install/koa.js +1 -1
- package/node_modules/@contrast/route-coverage/lib/install/socket.io.js +127 -0
- package/node_modules/@contrast/route-coverage/package.json +8 -8
- package/node_modules/@contrast/scopes/package.json +5 -5
- package/node_modules/@contrast/sec-obs/package.json +9 -9
- package/node_modules/@contrast/sources/lib/index.js +65 -22
- package/node_modules/@contrast/sources/lib/index.test.js +78 -33
- package/node_modules/@contrast/sources/lib/source-info.js +1 -10
- package/node_modules/@contrast/sources/package.json +3 -3
- package/node_modules/@contrast/telemetry/package.json +5 -5
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/assert/strict.d.ts +105 -2
- package/node_modules/@types/node/assert.d.ts +154 -95
- package/node_modules/@types/node/buffer.buffer.d.ts +9 -0
- package/node_modules/@types/node/buffer.d.ts +8 -4
- package/node_modules/@types/node/child_process.d.ts +65 -42
- package/node_modules/@types/node/cluster.d.ts +4 -5
- package/node_modules/@types/node/crypto.d.ts +1173 -322
- package/node_modules/@types/node/dgram.d.ts +9 -8
- package/node_modules/@types/node/diagnostics_channel.d.ts +0 -2
- package/node_modules/@types/node/dns.d.ts +1 -1
- package/node_modules/@types/node/events.d.ts +80 -34
- package/node_modules/@types/node/fs/promises.d.ts +39 -21
- package/node_modules/@types/node/fs.d.ts +328 -87
- package/node_modules/@types/node/globals.d.ts +2 -0
- package/node_modules/@types/node/globals.typedarray.d.ts +19 -0
- package/node_modules/@types/node/http.d.ts +94 -30
- package/node_modules/@types/node/http2.d.ts +178 -52
- package/node_modules/@types/node/https.d.ts +91 -62
- package/node_modules/@types/node/index.d.ts +2 -0
- package/node_modules/@types/node/inspector.d.ts +24 -0
- package/node_modules/@types/node/inspector.generated.d.ts +181 -0
- package/node_modules/@types/node/net.d.ts +12 -11
- package/node_modules/@types/node/os.d.ts +14 -3
- package/node_modules/@types/node/package.json +3 -3
- package/node_modules/@types/node/perf_hooks.d.ts +6 -8
- package/node_modules/@types/node/process.d.ts +12 -23
- package/node_modules/@types/node/readline/promises.d.ts +1 -1
- package/node_modules/@types/node/sea.d.ts +9 -0
- package/node_modules/@types/node/sqlite.d.ts +119 -10
- package/node_modules/@types/node/stream/consumers.d.ts +2 -2
- package/node_modules/@types/node/stream/web.d.ts +6 -55
- package/node_modules/@types/node/stream.d.ts +38 -23
- package/node_modules/@types/node/string_decoder.d.ts +2 -2
- package/node_modules/@types/node/test.d.ts +31 -26
- package/node_modules/@types/node/tls.d.ts +90 -66
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +10 -2
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +16 -0
- package/node_modules/@types/node/ts5.6/index.d.ts +2 -0
- package/node_modules/@types/node/ts5.7/index.d.ts +2 -0
- package/node_modules/@types/node/url.d.ts +8 -3
- package/node_modules/@types/node/util.d.ts +17 -3
- package/node_modules/@types/node/v8.d.ts +38 -5
- package/node_modules/@types/node/vm.d.ts +169 -88
- package/node_modules/@types/node/wasi.d.ts +1 -1
- package/node_modules/@types/node/web-globals/crypto.d.ts +32 -0
- package/node_modules/@types/node/web-globals/events.d.ts +3 -0
- package/node_modules/@types/node/web-globals/streams.d.ts +22 -0
- package/node_modules/@types/node/worker_threads.d.ts +109 -48
- package/node_modules/@types/node/zlib.d.ts +31 -24
- package/node_modules/axios/CHANGELOG.md +403 -357
- package/node_modules/axios/README.md +80 -49
- package/node_modules/axios/dist/axios.js +121 -46
- package/node_modules/axios/dist/axios.js.map +1 -1
- package/node_modules/axios/dist/axios.min.js +2 -2
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +126 -57
- package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
- package/node_modules/axios/dist/esm/axios.js +126 -57
- package/node_modules/axios/dist/esm/axios.js.map +1 -1
- package/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +346 -97
- package/node_modules/axios/dist/node/axios.cjs.map +1 -1
- package/node_modules/axios/index.d.cts +4 -0
- package/node_modules/axios/index.d.ts +4 -0
- package/node_modules/axios/lib/adapters/adapters.js +85 -40
- package/node_modules/axios/lib/adapters/fetch.js +1 -1
- package/node_modules/axios/lib/adapters/http.js +220 -42
- package/node_modules/axios/lib/core/InterceptorManager.js +1 -1
- package/node_modules/axios/lib/core/mergeConfig.js +4 -4
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/HttpStatusCode.js +6 -0
- package/node_modules/axios/lib/helpers/bind.js +7 -0
- package/node_modules/axios/lib/helpers/cookies.js +24 -13
- package/node_modules/axios/package.json +9 -4
- package/node_modules/detect-libc/lib/filesystem.js +1 -1
- package/node_modules/detect-libc/package.json +3 -1
- package/node_modules/node-abi/abi_registry.json +12 -2
- package/node_modules/node-abi/package.json +3 -6
- package/node_modules/semver/classes/range.js +1 -0
- package/node_modules/semver/classes/semver.js +19 -5
- package/node_modules/semver/internal/identifiers.js +4 -0
- package/node_modules/semver/package.json +3 -3
- package/node_modules/undici-types/agent.d.ts +1 -4
- package/node_modules/undici-types/client.d.ts +0 -2
- package/node_modules/undici-types/diagnostics-channel.d.ts +0 -1
- package/node_modules/undici-types/dispatcher.d.ts +0 -6
- package/node_modules/undici-types/errors.d.ts +5 -15
- package/node_modules/undici-types/eventsource.d.ts +6 -1
- package/node_modules/undici-types/h2c-client.d.ts +0 -2
- package/node_modules/undici-types/index.d.ts +6 -1
- package/node_modules/undici-types/interceptors.d.ts +5 -0
- package/node_modules/undici-types/mock-interceptor.d.ts +0 -1
- package/node_modules/undici-types/package.json +1 -1
- package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
- package/node_modules/undici-types/webidl.d.ts +82 -21
- package/package.json +3 -3
- package/node_modules/@contrast/assess/lib/get-policy.js +0 -336
- package/node_modules/@contrast/protect/lib/input-analysis/install/koa-body5.js +0 -63
- package/node_modules/@contrast/protect/lib/input-analysis/install/koa-bodyparser4.js +0 -64
|
@@ -41,11 +41,13 @@
|
|
|
41
41
|
// Definitions for Node.js modules that are not specific to any version of TypeScript:
|
|
42
42
|
/// <reference path="../globals.d.ts" />
|
|
43
43
|
/// <reference path="../web-globals/abortcontroller.d.ts" />
|
|
44
|
+
/// <reference path="../web-globals/crypto.d.ts" />
|
|
44
45
|
/// <reference path="../web-globals/domexception.d.ts" />
|
|
45
46
|
/// <reference path="../web-globals/events.d.ts" />
|
|
46
47
|
/// <reference path="../web-globals/fetch.d.ts" />
|
|
47
48
|
/// <reference path="../web-globals/navigator.d.ts" />
|
|
48
49
|
/// <reference path="../web-globals/storage.d.ts" />
|
|
50
|
+
/// <reference path="../web-globals/streams.d.ts" />
|
|
49
51
|
/// <reference path="../assert.d.ts" />
|
|
50
52
|
/// <reference path="../assert/strict.d.ts" />
|
|
51
53
|
/// <reference path="../async_hooks.d.ts" />
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/url.js)
|
|
9
9
|
*/
|
|
10
10
|
declare module "url" {
|
|
11
|
-
import { Blob as NodeBlob } from "node:buffer";
|
|
11
|
+
import { Blob as NodeBlob, NonSharedBuffer } from "node:buffer";
|
|
12
12
|
import { ClientRequestArgs } from "node:http";
|
|
13
13
|
import { ParsedUrlQuery, ParsedUrlQueryInput } from "node:querystring";
|
|
14
14
|
// Input to `url.format`
|
|
@@ -325,7 +325,7 @@ declare module "url" {
|
|
|
325
325
|
* @returns The fully-resolved platform-specific Node.js file path
|
|
326
326
|
* as a `Buffer`.
|
|
327
327
|
*/
|
|
328
|
-
function fileURLToPathBuffer(url: string | URL, options?: FileUrlToPathOptions):
|
|
328
|
+
function fileURLToPathBuffer(url: string | URL, options?: FileUrlToPathOptions): NonSharedBuffer;
|
|
329
329
|
/**
|
|
330
330
|
* This function ensures that `path` is resolved absolutely, and that the URL
|
|
331
331
|
* control characters are correctly encoded when converting into a File URL.
|
|
@@ -1020,7 +1020,12 @@ declare module "url" {
|
|
|
1020
1020
|
interface URLPatternInit extends _URLPatternInit {}
|
|
1021
1021
|
interface URLPatternResult extends _URLPatternResult {}
|
|
1022
1022
|
interface URLPattern extends _URLPattern {}
|
|
1023
|
-
var URLPattern: typeof
|
|
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;
|
|
1024
1029
|
}
|
|
1025
1030
|
}
|
|
1026
1031
|
declare module "node:url" {
|
|
@@ -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.
|
|
@@ -848,6 +853,15 @@ declare module "util" {
|
|
|
848
853
|
* @return The deprecated function wrapped to emit a warning.
|
|
849
854
|
*/
|
|
850
855
|
export function deprecate<T extends Function>(fn: T, msg: string, code?: string): T;
|
|
856
|
+
export interface IsDeepStrictEqualOptions {
|
|
857
|
+
/**
|
|
858
|
+
* If `true`, prototype and constructor
|
|
859
|
+
* comparison is skipped during deep strict equality check.
|
|
860
|
+
* @since v24.9.0
|
|
861
|
+
* @default false
|
|
862
|
+
*/
|
|
863
|
+
skipPrototype?: boolean | undefined;
|
|
864
|
+
}
|
|
851
865
|
/**
|
|
852
866
|
* Returns `true` if there is deep strict equality between `val1` and `val2`.
|
|
853
867
|
* Otherwise, returns `false`.
|
|
@@ -856,7 +870,7 @@ declare module "util" {
|
|
|
856
870
|
* equality.
|
|
857
871
|
* @since v9.0.0
|
|
858
872
|
*/
|
|
859
|
-
export function isDeepStrictEqual(val1: unknown, val2: unknown): boolean;
|
|
873
|
+
export function isDeepStrictEqual(val1: unknown, val2: unknown, options?: IsDeepStrictEqualOptions): boolean;
|
|
860
874
|
/**
|
|
861
875
|
* Returns `str` with any ANSI escape codes removed.
|
|
862
876
|
*
|
|
@@ -1327,7 +1341,7 @@ declare module "util" {
|
|
|
1327
1341
|
* encoded bytes.
|
|
1328
1342
|
* @param [input='an empty string'] The text to encode.
|
|
1329
1343
|
*/
|
|
1330
|
-
encode(input?: string):
|
|
1344
|
+
encode(input?: string): NodeJS.NonSharedUint8Array;
|
|
1331
1345
|
/**
|
|
1332
1346
|
* UTF-8 encodes the `src` string to the `dest` Uint8Array and returns an object
|
|
1333
1347
|
* containing the read Unicode code units and written UTF-8 bytes.
|
|
@@ -1437,7 +1451,7 @@ declare module "util" {
|
|
|
1437
1451
|
/**
|
|
1438
1452
|
* Array of argument strings.
|
|
1439
1453
|
*/
|
|
1440
|
-
args?: string[] | undefined;
|
|
1454
|
+
args?: readonly string[] | undefined;
|
|
1441
1455
|
/**
|
|
1442
1456
|
* Used to describe arguments known to the parser.
|
|
1443
1457
|
*/
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/v8.js)
|
|
8
8
|
*/
|
|
9
9
|
declare module "v8" {
|
|
10
|
+
import { NonSharedBuffer } from "node:buffer";
|
|
10
11
|
import { Readable } from "node:stream";
|
|
11
12
|
interface HeapSpaceInfo {
|
|
12
13
|
space_name: string;
|
|
@@ -43,12 +44,12 @@ declare module "v8" {
|
|
|
43
44
|
* If true, expose internals in the heap snapshot.
|
|
44
45
|
* @default false
|
|
45
46
|
*/
|
|
46
|
-
exposeInternals?: boolean;
|
|
47
|
+
exposeInternals?: boolean | undefined;
|
|
47
48
|
/**
|
|
48
49
|
* If true, expose numeric values in artificial fields.
|
|
49
50
|
* @default false
|
|
50
51
|
*/
|
|
51
|
-
exposeNumericValues?: boolean;
|
|
52
|
+
exposeNumericValues?: boolean | undefined;
|
|
52
53
|
}
|
|
53
54
|
/**
|
|
54
55
|
* Returns an integer representing a version tag derived from the V8 version,
|
|
@@ -400,6 +401,38 @@ declare module "v8" {
|
|
|
400
401
|
* @since v12.8.0
|
|
401
402
|
*/
|
|
402
403
|
function getHeapCodeStatistics(): HeapCodeStatistics;
|
|
404
|
+
/**
|
|
405
|
+
* @since v24.8.0
|
|
406
|
+
*/
|
|
407
|
+
interface CPUProfileHandle {
|
|
408
|
+
/**
|
|
409
|
+
* Stopping collecting the profile, then return a Promise that fulfills with an error or the
|
|
410
|
+
* profile data.
|
|
411
|
+
* @since v24.8.0
|
|
412
|
+
*/
|
|
413
|
+
stop(): Promise<string>;
|
|
414
|
+
/**
|
|
415
|
+
* Stopping collecting the profile and the profile will be discarded.
|
|
416
|
+
* @since v24.8.0
|
|
417
|
+
*/
|
|
418
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* @since v24.9.0
|
|
422
|
+
*/
|
|
423
|
+
interface HeapProfileHandle {
|
|
424
|
+
/**
|
|
425
|
+
* Stopping collecting the profile, then return a Promise that fulfills with an error or the
|
|
426
|
+
* profile data.
|
|
427
|
+
* @since v24.9.0
|
|
428
|
+
*/
|
|
429
|
+
stop(): Promise<string>;
|
|
430
|
+
/**
|
|
431
|
+
* Stopping collecting the profile and the profile will be discarded.
|
|
432
|
+
* @since v24.9.0
|
|
433
|
+
*/
|
|
434
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
435
|
+
}
|
|
403
436
|
/**
|
|
404
437
|
* V8 only supports `Latin-1/ISO-8859-1` and `UTF16` as the underlying representation of a string.
|
|
405
438
|
* If the `content` uses `Latin-1/ISO-8859-1` as the underlying representation, this function will return true;
|
|
@@ -453,7 +486,7 @@ declare module "v8" {
|
|
|
453
486
|
* the buffer is released. Calling this method results in undefined behavior
|
|
454
487
|
* if a previous write has failed.
|
|
455
488
|
*/
|
|
456
|
-
releaseBuffer():
|
|
489
|
+
releaseBuffer(): NonSharedBuffer;
|
|
457
490
|
/**
|
|
458
491
|
* Marks an `ArrayBuffer` as having its contents transferred out of band.
|
|
459
492
|
* Pass the corresponding `ArrayBuffer` in the deserializing context to `deserializer.transferArrayBuffer()`.
|
|
@@ -481,7 +514,7 @@ declare module "v8" {
|
|
|
481
514
|
* will require a way to compute the length of the buffer.
|
|
482
515
|
* For use inside of a custom `serializer._writeHostObject()`.
|
|
483
516
|
*/
|
|
484
|
-
writeRawBytes(buffer: NodeJS.
|
|
517
|
+
writeRawBytes(buffer: NodeJS.ArrayBufferView): void;
|
|
485
518
|
}
|
|
486
519
|
/**
|
|
487
520
|
* A subclass of `Serializer` that serializes `TypedArray`(in particular `Buffer`) and `DataView` objects as host objects, and only
|
|
@@ -552,7 +585,7 @@ declare module "v8" {
|
|
|
552
585
|
* larger than `buffer.constants.MAX_LENGTH`.
|
|
553
586
|
* @since v8.0.0
|
|
554
587
|
*/
|
|
555
|
-
function serialize(value: any):
|
|
588
|
+
function serialize(value: any): NonSharedBuffer;
|
|
556
589
|
/**
|
|
557
590
|
* Uses a `DefaultDeserializer` with default options to read a JS value
|
|
558
591
|
* from a buffer.
|
|
@@ -37,6 +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 { NonSharedBuffer } from "node:buffer";
|
|
40
41
|
import { ImportAttributes, ImportPhase } from "node:module";
|
|
41
42
|
interface Context extends NodeJS.Dict<any> {}
|
|
42
43
|
interface BaseOptions {
|
|
@@ -66,7 +67,7 @@ declare module "vm" {
|
|
|
66
67
|
/**
|
|
67
68
|
* Provides an optional data with V8's code cache data for the supplied source.
|
|
68
69
|
*/
|
|
69
|
-
cachedData?:
|
|
70
|
+
cachedData?: NodeJS.ArrayBufferView | undefined;
|
|
70
71
|
/** @deprecated in favor of `script.createCachedData()` */
|
|
71
72
|
produceCachedData?: boolean | undefined;
|
|
72
73
|
/**
|
|
@@ -99,28 +100,22 @@ declare module "vm" {
|
|
|
99
100
|
*/
|
|
100
101
|
breakOnSigint?: boolean | undefined;
|
|
101
102
|
}
|
|
102
|
-
interface RunningScriptInNewContextOptions
|
|
103
|
+
interface RunningScriptInNewContextOptions
|
|
104
|
+
extends RunningScriptOptions, Pick<CreateContextOptions, "microtaskMode">
|
|
105
|
+
{
|
|
103
106
|
/**
|
|
104
107
|
* Human-readable name of the newly created context.
|
|
105
108
|
*/
|
|
106
|
-
contextName?: CreateContextOptions["name"];
|
|
109
|
+
contextName?: CreateContextOptions["name"] | undefined;
|
|
107
110
|
/**
|
|
108
111
|
* Origin corresponding to the newly created context for display purposes. The origin should be formatted like a URL,
|
|
109
112
|
* but with only the scheme, host, and port (if necessary), like the value of the `url.origin` property of a `URL` object.
|
|
110
113
|
* Most notably, this string should omit the trailing slash, as that denotes a path.
|
|
111
114
|
*/
|
|
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"];
|
|
115
|
+
contextOrigin?: CreateContextOptions["origin"] | undefined;
|
|
116
|
+
contextCodeGeneration?: CreateContextOptions["codeGeneration"] | undefined;
|
|
118
117
|
}
|
|
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;
|
|
118
|
+
interface RunningCodeOptions extends RunningScriptOptions, Pick<ScriptOptions, "cachedData"> {
|
|
124
119
|
/**
|
|
125
120
|
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
|
|
126
121
|
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
|
|
@@ -132,11 +127,9 @@ declare module "vm" {
|
|
|
132
127
|
| typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
|
|
133
128
|
| undefined;
|
|
134
129
|
}
|
|
135
|
-
interface RunningCodeInNewContextOptions
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
*/
|
|
139
|
-
cachedData?: ScriptOptions["cachedData"] | undefined;
|
|
130
|
+
interface RunningCodeInNewContextOptions
|
|
131
|
+
extends RunningScriptInNewContextOptions, Pick<ScriptOptions, "cachedData">
|
|
132
|
+
{
|
|
140
133
|
/**
|
|
141
134
|
* Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
|
|
142
135
|
* part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
|
|
@@ -148,16 +141,7 @@ declare module "vm" {
|
|
|
148
141
|
| typeof constants.USE_MAIN_CONTEXT_DEFAULT_LOADER
|
|
149
142
|
| undefined;
|
|
150
143
|
}
|
|
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;
|
|
144
|
+
interface CompileFunctionOptions extends BaseOptions, Pick<ScriptOptions, "cachedData" | "produceCachedData"> {
|
|
161
145
|
/**
|
|
162
146
|
* The sandbox/context in which the said function should be compiled in.
|
|
163
147
|
*/
|
|
@@ -384,17 +368,17 @@ declare module "vm" {
|
|
|
384
368
|
* ```
|
|
385
369
|
* @since v10.6.0
|
|
386
370
|
*/
|
|
387
|
-
createCachedData():
|
|
371
|
+
createCachedData(): NonSharedBuffer;
|
|
388
372
|
/** @deprecated in favor of `script.createCachedData()` */
|
|
389
|
-
cachedDataProduced?: boolean
|
|
373
|
+
cachedDataProduced?: boolean;
|
|
390
374
|
/**
|
|
391
375
|
* When `cachedData` is supplied to create the `vm.Script`, this value will be set
|
|
392
376
|
* to either `true` or `false` depending on acceptance of the data by V8.
|
|
393
377
|
* Otherwise the value is `undefined`.
|
|
394
378
|
* @since v5.7.0
|
|
395
379
|
*/
|
|
396
|
-
cachedDataRejected?: boolean
|
|
397
|
-
cachedData?:
|
|
380
|
+
cachedDataRejected?: boolean;
|
|
381
|
+
cachedData?: NonSharedBuffer;
|
|
398
382
|
/**
|
|
399
383
|
* When the script is compiled from a source that contains a source map magic
|
|
400
384
|
* comment, this property will be set to the URL of the source map.
|
|
@@ -412,7 +396,7 @@ declare module "vm" {
|
|
|
412
396
|
* ```
|
|
413
397
|
* @since v19.1.0, v18.13.0
|
|
414
398
|
*/
|
|
415
|
-
sourceMapURL
|
|
399
|
+
sourceMapURL: string | undefined;
|
|
416
400
|
}
|
|
417
401
|
/**
|
|
418
402
|
* If the given `contextObject` is an object, the `vm.createContext()` method will
|
|
@@ -622,11 +606,7 @@ declare module "vm" {
|
|
|
622
606
|
code: string,
|
|
623
607
|
params?: readonly string[],
|
|
624
608
|
options?: CompileFunctionOptions,
|
|
625
|
-
): Function &
|
|
626
|
-
cachedData?: Script["cachedData"] | undefined;
|
|
627
|
-
cachedDataProduced?: Script["cachedDataProduced"] | undefined;
|
|
628
|
-
cachedDataRejected?: Script["cachedDataRejected"] | undefined;
|
|
629
|
-
};
|
|
609
|
+
): Function & Pick<Script, "cachedData" | "cachedDataProduced" | "cachedDataRejected">;
|
|
630
610
|
/**
|
|
631
611
|
* Measure the memory known to V8 and used by all contexts known to the
|
|
632
612
|
* current V8 isolate, or the main context.
|
|
@@ -683,10 +663,7 @@ declare module "vm" {
|
|
|
683
663
|
* @experimental
|
|
684
664
|
*/
|
|
685
665
|
function measureMemory(options?: MeasureMemoryOptions): Promise<MemoryMeasurement>;
|
|
686
|
-
interface ModuleEvaluateOptions {
|
|
687
|
-
timeout?: RunningScriptOptions["timeout"] | undefined;
|
|
688
|
-
breakOnSigint?: RunningScriptOptions["breakOnSigint"] | undefined;
|
|
689
|
-
}
|
|
666
|
+
interface ModuleEvaluateOptions extends Pick<RunningScriptOptions, "breakOnSigint" | "timeout"> {}
|
|
690
667
|
type ModuleLinker = (
|
|
691
668
|
specifier: string,
|
|
692
669
|
referencingModule: Module,
|
|
@@ -700,14 +677,12 @@ declare module "vm" {
|
|
|
700
677
|
* flag enabled.
|
|
701
678
|
*
|
|
702
679
|
* The `vm.Module` class provides a low-level interface for using
|
|
703
|
-
* ECMAScript modules in VM contexts. It is the counterpart of the `vm.Script`
|
|
704
|
-
* defined in the ECMAScript
|
|
680
|
+
* ECMAScript modules in VM contexts. It is the counterpart of the `vm.Script`
|
|
681
|
+
* class that closely mirrors [Module Record](https://tc39.es/ecma262/#sec-abstract-module-records)s as defined in the ECMAScript
|
|
705
682
|
* specification.
|
|
706
683
|
*
|
|
707
684
|
* Unlike `vm.Script` however, every `vm.Module` object is bound to a context from
|
|
708
|
-
* its creation.
|
|
709
|
-
* in contrast with the synchronous nature of `vm.Script` objects. The use of
|
|
710
|
-
* 'async' functions can help with manipulating `vm.Module` objects.
|
|
685
|
+
* its creation.
|
|
711
686
|
*
|
|
712
687
|
* Using a `vm.Module` object requires three distinct steps: creation/parsing,
|
|
713
688
|
* linking, and evaluation. These three steps are illustrated in the following
|
|
@@ -735,7 +710,7 @@ declare module "vm" {
|
|
|
735
710
|
* // Here, we attempt to obtain the default export from the module "foo", and
|
|
736
711
|
* // put it into local binding "secret".
|
|
737
712
|
*
|
|
738
|
-
* const
|
|
713
|
+
* const rootModule = new vm.SourceTextModule(`
|
|
739
714
|
* import s from 'foo';
|
|
740
715
|
* s;
|
|
741
716
|
* print(s);
|
|
@@ -745,39 +720,48 @@ declare module "vm" {
|
|
|
745
720
|
* //
|
|
746
721
|
* // "Link" the imported dependencies of this Module to it.
|
|
747
722
|
* //
|
|
748
|
-
* //
|
|
749
|
-
* //
|
|
750
|
-
* // the imported module. The callback is expected to return a Module that
|
|
751
|
-
* // corresponds to the provided specifier, with certain requirements documented
|
|
752
|
-
* // in `module.link()`.
|
|
753
|
-
* //
|
|
754
|
-
* // If linking has not started for the returned Module, the same linker
|
|
755
|
-
* // callback will be called on the returned Module.
|
|
723
|
+
* // Obtain the requested dependencies of a SourceTextModule by
|
|
724
|
+
* // `sourceTextModule.moduleRequests` and resolve them.
|
|
756
725
|
* //
|
|
757
726
|
* // Even top-level Modules without dependencies must be explicitly linked. The
|
|
758
|
-
* //
|
|
727
|
+
* // array passed to `sourceTextModule.linkRequests(modules)` can be
|
|
728
|
+
* // empty, however.
|
|
759
729
|
* //
|
|
760
|
-
* //
|
|
761
|
-
* //
|
|
762
|
-
* //
|
|
763
|
-
*
|
|
764
|
-
*
|
|
765
|
-
*
|
|
730
|
+
* // Note: This is a contrived example in that the resolveAndLinkDependencies
|
|
731
|
+
* // creates a new "foo" module every time it is called. In a full-fledged
|
|
732
|
+
* // module system, a cache would probably be used to avoid duplicated modules.
|
|
733
|
+
*
|
|
734
|
+
* const moduleMap = new Map([
|
|
735
|
+
* ['root', rootModule],
|
|
736
|
+
* ]);
|
|
766
737
|
*
|
|
767
|
-
*
|
|
768
|
-
*
|
|
769
|
-
*
|
|
770
|
-
*
|
|
771
|
-
*
|
|
772
|
-
*
|
|
773
|
-
* `, { context: referencingModule.context });
|
|
738
|
+
* function resolveAndLinkDependencies(module) {
|
|
739
|
+
* const requestedModules = module.moduleRequests.map((request) => {
|
|
740
|
+
* // In a full-fledged module system, the resolveAndLinkDependencies would
|
|
741
|
+
* // resolve the module with the module cache key `[specifier, attributes]`.
|
|
742
|
+
* // In this example, we just use the specifier as the key.
|
|
743
|
+
* const specifier = request.specifier;
|
|
774
744
|
*
|
|
775
|
-
*
|
|
776
|
-
*
|
|
777
|
-
*
|
|
778
|
-
*
|
|
745
|
+
* let requestedModule = moduleMap.get(specifier);
|
|
746
|
+
* if (requestedModule === undefined) {
|
|
747
|
+
* requestedModule = new vm.SourceTextModule(`
|
|
748
|
+
* // The "secret" variable refers to the global variable we added to
|
|
749
|
+
* // "contextifiedObject" when creating the context.
|
|
750
|
+
* export default secret;
|
|
751
|
+
* `, { context: referencingModule.context });
|
|
752
|
+
* moduleMap.set(specifier, linkedModule);
|
|
753
|
+
* // Resolve the dependencies of the new module as well.
|
|
754
|
+
* resolveAndLinkDependencies(requestedModule);
|
|
755
|
+
* }
|
|
756
|
+
*
|
|
757
|
+
* return requestedModule;
|
|
758
|
+
* });
|
|
759
|
+
*
|
|
760
|
+
* module.linkRequests(requestedModules);
|
|
779
761
|
* }
|
|
780
|
-
*
|
|
762
|
+
*
|
|
763
|
+
* resolveAndLinkDependencies(rootModule);
|
|
764
|
+
* rootModule.instantiate();
|
|
781
765
|
*
|
|
782
766
|
* // Step 3
|
|
783
767
|
* //
|
|
@@ -785,7 +769,7 @@ declare module "vm" {
|
|
|
785
769
|
* // resolve after the module has finished evaluating.
|
|
786
770
|
*
|
|
787
771
|
* // Prints 42.
|
|
788
|
-
* await
|
|
772
|
+
* await rootModule.evaluate();
|
|
789
773
|
* ```
|
|
790
774
|
* @since v13.0.0, v12.16.0
|
|
791
775
|
* @experimental
|
|
@@ -855,6 +839,10 @@ declare module "vm" {
|
|
|
855
839
|
* Link module dependencies. This method must be called before evaluation, and
|
|
856
840
|
* can only be called once per module.
|
|
857
841
|
*
|
|
842
|
+
* Use `sourceTextModule.linkRequests(modules)` and
|
|
843
|
+
* `sourceTextModule.instantiate()` to link modules either synchronously or
|
|
844
|
+
* asynchronously.
|
|
845
|
+
*
|
|
858
846
|
* The function is expected to return a `Module` object or a `Promise` that
|
|
859
847
|
* eventually resolves to a `Module` object. The returned `Module` must satisfy the
|
|
860
848
|
* following two invariants:
|
|
@@ -885,19 +873,13 @@ declare module "vm" {
|
|
|
885
873
|
*/
|
|
886
874
|
link(linker: ModuleLinker): Promise<void>;
|
|
887
875
|
}
|
|
888
|
-
interface SourceTextModuleOptions {
|
|
876
|
+
interface SourceTextModuleOptions extends Pick<ScriptOptions, "cachedData" | "columnOffset" | "lineOffset"> {
|
|
889
877
|
/**
|
|
890
878
|
* String used in stack traces.
|
|
891
879
|
* @default 'vm:module(i)' where i is a context-specific ascending index.
|
|
892
880
|
*/
|
|
893
881
|
identifier?: string | undefined;
|
|
894
|
-
/**
|
|
895
|
-
* Provides an optional data with V8's code cache data for the supplied source.
|
|
896
|
-
*/
|
|
897
|
-
cachedData?: ScriptOptions["cachedData"] | undefined;
|
|
898
882
|
context?: Context | undefined;
|
|
899
|
-
lineOffset?: BaseOptions["lineOffset"] | undefined;
|
|
900
|
-
columnOffset?: BaseOptions["columnOffset"] | undefined;
|
|
901
883
|
/**
|
|
902
884
|
* Called during evaluation of this module to initialize the `import.meta`.
|
|
903
885
|
*/
|
|
@@ -941,6 +923,39 @@ declare module "vm" {
|
|
|
941
923
|
class SourceTextModule extends Module {
|
|
942
924
|
/**
|
|
943
925
|
* Creates a new `SourceTextModule` instance.
|
|
926
|
+
*
|
|
927
|
+
* Properties assigned to the `import.meta` object that are objects may
|
|
928
|
+
* allow the module to access information outside the specified `context`. Use
|
|
929
|
+
* `vm.runInContext()` to create objects in a specific context.
|
|
930
|
+
*
|
|
931
|
+
* ```js
|
|
932
|
+
* import vm from 'node:vm';
|
|
933
|
+
*
|
|
934
|
+
* const contextifiedObject = vm.createContext({ secret: 42 });
|
|
935
|
+
*
|
|
936
|
+
* const module = new vm.SourceTextModule(
|
|
937
|
+
* 'Object.getPrototypeOf(import.meta.prop).secret = secret;',
|
|
938
|
+
* {
|
|
939
|
+
* initializeImportMeta(meta) {
|
|
940
|
+
* // Note: this object is created in the top context. As such,
|
|
941
|
+
* // Object.getPrototypeOf(import.meta.prop) points to the
|
|
942
|
+
* // Object.prototype in the top context rather than that in
|
|
943
|
+
* // the contextified object.
|
|
944
|
+
* meta.prop = {};
|
|
945
|
+
* },
|
|
946
|
+
* });
|
|
947
|
+
* // The module has an empty `moduleRequests` array.
|
|
948
|
+
* module.linkRequests([]);
|
|
949
|
+
* module.instantiate();
|
|
950
|
+
* await module.evaluate();
|
|
951
|
+
*
|
|
952
|
+
* // Now, Object.prototype.secret will be equal to 42.
|
|
953
|
+
* //
|
|
954
|
+
* // To fix this problem, replace
|
|
955
|
+
* // meta.prop = {};
|
|
956
|
+
* // above with
|
|
957
|
+
* // meta.prop = vm.runInContext('{}', contextifiedObject);
|
|
958
|
+
* ```
|
|
944
959
|
* @param code JavaScript Module code to parse
|
|
945
960
|
*/
|
|
946
961
|
constructor(code: string, options?: SourceTextModuleOptions);
|
|
@@ -948,6 +963,75 @@ declare module "vm" {
|
|
|
948
963
|
* @deprecated Use `sourceTextModule.moduleRequests` instead.
|
|
949
964
|
*/
|
|
950
965
|
readonly dependencySpecifiers: readonly string[];
|
|
966
|
+
/**
|
|
967
|
+
* Iterates over the dependency graph and returns `true` if any module in its
|
|
968
|
+
* dependencies or this module itself contains top-level `await` expressions,
|
|
969
|
+
* otherwise returns `false`.
|
|
970
|
+
*
|
|
971
|
+
* The search may be slow if the graph is big enough.
|
|
972
|
+
*
|
|
973
|
+
* This requires the module to be instantiated first. If the module is not
|
|
974
|
+
* instantiated yet, an error will be thrown.
|
|
975
|
+
* @since v24.9.0
|
|
976
|
+
*/
|
|
977
|
+
hasAsyncGraph(): boolean;
|
|
978
|
+
/**
|
|
979
|
+
* Returns whether the module itself contains any top-level `await` expressions.
|
|
980
|
+
*
|
|
981
|
+
* This corresponds to the field `[[HasTLA]]` in [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records) in the
|
|
982
|
+
* ECMAScript specification.
|
|
983
|
+
* @since v24.9.0
|
|
984
|
+
*/
|
|
985
|
+
hasTopLevelAwait(): boolean;
|
|
986
|
+
/**
|
|
987
|
+
* Instantiate the module with the linked requested modules.
|
|
988
|
+
*
|
|
989
|
+
* This resolves the imported bindings of the module, including re-exported
|
|
990
|
+
* binding names. When there are any bindings that cannot be resolved,
|
|
991
|
+
* an error would be thrown synchronously.
|
|
992
|
+
*
|
|
993
|
+
* If the requested modules include cyclic dependencies, the
|
|
994
|
+
* `sourceTextModule.linkRequests(modules)` method must be called on all
|
|
995
|
+
* modules in the cycle before calling this method.
|
|
996
|
+
* @since v24.8.0
|
|
997
|
+
*/
|
|
998
|
+
instantiate(): void;
|
|
999
|
+
/**
|
|
1000
|
+
* Link module dependencies. This method must be called before evaluation, and
|
|
1001
|
+
* can only be called once per module.
|
|
1002
|
+
*
|
|
1003
|
+
* The order of the module instances in the `modules` array should correspond to the order of
|
|
1004
|
+
* `sourceTextModule.moduleRequests` being resolved. If two module requests have the same
|
|
1005
|
+
* specifier and import attributes, they must be resolved with the same module instance or an
|
|
1006
|
+
* `ERR_MODULE_LINK_MISMATCH` would be thrown. For example, when linking requests for this
|
|
1007
|
+
* module:
|
|
1008
|
+
*
|
|
1009
|
+
* ```js
|
|
1010
|
+
* import foo from 'foo';
|
|
1011
|
+
* import source Foo from 'foo';
|
|
1012
|
+
* ```
|
|
1013
|
+
*
|
|
1014
|
+
* The `modules` array must contain two references to the same instance, because the two
|
|
1015
|
+
* module requests are identical but in two phases.
|
|
1016
|
+
*
|
|
1017
|
+
* If the module has no dependencies, the `modules` array can be empty.
|
|
1018
|
+
*
|
|
1019
|
+
* Users can use `sourceTextModule.moduleRequests` to implement the host-defined
|
|
1020
|
+
* [HostLoadImportedModule](https://tc39.es/ecma262/#sec-HostLoadImportedModule) abstract operation in the ECMAScript specification,
|
|
1021
|
+
* and using `sourceTextModule.linkRequests()` to invoke specification defined
|
|
1022
|
+
* [FinishLoadingImportedModule](https://tc39.es/ecma262/#sec-FinishLoadingImportedModule), on the module with all dependencies in a batch.
|
|
1023
|
+
*
|
|
1024
|
+
* It's up to the creator of the `SourceTextModule` to determine if the resolution
|
|
1025
|
+
* of the dependencies is synchronous or asynchronous.
|
|
1026
|
+
*
|
|
1027
|
+
* After each module in the `modules` array is linked, call
|
|
1028
|
+
* `sourceTextModule.instantiate()`.
|
|
1029
|
+
* @since v24.8.0
|
|
1030
|
+
* @param modules Array of `vm.Module` objects that this module depends on.
|
|
1031
|
+
* The order of the modules in the array is the order of
|
|
1032
|
+
* `sourceTextModule.moduleRequests`.
|
|
1033
|
+
*/
|
|
1034
|
+
linkRequests(modules: readonly Module[]): void;
|
|
951
1035
|
/**
|
|
952
1036
|
* The requested import dependencies of this module. The returned array is frozen
|
|
953
1037
|
* to disallow any changes to it.
|
|
@@ -1043,9 +1127,7 @@ declare module "vm" {
|
|
|
1043
1127
|
options?: SyntheticModuleOptions,
|
|
1044
1128
|
);
|
|
1045
1129
|
/**
|
|
1046
|
-
* This method
|
|
1047
|
-
* it is called before the module is linked, an `ERR_VM_MODULE_STATUS` error
|
|
1048
|
-
* will be thrown.
|
|
1130
|
+
* This method sets the module export binding slots with the given value.
|
|
1049
1131
|
*
|
|
1050
1132
|
* ```js
|
|
1051
1133
|
* import vm from 'node:vm';
|
|
@@ -1054,7 +1136,6 @@ declare module "vm" {
|
|
|
1054
1136
|
* m.setExport('x', 1);
|
|
1055
1137
|
* });
|
|
1056
1138
|
*
|
|
1057
|
-
* await m.link(() => {});
|
|
1058
1139
|
* await m.evaluate();
|
|
1059
1140
|
*
|
|
1060
1141
|
* assert.strictEqual(m.namespace.x, 1);
|
|
@@ -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
|
+
}
|
|
@@ -51,6 +51,7 @@ interface EventListenerObject {
|
|
|
51
51
|
handleEvent(object: Event): void;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
type _EventListenerOptions = typeof globalThis extends { onmessage: any } ? {} : EventListenerOptions;
|
|
54
55
|
interface EventListenerOptions {
|
|
55
56
|
capture?: boolean;
|
|
56
57
|
}
|
|
@@ -85,6 +86,8 @@ declare global {
|
|
|
85
86
|
new(type: string, eventInitDict?: EventInit): Event;
|
|
86
87
|
};
|
|
87
88
|
|
|
89
|
+
interface EventListenerOptions extends _EventListenerOptions {}
|
|
90
|
+
|
|
88
91
|
interface EventTarget extends _EventTarget {}
|
|
89
92
|
var EventTarget: typeof globalThis extends { onmessage: any; EventTarget: infer T } ? T
|
|
90
93
|
: {
|