@poe-platform/safe-js 0.1.803 → 0.1.804

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 (56) hide show
  1. package/README.md +4 -4
  2. package/dist/safe-js/bundled-yaml/LICENSE +13 -0
  3. package/dist/safe-js/bundled-yaml/index.js +6601 -0
  4. package/dist/safe-js/chunks/{chunk-FUXGXSZC.js → chunk-36PBWSDR.js} +8 -8
  5. package/dist/safe-js/chunks/{chunk-SN4G557J.js → chunk-6AO2T2VZ.js} +1 -1
  6. package/dist/safe-js/chunks/{chunk-ZXDUALDQ.js → chunk-BKNQTNHP.js} +33 -23
  7. package/dist/safe-js/chunks/{chunk-WEPHHJMR.js → chunk-BYDDUKS3.js} +3 -3
  8. package/dist/safe-js/chunks/{chunk-6H5VC5W5.js → chunk-CKOGIOB3.js} +470 -464
  9. package/dist/safe-js/chunks/{chunk-D36FRVNN.js → chunk-CVPZFRCC.js} +3 -3
  10. package/dist/safe-js/chunks/{chunk-4KMUWNZD.js → chunk-ECMGBHAB.js} +13 -137
  11. package/dist/safe-js/chunks/{chunk-A3LXCGMJ.js → chunk-EQUBWQJN.js} +57 -34
  12. package/dist/safe-js/chunks/{chunk-ZAOSXSKI.js → chunk-JMDWLOJV.js} +26 -3
  13. package/dist/safe-js/chunks/{chunk-3NFTBEZR.js → chunk-JQ5QJV5Q.js} +2 -2
  14. package/dist/safe-js/chunks/{chunk-MMN3IESA.js → chunk-KMBCLXER.js} +1 -1
  15. package/dist/safe-js/chunks/{chunk-WRGATIKL.js → chunk-MJH73KJI.js} +2 -2
  16. package/dist/safe-js/chunks/{chunk-UQYM4GXB.js → chunk-P66QKVQC.js} +3 -3
  17. package/dist/safe-js/chunks/{chunk-HPHCQNFV.js → chunk-RPGCF4KE.js} +130 -3
  18. package/dist/safe-js/chunks/{chunk-J565YTXP.js → chunk-SIR35W6T.js} +5 -5
  19. package/dist/safe-js/chunks/{chunk-LVTYTUF5.js → chunk-SMGNJNDU.js} +1 -1
  20. package/dist/safe-js/chunks/{chunk-6NCYOKZQ.js → chunk-VLRTLEDI.js} +2 -2
  21. package/dist/safe-js/chunks/{chunk-JCHJGIQA.js → chunk-VVOPJZRG.js} +2 -0
  22. package/dist/safe-js/chunks/{cli-runtime-QIA3QMTP.js → cli-runtime-A353G7DR.js} +15 -15
  23. package/dist/safe-js/chunks/{dump-TGI6PZKL.js → dump-KQZFULX2.js} +4 -4
  24. package/dist/safe-js/chunks/harness-XT6K6X67.js +10 -0
  25. package/dist/safe-js/chunks/mcp-VWE444VD.js +11 -0
  26. package/dist/safe-js/chunks/migration-file-NSKXOMAO.js +14 -0
  27. package/dist/safe-js/chunks/restore-SHPORPY4.js +13 -0
  28. package/dist/safe-js/chunks/run-FQOSICOT.js +19 -0
  29. package/dist/safe-js/chunks/{runtime-modules-HWTUIY5J.js → runtime-modules-DBRXXRND.js} +4 -4
  30. package/dist/safe-js/chunks/{source-files-BSDM22Y2.js → source-files-A2WSOO6G.js} +3 -3
  31. package/dist/safe-js/cli.js +2 -2
  32. package/dist/safe-js/core.d.ts +19 -0
  33. package/dist/safe-js/core.js +39 -15
  34. package/dist/safe-js/error/format.d.ts +3 -0
  35. package/dist/safe-js/index.d.ts +1 -12
  36. package/dist/safe-js/index.js +30 -39
  37. package/dist/safe-js/interp/interpreter.d.ts +1 -3
  38. package/dist/safe-js/modules/fs.js +5 -5
  39. package/dist/safe-js/platform/node.d.ts +1 -0
  40. package/dist/safe-js/platform/node.js +1 -0
  41. package/dist/safe-js/platform/workerd.d.ts +1 -0
  42. package/dist/safe-js/platform/workerd.js +2 -0
  43. package/dist/safe-js/portable/chunks/{chunk-XCTU25SU.js → chunk-NLGXLZCK.js} +1 -1
  44. package/dist/safe-js/portable/chunks/{chunk-BIHLWVUU.js → chunk-SRMMDXD3.js} +124 -91
  45. package/dist/safe-js/portable/chunks/{chunk-H5X3T5VP.js → chunk-W6MZOTYR.js} +2 -0
  46. package/dist/safe-js/portable/chunks/{source-files-CVU252FB.js → source-files-AEDWESAJ.js} +2 -2
  47. package/dist/safe-js/portable/core.js +452 -246
  48. package/dist/safe-js/portable/modules/fs.js +2 -2
  49. package/dist/safe-js/workerd.js +57970 -57736
  50. package/package.json +6 -5
  51. package/dist/safe-js/chunks/harness-EE3ISLJP.js +0 -10
  52. package/dist/safe-js/chunks/mcp-F5MMOZNP.js +0 -11
  53. package/dist/safe-js/chunks/migration-file-W3HZOGXV.js +0 -14
  54. package/dist/safe-js/chunks/restore-MMM4A46M.js +0 -13
  55. package/dist/safe-js/chunks/run-TKX3IFNH.js +0 -19
  56. package/dist/safe-js/node-unavailable.d.ts +0 -1
