secure-exec 0.0.1 → 0.1.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/LICENSE +191 -0
- package/README.md +7 -0
- package/dist/bridge/active-handles.d.ts +21 -0
- package/dist/bridge/active-handles.js +60 -0
- package/dist/bridge/child-process.d.ts +87 -0
- package/dist/bridge/child-process.js +523 -0
- package/dist/bridge/fs.d.ts +227 -0
- package/dist/bridge/fs.js +1572 -0
- package/dist/bridge/index.d.ts +10 -0
- package/dist/bridge/index.js +41 -0
- package/dist/bridge/module.d.ts +73 -0
- package/dist/bridge/module.js +329 -0
- package/dist/bridge/network.d.ts +208 -0
- package/dist/bridge/network.js +1117 -0
- package/dist/bridge/os.d.ts +13 -0
- package/dist/bridge/os.js +257 -0
- package/dist/bridge/polyfills.d.ts +2 -0
- package/dist/bridge/polyfills.js +12 -0
- package/dist/bridge/process.d.ts +64 -0
- package/dist/bridge/process.js +916 -0
- package/dist/bridge-loader.d.ts +1 -0
- package/dist/bridge-loader.js +2 -0
- package/dist/bridge-setup.d.ts +1 -0
- package/dist/bridge-setup.js +2 -0
- package/dist/bridge.js +10586 -0
- package/dist/browser/driver.d.ts +42 -0
- package/dist/browser/driver.js +263 -0
- package/dist/browser/index.d.ts +5 -0
- package/dist/browser/index.js +4 -0
- package/dist/browser/worker.d.ts +1 -0
- package/dist/browser/worker.js +3 -0
- package/dist/browser-runtime.d.ts +6 -0
- package/dist/browser-runtime.js +4 -0
- package/dist/esm-compiler.d.ts +1 -0
- package/dist/esm-compiler.js +2 -0
- package/dist/execution.d.ts +1 -0
- package/dist/execution.js +2 -0
- package/dist/fs-helpers.d.ts +2 -0
- package/dist/fs-helpers.js +1 -0
- package/dist/generated/isolate-runtime.d.ts +19 -0
- package/dist/generated/isolate-runtime.js +21 -0
- package/dist/generated/polyfills.d.ts +82 -0
- package/dist/generated/polyfills.js +82 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +11 -0
- package/dist/isolate-runtime/apply-custom-global-policy.js +54 -0
- package/dist/isolate-runtime/apply-timing-mitigation-freeze.js +44 -0
- package/dist/isolate-runtime/apply-timing-mitigation-off.js +14 -0
- package/dist/isolate-runtime/bridge-attach.js +29 -0
- package/dist/isolate-runtime/bridge-initial-globals.js +78 -0
- package/dist/isolate-runtime/eval-script-result.js +8 -0
- package/dist/isolate-runtime/global-exposure-helpers.js +36 -0
- package/dist/isolate-runtime/init-commonjs-module-globals.js +28 -0
- package/dist/isolate-runtime/override-process-cwd.js +8 -0
- package/dist/isolate-runtime/override-process-env.js +8 -0
- package/dist/isolate-runtime/require-setup.js +606 -0
- package/dist/isolate-runtime/set-commonjs-file-globals.js +36 -0
- package/dist/isolate-runtime/set-stdin-data.js +10 -0
- package/dist/isolate-runtime/setup-dynamic-import.js +64 -0
- package/dist/isolate-runtime/setup-fs-facade.js +40 -0
- package/dist/isolate.d.ts +1 -0
- package/dist/isolate.js +2 -0
- package/dist/module-resolver.d.ts +1 -0
- package/dist/module-resolver.js +2 -0
- package/dist/node/bridge-setup.d.ts +1 -0
- package/dist/node/bridge-setup.js +2 -0
- package/dist/node/driver.d.ts +2 -0
- package/dist/node/driver.js +2 -0
- package/dist/node/esm-compiler.d.ts +1 -0
- package/dist/node/esm-compiler.js +2 -0
- package/dist/node/execution-driver.d.ts +2 -0
- package/dist/node/execution-driver.js +2 -0
- package/dist/node/execution-lifecycle.d.ts +1 -0
- package/dist/node/execution-lifecycle.js +2 -0
- package/dist/node/isolate-bootstrap.d.ts +2 -0
- package/dist/node/isolate-bootstrap.js +1 -0
- package/dist/node/module-access.d.ts +2 -0
- package/dist/node/module-access.js +2 -0
- package/dist/node/module-resolver.d.ts +1 -0
- package/dist/node/module-resolver.js +2 -0
- package/dist/package-bundler.d.ts +2 -0
- package/dist/package-bundler.js +1 -0
- package/dist/polyfills.d.ts +1 -0
- package/dist/polyfills.js +2 -0
- package/dist/python-runtime.d.ts +2 -0
- package/dist/python-runtime.js +2 -0
- package/dist/runtime-driver.d.ts +1 -0
- package/dist/runtime-driver.js +1 -0
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.js +2 -0
- package/dist/shared/api-types.d.ts +1 -0
- package/dist/shared/api-types.js +1 -0
- package/dist/shared/bridge-contract.d.ts +2 -0
- package/dist/shared/bridge-contract.js +1 -0
- package/dist/shared/console-formatter.d.ts +2 -0
- package/dist/shared/console-formatter.js +1 -0
- package/dist/shared/errors.d.ts +2 -0
- package/dist/shared/errors.js +1 -0
- package/dist/shared/esm-utils.d.ts +1 -0
- package/dist/shared/esm-utils.js +2 -0
- package/dist/shared/global-exposure.d.ts +2 -0
- package/dist/shared/global-exposure.js +1 -0
- package/dist/shared/in-memory-fs.d.ts +1 -0
- package/dist/shared/in-memory-fs.js +2 -0
- package/dist/shared/permissions.d.ts +1 -0
- package/dist/shared/permissions.js +2 -0
- package/dist/shared/require-setup.d.ts +1 -0
- package/dist/shared/require-setup.js +2 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.js +1 -0
- package/package.json +51 -4
- package/index.js +0 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { NodeRuntime } from "./runtime.js";
|
|
2
|
+
export type { NodeRuntimeOptions } from "./runtime.js";
|
|
3
|
+
export type { ResourceBudgets } from "./runtime-driver.js";
|
|
4
|
+
export { PythonRuntime } from "./python-runtime.js";
|
|
5
|
+
export type { PythonRuntimeOptions } from "./python-runtime.js";
|
|
6
|
+
export type { CommandExecutor, NodeRuntimeDriver, NodeRuntimeDriverFactory, NetworkAdapter, Permissions, PythonRuntimeDriver, PythonRuntimeDriverFactory, RuntimeDriver, RuntimeDriverFactory, SharedRuntimeDriver, SystemDriver, VirtualFileSystem, } from "./types.js";
|
|
7
|
+
export type { DirEntry, StatInfo } from "./fs-helpers.js";
|
|
8
|
+
export type { StdioChannel, StdioEvent, StdioHook, ExecOptions, ExecResult, OSConfig, PythonRunOptions, PythonRunResult, ProcessConfig, RunResult, TimingMitigation, } from "./shared/api-types.js";
|
|
9
|
+
export { createDefaultNetworkAdapter, createNodeDriver, createNodeRuntimeDriverFactory, NodeExecutionDriver, NodeFileSystem, } from "@secure-exec/node";
|
|
10
|
+
export type { ModuleAccessOptions, NodeRuntimeDriverFactoryOptions, } from "@secure-exec/node";
|
|
11
|
+
export { createPyodideRuntimeDriverFactory, PyodideRuntimeDriver, } from "@secure-exec/python";
|
|
12
|
+
export { createBrowserDriver, createBrowserNetworkAdapter, createBrowserRuntimeDriverFactory, createOpfsFileSystem, } from "@secure-exec/browser";
|
|
13
|
+
export type { BrowserDriverOptions, BrowserRuntimeDriverFactoryOptions, BrowserRuntimeSystemOptions, } from "@secure-exec/browser";
|
|
14
|
+
export { createInMemoryFileSystem } from "./shared/in-memory-fs.js";
|
|
15
|
+
export { allowAll, allowAllChildProcess, allowAllEnv, allowAllFs, allowAllNetwork, } from "./shared/permissions.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Re-export core runtime surface.
|
|
2
|
+
export { NodeRuntime } from "./runtime.js";
|
|
3
|
+
export { PythonRuntime } from "./python-runtime.js";
|
|
4
|
+
// Re-export Node driver factories.
|
|
5
|
+
export { createDefaultNetworkAdapter, createNodeDriver, createNodeRuntimeDriverFactory, NodeExecutionDriver, NodeFileSystem, } from "@secure-exec/node";
|
|
6
|
+
// Re-export Python runtime-driver factories.
|
|
7
|
+
export { createPyodideRuntimeDriverFactory, PyodideRuntimeDriver, } from "@secure-exec/python";
|
|
8
|
+
// Re-export browser driver factories.
|
|
9
|
+
export { createBrowserDriver, createBrowserNetworkAdapter, createBrowserRuntimeDriverFactory, createOpfsFileSystem, } from "@secure-exec/browser";
|
|
10
|
+
export { createInMemoryFileSystem } from "./shared/in-memory-fs.js";
|
|
11
|
+
export { allowAll, allowAllChildProcess, allowAllEnv, allowAllFs, allowAllNetwork, } from "./shared/permissions.js";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(() => {
|
|
3
|
+
// 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
|
+
// 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
|
+
// 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
|
+
if (hasOwnGlobal(globalName)) {
|
|
46
|
+
__runtimeExposeCustomGlobal(globalName, getGlobalValue(globalName));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
for (const globalName of __mutableGlobals) {
|
|
50
|
+
if (hasOwnGlobal(globalName)) {
|
|
51
|
+
__runtimeExposeMutableGlobal(globalName, getGlobalValue(globalName));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
})();
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(() => {
|
|
3
|
+
// isolate-runtime/src/common/global-access.ts
|
|
4
|
+
function setGlobalValue(name, value) {
|
|
5
|
+
Reflect.set(globalThis, name, value);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// 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
|
+
value: __frozenDateNow,
|
|
15
|
+
configurable: true,
|
|
16
|
+
writable: true
|
|
17
|
+
});
|
|
18
|
+
} catch {
|
|
19
|
+
Date.now = __frozenDateNow;
|
|
20
|
+
}
|
|
21
|
+
var __frozenPerformanceNow = () => 0;
|
|
22
|
+
var __performance = globalThis.performance;
|
|
23
|
+
if (typeof __performance !== "undefined" && __performance !== null) {
|
|
24
|
+
try {
|
|
25
|
+
Object.defineProperty(__performance, "now", {
|
|
26
|
+
value: __frozenPerformanceNow,
|
|
27
|
+
configurable: true,
|
|
28
|
+
writable: true
|
|
29
|
+
});
|
|
30
|
+
} catch {
|
|
31
|
+
try {
|
|
32
|
+
Object.assign(__performance, { now: __frozenPerformanceNow });
|
|
33
|
+
} catch {
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
setGlobalValue("performance", {
|
|
38
|
+
now: __frozenPerformanceNow
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
if (!Reflect.deleteProperty(globalThis, "SharedArrayBuffer")) {
|
|
42
|
+
setGlobalValue("SharedArrayBuffer", void 0);
|
|
43
|
+
}
|
|
44
|
+
})();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(() => {
|
|
3
|
+
// isolate-runtime/src/common/global-access.ts
|
|
4
|
+
function setGlobalValue(name, value) {
|
|
5
|
+
Reflect.set(globalThis, name, value);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// 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
|
+
})();
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(() => {
|
|
3
|
+
// 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
|
+
// isolate-runtime/src/inject/bridge-attach.ts
|
|
25
|
+
var __runtimeExposeCustomGlobal = getRuntimeExposeCustomGlobal();
|
|
26
|
+
if (typeof globalThis.bridge !== "undefined") {
|
|
27
|
+
__runtimeExposeCustomGlobal("bridge", globalThis.bridge);
|
|
28
|
+
}
|
|
29
|
+
})();
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(() => {
|
|
3
|
+
// 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
|
+
// isolate-runtime/src/inject/bridge-initial-globals.ts
|
|
25
|
+
var __runtimeExposeMutableGlobal = getRuntimeExposeMutableGlobal();
|
|
26
|
+
var __bridgeSetupConfig = globalThis.__runtimeBridgeSetupConfig ?? {};
|
|
27
|
+
var __initialCwd = typeof __bridgeSetupConfig.initialCwd === "string" ? __bridgeSetupConfig.initialCwd : "/";
|
|
28
|
+
var __jsonPayloadLimitBytes = typeof __bridgeSetupConfig.jsonPayloadLimitBytes === "number" && Number.isFinite(__bridgeSetupConfig.jsonPayloadLimitBytes) ? Math.max(0, Math.floor(__bridgeSetupConfig.jsonPayloadLimitBytes)) : 4 * 1024 * 1024;
|
|
29
|
+
var __payloadLimitErrorCode = typeof __bridgeSetupConfig.payloadLimitErrorCode === "string" && __bridgeSetupConfig.payloadLimitErrorCode.length > 0 ? __bridgeSetupConfig.payloadLimitErrorCode : "ERR_SANDBOX_PAYLOAD_TOO_LARGE";
|
|
30
|
+
__runtimeExposeMutableGlobal("_moduleCache", {});
|
|
31
|
+
globalThis._moduleCache = globalThis._moduleCache ?? {};
|
|
32
|
+
var __moduleCache = globalThis._moduleCache;
|
|
33
|
+
if (__moduleCache) {
|
|
34
|
+
__moduleCache["v8"] = {
|
|
35
|
+
getHeapStatistics: function() {
|
|
36
|
+
return {
|
|
37
|
+
total_heap_size: 67108864,
|
|
38
|
+
total_heap_size_executable: 1048576,
|
|
39
|
+
total_physical_size: 67108864,
|
|
40
|
+
total_available_size: 67108864,
|
|
41
|
+
used_heap_size: 52428800,
|
|
42
|
+
heap_size_limit: 134217728,
|
|
43
|
+
malloced_memory: 8192,
|
|
44
|
+
peak_malloced_memory: 16384,
|
|
45
|
+
does_zap_garbage: 0,
|
|
46
|
+
number_of_native_contexts: 1,
|
|
47
|
+
number_of_detached_contexts: 0,
|
|
48
|
+
external_memory: 0
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
getHeapSpaceStatistics: function() {
|
|
52
|
+
return [];
|
|
53
|
+
},
|
|
54
|
+
getHeapCodeStatistics: function() {
|
|
55
|
+
return {};
|
|
56
|
+
},
|
|
57
|
+
setFlagsFromString: function() {
|
|
58
|
+
},
|
|
59
|
+
serialize: function(value) {
|
|
60
|
+
return Buffer.from(JSON.stringify(value));
|
|
61
|
+
},
|
|
62
|
+
deserialize: function(buffer) {
|
|
63
|
+
const text = buffer.toString();
|
|
64
|
+
if (Buffer.byteLength(text, "utf8") > __jsonPayloadLimitBytes) {
|
|
65
|
+
throw new Error(
|
|
66
|
+
__payloadLimitErrorCode + ": v8.deserialize exceeds " + String(__jsonPayloadLimitBytes) + " bytes"
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
return JSON.parse(text);
|
|
70
|
+
},
|
|
71
|
+
cachedDataVersionTag: function() {
|
|
72
|
+
return 0;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
__runtimeExposeMutableGlobal("_pendingModules", {});
|
|
77
|
+
__runtimeExposeMutableGlobal("_currentModule", { dirname: __initialCwd });
|
|
78
|
+
})();
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(() => {
|
|
3
|
+
// 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
|
+
// isolate-runtime/src/inject/global-exposure-helpers.ts
|
|
35
|
+
ensureRuntimeExposureHelpers();
|
|
36
|
+
})();
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(() => {
|
|
3
|
+
// 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
|
+
// isolate-runtime/src/inject/init-commonjs-module-globals.ts
|
|
25
|
+
var __runtimeExposeMutableGlobal = getRuntimeExposeMutableGlobal();
|
|
26
|
+
__runtimeExposeMutableGlobal("module", { exports: {} });
|
|
27
|
+
__runtimeExposeMutableGlobal("exports", globalThis.module.exports);
|
|
28
|
+
})();
|