@ai-ecoverse/slicc-kernel 1.164.1 → 1.164.3

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.
@@ -1456,6 +1456,8 @@ var setAdd = Set.prototype.add;
1456
1456
  var mapGet = WeakMap.prototype.get;
1457
1457
  var mapSet = WeakMap.prototype.set;
1458
1458
  var isNativeError = types.isNativeError;
1459
+ var freeze = Object.freeze;
1460
+ var blank = Object.create;
1459
1461
  function internals() {
1460
1462
  try {
1461
1463
  const load = createRequire(import.meta.url);
@@ -1551,11 +1553,20 @@ function keptFrames(trace) {
1551
1553
  }
1552
1554
  var formatter = null;
1553
1555
  var formatting = false;
1554
- var tops = /* @__PURE__ */ new WeakMap();
1555
- function stackDispatcher(fallback) {
1556
+ var seen = /* @__PURE__ */ new WeakMap();
1557
+ function positionsAt(positions, error, site) {
1558
+ if (positions === void 0 || !keptFrame(site)) return void 0;
1559
+ try {
1560
+ return positions(error);
1561
+ } catch {
1562
+ return void 0;
1563
+ }
1564
+ }
1565
+ function stackDispatcher(fallback, positions) {
1556
1566
  return (error, trace) => {
1557
1567
  if (typeof error === "object" && error !== null && trace.length > 0) {
1558
- apply(mapSet, tops, [error, trace[0]]);
1568
+ const site = trace[0];
1569
+ apply(mapSet, seen, [error, { site, at: positionsAt(positions, error, site) }]);
1559
1570
  }
1560
1571
  const fn = formatter;
1561
1572
  if (fn === null || formatting) return apply(fallback, void 0, [error, trace]);
@@ -1571,8 +1582,29 @@ function stackDispatcher(fallback) {
1571
1582
  };
1572
1583
  }
1573
1584
  var found = internals();
1574
- if (found) found.setInternalPrepareStackTrace(stackDispatcher(found.fallback));
1575
- var positions = found?.positions;
1585
+ if (found) found.setInternalPrepareStackTrace(stackDispatcher(found.fallback, found.positions));
1586
+ function errorSourceOf(error) {
1587
+ if (typeof error !== "object" || error === null || !isNativeError(error)) return void 0;
1588
+ try {
1589
+ void error.stack;
1590
+ } catch {
1591
+ return void 0;
1592
+ }
1593
+ const got = apply(mapGet, seen, [error]);
1594
+ if (got === void 0 || !keptFrame(got.site)) return void 0;
1595
+ const { site, at } = got;
1596
+ if (!at || typeof at.sourceLine !== "string" || typeof at.lineNumber !== "number")
1597
+ return void 0;
1598
+ if (apply(setHas, ownNames, [at.scriptResourceName]) === true) return void 0;
1599
+ const file = apply(isEval, site, []) === true ? void 0 : apply(fileOf, site, []);
1600
+ if (at.scriptResourceName !== file || apply(lineOf, site, []) !== at.lineNumber) return void 0;
1601
+ const out = blank(null);
1602
+ out.sourceLine = at.sourceLine;
1603
+ out.lineNumber = at.lineNumber;
1604
+ out.startColumn = typeof at.startColumn === "number" ? at.startColumn : 0;
1605
+ return freeze(out);
1606
+ }
1607
+ var nodeErrorSource = found?.positions ? errorSourceOf : void 0;
1576
1608
 
1577
1609
  // src/process/js/lockdown.ts
1578
1610
  var BLOCKED_GLOBALS = [