@@ -7,15 +7,15 @@ import {
7
7
  } from "./chunk-ONWFPHUI.js";
8
8
  import {
9
9
  restore
10
- } from "./chunk-D36FRVNN.js";
10
+ } from "./chunk-CVPZFRCC.js";
11
11
  import {
12
12
  hashParsedAst,
13
13
  hashSource
14
- } from "./chunk-WRGATIKL.js";
14
+ } from "./chunk-MJH73KJI.js";
15
15
  import {
16
16
  attachDumpController,
17
17
  createDumpController
18
- } from "./chunk-6NCYOKZQ.js";
18
+ } from "./chunk-VLRTLEDI.js";
19
19
  import {
20
20
  DUMP_FORMAT_VERSION,
21
21
  EXECUTION_SEMANTICS,
@@ -107,7 +107,7 @@ import {
107
107
  wrapCallerInjectedBindings,
108
108
  wrapCancelableBindings,
109
109
  wrapHostConstructor
110
- } from "./chunk-ZXDUALDQ.js";
110
+ } from "./chunk-BKNQTNHP.js";
111
111
  import {
112
112
  Budget,
113
113
  CompileScope,
@@ -122,16 +122,16 @@ import {
122
122
  parseSourceModule,
123
123
  replaceErrorStack,
124
124
  safeAddEvent
125
- } from "./chunk-A3LXCGMJ.js";
125
+ } from "./chunk-EQUBWQJN.js";
126
126
  import {
127
127
  dirname
128
- } from "./chunk-MMN3IESA.js";
128
+ } from "./chunk-KMBCLXER.js";
129
129
  import {
130
130
  AsyncLocalStorage,
131
131
  createHostCallbackContext,
132
132
  hostFs,
133
133
  types
134
- } from "./chunk-JCHJGIQA.js";
134
+ } from "./chunk-VVOPJZRG.js";
135
135
 
136
136
  // packages/safe-js/src/modules/source-graph.ts
