poe-code 11.0.17 → 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/dist/index.js +22 -15
- package/dist/index.js.map +2 -2
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/safejs/dist/chunks/{chunk-D4DDI3HH.js → chunk-6BCUWJFF.js} +22 -15
- package/packages/safejs/dist/chunks/{chunk-D4DDI3HH.js.map → chunk-6BCUWJFF.js.map} +2 -2
- package/packages/safejs/dist/chunks/{chunk-COHIMIAF.js → chunk-BIGMX2WV.js} +2 -2
- package/packages/safejs/dist/cli.js +2 -2
- package/packages/safejs/dist/core.js +1 -1
- package/packages/safejs/dist/index.js +2 -2
- package/packages/safejs/dist/interp/exceptions.d.ts +3 -2
- package/packages/safejs/dist/interp/exceptions.js +6 -2
- package/packages/safejs/dist/interp/interpreter.js +14 -14
- /package/packages/safejs/dist/chunks/{chunk-COHIMIAF.js.map → chunk-BIGMX2WV.js.map} +0 -0
package/package.json
CHANGED
|
@@ -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,
|
|
@@ -25846,7 +25850,7 @@ async function evaluateNode(node, context) {
|
|
|
25846
25850
|
error
|
|
25847
25851
|
};
|
|
25848
25852
|
}
|
|
25849
|
-
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);
|
|
25850
25854
|
return {
|
|
25851
25855
|
kind: "throw",
|
|
25852
25856
|
hasValue: true,
|
|
@@ -27541,7 +27545,7 @@ async function evaluateStringMethodCall(node, target, methodName, context) {
|
|
|
27541
27545
|
if (isFatalSandboxError(error)) {
|
|
27542
27546
|
throw error;
|
|
27543
27547
|
}
|
|
27544
|
-
throw captureException(error, [...context.callStack, formatStackFrame(node, methodName)]);
|
|
27548
|
+
throw captureException(error, [...context.callStack, formatStackFrame(node, methodName)], true);
|
|
27545
27549
|
} finally {
|
|
27546
27550
|
leaveCall();
|
|
27547
27551
|
}
|
|
@@ -27568,7 +27572,7 @@ async function evaluateArrayMethodCall(node, target, methodName, context) {
|
|
|
27568
27572
|
if (isFatalSandboxError(error)) {
|
|
27569
27573
|
throw error;
|
|
27570
27574
|
}
|
|
27571
|
-
throw captureException(error, [...context.callStack, formatStackFrame(node, methodName)]);
|
|
27575
|
+
throw captureException(error, [...context.callStack, formatStackFrame(node, methodName)], true);
|
|
27572
27576
|
} finally {
|
|
27573
27577
|
leaveCall();
|
|
27574
27578
|
}
|
|
@@ -27595,7 +27599,7 @@ async function evaluateMapMethodCall(node, target, methodName, context) {
|
|
|
27595
27599
|
if (isFatalSandboxError(error)) {
|
|
27596
27600
|
throw error;
|
|
27597
27601
|
}
|
|
27598
|
-
throw captureException(error, [...context.callStack, formatStackFrame(node, methodName)]);
|
|
27602
|
+
throw captureException(error, [...context.callStack, formatStackFrame(node, methodName)], true);
|
|
27599
27603
|
} finally {
|
|
27600
27604
|
leaveCall();
|
|
27601
27605
|
}
|
|
@@ -27622,7 +27626,7 @@ async function evaluateSetMethodCall(node, target, methodName, context) {
|
|
|
27622
27626
|
if (isFatalSandboxError(error)) {
|
|
27623
27627
|
throw error;
|
|
27624
27628
|
}
|
|
27625
|
-
throw captureException(error, [...context.callStack, formatStackFrame(node, methodName)]);
|
|
27629
|
+
throw captureException(error, [...context.callStack, formatStackFrame(node, methodName)], true);
|
|
27626
27630
|
} finally {
|
|
27627
27631
|
leaveCall();
|
|
27628
27632
|
}
|
|
@@ -28000,7 +28004,7 @@ async function evaluateNumberMethodCall(node, target, methodName, context) {
|
|
|
28000
28004
|
if (isFatalSandboxError(error)) {
|
|
28001
28005
|
throw error;
|
|
28002
28006
|
}
|
|
28003
|
-
throw captureException(error, [...context.callStack, formatStackFrame(node, methodName)]);
|
|
28007
|
+
throw captureException(error, [...context.callStack, formatStackFrame(node, methodName)], true);
|
|
28004
28008
|
}
|
|
28005
28009
|
}
|
|
28006
28010
|
function createArrayMethodOptions(context) {
|
|
@@ -28042,12 +28046,15 @@ async function invokeSandboxClosure(callee, args, context, stack, span, thisValu
|
|
|
28042
28046
|
if (isSandboxPromise(result) && result.synchronousPrefix !== void 0) {
|
|
28043
28047
|
await result.synchronousPrefix;
|
|
28044
28048
|
}
|
|
28045
|
-
return !construct && callee.async === true ? normalizeClosureResult(
|
|
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);
|
|
28046
28053
|
} catch (error) {
|
|
28047
28054
|
if (isFatalSandboxError(error)) {
|
|
28048
28055
|
throw error;
|
|
28049
28056
|
}
|
|
28050
|
-
throw captureException(error, stack);
|
|
28057
|
+
throw captureException(error, stack, callee.sandbox === true);
|
|
28051
28058
|
} finally {
|
|
28052
28059
|
leaveCall();
|
|
28053
28060
|
}
|
|
@@ -28172,19 +28179,19 @@ function isInterpreterError(value) {
|
|
|
28172
28179
|
function hasOwnProperty2(value, name) {
|
|
28173
28180
|
return Object.prototype.hasOwnProperty.call(value, name);
|
|
28174
28181
|
}
|
|
28175
|
-
function wrapHostResult(result, stack) {
|
|
28182
|
+
function wrapHostResult(result, stack, sandbox) {
|
|
28176
28183
|
if (!isPromiseLikeResult(result)) {
|
|
28177
28184
|
return result;
|
|
28178
28185
|
}
|
|
28179
28186
|
return Promise.resolve(result).then(
|
|
28180
28187
|
(value) => value,
|
|
28181
28188
|
(reason) => Promise.reject(
|
|
28182
|
-
isInterpreterError(reason) || reason instanceof SandboxError || isCapturedException(reason) ? reason : createCapturedException(reason, stack)
|
|
28189
|
+
isInterpreterError(reason) || reason instanceof SandboxError || isCapturedException(reason) ? reason : createCapturedException(reason, stack, sandbox)
|
|
28183
28190
|
)
|
|
28184
28191
|
);
|
|
28185
28192
|
}
|
|
28186
|
-
function captureException(error, stack) {
|
|
28187
|
-
return isCapturedException(error) ? error : createCapturedException(error, stack);
|
|
28193
|
+
function captureException(error, stack, sandbox) {
|
|
28194
|
+
return isCapturedException(error) ? error : createCapturedException(error, stack, sandbox);
|
|
28188
28195
|
}
|
|
28189
28196
|
function isFatalSandboxError(error) {
|
|
28190
28197
|
return error instanceof SandboxError && (error.code === "budgetExceeded" || error.code === "reentry");
|
|
@@ -29065,4 +29072,4 @@ export {
|
|
|
29065
29072
|
FileSnapshotBackend,
|
|
29066
29073
|
run
|
|
29067
29074
|
};
|
|
29068
|
-
//# sourceMappingURL=chunk-
|
|
29075
|
+
//# sourceMappingURL=chunk-6BCUWJFF.js.map
|