poe-code 14.0.45 → 14.0.47
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 +53 -26
- package/dist/index.js.map +3 -3
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/safe-bash/dist/browser.js +15 -5
- package/packages/safe-bash/dist/browser.js.map +2 -2
- package/packages/safe-bash/dist/commands/network/authorizer.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/network/authorizer.js +4 -1
- package/packages/safe-bash/dist/commands/network/authorizer.js.map +1 -1
- package/packages/safe-bash/dist/contracts/filesystem-output.d.ts.map +1 -1
- package/packages/safe-bash/dist/contracts/filesystem-output.js +12 -4
- package/packages/safe-bash/dist/contracts/filesystem-output.js.map +1 -1
- package/packages/safe-js/dist/chunks/{chunk-WQQANSWB.js → chunk-WQY27BRL.js} +2 -2
- package/packages/safe-js/dist/chunks/{chunk-T3NC5O24.js → chunk-XC53RECY.js} +54 -27
- package/packages/safe-js/dist/chunks/chunk-XC53RECY.js.map +7 -0
- package/packages/safe-js/dist/cli.js +2 -2
- package/packages/safe-js/dist/core.js +1 -1
- package/packages/safe-js/dist/index.js +2 -2
- package/packages/safe-js/dist/interp/budget.d.ts +1 -0
- package/packages/safe-js/dist/interp/budget.js +3 -0
- package/packages/safe-js/dist/interp/exceptions.d.ts +3 -0
- package/packages/safe-js/dist/interp/exceptions.js +57 -12
- package/packages/safe-js/dist/interp/interpreter.js +6 -29
- package/packages/safe-js/dist/interp/methods/function.js +5 -2
- package/packages/safe-js/dist/chunks/chunk-T3NC5O24.js.map +0 -7
- /package/packages/safe-js/dist/chunks/{chunk-WQQANSWB.js.map → chunk-WQY27BRL.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -119789,6 +119789,9 @@ var init_shape = __esm({
|
|
|
119789
119789
|
});
|
|
119790
119790
|
|
|
119791
119791
|
// packages/safe-js/src/interp/budget.ts
|
|
119792
|
+
function isFatalSandboxError(error3) {
|
|
119793
|
+
return error3 instanceof SandboxError && (error3.code === "budgetExceeded" || error3.code === "reentry");
|
|
119794
|
+
}
|
|
119792
119795
|
function allocateRegexSteps(steps) {
|
|
119793
119796
|
if (!Number.isInteger(steps) || steps < 0) {
|
|
119794
119797
|
throw new Error("steps must be a non-negative integer.");
|
|
@@ -128545,7 +128548,19 @@ async function evaluateTryStatement(node, context, evaluateNode3) {
|
|
|
128545
128548
|
value: void 0
|
|
128546
128549
|
};
|
|
128547
128550
|
}
|
|
128548
|
-
|
|
128551
|
+
let tryOrCatchResult = tryResult;
|
|
128552
|
+
let catchFailure;
|
|
128553
|
+
if (fatalBudgetError === void 0 && tryResult.kind === "throw" && node.handler !== void 0) {
|
|
128554
|
+
try {
|
|
128555
|
+
tryOrCatchResult = await evaluateCatchClause(node.handler, tryResult.value, context, evaluateNode3);
|
|
128556
|
+
} catch (error3) {
|
|
128557
|
+
if (isFatalSandboxError(error3) || isInterpreterError(error3) || error3 instanceof HostCallResumabilityError) {
|
|
128558
|
+
throw error3;
|
|
128559
|
+
}
|
|
128560
|
+
catchFailure = createThrowCompletion(error3, context.budget, context.callStack, node.span);
|
|
128561
|
+
tryOrCatchResult = catchFailure;
|
|
128562
|
+
}
|
|
128563
|
+
}
|
|
128549
128564
|
if (node.finalizer === void 0 || tryOrCatchResult.kind === "error") {
|
|
128550
128565
|
return tryOrCatchResult;
|
|
128551
128566
|
}
|
|
@@ -128553,14 +128568,38 @@ async function evaluateTryStatement(node, context, evaluateNode3) {
|
|
|
128553
128568
|
context,
|
|
128554
128569
|
() => evaluateBlockCompletion(node.finalizer, context, evaluateNode3)
|
|
128555
128570
|
) : evaluateBlockCompletion(node.finalizer, context, evaluateNode3);
|
|
128556
|
-
|
|
128557
|
-
|
|
128558
|
-
|
|
128571
|
+
if (catchFailure !== void 0) {
|
|
128572
|
+
const value = catchFailure.value;
|
|
128573
|
+
context.budget.setRetainedValues(catchFailure, () => [value]);
|
|
128559
128574
|
}
|
|
128560
|
-
|
|
128561
|
-
|
|
128575
|
+
try {
|
|
128576
|
+
const finalizerResult = await (fatalBudgetError === void 0 ? evaluateFinalizer() : withFatalPromiseCleanup(evaluateFinalizer));
|
|
128577
|
+
if (fatalBudgetError !== void 0) {
|
|
128578
|
+
throw fatalBudgetError;
|
|
128579
|
+
}
|
|
128580
|
+
if (finalizerResult.kind === "normal") {
|
|
128581
|
+
return tryOrCatchResult;
|
|
128582
|
+
}
|
|
128583
|
+
return finalizerResult;
|
|
128584
|
+
} finally {
|
|
128585
|
+
if (catchFailure !== void 0) context.budget.setRetainedValues(catchFailure, void 0);
|
|
128562
128586
|
}
|
|
128563
|
-
|
|
128587
|
+
}
|
|
128588
|
+
function createThrowCompletion(error3, budget, stackFrames, span) {
|
|
128589
|
+
const value = isCapturedException(error3) ? coerceThrownValue(error3.reason, budget, error3.stackFrames, span, error3.sandbox) : coerceThrownValue(error3, budget, stackFrames, span, true);
|
|
128590
|
+
return {
|
|
128591
|
+
kind: "throw",
|
|
128592
|
+
hasValue: true,
|
|
128593
|
+
span: readErrorSpan(value) ?? span,
|
|
128594
|
+
stackFrames: isCapturedException(error3) ? error3.stackFrames : stackFrames,
|
|
128595
|
+
value
|
|
128596
|
+
};
|
|
128597
|
+
}
|
|
128598
|
+
function isInterpreterError(value) {
|
|
128599
|
+
return typeof value === "object" && value !== null && hasOwnProperty15(value, "code") && hasOwnProperty15(value, "message") && hasOwnProperty15(value, "nodeType") && hasOwnProperty15(value, "span") && (value.code === "UNBOUND_IDENTIFIER" || value.code === "UNSUPPORTED_NODE");
|
|
128600
|
+
}
|
|
128601
|
+
function hasOwnProperty15(value, name) {
|
|
128602
|
+
return Object.prototype.hasOwnProperty.call(value, name);
|
|
128564
128603
|
}
|
|
128565
128604
|
function createCapturedException(reason, stackFrames, sandbox = false) {
|
|
128566
128605
|
return {
|
|
@@ -144469,13 +144508,16 @@ function getFunctionMember(target, property, options) {
|
|
|
144469
144508
|
return createSandboxClosure({
|
|
144470
144509
|
sandbox: true,
|
|
144471
144510
|
name: `Function#${property}`,
|
|
144472
|
-
call: (args, context) => callFunctionMethod(
|
|
144511
|
+
call: (args, context) => callFunctionMethod(context?.thisValue, property, args, options, context?.stack ?? [])
|
|
144473
144512
|
});
|
|
144474
144513
|
}
|
|
144475
144514
|
function isFunctionMethodName(property) {
|
|
144476
144515
|
return typeof property === "string" && functionMethodNames.has(property);
|
|
144477
144516
|
}
|
|
144478
144517
|
function callFunctionMethod(target, methodName, args, options, stack) {
|
|
144518
|
+
if (!isSandboxClosure(target)) {
|
|
144519
|
+
throw new TypeError(`Function#${methodName} requires a callable receiver.`);
|
|
144520
|
+
}
|
|
144479
144521
|
const thisValue = args[0];
|
|
144480
144522
|
if (methodName === "bind") {
|
|
144481
144523
|
const boundArgs = args.slice(1);
|
|
@@ -146250,22 +146292,16 @@ async function evaluateNode2(node, context) {
|
|
|
146250
146292
|
error: error3
|
|
146251
146293
|
};
|
|
146252
146294
|
}
|
|
146253
|
-
const
|
|
146295
|
+
const completion = createThrowCompletion(error3, context.budget, context.callStack, node.span);
|
|
146254
146296
|
reconcileDataBudget(
|
|
146255
146297
|
context.budget,
|
|
146256
146298
|
context.stats,
|
|
146257
146299
|
context.scope,
|
|
146258
|
-
|
|
146300
|
+
completion.value,
|
|
146259
146301
|
compilation,
|
|
146260
146302
|
context.compilation
|
|
146261
146303
|
);
|
|
146262
|
-
return
|
|
146263
|
-
kind: "throw",
|
|
146264
|
-
hasValue: true,
|
|
146265
|
-
span: readErrorSpan(exception) ?? node.span,
|
|
146266
|
-
stackFrames: isCapturedException(error3) ? error3.stackFrames : context.callStack,
|
|
146267
|
-
value: exception
|
|
146268
|
-
};
|
|
146304
|
+
return completion;
|
|
146269
146305
|
} finally {
|
|
146270
146306
|
compilation.dispose();
|
|
146271
146307
|
}
|
|
@@ -148742,12 +148778,6 @@ function defineSandboxProperty(target, key3, value) {
|
|
|
148742
148778
|
writable: true
|
|
148743
148779
|
});
|
|
148744
148780
|
}
|
|
148745
|
-
function isInterpreterError(value) {
|
|
148746
|
-
return typeof value === "object" && value !== null && hasOwnProperty15(value, "code") && hasOwnProperty15(value, "message") && hasOwnProperty15(value, "nodeType") && hasOwnProperty15(value, "span") && (value.code === "UNBOUND_IDENTIFIER" || value.code === "UNSUPPORTED_NODE");
|
|
148747
|
-
}
|
|
148748
|
-
function hasOwnProperty15(value, name) {
|
|
148749
|
-
return Object.prototype.hasOwnProperty.call(value, name);
|
|
148750
|
-
}
|
|
148751
148781
|
function wrapHostResult(result, stack, sandbox) {
|
|
148752
148782
|
if (!isPromiseLikeResult(result)) {
|
|
148753
148783
|
return result;
|
|
@@ -148762,9 +148792,6 @@ function wrapHostResult(result, stack, sandbox) {
|
|
|
148762
148792
|
function captureException(error3, stack, sandbox) {
|
|
148763
148793
|
return isCapturedException(error3) ? error3 : createCapturedException(error3, stack, sandbox);
|
|
148764
148794
|
}
|
|
148765
|
-
function isFatalSandboxError(error3) {
|
|
148766
|
-
return error3 instanceof SandboxError && (error3.code === "budgetExceeded" || error3.code === "reentry");
|
|
148767
|
-
}
|
|
148768
148795
|
function isPromiseLikeResult(value) {
|
|
148769
148796
|
return typeof value === "object" && value !== null && "then" in value;
|
|
148770
148797
|
}
|