137
137
  var ambiguous = /* @__PURE__ */ Symbol("ambiguous module export");
@@ -2339,7 +2339,7 @@ function run(source, options = {}) {
2339
2339
  throw new TypeError("Source resolution requires sourceType: 'module'.");
2340
2340
  if (options.sourceRoot !== void 0) {
2341
2341
  if (options.sourceResolver !== void 0) throw new TypeError("Specify sourceRoot or sourceResolver, not both.");
2342
- const { createRootedSourceResolver } = await import("./source-files-BSDM22Y2.js");
2342
+ const { createRootedSourceResolver } = await import("./source-files-A2WSOO6G.js");
2343
2343
  const { sourceRoot, ...resolved } = options;
2344
2344
  const sourceResolver = await createRootedSourceResolver(sourceRoot);
2345
2345
  return runWithExtensions(source, { ...resolved, filename: await sourceResolver.entryId(options.filename), sourceResolver }, jobs);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  deepCopyToSandbox
3
- } from "./chunk-ZXDUALDQ.js";
3
+ } from "./chunk-BKNQTNHP.js";
4
4
 
5
5
  // packages/safe-js/src/modules/harness.ts
6
6
  function makeHarnessModule(frontmatter, meta) {
@@ -41,13 +41,13 @@ import {
41
41
  sandboxErrorTypes,
42
42
  syntaxDiagnostics,
43
43
  templateRealms
44
- } from "./chunk-A3LXCGMJ.js";
44
+ } from "./chunk-EQUBWQJN.js";
45
45
  import {
46
46
  AsyncLocalStorage,
47
47
  cloneSharedBufferWrapper,
48
48
  setImmediate,
49
49
  types
50
- } from "./chunk-JCHJGIQA.js";
50
+ } from "./chunk-VVOPJZRG.js";
51
51
 
52
52
  // packages/safe-js/src/interp/native-promise-properties.ts
53
53
  var admittedSymbols = /* @__PURE__ */ new WeakMap();
@@ -8173,7 +8173,9 @@ function createInterpretedClosure(node, context, evaluateNode2, homeObject, init
8173
8173
  }
8174
8174
  });
8175
8175
  const value = "hasValue" in result && result.hasValue ? result.value : void 0;
8176
- reconcileCompiledValues(context.budget, [...scope.retainedDataRoots(), value], compilation, parent, [value]);
8176
+ if (context.budget.limits.dataSize !== void 0 || compilation.tickets.size > 0) {
8177
+ reconcileCompiledValues(context.budget, [...scope.retainedDataRoots(), value], compilation, parent, [value]);
8178
+ }
8177
8179
  if (result.kind === "error") throw result.error;
8178
8180
  if (result.kind === "throw") throw result.value;
8179
8181
  return value;
@@ -8422,13 +8424,15 @@ async function executeClosure(node, args, thisValue, context, evaluateNode2) {
8422
8424
  scope
8423
8425
  });
8424
8426
  const value = "hasValue" in result && result.hasValue ? result.value : void 0;
8425
- reconcileCompiledValues(
8426
- context.budget,
8427
- [...scope.retainedDataRoots(), value],
8428
- compilation,
8429
- parent,
8430
- [value]
8431
- );
8427
+ if (context.budget.limits.dataSize !== void 0 || compilation.tickets.size > 0) {
8428
+ reconcileCompiledValues(
8429
+ context.budget,
8430
+ [...scope.retainedDataRoots(), value],
8431
+ compilation,
8432
+ parent,
8433
+ [value]
8434
+ );
8435
+ }
8432
8436
  if (result.kind === "error") {
8433
8437
  throw result.error;
8434
8438
  }
