@poe-platform/safe-js 0.1.735 → 0.1.737

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.
Files changed (54) hide show
  1. package/README.md +10 -10
  2. package/dist/safe-js/chunks/{chunk-PPIYB46P.js → chunk-33AKDRQ4.js} +3 -3
  3. package/dist/safe-js/chunks/{chunk-7R3KDASZ.js → chunk-356QH3RB.js} +7 -3
  4. package/dist/safe-js/chunks/chunk-356QH3RB.js.map +7 -0
  5. package/dist/safe-js/chunks/{chunk-RULU2F5J.js → chunk-762WTEEI.js} +2 -2
  6. package/dist/safe-js/chunks/{chunk-U33B2YAT.js → chunk-7AHNAUR5.js} +2 -2
  7. package/dist/safe-js/chunks/{chunk-WGHFQSF5.js → chunk-FUUG7UIZ.js} +4 -4
  8. package/dist/safe-js/chunks/{chunk-SHVW6TCE.js → chunk-IKRAX7Z5.js} +3 -3
  9. package/dist/safe-js/chunks/{chunk-VTIHUINQ.js → chunk-LELXBLG2.js} +6 -6
  10. package/dist/safe-js/chunks/{chunk-5X7TFA3E.js → chunk-SBFOCNNW.js} +170 -137
  11. package/dist/safe-js/chunks/{chunk-5X7TFA3E.js.map → chunk-SBFOCNNW.js.map} +3 -3
  12. package/dist/safe-js/chunks/{chunk-KETIFEA7.js → chunk-TAC75RFB.js} +2 -2
  13. package/dist/safe-js/chunks/{chunk-MTQWXXXX.js → chunk-UVJ27MVC.js} +3 -3
  14. package/dist/safe-js/chunks/{chunk-QKO4FATZ.js → chunk-VQGYRKM4.js} +36 -10
  15. package/dist/safe-js/chunks/{chunk-QKO4FATZ.js.map → chunk-VQGYRKM4.js.map} +2 -2
  16. package/dist/safe-js/chunks/{chunk-JSXHEWUQ.js → chunk-WDEOWDLS.js} +4 -4
  17. package/dist/safe-js/chunks/{chunk-6G3J4CW7.js → chunk-ZNAW4ZDX.js} +2 -2
  18. package/dist/safe-js/chunks/{cli-runtime-ZUBPVST5.js → cli-runtime-FMSBDP7G.js} +11 -11
  19. package/dist/safe-js/chunks/{dump-YCUYBGSZ.js → dump-2IM3WE2J.js} +4 -4
  20. package/dist/safe-js/chunks/harness-ZLV6ZBEU.js +11 -0
  21. package/dist/safe-js/chunks/{mcp-JBFGRP6T.js → mcp-42AFDWT3.js} +4 -4
  22. package/dist/safe-js/chunks/{migration-file-ISSKTEAS.js → migration-file-AYLLA72K.js} +5 -5
  23. package/dist/safe-js/chunks/restore-SGQO4E4M.js +14 -0
  24. package/dist/safe-js/chunks/{run-IBQKVJTY.js → run-Q5Z4TRQO.js} +7 -7
  25. package/dist/safe-js/chunks/{runtime-modules-AFF6IQR2.js → runtime-modules-3P6FZJ55.js} +4 -4
  26. package/dist/safe-js/cli.js +2 -2
  27. package/dist/safe-js/core.js +7 -7
  28. package/dist/safe-js/index.js +13 -13
  29. package/dist/safe-js/interp/host-capabilities.d.ts +5 -5
  30. package/dist/safe-js/modules/fs.d.ts +4 -1
  31. package/dist/safe-js/modules/fs.js +3 -3
  32. package/dist/safe-js/snapshot/validation.d.ts +1 -1
  33. package/package.json +2 -2
  34. package/dist/safe-js/chunks/chunk-7R3KDASZ.js.map +0 -7
  35. package/dist/safe-js/chunks/harness-BSIQQFYL.js +0 -11
  36. package/dist/safe-js/chunks/restore-NHLS3LCF.js +0 -14
  37. /package/dist/safe-js/chunks/{chunk-PPIYB46P.js.map → chunk-33AKDRQ4.js.map} +0 -0
  38. /package/dist/safe-js/chunks/{chunk-RULU2F5J.js.map → chunk-762WTEEI.js.map} +0 -0
  39. /package/dist/safe-js/chunks/{chunk-U33B2YAT.js.map → chunk-7AHNAUR5.js.map} +0 -0
  40. /package/dist/safe-js/chunks/{chunk-WGHFQSF5.js.map → chunk-FUUG7UIZ.js.map} +0 -0
  41. /package/dist/safe-js/chunks/{chunk-SHVW6TCE.js.map → chunk-IKRAX7Z5.js.map} +0 -0
  42. /package/dist/safe-js/chunks/{chunk-VTIHUINQ.js.map → chunk-LELXBLG2.js.map} +0 -0
  43. /package/dist/safe-js/chunks/{chunk-KETIFEA7.js.map → chunk-TAC75RFB.js.map} +0 -0
  44. /package/dist/safe-js/chunks/{chunk-MTQWXXXX.js.map → chunk-UVJ27MVC.js.map} +0 -0
  45. /package/dist/safe-js/chunks/{chunk-JSXHEWUQ.js.map → chunk-WDEOWDLS.js.map} +0 -0
  46. /package/dist/safe-js/chunks/{chunk-6G3J4CW7.js.map → chunk-ZNAW4ZDX.js.map} +0 -0
  47. /package/dist/safe-js/chunks/{cli-runtime-ZUBPVST5.js.map → cli-runtime-FMSBDP7G.js.map} +0 -0
  48. /package/dist/safe-js/chunks/{dump-YCUYBGSZ.js.map → dump-2IM3WE2J.js.map} +0 -0
  49. /package/dist/safe-js/chunks/{harness-BSIQQFYL.js.map → harness-ZLV6ZBEU.js.map} +0 -0
  50. /package/dist/safe-js/chunks/{mcp-JBFGRP6T.js.map → mcp-42AFDWT3.js.map} +0 -0
  51. /package/dist/safe-js/chunks/{migration-file-ISSKTEAS.js.map → migration-file-AYLLA72K.js.map} +0 -0
  52. /package/dist/safe-js/chunks/{restore-NHLS3LCF.js.map → restore-SGQO4E4M.js.map} +0 -0
  53. /package/dist/safe-js/chunks/{run-IBQKVJTY.js.map → run-Q5Z4TRQO.js.map} +0 -0
  54. /package/dist/safe-js/chunks/{runtime-modules-AFF6IQR2.js.map → runtime-modules-3P6FZJ55.js.map} +0 -0
