@ai-ecoverse/slicc-kernel 1.165.3 → 1.166.2

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.
@@ -1518,6 +1518,10 @@ var isEval = proto.isEval;
1518
1518
  var originOf = proto.getEvalOrigin;
1519
1519
  var lineOf = proto.getLineNumber;
1520
1520
  var nameOf = proto.getScriptNameOrSourceURL;
1521
+ var functionOf = proto.getFunctionName;
1522
+ var typeOf = proto.getTypeName;
1523
+ var syntaxProto = SyntaxError.prototype;
1524
+ var protoOf = Object.getPrototypeOf;
1521
1525
  var ownNames = /* @__PURE__ */ new Set([
1522
1526
  apply(fileOf, self, []),
1523
1527
  apply(proto.getScriptNameOrSourceURL, self, [])
@@ -1611,7 +1615,8 @@ function record(positions, error, trace) {
1611
1615
  if (typeof error === "object" && error !== null && trace.length > 0) {
1612
1616
  noteSourceUrls(trace);
1613
1617
  const site = trace[0];
1614
- apply(mapSet, seen, [error, { site, at: positionsAt(positions, error, site) }]);
1618
+ const next = trace[1];
1619
+ apply(mapSet, seen, [error, { site, next, at: positionsAt(positions, error, site) }]);
1615
1620
  }
1616
1621
  }
1617
1622
  function stackDispatcher(fallback, positions) {
@@ -1694,6 +1699,18 @@ if (found) {
1694
1699
  setRawStack(rawReader(found.overrides, found.fallback));
1695
1700
  }
1696
1701
  }
1702
+ function programFrame(site) {
1703
+ if (site === void 0 || !keptFrame(site)) return false;
1704
+ if (apply(isEval, site, []) === true) return true;
1705
+ const file = apply(fileOf, site, []);
1706
+ return typeof file === "string" && apply(startsWith, file, ["node:"]) !== true;
1707
+ }
1708
+ function jsonParseSite(error, got) {
1709
+ const { site, next } = got;
1710
+ if (protoOf(error) !== syntaxProto || apply(fileOf, site, []) !== null) return false;
1711
+ if (apply(functionOf, site, []) !== "parse" || apply(typeOf, site, []) !== "JSON") return false;
1712
+ return programFrame(next);
1713
+ }
1697
1714
  function errorSourceOf(error) {
1698
1715
  if (typeof error !== "object" || error === null || !isNativeError(error)) return void 0;
1699
1716
  try {
@@ -1707,8 +1724,13 @@ function errorSourceOf(error) {
1707
1724
  if (!at || typeof at.sourceLine !== "string" || typeof at.lineNumber !== "number")
1708
1725
  return void 0;
1709
1726
  if (apply(setHas, ownNames, [at.scriptResourceName]) === true) return void 0;
1727
+ if (jsonParseSite(error, got))
1728
+ return at.scriptResourceName === void 0 ? answer(at) : void 0;
1710
1729
  const file = scriptOf(site);
1711
1730
  if (at.scriptResourceName !== file || apply(lineOf, site, []) !== at.lineNumber) return void 0;
1731
+ return answer(at);
1732
+ }
1733
+ function answer(at) {
1712
1734
  const out = blank(null);
1713
1735
  out.sourceLine = at.sourceLine;
1714
1736
  out.lineNumber = at.lineNumber;