@@ -25665,7 +25669,6 @@ async function evaluateNode(node, context, onReference) {
25665
25669
  const evaluationContext = compilation === void 0 ? context : {
25666
25670
  ...context,
25667
25671
  compilation,
25668
- deferDataScans: context.deferDataScans || node.type === "ForStatement" || node.type === "ForInStatement" || node.type === "ForOfStatement" || node.type === "WhileStatement" || node.type === "DoWhileStatement",
25669
25672
  get generatorResume() {
25670
25673
  return context.generatorResume;
25671
25674
  },
@@ -25675,16 +25678,17 @@ async function evaluateNode(node, context, onReference) {
25675
25678
  };
25676
25679
  try {
25677
25680
  const result = node.type === "Identifier" && onReference !== void 0 ? await evaluateIdentifier(node, evaluationContext, onReference) : await handler(node, evaluationContext);
25678
- if (!context.deferDataScans || context.budget.limits.dataSize !== void 0 || (compilation?.tickets.size ?? 0) > 0) {
25679
- reconcileDataBudget(
25680
- context.budget,
25681
- context.stats,
25682
- context.scope,
25683
- "hasValue" in result && result.hasValue ? result.value : void 0,
25684
- compilation,
25685
- context.compilation
25686
- );
25687
- }
25681
+ const transient = "hasValue" in result && result.hasValue ? result.value : void 0;
25682
+ reconcileDataBudget(
25683
+ context.budget,
25684
+ context.stats,
25685
+ context.scope,
25686
+ transient,
25687
+ compilation,
25688
+ context.compilation,
25689
+ true,
25690
+ handler === evaluatePrimitiveLiteral ? typeof transient === "string" ? transient.length : 8 : void 0
25691
+ );
25688
25692
  if (result.kind === "break" && result.label !== void 0 && "labels" in node && node.labels?.includes(result.label))
25689
25693
  return { kind: "normal", hasValue: context.evalCompletion === true && result.hasValue, value: context.evalCompletion ? result.value : void 0 };
25690
25694
  return result;
@@ -25709,14 +25713,20 @@ async function evaluateNode(node, context, onReference) {
25709
25713
  context.scope,
25710
25714
  completion.value,
25711
25715
  compilation,
25712
- context.compilation
25716
+ context.compilation,
25717
+ true
25713
25718
  );
25714
25719
  return completion;
25715
25720
  } finally {
25716
25721
  compilation?.dispose();
25717
25722
  }
25718
25723
  }
25719
- function reconcileDataBudget(budget, stats, scope, transient, compilation, parent) {
25724
+ function reconcileDataBudget(budget, stats, scope, transient, compilation, parent, nodeCheckpoint = false, growth) {
25725
+ if (nodeCheckpoint && (compilation?.tickets.size ?? 0) === 0) {
25726
+ const limit = budget.limits.dataSize;
25727
+ if (limit === void 0 || limit === Infinity) return;
25728
+ if (growth !== void 0 && budget.currentDataSize + growth <= limit) return;
25729
+ }
25720
25730
  reconcileCompiledValues(
25721
25731
  budget,
25722
25732
  [...scope.retainedDataRoots(), transient],
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  declareBudgetedHostOperation,
9
9
  declareHostOperation
10
- } from "./chunk-ZXDUALDQ.js";
10
+ } from "./chunk-BKNQTNHP.js";
11
11
  import {
12
12
  basename,
13
13
  dirname,
@@ -15,14 +15,14 @@ import {
15
15
  relative,
16
16
  resolve,
17
17
  sep
18
- } from "./chunk-MMN3IESA.js";
18
+ } from "./chunk-KMBCLXER.js";
19
19
  import {
20
20
  accessDeniedSystemError,
21
21
  constants,
22
22
  hostFs,
23
23
  hostPlatform,
24
24
  inspect
25
- } from "./chunk-JCHJGIQA.js";
25
+ } from "./chunk-VVOPJZRG.js";
26
26
 
27
27
  // packages/safe-js/src/modules/fs.ts
28
28
  import { createFsBridge } from "@poe-platform/safe-fs/core";