@ai-ecoverse/slicc-jsh 0.2.1 → 0.3.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 +3 -1
- package/dist/host/main.mjs +1 -1
- package/dist/jsh.mjs +478 -9
- package/dist/meta-main.json +1 -1
- package/dist/node.mjs +478 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,7 +22,9 @@ Design and milestones: [slicc-kernel#68](https://github.com/ai-ecoverse/slicc-ke
|
|
|
22
22
|
|
|
23
23
|
**npm ecosystem gaps:** packages that import `node:tty` (e.g. chalk's Node build) or need `crypto` (e.g. nanoid's main entry) fail with `ERR_NOT_SUPPORTED` until those modules ship. Prefer the browser/`default` export condition, or a fixture that pins it, when dogfooding. The `tls` module itself is unsupported (`ERR_NOT_SUPPORTED`) — so **http-proxy-agent** / **https-proxy-agent** (which import `tls` for CONNECT tunnels) cannot run yet even though `http.Agent` subclasses via agent-base work for plain `http`.
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
**`child_process` (0.3.0):** `spawn`, `execFile`, and `exec` (via `sh -c`) sit on `ctx.spawn` — argv/env/cwd, stdio `inherit`/`pipe`/`ignore`, streams on `.stdin`/`.stdout`/`.stderr`, events `spawn`/`exit`/`close`/`error` (ENOENT), `.kill(signal)`, `.pid`. Sync forms (`spawnSync`, `execSync`, `execFileSync`) and `fork` stay `ERR_NOT_SUPPORTED`. Also `fs.realpathSync` (no symlink walk) and `process.getuid`/`getgid`/`kill(self)` so pnpm's global cmd shims can resolve their target and re-raise signals.
|
|
26
|
+
|
|
27
|
+
**Still later:** `crypto` / `zlib` / `readline` / `tty` / `tls` / `worker_threads` / TLS `https.createServer` throw `ERR_NOT_SUPPORTED` until their milestone.
|
|
26
28
|
|
|
27
29
|
JS program entries are **esbuild-bundled** to single files (`dist/node.mjs`, `dist/jsh.mjs`) because the kernel loads `abi: "js"` modules via `data:` URLs (relative imports do not resolve).
|
|
28
30
|
|
package/dist/host/main.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import vm from "node:vm";
|
|
|
10
10
|
// package.json
|
|
11
11
|
var package_default = {
|
|
12
12
|
name: "@ai-ecoverse/slicc-jsh",
|
|
13
|
-
version: "0.
|
|
13
|
+
version: "0.3.0",
|
|
14
14
|
description: "Node.js-compatible runtime for slicc-kernel: the node and jsh commands (abi: js)",
|
|
15
15
|
type: "module",
|
|
16
16
|
license: "Apache-2.0",
|
package/dist/jsh.mjs
CHANGED
|
@@ -1585,7 +1585,7 @@ function assignProcessExitCode(value) {
|
|
|
1585
1585
|
// package.json
|
|
1586
1586
|
var package_default = {
|
|
1587
1587
|
name: "@ai-ecoverse/slicc-jsh",
|
|
1588
|
-
version: "0.
|
|
1588
|
+
version: "0.3.0",
|
|
1589
1589
|
description: "Node.js-compatible runtime for slicc-kernel: the node and jsh commands (abi: js)",
|
|
1590
1590
|
type: "module",
|
|
1591
1591
|
license: "Apache-2.0",
|
|
@@ -10793,6 +10793,415 @@ function createEvents() {
|
|
|
10793
10793
|
});
|
|
10794
10794
|
}
|
|
10795
10795
|
|
|
10796
|
+
// src/runtime/builtins/child-process.mjs
|
|
10797
|
+
var SIGNAL_NAMES = {
|
|
10798
|
+
1: "SIGHUP",
|
|
10799
|
+
2: "SIGINT",
|
|
10800
|
+
3: "SIGQUIT",
|
|
10801
|
+
6: "SIGABRT",
|
|
10802
|
+
9: "SIGKILL",
|
|
10803
|
+
10: "SIGUSR1",
|
|
10804
|
+
12: "SIGUSR2",
|
|
10805
|
+
13: "SIGPIPE",
|
|
10806
|
+
14: "SIGALRM",
|
|
10807
|
+
15: "SIGTERM",
|
|
10808
|
+
17: "SIGCHLD",
|
|
10809
|
+
18: "SIGCONT",
|
|
10810
|
+
19: "SIGSTOP",
|
|
10811
|
+
20: "SIGTSTP"
|
|
10812
|
+
};
|
|
10813
|
+
var SIGNAL_NUMBERS = Object.fromEntries(
|
|
10814
|
+
Object.entries(SIGNAL_NAMES).map(([n, name]) => [name, Number(n)])
|
|
10815
|
+
);
|
|
10816
|
+
function notSupported(name) {
|
|
10817
|
+
const err = new Error(`slicc-jsh: child_process.${name} is not supported yet`);
|
|
10818
|
+
err.code = "ERR_NOT_SUPPORTED";
|
|
10819
|
+
throw err;
|
|
10820
|
+
}
|
|
10821
|
+
function normalizeArgs(file, args, options, callback) {
|
|
10822
|
+
if (typeof args === "function") {
|
|
10823
|
+
return { args: [], options: {}, callback: args };
|
|
10824
|
+
}
|
|
10825
|
+
if (typeof options === "function") {
|
|
10826
|
+
return { args: Array.isArray(args) ? args : [], options: {}, callback: options };
|
|
10827
|
+
}
|
|
10828
|
+
if (args != null && !Array.isArray(args) && typeof args === "object") {
|
|
10829
|
+
return { args: [], options: args, callback: typeof options === "function" ? options : callback };
|
|
10830
|
+
}
|
|
10831
|
+
return {
|
|
10832
|
+
args: Array.isArray(args) ? args.map(String) : [],
|
|
10833
|
+
options: options && typeof options === "object" ? options : {},
|
|
10834
|
+
callback: typeof callback === "function" ? callback : void 0
|
|
10835
|
+
};
|
|
10836
|
+
}
|
|
10837
|
+
function normalizeStdio(stdio) {
|
|
10838
|
+
if (stdio === void 0) return ["pipe", "pipe", "pipe"];
|
|
10839
|
+
if (typeof stdio === "string") return [stdio, stdio, stdio];
|
|
10840
|
+
if (Array.isArray(stdio)) {
|
|
10841
|
+
return [stdio[0] ?? "pipe", stdio[1] ?? "pipe", stdio[2] ?? "pipe"];
|
|
10842
|
+
}
|
|
10843
|
+
return ["pipe", "pipe", "pipe"];
|
|
10844
|
+
}
|
|
10845
|
+
function toKernelStdio(mode) {
|
|
10846
|
+
if (mode === "pipe" || mode === "overlapped") return "pipe";
|
|
10847
|
+
if (mode === "ignore" || mode === null || mode === void 0 || mode === "null") return "null";
|
|
10848
|
+
if (mode === "inherit") return "inherit";
|
|
10849
|
+
if (typeof mode === "number") return mode;
|
|
10850
|
+
const err = new Error(`The argument 'stdio' is invalid. Received ${String(mode)}`);
|
|
10851
|
+
err.code = "ERR_INVALID_ARG_VALUE";
|
|
10852
|
+
throw err;
|
|
10853
|
+
}
|
|
10854
|
+
function signalName(sig) {
|
|
10855
|
+
if (sig == null) return null;
|
|
10856
|
+
if (typeof sig === "string") return sig.startsWith("SIG") ? sig : `SIG${sig}`;
|
|
10857
|
+
if (typeof sig === "number") return SIGNAL_NAMES[sig] ?? String(sig);
|
|
10858
|
+
return null;
|
|
10859
|
+
}
|
|
10860
|
+
function spawnError(command, args, code, message) {
|
|
10861
|
+
const err = new Error(message ?? `spawn ${command} ${code}`);
|
|
10862
|
+
err.code = code;
|
|
10863
|
+
err.errno = code === "ENOENT" ? -2 : void 0;
|
|
10864
|
+
err.syscall = "spawn";
|
|
10865
|
+
err.path = command;
|
|
10866
|
+
err.spawnargs = args;
|
|
10867
|
+
return err;
|
|
10868
|
+
}
|
|
10869
|
+
function createChildProcess({ ctx, process: process2, Buffer: Buffer2, handles, getStream }) {
|
|
10870
|
+
class ChildProcess extends EventEmitter {
|
|
10871
|
+
constructor() {
|
|
10872
|
+
super();
|
|
10873
|
+
this.stdin = null;
|
|
10874
|
+
this.stdout = null;
|
|
10875
|
+
this.stderr = null;
|
|
10876
|
+
this.pid = void 0;
|
|
10877
|
+
this.exitCode = null;
|
|
10878
|
+
this.signalCode = null;
|
|
10879
|
+
this.killed = false;
|
|
10880
|
+
this.connected = false;
|
|
10881
|
+
this.spawnfile = "";
|
|
10882
|
+
this.spawnargs = [];
|
|
10883
|
+
this.#kernel = null;
|
|
10884
|
+
this.#handle = null;
|
|
10885
|
+
this.#closing = false;
|
|
10886
|
+
}
|
|
10887
|
+
#kernel;
|
|
10888
|
+
#handle;
|
|
10889
|
+
#closing;
|
|
10890
|
+
kill(signal = "SIGTERM") {
|
|
10891
|
+
const name = signalName(signal) ?? "SIGTERM";
|
|
10892
|
+
this.killed = true;
|
|
10893
|
+
if (!this.#kernel) return false;
|
|
10894
|
+
try {
|
|
10895
|
+
const ret = this.#kernel.kill(name);
|
|
10896
|
+
return ret !== false;
|
|
10897
|
+
} catch {
|
|
10898
|
+
return false;
|
|
10899
|
+
}
|
|
10900
|
+
}
|
|
10901
|
+
ref() {
|
|
10902
|
+
if (this.#handle) handles.add(this.#handle);
|
|
10903
|
+
return this;
|
|
10904
|
+
}
|
|
10905
|
+
unref() {
|
|
10906
|
+
if (this.#handle) handles.delete(this.#handle);
|
|
10907
|
+
return this;
|
|
10908
|
+
}
|
|
10909
|
+
/** @internal */
|
|
10910
|
+
_bindKernel(child) {
|
|
10911
|
+
this.#kernel = child;
|
|
10912
|
+
this.pid = child.pid;
|
|
10913
|
+
this.#handle = { kind: "child", pid: child.pid };
|
|
10914
|
+
handles.add(this.#handle);
|
|
10915
|
+
}
|
|
10916
|
+
/** @internal */
|
|
10917
|
+
_release() {
|
|
10918
|
+
if (this.#handle) {
|
|
10919
|
+
handles.delete(this.#handle);
|
|
10920
|
+
this.#handle = null;
|
|
10921
|
+
}
|
|
10922
|
+
}
|
|
10923
|
+
/** @internal */
|
|
10924
|
+
_markClosing() {
|
|
10925
|
+
this.#closing = true;
|
|
10926
|
+
}
|
|
10927
|
+
get _closing() {
|
|
10928
|
+
return this.#closing;
|
|
10929
|
+
}
|
|
10930
|
+
}
|
|
10931
|
+
function createPipeReadable() {
|
|
10932
|
+
const { Readable } = getStream();
|
|
10933
|
+
const r = new Readable({ read() {
|
|
10934
|
+
} });
|
|
10935
|
+
r._sliccPump = async (webStream) => {
|
|
10936
|
+
if (!webStream) {
|
|
10937
|
+
r.push(null);
|
|
10938
|
+
return;
|
|
10939
|
+
}
|
|
10940
|
+
try {
|
|
10941
|
+
const reader = webStream.getReader();
|
|
10942
|
+
for (; ; ) {
|
|
10943
|
+
const { done, value } = await reader.read();
|
|
10944
|
+
if (done) break;
|
|
10945
|
+
const chunk = value instanceof Uint8Array ? Buffer2.from(value) : Buffer2.from(String(value));
|
|
10946
|
+
r.push(chunk);
|
|
10947
|
+
}
|
|
10948
|
+
r.push(null);
|
|
10949
|
+
} catch (err) {
|
|
10950
|
+
r.destroy(err);
|
|
10951
|
+
}
|
|
10952
|
+
};
|
|
10953
|
+
return r;
|
|
10954
|
+
}
|
|
10955
|
+
function createPipeWritable() {
|
|
10956
|
+
const { Writable } = getStream();
|
|
10957
|
+
let writer = null;
|
|
10958
|
+
const pending = [];
|
|
10959
|
+
let ended = false;
|
|
10960
|
+
const w = new Writable({
|
|
10961
|
+
write(chunk, _enc, cb) {
|
|
10962
|
+
const bytes = typeof chunk === "string" ? Buffer2.from(chunk) : chunk;
|
|
10963
|
+
if (!writer) {
|
|
10964
|
+
pending.push({ bytes, cb });
|
|
10965
|
+
return;
|
|
10966
|
+
}
|
|
10967
|
+
writer.write(bytes).then(() => cb(), cb);
|
|
10968
|
+
},
|
|
10969
|
+
final(cb) {
|
|
10970
|
+
ended = true;
|
|
10971
|
+
if (!writer) {
|
|
10972
|
+
pending.push({ end: true, cb });
|
|
10973
|
+
return;
|
|
10974
|
+
}
|
|
10975
|
+
writer.close().then(() => cb(), cb);
|
|
10976
|
+
},
|
|
10977
|
+
destroy(err, cb) {
|
|
10978
|
+
if (writer) writer.abort(err).then(() => cb(err), () => cb(err));
|
|
10979
|
+
else cb(err);
|
|
10980
|
+
}
|
|
10981
|
+
});
|
|
10982
|
+
w._sliccAttach = (webStream) => {
|
|
10983
|
+
if (!webStream) {
|
|
10984
|
+
for (const p of pending) p.cb?.(new Error("stdin not available"));
|
|
10985
|
+
pending.length = 0;
|
|
10986
|
+
return;
|
|
10987
|
+
}
|
|
10988
|
+
writer = webStream.getWriter();
|
|
10989
|
+
for (const p of pending) {
|
|
10990
|
+
if (p.end) writer.close().then(() => p.cb(), p.cb);
|
|
10991
|
+
else writer.write(p.bytes).then(() => p.cb(), p.cb);
|
|
10992
|
+
}
|
|
10993
|
+
pending.length = 0;
|
|
10994
|
+
if (ended && pending.length === 0) {
|
|
10995
|
+
}
|
|
10996
|
+
};
|
|
10997
|
+
return w;
|
|
10998
|
+
}
|
|
10999
|
+
function prepareStdio(child, stdio) {
|
|
11000
|
+
const [inMode, outMode, errMode] = stdio;
|
|
11001
|
+
if (toKernelStdio(inMode) === "pipe") child.stdin = createPipeWritable();
|
|
11002
|
+
if (toKernelStdio(outMode) === "pipe") child.stdout = createPipeReadable();
|
|
11003
|
+
if (toKernelStdio(errMode) === "pipe") child.stderr = createPipeReadable();
|
|
11004
|
+
}
|
|
11005
|
+
function connectStdio(child, kernelChild) {
|
|
11006
|
+
child.stdin?._sliccAttach?.(kernelChild.stdin);
|
|
11007
|
+
const pumps = [];
|
|
11008
|
+
if (child.stdout?._sliccPump) pumps.push(child.stdout._sliccPump(kernelChild.stdout));
|
|
11009
|
+
if (child.stderr?._sliccPump) pumps.push(child.stderr._sliccPump(kernelChild.stderr));
|
|
11010
|
+
child._stdioPumps = Promise.all(pumps);
|
|
11011
|
+
}
|
|
11012
|
+
function finish(child, code, signal) {
|
|
11013
|
+
if (child._closing) return;
|
|
11014
|
+
child._markClosing();
|
|
11015
|
+
child.exitCode = code;
|
|
11016
|
+
child.signalCode = signal;
|
|
11017
|
+
child.emit("exit", code, signal);
|
|
11018
|
+
const after = child._stdioPumps ?? Promise.resolve();
|
|
11019
|
+
trackPromise(handles, after);
|
|
11020
|
+
after.finally(() => {
|
|
11021
|
+
child.emit("close", code, signal);
|
|
11022
|
+
child._release();
|
|
11023
|
+
handles.notify?.();
|
|
11024
|
+
});
|
|
11025
|
+
}
|
|
11026
|
+
function startSpawn(child, file, args, options, stdio) {
|
|
11027
|
+
const cwd = options.cwd != null ? String(options.cwd) : process2.cwd();
|
|
11028
|
+
const env = options.env ? { ...options.env } : { ...process2.env };
|
|
11029
|
+
const argv = [file, ...args];
|
|
11030
|
+
child.spawnfile = file;
|
|
11031
|
+
child.spawnargs = argv;
|
|
11032
|
+
const spawnPromise = ctx.spawn({
|
|
11033
|
+
argv,
|
|
11034
|
+
cwd,
|
|
11035
|
+
env,
|
|
11036
|
+
stdin: toKernelStdio(stdio[0]),
|
|
11037
|
+
stdout: toKernelStdio(stdio[1]),
|
|
11038
|
+
stderr: toKernelStdio(stdio[2])
|
|
11039
|
+
});
|
|
11040
|
+
trackPromise(handles, spawnPromise);
|
|
11041
|
+
spawnPromise.then(
|
|
11042
|
+
(kernelChild) => {
|
|
11043
|
+
child._bindKernel(kernelChild);
|
|
11044
|
+
connectStdio(child, kernelChild);
|
|
11045
|
+
child.emit("spawn");
|
|
11046
|
+
const waitP = kernelChild.wait();
|
|
11047
|
+
trackPromise(handles, waitP);
|
|
11048
|
+
waitP.then(
|
|
11049
|
+
(status) => {
|
|
11050
|
+
const sigNum = status?.signal;
|
|
11051
|
+
if (sigNum != null && sigNum !== 0) {
|
|
11052
|
+
const name = SIGNAL_NAMES[sigNum] ?? String(sigNum);
|
|
11053
|
+
finish(child, null, name);
|
|
11054
|
+
} else {
|
|
11055
|
+
const code = typeof status?.status === "number" ? status.status : 0;
|
|
11056
|
+
finish(child, code, null);
|
|
11057
|
+
}
|
|
11058
|
+
},
|
|
11059
|
+
(err) => {
|
|
11060
|
+
child.emit("error", err);
|
|
11061
|
+
finish(child, 1, null);
|
|
11062
|
+
}
|
|
11063
|
+
);
|
|
11064
|
+
},
|
|
11065
|
+
(err) => {
|
|
11066
|
+
const code = err?.code === "ENOENT" ? "ENOENT" : err?.code ?? "ERR_SPAWN_FAILED";
|
|
11067
|
+
const error = code === "ENOENT" ? spawnError(file, args, "ENOENT", `spawn ${file} ENOENT`) : spawnError(file, args, code, err?.message ?? String(err));
|
|
11068
|
+
try {
|
|
11069
|
+
child.stdout?.push?.(null);
|
|
11070
|
+
} catch {
|
|
11071
|
+
}
|
|
11072
|
+
try {
|
|
11073
|
+
child.stderr?.push?.(null);
|
|
11074
|
+
} catch {
|
|
11075
|
+
}
|
|
11076
|
+
process2.nextTick(() => {
|
|
11077
|
+
child.emit("error", error);
|
|
11078
|
+
if (code === "ENOENT") {
|
|
11079
|
+
child.exitCode = -2;
|
|
11080
|
+
child.emit("close", -2, null);
|
|
11081
|
+
} else {
|
|
11082
|
+
finish(child, 1, null);
|
|
11083
|
+
}
|
|
11084
|
+
child._release();
|
|
11085
|
+
handles.notify?.();
|
|
11086
|
+
});
|
|
11087
|
+
}
|
|
11088
|
+
);
|
|
11089
|
+
}
|
|
11090
|
+
function spawn(command, args, options) {
|
|
11091
|
+
let file = command;
|
|
11092
|
+
let argv = args;
|
|
11093
|
+
let opts = options;
|
|
11094
|
+
if (argv != null && !Array.isArray(argv) && typeof argv === "object") {
|
|
11095
|
+
opts = argv;
|
|
11096
|
+
argv = [];
|
|
11097
|
+
}
|
|
11098
|
+
argv = Array.isArray(argv) ? argv.map(String) : [];
|
|
11099
|
+
opts = opts && typeof opts === "object" ? opts : {};
|
|
11100
|
+
file = String(file);
|
|
11101
|
+
if (opts.shell) {
|
|
11102
|
+
const shell = typeof opts.shell === "string" ? opts.shell : "sh";
|
|
11103
|
+
const line = argv.length ? [file, ...argv].join(" ") : file;
|
|
11104
|
+
file = shell;
|
|
11105
|
+
argv = ["-c", line];
|
|
11106
|
+
}
|
|
11107
|
+
const stdio = normalizeStdio(opts.stdio);
|
|
11108
|
+
const child = new ChildProcess();
|
|
11109
|
+
prepareStdio(child, stdio);
|
|
11110
|
+
process2.nextTick(() => startSpawn(child, file, argv, opts, stdio));
|
|
11111
|
+
return child;
|
|
11112
|
+
}
|
|
11113
|
+
function execFile(file, args, options, callback) {
|
|
11114
|
+
const norm = normalizeArgs(file, args, options, callback);
|
|
11115
|
+
const opts = { ...norm.options };
|
|
11116
|
+
if (opts.stdio === void 0) opts.stdio = ["pipe", "pipe", "pipe"];
|
|
11117
|
+
const child = spawn(String(file), norm.args, opts);
|
|
11118
|
+
if (!norm.callback) return child;
|
|
11119
|
+
const maxBuffer = opts.maxBuffer ?? 1024 * 1024;
|
|
11120
|
+
let stdout = Buffer2.alloc(0);
|
|
11121
|
+
let stderr = Buffer2.alloc(0);
|
|
11122
|
+
let exited = false;
|
|
11123
|
+
const done = (err) => {
|
|
11124
|
+
if (exited) return;
|
|
11125
|
+
exited = true;
|
|
11126
|
+
const enc = opts.encoding;
|
|
11127
|
+
const out = enc ? stdout.toString(enc) : stdout;
|
|
11128
|
+
const errOut = enc ? stderr.toString(enc) : stderr;
|
|
11129
|
+
norm.callback(err, out, errOut);
|
|
11130
|
+
};
|
|
11131
|
+
if (child.stdout) {
|
|
11132
|
+
child.stdout.on("data", (chunk) => {
|
|
11133
|
+
stdout = Buffer2.concat([stdout, Buffer2.isBuffer(chunk) ? chunk : Buffer2.from(chunk)]);
|
|
11134
|
+
if (stdout.length > maxBuffer) {
|
|
11135
|
+
child.kill();
|
|
11136
|
+
const err = new Error("stdout maxBuffer exceeded");
|
|
11137
|
+
err.code = "ERR_CHILD_PROCESS_STDIO_MAXBUFFER";
|
|
11138
|
+
done(err);
|
|
11139
|
+
}
|
|
11140
|
+
});
|
|
11141
|
+
}
|
|
11142
|
+
if (child.stderr) {
|
|
11143
|
+
child.stderr.on("data", (chunk) => {
|
|
11144
|
+
stderr = Buffer2.concat([stderr, Buffer2.isBuffer(chunk) ? chunk : Buffer2.from(chunk)]);
|
|
11145
|
+
if (stderr.length > maxBuffer) {
|
|
11146
|
+
child.kill();
|
|
11147
|
+
const err = new Error("stderr maxBuffer exceeded");
|
|
11148
|
+
err.code = "ERR_CHILD_PROCESS_STDIO_MAXBUFFER";
|
|
11149
|
+
done(err);
|
|
11150
|
+
}
|
|
11151
|
+
});
|
|
11152
|
+
}
|
|
11153
|
+
child.on("error", (err) => done(err));
|
|
11154
|
+
child.on("close", (code, signal) => {
|
|
11155
|
+
if (exited) return;
|
|
11156
|
+
if (code === 0 && !signal) {
|
|
11157
|
+
done(null);
|
|
11158
|
+
return;
|
|
11159
|
+
}
|
|
11160
|
+
const err = new Error(`Command failed: ${file} ${norm.args.join(" ")}`);
|
|
11161
|
+
err.code = code;
|
|
11162
|
+
err.killed = child.killed;
|
|
11163
|
+
err.signal = signal;
|
|
11164
|
+
err.cmd = `${file} ${norm.args.join(" ")}`.trim();
|
|
11165
|
+
err.stdout = opts.encoding ? stdout.toString(opts.encoding) : stdout;
|
|
11166
|
+
err.stderr = opts.encoding ? stderr.toString(opts.encoding) : stderr;
|
|
11167
|
+
done(err);
|
|
11168
|
+
});
|
|
11169
|
+
return child;
|
|
11170
|
+
}
|
|
11171
|
+
function exec(command, options, callback) {
|
|
11172
|
+
let opts = options;
|
|
11173
|
+
let cb = callback;
|
|
11174
|
+
if (typeof options === "function") {
|
|
11175
|
+
cb = options;
|
|
11176
|
+
opts = {};
|
|
11177
|
+
}
|
|
11178
|
+
opts = opts && typeof opts === "object" ? opts : {};
|
|
11179
|
+
const shell = typeof opts.shell === "string" ? opts.shell : "sh";
|
|
11180
|
+
return execFile(shell, ["-c", String(command)], { ...opts, shell: false }, cb);
|
|
11181
|
+
}
|
|
11182
|
+
return {
|
|
11183
|
+
spawn,
|
|
11184
|
+
execFile,
|
|
11185
|
+
exec,
|
|
11186
|
+
spawnSync() {
|
|
11187
|
+
notSupported("spawnSync");
|
|
11188
|
+
},
|
|
11189
|
+
execSync() {
|
|
11190
|
+
notSupported("execSync");
|
|
11191
|
+
},
|
|
11192
|
+
execFileSync() {
|
|
11193
|
+
notSupported("execFileSync");
|
|
11194
|
+
},
|
|
11195
|
+
fork() {
|
|
11196
|
+
notSupported("fork");
|
|
11197
|
+
},
|
|
11198
|
+
ChildProcess,
|
|
11199
|
+
// Expose for tests / advanced callers
|
|
11200
|
+
_SIGNAL_NAMES: SIGNAL_NAMES,
|
|
11201
|
+
_SIGNAL_NUMBERS: SIGNAL_NUMBERS
|
|
11202
|
+
};
|
|
11203
|
+
}
|
|
11204
|
+
|
|
10796
11205
|
// src/runtime/builtins/fs.mjs
|
|
10797
11206
|
var encoder3 = new TextEncoder();
|
|
10798
11207
|
var decoder3 = new TextDecoder();
|
|
@@ -11187,6 +11596,21 @@ function createFs({ ctx, path, process: process2, Buffer: Buffer2, handles, getS
|
|
|
11187
11596
|
throw nodeFsError(err?.code || "ENOENT", "lstat", pathArg, err);
|
|
11188
11597
|
}
|
|
11189
11598
|
},
|
|
11599
|
+
/**
|
|
11600
|
+
* Resolve to a canonical absolute path. Symlink walk is not implemented;
|
|
11601
|
+
* when the path exists we return the normalized absolute form (enough for
|
|
11602
|
+
* pnpm's cmd shims, which only need dirname(realpathSync(argv[1]))).
|
|
11603
|
+
*/
|
|
11604
|
+
realpathSync(p) {
|
|
11605
|
+
const pathArg = p;
|
|
11606
|
+
const target = abs(p);
|
|
11607
|
+
try {
|
|
11608
|
+
syncFs.stat(target);
|
|
11609
|
+
return target;
|
|
11610
|
+
} catch (err) {
|
|
11611
|
+
throw nodeFsError(err?.code || "ENOENT", "realpath", pathArg, err);
|
|
11612
|
+
}
|
|
11613
|
+
},
|
|
11190
11614
|
readdirSync,
|
|
11191
11615
|
mkdirSync,
|
|
11192
11616
|
rmdirSync(p, options = {}) {
|
|
@@ -11825,6 +12249,7 @@ function createFs({ ctx, path, process: process2, Buffer: Buffer2, handles, getS
|
|
|
11825
12249
|
access: callbackify(syncApi.accessSync),
|
|
11826
12250
|
stat: callbackify(syncApi.statSync),
|
|
11827
12251
|
lstat: callbackify(syncApi.lstatSync),
|
|
12252
|
+
realpath: callbackify(syncApi.realpathSync),
|
|
11828
12253
|
readdir: callbackify(syncApi.readdirSync),
|
|
11829
12254
|
mkdir: callbackify(syncApi.mkdirSync),
|
|
11830
12255
|
rmdir: callbackify(syncApi.rmdirSync),
|
|
@@ -12685,7 +13110,7 @@ function createHttp2({ ctx, process: process2, Buffer: Buffer2, handles, getStre
|
|
|
12685
13110
|
|
|
12686
13111
|
// src/runtime/builtins/https.mjs
|
|
12687
13112
|
var TLS_CLIENT_OPTS = ["cert", "key", "pfx", "ca"];
|
|
12688
|
-
function
|
|
13113
|
+
function notSupported2(what) {
|
|
12689
13114
|
const err = new Error(`slicc-jsh: '${what}' is not supported yet (no TLS on ctx.net)`);
|
|
12690
13115
|
err.code = "ERR_NOT_SUPPORTED";
|
|
12691
13116
|
return err;
|
|
@@ -12699,7 +13124,7 @@ function isManualRedirectUnsupported(err) {
|
|
|
12699
13124
|
function rejectTlsOptions(options) {
|
|
12700
13125
|
for (const name of TLS_CLIENT_OPTS) {
|
|
12701
13126
|
if (options?.[name] != null) {
|
|
12702
|
-
throw
|
|
13127
|
+
throw notSupported2(`https.request option '${name}'`);
|
|
12703
13128
|
}
|
|
12704
13129
|
}
|
|
12705
13130
|
}
|
|
@@ -12733,7 +13158,7 @@ function createHttps({ ctx, Buffer: Buffer2, http, handles }) {
|
|
|
12733
13158
|
}
|
|
12734
13159
|
}
|
|
12735
13160
|
function createServer() {
|
|
12736
|
-
throw
|
|
13161
|
+
throw notSupported2("https.createServer");
|
|
12737
13162
|
}
|
|
12738
13163
|
class ClientRequest extends EventEmitter {
|
|
12739
13164
|
#ended = false;
|
|
@@ -12824,7 +13249,7 @@ function createHttps({ ctx, Buffer: Buffer2, http, handles }) {
|
|
|
12824
13249
|
if (this.#sent || this.#destroyed) return;
|
|
12825
13250
|
this.#sent = true;
|
|
12826
13251
|
try {
|
|
12827
|
-
if (typeof ctx.fetch !== "function") throw
|
|
13252
|
+
if (typeof ctx.fetch !== "function") throw notSupported2("https.request");
|
|
12828
13253
|
const opts = this.#opts;
|
|
12829
13254
|
const method = (opts.method ?? "GET").toUpperCase();
|
|
12830
13255
|
const host = opts.hostname ?? opts.host ?? "localhost";
|
|
@@ -13713,6 +14138,7 @@ var BUILTIN_LIST = [
|
|
|
13713
14138
|
"assert",
|
|
13714
14139
|
"assert/strict",
|
|
13715
14140
|
"buffer",
|
|
14141
|
+
"child_process",
|
|
13716
14142
|
"console",
|
|
13717
14143
|
"events",
|
|
13718
14144
|
"fs",
|
|
@@ -13736,7 +14162,6 @@ var BUILTIN_LIST = [
|
|
|
13736
14162
|
"util/types"
|
|
13737
14163
|
];
|
|
13738
14164
|
var NOT_YET = [
|
|
13739
|
-
"child_process",
|
|
13740
14165
|
"http2",
|
|
13741
14166
|
"crypto",
|
|
13742
14167
|
"zlib",
|
|
@@ -13755,7 +14180,7 @@ var NOT_YET = [
|
|
|
13755
14180
|
"v8",
|
|
13756
14181
|
"was"
|
|
13757
14182
|
];
|
|
13758
|
-
function
|
|
14183
|
+
function notSupported3(id) {
|
|
13759
14184
|
const err = new Error(`slicc-jsh: '${id}' is not supported yet`);
|
|
13760
14185
|
err.code = "ERR_NOT_SUPPORTED";
|
|
13761
14186
|
throw err;
|
|
@@ -13801,6 +14226,13 @@ function createBuiltins({ ctx, process: process2, Buffer: Buffer2, console: cons
|
|
|
13801
14226
|
if (!https) https = createHttps({ ctx, Buffer: Buffer2, http: getHttp(), handles });
|
|
13802
14227
|
return https;
|
|
13803
14228
|
};
|
|
14229
|
+
let childProcess;
|
|
14230
|
+
const getChildProcess = () => {
|
|
14231
|
+
if (!childProcess) {
|
|
14232
|
+
childProcess = createChildProcess({ ctx, process: process2, Buffer: Buffer2, handles, getStream });
|
|
14233
|
+
}
|
|
14234
|
+
return childProcess;
|
|
14235
|
+
};
|
|
13804
14236
|
let ModuleExport = null;
|
|
13805
14237
|
const implemented = {
|
|
13806
14238
|
process: () => process2,
|
|
@@ -13826,7 +14258,8 @@ function createBuiltins({ ctx, process: process2, Buffer: Buffer2, console: cons
|
|
|
13826
14258
|
"timers/promises": () => timersPromises,
|
|
13827
14259
|
net: () => getNet(),
|
|
13828
14260
|
http: () => getHttp(),
|
|
13829
|
-
https: () => getHttps()
|
|
14261
|
+
https: () => getHttps(),
|
|
14262
|
+
child_process: () => getChildProcess()
|
|
13830
14263
|
};
|
|
13831
14264
|
return {
|
|
13832
14265
|
installModule(Module) {
|
|
@@ -13840,7 +14273,7 @@ function createBuiltins({ ctx, process: process2, Buffer: Buffer2, console: cons
|
|
|
13840
14273
|
},
|
|
13841
14274
|
load(id) {
|
|
13842
14275
|
const bare = id.startsWith("node:") ? id.slice(5) : id;
|
|
13843
|
-
if (NOT_YET.includes(bare))
|
|
14276
|
+
if (NOT_YET.includes(bare)) notSupported3(bare);
|
|
13844
14277
|
const factory = implemented[bare];
|
|
13845
14278
|
if (!factory) {
|
|
13846
14279
|
const err = new Error(`No such built-in module: ${id}`);
|
|
@@ -15892,6 +16325,42 @@ var Process = class extends EventEmitter {
|
|
|
15892
16325
|
cwd() {
|
|
15893
16326
|
return this._cwd;
|
|
15894
16327
|
}
|
|
16328
|
+
/** Root (0) until credential plumbing is exposed on process. */
|
|
16329
|
+
getuid() {
|
|
16330
|
+
return 0;
|
|
16331
|
+
}
|
|
16332
|
+
geteuid() {
|
|
16333
|
+
return 0;
|
|
16334
|
+
}
|
|
16335
|
+
getgid() {
|
|
16336
|
+
return 0;
|
|
16337
|
+
}
|
|
16338
|
+
getegid() {
|
|
16339
|
+
return 0;
|
|
16340
|
+
}
|
|
16341
|
+
getgroups() {
|
|
16342
|
+
return [0];
|
|
16343
|
+
}
|
|
16344
|
+
/**
|
|
16345
|
+
* Minimal process.kill: only this process (pid === this.pid). Used by pnpm
|
|
16346
|
+
* cmd shims to re-raise a child's terminating signal. Unknown pids → ESRCH.
|
|
16347
|
+
*/
|
|
16348
|
+
kill(pid, signal = "SIGTERM") {
|
|
16349
|
+
const target = Number(pid);
|
|
16350
|
+
if (target !== this.pid) {
|
|
16351
|
+
const err = new Error(`kill ESRCH`);
|
|
16352
|
+
err.code = "ESRCH";
|
|
16353
|
+
err.errno = -3;
|
|
16354
|
+
err.syscall = "kill";
|
|
16355
|
+
throw err;
|
|
16356
|
+
}
|
|
16357
|
+
const name = typeof signal === "string" ? signal.startsWith("SIG") ? signal : `SIG${signal}` : "SIGTERM";
|
|
16358
|
+
if (name === "SIGTERM" || name === "SIGINT" || name === "SIGHUP" || name === "SIGKILL") {
|
|
16359
|
+
const codes = { SIGTERM: 143, SIGINT: 130, SIGHUP: 129, SIGKILL: 137 };
|
|
16360
|
+
this.exit(codes[name] ?? 1);
|
|
16361
|
+
}
|
|
16362
|
+
return true;
|
|
16363
|
+
}
|
|
15895
16364
|
chdir(path) {
|
|
15896
16365
|
if (typeof path !== "string") {
|
|
15897
16366
|
const err = new TypeError(
|
package/dist/meta-main.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/runtime/exit.mjs":{"bytes":1670,"imports":[],"format":"esm"},"package.json":{"bytes":2541,"imports":[],"format":"esm","with":{"type":"json"}},"src/jsh/parse-flags.mjs":{"bytes":1829,"imports":[],"format":"esm"},"src/jsh/sliccy/exec.mjs":{"bytes":4790,"imports":[],"format":"esm"},"src/jsh/sliccy/http.mjs":{"bytes":5865,"imports":[],"format":"esm"},"src/jsh/sliccy/pure.mjs":{"bytes":7087,"imports":[],"format":"esm"},"src/jsh/sliccy/index.mjs":{"bytes":2910,"imports":[{"path":"src/jsh/sliccy/exec.mjs","kind":"import-statement","original":"./exec.mjs"},{"path":"src/jsh/sliccy/http.mjs","kind":"import-statement","original":"./http.mjs"},{"path":"src/jsh/sliccy/pure.mjs","kind":"import-statement","original":"./pure.mjs"}],"format":"esm"},"src/jsh/run.mjs":{"bytes":4655,"imports":[{"path":"package.json","kind":"import-statement","original":"../../package.json","with":{"type":"json"}},{"path":"src/jsh/parse-flags.mjs","kind":"import-statement","original":"./parse-flags.mjs"},{"path":"src/jsh/sliccy/index.mjs","kind":"import-statement","original":"./sliccy/index.mjs"}],"format":"esm"},"src/jsh/kernel.mjs":{"bytes":5909,"imports":[{"path":"src/runtime/exit.mjs","kind":"import-statement","original":"../runtime/exit.mjs"},{"path":"src/jsh/run.mjs","kind":"import-statement","original":"./run.mjs"}],"format":"esm"},"src/runtime/async-handles.mjs":{"bytes":2272,"imports":[],"format":"esm"},"src/runtime/buffer.mjs":{"bytes":37245,"imports":[],"format":"esm"},"node_modules/node-inspect-extracted/dist/inspect.js":{"bytes":51340,"imports":[],"format":"cjs"},"node_modules/node-inspect-extracted/index.mjs":{"bytes":380,"imports":[{"path":"node_modules/node-inspect-extracted/dist/inspect.js","kind":"import-statement","original":"./dist/inspect.js"}],"format":"esm"},"src/runtime/builtins/util.mjs":{"bytes":4208,"imports":[{"path":"node_modules/node-inspect-extracted/index.mjs","kind":"import-statement","original":"node-inspect-extracted"}],"format":"esm"},"node_modules/acorn/dist/acorn.mjs":{"bytes":234658,"imports":[],"format":"esm"},"src/runtime/esm/transform.mjs":{"bytes":25854,"imports":[{"path":"node_modules/acorn/dist/acorn.mjs","kind":"import-statement","original":"acorn"}],"format":"esm"},"src/runtime/path.mjs":{"bytes":4249,"imports":[],"format":"esm"},"src/runtime/builtins/assert.mjs":{"bytes":20298,"imports":[{"path":"node_modules/node-inspect-extracted/index.mjs","kind":"import-statement","original":"node-inspect-extracted"}],"format":"esm"},"src/runtime/builtins/events.mjs":{"bytes":2406,"imports":[],"format":"esm"},"src/runtime/builtins/fs.mjs":{"bytes":34553,"imports":[{"path":"src/runtime/async-handles.mjs","kind":"import-statement","original":"../async-handles.mjs"}],"format":"esm"},"src/runtime/builtins/http.mjs":{"bytes":30054,"imports":[{"path":"src/runtime/builtins/events.mjs","kind":"import-statement","original":"./events.mjs"}],"format":"esm"},"src/runtime/builtins/https.mjs":{"bytes":8217,"imports":[{"path":"src/runtime/async-handles.mjs","kind":"import-statement","original":"../async-handles.mjs"},{"path":"src/runtime/builtins/events.mjs","kind":"import-statement","original":"./events.mjs"}],"format":"esm"},"src/runtime/builtins/net.mjs":{"bytes":17353,"imports":[{"path":"src/runtime/async-handles.mjs","kind":"import-statement","original":"../async-handles.mjs"},{"path":"src/runtime/builtins/events.mjs","kind":"import-statement","original":"./events.mjs"}],"format":"esm"},"src/runtime/builtins/os.mjs":{"bytes":719,"imports":[],"format":"esm"},"src/runtime/builtins/querystring.mjs":{"bytes":1235,"imports":[],"format":"esm"},"src/runtime/vendor-load.mjs":{"bytes":1636,"imports":[],"format":"esm"},"src/runtime/builtins/stream.mjs":{"bytes":1263,"imports":[{"path":"src/runtime/async-handles.mjs","kind":"import-statement","original":"../async-handles.mjs"},{"path":"src/runtime/vendor-load.mjs","kind":"import-statement","original":"../vendor-load.mjs"}],"format":"esm"},"src/runtime/builtins/string-decoder.mjs":{"bytes":3885,"imports":[{"path":"src/runtime/vendor-load.mjs","kind":"import-statement","original":"../vendor-load.mjs"}],"format":"esm"},"src/runtime/builtins/timers-module.mjs":{"bytes":1138,"imports":[{"path":"src/runtime/async-handles.mjs","kind":"import-statement","original":"../async-handles.mjs"}],"format":"esm"},"src/runtime/builtins/url.mjs":{"bytes":1774,"imports":[],"format":"esm"},"src/runtime/cjs/builtins.mjs":{"bytes":4655,"imports":[{"path":"src/runtime/builtins/assert.mjs","kind":"import-statement","original":"../builtins/assert.mjs"},{"path":"src/runtime/builtins/events.mjs","kind":"import-statement","original":"../builtins/events.mjs"},{"path":"src/runtime/builtins/fs.mjs","kind":"import-statement","original":"../builtins/fs.mjs"},{"path":"src/runtime/builtins/http.mjs","kind":"import-statement","original":"../builtins/http.mjs"},{"path":"src/runtime/builtins/https.mjs","kind":"import-statement","original":"../builtins/https.mjs"},{"path":"src/runtime/builtins/net.mjs","kind":"import-statement","original":"../builtins/net.mjs"},{"path":"src/runtime/builtins/os.mjs","kind":"import-statement","original":"../builtins/os.mjs"},{"path":"src/runtime/builtins/querystring.mjs","kind":"import-statement","original":"../builtins/querystring.mjs"},{"path":"src/runtime/builtins/stream.mjs","kind":"import-statement","original":"../builtins/stream.mjs"},{"path":"src/runtime/builtins/string-decoder.mjs","kind":"import-statement","original":"../builtins/string-decoder.mjs"},{"path":"src/runtime/builtins/timers-module.mjs","kind":"import-statement","original":"../builtins/timers-module.mjs"},{"path":"src/runtime/builtins/url.mjs","kind":"import-statement","original":"../builtins/url.mjs"},{"path":"src/runtime/builtins/util.mjs","kind":"import-statement","original":"../builtins/util.mjs"}],"format":"esm"},"src/runtime/cjs/errors.mjs":{"bytes":882,"imports":[],"format":"esm"},"src/runtime/cjs/resolve.mjs":{"bytes":9966,"imports":[{"path":"src/runtime/cjs/errors.mjs","kind":"import-statement","original":"./errors.mjs"}],"format":"esm"},"src/runtime/cjs/loader.mjs":{"bytes":13441,"imports":[{"path":"src/runtime/esm/transform.mjs","kind":"import-statement","original":"../esm/transform.mjs"},{"path":"src/runtime/path.mjs","kind":"import-statement","original":"../path.mjs"},{"path":"src/runtime/cjs/builtins.mjs","kind":"import-statement","original":"./builtins.mjs"},{"path":"src/runtime/cjs/resolve.mjs","kind":"import-statement","original":"./resolve.mjs"}],"format":"esm"},"src/runtime/cli.mjs":{"bytes":2291,"imports":[],"format":"esm"},"src/runtime/console.mjs":{"bytes":4413,"imports":[],"format":"esm"},"src/runtime/esm/loader.mjs":{"bytes":13249,"imports":[{"path":"src/runtime/path.mjs","kind":"import-statement","original":"../path.mjs"},{"path":"src/runtime/cjs/resolve.mjs","kind":"import-statement","original":"../cjs/resolve.mjs"},{"path":"src/runtime/esm/transform.mjs","kind":"import-statement","original":"./transform.mjs"}],"format":"esm"},"src/runtime/stack.mjs":{"bytes":8404,"imports":[],"format":"esm"},"src/runtime/errors-format.mjs":{"bytes":11779,"imports":[{"path":"src/runtime/stack.mjs","kind":"import-statement","original":"./stack.mjs"}],"format":"esm"},"src/runtime/handles.mjs":{"bytes":800,"imports":[],"format":"esm"},"src/runtime/next-tick.mjs":{"bytes":1268,"imports":[],"format":"esm"},"src/runtime/process.mjs":{"bytes":11306,"imports":[{"path":"src/runtime/builtins/events.mjs","kind":"import-statement","original":"./builtins/events.mjs"},{"path":"src/runtime/exit.mjs","kind":"import-statement","original":"./exit.mjs"}],"format":"esm"},"src/runtime/timers.mjs":{"bytes":3775,"imports":[],"format":"esm"},"src/runtime/web/fetch.mjs":{"bytes":443,"imports":[],"format":"esm"},"src/runtime/web/websocket.mjs":{"bytes":9530,"imports":[{"path":"src/runtime/exit.mjs","kind":"import-statement","original":"../exit.mjs"}],"format":"esm"},"src/runtime/run.mjs":{"bytes":17936,"imports":[{"path":"src/jsh/kernel.mjs","kind":"import-statement","original":"../jsh/kernel.mjs"},{"path":"src/runtime/async-handles.mjs","kind":"import-statement","original":"./async-handles.mjs"},{"path":"src/runtime/buffer.mjs","kind":"import-statement","original":"./buffer.mjs"},{"path":"src/runtime/builtins/util.mjs","kind":"import-statement","original":"./builtins/util.mjs"},{"path":"src/runtime/cjs/loader.mjs","kind":"import-statement","original":"./cjs/loader.mjs"},{"path":"src/runtime/cli.mjs","kind":"import-statement","original":"./cli.mjs"},{"path":"src/runtime/console.mjs","kind":"import-statement","original":"./console.mjs"},{"path":"src/runtime/esm/loader.mjs","kind":"import-statement","original":"./esm/loader.mjs"},{"path":"src/runtime/esm/transform.mjs","kind":"import-statement","original":"./esm/transform.mjs"},{"path":"src/runtime/errors-format.mjs","kind":"import-statement","original":"./errors-format.mjs"},{"path":"src/runtime/exit.mjs","kind":"import-statement","original":"./exit.mjs"},{"path":"src/runtime/handles.mjs","kind":"import-statement","original":"./handles.mjs"},{"path":"src/runtime/next-tick.mjs","kind":"import-statement","original":"./next-tick.mjs"},{"path":"src/runtime/process.mjs","kind":"import-statement","original":"./process.mjs"},{"path":"src/runtime/stack.mjs","kind":"import-statement","original":"./stack.mjs"},{"path":"src/runtime/timers.mjs","kind":"import-statement","original":"./timers.mjs"},{"path":"src/runtime/web/fetch.mjs","kind":"import-statement","original":"./web/fetch.mjs"},{"path":"src/runtime/web/websocket.mjs","kind":"import-statement","original":"./web/websocket.mjs"}],"format":"esm"},"src/node.mjs":{"bytes":233,"imports":[{"path":"src/runtime/run.mjs","kind":"import-statement","original":"./runtime/run.mjs"}],"format":"esm"},"src/jsh.mjs":{"bytes":1273,"imports":[{"path":"src/jsh/kernel.mjs","kind":"import-statement","original":"./jsh/kernel.mjs"},{"path":"src/jsh/run.mjs","kind":"import-statement","original":"./jsh/run.mjs"},{"path":"src/runtime/run.mjs","kind":"import-statement","original":"./runtime/run.mjs"}],"format":"esm"}},"outputs":{"dist/node.mjs":{"imports":[],"exports":["default"],"entryPoint":"src/node.mjs","inputs":{"node_modules/node-inspect-extracted/dist/inspect.js":{"bytesInOutput":86401},"src/runtime/exit.mjs":{"bytesInOutput":1573},"package.json":{"bytesInOutput":2466},"src/jsh/parse-flags.mjs":{"bytesInOutput":1558},"src/jsh/sliccy/exec.mjs":{"bytesInOutput":4077},"src/jsh/sliccy/http.mjs":{"bytesInOutput":5497},"src/jsh/sliccy/pure.mjs":{"bytesInOutput":6246},"src/jsh/sliccy/index.mjs":{"bytesInOutput":2229},"src/jsh/run.mjs":{"bytesInOutput":2930},"src/jsh/kernel.mjs":{"bytesInOutput":4606},"src/runtime/async-handles.mjs":{"bytesInOutput":1156},"src/runtime/buffer.mjs":{"bytesInOutput":36834},"node_modules/node-inspect-extracted/index.mjs":{"bytesInOutput":387},"src/runtime/builtins/util.mjs":{"bytesInOutput":3726},"node_modules/acorn/dist/acorn.mjs":{"bytesInOutput":203908},"src/runtime/esm/transform.mjs":{"bytesInOutput":20720},"src/runtime/path.mjs":{"bytesInOutput":4196},"src/runtime/builtins/assert.mjs":{"bytesInOutput":19383},"src/runtime/builtins/events.mjs":{"bytesInOutput":2336},"src/runtime/builtins/fs.mjs":{"bytesInOutput":32990},"src/runtime/builtins/http.mjs":{"bytesInOutput":27190},"src/runtime/builtins/https.mjs":{"bytesInOutput":7337},"src/runtime/builtins/net.mjs":{"bytesInOutput":14529},"src/runtime/builtins/os.mjs":{"bytesInOutput":648},"src/runtime/builtins/querystring.mjs":{"bytesInOutput":1197},"src/runtime/vendor-load.mjs":{"bytesInOutput":1158},"src/runtime/builtins/stream.mjs":{"bytesInOutput":1116},"src/runtime/builtins/string-decoder.mjs":{"bytesInOutput":3195},"src/runtime/builtins/timers-module.mjs":{"bytesInOutput":969},"src/runtime/builtins/url.mjs":{"bytesInOutput":1697},"src/runtime/cjs/builtins.mjs":{"bytesInOutput":3893},"src/runtime/cjs/errors.mjs":{"bytesInOutput":574},"src/runtime/cjs/resolve.mjs":{"bytesInOutput":8866},"src/runtime/cjs/loader.mjs":{"bytesInOutput":11203},"src/runtime/cli.mjs":{"bytesInOutput":2165},"src/runtime/console.mjs":{"bytesInOutput":4414},"src/runtime/esm/loader.mjs":{"bytesInOutput":11287},"src/runtime/stack.mjs":{"bytesInOutput":6887},"src/runtime/errors-format.mjs":{"bytesInOutput":9795},"src/runtime/handles.mjs":{"bytesInOutput":688},"src/runtime/next-tick.mjs":{"bytesInOutput":900},"src/runtime/process.mjs":{"bytesInOutput":10735},"src/runtime/timers.mjs":{"bytesInOutput":3529},"src/runtime/web/fetch.mjs":{"bytesInOutput":358},"src/runtime/web/websocket.mjs":{"bytesInOutput":8204},"src/runtime/run.mjs":{"bytesInOutput":13844},"src/node.mjs":{"bytesInOutput":52}},"bytes":602530},"dist/jsh.mjs":{"imports":[],"exports":["default"],"entryPoint":"src/jsh.mjs","inputs":{"node_modules/node-inspect-extracted/dist/inspect.js":{"bytesInOutput":86401},"src/runtime/exit.mjs":{"bytesInOutput":1573},"package.json":{"bytesInOutput":2466},"src/jsh/parse-flags.mjs":{"bytesInOutput":1558},"src/jsh/sliccy/exec.mjs":{"bytesInOutput":4077},"src/jsh/sliccy/http.mjs":{"bytesInOutput":5497},"src/jsh/sliccy/pure.mjs":{"bytesInOutput":6246},"src/jsh/sliccy/index.mjs":{"bytesInOutput":2229},"src/jsh/run.mjs":{"bytesInOutput":2930},"src/jsh/kernel.mjs":{"bytesInOutput":4606},"src/runtime/async-handles.mjs":{"bytesInOutput":1156},"src/runtime/buffer.mjs":{"bytesInOutput":36834},"node_modules/node-inspect-extracted/index.mjs":{"bytesInOutput":387},"src/runtime/builtins/util.mjs":{"bytesInOutput":3726},"node_modules/acorn/dist/acorn.mjs":{"bytesInOutput":203908},"src/runtime/esm/transform.mjs":{"bytesInOutput":20720},"src/runtime/path.mjs":{"bytesInOutput":4196},"src/runtime/builtins/assert.mjs":{"bytesInOutput":19383},"src/runtime/builtins/events.mjs":{"bytesInOutput":2336},"src/runtime/builtins/fs.mjs":{"bytesInOutput":32990},"src/runtime/builtins/http.mjs":{"bytesInOutput":27190},"src/runtime/builtins/https.mjs":{"bytesInOutput":7337},"src/runtime/builtins/net.mjs":{"bytesInOutput":14529},"src/runtime/builtins/os.mjs":{"bytesInOutput":648},"src/runtime/builtins/querystring.mjs":{"bytesInOutput":1197},"src/runtime/vendor-load.mjs":{"bytesInOutput":1158},"src/runtime/builtins/stream.mjs":{"bytesInOutput":1116},"src/runtime/builtins/string-decoder.mjs":{"bytesInOutput":3195},"src/runtime/builtins/timers-module.mjs":{"bytesInOutput":969},"src/runtime/builtins/url.mjs":{"bytesInOutput":1697},"src/runtime/cjs/builtins.mjs":{"bytesInOutput":3893},"src/runtime/cjs/errors.mjs":{"bytesInOutput":574},"src/runtime/cjs/resolve.mjs":{"bytesInOutput":8866},"src/runtime/cjs/loader.mjs":{"bytesInOutput":11203},"src/runtime/cli.mjs":{"bytesInOutput":2165},"src/runtime/console.mjs":{"bytesInOutput":4414},"src/runtime/esm/loader.mjs":{"bytesInOutput":11287},"src/runtime/stack.mjs":{"bytesInOutput":6887},"src/runtime/errors-format.mjs":{"bytesInOutput":9795},"src/runtime/handles.mjs":{"bytesInOutput":688},"src/runtime/next-tick.mjs":{"bytesInOutput":900},"src/runtime/process.mjs":{"bytesInOutput":10735},"src/runtime/timers.mjs":{"bytesInOutput":3529},"src/runtime/web/fetch.mjs":{"bytesInOutput":358},"src/runtime/web/websocket.mjs":{"bytesInOutput":8204},"src/runtime/run.mjs":{"bytesInOutput":13844},"src/jsh.mjs":{"bytesInOutput":761}},"bytes":603238}}}
|
|
1
|
+
{"inputs":{"src/runtime/exit.mjs":{"bytes":1670,"imports":[],"format":"esm"},"package.json":{"bytes":2541,"imports":[],"format":"esm","with":{"type":"json"}},"src/jsh/parse-flags.mjs":{"bytes":1829,"imports":[],"format":"esm"},"src/jsh/sliccy/exec.mjs":{"bytes":4790,"imports":[],"format":"esm"},"src/jsh/sliccy/http.mjs":{"bytes":5865,"imports":[],"format":"esm"},"src/jsh/sliccy/pure.mjs":{"bytes":7087,"imports":[],"format":"esm"},"src/jsh/sliccy/index.mjs":{"bytes":2910,"imports":[{"path":"src/jsh/sliccy/exec.mjs","kind":"import-statement","original":"./exec.mjs"},{"path":"src/jsh/sliccy/http.mjs","kind":"import-statement","original":"./http.mjs"},{"path":"src/jsh/sliccy/pure.mjs","kind":"import-statement","original":"./pure.mjs"}],"format":"esm"},"src/jsh/run.mjs":{"bytes":4655,"imports":[{"path":"package.json","kind":"import-statement","original":"../../package.json","with":{"type":"json"}},{"path":"src/jsh/parse-flags.mjs","kind":"import-statement","original":"./parse-flags.mjs"},{"path":"src/jsh/sliccy/index.mjs","kind":"import-statement","original":"./sliccy/index.mjs"}],"format":"esm"},"src/jsh/kernel.mjs":{"bytes":5909,"imports":[{"path":"src/runtime/exit.mjs","kind":"import-statement","original":"../runtime/exit.mjs"},{"path":"src/jsh/run.mjs","kind":"import-statement","original":"./run.mjs"}],"format":"esm"},"src/runtime/async-handles.mjs":{"bytes":2272,"imports":[],"format":"esm"},"src/runtime/buffer.mjs":{"bytes":37245,"imports":[],"format":"esm"},"node_modules/node-inspect-extracted/dist/inspect.js":{"bytes":51340,"imports":[],"format":"cjs"},"node_modules/node-inspect-extracted/index.mjs":{"bytes":380,"imports":[{"path":"node_modules/node-inspect-extracted/dist/inspect.js","kind":"import-statement","original":"./dist/inspect.js"}],"format":"esm"},"src/runtime/builtins/util.mjs":{"bytes":4208,"imports":[{"path":"node_modules/node-inspect-extracted/index.mjs","kind":"import-statement","original":"node-inspect-extracted"}],"format":"esm"},"node_modules/acorn/dist/acorn.mjs":{"bytes":234658,"imports":[],"format":"esm"},"src/runtime/esm/transform.mjs":{"bytes":25854,"imports":[{"path":"node_modules/acorn/dist/acorn.mjs","kind":"import-statement","original":"acorn"}],"format":"esm"},"src/runtime/path.mjs":{"bytes":4249,"imports":[],"format":"esm"},"src/runtime/builtins/assert.mjs":{"bytes":20298,"imports":[{"path":"node_modules/node-inspect-extracted/index.mjs","kind":"import-statement","original":"node-inspect-extracted"}],"format":"esm"},"src/runtime/builtins/events.mjs":{"bytes":2406,"imports":[],"format":"esm"},"src/runtime/builtins/child-process.mjs":{"bytes":13534,"imports":[{"path":"src/runtime/async-handles.mjs","kind":"import-statement","original":"../async-handles.mjs"},{"path":"src/runtime/builtins/events.mjs","kind":"import-statement","original":"./events.mjs"}],"format":"esm"},"src/runtime/builtins/fs.mjs":{"bytes":35102,"imports":[{"path":"src/runtime/async-handles.mjs","kind":"import-statement","original":"../async-handles.mjs"}],"format":"esm"},"src/runtime/builtins/http.mjs":{"bytes":30054,"imports":[{"path":"src/runtime/builtins/events.mjs","kind":"import-statement","original":"./events.mjs"}],"format":"esm"},"src/runtime/builtins/https.mjs":{"bytes":8217,"imports":[{"path":"src/runtime/async-handles.mjs","kind":"import-statement","original":"../async-handles.mjs"},{"path":"src/runtime/builtins/events.mjs","kind":"import-statement","original":"./events.mjs"}],"format":"esm"},"src/runtime/builtins/net.mjs":{"bytes":17353,"imports":[{"path":"src/runtime/async-handles.mjs","kind":"import-statement","original":"../async-handles.mjs"},{"path":"src/runtime/builtins/events.mjs","kind":"import-statement","original":"./events.mjs"}],"format":"esm"},"src/runtime/builtins/os.mjs":{"bytes":719,"imports":[],"format":"esm"},"src/runtime/builtins/querystring.mjs":{"bytes":1235,"imports":[],"format":"esm"},"src/runtime/vendor-load.mjs":{"bytes":1636,"imports":[],"format":"esm"},"src/runtime/builtins/stream.mjs":{"bytes":1263,"imports":[{"path":"src/runtime/async-handles.mjs","kind":"import-statement","original":"../async-handles.mjs"},{"path":"src/runtime/vendor-load.mjs","kind":"import-statement","original":"../vendor-load.mjs"}],"format":"esm"},"src/runtime/builtins/string-decoder.mjs":{"bytes":3885,"imports":[{"path":"src/runtime/vendor-load.mjs","kind":"import-statement","original":"../vendor-load.mjs"}],"format":"esm"},"src/runtime/builtins/timers-module.mjs":{"bytes":1138,"imports":[{"path":"src/runtime/async-handles.mjs","kind":"import-statement","original":"../async-handles.mjs"}],"format":"esm"},"src/runtime/builtins/url.mjs":{"bytes":1774,"imports":[],"format":"esm"},"src/runtime/cjs/builtins.mjs":{"bytes":4969,"imports":[{"path":"src/runtime/builtins/assert.mjs","kind":"import-statement","original":"../builtins/assert.mjs"},{"path":"src/runtime/builtins/child-process.mjs","kind":"import-statement","original":"../builtins/child-process.mjs"},{"path":"src/runtime/builtins/events.mjs","kind":"import-statement","original":"../builtins/events.mjs"},{"path":"src/runtime/builtins/fs.mjs","kind":"import-statement","original":"../builtins/fs.mjs"},{"path":"src/runtime/builtins/http.mjs","kind":"import-statement","original":"../builtins/http.mjs"},{"path":"src/runtime/builtins/https.mjs","kind":"import-statement","original":"../builtins/https.mjs"},{"path":"src/runtime/builtins/net.mjs","kind":"import-statement","original":"../builtins/net.mjs"},{"path":"src/runtime/builtins/os.mjs","kind":"import-statement","original":"../builtins/os.mjs"},{"path":"src/runtime/builtins/querystring.mjs","kind":"import-statement","original":"../builtins/querystring.mjs"},{"path":"src/runtime/builtins/stream.mjs","kind":"import-statement","original":"../builtins/stream.mjs"},{"path":"src/runtime/builtins/string-decoder.mjs","kind":"import-statement","original":"../builtins/string-decoder.mjs"},{"path":"src/runtime/builtins/timers-module.mjs","kind":"import-statement","original":"../builtins/timers-module.mjs"},{"path":"src/runtime/builtins/url.mjs","kind":"import-statement","original":"../builtins/url.mjs"},{"path":"src/runtime/builtins/util.mjs","kind":"import-statement","original":"../builtins/util.mjs"}],"format":"esm"},"src/runtime/cjs/errors.mjs":{"bytes":882,"imports":[],"format":"esm"},"src/runtime/cjs/resolve.mjs":{"bytes":9966,"imports":[{"path":"src/runtime/cjs/errors.mjs","kind":"import-statement","original":"./errors.mjs"}],"format":"esm"},"src/runtime/cjs/loader.mjs":{"bytes":13441,"imports":[{"path":"src/runtime/esm/transform.mjs","kind":"import-statement","original":"../esm/transform.mjs"},{"path":"src/runtime/path.mjs","kind":"import-statement","original":"../path.mjs"},{"path":"src/runtime/cjs/builtins.mjs","kind":"import-statement","original":"./builtins.mjs"},{"path":"src/runtime/cjs/resolve.mjs","kind":"import-statement","original":"./resolve.mjs"}],"format":"esm"},"src/runtime/cli.mjs":{"bytes":2291,"imports":[],"format":"esm"},"src/runtime/console.mjs":{"bytes":4413,"imports":[],"format":"esm"},"src/runtime/esm/loader.mjs":{"bytes":13249,"imports":[{"path":"src/runtime/path.mjs","kind":"import-statement","original":"../path.mjs"},{"path":"src/runtime/cjs/resolve.mjs","kind":"import-statement","original":"../cjs/resolve.mjs"},{"path":"src/runtime/esm/transform.mjs","kind":"import-statement","original":"./transform.mjs"}],"format":"esm"},"src/runtime/stack.mjs":{"bytes":8404,"imports":[],"format":"esm"},"src/runtime/errors-format.mjs":{"bytes":11779,"imports":[{"path":"src/runtime/stack.mjs","kind":"import-statement","original":"./stack.mjs"}],"format":"esm"},"src/runtime/handles.mjs":{"bytes":800,"imports":[],"format":"esm"},"src/runtime/next-tick.mjs":{"bytes":1268,"imports":[],"format":"esm"},"src/runtime/process.mjs":{"bytes":12375,"imports":[{"path":"src/runtime/builtins/events.mjs","kind":"import-statement","original":"./builtins/events.mjs"},{"path":"src/runtime/exit.mjs","kind":"import-statement","original":"./exit.mjs"}],"format":"esm"},"src/runtime/timers.mjs":{"bytes":3775,"imports":[],"format":"esm"},"src/runtime/web/fetch.mjs":{"bytes":443,"imports":[],"format":"esm"},"src/runtime/web/websocket.mjs":{"bytes":9530,"imports":[{"path":"src/runtime/exit.mjs","kind":"import-statement","original":"../exit.mjs"}],"format":"esm"},"src/runtime/run.mjs":{"bytes":17936,"imports":[{"path":"src/jsh/kernel.mjs","kind":"import-statement","original":"../jsh/kernel.mjs"},{"path":"src/runtime/async-handles.mjs","kind":"import-statement","original":"./async-handles.mjs"},{"path":"src/runtime/buffer.mjs","kind":"import-statement","original":"./buffer.mjs"},{"path":"src/runtime/builtins/util.mjs","kind":"import-statement","original":"./builtins/util.mjs"},{"path":"src/runtime/cjs/loader.mjs","kind":"import-statement","original":"./cjs/loader.mjs"},{"path":"src/runtime/cli.mjs","kind":"import-statement","original":"./cli.mjs"},{"path":"src/runtime/console.mjs","kind":"import-statement","original":"./console.mjs"},{"path":"src/runtime/esm/loader.mjs","kind":"import-statement","original":"./esm/loader.mjs"},{"path":"src/runtime/esm/transform.mjs","kind":"import-statement","original":"./esm/transform.mjs"},{"path":"src/runtime/errors-format.mjs","kind":"import-statement","original":"./errors-format.mjs"},{"path":"src/runtime/exit.mjs","kind":"import-statement","original":"./exit.mjs"},{"path":"src/runtime/handles.mjs","kind":"import-statement","original":"./handles.mjs"},{"path":"src/runtime/next-tick.mjs","kind":"import-statement","original":"./next-tick.mjs"},{"path":"src/runtime/process.mjs","kind":"import-statement","original":"./process.mjs"},{"path":"src/runtime/stack.mjs","kind":"import-statement","original":"./stack.mjs"},{"path":"src/runtime/timers.mjs","kind":"import-statement","original":"./timers.mjs"},{"path":"src/runtime/web/fetch.mjs","kind":"import-statement","original":"./web/fetch.mjs"},{"path":"src/runtime/web/websocket.mjs","kind":"import-statement","original":"./web/websocket.mjs"}],"format":"esm"},"src/node.mjs":{"bytes":233,"imports":[{"path":"src/runtime/run.mjs","kind":"import-statement","original":"./runtime/run.mjs"}],"format":"esm"},"src/jsh.mjs":{"bytes":1273,"imports":[{"path":"src/jsh/kernel.mjs","kind":"import-statement","original":"./jsh/kernel.mjs"},{"path":"src/jsh/run.mjs","kind":"import-statement","original":"./jsh/run.mjs"},{"path":"src/runtime/run.mjs","kind":"import-statement","original":"./runtime/run.mjs"}],"format":"esm"}},"outputs":{"dist/node.mjs":{"imports":[],"exports":["default"],"entryPoint":"src/node.mjs","inputs":{"node_modules/node-inspect-extracted/dist/inspect.js":{"bytesInOutput":86401},"src/runtime/exit.mjs":{"bytesInOutput":1573},"package.json":{"bytesInOutput":2466},"src/jsh/parse-flags.mjs":{"bytesInOutput":1558},"src/jsh/sliccy/exec.mjs":{"bytesInOutput":4077},"src/jsh/sliccy/http.mjs":{"bytesInOutput":5497},"src/jsh/sliccy/pure.mjs":{"bytesInOutput":6246},"src/jsh/sliccy/index.mjs":{"bytesInOutput":2229},"src/jsh/run.mjs":{"bytesInOutput":2930},"src/jsh/kernel.mjs":{"bytesInOutput":4606},"src/runtime/async-handles.mjs":{"bytesInOutput":1156},"src/runtime/buffer.mjs":{"bytesInOutput":36834},"node_modules/node-inspect-extracted/index.mjs":{"bytesInOutput":387},"src/runtime/builtins/util.mjs":{"bytesInOutput":3726},"node_modules/acorn/dist/acorn.mjs":{"bytesInOutput":203908},"src/runtime/esm/transform.mjs":{"bytesInOutput":20720},"src/runtime/path.mjs":{"bytesInOutput":4196},"src/runtime/builtins/assert.mjs":{"bytesInOutput":19383},"src/runtime/builtins/events.mjs":{"bytesInOutput":2336},"src/runtime/builtins/child-process.mjs":{"bytesInOutput":12707},"src/runtime/builtins/fs.mjs":{"bytesInOutput":33539},"src/runtime/builtins/http.mjs":{"bytesInOutput":27190},"src/runtime/builtins/https.mjs":{"bytesInOutput":7341},"src/runtime/builtins/net.mjs":{"bytesInOutput":14529},"src/runtime/builtins/os.mjs":{"bytesInOutput":648},"src/runtime/builtins/querystring.mjs":{"bytesInOutput":1197},"src/runtime/vendor-load.mjs":{"bytesInOutput":1158},"src/runtime/builtins/stream.mjs":{"bytesInOutput":1116},"src/runtime/builtins/string-decoder.mjs":{"bytesInOutput":3195},"src/runtime/builtins/timers-module.mjs":{"bytesInOutput":969},"src/runtime/builtins/url.mjs":{"bytesInOutput":1697},"src/runtime/cjs/builtins.mjs":{"bytesInOutput":4158},"src/runtime/cjs/errors.mjs":{"bytesInOutput":574},"src/runtime/cjs/resolve.mjs":{"bytesInOutput":8866},"src/runtime/cjs/loader.mjs":{"bytesInOutput":11203},"src/runtime/cli.mjs":{"bytesInOutput":2165},"src/runtime/console.mjs":{"bytesInOutput":4414},"src/runtime/esm/loader.mjs":{"bytesInOutput":11287},"src/runtime/stack.mjs":{"bytesInOutput":6887},"src/runtime/errors-format.mjs":{"bytesInOutput":9795},"src/runtime/handles.mjs":{"bytesInOutput":688},"src/runtime/next-tick.mjs":{"bytesInOutput":900},"src/runtime/process.mjs":{"bytesInOutput":11718},"src/runtime/timers.mjs":{"bytesInOutput":3529},"src/runtime/web/fetch.mjs":{"bytesInOutput":358},"src/runtime/web/websocket.mjs":{"bytesInOutput":8204},"src/runtime/run.mjs":{"bytesInOutput":13844},"src/node.mjs":{"bytesInOutput":52}},"bytes":617081},"dist/jsh.mjs":{"imports":[],"exports":["default"],"entryPoint":"src/jsh.mjs","inputs":{"node_modules/node-inspect-extracted/dist/inspect.js":{"bytesInOutput":86401},"src/runtime/exit.mjs":{"bytesInOutput":1573},"package.json":{"bytesInOutput":2466},"src/jsh/parse-flags.mjs":{"bytesInOutput":1558},"src/jsh/sliccy/exec.mjs":{"bytesInOutput":4077},"src/jsh/sliccy/http.mjs":{"bytesInOutput":5497},"src/jsh/sliccy/pure.mjs":{"bytesInOutput":6246},"src/jsh/sliccy/index.mjs":{"bytesInOutput":2229},"src/jsh/run.mjs":{"bytesInOutput":2930},"src/jsh/kernel.mjs":{"bytesInOutput":4606},"src/runtime/async-handles.mjs":{"bytesInOutput":1156},"src/runtime/buffer.mjs":{"bytesInOutput":36834},"node_modules/node-inspect-extracted/index.mjs":{"bytesInOutput":387},"src/runtime/builtins/util.mjs":{"bytesInOutput":3726},"node_modules/acorn/dist/acorn.mjs":{"bytesInOutput":203908},"src/runtime/esm/transform.mjs":{"bytesInOutput":20720},"src/runtime/path.mjs":{"bytesInOutput":4196},"src/runtime/builtins/assert.mjs":{"bytesInOutput":19383},"src/runtime/builtins/events.mjs":{"bytesInOutput":2336},"src/runtime/builtins/child-process.mjs":{"bytesInOutput":12707},"src/runtime/builtins/fs.mjs":{"bytesInOutput":33539},"src/runtime/builtins/http.mjs":{"bytesInOutput":27190},"src/runtime/builtins/https.mjs":{"bytesInOutput":7341},"src/runtime/builtins/net.mjs":{"bytesInOutput":14529},"src/runtime/builtins/os.mjs":{"bytesInOutput":648},"src/runtime/builtins/querystring.mjs":{"bytesInOutput":1197},"src/runtime/vendor-load.mjs":{"bytesInOutput":1158},"src/runtime/builtins/stream.mjs":{"bytesInOutput":1116},"src/runtime/builtins/string-decoder.mjs":{"bytesInOutput":3195},"src/runtime/builtins/timers-module.mjs":{"bytesInOutput":969},"src/runtime/builtins/url.mjs":{"bytesInOutput":1697},"src/runtime/cjs/builtins.mjs":{"bytesInOutput":4158},"src/runtime/cjs/errors.mjs":{"bytesInOutput":574},"src/runtime/cjs/resolve.mjs":{"bytesInOutput":8866},"src/runtime/cjs/loader.mjs":{"bytesInOutput":11203},"src/runtime/cli.mjs":{"bytesInOutput":2165},"src/runtime/console.mjs":{"bytesInOutput":4414},"src/runtime/esm/loader.mjs":{"bytesInOutput":11287},"src/runtime/stack.mjs":{"bytesInOutput":6887},"src/runtime/errors-format.mjs":{"bytesInOutput":9795},"src/runtime/handles.mjs":{"bytesInOutput":688},"src/runtime/next-tick.mjs":{"bytesInOutput":900},"src/runtime/process.mjs":{"bytesInOutput":11718},"src/runtime/timers.mjs":{"bytesInOutput":3529},"src/runtime/web/fetch.mjs":{"bytesInOutput":358},"src/runtime/web/websocket.mjs":{"bytesInOutput":8204},"src/runtime/run.mjs":{"bytesInOutput":13844},"src/jsh.mjs":{"bytesInOutput":761}},"bytes":617789}}}
|
package/dist/node.mjs
CHANGED
|
@@ -1585,7 +1585,7 @@ function assignProcessExitCode(value) {
|
|
|
1585
1585
|
// package.json
|
|
1586
1586
|
var package_default = {
|
|
1587
1587
|
name: "@ai-ecoverse/slicc-jsh",
|
|
1588
|
-
version: "0.
|
|
1588
|
+
version: "0.3.0",
|
|
1589
1589
|
description: "Node.js-compatible runtime for slicc-kernel: the node and jsh commands (abi: js)",
|
|
1590
1590
|
type: "module",
|
|
1591
1591
|
license: "Apache-2.0",
|
|
@@ -10793,6 +10793,415 @@ function createEvents() {
|
|
|
10793
10793
|
});
|
|
10794
10794
|
}
|
|
10795
10795
|
|
|
10796
|
+
// src/runtime/builtins/child-process.mjs
|
|
10797
|
+
var SIGNAL_NAMES = {
|
|
10798
|
+
1: "SIGHUP",
|
|
10799
|
+
2: "SIGINT",
|
|
10800
|
+
3: "SIGQUIT",
|
|
10801
|
+
6: "SIGABRT",
|
|
10802
|
+
9: "SIGKILL",
|
|
10803
|
+
10: "SIGUSR1",
|
|
10804
|
+
12: "SIGUSR2",
|
|
10805
|
+
13: "SIGPIPE",
|
|
10806
|
+
14: "SIGALRM",
|
|
10807
|
+
15: "SIGTERM",
|
|
10808
|
+
17: "SIGCHLD",
|
|
10809
|
+
18: "SIGCONT",
|
|
10810
|
+
19: "SIGSTOP",
|
|
10811
|
+
20: "SIGTSTP"
|
|
10812
|
+
};
|
|
10813
|
+
var SIGNAL_NUMBERS = Object.fromEntries(
|
|
10814
|
+
Object.entries(SIGNAL_NAMES).map(([n, name]) => [name, Number(n)])
|
|
10815
|
+
);
|
|
10816
|
+
function notSupported(name) {
|
|
10817
|
+
const err = new Error(`slicc-jsh: child_process.${name} is not supported yet`);
|
|
10818
|
+
err.code = "ERR_NOT_SUPPORTED";
|
|
10819
|
+
throw err;
|
|
10820
|
+
}
|
|
10821
|
+
function normalizeArgs(file, args, options, callback) {
|
|
10822
|
+
if (typeof args === "function") {
|
|
10823
|
+
return { args: [], options: {}, callback: args };
|
|
10824
|
+
}
|
|
10825
|
+
if (typeof options === "function") {
|
|
10826
|
+
return { args: Array.isArray(args) ? args : [], options: {}, callback: options };
|
|
10827
|
+
}
|
|
10828
|
+
if (args != null && !Array.isArray(args) && typeof args === "object") {
|
|
10829
|
+
return { args: [], options: args, callback: typeof options === "function" ? options : callback };
|
|
10830
|
+
}
|
|
10831
|
+
return {
|
|
10832
|
+
args: Array.isArray(args) ? args.map(String) : [],
|
|
10833
|
+
options: options && typeof options === "object" ? options : {},
|
|
10834
|
+
callback: typeof callback === "function" ? callback : void 0
|
|
10835
|
+
};
|
|
10836
|
+
}
|
|
10837
|
+
function normalizeStdio(stdio) {
|
|
10838
|
+
if (stdio === void 0) return ["pipe", "pipe", "pipe"];
|
|
10839
|
+
if (typeof stdio === "string") return [stdio, stdio, stdio];
|
|
10840
|
+
if (Array.isArray(stdio)) {
|
|
10841
|
+
return [stdio[0] ?? "pipe", stdio[1] ?? "pipe", stdio[2] ?? "pipe"];
|
|
10842
|
+
}
|
|
10843
|
+
return ["pipe", "pipe", "pipe"];
|
|
10844
|
+
}
|
|
10845
|
+
function toKernelStdio(mode) {
|
|
10846
|
+
if (mode === "pipe" || mode === "overlapped") return "pipe";
|
|
10847
|
+
if (mode === "ignore" || mode === null || mode === void 0 || mode === "null") return "null";
|
|
10848
|
+
if (mode === "inherit") return "inherit";
|
|
10849
|
+
if (typeof mode === "number") return mode;
|
|
10850
|
+
const err = new Error(`The argument 'stdio' is invalid. Received ${String(mode)}`);
|
|
10851
|
+
err.code = "ERR_INVALID_ARG_VALUE";
|
|
10852
|
+
throw err;
|
|
10853
|
+
}
|
|
10854
|
+
function signalName(sig) {
|
|
10855
|
+
if (sig == null) return null;
|
|
10856
|
+
if (typeof sig === "string") return sig.startsWith("SIG") ? sig : `SIG${sig}`;
|
|
10857
|
+
if (typeof sig === "number") return SIGNAL_NAMES[sig] ?? String(sig);
|
|
10858
|
+
return null;
|
|
10859
|
+
}
|
|
10860
|
+
function spawnError(command, args, code, message) {
|
|
10861
|
+
const err = new Error(message ?? `spawn ${command} ${code}`);
|
|
10862
|
+
err.code = code;
|
|
10863
|
+
err.errno = code === "ENOENT" ? -2 : void 0;
|
|
10864
|
+
err.syscall = "spawn";
|
|
10865
|
+
err.path = command;
|
|
10866
|
+
err.spawnargs = args;
|
|
10867
|
+
return err;
|
|
10868
|
+
}
|
|
10869
|
+
function createChildProcess({ ctx, process: process2, Buffer: Buffer2, handles, getStream }) {
|
|
10870
|
+
class ChildProcess extends EventEmitter {
|
|
10871
|
+
constructor() {
|
|
10872
|
+
super();
|
|
10873
|
+
this.stdin = null;
|
|
10874
|
+
this.stdout = null;
|
|
10875
|
+
this.stderr = null;
|
|
10876
|
+
this.pid = void 0;
|
|
10877
|
+
this.exitCode = null;
|
|
10878
|
+
this.signalCode = null;
|
|
10879
|
+
this.killed = false;
|
|
10880
|
+
this.connected = false;
|
|
10881
|
+
this.spawnfile = "";
|
|
10882
|
+
this.spawnargs = [];
|
|
10883
|
+
this.#kernel = null;
|
|
10884
|
+
this.#handle = null;
|
|
10885
|
+
this.#closing = false;
|
|
10886
|
+
}
|
|
10887
|
+
#kernel;
|
|
10888
|
+
#handle;
|
|
10889
|
+
#closing;
|
|
10890
|
+
kill(signal = "SIGTERM") {
|
|
10891
|
+
const name = signalName(signal) ?? "SIGTERM";
|
|
10892
|
+
this.killed = true;
|
|
10893
|
+
if (!this.#kernel) return false;
|
|
10894
|
+
try {
|
|
10895
|
+
const ret = this.#kernel.kill(name);
|
|
10896
|
+
return ret !== false;
|
|
10897
|
+
} catch {
|
|
10898
|
+
return false;
|
|
10899
|
+
}
|
|
10900
|
+
}
|
|
10901
|
+
ref() {
|
|
10902
|
+
if (this.#handle) handles.add(this.#handle);
|
|
10903
|
+
return this;
|
|
10904
|
+
}
|
|
10905
|
+
unref() {
|
|
10906
|
+
if (this.#handle) handles.delete(this.#handle);
|
|
10907
|
+
return this;
|
|
10908
|
+
}
|
|
10909
|
+
/** @internal */
|
|
10910
|
+
_bindKernel(child) {
|
|
10911
|
+
this.#kernel = child;
|
|
10912
|
+
this.pid = child.pid;
|
|
10913
|
+
this.#handle = { kind: "child", pid: child.pid };
|
|
10914
|
+
handles.add(this.#handle);
|
|
10915
|
+
}
|
|
10916
|
+
/** @internal */
|
|
10917
|
+
_release() {
|
|
10918
|
+
if (this.#handle) {
|
|
10919
|
+
handles.delete(this.#handle);
|
|
10920
|
+
this.#handle = null;
|
|
10921
|
+
}
|
|
10922
|
+
}
|
|
10923
|
+
/** @internal */
|
|
10924
|
+
_markClosing() {
|
|
10925
|
+
this.#closing = true;
|
|
10926
|
+
}
|
|
10927
|
+
get _closing() {
|
|
10928
|
+
return this.#closing;
|
|
10929
|
+
}
|
|
10930
|
+
}
|
|
10931
|
+
function createPipeReadable() {
|
|
10932
|
+
const { Readable } = getStream();
|
|
10933
|
+
const r = new Readable({ read() {
|
|
10934
|
+
} });
|
|
10935
|
+
r._sliccPump = async (webStream) => {
|
|
10936
|
+
if (!webStream) {
|
|
10937
|
+
r.push(null);
|
|
10938
|
+
return;
|
|
10939
|
+
}
|
|
10940
|
+
try {
|
|
10941
|
+
const reader = webStream.getReader();
|
|
10942
|
+
for (; ; ) {
|
|
10943
|
+
const { done, value } = await reader.read();
|
|
10944
|
+
if (done) break;
|
|
10945
|
+
const chunk = value instanceof Uint8Array ? Buffer2.from(value) : Buffer2.from(String(value));
|
|
10946
|
+
r.push(chunk);
|
|
10947
|
+
}
|
|
10948
|
+
r.push(null);
|
|
10949
|
+
} catch (err) {
|
|
10950
|
+
r.destroy(err);
|
|
10951
|
+
}
|
|
10952
|
+
};
|
|
10953
|
+
return r;
|
|
10954
|
+
}
|
|
10955
|
+
function createPipeWritable() {
|
|
10956
|
+
const { Writable } = getStream();
|
|
10957
|
+
let writer = null;
|
|
10958
|
+
const pending = [];
|
|
10959
|
+
let ended = false;
|
|
10960
|
+
const w = new Writable({
|
|
10961
|
+
write(chunk, _enc, cb) {
|
|
10962
|
+
const bytes = typeof chunk === "string" ? Buffer2.from(chunk) : chunk;
|
|
10963
|
+
if (!writer) {
|
|
10964
|
+
pending.push({ bytes, cb });
|
|
10965
|
+
return;
|
|
10966
|
+
}
|
|
10967
|
+
writer.write(bytes).then(() => cb(), cb);
|
|
10968
|
+
},
|
|
10969
|
+
final(cb) {
|
|
10970
|
+
ended = true;
|
|
10971
|
+
if (!writer) {
|
|
10972
|
+
pending.push({ end: true, cb });
|
|
10973
|
+
return;
|
|
10974
|
+
}
|
|
10975
|
+
writer.close().then(() => cb(), cb);
|
|
10976
|
+
},
|
|
10977
|
+
destroy(err, cb) {
|
|
10978
|
+
if (writer) writer.abort(err).then(() => cb(err), () => cb(err));
|
|
10979
|
+
else cb(err);
|
|
10980
|
+
}
|
|
10981
|
+
});
|
|
10982
|
+
w._sliccAttach = (webStream) => {
|
|
10983
|
+
if (!webStream) {
|
|
10984
|
+
for (const p of pending) p.cb?.(new Error("stdin not available"));
|
|
10985
|
+
pending.length = 0;
|
|
10986
|
+
return;
|
|
10987
|
+
}
|
|
10988
|
+
writer = webStream.getWriter();
|
|
10989
|
+
for (const p of pending) {
|
|
10990
|
+
if (p.end) writer.close().then(() => p.cb(), p.cb);
|
|
10991
|
+
else writer.write(p.bytes).then(() => p.cb(), p.cb);
|
|
10992
|
+
}
|
|
10993
|
+
pending.length = 0;
|
|
10994
|
+
if (ended && pending.length === 0) {
|
|
10995
|
+
}
|
|
10996
|
+
};
|
|
10997
|
+
return w;
|
|
10998
|
+
}
|
|
10999
|
+
function prepareStdio(child, stdio) {
|
|
11000
|
+
const [inMode, outMode, errMode] = stdio;
|
|
11001
|
+
if (toKernelStdio(inMode) === "pipe") child.stdin = createPipeWritable();
|
|
11002
|
+
if (toKernelStdio(outMode) === "pipe") child.stdout = createPipeReadable();
|
|
11003
|
+
if (toKernelStdio(errMode) === "pipe") child.stderr = createPipeReadable();
|
|
11004
|
+
}
|
|
11005
|
+
function connectStdio(child, kernelChild) {
|
|
11006
|
+
child.stdin?._sliccAttach?.(kernelChild.stdin);
|
|
11007
|
+
const pumps = [];
|
|
11008
|
+
if (child.stdout?._sliccPump) pumps.push(child.stdout._sliccPump(kernelChild.stdout));
|
|
11009
|
+
if (child.stderr?._sliccPump) pumps.push(child.stderr._sliccPump(kernelChild.stderr));
|
|
11010
|
+
child._stdioPumps = Promise.all(pumps);
|
|
11011
|
+
}
|
|
11012
|
+
function finish(child, code, signal) {
|
|
11013
|
+
if (child._closing) return;
|
|
11014
|
+
child._markClosing();
|
|
11015
|
+
child.exitCode = code;
|
|
11016
|
+
child.signalCode = signal;
|
|
11017
|
+
child.emit("exit", code, signal);
|
|
11018
|
+
const after = child._stdioPumps ?? Promise.resolve();
|
|
11019
|
+
trackPromise(handles, after);
|
|
11020
|
+
after.finally(() => {
|
|
11021
|
+
child.emit("close", code, signal);
|
|
11022
|
+
child._release();
|
|
11023
|
+
handles.notify?.();
|
|
11024
|
+
});
|
|
11025
|
+
}
|
|
11026
|
+
function startSpawn(child, file, args, options, stdio) {
|
|
11027
|
+
const cwd = options.cwd != null ? String(options.cwd) : process2.cwd();
|
|
11028
|
+
const env = options.env ? { ...options.env } : { ...process2.env };
|
|
11029
|
+
const argv = [file, ...args];
|
|
11030
|
+
child.spawnfile = file;
|
|
11031
|
+
child.spawnargs = argv;
|
|
11032
|
+
const spawnPromise = ctx.spawn({
|
|
11033
|
+
argv,
|
|
11034
|
+
cwd,
|
|
11035
|
+
env,
|
|
11036
|
+
stdin: toKernelStdio(stdio[0]),
|
|
11037
|
+
stdout: toKernelStdio(stdio[1]),
|
|
11038
|
+
stderr: toKernelStdio(stdio[2])
|
|
11039
|
+
});
|
|
11040
|
+
trackPromise(handles, spawnPromise);
|
|
11041
|
+
spawnPromise.then(
|
|
11042
|
+
(kernelChild) => {
|
|
11043
|
+
child._bindKernel(kernelChild);
|
|
11044
|
+
connectStdio(child, kernelChild);
|
|
11045
|
+
child.emit("spawn");
|
|
11046
|
+
const waitP = kernelChild.wait();
|
|
11047
|
+
trackPromise(handles, waitP);
|
|
11048
|
+
waitP.then(
|
|
11049
|
+
(status) => {
|
|
11050
|
+
const sigNum = status?.signal;
|
|
11051
|
+
if (sigNum != null && sigNum !== 0) {
|
|
11052
|
+
const name = SIGNAL_NAMES[sigNum] ?? String(sigNum);
|
|
11053
|
+
finish(child, null, name);
|
|
11054
|
+
} else {
|
|
11055
|
+
const code = typeof status?.status === "number" ? status.status : 0;
|
|
11056
|
+
finish(child, code, null);
|
|
11057
|
+
}
|
|
11058
|
+
},
|
|
11059
|
+
(err) => {
|
|
11060
|
+
child.emit("error", err);
|
|
11061
|
+
finish(child, 1, null);
|
|
11062
|
+
}
|
|
11063
|
+
);
|
|
11064
|
+
},
|
|
11065
|
+
(err) => {
|
|
11066
|
+
const code = err?.code === "ENOENT" ? "ENOENT" : err?.code ?? "ERR_SPAWN_FAILED";
|
|
11067
|
+
const error = code === "ENOENT" ? spawnError(file, args, "ENOENT", `spawn ${file} ENOENT`) : spawnError(file, args, code, err?.message ?? String(err));
|
|
11068
|
+
try {
|
|
11069
|
+
child.stdout?.push?.(null);
|
|
11070
|
+
} catch {
|
|
11071
|
+
}
|
|
11072
|
+
try {
|
|
11073
|
+
child.stderr?.push?.(null);
|
|
11074
|
+
} catch {
|
|
11075
|
+
}
|
|
11076
|
+
process2.nextTick(() => {
|
|
11077
|
+
child.emit("error", error);
|
|
11078
|
+
if (code === "ENOENT") {
|
|
11079
|
+
child.exitCode = -2;
|
|
11080
|
+
child.emit("close", -2, null);
|
|
11081
|
+
} else {
|
|
11082
|
+
finish(child, 1, null);
|
|
11083
|
+
}
|
|
11084
|
+
child._release();
|
|
11085
|
+
handles.notify?.();
|
|
11086
|
+
});
|
|
11087
|
+
}
|
|
11088
|
+
);
|
|
11089
|
+
}
|
|
11090
|
+
function spawn(command, args, options) {
|
|
11091
|
+
let file = command;
|
|
11092
|
+
let argv = args;
|
|
11093
|
+
let opts = options;
|
|
11094
|
+
if (argv != null && !Array.isArray(argv) && typeof argv === "object") {
|
|
11095
|
+
opts = argv;
|
|
11096
|
+
argv = [];
|
|
11097
|
+
}
|
|
11098
|
+
argv = Array.isArray(argv) ? argv.map(String) : [];
|
|
11099
|
+
opts = opts && typeof opts === "object" ? opts : {};
|
|
11100
|
+
file = String(file);
|
|
11101
|
+
if (opts.shell) {
|
|
11102
|
+
const shell = typeof opts.shell === "string" ? opts.shell : "sh";
|
|
11103
|
+
const line = argv.length ? [file, ...argv].join(" ") : file;
|
|
11104
|
+
file = shell;
|
|
11105
|
+
argv = ["-c", line];
|
|
11106
|
+
}
|
|
11107
|
+
const stdio = normalizeStdio(opts.stdio);
|
|
11108
|
+
const child = new ChildProcess();
|
|
11109
|
+
prepareStdio(child, stdio);
|
|
11110
|
+
process2.nextTick(() => startSpawn(child, file, argv, opts, stdio));
|
|
11111
|
+
return child;
|
|
11112
|
+
}
|
|
11113
|
+
function execFile(file, args, options, callback) {
|
|
11114
|
+
const norm = normalizeArgs(file, args, options, callback);
|
|
11115
|
+
const opts = { ...norm.options };
|
|
11116
|
+
if (opts.stdio === void 0) opts.stdio = ["pipe", "pipe", "pipe"];
|
|
11117
|
+
const child = spawn(String(file), norm.args, opts);
|
|
11118
|
+
if (!norm.callback) return child;
|
|
11119
|
+
const maxBuffer = opts.maxBuffer ?? 1024 * 1024;
|
|
11120
|
+
let stdout = Buffer2.alloc(0);
|
|
11121
|
+
let stderr = Buffer2.alloc(0);
|
|
11122
|
+
let exited = false;
|
|
11123
|
+
const done = (err) => {
|
|
11124
|
+
if (exited) return;
|
|
11125
|
+
exited = true;
|
|
11126
|
+
const enc = opts.encoding;
|
|
11127
|
+
const out = enc ? stdout.toString(enc) : stdout;
|
|
11128
|
+
const errOut = enc ? stderr.toString(enc) : stderr;
|
|
11129
|
+
norm.callback(err, out, errOut);
|
|
11130
|
+
};
|
|
11131
|
+
if (child.stdout) {
|
|
11132
|
+
child.stdout.on("data", (chunk) => {
|
|
11133
|
+
stdout = Buffer2.concat([stdout, Buffer2.isBuffer(chunk) ? chunk : Buffer2.from(chunk)]);
|
|
11134
|
+
if (stdout.length > maxBuffer) {
|
|
11135
|
+
child.kill();
|
|
11136
|
+
const err = new Error("stdout maxBuffer exceeded");
|
|
11137
|
+
err.code = "ERR_CHILD_PROCESS_STDIO_MAXBUFFER";
|
|
11138
|
+
done(err);
|
|
11139
|
+
}
|
|
11140
|
+
});
|
|
11141
|
+
}
|
|
11142
|
+
if (child.stderr) {
|
|
11143
|
+
child.stderr.on("data", (chunk) => {
|
|
11144
|
+
stderr = Buffer2.concat([stderr, Buffer2.isBuffer(chunk) ? chunk : Buffer2.from(chunk)]);
|
|
11145
|
+
if (stderr.length > maxBuffer) {
|
|
11146
|
+
child.kill();
|
|
11147
|
+
const err = new Error("stderr maxBuffer exceeded");
|
|
11148
|
+
err.code = "ERR_CHILD_PROCESS_STDIO_MAXBUFFER";
|
|
11149
|
+
done(err);
|
|
11150
|
+
}
|
|
11151
|
+
});
|
|
11152
|
+
}
|
|
11153
|
+
child.on("error", (err) => done(err));
|
|
11154
|
+
child.on("close", (code, signal) => {
|
|
11155
|
+
if (exited) return;
|
|
11156
|
+
if (code === 0 && !signal) {
|
|
11157
|
+
done(null);
|
|
11158
|
+
return;
|
|
11159
|
+
}
|
|
11160
|
+
const err = new Error(`Command failed: ${file} ${norm.args.join(" ")}`);
|
|
11161
|
+
err.code = code;
|
|
11162
|
+
err.killed = child.killed;
|
|
11163
|
+
err.signal = signal;
|
|
11164
|
+
err.cmd = `${file} ${norm.args.join(" ")}`.trim();
|
|
11165
|
+
err.stdout = opts.encoding ? stdout.toString(opts.encoding) : stdout;
|
|
11166
|
+
err.stderr = opts.encoding ? stderr.toString(opts.encoding) : stderr;
|
|
11167
|
+
done(err);
|
|
11168
|
+
});
|
|
11169
|
+
return child;
|
|
11170
|
+
}
|
|
11171
|
+
function exec(command, options, callback) {
|
|
11172
|
+
let opts = options;
|
|
11173
|
+
let cb = callback;
|
|
11174
|
+
if (typeof options === "function") {
|
|
11175
|
+
cb = options;
|
|
11176
|
+
opts = {};
|
|
11177
|
+
}
|
|
11178
|
+
opts = opts && typeof opts === "object" ? opts : {};
|
|
11179
|
+
const shell = typeof opts.shell === "string" ? opts.shell : "sh";
|
|
11180
|
+
return execFile(shell, ["-c", String(command)], { ...opts, shell: false }, cb);
|
|
11181
|
+
}
|
|
11182
|
+
return {
|
|
11183
|
+
spawn,
|
|
11184
|
+
execFile,
|
|
11185
|
+
exec,
|
|
11186
|
+
spawnSync() {
|
|
11187
|
+
notSupported("spawnSync");
|
|
11188
|
+
},
|
|
11189
|
+
execSync() {
|
|
11190
|
+
notSupported("execSync");
|
|
11191
|
+
},
|
|
11192
|
+
execFileSync() {
|
|
11193
|
+
notSupported("execFileSync");
|
|
11194
|
+
},
|
|
11195
|
+
fork() {
|
|
11196
|
+
notSupported("fork");
|
|
11197
|
+
},
|
|
11198
|
+
ChildProcess,
|
|
11199
|
+
// Expose for tests / advanced callers
|
|
11200
|
+
_SIGNAL_NAMES: SIGNAL_NAMES,
|
|
11201
|
+
_SIGNAL_NUMBERS: SIGNAL_NUMBERS
|
|
11202
|
+
};
|
|
11203
|
+
}
|
|
11204
|
+
|
|
10796
11205
|
// src/runtime/builtins/fs.mjs
|
|
10797
11206
|
var encoder3 = new TextEncoder();
|
|
10798
11207
|
var decoder3 = new TextDecoder();
|
|
@@ -11187,6 +11596,21 @@ function createFs({ ctx, path, process: process2, Buffer: Buffer2, handles, getS
|
|
|
11187
11596
|
throw nodeFsError(err?.code || "ENOENT", "lstat", pathArg, err);
|
|
11188
11597
|
}
|
|
11189
11598
|
},
|
|
11599
|
+
/**
|
|
11600
|
+
* Resolve to a canonical absolute path. Symlink walk is not implemented;
|
|
11601
|
+
* when the path exists we return the normalized absolute form (enough for
|
|
11602
|
+
* pnpm's cmd shims, which only need dirname(realpathSync(argv[1]))).
|
|
11603
|
+
*/
|
|
11604
|
+
realpathSync(p) {
|
|
11605
|
+
const pathArg = p;
|
|
11606
|
+
const target = abs(p);
|
|
11607
|
+
try {
|
|
11608
|
+
syncFs.stat(target);
|
|
11609
|
+
return target;
|
|
11610
|
+
} catch (err) {
|
|
11611
|
+
throw nodeFsError(err?.code || "ENOENT", "realpath", pathArg, err);
|
|
11612
|
+
}
|
|
11613
|
+
},
|
|
11190
11614
|
readdirSync,
|
|
11191
11615
|
mkdirSync,
|
|
11192
11616
|
rmdirSync(p, options = {}) {
|
|
@@ -11825,6 +12249,7 @@ function createFs({ ctx, path, process: process2, Buffer: Buffer2, handles, getS
|
|
|
11825
12249
|
access: callbackify(syncApi.accessSync),
|
|
11826
12250
|
stat: callbackify(syncApi.statSync),
|
|
11827
12251
|
lstat: callbackify(syncApi.lstatSync),
|
|
12252
|
+
realpath: callbackify(syncApi.realpathSync),
|
|
11828
12253
|
readdir: callbackify(syncApi.readdirSync),
|
|
11829
12254
|
mkdir: callbackify(syncApi.mkdirSync),
|
|
11830
12255
|
rmdir: callbackify(syncApi.rmdirSync),
|
|
@@ -12685,7 +13110,7 @@ function createHttp2({ ctx, process: process2, Buffer: Buffer2, handles, getStre
|
|
|
12685
13110
|
|
|
12686
13111
|
// src/runtime/builtins/https.mjs
|
|
12687
13112
|
var TLS_CLIENT_OPTS = ["cert", "key", "pfx", "ca"];
|
|
12688
|
-
function
|
|
13113
|
+
function notSupported2(what) {
|
|
12689
13114
|
const err = new Error(`slicc-jsh: '${what}' is not supported yet (no TLS on ctx.net)`);
|
|
12690
13115
|
err.code = "ERR_NOT_SUPPORTED";
|
|
12691
13116
|
return err;
|
|
@@ -12699,7 +13124,7 @@ function isManualRedirectUnsupported(err) {
|
|
|
12699
13124
|
function rejectTlsOptions(options) {
|
|
12700
13125
|
for (const name of TLS_CLIENT_OPTS) {
|
|
12701
13126
|
if (options?.[name] != null) {
|
|
12702
|
-
throw
|
|
13127
|
+
throw notSupported2(`https.request option '${name}'`);
|
|
12703
13128
|
}
|
|
12704
13129
|
}
|
|
12705
13130
|
}
|
|
@@ -12733,7 +13158,7 @@ function createHttps({ ctx, Buffer: Buffer2, http, handles }) {
|
|
|
12733
13158
|
}
|
|
12734
13159
|
}
|
|
12735
13160
|
function createServer() {
|
|
12736
|
-
throw
|
|
13161
|
+
throw notSupported2("https.createServer");
|
|
12737
13162
|
}
|
|
12738
13163
|
class ClientRequest extends EventEmitter {
|
|
12739
13164
|
#ended = false;
|
|
@@ -12824,7 +13249,7 @@ function createHttps({ ctx, Buffer: Buffer2, http, handles }) {
|
|
|
12824
13249
|
if (this.#sent || this.#destroyed) return;
|
|
12825
13250
|
this.#sent = true;
|
|
12826
13251
|
try {
|
|
12827
|
-
if (typeof ctx.fetch !== "function") throw
|
|
13252
|
+
if (typeof ctx.fetch !== "function") throw notSupported2("https.request");
|
|
12828
13253
|
const opts = this.#opts;
|
|
12829
13254
|
const method = (opts.method ?? "GET").toUpperCase();
|
|
12830
13255
|
const host = opts.hostname ?? opts.host ?? "localhost";
|
|
@@ -13713,6 +14138,7 @@ var BUILTIN_LIST = [
|
|
|
13713
14138
|
"assert",
|
|
13714
14139
|
"assert/strict",
|
|
13715
14140
|
"buffer",
|
|
14141
|
+
"child_process",
|
|
13716
14142
|
"console",
|
|
13717
14143
|
"events",
|
|
13718
14144
|
"fs",
|
|
@@ -13736,7 +14162,6 @@ var BUILTIN_LIST = [
|
|
|
13736
14162
|
"util/types"
|
|
13737
14163
|
];
|
|
13738
14164
|
var NOT_YET = [
|
|
13739
|
-
"child_process",
|
|
13740
14165
|
"http2",
|
|
13741
14166
|
"crypto",
|
|
13742
14167
|
"zlib",
|
|
@@ -13755,7 +14180,7 @@ var NOT_YET = [
|
|
|
13755
14180
|
"v8",
|
|
13756
14181
|
"was"
|
|
13757
14182
|
];
|
|
13758
|
-
function
|
|
14183
|
+
function notSupported3(id) {
|
|
13759
14184
|
const err = new Error(`slicc-jsh: '${id}' is not supported yet`);
|
|
13760
14185
|
err.code = "ERR_NOT_SUPPORTED";
|
|
13761
14186
|
throw err;
|
|
@@ -13801,6 +14226,13 @@ function createBuiltins({ ctx, process: process2, Buffer: Buffer2, console: cons
|
|
|
13801
14226
|
if (!https) https = createHttps({ ctx, Buffer: Buffer2, http: getHttp(), handles });
|
|
13802
14227
|
return https;
|
|
13803
14228
|
};
|
|
14229
|
+
let childProcess;
|
|
14230
|
+
const getChildProcess = () => {
|
|
14231
|
+
if (!childProcess) {
|
|
14232
|
+
childProcess = createChildProcess({ ctx, process: process2, Buffer: Buffer2, handles, getStream });
|
|
14233
|
+
}
|
|
14234
|
+
return childProcess;
|
|
14235
|
+
};
|
|
13804
14236
|
let ModuleExport = null;
|
|
13805
14237
|
const implemented = {
|
|
13806
14238
|
process: () => process2,
|
|
@@ -13826,7 +14258,8 @@ function createBuiltins({ ctx, process: process2, Buffer: Buffer2, console: cons
|
|
|
13826
14258
|
"timers/promises": () => timersPromises,
|
|
13827
14259
|
net: () => getNet(),
|
|
13828
14260
|
http: () => getHttp(),
|
|
13829
|
-
https: () => getHttps()
|
|
14261
|
+
https: () => getHttps(),
|
|
14262
|
+
child_process: () => getChildProcess()
|
|
13830
14263
|
};
|
|
13831
14264
|
return {
|
|
13832
14265
|
installModule(Module) {
|
|
@@ -13840,7 +14273,7 @@ function createBuiltins({ ctx, process: process2, Buffer: Buffer2, console: cons
|
|
|
13840
14273
|
},
|
|
13841
14274
|
load(id) {
|
|
13842
14275
|
const bare = id.startsWith("node:") ? id.slice(5) : id;
|
|
13843
|
-
if (NOT_YET.includes(bare))
|
|
14276
|
+
if (NOT_YET.includes(bare)) notSupported3(bare);
|
|
13844
14277
|
const factory = implemented[bare];
|
|
13845
14278
|
if (!factory) {
|
|
13846
14279
|
const err = new Error(`No such built-in module: ${id}`);
|
|
@@ -15892,6 +16325,42 @@ var Process = class extends EventEmitter {
|
|
|
15892
16325
|
cwd() {
|
|
15893
16326
|
return this._cwd;
|
|
15894
16327
|
}
|
|
16328
|
+
/** Root (0) until credential plumbing is exposed on process. */
|
|
16329
|
+
getuid() {
|
|
16330
|
+
return 0;
|
|
16331
|
+
}
|
|
16332
|
+
geteuid() {
|
|
16333
|
+
return 0;
|
|
16334
|
+
}
|
|
16335
|
+
getgid() {
|
|
16336
|
+
return 0;
|
|
16337
|
+
}
|
|
16338
|
+
getegid() {
|
|
16339
|
+
return 0;
|
|
16340
|
+
}
|
|
16341
|
+
getgroups() {
|
|
16342
|
+
return [0];
|
|
16343
|
+
}
|
|
16344
|
+
/**
|
|
16345
|
+
* Minimal process.kill: only this process (pid === this.pid). Used by pnpm
|
|
16346
|
+
* cmd shims to re-raise a child's terminating signal. Unknown pids → ESRCH.
|
|
16347
|
+
*/
|
|
16348
|
+
kill(pid, signal = "SIGTERM") {
|
|
16349
|
+
const target = Number(pid);
|
|
16350
|
+
if (target !== this.pid) {
|
|
16351
|
+
const err = new Error(`kill ESRCH`);
|
|
16352
|
+
err.code = "ESRCH";
|
|
16353
|
+
err.errno = -3;
|
|
16354
|
+
err.syscall = "kill";
|
|
16355
|
+
throw err;
|
|
16356
|
+
}
|
|
16357
|
+
const name = typeof signal === "string" ? signal.startsWith("SIG") ? signal : `SIG${signal}` : "SIGTERM";
|
|
16358
|
+
if (name === "SIGTERM" || name === "SIGINT" || name === "SIGHUP" || name === "SIGKILL") {
|
|
16359
|
+
const codes = { SIGTERM: 143, SIGINT: 130, SIGHUP: 129, SIGKILL: 137 };
|
|
16360
|
+
this.exit(codes[name] ?? 1);
|
|
16361
|
+
}
|
|
16362
|
+
return true;
|
|
16363
|
+
}
|
|
15895
16364
|
chdir(path) {
|
|
15896
16365
|
if (typeof path !== "string") {
|
|
15897
16366
|
const err = new TypeError(
|