poe-code 14.0.44 → 14.0.45

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 (34) hide show
  1. package/dist/index.js +43 -22
  2. package/dist/index.js.map +3 -3
  3. package/dist/metafile.json +1 -1
  4. package/package.json +1 -1
  5. package/packages/safe-bash/dist/browser.js +72 -25
  6. package/packages/safe-bash/dist/browser.js.map +3 -3
  7. package/packages/safe-bash/dist/shell/parser.d.ts +3 -2
  8. package/packages/safe-bash/dist/shell/parser.d.ts.map +1 -1
  9. package/packages/safe-bash/dist/shell/parser.js +18 -21
  10. package/packages/safe-bash/dist/shell/parser.js.map +1 -1
  11. package/packages/safe-bash/dist/shell/runtime.d.ts.map +1 -1
  12. package/packages/safe-bash/dist/shell/runtime.js +14 -6
  13. package/packages/safe-bash/dist/shell/runtime.js.map +1 -1
  14. package/packages/safe-bash/dist/shell/shell.d.ts.map +1 -1
  15. package/packages/safe-bash/dist/shell/shell.js +4 -2
  16. package/packages/safe-bash/dist/shell/shell.js.map +1 -1
  17. package/packages/safe-bash/dist/shell/source-line-index.d.ts +10 -0
  18. package/packages/safe-bash/dist/shell/source-line-index.d.ts.map +1 -0
  19. package/packages/safe-bash/dist/shell/source-line-index.js +41 -0
  20. package/packages/safe-bash/dist/shell/source-line-index.js.map +1 -0
  21. package/packages/safe-js/dist/chunks/{chunk-JZXAWFPL.js → chunk-T3NC5O24.js} +43 -23
  22. package/packages/safe-js/dist/chunks/chunk-T3NC5O24.js.map +7 -0
  23. package/packages/safe-js/dist/chunks/{chunk-2GJ635AB.js → chunk-WQQANSWB.js} +2 -2
  24. package/packages/safe-js/dist/cli.js +2 -2
  25. package/packages/safe-js/dist/core.js +1 -1
  26. package/packages/safe-js/dist/index.js +2 -2
  27. package/packages/safe-js/dist/interp/exceptions.d.ts +1 -0
  28. package/packages/safe-js/dist/interp/exceptions.js +11 -11
  29. package/packages/safe-js/dist/interp/interpreter.js +2 -1
  30. package/packages/safe-js/dist/interp/patterns.js +2 -4
  31. package/packages/safe-js/dist/interp/values.d.ts +1 -1
  32. package/packages/safe-js/dist/interp/values.js +9 -4
  33. package/packages/safe-js/dist/chunks/chunk-JZXAWFPL.js.map +0 -7
  34. /package/packages/safe-js/dist/chunks/{chunk-2GJ635AB.js.map → chunk-WQQANSWB.js.map} +0 -0
package/dist/index.js CHANGED
@@ -128747,6 +128747,9 @@ async function evaluateCatchClause(node, thrownValue, context, evaluateNode3) {
128747
128747
  scope
128748
128748
  };
