sandboxedjs 0.1.67 → 0.1.69
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/index.cjs +189 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +189 -6
- package/dist/index.js.map +1 -1
- package/dist/python/python.data +270 -273
- package/dist/python/python.js +1 -1
- package/dist/python/python.wasm +0 -0
- package/dist/python/runtime.json +3 -3
- package/dist/python-abi.cjs +45 -1
- package/dist/python-abi.cjs.map +1 -1
- package/dist/python-abi.d.cts +34 -0
- package/dist/python-abi.d.ts +34 -0
- package/dist/python-abi.js +45 -1
- package/dist/python-abi.js.map +1 -1
- package/dist/python-worker.js +13 -1
- package/dist/python-worker.js.map +1 -1
- package/package.json +1 -1
package/dist/python/python.wasm
CHANGED
|
Binary file
|
package/dist/python/runtime.json
CHANGED
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"artifacts": {
|
|
19
19
|
"moduleUrl": "./python.js",
|
|
20
20
|
"hashes": {
|
|
21
|
-
"python.js": "sha256-
|
|
22
|
-
"python.wasm": "sha256-
|
|
23
|
-
"python.data": "sha256-
|
|
21
|
+
"python.js": "sha256-3a6b27974ad6102edfe43dc56fc13003cfa6a57d0adbf62668ea14845651781b",
|
|
22
|
+
"python.wasm": "sha256-5819858e6d9114b297310641b66680aa3d7cfef34b39bcd90bba11004483a05c",
|
|
23
|
+
"python.data": "sha256-cc6790dab6abf55be3705fd64be3721000372eddac8968e7d0e9420602570a43",
|
|
24
24
|
"python.worker.js": "sha256-63bb1df52c4e3a95eae7b2d77c98554188fcc5925e72628ea0c34d5c573977a5"
|
|
25
25
|
}
|
|
26
26
|
},
|
package/dist/python-abi.cjs
CHANGED
|
@@ -48,7 +48,10 @@ var Op = {
|
|
|
48
48
|
getpeername: 1801,
|
|
49
49
|
setsockopt: 1802,
|
|
50
50
|
getsockopt: 1803,
|
|
51
|
-
socket_close: 1804
|
|
51
|
+
socket_close: 1804,
|
|
52
|
+
spawn: 2048,
|
|
53
|
+
waitpid: 2049,
|
|
54
|
+
kill: 2050
|
|
52
55
|
};
|
|
53
56
|
var Errno = {
|
|
54
57
|
EPERM: 1,
|
|
@@ -59,6 +62,7 @@ var Errno = {
|
|
|
59
62
|
ENXIO: 6,
|
|
60
63
|
E2BIG: 7,
|
|
61
64
|
EBADF: 9,
|
|
65
|
+
ECHILD: 10,
|
|
62
66
|
EAGAIN: 11,
|
|
63
67
|
ENOMEM: 12,
|
|
64
68
|
EACCES: 13,
|
|
@@ -1513,6 +1517,46 @@ function createHostAbiServer(proc) {
|
|
|
1513
1517
|
const joined = Object.entries(proc.env).map(([key, value]) => `${key}=${value}`).join("\0");
|
|
1514
1518
|
return { status: 0, payload: new Writer().string(joined).finish() };
|
|
1515
1519
|
}
|
|
1520
|
+
/* --------------------------------------------------------- processes */
|
|
1521
|
+
case Op.spawn: {
|
|
1522
|
+
const argv = [];
|
|
1523
|
+
for (let i = 0, n = r.u32(); i < n; i++) argv.push(r.string());
|
|
1524
|
+
const env = {};
|
|
1525
|
+
for (let i = 0, n = r.u32(); i < n; i++) {
|
|
1526
|
+
const entry = r.string();
|
|
1527
|
+
const split = entry.indexOf("=");
|
|
1528
|
+
if (split > 0) env[entry.slice(0, split)] = entry.slice(split + 1);
|
|
1529
|
+
}
|
|
1530
|
+
const cwd = r.string() || proc.cwd;
|
|
1531
|
+
const files2 = /* @__PURE__ */ new Map();
|
|
1532
|
+
for (let i = 0, n = r.u32(); i < n; i++) {
|
|
1533
|
+
const childFd = r.u32() | 0;
|
|
1534
|
+
const parentFd = r.u32() | 0;
|
|
1535
|
+
files2.set(childFd, proc.table.get(parentFd));
|
|
1536
|
+
}
|
|
1537
|
+
if (!proc.processes) throw new PosixError(Errno.ENOSYS);
|
|
1538
|
+
if (argv.length === 0) throw new PosixError(Errno.EINVAL);
|
|
1539
|
+
return { status: await proc.processes.spawn({ argv, env, cwd: resolve2(cwd), files: files2 }) };
|
|
1540
|
+
}
|
|
1541
|
+
case Op.waitpid: {
|
|
1542
|
+
const pid = r.u32() | 0;
|
|
1543
|
+
const options = r.u32() | 0;
|
|
1544
|
+
if (!proc.processes) throw new PosixError(Errno.ENOSYS);
|
|
1545
|
+
const result = await Promise.race([
|
|
1546
|
+
proc.processes.wait(pid, options),
|
|
1547
|
+
aborted().then(() => {
|
|
1548
|
+
throw new PosixError(Errno.EINTR);
|
|
1549
|
+
})
|
|
1550
|
+
]);
|
|
1551
|
+
return { status: 0, payload: new Writer().i32(result.pid).i32(result.status).finish() };
|
|
1552
|
+
}
|
|
1553
|
+
case Op.kill: {
|
|
1554
|
+
const pid = r.u32() | 0;
|
|
1555
|
+
const signal = r.u32() | 0;
|
|
1556
|
+
if (!proc.processes) throw new PosixError(Errno.ENOSYS);
|
|
1557
|
+
proc.processes.kill(pid, signal);
|
|
1558
|
+
return { status: 0 };
|
|
1559
|
+
}
|
|
1516
1560
|
/* ---------------------------------------------------------- entropy */
|
|
1517
1561
|
case Op.getrandom: {
|
|
1518
1562
|
const length = Math.min(r.u32(), 65536);
|