poe-code 11.0.16 → 11.0.18

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-code",
3
- "version": "11.0.16",
3
+ "version": "11.0.18",
4
4
  "description": "CLI tool to configure Poe API for developer workflows.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -18107,9 +18107,10 @@ async function evaluateTryStatement(node, context, evaluateNode2) {
18107
18107
  }
18108
18108
  return finalizerResult;
18109
18109
  }
18110
- function createCapturedException(reason, stackFrames) {
18110
+ function createCapturedException(reason, stackFrames, sandbox = false) {
18111
18111
  return {
18112
18112
  reason,
18113
+ sandbox,
18113
18114
  stackFrames,
18114
18115
  [capturedExceptionBrand]: true
18115
18116
  };
@@ -18117,7 +18118,7 @@ function createCapturedException(reason, stackFrames) {
18117
18118
  function isCapturedException(value) {
18118
18119
  return typeof value === "object" && value !== null && capturedExceptionBrand in value;
18119
18120
  }
18120
- function coerceThrownValue(reason, budget, stackFrames, span) {
18121
+ function coerceThrownValue(reason, budget, stackFrames, span, sandbox = false) {
18121
18122
  if (isSubsetErrorValue(reason)) {
18122
18123
  attachErrorSpan(reason, readErrorSpan(reason) ?? span);
18123
18124
  return reason;
@@ -18129,6 +18130,9 @@ function coerceThrownValue(reason, budget, stackFrames, span) {
18129
18130
  span
18130
18131
  });
18131
18132
  }
18133
+ if (sandbox) {
18134
+ return reason;
18135
+ }
18132
18136
  if (isErrorLikeValue(reason)) {
18133
18137
  return createSubsetErrorValue(reason.name || "Error", reason.message, stackFrames, budget, {
18134
18138
  chargeBudget: false,
@@ -19806,7 +19810,10 @@ function measureSandboxData(values, options = {}) {
19806
19810
  usage += 1;
19807
19811
  if (Array.isArray(value)) {
19808
19812
  usage += value.length;
19809
- for (const entry of value) visit(entry);
19813
+ for (let index = 0; index < value.length; index += 1) {
19814
+ const descriptor = Object.getOwnPropertyDescriptor(value, index);
19815
+ if (descriptor !== void 0 && "value" in descriptor) visit(descriptor.value);
19816
+ }
19810
19817
  return;
19811
19818
  }
19812
19819
  if (isSandboxMap(value)) {
@@ -19840,7 +19847,7 @@ function measureSandboxData(values, options = {}) {
19840
19847
  usage += value.source.length + value.flags.length;
19841
19848
  return;
19842
19849
  }
19843
- const entries = isSandboxArguments(value) ? getSandboxArgumentEntries(value) : Object.entries(value);
19850
+ const entries = isSandboxArguments(value) ? getSandboxArgumentEntries(value) : Object.entries(Object.getOwnPropertyDescriptors(value)).filter(([, descriptor]) => descriptor.enumerable).map(([key, descriptor]) => [key, "value" in descriptor ? descriptor.value : void 0]);
19844
19851
  usage += entries.length;
19845
19852
  for (const [key, entry] of entries) {
19846
19853
  usage += key.length;
@@ -25843,7 +25850,7 @@ async function evaluateNode(node, context) {
25843
25850
  error
25844
25851
  };
25845
25852
  }
25846
- const exception = isCapturedException(error) ? coerceThrownValue(error.reason, context.budget, error.stackFrames, node.span) : coerceThrownValue(error, context.budget, context.callStack, node.span);
25853
+ const exception = isCapturedException(error) ? coerceThrownValue(error.reason, context.budget, error.stackFrames, node.span, error.sandbox) : coerceThrownValue(error, context.budget, context.callStack, node.span, true);
25847
25854
  return {
25848
25855
  kind: "throw",
25849
25856
  hasValue: true,
@@ -27538,7 +27545,7 @@ async function evaluateStringMethodCall(node, target, methodName, context) {
27538
27545
  if (isFatalSandboxError(error)) {
27539
27546
  throw error;
27540
27547
  }
27541
- throw captureException(error, [...context.callStack, formatStackFrame(node, methodName)]);
27548
+ throw captureException(error, [...context.callStack, formatStackFrame(node, methodName)], true);
27542
27549
  } finally {
27543
27550
  leaveCall();
27544
27551
  }
@@ -27565,7 +27572,7 @@ async function evaluateArrayMethodCall(node, target, methodName, context) {
27565
27572
  if (isFatalSandboxError(error)) {
27566
27573
  throw error;
27567
27574
  }
27568
- throw captureException(error, [...context.callStack, formatStackFrame(node, methodName)]);
27575
+ throw captureException(error, [...context.callStack, formatStackFrame(node, methodName)], true);
27569
27576
  } finally {
27570
27577
  leaveCall();
27571
27578
  }
@@ -27592,7 +27599,7 @@ async function evaluateMapMethodCall(node, target, methodName, context) {
27592
27599
  if (isFatalSandboxError(error)) {
27593
27600
  throw error;
27594
27601
  }
27595
- throw captureException(error, [...context.callStack, formatStackFrame(node, methodName)]);
27602
+ throw captureException(error, [...context.callStack, formatStackFrame(node, methodName)], true);
27596
27603
  } finally {
27597
27604
  leaveCall();
27598
27605
  }
@@ -27619,7 +27626,7 @@ async function evaluateSetMethodCall(node, target, methodName, context) {
27619
27626
  if (isFatalSandboxError(error)) {
27620
27627
  throw error;
27621
27628
  }
27622
- throw captureException(error, [...context.callStack, formatStackFrame(node, methodName)]);
27629
+ throw captureException(error, [...context.callStack, formatStackFrame(node, methodName)], true);
27623
27630
  } finally {
27624
27631
  leaveCall();
27625
27632
  }
@@ -27997,7 +28004,7 @@ async function evaluateNumberMethodCall(node, target, methodName, context) {
27997
28004
  if (isFatalSandboxError(error)) {
27998
28005
  throw error;
27999
28006
  }
28000
- throw captureException(error, [...context.callStack, formatStackFrame(node, methodName)]);
28007
+ throw captureException(error, [...context.callStack, formatStackFrame(node, methodName)], true);
28001
28008
  }
28002
28009
  }
28003
28010
  function createArrayMethodOptions(context) {
@@ -28039,12 +28046,15 @@ async function invokeSandboxClosure(callee, args, context, stack, span, thisValu
28039
28046
  if (isSandboxPromise(result) && result.synchronousPrefix !== void 0) {
28040
28047
  await result.synchronousPrefix;
28041
28048
  }
28042
- return !construct && callee.async === true ? normalizeClosureResult(wrapHostResult(result, stack), context.budget) : await wrapHostResult(result, stack);
28049
+ return !construct && callee.async === true ? normalizeClosureResult(
28050
+ wrapHostResult(result, stack, callee.sandbox === true),
28051
+ context.budget
28052
+ ) : await wrapHostResult(result, stack, callee.sandbox === true);
28043
28053
  } catch (error) {
28044
28054
  if (isFatalSandboxError(error)) {
28045
28055
  throw error;
28046
28056
  }
28047
- throw captureException(error, stack);
28057
+ throw captureException(error, stack, callee.sandbox === true);
28048
28058
  } finally {
28049
28059
  leaveCall();
28050
28060
  }
@@ -28169,19 +28179,19 @@ function isInterpreterError(value) {
28169
28179
  function hasOwnProperty2(value, name) {
28170
28180
  return Object.prototype.hasOwnProperty.call(value, name);
28171
28181
  }
28172
- function wrapHostResult(result, stack) {
28182
+ function wrapHostResult(result, stack, sandbox) {
28173
28183
  if (!isPromiseLikeResult(result)) {
28174
28184
  return result;
28175
28185
  }
28176
28186
  return Promise.resolve(result).then(
28177
28187
  (value) => value,
28178
28188
  (reason) => Promise.reject(
28179
- isInterpreterError(reason) || reason instanceof SandboxError || isCapturedException(reason) ? reason : createCapturedException(reason, stack)
28189
+ isInterpreterError(reason) || reason instanceof SandboxError || isCapturedException(reason) ? reason : createCapturedException(reason, stack, sandbox)
28180
28190
  )
28181
28191
  );
28182
28192
  }
28183
- function captureException(error, stack) {
28184
- return isCapturedException(error) ? error : createCapturedException(error, stack);
28193
+ function captureException(error, stack, sandbox) {
28194
+ return isCapturedException(error) ? error : createCapturedException(error, stack, sandbox);
28185
28195
  }
28186
28196
  function isFatalSandboxError(error) {
28187
28197
  return error instanceof SandboxError && (error.code === "budgetExceeded" || error.code === "reentry");
@@ -29062,4 +29072,4 @@ export {
29062
29072
  FileSnapshotBackend,
29063
29073
  run
29064
29074
  };
29065
- //# sourceMappingURL=chunk-KNMVUWS7.js.map
29075
+ //# sourceMappingURL=chunk-6BCUWJFF.js.map