@secure-exec/core 0.2.1 → 0.3.0-rc.1
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 +5 -5
- package/dist/binary.d.ts +4 -0
- package/dist/binary.js +25 -0
- package/dist/bytes.d.ts +2 -0
- package/dist/bytes.js +6 -0
- package/dist/callbacks.d.ts +41 -0
- package/dist/callbacks.js +94 -0
- package/dist/cargo.d.ts +2 -0
- package/dist/cargo.js +142 -0
- package/dist/correlation.d.ts +10 -0
- package/dist/correlation.js +49 -0
- package/dist/descriptors.d.ts +34 -0
- package/dist/descriptors.js +37 -0
- package/dist/event-buffer.d.ts +90 -0
- package/dist/event-buffer.js +313 -0
- package/dist/ext.d.ts +7 -0
- package/dist/ext.js +13 -0
- package/dist/filesystem.d.ts +41 -0
- package/dist/filesystem.js +70 -0
- package/dist/frame-payload-codec.d.ts +8 -0
- package/dist/frame-payload-codec.js +14 -0
- package/dist/frame-rpc.d.ts +38 -0
- package/dist/frame-rpc.js +73 -0
- package/dist/frame-stream.d.ts +27 -0
- package/dist/frame-stream.js +99 -0
- package/dist/framing.d.ts +7 -0
- package/dist/framing.js +22 -0
- package/dist/generated/AcpLimitsConfig.d.ts +4 -0
- package/dist/generated/AcpLimitsConfig.js +2 -0
- package/dist/generated/CreateVmConfig.d.ts +19 -0
- package/dist/generated/FsPermissionRule.d.ts +6 -0
- package/dist/generated/FsPermissionRuleSet.d.ts +6 -0
- package/dist/generated/FsPermissionRuleSet.js +1 -0
- package/dist/generated/FsPermissionScope.d.ts +3 -0
- package/dist/generated/FsPermissionScope.js +1 -0
- package/dist/generated/HttpLimitsConfig.d.ts +3 -0
- package/dist/generated/HttpLimitsConfig.js +2 -0
- package/dist/generated/JsModuleResolution.d.ts +1 -0
- package/dist/generated/JsModuleResolution.js +2 -0
- package/dist/generated/JsRuntimeConfig.d.ts +26 -0
- package/dist/generated/JsRuntimeConfig.js +1 -0
- package/dist/generated/JsRuntimeLimitsConfig.d.ts +7 -0
- package/dist/generated/JsRuntimeLimitsConfig.js +2 -0
- package/dist/generated/JsRuntimePlatform.d.ts +1 -0
- package/dist/generated/JsRuntimePlatform.js +2 -0
- package/dist/generated/MountPluginDescriptor.d.ts +4 -0
- package/dist/generated/MountPluginDescriptor.js +2 -0
- package/dist/generated/NativeRootFilesystemConfig.d.ts +5 -0
- package/dist/generated/NativeRootFilesystemConfig.js +1 -0
- package/dist/generated/PatternPermissionRule.d.ts +6 -0
- package/dist/generated/PatternPermissionRule.js +1 -0
- package/dist/generated/PatternPermissionRuleSet.d.ts +6 -0
- package/dist/generated/PatternPermissionRuleSet.js +1 -0
- package/dist/generated/PatternPermissionScope.d.ts +3 -0
- package/dist/generated/PatternPermissionScope.js +1 -0
- package/dist/generated/PermissionMode.d.ts +1 -0
- package/dist/generated/PermissionMode.js +2 -0
- package/dist/generated/PermissionsPolicy.d.ts +10 -0
- package/dist/generated/PermissionsPolicy.js +1 -0
- package/dist/generated/PluginLimitsConfig.d.ts +4 -0
- package/dist/generated/PluginLimitsConfig.js +2 -0
- package/dist/generated/PythonLimitsConfig.d.ts +5 -0
- package/dist/generated/PythonLimitsConfig.js +2 -0
- package/dist/generated/ResourceLimitsConfig.d.ts +22 -0
- package/dist/generated/ResourceLimitsConfig.js +2 -0
- package/dist/generated/RootFilesystemConfig.d.ts +9 -0
- package/dist/generated/RootFilesystemConfig.js +1 -0
- package/dist/generated/RootFilesystemEntry.d.ts +13 -0
- package/dist/generated/RootFilesystemEntry.js +1 -0
- package/dist/generated/RootFilesystemEntryEncoding.d.ts +1 -0
- package/dist/generated/RootFilesystemEntryEncoding.js +2 -0
- package/dist/generated/RootFilesystemEntryKind.d.ts +1 -0
- package/dist/generated/RootFilesystemEntryKind.js +2 -0
- package/dist/generated/RootFilesystemLowerDescriptor.d.ts +7 -0
- package/dist/generated/RootFilesystemLowerDescriptor.js +1 -0
- package/dist/generated/RootFilesystemMode.d.ts +1 -0
- package/dist/generated/RootFilesystemMode.js +2 -0
- package/dist/generated/ToolLimitsConfig.d.ts +10 -0
- package/dist/generated/ToolLimitsConfig.js +2 -0
- package/dist/generated/VmDnsConfig.d.ts +6 -0
- package/dist/generated/VmDnsConfig.js +2 -0
- package/dist/generated/VmLimitsConfig.d.ts +18 -0
- package/dist/generated/VmLimitsConfig.js +1 -0
- package/dist/generated/VmListenPolicyConfig.d.ts +5 -0
- package/dist/generated/VmListenPolicyConfig.js +2 -0
- package/dist/generated/WasmLimitsConfig.d.ts +5 -0
- package/dist/generated/WasmLimitsConfig.js +2 -0
- package/dist/generated-protocol.d.ts +1037 -0
- package/dist/generated-protocol.js +2887 -0
- package/dist/index.d.ts +24 -62
- package/dist/index.js +24 -53
- package/dist/json.d.ts +2 -0
- package/dist/json.js +20 -0
- package/dist/kernel-proxy.d.ts +149 -0
- package/dist/kernel-proxy.js +1733 -0
- package/dist/native-client.d.ts +41 -0
- package/dist/native-client.js +124 -0
- package/dist/node-runtime.d.ts +443 -0
- package/dist/node-runtime.js +569 -0
- package/dist/numbers.d.ts +1 -0
- package/dist/numbers.js +8 -0
- package/dist/ownership.d.ts +18 -0
- package/dist/ownership.js +77 -0
- package/dist/permissions.d.ts +29 -0
- package/dist/permissions.js +68 -0
- package/dist/process.d.ts +35 -0
- package/dist/process.js +125 -0
- package/dist/protocol-client.d.ts +46 -0
- package/dist/protocol-client.js +180 -0
- package/dist/protocol-frames.d.ts +68 -0
- package/dist/protocol-frames.js +139 -0
- package/dist/protocol-maps.d.ts +28 -0
- package/dist/protocol-maps.js +217 -0
- package/dist/protocol-schema.d.ts +10 -0
- package/dist/protocol-schema.js +11 -0
- package/dist/request-payloads.d.ts +137 -0
- package/dist/request-payloads.js +210 -0
- package/dist/response-payloads.d.ts +107 -0
- package/dist/response-payloads.js +161 -0
- package/dist/sidecar-client.d.ts +242 -0
- package/dist/sidecar-client.js +797 -0
- package/dist/state.d.ts +40 -0
- package/dist/state.js +44 -0
- package/dist/test-runtime.d.ts +526 -0
- package/dist/test-runtime.js +2119 -0
- package/dist/vm-config.d.ts +31 -0
- package/dist/vm-config.js +1 -0
- package/fixtures/alpine-defaults.json +520 -0
- package/fixtures/base-filesystem.json +528 -0
- package/package.json +193 -115
- package/LICENSE +0 -191
- package/dist/bridge-setup.d.ts +0 -6
- package/dist/bridge-setup.js +0 -9
- package/dist/esm-compiler.d.ts +0 -18
- package/dist/esm-compiler.js +0 -72
- package/dist/fs-helpers.d.ts +0 -23
- package/dist/fs-helpers.js +0 -41
- package/dist/generated/isolate-runtime.d.ts +0 -19
- package/dist/generated/isolate-runtime.js +0 -21
- package/dist/generated/polyfills.d.ts +0 -82
- package/dist/generated/polyfills.js +0 -82
- package/dist/isolate-runtime/apply-custom-global-policy.js +0 -53
- package/dist/isolate-runtime/apply-timing-mitigation-freeze.js +0 -130
- package/dist/isolate-runtime/apply-timing-mitigation-off.js +0 -14
- package/dist/isolate-runtime/bridge-attach.js +0 -29
- package/dist/isolate-runtime/bridge-initial-globals.js +0 -385
- package/dist/isolate-runtime/eval-script-result.js +0 -8
- package/dist/isolate-runtime/global-exposure-helpers.js +0 -36
- package/dist/isolate-runtime/init-commonjs-module-globals.js +0 -28
- package/dist/isolate-runtime/override-process-cwd.js +0 -8
- package/dist/isolate-runtime/override-process-env.js +0 -8
- package/dist/isolate-runtime/require-setup.js +0 -4153
- package/dist/isolate-runtime/set-commonjs-file-globals.js +0 -36
- package/dist/isolate-runtime/set-stdin-data.js +0 -10
- package/dist/isolate-runtime/setup-dynamic-import.js +0 -123
- package/dist/isolate-runtime/setup-fs-facade.js +0 -87
- package/dist/kernel/command-registry.d.ts +0 -44
- package/dist/kernel/command-registry.js +0 -114
- package/dist/kernel/device-backend.d.ts +0 -14
- package/dist/kernel/device-backend.js +0 -251
- package/dist/kernel/device-layer.d.ts +0 -12
- package/dist/kernel/device-layer.js +0 -271
- package/dist/kernel/dns-cache.d.ts +0 -29
- package/dist/kernel/dns-cache.js +0 -52
- package/dist/kernel/fd-table.d.ts +0 -84
- package/dist/kernel/fd-table.js +0 -278
- package/dist/kernel/file-lock.d.ts +0 -34
- package/dist/kernel/file-lock.js +0 -122
- package/dist/kernel/host-adapter.d.ts +0 -50
- package/dist/kernel/host-adapter.js +0 -8
- package/dist/kernel/index.d.ts +0 -36
- package/dist/kernel/index.js +0 -34
- package/dist/kernel/kernel.d.ts +0 -9
- package/dist/kernel/kernel.js +0 -1415
- package/dist/kernel/mount-table.d.ts +0 -75
- package/dist/kernel/mount-table.js +0 -353
- package/dist/kernel/permissions.d.ts +0 -36
- package/dist/kernel/permissions.js +0 -150
- package/dist/kernel/pipe-manager.d.ts +0 -64
- package/dist/kernel/pipe-manager.js +0 -267
- package/dist/kernel/proc-backend.d.ts +0 -30
- package/dist/kernel/proc-backend.js +0 -428
- package/dist/kernel/proc-layer.d.ts +0 -11
- package/dist/kernel/proc-layer.js +0 -507
- package/dist/kernel/process-table.d.ts +0 -126
- package/dist/kernel/process-table.js +0 -651
- package/dist/kernel/pty.d.ts +0 -109
- package/dist/kernel/pty.js +0 -552
- package/dist/kernel/socket-table.d.ts +0 -312
- package/dist/kernel/socket-table.js +0 -1188
- package/dist/kernel/timer-table.d.ts +0 -54
- package/dist/kernel/timer-table.js +0 -108
- package/dist/kernel/types.d.ts +0 -541
- package/dist/kernel/types.js +0 -98
- package/dist/kernel/user.d.ts +0 -29
- package/dist/kernel/user.js +0 -35
- package/dist/kernel/vfs.d.ts +0 -82
- package/dist/kernel/vfs.js +0 -25
- package/dist/kernel/wait.d.ts +0 -45
- package/dist/kernel/wait.js +0 -112
- package/dist/kernel/wstatus.d.ts +0 -21
- package/dist/kernel/wstatus.js +0 -33
- package/dist/module-resolver.d.ts +0 -29
- package/dist/module-resolver.js +0 -314
- package/dist/package-bundler.d.ts +0 -41
- package/dist/package-bundler.js +0 -497
- package/dist/runtime-driver.d.ts +0 -66
- package/dist/shared/api-types.d.ts +0 -83
- package/dist/shared/bridge-contract.d.ts +0 -772
- package/dist/shared/bridge-contract.js +0 -169
- package/dist/shared/console-formatter.d.ts +0 -22
- package/dist/shared/console-formatter.js +0 -161
- package/dist/shared/constants.d.ts +0 -3
- package/dist/shared/constants.js +0 -3
- package/dist/shared/errors.d.ts +0 -16
- package/dist/shared/errors.js +0 -21
- package/dist/shared/esm-utils.d.ts +0 -28
- package/dist/shared/esm-utils.js +0 -97
- package/dist/shared/global-exposure.d.ts +0 -38
- package/dist/shared/global-exposure.js +0 -876
- package/dist/shared/in-memory-fs.d.ts +0 -16
- package/dist/shared/in-memory-fs.js +0 -115
- package/dist/shared/permissions.d.ts +0 -36
- package/dist/shared/permissions.js +0 -314
- package/dist/shared/require-setup.d.ts +0 -6
- package/dist/shared/require-setup.js +0 -9
- package/dist/test/block-store-conformance.d.ts +0 -34
- package/dist/test/block-store-conformance.js +0 -251
- package/dist/test/metadata-store-conformance.d.ts +0 -37
- package/dist/test/metadata-store-conformance.js +0 -646
- package/dist/test/vfs-conformance.d.ts +0 -65
- package/dist/test/vfs-conformance.js +0 -842
- package/dist/types.d.ts +0 -98
- package/dist/types.js +0 -6
- package/dist/vfs/chunked-vfs.d.ts +0 -66
- package/dist/vfs/chunked-vfs.js +0 -1290
- package/dist/vfs/host-block-store.d.ts +0 -19
- package/dist/vfs/host-block-store.js +0 -97
- package/dist/vfs/memory-block-store.d.ts +0 -16
- package/dist/vfs/memory-block-store.js +0 -45
- package/dist/vfs/memory-metadata.d.ts +0 -75
- package/dist/vfs/memory-metadata.js +0 -528
- package/dist/vfs/sqlite-metadata.d.ts +0 -91
- package/dist/vfs/sqlite-metadata.js +0 -582
- package/dist/vfs/types.d.ts +0 -210
- package/dist/vfs/types.js +0 -8
- /package/dist/{runtime-driver.js → generated/CreateVmConfig.js} +0 -0
- /package/dist/{shared/api-types.js → generated/FsPermissionRule.js} +0 -0
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
(() => {
|
|
3
|
-
// ../core/isolate-runtime/src/common/global-access.ts
|
|
4
|
-
function hasOwnGlobal(name) {
|
|
5
|
-
return Object.prototype.hasOwnProperty.call(globalThis, name);
|
|
6
|
-
}
|
|
7
|
-
function getGlobalValue(name) {
|
|
8
|
-
return Reflect.get(globalThis, name);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// ../core/isolate-runtime/src/common/global-exposure.ts
|
|
12
|
-
function defineRuntimeGlobalBinding(name, value, mutable) {
|
|
13
|
-
Object.defineProperty(globalThis, name, {
|
|
14
|
-
value,
|
|
15
|
-
writable: mutable,
|
|
16
|
-
configurable: mutable,
|
|
17
|
-
enumerable: true
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
function createRuntimeGlobalExposer(mutable) {
|
|
21
|
-
return (name, value) => {
|
|
22
|
-
defineRuntimeGlobalBinding(name, value, mutable);
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
function getRuntimeExposeCustomGlobal() {
|
|
26
|
-
if (typeof globalThis.__runtimeExposeCustomGlobal === "function") {
|
|
27
|
-
return globalThis.__runtimeExposeCustomGlobal;
|
|
28
|
-
}
|
|
29
|
-
return createRuntimeGlobalExposer(false);
|
|
30
|
-
}
|
|
31
|
-
function getRuntimeExposeMutableGlobal() {
|
|
32
|
-
if (typeof globalThis.__runtimeExposeMutableGlobal === "function") {
|
|
33
|
-
return globalThis.__runtimeExposeMutableGlobal;
|
|
34
|
-
}
|
|
35
|
-
return createRuntimeGlobalExposer(true);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// ../core/isolate-runtime/src/inject/apply-custom-global-policy.ts
|
|
39
|
-
var __runtimeExposeCustomGlobal = getRuntimeExposeCustomGlobal();
|
|
40
|
-
var __runtimeExposeMutableGlobal = getRuntimeExposeMutableGlobal();
|
|
41
|
-
var __globalPolicy = globalThis.__runtimeCustomGlobalPolicy ?? {};
|
|
42
|
-
var __hardenedGlobals = Array.isArray(__globalPolicy.hardenedGlobals) ? __globalPolicy.hardenedGlobals : [];
|
|
43
|
-
var __mutableGlobals = Array.isArray(__globalPolicy.mutableGlobals) ? __globalPolicy.mutableGlobals : [];
|
|
44
|
-
for (const globalName of __hardenedGlobals) {
|
|
45
|
-
const value = hasOwnGlobal(globalName) ? getGlobalValue(globalName) : void 0;
|
|
46
|
-
__runtimeExposeCustomGlobal(globalName, value);
|
|
47
|
-
}
|
|
48
|
-
for (const globalName of __mutableGlobals) {
|
|
49
|
-
if (hasOwnGlobal(globalName)) {
|
|
50
|
-
__runtimeExposeMutableGlobal(globalName, getGlobalValue(globalName));
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
})();
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
(() => {
|
|
3
|
-
// ../core/isolate-runtime/src/common/global-access.ts
|
|
4
|
-
function setGlobalValue(name, value) {
|
|
5
|
-
Reflect.set(globalThis, name, value);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// ../core/isolate-runtime/src/inject/apply-timing-mitigation-freeze.ts
|
|
9
|
-
var __timingConfig = globalThis.__runtimeTimingMitigationConfig ?? {};
|
|
10
|
-
var __frozenTimeMs = typeof __timingConfig.frozenTimeMs === "number" && Number.isFinite(__timingConfig.frozenTimeMs) ? __timingConfig.frozenTimeMs : Date.now();
|
|
11
|
-
var __frozenDateNow = () => __frozenTimeMs;
|
|
12
|
-
try {
|
|
13
|
-
Object.defineProperty(Date, "now", {
|
|
14
|
-
get: () => __frozenDateNow,
|
|
15
|
-
set: () => {
|
|
16
|
-
},
|
|
17
|
-
configurable: false
|
|
18
|
-
});
|
|
19
|
-
} catch {
|
|
20
|
-
Date.now = __frozenDateNow;
|
|
21
|
-
}
|
|
22
|
-
var __OrigDate = Date;
|
|
23
|
-
var __FrozenDate = function Date2(...args) {
|
|
24
|
-
if (new.target) {
|
|
25
|
-
if (args.length === 0) {
|
|
26
|
-
return new __OrigDate(__frozenTimeMs);
|
|
27
|
-
}
|
|
28
|
-
return new __OrigDate(...args);
|
|
29
|
-
}
|
|
30
|
-
return __OrigDate();
|
|
31
|
-
};
|
|
32
|
-
Object.defineProperty(__FrozenDate, "prototype", {
|
|
33
|
-
value: __OrigDate.prototype,
|
|
34
|
-
writable: false,
|
|
35
|
-
configurable: false
|
|
36
|
-
});
|
|
37
|
-
__FrozenDate.now = __frozenDateNow;
|
|
38
|
-
__FrozenDate.parse = __OrigDate.parse;
|
|
39
|
-
__FrozenDate.UTC = __OrigDate.UTC;
|
|
40
|
-
Object.defineProperty(__FrozenDate, "now", {
|
|
41
|
-
get: () => __frozenDateNow,
|
|
42
|
-
set: () => {
|
|
43
|
-
},
|
|
44
|
-
configurable: false
|
|
45
|
-
});
|
|
46
|
-
try {
|
|
47
|
-
Object.defineProperty(globalThis, "Date", {
|
|
48
|
-
value: __FrozenDate,
|
|
49
|
-
configurable: false,
|
|
50
|
-
writable: false
|
|
51
|
-
});
|
|
52
|
-
} catch {
|
|
53
|
-
globalThis.Date = __FrozenDate;
|
|
54
|
-
}
|
|
55
|
-
var __frozenPerformanceNow = () => 0;
|
|
56
|
-
var __origPerf = globalThis.performance;
|
|
57
|
-
var __frozenPerf = /* @__PURE__ */ Object.create(null);
|
|
58
|
-
if (typeof __origPerf !== "undefined" && __origPerf !== null) {
|
|
59
|
-
const src = __origPerf;
|
|
60
|
-
for (const key of Object.getOwnPropertyNames(
|
|
61
|
-
Object.getPrototypeOf(__origPerf) ?? __origPerf
|
|
62
|
-
)) {
|
|
63
|
-
if (key !== "now") {
|
|
64
|
-
try {
|
|
65
|
-
const val = src[key];
|
|
66
|
-
if (typeof val === "function") {
|
|
67
|
-
__frozenPerf[key] = val.bind(__origPerf);
|
|
68
|
-
} else {
|
|
69
|
-
__frozenPerf[key] = val;
|
|
70
|
-
}
|
|
71
|
-
} catch {
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
Object.defineProperty(__frozenPerf, "now", {
|
|
77
|
-
value: __frozenPerformanceNow,
|
|
78
|
-
configurable: false,
|
|
79
|
-
writable: false
|
|
80
|
-
});
|
|
81
|
-
Object.freeze(__frozenPerf);
|
|
82
|
-
try {
|
|
83
|
-
Object.defineProperty(globalThis, "performance", {
|
|
84
|
-
value: __frozenPerf,
|
|
85
|
-
configurable: false,
|
|
86
|
-
writable: false
|
|
87
|
-
});
|
|
88
|
-
} catch {
|
|
89
|
-
globalThis.performance = __frozenPerf;
|
|
90
|
-
}
|
|
91
|
-
var __OrigSAB = globalThis.SharedArrayBuffer;
|
|
92
|
-
if (typeof __OrigSAB === "function") {
|
|
93
|
-
try {
|
|
94
|
-
const proto = __OrigSAB.prototype;
|
|
95
|
-
if (proto) {
|
|
96
|
-
for (const key of [
|
|
97
|
-
"byteLength",
|
|
98
|
-
"slice",
|
|
99
|
-
"grow",
|
|
100
|
-
"maxByteLength",
|
|
101
|
-
"growable"
|
|
102
|
-
]) {
|
|
103
|
-
try {
|
|
104
|
-
Object.defineProperty(proto, key, {
|
|
105
|
-
get() {
|
|
106
|
-
throw new TypeError(
|
|
107
|
-
"SharedArrayBuffer is not available in sandbox"
|
|
108
|
-
);
|
|
109
|
-
},
|
|
110
|
-
configurable: false
|
|
111
|
-
});
|
|
112
|
-
} catch {
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
} catch {
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
try {
|
|
120
|
-
Object.defineProperty(globalThis, "SharedArrayBuffer", {
|
|
121
|
-
value: void 0,
|
|
122
|
-
configurable: false,
|
|
123
|
-
writable: false,
|
|
124
|
-
enumerable: false
|
|
125
|
-
});
|
|
126
|
-
} catch {
|
|
127
|
-
Reflect.deleteProperty(globalThis, "SharedArrayBuffer");
|
|
128
|
-
setGlobalValue("SharedArrayBuffer", void 0);
|
|
129
|
-
}
|
|
130
|
-
})();
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
(() => {
|
|
3
|
-
// ../core/isolate-runtime/src/common/global-access.ts
|
|
4
|
-
function setGlobalValue(name, value) {
|
|
5
|
-
Reflect.set(globalThis, name, value);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// ../core/isolate-runtime/src/inject/apply-timing-mitigation-off.ts
|
|
9
|
-
if (typeof globalThis.performance === "undefined" || globalThis.performance === null) {
|
|
10
|
-
setGlobalValue("performance", {
|
|
11
|
-
now: () => Date.now()
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
})();
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
(() => {
|
|
3
|
-
// ../core/isolate-runtime/src/common/global-exposure.ts
|
|
4
|
-
function defineRuntimeGlobalBinding(name, value, mutable) {
|
|
5
|
-
Object.defineProperty(globalThis, name, {
|
|
6
|
-
value,
|
|
7
|
-
writable: mutable,
|
|
8
|
-
configurable: mutable,
|
|
9
|
-
enumerable: true
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
function createRuntimeGlobalExposer(mutable) {
|
|
13
|
-
return (name, value) => {
|
|
14
|
-
defineRuntimeGlobalBinding(name, value, mutable);
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function getRuntimeExposeCustomGlobal() {
|
|
18
|
-
if (typeof globalThis.__runtimeExposeCustomGlobal === "function") {
|
|
19
|
-
return globalThis.__runtimeExposeCustomGlobal;
|
|
20
|
-
}
|
|
21
|
-
return createRuntimeGlobalExposer(false);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// ../core/isolate-runtime/src/inject/bridge-attach.ts
|
|
25
|
-
var __runtimeExposeCustomGlobal = getRuntimeExposeCustomGlobal();
|
|
26
|
-
if (typeof globalThis.bridge !== "undefined") {
|
|
27
|
-
__runtimeExposeCustomGlobal("bridge", globalThis.bridge);
|
|
28
|
-
}
|
|
29
|
-
})();
|
|
@@ -1,385 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
(() => {
|
|
3
|
-
// ../core/isolate-runtime/src/common/global-exposure.ts
|
|
4
|
-
function defineRuntimeGlobalBinding(name, value, mutable) {
|
|
5
|
-
Object.defineProperty(globalThis, name, {
|
|
6
|
-
value,
|
|
7
|
-
writable: mutable,
|
|
8
|
-
configurable: mutable,
|
|
9
|
-
enumerable: true
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
function createRuntimeGlobalExposer(mutable) {
|
|
13
|
-
return (name, value) => {
|
|
14
|
-
defineRuntimeGlobalBinding(name, value, mutable);
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function getRuntimeExposeMutableGlobal() {
|
|
18
|
-
if (typeof globalThis.__runtimeExposeMutableGlobal === "function") {
|
|
19
|
-
return globalThis.__runtimeExposeMutableGlobal;
|
|
20
|
-
}
|
|
21
|
-
return createRuntimeGlobalExposer(true);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// ../core/isolate-runtime/src/common/global-access.ts
|
|
25
|
-
function setGlobalValue(name, value) {
|
|
26
|
-
Reflect.set(globalThis, name, value);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// ../core/isolate-runtime/src/inject/bridge-initial-globals.ts
|
|
30
|
-
var __runtimeExposeMutableGlobal = getRuntimeExposeMutableGlobal();
|
|
31
|
-
var __bridgeSetupConfig = globalThis.__runtimeBridgeSetupConfig ?? {};
|
|
32
|
-
var __initialCwd = typeof __bridgeSetupConfig.initialCwd === "string" ? __bridgeSetupConfig.initialCwd : "/";
|
|
33
|
-
globalThis.__runtimeJsonPayloadLimitBytes = typeof __bridgeSetupConfig.jsonPayloadLimitBytes === "number" && Number.isFinite(__bridgeSetupConfig.jsonPayloadLimitBytes) ? Math.max(0, Math.floor(__bridgeSetupConfig.jsonPayloadLimitBytes)) : 4 * 1024 * 1024;
|
|
34
|
-
globalThis.__runtimePayloadLimitErrorCode = typeof __bridgeSetupConfig.payloadLimitErrorCode === "string" && __bridgeSetupConfig.payloadLimitErrorCode.length > 0 ? __bridgeSetupConfig.payloadLimitErrorCode : "ERR_SANDBOX_PAYLOAD_TOO_LARGE";
|
|
35
|
-
function __scEncode(value, seen) {
|
|
36
|
-
if (value === null) return null;
|
|
37
|
-
if (value === void 0) return { t: "undef" };
|
|
38
|
-
if (typeof value === "boolean") return value;
|
|
39
|
-
if (typeof value === "string") return value;
|
|
40
|
-
if (typeof value === "bigint") return { t: "bigint", v: String(value) };
|
|
41
|
-
if (typeof value === "number") {
|
|
42
|
-
if (Object.is(value, -0)) return { t: "-0" };
|
|
43
|
-
if (Number.isNaN(value)) return { t: "nan" };
|
|
44
|
-
if (value === Infinity) return { t: "inf" };
|
|
45
|
-
if (value === -Infinity) return { t: "-inf" };
|
|
46
|
-
return value;
|
|
47
|
-
}
|
|
48
|
-
const obj = value;
|
|
49
|
-
if (seen.has(obj)) return { t: "ref", i: seen.get(obj) };
|
|
50
|
-
const idx = seen.size;
|
|
51
|
-
seen.set(obj, idx);
|
|
52
|
-
if (value instanceof Date)
|
|
53
|
-
return { t: "date", v: value.getTime() };
|
|
54
|
-
if (value instanceof RegExp)
|
|
55
|
-
return { t: "regexp", p: value.source, f: value.flags };
|
|
56
|
-
if (value instanceof Map) {
|
|
57
|
-
const entries = [];
|
|
58
|
-
value.forEach((v, k) => {
|
|
59
|
-
entries.push([__scEncode(k, seen), __scEncode(v, seen)]);
|
|
60
|
-
});
|
|
61
|
-
return { t: "map", v: entries };
|
|
62
|
-
}
|
|
63
|
-
if (value instanceof Set) {
|
|
64
|
-
const elems = [];
|
|
65
|
-
value.forEach((v) => {
|
|
66
|
-
elems.push(__scEncode(v, seen));
|
|
67
|
-
});
|
|
68
|
-
return { t: "set", v: elems };
|
|
69
|
-
}
|
|
70
|
-
if (value instanceof ArrayBuffer) {
|
|
71
|
-
return { t: "ab", v: Array.from(new Uint8Array(value)) };
|
|
72
|
-
}
|
|
73
|
-
if (ArrayBuffer.isView(value) && !(value instanceof DataView)) {
|
|
74
|
-
return {
|
|
75
|
-
t: "ta",
|
|
76
|
-
k: value.constructor.name,
|
|
77
|
-
v: Array.from(
|
|
78
|
-
new Uint8Array(value.buffer, value.byteOffset, value.byteLength)
|
|
79
|
-
)
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
if (Array.isArray(value)) {
|
|
83
|
-
return {
|
|
84
|
-
t: "arr",
|
|
85
|
-
v: value.map((v) => __scEncode(v, seen))
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
const result = {};
|
|
89
|
-
for (const key of Object.keys(value)) {
|
|
90
|
-
result[key] = __scEncode(
|
|
91
|
-
value[key],
|
|
92
|
-
seen
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
return { t: "obj", v: result };
|
|
96
|
-
}
|
|
97
|
-
function __scDecode(tagged, refs) {
|
|
98
|
-
if (tagged === null) return null;
|
|
99
|
-
if (typeof tagged === "boolean" || typeof tagged === "string" || typeof tagged === "number")
|
|
100
|
-
return tagged;
|
|
101
|
-
const tag = tagged.t;
|
|
102
|
-
if (tag === void 0) return tagged;
|
|
103
|
-
switch (tag) {
|
|
104
|
-
case "undef":
|
|
105
|
-
return void 0;
|
|
106
|
-
case "nan":
|
|
107
|
-
return NaN;
|
|
108
|
-
case "inf":
|
|
109
|
-
return Infinity;
|
|
110
|
-
case "-inf":
|
|
111
|
-
return -Infinity;
|
|
112
|
-
case "-0":
|
|
113
|
-
return -0;
|
|
114
|
-
case "bigint":
|
|
115
|
-
return BigInt(tagged.v);
|
|
116
|
-
case "ref":
|
|
117
|
-
return refs[tagged.i];
|
|
118
|
-
case "date": {
|
|
119
|
-
const d = new Date(tagged.v);
|
|
120
|
-
refs.push(d);
|
|
121
|
-
return d;
|
|
122
|
-
}
|
|
123
|
-
case "regexp": {
|
|
124
|
-
const r = new RegExp(
|
|
125
|
-
tagged.p,
|
|
126
|
-
tagged.f
|
|
127
|
-
);
|
|
128
|
-
refs.push(r);
|
|
129
|
-
return r;
|
|
130
|
-
}
|
|
131
|
-
case "map": {
|
|
132
|
-
const m = /* @__PURE__ */ new Map();
|
|
133
|
-
refs.push(m);
|
|
134
|
-
for (const [k, v] of tagged.v) {
|
|
135
|
-
m.set(__scDecode(k, refs), __scDecode(v, refs));
|
|
136
|
-
}
|
|
137
|
-
return m;
|
|
138
|
-
}
|
|
139
|
-
case "set": {
|
|
140
|
-
const s = /* @__PURE__ */ new Set();
|
|
141
|
-
refs.push(s);
|
|
142
|
-
for (const v of tagged.v) {
|
|
143
|
-
s.add(__scDecode(v, refs));
|
|
144
|
-
}
|
|
145
|
-
return s;
|
|
146
|
-
}
|
|
147
|
-
case "ab": {
|
|
148
|
-
const bytes = tagged.v;
|
|
149
|
-
const ab = new ArrayBuffer(bytes.length);
|
|
150
|
-
const u8 = new Uint8Array(ab);
|
|
151
|
-
for (let i = 0; i < bytes.length; i++) u8[i] = bytes[i];
|
|
152
|
-
refs.push(ab);
|
|
153
|
-
return ab;
|
|
154
|
-
}
|
|
155
|
-
case "ta": {
|
|
156
|
-
const { k, v: bytes } = tagged;
|
|
157
|
-
const ctors = {
|
|
158
|
-
Int8Array,
|
|
159
|
-
Uint8Array,
|
|
160
|
-
Uint8ClampedArray,
|
|
161
|
-
Int16Array,
|
|
162
|
-
Uint16Array,
|
|
163
|
-
Int32Array,
|
|
164
|
-
Uint32Array,
|
|
165
|
-
Float32Array,
|
|
166
|
-
Float64Array
|
|
167
|
-
};
|
|
168
|
-
const Ctor = ctors[k] ?? Uint8Array;
|
|
169
|
-
const ab = new ArrayBuffer(bytes.length);
|
|
170
|
-
const u8 = new Uint8Array(ab);
|
|
171
|
-
for (let i = 0; i < bytes.length; i++) u8[i] = bytes[i];
|
|
172
|
-
const ta = new Ctor(ab);
|
|
173
|
-
refs.push(ta);
|
|
174
|
-
return ta;
|
|
175
|
-
}
|
|
176
|
-
case "arr": {
|
|
177
|
-
const arr = [];
|
|
178
|
-
refs.push(arr);
|
|
179
|
-
for (const v of tagged.v) {
|
|
180
|
-
arr.push(__scDecode(v, refs));
|
|
181
|
-
}
|
|
182
|
-
return arr;
|
|
183
|
-
}
|
|
184
|
-
case "obj": {
|
|
185
|
-
const obj = {};
|
|
186
|
-
refs.push(obj);
|
|
187
|
-
const entries = tagged.v;
|
|
188
|
-
for (const key of Object.keys(entries)) {
|
|
189
|
-
obj[key] = __scDecode(entries[key], refs);
|
|
190
|
-
}
|
|
191
|
-
return obj;
|
|
192
|
-
}
|
|
193
|
-
default:
|
|
194
|
-
return tagged;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
__runtimeExposeMutableGlobal("_moduleCache", {});
|
|
198
|
-
globalThis._moduleCache = globalThis._moduleCache ?? {};
|
|
199
|
-
var __moduleCache = globalThis._moduleCache;
|
|
200
|
-
if (__moduleCache) {
|
|
201
|
-
__moduleCache["v8"] = {
|
|
202
|
-
getHeapStatistics: function() {
|
|
203
|
-
return {
|
|
204
|
-
total_heap_size: 67108864,
|
|
205
|
-
total_heap_size_executable: 1048576,
|
|
206
|
-
total_physical_size: 67108864,
|
|
207
|
-
total_available_size: 67108864,
|
|
208
|
-
used_heap_size: 52428800,
|
|
209
|
-
heap_size_limit: 134217728,
|
|
210
|
-
malloced_memory: 8192,
|
|
211
|
-
peak_malloced_memory: 16384,
|
|
212
|
-
does_zap_garbage: 0,
|
|
213
|
-
number_of_native_contexts: 1,
|
|
214
|
-
number_of_detached_contexts: 0,
|
|
215
|
-
external_memory: 0
|
|
216
|
-
};
|
|
217
|
-
},
|
|
218
|
-
getHeapSpaceStatistics: function() {
|
|
219
|
-
return [];
|
|
220
|
-
},
|
|
221
|
-
getHeapCodeStatistics: function() {
|
|
222
|
-
return {};
|
|
223
|
-
},
|
|
224
|
-
setFlagsFromString: function() {
|
|
225
|
-
},
|
|
226
|
-
serialize: function(value) {
|
|
227
|
-
return Buffer.from(
|
|
228
|
-
JSON.stringify({ $v8sc: 1, d: __scEncode(value, /* @__PURE__ */ new Map()) })
|
|
229
|
-
);
|
|
230
|
-
},
|
|
231
|
-
deserialize: function(buffer) {
|
|
232
|
-
const limit = globalThis.__runtimeJsonPayloadLimitBytes ?? 4 * 1024 * 1024;
|
|
233
|
-
const errorCode = globalThis.__runtimePayloadLimitErrorCode ?? "ERR_SANDBOX_PAYLOAD_TOO_LARGE";
|
|
234
|
-
if (buffer.length > limit) {
|
|
235
|
-
throw new Error(
|
|
236
|
-
errorCode + ": v8.deserialize exceeds " + String(limit) + " bytes"
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
const text = buffer.toString();
|
|
240
|
-
const envelope = JSON.parse(text);
|
|
241
|
-
if (envelope !== null && typeof envelope === "object" && envelope.$v8sc === 1) {
|
|
242
|
-
return __scDecode(envelope.d, []);
|
|
243
|
-
}
|
|
244
|
-
return envelope;
|
|
245
|
-
},
|
|
246
|
-
cachedDataVersionTag: function() {
|
|
247
|
-
return 0;
|
|
248
|
-
}
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
__runtimeExposeMutableGlobal("_pendingModules", {});
|
|
252
|
-
__runtimeExposeMutableGlobal("_currentModule", { dirname: __initialCwd });
|
|
253
|
-
globalThis.__runtimeApplyConfig = function(config) {
|
|
254
|
-
if (typeof config.payloadLimitBytes === "number" && Number.isFinite(config.payloadLimitBytes)) {
|
|
255
|
-
globalThis.__runtimeJsonPayloadLimitBytes = Math.max(
|
|
256
|
-
0,
|
|
257
|
-
Math.floor(config.payloadLimitBytes)
|
|
258
|
-
);
|
|
259
|
-
}
|
|
260
|
-
if (typeof config.payloadLimitErrorCode === "string" && config.payloadLimitErrorCode.length > 0) {
|
|
261
|
-
globalThis.__runtimePayloadLimitErrorCode = config.payloadLimitErrorCode;
|
|
262
|
-
}
|
|
263
|
-
if (config.timingMitigation === "freeze") {
|
|
264
|
-
const frozenTimeMs = typeof config.frozenTimeMs === "number" && Number.isFinite(config.frozenTimeMs) ? config.frozenTimeMs : Date.now();
|
|
265
|
-
const frozenDateNow = () => frozenTimeMs;
|
|
266
|
-
try {
|
|
267
|
-
Object.defineProperty(Date, "now", {
|
|
268
|
-
value: frozenDateNow,
|
|
269
|
-
configurable: false,
|
|
270
|
-
writable: false
|
|
271
|
-
});
|
|
272
|
-
} catch {
|
|
273
|
-
Date.now = frozenDateNow;
|
|
274
|
-
}
|
|
275
|
-
const OrigDate = Date;
|
|
276
|
-
const FrozenDate = function Date2(...args) {
|
|
277
|
-
if (new.target) {
|
|
278
|
-
if (args.length === 0) {
|
|
279
|
-
return new OrigDate(frozenTimeMs);
|
|
280
|
-
}
|
|
281
|
-
return new OrigDate(...args);
|
|
282
|
-
}
|
|
283
|
-
return OrigDate();
|
|
284
|
-
};
|
|
285
|
-
Object.defineProperty(FrozenDate, "prototype", {
|
|
286
|
-
value: OrigDate.prototype,
|
|
287
|
-
writable: false,
|
|
288
|
-
configurable: false
|
|
289
|
-
});
|
|
290
|
-
FrozenDate.now = frozenDateNow;
|
|
291
|
-
FrozenDate.parse = OrigDate.parse;
|
|
292
|
-
FrozenDate.UTC = OrigDate.UTC;
|
|
293
|
-
Object.defineProperty(FrozenDate, "now", {
|
|
294
|
-
value: frozenDateNow,
|
|
295
|
-
configurable: false,
|
|
296
|
-
writable: false
|
|
297
|
-
});
|
|
298
|
-
try {
|
|
299
|
-
Object.defineProperty(globalThis, "Date", {
|
|
300
|
-
value: FrozenDate,
|
|
301
|
-
configurable: false,
|
|
302
|
-
writable: false
|
|
303
|
-
});
|
|
304
|
-
} catch {
|
|
305
|
-
globalThis.Date = FrozenDate;
|
|
306
|
-
}
|
|
307
|
-
const frozenPerformanceNow = () => 0;
|
|
308
|
-
const origPerf = globalThis.performance;
|
|
309
|
-
const frozenPerf = /* @__PURE__ */ Object.create(null);
|
|
310
|
-
if (typeof origPerf !== "undefined" && origPerf !== null) {
|
|
311
|
-
const src = origPerf;
|
|
312
|
-
for (const key of Object.getOwnPropertyNames(
|
|
313
|
-
Object.getPrototypeOf(origPerf) ?? origPerf
|
|
314
|
-
)) {
|
|
315
|
-
if (key !== "now") {
|
|
316
|
-
try {
|
|
317
|
-
const val = src[key];
|
|
318
|
-
if (typeof val === "function") {
|
|
319
|
-
frozenPerf[key] = val.bind(origPerf);
|
|
320
|
-
} else {
|
|
321
|
-
frozenPerf[key] = val;
|
|
322
|
-
}
|
|
323
|
-
} catch {
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
Object.defineProperty(frozenPerf, "now", {
|
|
329
|
-
value: frozenPerformanceNow,
|
|
330
|
-
configurable: false,
|
|
331
|
-
writable: false
|
|
332
|
-
});
|
|
333
|
-
Object.freeze(frozenPerf);
|
|
334
|
-
try {
|
|
335
|
-
Object.defineProperty(globalThis, "performance", {
|
|
336
|
-
value: frozenPerf,
|
|
337
|
-
configurable: false,
|
|
338
|
-
writable: false
|
|
339
|
-
});
|
|
340
|
-
} catch {
|
|
341
|
-
globalThis.performance = frozenPerf;
|
|
342
|
-
}
|
|
343
|
-
const OrigSAB = globalThis.SharedArrayBuffer;
|
|
344
|
-
if (typeof OrigSAB === "function") {
|
|
345
|
-
try {
|
|
346
|
-
const proto = OrigSAB.prototype;
|
|
347
|
-
if (proto) {
|
|
348
|
-
for (const key of [
|
|
349
|
-
"byteLength",
|
|
350
|
-
"slice",
|
|
351
|
-
"grow",
|
|
352
|
-
"maxByteLength",
|
|
353
|
-
"growable"
|
|
354
|
-
]) {
|
|
355
|
-
try {
|
|
356
|
-
Object.defineProperty(proto, key, {
|
|
357
|
-
get() {
|
|
358
|
-
throw new TypeError(
|
|
359
|
-
"SharedArrayBuffer is not available in sandbox"
|
|
360
|
-
);
|
|
361
|
-
},
|
|
362
|
-
configurable: false
|
|
363
|
-
});
|
|
364
|
-
} catch {
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
} catch {
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
try {
|
|
372
|
-
Object.defineProperty(globalThis, "SharedArrayBuffer", {
|
|
373
|
-
value: void 0,
|
|
374
|
-
configurable: false,
|
|
375
|
-
writable: false,
|
|
376
|
-
enumerable: false
|
|
377
|
-
});
|
|
378
|
-
} catch {
|
|
379
|
-
Reflect.deleteProperty(globalThis, "SharedArrayBuffer");
|
|
380
|
-
setGlobalValue("SharedArrayBuffer", void 0);
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
delete globalThis.__runtimeApplyConfig;
|
|
384
|
-
};
|
|
385
|
-
})();
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
(() => {
|
|
3
|
-
// ../core/isolate-runtime/src/common/global-exposure.ts
|
|
4
|
-
function defineRuntimeGlobalBinding(name, value, mutable) {
|
|
5
|
-
Object.defineProperty(globalThis, name, {
|
|
6
|
-
value,
|
|
7
|
-
writable: mutable,
|
|
8
|
-
configurable: mutable,
|
|
9
|
-
enumerable: true
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
function createRuntimeGlobalExposer(mutable) {
|
|
13
|
-
return (name, value) => {
|
|
14
|
-
defineRuntimeGlobalBinding(name, value, mutable);
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function ensureRuntimeExposureHelpers() {
|
|
18
|
-
if (typeof globalThis.__runtimeExposeCustomGlobal !== "function") {
|
|
19
|
-
defineRuntimeGlobalBinding(
|
|
20
|
-
"__runtimeExposeCustomGlobal",
|
|
21
|
-
createRuntimeGlobalExposer(false),
|
|
22
|
-
false
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
if (typeof globalThis.__runtimeExposeMutableGlobal !== "function") {
|
|
26
|
-
defineRuntimeGlobalBinding(
|
|
27
|
-
"__runtimeExposeMutableGlobal",
|
|
28
|
-
createRuntimeGlobalExposer(true),
|
|
29
|
-
false
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// ../core/isolate-runtime/src/inject/global-exposure-helpers.ts
|
|
35
|
-
ensureRuntimeExposureHelpers();
|
|
36
|
-
})();
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
(() => {
|
|
3
|
-
// ../core/isolate-runtime/src/common/global-exposure.ts
|
|
4
|
-
function defineRuntimeGlobalBinding(name, value, mutable) {
|
|
5
|
-
Object.defineProperty(globalThis, name, {
|
|
6
|
-
value,
|
|
7
|
-
writable: mutable,
|
|
8
|
-
configurable: mutable,
|
|
9
|
-
enumerable: true
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
function createRuntimeGlobalExposer(mutable) {
|
|
13
|
-
return (name, value) => {
|
|
14
|
-
defineRuntimeGlobalBinding(name, value, mutable);
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function getRuntimeExposeMutableGlobal() {
|
|
18
|
-
if (typeof globalThis.__runtimeExposeMutableGlobal === "function") {
|
|
19
|
-
return globalThis.__runtimeExposeMutableGlobal;
|
|
20
|
-
}
|
|
21
|
-
return createRuntimeGlobalExposer(true);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// ../core/isolate-runtime/src/inject/init-commonjs-module-globals.ts
|
|
25
|
-
var __runtimeExposeMutableGlobal = getRuntimeExposeMutableGlobal();
|
|
26
|
-
__runtimeExposeMutableGlobal("module", { exports: {} });
|
|
27
|
-
__runtimeExposeMutableGlobal("exports", globalThis.module.exports);
|
|
28
|
-
})();
|