128749
128749
  if (node.param !== void 0) {
128750
+ for (const name of getPatternBindingNames(node.param)) {
128751
+ scope.predeclare(name, "let");
128752
+ }
128750
128753
  const binding = await bindPattern(node.param, thrownValue, catchContext, evaluateNode3);
128751
128754
  if (!binding.ok) {
128752
128755
  return binding.result;
@@ -128860,8 +128863,8 @@ async function bindArrayPattern(pattern, value, context, evaluateNode3) {
128860
128863
  return { ok: true };
128861
128864
  }
128862
128865
  async function bindObjectPattern(pattern, value, context, evaluateNode3) {
128863
- if (typeof value !== "object" && !Array.isArray(value) || value === null) {
128864
- throw new TypeError("Object catch bindings require a non-null object value.");
128866
+ if (value === null || value === void 0) {
128867
+ throw new TypeError("Object catch bindings require a non-nullish value.");
128865
128868
  }
128866
128869
  const excludedKeys = /* @__PURE__ */ new Set();
128867
128870
  for (const property of pattern.properties) {
@@ -128880,7 +128883,7 @@ async function bindObjectPattern(pattern, value, context, evaluateNode3) {
128880
128883
  excludedKeys.add(String(key3.value));
128881
128884
  const binding = await bindPattern(
128882
128885
  property.value,
128883
- getObjectPatternValue(value, key3.value),
128886
+ context.getProperty === void 0 ? getSandboxDataProperty(value, key3.value, context.budget) : context.getProperty(value, key3.value),
128884
128887
  context,
128885
128888
  evaluateNode3
128886
128889
  );
@@ -128924,15 +128927,9 @@ function getStaticPropertyKey(property) {
128924
128927
  throw new TypeError(`Unsupported catch binding property key '${property.type}'.`);
128925
128928
  }
128926
128929
  }
128927
- function getObjectPatternValue(value, key3) {
128928
- return value[key3];
128929
- }
128930
128930
  function copyObjectRest(value, excludedKeys) {
128931
128931
  const rest = /* @__PURE__ */ Object.create(null);
128932
- for (const [key3, entryValue] of Object.entries(value)) {
128933
- if (excludedKeys.has(key3)) {
128934
- continue;
128935
- }
128932
+ for (const [key3, entryValue] of ownEnumerableSandboxEntries(value, excludedKeys)) {
128936
128933
  rest[key3] = entryValue;
128937
128934
  }
128938
128935
  return rest;
@@ -128946,6 +128943,7 @@ var init_exceptions = __esm({
128946
128943
  init_host_call();
128947
128944
  init_promise_tracker();
128948
128945
  init_values();
128946
+ init_object_model();
128949
128947
  init_property_key();
128950
128948
  capturedExceptionBrand = /* @__PURE__ */ Symbol("CapturedException");
128951
128949
  }
@@ -130189,18 +130187,21 @@ function createSandboxClosure(input) {
130189
130187
  }
130190
130188
  return Object.freeze(closure);
130191
130189
  }
130192
- function ownEnumerableSandboxEntries(value) {
130190
+ function ownEnumerableSandboxEntries(value, excludedKeys) {
130193
130191
  if (isGuestHostObject(value)) {
130194
- const entries = [];
130192
+ const entries2 = [];
130195
130193
  for (const key3 of getHostObjectKeys(value)) {
130196
- if (hasHostObjectMember(value, key3, true)) entries.push([key3, getHostObjectMember(value, key3)]);
130194
+ if (excludedKeys?.has(key3)) continue;
130195
+ if (hasHostObjectMember(value, key3, true)) entries2.push([key3, getHostObjectMember(value, key3)]);
130197
130196
  }
130198
- return entries;
130197
+ return entries2;
130199
130198
  }
130200
130199
  if (value === null || value === void 0) throw new TypeError("Cannot convert undefined or null to object.");
130201
- if (isGuestClosure(value)) return Object.entries(value.properties ?? {});
130202
- if (isSandboxClosure(value) || isSandboxGenerator(value) || isSandboxMap(value) || isSandboxSet(value) || isSandboxPromise(value) || isSandboxRegex(value)) return [];
130203
- return Object.entries(Object(value));
130200
+ let entries;
130201
+ if (isGuestClosure(value)) entries = Object.entries(value.properties ?? {});
130202
+ else if (isSandboxClosure(value) || isSandboxGenerator(value) || isSandboxMap(value) || isSandboxSet(value) || isSandboxPromise(value) || isSandboxRegex(value)) return [];
130203
+ else entries = Object.entries(Object(value));
130204
+ return excludedKeys === void 0 ? entries : entries.filter(([key3]) => !excludedKeys.has(key3));
130204
130205
  }
130205
130206
  function createSandboxPromise(promise, metadata = {}) {
130206
130207
  const original = metadata.trackReplay === false ? promise : promiseReplayContext.getStore()?.track(promise) ?? promise;
@@ -131083,6 +131084,27 @@ function getSandboxPrototype(value, budget) {
131083
131084
  function hasExplicitSandboxPrototype(value) {
131084
131085
  return prototypes.has(value);
131085
131086
  }
131087
+ function getSandboxDataProperty(value, key3, budget) {
131088
+ let current = value;
131089
+ let depth = 0;
131090
+ while (typeof current === "object" && current !== null) {
131091
+ if (isGuestHostObject(current)) return getHostObjectMember(current, String(key3));
131092
+ if (isGuestClosure(current)) return getGuestFunctionProperty(current, String(key3));
131093
+ if (isSandboxClosure(current)) {
131094
+ const properties = current.properties;
131095
+ return properties !== void 0 && Object.hasOwn(properties, String(key3)) ? properties[String(key3)] : void 0;
131096
+ }
131097
+ if (isSandboxMap(current) || isSandboxSet(current) || isSandboxPromise(current) || isSandboxRegex(current) || isSandboxGenerator(current))
131098
+ return void 0;
131099
+ if (Object.hasOwn(current, String(key3))) return current[String(key3)];
131100
+ current = getSandboxPrototype(current, budget);
131101
+ if (current !== null) {
131102
+ budget?.visitNode();
131103
+ assertSandboxDataDepth(++depth);
131104
+ }
131105
+ }
131106
+ return void 0;
131107
+ }
131086
131108
  function setSandboxPrototype(value, prototype, budget) {
131087
131109
  if (budget !== void 0 && intrinsicPrototypes.get(budget) === value && prototype !== null) {
131088
131110
  throw new TypeError("Object.prototype has an immutable null prototype.");
@@ -143689,10 +143711,8 @@ function describeRuntimeValue(value) {
143689
143711
  }
143690
143712
  function copyObjectRestValue(value, excludedKeys) {
143691
143713
  const rest = /* @__PURE__ */ Object.create(null);
143692
- for (const [key3, entryValue] of ownEnumerableSandboxEntries(value)) {
143693
- if (!excludedKeys.has(key3)) {
143694
- defineProperty(rest, key3, entryValue);
143695
- }
143714
+ for (const [key3, entryValue] of ownEnumerableSandboxEntries(value, excludedKeys)) {
143715
+ defineProperty(rest, key3, entryValue);
143696
143716
  }
143697
143717
  return rest;
143698
143718
  }
@@ -147549,7 +147569,8 @@ async function evaluateThrowStatement2(node, context) {
147549
147569
  async function evaluateTryStatement2(node, context) {
147550
147570
  return evaluateTryStatement(node, {
147551
147571
  ...context,
147552
- toPropertyKey: (value) => toPropertyKey(value, context.budget, createCoercionContext(context))
147572
+ toPropertyKey: (value) => toPropertyKey(value, context.budget, createCoercionContext(context)),
147573
+ getProperty: (value, key3) => getPropertyValue(value, key3, context)
147553
147574
  }, evaluateNode2);
147554
147575
  }
147555
147576
  async function evaluateUnaryExpression(node, context) {