Skip to content

Commit 32e85f2

Browse files
committed
fix: comment out browser/python re-exports from umbrella entry to fix Node.js import crash
node-stdlib-browser@1.3.1 ESM entry references mock/empty.js which is missing from the published package. Eagerly importing @secure-exec/browser or @secure-exec/python from the main entry pulls in node-stdlib-browser and crashes. Browser/python exports are commented out with TODOs and remain available via "secure-exec/browser" and "secure-exec/python" subpath imports.
1 parent 42c853b commit 32e85f2

4 files changed

Lines changed: 78 additions & 30 deletions

File tree

packages/secure-exec/package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
"./browser": {
2323
"import": "./dist/browser-runtime.js",
2424
"types": "./dist/browser-runtime.d.ts"
25+
},
26+
"./python": {
27+
"import": "./dist/python-runtime.js",
28+
"types": "./dist/python-runtime.d.ts"
2529
}
2630
},
2731
"scripts": {
@@ -37,9 +41,11 @@
3741
"test:watch": "vitest"
3842
},
3943
"dependencies": {
40-
"@secure-exec/browser": "workspace:*",
4144
"@secure-exec/core": "workspace:*",
42-
"@secure-exec/node": "workspace:*",
45+
"@secure-exec/node": "workspace:*"
46+
},
47+
"optionalDependencies": {
48+
"@secure-exec/browser": "workspace:*",
4349
"@secure-exec/python": "workspace:*"
4450
},
4551
"devDependencies": {

packages/secure-exec/src/index.ts

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
export { NodeRuntime } from "./runtime.js";
33
export type { NodeRuntimeOptions } from "./runtime.js";
44
export type { ResourceBudgets } from "./runtime-driver.js";
5-
export { PythonRuntime } from "./python-runtime.js";
6-
export type { PythonRuntimeOptions } from "./python-runtime.js";
5+
// TODO: Re-enable once node-stdlib-browser ESM entry is fixed (mock/empty.js missing from published package).
6+
// export { PythonRuntime } from "./python-runtime.js";
7+
// export type { PythonRuntimeOptions } from "./python-runtime.js";
78

89
// Re-export public types.
910
export type {
@@ -12,8 +13,9 @@ export type {
1213
NodeRuntimeDriverFactory,
1314
NetworkAdapter,
1415
Permissions,
15-
PythonRuntimeDriver,
16-
PythonRuntimeDriverFactory,
16+
// TODO: Re-enable once node-stdlib-browser ESM entry is fixed.
17+
// PythonRuntimeDriver,
18+
// PythonRuntimeDriverFactory,
1719
RuntimeDriver,
1820
RuntimeDriverFactory,
1921
SharedRuntimeDriver,
@@ -28,8 +30,9 @@ export type {
2830
ExecOptions,
2931
ExecResult,
3032
OSConfig,
31-
PythonRunOptions,
32-
PythonRunResult,
33+
// TODO: Re-enable once node-stdlib-browser ESM entry is fixed.
34+
// PythonRunOptions,
35+
// PythonRunResult,
3336
ProcessConfig,
3437
RunResult,
3538
TimingMitigation,
@@ -48,24 +51,25 @@ export type {
4851
NodeRuntimeDriverFactoryOptions,
4952
} from "@secure-exec/node";
5053

51-
// Re-export Python runtime-driver factories.
52-
export {
53-
createPyodideRuntimeDriverFactory,
54-
PyodideRuntimeDriver,
55-
} from "@secure-exec/python";
56-
57-
// Re-export browser driver factories.
58-
export {
59-
createBrowserDriver,
60-
createBrowserNetworkAdapter,
61-
createBrowserRuntimeDriverFactory,
62-
createOpfsFileSystem,
63-
} from "@secure-exec/browser";
64-
export type {
65-
BrowserDriverOptions,
66-
BrowserRuntimeDriverFactoryOptions,
67-
BrowserRuntimeSystemOptions,
68-
} from "@secure-exec/browser";
54+
// TODO: Re-enable once node-stdlib-browser ESM entry is fixed (mock/empty.js missing from published package).
55+
// Eagerly importing @secure-exec/python and @secure-exec/browser pulls in node-stdlib-browser,
56+
// which crashes on Node.js. Use "secure-exec/python" or "secure-exec/browser" subpath imports instead.
57+
// export {
58+
// createPyodideRuntimeDriverFactory,
59+
// PyodideRuntimeDriver,
60+
// } from "@secure-exec/python";
61+
//
62+
// export {
63+
// createBrowserDriver,
64+
// createBrowserNetworkAdapter,
65+
// createBrowserRuntimeDriverFactory,
66+
// createOpfsFileSystem,
67+
// } from "@secure-exec/browser";
68+
// export type {
69+
// BrowserDriverOptions,
70+
// BrowserRuntimeDriverFactoryOptions,
71+
// BrowserRuntimeSystemOptions,
72+
// } from "@secure-exec/browser";
6973

7074
export { createInMemoryFileSystem } from "./shared/in-memory-fs.js";
7175
export {
Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1-
// Re-exported from @secure-exec/core — canonical source is packages/secure-exec-core/src/python-runtime.ts
1+
// Python-only entrypoint: import from "secure-exec/python".
22
export { PythonRuntime } from "@secure-exec/core";
33
export type { PythonRuntimeOptions } from "@secure-exec/core";
4+
5+
export {
6+
createPyodideRuntimeDriverFactory,
7+
PyodideRuntimeDriver,
8+
} from "@secure-exec/python";
9+
10+
export type {
11+
StdioChannel,
12+
StdioEvent,
13+
StdioHook,
14+
ExecOptions,
15+
ExecResult,
16+
OSConfig,
17+
PythonRunOptions,
18+
PythonRunResult,
19+
ProcessConfig,
20+
RunResult,
21+
TimingMitigation,
22+
} from "@secure-exec/core";
23+
24+
export {
25+
allowAll,
26+
allowAllChildProcess,
27+
allowAllEnv,
28+
allowAllFs,
29+
allowAllNetwork,
30+
} from "@secure-exec/core";

pnpm-lock.yaml

Lines changed: 14 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)