@poe-platform/safe-js 0.1.94 → 0.1.96
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/dist/safe-js/chunks/{chunk-T3NC5O24.js → chunk-4TLNAG7I.js} +50 -26
- package/dist/safe-js/chunks/chunk-4TLNAG7I.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-ADIFHHXM.js → chunk-7WYL7YGQ.js} +2 -2
- package/dist/safe-js/cli.js +2 -2
- package/dist/safe-js/core.js +1 -1
- package/dist/safe-js/index.js +2 -2
- package/dist/safe-js/interp/budget.d.ts +1 -0
- package/dist/safe-js/interp/exceptions.d.ts +3 -0
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-T3NC5O24.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-ADIFHHXM.js.map → chunk-7WYL7YGQ.js.map} +0 -0
|
@@ -172,6 +172,9 @@ var SandboxError = class extends Error {
|
|
|
172
172
|
this.limit = input.limit;
|
|
173
173
|
}
|
|
174
174
|
};
|
|
175
|
+
function isFatalSandboxError(error) {
|
|
176
|
+
return error instanceof SandboxError && (error.code === "budgetExceeded" || error.code === "reentry");
|
|
177
|
+
}
|
|
175
178
|
var Budget = class {
|
|
176
179
|
deadline;
|
|
177
180
|
limits;
|
|
@@ -8646,7 +8649,19 @@ async function evaluateTryStatement(node, context, evaluateNode2) {
|
|
|
8646
8649
|
value: void 0
|
|
8647
8650
|
};
|
|
8648
8651
|
}
|
|
8649
|
-
|
|
8652
|
+
let tryOrCatchResult = tryResult;
|
|
8653
|
+
let catchFailure;
|
|
8654
|
+
if (fatalBudgetError === void 0 && tryResult.kind === "throw" && node.handler !== void 0) {
|
|
8655
|
+
try {
|
|
8656
|
+
tryOrCatchResult = await evaluateCatchClause(node.handler, tryResult.value, context, evaluateNode2);
|
|
8657
|
+
} catch (error) {
|
|
8658
|
+
if (isFatalSandboxError(error) || isInterpreterError(error) || error instanceof HostCallResumabilityError) {
|
|
8659
|
+
throw error;
|
|
8660
|
+
}
|
|
8661
|
+
catchFailure = createThrowCompletion(error, context.budget, context.callStack, node.span);
|
|
8662
|
+
tryOrCatchResult = catchFailure;
|
|
8663
|
+
}
|
|
8664
|
+
}
|
|
8650
8665
|
if (node.finalizer === void 0 || tryOrCatchResult.kind === "error") {
|
|
8651
8666
|
return tryOrCatchResult;
|
|
8652
8667
|
}
|
|
@@ -8654,14 +8669,38 @@ async function evaluateTryStatement(node, context, evaluateNode2) {
|
|
|
8654
8669
|
context,
|
|
8655
8670
|
() => evaluateBlockCompletion(node.finalizer, context, evaluateNode2)
|
|
8656
8671
|
) : evaluateBlockCompletion(node.finalizer, context, evaluateNode2);
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
|
|
8672
|
+
if (catchFailure !== void 0) {
|
|
8673
|
+
const value = catchFailure.value;
|
|
8674
|
+
context.budget.setRetainedValues(catchFailure, () => [value]);
|
|
8660
8675
|
}
|
|
8661
|
-
|
|
8662
|
-
|
|
8676
|
+
try {
|
|
8677
|
+
const finalizerResult = await (fatalBudgetError === void 0 ? evaluateFinalizer() : withFatalPromiseCleanup(evaluateFinalizer));
|
|
8678
|
+
if (fatalBudgetError !== void 0) {
|
|
8679
|
+
throw fatalBudgetError;
|
|
8680
|
+
}
|
|
8681
|
+
if (finalizerResult.kind === "normal") {
|
|
8682
|
+
return tryOrCatchResult;
|
|
8683
|
+
}
|
|
8684
|
+
return finalizerResult;
|
|
8685
|
+
} finally {
|
|
8686
|
+
if (catchFailure !== void 0) context.budget.setRetainedValues(catchFailure, void 0);
|
|
8663
8687
|
}
|
|
8664
|
-
|
|
8688
|
+
}
|
|
8689
|
+
function createThrowCompletion(error, budget, stackFrames, span) {
|
|
8690
|
+
const value = isCapturedException(error) ? coerceThrownValue(error.reason, budget, error.stackFrames, span, error.sandbox) : coerceThrownValue(error, budget, stackFrames, span, true);
|
|
8691
|
+
return {
|
|
8692
|
+
kind: "throw",
|
|
8693
|
+
hasValue: true,
|
|
8694
|
+
span: readErrorSpan(value) ?? span,
|
|
8695
|
+
stackFrames: isCapturedException(error) ? error.stackFrames : stackFrames,
|
|
8696
|
+
value
|
|
8697
|
+
};
|
|
8698
|
+
}
|
|
8699
|
+
function isInterpreterError(value) {
|
|
8700
|
+
return typeof value === "object" && value !== null && hasOwnProperty2(value, "code") && hasOwnProperty2(value, "message") && hasOwnProperty2(value, "nodeType") && hasOwnProperty2(value, "span") && (value.code === "UNBOUND_IDENTIFIER" || value.code === "UNSUPPORTED_NODE");
|
|
8701
|
+
}
|
|
8702
|
+
function hasOwnProperty2(value, name) {
|
|
8703
|
+
return Object.prototype.hasOwnProperty.call(value, name);
|
|
8665
8704
|
}
|
|
8666
8705
|
function createCapturedException(reason, stackFrames, sandbox = false) {
|
|
8667
8706
|
return {
|
|
@@ -26070,22 +26109,16 @@ async function evaluateNode(node, context) {
|
|
|
26070
26109
|
error
|
|
26071
26110
|
};
|
|
26072
26111
|
}
|
|
26073
|
-
const
|
|
26112
|
+
const completion = createThrowCompletion(error, context.budget, context.callStack, node.span);
|
|
26074
26113
|
reconcileDataBudget(
|
|
26075
26114
|
context.budget,
|
|
26076
26115
|
context.stats,
|
|
26077
26116
|
context.scope,
|
|
26078
|
-
|
|
26117
|
+
completion.value,
|
|
26079
26118
|
compilation,
|
|
26080
26119
|
context.compilation
|
|
26081
26120
|
);
|
|
26082
|
-
return
|
|
26083
|
-
kind: "throw",
|
|
26084
|
-
hasValue: true,
|
|
26085
|
-
span: readErrorSpan(exception) ?? node.span,
|
|
26086
|
-
stackFrames: isCapturedException(error) ? error.stackFrames : context.callStack,
|
|
26087
|
-
value: exception
|
|
26088
|
-
};
|
|
26121
|
+
return completion;
|
|
26089
26122
|
} finally {
|
|
26090
26123
|
compilation.dispose();
|
|
26091
26124
|
}
|
|
@@ -28562,12 +28595,6 @@ function defineSandboxProperty(target, key, value) {
|
|
|
28562
28595
|
writable: true
|
|
28563
28596
|
});
|
|
28564
28597
|
}
|
|
28565
|
-
function isInterpreterError(value) {
|
|
28566
|
-
return typeof value === "object" && value !== null && hasOwnProperty2(value, "code") && hasOwnProperty2(value, "message") && hasOwnProperty2(value, "nodeType") && hasOwnProperty2(value, "span") && (value.code === "UNBOUND_IDENTIFIER" || value.code === "UNSUPPORTED_NODE");
|
|
28567
|
-
}
|
|
28568
|
-
function hasOwnProperty2(value, name) {
|
|
28569
|
-
return Object.prototype.hasOwnProperty.call(value, name);
|
|
28570
|
-
}
|
|
28571
28598
|
function wrapHostResult(result, stack, sandbox) {
|
|
28572
28599
|
if (!isPromiseLikeResult(result)) {
|
|
28573
28600
|
return result;
|
|
@@ -28582,9 +28609,6 @@ function wrapHostResult(result, stack, sandbox) {
|
|
|
28582
28609
|
function captureException(error, stack, sandbox) {
|
|
28583
28610
|
return isCapturedException(error) ? error : createCapturedException(error, stack, sandbox);
|
|
28584
28611
|
}
|
|
28585
|
-
function isFatalSandboxError(error) {
|
|
28586
|
-
return error instanceof SandboxError && (error.code === "budgetExceeded" || error.code === "reentry");
|
|
28587
|
-
}
|
|
28588
28612
|
function isPromiseLikeResult(value) {
|
|
28589
28613
|
return typeof value === "object" && value !== null && "then" in value;
|
|
28590
28614
|
}
|
|
@@ -32917,4 +32941,4 @@ export {
|
|
|
32917
32941
|
FileSnapshotBackend,
|
|
32918
32942
|
run
|
|
32919
32943
|
};
|
|
32920
|
-
//# sourceMappingURL=chunk-
|
|
32944
|
+
//# sourceMappingURL=chunk-4TLNAG7I.js.map
|