@@ -14,7 +14,7 @@ import {
14
14
  safeRecordException,
15
15
  safeStartSpan,
16
16
  splitSourceLines
17
- } from "./chunk-QKO4FATZ.js";
17
+ } from "./chunk-VQGYRKM4.js";
18
18
  import {
19
19
  AsyncLocalStorage
20
20
  } from "./chunk-UQPYTZOZ.js";
@@ -2850,4 +2850,4 @@ export {
2850
2850
  makeLogModule,
2851
2851
  makeMetricModule
2852
2852
  };
2853
- //# sourceMappingURL=chunk-KETIFEA7.js.map
2853
+ //# sourceMappingURL=chunk-TAC75RFB.js.map
@@ -6,10 +6,10 @@ import {
6
6
  import {
7
7
  declareHostOperation,
8
8
  runResources
9
- } from "./chunk-5X7TFA3E.js";
9
+ } from "./chunk-SBFOCNNW.js";
10
10
  import {
11
11
  hostErrorData
12
- } from "./chunk-QKO4FATZ.js";
12
+ } from "./chunk-VQGYRKM4.js";
13
13
 
14
14
  // packages/safe-js/src/modules/mcp.ts
15
15
  var DEFAULT_TOOL_BATCH_CONCURRENCY = 4;
@@ -402,4 +402,4 @@ function isPlainObjectRecord(value) {
402
402
  export {
403
403
  makeMcpModule
404
404
  };
405
- //# sourceMappingURL=chunk-MTQWXXXX.js.map
405
+ //# sourceMappingURL=chunk-UVJ27MVC.js.map
@@ -4197,8 +4197,6 @@ function allHexDigits(value) {
4197
4197
 
4198
4198
  // packages/safe-js/src/parse/parser.ts
4199
4199
  var isFrozenPosition = Object.isFrozen;
4200
- var MAX_CONDITIONAL_EXPRESSION_DEPTH = 256;
4201
- var MAX_IF_STATEMENT_DEPTH = 2048;
4202
4200
  var STRICT_BINDING_NAMES = /* @__PURE__ */ new Set(["eval", "arguments", "implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"]);
4203
4201
  var functionBodyStrictness = /* @__PURE__ */ new WeakMap();
4204
4202
  var DisallowedSyntaxError = class extends Error {
@@ -4486,6 +4484,7 @@ var Parser = class {
4486
4484
  allowIn = true;
4487
4485
  breakableDepth = 0;
4488
4486
  conditionalExpressionDepth = 0;
4487
+ conditionalDepths = /* @__PURE__ */ new WeakMap();
4489
4488
  ifStatementDepth = 0;
4490
4489
  loopDepth = 0;
4491
4490
  activeLabels = /* @__PURE__ */ new Map();
@@ -4762,19 +4761,46 @@ var Parser = class {
4762
4761
  span: createSpan2(start, body.span.end)
4763
4762
  });
4764
4763
  }
4764
+ // Cache completed subtrees so successive left-nested tests are visited only once.
4765
+ conditionalDepth(node) {
4766
+ const pending = [{ node }];
4767
+ while (pending.length > 0) {
4768
+ const frame = pending[pending.length - 1];
4769
+ if (this.conditionalDepths.has(frame.node)) {
4770
+ pending.pop();
4771
+ } else if (frame.children === void 0) {
4772
+ frame.children = [...compilerElements(frame.node)].filter(
4773
+ (child) => child !== null && typeof child === "object"
4774
+ );
4775
+ for (const child of frame.children) {
4776
+ if (!this.conditionalDepths.has(child)) pending.push({ node: child });
4777
+ }
4778
+ } else {
4779
+ let depth = 0;
4780
+ for (const child of frame.children) {
4781
+ depth = Math.max(depth, this.conditionalDepths.get(child));
4782
+ }
4783
+ if (compilerField(frame.node, "type") === "ConditionalExpression") depth += 1;
4784
+ this.conditionalDepths.set(frame.node, depth);
4785
+ pending.pop();
4786
+ }
4787
+ }
4788
+ return this.conditionalDepths.get(node);
4789
+ }
4765
4790
  parseConditionalExpression() {
4766
- if (this.conditionalExpressionDepth >= MAX_CONDITIONAL_EXPRESSION_DEPTH) {
4767
- const token = this.currentToken();
4791
+ const token = this.currentToken();
4792
+ const test = this.parseCoalesceExpression();
4793
+ if (this.consumePunctuator("?") === void 0) {
4794
+ return test;
4795
+ }
4796
+ const limit = this.compilation?.owner?.budget.limits.maxCallDepth ?? Infinity;
4797
+ if (limit !== Infinity && this.conditionalExpressionDepth + this.conditionalDepth(test.node) >= limit) {
4768
4798
  throw new Error(
4769
4799
  `Conditional expression nesting limit exceeded at line ${token.start.line}, column ${token.start.column}.`
4770
4800
  );
4771
4801
  }
4772
4802
  this.conditionalExpressionDepth += 1;
4773
4803
  try {
4774
- const test = this.parseCoalesceExpression();
4775
- if (this.consumePunctuator("?") === void 0) {
4776
- return test;
4777
- }
4778
4804
  const consequent = this.parseExpression();
4779
4805
  this.expectPunctuator(":");
4780
4806
  const alternate = this.parseAssignmentExpression();
@@ -5080,7 +5106,7 @@ var Parser = class {
5080
5106
  let entered = 0;
5081
5107
  try {
5082
5108
  for (; ; ) {
5083
- if (this.ifStatementDepth >= MAX_IF_STATEMENT_DEPTH) {
5109
+ if (this.ifStatementDepth >= (this.compilation?.owner?.budget.limits.maxCallDepth ?? Infinity)) {
5084
5110
  const token2 = this.currentToken();
5085
5111
  throw new Error(
5086
5112
  `If statement nesting limit exceeded at line ${token2.start.line}, column ${token2.start.column}.`
@@ -8746,4 +8772,4 @@ export {
8746
8772
  Float16Array2 as Float16Array,
8747
8773
  numericTypedArrayConstructors
8748
8774
  };
8749
- //# sourceMappingURL=chunk-QKO4FATZ.js.map
8775
+ //# sourceMappingURL=chunk-VQGYRKM4.js.map