@scelar/nodepod 1.0.3 → 1.0.4
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/dist/__sw__.js +642 -642
- package/dist/{child_process-D6oDN2MX.js → child_process-53fMkug_.js} +4 -4
- package/dist/child_process-53fMkug_.js.map +1 -0
- package/dist/{child_process-hmVqFcF7.cjs → child_process-lxSKECHq.cjs} +5 -5
- package/dist/child_process-lxSKECHq.cjs.map +1 -0
- package/dist/{index-Ale2oba_.js → index-B8lyh_ti.js} +1081 -428
- package/dist/index-B8lyh_ti.js.map +1 -0
- package/dist/{index-BO1i013L.cjs → index-C-TQIrdG.cjs} +1195 -430
- package/dist/index-C-TQIrdG.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/memory-volume.d.ts +1 -1
- package/dist/polyfills/wasi.d.ts +45 -4
- package/dist/sdk/nodepod.d.ts +4 -3
- package/dist/sdk/types.d.ts +6 -0
- package/dist/threading/process-manager.d.ts +1 -1
- package/dist/threading/worker-protocol.d.ts +1 -1
- package/package.json +97 -97
- package/src/index.ts +192 -192
- package/src/memory-volume.ts +10 -4
- package/src/packages/version-resolver.ts +12 -2
- package/src/polyfills/child_process.ts +2288 -2288
- package/src/polyfills/fs.ts +2888 -2888
- package/src/polyfills/http.ts +1450 -1449
- package/src/polyfills/process.ts +27 -1
- package/src/polyfills/stream.ts +1620 -1620
- package/src/polyfills/wasi.ts +1284 -22
- package/src/request-proxy.ts +716 -716
- package/src/script-engine.ts +3694 -3396
- package/src/sdk/nodepod.ts +525 -509
- package/src/sdk/types.ts +7 -0
- package/src/syntax-transforms.ts +2 -2
- package/src/threading/offload-worker.ts +383 -383
- package/src/threading/offload.ts +271 -271
- package/src/threading/process-manager.ts +956 -956
- package/src/threading/process-worker-entry.ts +858 -854
- package/src/threading/worker-protocol.ts +1 -1
- package/dist/child_process-D6oDN2MX.js.map +0 -1
- package/dist/child_process-hmVqFcF7.cjs.map +0 -1
- package/dist/index-Ale2oba_.js.map +0 -1
- package/dist/index-BO1i013L.cjs.map +0 -1
package/dist/index.cjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p, I, q, s, t, v, w, P, x, y, z, A, S, C, F, G, H, J, K, O, Q, U, X, Z, _, $, $ as $2, a0, a1, a2, a3, a4, l, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap, aq, ar } from "./index-
|
|
1
|
+
import { p, I, q, s, t, v, w, P, x, y, z, A, S, C, F, G, H, J, K, O, Q, U, X, Z, _, $, $ as $2, a0, a1, a2, a3, a4, l, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap, aq, ar } from "./index-B8lyh_ti.js";
|
|
2
2
|
export {
|
|
3
3
|
p as DependencyInstaller,
|
|
4
4
|
I as IframeSandbox,
|
package/dist/memory-volume.d.ts
CHANGED
|
@@ -72,7 +72,7 @@ export declare class MemoryVolume {
|
|
|
72
72
|
off(event: 'change', handler: FileChangeHandler): this;
|
|
73
73
|
off(event: 'delete', handler: FileDeleteHandler): this;
|
|
74
74
|
private broadcast;
|
|
75
|
-
toSnapshot(): VolumeSnapshot;
|
|
75
|
+
toSnapshot(excludePrefixes?: string[]): VolumeSnapshot;
|
|
76
76
|
private collectEntries;
|
|
77
77
|
static fromBinarySnapshot(snapshot: {
|
|
78
78
|
manifest: Array<{
|
package/dist/polyfills/wasi.d.ts
CHANGED
|
@@ -1,12 +1,53 @@
|
|
|
1
|
+
interface WasiFileStat {
|
|
2
|
+
isFile(): boolean;
|
|
3
|
+
isDirectory(): boolean;
|
|
4
|
+
isSymbolicLink(): boolean;
|
|
5
|
+
size: number;
|
|
6
|
+
mtimeMs: number;
|
|
7
|
+
atimeMs: number;
|
|
8
|
+
ctimeMs: number;
|
|
9
|
+
ino?: number;
|
|
10
|
+
nlink?: number;
|
|
11
|
+
}
|
|
12
|
+
interface WasiFS {
|
|
13
|
+
readFileSync(p: string): Uint8Array;
|
|
14
|
+
writeFileSync(p: string, data: string | Uint8Array): void;
|
|
15
|
+
mkdirSync(p: string, options?: {
|
|
16
|
+
recursive?: boolean;
|
|
17
|
+
}): void;
|
|
18
|
+
statSync(p: string): WasiFileStat;
|
|
19
|
+
readdirSync(p: string): string[];
|
|
20
|
+
unlinkSync(p: string): void;
|
|
21
|
+
rmdirSync(p: string): void;
|
|
22
|
+
renameSync(from: string, to: string): void;
|
|
23
|
+
existsSync(p: string): boolean;
|
|
24
|
+
symlinkSync?(target: string, linkPath: string): void;
|
|
25
|
+
readlinkSync?(p: string): string;
|
|
26
|
+
}
|
|
27
|
+
export declare class ExitStatus extends Error {
|
|
28
|
+
readonly code: number;
|
|
29
|
+
constructor(code: number);
|
|
30
|
+
}
|
|
31
|
+
export interface WASIOptions {
|
|
32
|
+
version?: "preview1" | "unstable";
|
|
33
|
+
args?: string[];
|
|
34
|
+
env?: Record<string, string>;
|
|
35
|
+
preopens?: Record<string, string>;
|
|
36
|
+
returnOnExit?: boolean;
|
|
37
|
+
stdin?: number;
|
|
38
|
+
stdout?: number;
|
|
39
|
+
stderr?: number;
|
|
40
|
+
fs?: WasiFS;
|
|
41
|
+
}
|
|
1
42
|
export interface WASI {
|
|
2
43
|
readonly wasiImport: Record<string, Function>;
|
|
3
|
-
start(
|
|
4
|
-
initialize(
|
|
44
|
+
start(instance: object): number;
|
|
45
|
+
initialize(instance: object): void;
|
|
5
46
|
getImportObject(): Record<string, Record<string, Function>>;
|
|
6
47
|
}
|
|
7
48
|
interface WASIConstructor {
|
|
8
|
-
new (
|
|
9
|
-
(this: any,
|
|
49
|
+
new (options?: WASIOptions): WASI;
|
|
50
|
+
(this: any, options?: WASIOptions): void;
|
|
10
51
|
prototype: any;
|
|
11
52
|
}
|
|
12
53
|
export declare const WASI: WASIConstructor;
|
package/dist/sdk/nodepod.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { MemoryVolume } from "../memory-volume";
|
|
|
2
2
|
import { ScriptEngine } from "../script-engine";
|
|
3
3
|
import { DependencyInstaller } from "../packages/installer";
|
|
4
4
|
import { RequestProxy } from "../request-proxy";
|
|
5
|
-
import type { NodepodOptions, TerminalOptions, Snapshot, SpawnOptions } from "./types";
|
|
5
|
+
import type { NodepodOptions, TerminalOptions, Snapshot, SnapshotOptions, SpawnOptions } from "./types";
|
|
6
6
|
import { NodepodFS } from "./nodepod-fs";
|
|
7
7
|
import { NodepodProcess } from "./nodepod-process";
|
|
8
8
|
import { NodepodTerminal } from "./nodepod-terminal";
|
|
@@ -27,8 +27,9 @@ export declare class Nodepod {
|
|
|
27
27
|
setPreviewScript(script: string): Promise<void>;
|
|
28
28
|
clearPreviewScript(): Promise<void>;
|
|
29
29
|
port(num: number): string | null;
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
private static readonly SHALLOW_EXCLUDE;
|
|
31
|
+
snapshot(opts?: SnapshotOptions): Snapshot;
|
|
32
|
+
restore(snapshot: Snapshot, opts?: SnapshotOptions): Promise<void>;
|
|
32
33
|
teardown(): void;
|
|
33
34
|
get volume(): MemoryVolume;
|
|
34
35
|
get engine(): ScriptEngine;
|
package/dist/sdk/types.d.ts
CHANGED
|
@@ -46,6 +46,12 @@ export interface StatResult {
|
|
|
46
46
|
mtime: number;
|
|
47
47
|
}
|
|
48
48
|
export type Snapshot = VolumeSnapshot;
|
|
49
|
+
export interface SnapshotOptions {
|
|
50
|
+
/** Exclude node_modules and other auto-installable dirs. Default: true */
|
|
51
|
+
shallow?: boolean;
|
|
52
|
+
/** Auto-install deps from package.json after restoring a shallow snapshot. Default: true */
|
|
53
|
+
autoInstall?: boolean;
|
|
54
|
+
}
|
|
49
55
|
export interface SpawnOptions {
|
|
50
56
|
cwd?: string;
|
|
51
57
|
env?: Record<string, string>;
|
|
@@ -39,7 +39,7 @@ export declare class ProcessManager extends EventEmitter {
|
|
|
39
39
|
statusCode: number;
|
|
40
40
|
statusMessage: string;
|
|
41
41
|
headers: Record<string, string>;
|
|
42
|
-
body: string;
|
|
42
|
+
body: string | ArrayBuffer;
|
|
43
43
|
}>;
|
|
44
44
|
dispatchWsUpgrade(port: number, uid: string, path: string, headers: Record<string, string>): number;
|
|
45
45
|
dispatchWsData(pid: number, uid: string, frame: number[]): void;
|
|
@@ -216,7 +216,7 @@ export interface WorkerToMain_HttpResponse {
|
|
|
216
216
|
statusCode: number;
|
|
217
217
|
statusMessage: string;
|
|
218
218
|
headers: Record<string, string>;
|
|
219
|
-
body: string;
|
|
219
|
+
body: string | ArrayBuffer;
|
|
220
220
|
}
|
|
221
221
|
export interface WorkerToMain_IPC {
|
|
222
222
|
type: "ipc-message";
|
package/package.json
CHANGED
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@scelar/nodepod",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Browser-native Node.js runtime environment",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"license": "MIT WITH Commons-Clause",
|
|
7
|
-
"author": "R1ck404 (https://github.com/R1ck404)",
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/ScelarOrg/Nodepod.git"
|
|
11
|
-
},
|
|
12
|
-
"bugs": {
|
|
13
|
-
"url": "https://github.com/ScelarOrg/Nodepod/issues"
|
|
14
|
-
},
|
|
15
|
-
"homepage": "https://github.com/ScelarOrg/Nodepod#readme",
|
|
16
|
-
"keywords": [
|
|
17
|
-
"node",
|
|
18
|
-
"browser",
|
|
19
|
-
"runtime",
|
|
20
|
-
"sandbox",
|
|
21
|
-
"typescript",
|
|
22
|
-
"virtual-filesystem",
|
|
23
|
-
"polyfill",
|
|
24
|
-
"webcontainer",
|
|
25
|
-
"in-browser",
|
|
26
|
-
"nodejs"
|
|
27
|
-
],
|
|
28
|
-
"engines": {
|
|
29
|
-
"node": ">=20.0.0"
|
|
30
|
-
},
|
|
31
|
-
"main": "./dist/index.cjs",
|
|
32
|
-
"module": "./dist/index.mjs",
|
|
33
|
-
"types": "./dist/index.d.ts",
|
|
34
|
-
"exports": {
|
|
35
|
-
".": {
|
|
36
|
-
"import": {
|
|
37
|
-
"types": "./dist/index.d.ts",
|
|
38
|
-
"default": "./dist/index.mjs"
|
|
39
|
-
},
|
|
40
|
-
"require": {
|
|
41
|
-
"types": "./dist/index.d.ts",
|
|
42
|
-
"default": "./dist/index.cjs"
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
"files": [
|
|
47
|
-
"src",
|
|
48
|
-
"dist"
|
|
49
|
-
],
|
|
50
|
-
"sideEffects": false,
|
|
51
|
-
"scripts": {
|
|
52
|
-
"build:lib": "vite build --config vite.lib.config.js && node -e \"require('fs').copyFileSync('static/__sw__.js','dist/__sw__.js')\"",
|
|
53
|
-
"build:types": "tsc --project tsconfig.build.json",
|
|
54
|
-
"build:publish": "npm run build:lib && npm run build:types",
|
|
55
|
-
"type-check": "tsc --noEmit",
|
|
56
|
-
"test": "vitest run",
|
|
57
|
-
"test:watch": "vitest",
|
|
58
|
-
"bench": "vitest bench",
|
|
59
|
-
"bench:run": "vitest bench --run"
|
|
60
|
-
},
|
|
61
|
-
"dependencies": {
|
|
62
|
-
"acorn": "^8.15.0",
|
|
63
|
-
"acorn-jsx": "^5.3.2",
|
|
64
|
-
"brotli": "^1.3.3",
|
|
65
|
-
"brotli-wasm": "^3.0.1",
|
|
66
|
-
"comlink": "^4.4.2",
|
|
67
|
-
"pako": "^2.1.0",
|
|
68
|
-
"resolve.exports": "^2.0.3",
|
|
69
|
-
"zod": "^4.3.6"
|
|
70
|
-
},
|
|
71
|
-
"peerDependencies": {
|
|
72
|
-
"@xterm/xterm": "^6.0.0",
|
|
73
|
-
"@xterm/addon-fit": "^0.11.0",
|
|
74
|
-
"@xterm/addon-webgl": "^0.19.0"
|
|
75
|
-
},
|
|
76
|
-
"peerDependenciesMeta": {
|
|
77
|
-
"@xterm/xterm": {
|
|
78
|
-
"optional": true
|
|
79
|
-
},
|
|
80
|
-
"@xterm/addon-fit": {
|
|
81
|
-
"optional": true
|
|
82
|
-
},
|
|
83
|
-
"@xterm/addon-webgl": {
|
|
84
|
-
"optional": true
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
"devDependencies": {
|
|
88
|
-
"@types/node": "^25.0.10",
|
|
89
|
-
"@types/pako": "^2.0.4",
|
|
90
|
-
"esbuild": "^0.27.2",
|
|
91
|
-
"typescript": "^5.9.3",
|
|
92
|
-
"vite": "^5.4.0",
|
|
93
|
-
"vite-plugin-top-level-await": "^1.6.0",
|
|
94
|
-
"vite-plugin-wasm": "^3.5.0",
|
|
95
|
-
"vitest": "^4.0.18"
|
|
96
|
-
}
|
|
97
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@scelar/nodepod",
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"description": "Browser-native Node.js runtime environment",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT WITH Commons-Clause",
|
|
7
|
+
"author": "R1ck404 (https://github.com/R1ck404)",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/ScelarOrg/Nodepod.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/ScelarOrg/Nodepod/issues"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/ScelarOrg/Nodepod#readme",
|
|
16
|
+
"keywords": [
|
|
17
|
+
"node",
|
|
18
|
+
"browser",
|
|
19
|
+
"runtime",
|
|
20
|
+
"sandbox",
|
|
21
|
+
"typescript",
|
|
22
|
+
"virtual-filesystem",
|
|
23
|
+
"polyfill",
|
|
24
|
+
"webcontainer",
|
|
25
|
+
"in-browser",
|
|
26
|
+
"nodejs"
|
|
27
|
+
],
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=20.0.0"
|
|
30
|
+
},
|
|
31
|
+
"main": "./dist/index.cjs",
|
|
32
|
+
"module": "./dist/index.mjs",
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"import": {
|
|
37
|
+
"types": "./dist/index.d.ts",
|
|
38
|
+
"default": "./dist/index.mjs"
|
|
39
|
+
},
|
|
40
|
+
"require": {
|
|
41
|
+
"types": "./dist/index.d.ts",
|
|
42
|
+
"default": "./dist/index.cjs"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"files": [
|
|
47
|
+
"src",
|
|
48
|
+
"dist"
|
|
49
|
+
],
|
|
50
|
+
"sideEffects": false,
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build:lib": "vite build --config vite.lib.config.js && node -e \"require('fs').copyFileSync('static/__sw__.js','dist/__sw__.js')\"",
|
|
53
|
+
"build:types": "tsc --project tsconfig.build.json",
|
|
54
|
+
"build:publish": "npm run build:lib && npm run build:types",
|
|
55
|
+
"type-check": "tsc --noEmit",
|
|
56
|
+
"test": "vitest run",
|
|
57
|
+
"test:watch": "vitest",
|
|
58
|
+
"bench": "vitest bench",
|
|
59
|
+
"bench:run": "vitest bench --run"
|
|
60
|
+
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"acorn": "^8.15.0",
|
|
63
|
+
"acorn-jsx": "^5.3.2",
|
|
64
|
+
"brotli": "^1.3.3",
|
|
65
|
+
"brotli-wasm": "^3.0.1",
|
|
66
|
+
"comlink": "^4.4.2",
|
|
67
|
+
"pako": "^2.1.0",
|
|
68
|
+
"resolve.exports": "^2.0.3",
|
|
69
|
+
"zod": "^4.3.6"
|
|
70
|
+
},
|
|
71
|
+
"peerDependencies": {
|
|
72
|
+
"@xterm/xterm": "^6.0.0",
|
|
73
|
+
"@xterm/addon-fit": "^0.11.0",
|
|
74
|
+
"@xterm/addon-webgl": "^0.19.0"
|
|
75
|
+
},
|
|
76
|
+
"peerDependenciesMeta": {
|
|
77
|
+
"@xterm/xterm": {
|
|
78
|
+
"optional": true
|
|
79
|
+
},
|
|
80
|
+
"@xterm/addon-fit": {
|
|
81
|
+
"optional": true
|
|
82
|
+
},
|
|
83
|
+
"@xterm/addon-webgl": {
|
|
84
|
+
"optional": true
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"devDependencies": {
|
|
88
|
+
"@types/node": "^25.0.10",
|
|
89
|
+
"@types/pako": "^2.0.4",
|
|
90
|
+
"esbuild": "^0.27.2",
|
|
91
|
+
"typescript": "^5.9.3",
|
|
92
|
+
"vite": "^5.4.0",
|
|
93
|
+
"vite-plugin-top-level-await": "^1.6.0",
|
|
94
|
+
"vite-plugin-wasm": "^3.5.0",
|
|
95
|
+
"vitest": "^4.0.18"
|
|
96
|
+
}
|
|
97
|
+
}
|