@ai-ecoverse/slicc-kernel 1.162.1 → 1.163.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/kernel-worker.js +19 -2
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-driver-worker.js +117 -0
- package/dist/node-driver-worker.js.map +4 -4
- package/dist/node-process-worker.js +232 -88
- package/dist/node-process-worker.js.map +4 -4
- package/dist/node.js +55 -8
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +5 -2
- package/dist/process-worker.js.map +2 -2
- package/dist/types/launcher.d.ts +1 -0
- package/dist/types/mount/mount-fs.d.ts +2 -0
- package/dist/types/node.d.ts +3 -0
- package/dist/types/process/js/js-context.d.ts +3 -0
- package/dist/types/process/js/js-sync.d.ts +2 -1
- package/package.json +2 -2
|
@@ -1420,6 +1420,123 @@ async function hostDriver(start, load) {
|
|
|
1420
1420
|
import { isBuiltin, registerHooks } from "node:module";
|
|
1421
1421
|
import { types } from "node:util";
|
|
1422
1422
|
|
|
1423
|
+
// src/node-stack.ts
|
|
1424
|
+
import { createRequire } from "node:module";
|
|
1425
|
+
var apply = Reflect.apply;
|
|
1426
|
+
var push = Array.prototype.push;
|
|
1427
|
+
var startsWith = String.prototype.startsWith;
|
|
1428
|
+
var slice = String.prototype.slice;
|
|
1429
|
+
var lastIndexOf = String.prototype.lastIndexOf;
|
|
1430
|
+
var indexOf2 = String.prototype.indexOf;
|
|
1431
|
+
var setHas = Set.prototype.has;
|
|
1432
|
+
var setAdd = Set.prototype.add;
|
|
1433
|
+
function internals() {
|
|
1434
|
+
try {
|
|
1435
|
+
const load = createRequire(import.meta.url);
|
|
1436
|
+
const errors = load("internal/errors");
|
|
1437
|
+
const set = errors.setInternalPrepareStackTrace;
|
|
1438
|
+
let fallback = errors.defaultPrepareStackTrace;
|
|
1439
|
+
if (process.sourceMapsEnabled) {
|
|
1440
|
+
fallback = load("internal/source_map/prepare_stack_trace").prepareStackTraceWithSourceMaps;
|
|
1441
|
+
}
|
|
1442
|
+
if (typeof set !== "function" || typeof fallback !== "function") return void 0;
|
|
1443
|
+
return {
|
|
1444
|
+
setInternalPrepareStackTrace: set,
|
|
1445
|
+
fallback
|
|
1446
|
+
};
|
|
1447
|
+
} catch {
|
|
1448
|
+
return void 0;
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
function ownSite() {
|
|
1452
|
+
const saved = Object.getOwnPropertyDescriptor(Error, "prepareStackTrace");
|
|
1453
|
+
try {
|
|
1454
|
+
Object.defineProperty(Error, "prepareStackTrace", {
|
|
1455
|
+
value: (_, sites) => sites[0],
|
|
1456
|
+
configurable: true,
|
|
1457
|
+
writable: true
|
|
1458
|
+
});
|
|
1459
|
+
return new Error().stack;
|
|
1460
|
+
} finally {
|
|
1461
|
+
delete Error.prepareStackTrace;
|
|
1462
|
+
Object.defineProperties(Error, saved ? { prepareStackTrace: saved } : {});
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
var self = ownSite();
|
|
1466
|
+
var proto = Object.getPrototypeOf(self);
|
|
1467
|
+
var fileOf = proto.getFileName;
|
|
1468
|
+
var hashOf = proto.getScriptHash;
|
|
1469
|
+
var isEval = proto.isEval;
|
|
1470
|
+
var originOf = proto.getEvalOrigin;
|
|
1471
|
+
var ownHash = apply(hashOf, self, []);
|
|
1472
|
+
var programHashes = /* @__PURE__ */ new Set();
|
|
1473
|
+
var programNames = /* @__PURE__ */ new Set();
|
|
1474
|
+
function programName(name) {
|
|
1475
|
+
return apply(startsWith, name, ["data:"]) === true || apply(setHas, programNames, [name]) === true;
|
|
1476
|
+
}
|
|
1477
|
+
function rootOrigin(origin) {
|
|
1478
|
+
let at = origin;
|
|
1479
|
+
while (apply(startsWith, at, ["eval at "]) === true) {
|
|
1480
|
+
const open = apply(indexOf2, at, [" ("]);
|
|
1481
|
+
if (open < 0) return "";
|
|
1482
|
+
let depth = 1;
|
|
1483
|
+
let i = open + 2;
|
|
1484
|
+
for (; i < at.length && depth > 0; i++) {
|
|
1485
|
+
const c = at[i];
|
|
1486
|
+
if (c === "(") depth++;
|
|
1487
|
+
else if (c === ")") depth--;
|
|
1488
|
+
}
|
|
1489
|
+
if (depth !== 0) return "";
|
|
1490
|
+
at = apply(slice, at, [open + 2, i - 1]);
|
|
1491
|
+
}
|
|
1492
|
+
let end = at.length;
|
|
1493
|
+
for (let n = 0; n < 2; n++) {
|
|
1494
|
+
const colon = apply(lastIndexOf, at, [":", end - 1]);
|
|
1495
|
+
if (colon <= 0) break;
|
|
1496
|
+
end = colon;
|
|
1497
|
+
}
|
|
1498
|
+
return apply(slice, at, [0, end]);
|
|
1499
|
+
}
|
|
1500
|
+
function keptFrame(site) {
|
|
1501
|
+
const hash = apply(hashOf, site, []);
|
|
1502
|
+
if (hash === ownHash) return false;
|
|
1503
|
+
if (apply(isEval, site, []) === true) {
|
|
1504
|
+
const origin = apply(originOf, site, []);
|
|
1505
|
+
return typeof origin === "string" && programName(rootOrigin(origin));
|
|
1506
|
+
}
|
|
1507
|
+
const file = apply(fileOf, site, []);
|
|
1508
|
+
if (typeof file !== "string") return true;
|
|
1509
|
+
if (apply(setHas, programHashes, [hash]) === true) return true;
|
|
1510
|
+
return apply(startsWith, file, ["node:"]) === true || programName(file);
|
|
1511
|
+
}
|
|
1512
|
+
function keptFrames(trace) {
|
|
1513
|
+
const out = [];
|
|
1514
|
+
for (let i = 0; i < trace.length; i++) {
|
|
1515
|
+
const site = trace[i];
|
|
1516
|
+
if (keptFrame(site)) apply(push, out, [site]);
|
|
1517
|
+
}
|
|
1518
|
+
return out;
|
|
1519
|
+
}
|
|
1520
|
+
var formatter = null;
|
|
1521
|
+
var formatting = false;
|
|
1522
|
+
function stackDispatcher(fallback) {
|
|
1523
|
+
return (error, trace) => {
|
|
1524
|
+
const fn = formatter;
|
|
1525
|
+
if (fn === null || formatting) return apply(fallback, void 0, [error, trace]);
|
|
1526
|
+
formatting = true;
|
|
1527
|
+
try {
|
|
1528
|
+
const out = apply(fn, void 0, [error, keptFrames(trace)]);
|
|
1529
|
+
if (typeof out === "string") return out;
|
|
1530
|
+
} catch {
|
|
1531
|
+
} finally {
|
|
1532
|
+
formatting = false;
|
|
1533
|
+
}
|
|
1534
|
+
return apply(fallback, void 0, [error, trace]);
|
|
1535
|
+
};
|
|
1536
|
+
}
|
|
1537
|
+
var found = internals();
|
|
1538
|
+
if (found) found.setInternalPrepareStackTrace(stackDispatcher(found.fallback));
|
|
1539
|
+
|
|
1423
1540
|
// src/process/js/lockdown.ts
|
|
1424
1541
|
var BLOCKED_GLOBALS = [
|
|
1425
1542
|
"XMLHttpRequest",
|