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/dist/index.js +27 -17
- package/dist/index.js.map +2 -2
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/safejs/dist/chunks/{chunk-KNMVUWS7.js → chunk-6BCUWJFF.js} +27 -17
- package/packages/safejs/dist/chunks/{chunk-KNMVUWS7.js.map → chunk-6BCUWJFF.js.map} +2 -2
- package/packages/safejs/dist/chunks/{chunk-X4JCDSRU.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/interp/values.js +8 -3
- /package/packages/safejs/dist/chunks/{chunk-X4JCDSRU.js.map → chunk-BIGMX2WV.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -138317,9 +138317,10 @@ async function evaluateTryStatement(node, context, evaluateNode3) {
|
|
|
138317
138317
|
}
|
|
138318
138318
|
return finalizerResult;
|
|
138319
138319
|
}
|
|
138320
|
-
function createCapturedException(reason, stackFrames) {
|
|
138320
|
+
function createCapturedException(reason, stackFrames, sandbox = false) {
|
|
138321
138321
|
return {
|
|
138322
138322
|
reason,
|
|
138323
|
+
sandbox,
|
|
138323
138324
|
stackFrames,
|
|
138324
138325
|
[capturedExceptionBrand]: true
|
|
138325
138326
|
};
|
|
@@ -138327,7 +138328,7 @@ function createCapturedException(reason, stackFrames) {
|
|
|
138327
138328
|
function isCapturedException(value) {
|
|
138328
138329
|
return typeof value === "object" && value !== null && capturedExceptionBrand in value;
|
|
138329
138330
|
}
|
|
138330
|
-
function coerceThrownValue(reason, budget, stackFrames, span) {
|
|
138331
|
+
function coerceThrownValue(reason, budget, stackFrames, span, sandbox = false) {
|
|
138331
138332
|
if (isSubsetErrorValue(reason)) {
|
|
138332
138333
|
attachErrorSpan(reason, readErrorSpan(reason) ?? span);
|
|
138333
138334
|
return reason;
|
|
@@ -138339,6 +138340,9 @@ function coerceThrownValue(reason, budget, stackFrames, span) {
|
|
|
138339
138340
|
span
|
|
138340
138341
|
});
|
|
138341
138342
|
}
|
|
138343
|
+
if (sandbox) {
|
|
138344
|
+
return reason;
|
|
138345
|
+
}
|
|
138342
138346
|
if (isErrorLikeValue(reason)) {
|
|
138343
138347
|
return createSubsetErrorValue(reason.name || "Error", reason.message, stackFrames, budget, {
|
|
138344
138348
|
chargeBudget: false,
|
|
@@ -140063,7 +140067,10 @@ function measureSandboxData(values, options = {}) {
|
|
|
140063
140067
|
usage += 1;
|
|
140064
140068
|
if (Array.isArray(value)) {
|
|
140065
140069
|
usage += value.length;
|
|
140066
|
-
for (
|
|
140070
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
140071
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, index);
|
|
140072
|
+
if (descriptor !== void 0 && "value" in descriptor) visit(descriptor.value);
|
|
140073
|
+
}
|
|
140067
140074
|
return;
|
|
140068
140075
|
}
|
|
140069
140076
|
if (isSandboxMap(value)) {
|
|
@@ -140097,7 +140104,7 @@ function measureSandboxData(values, options = {}) {
|
|
|
140097
140104
|
usage += value.source.length + value.flags.length;
|
|
140098
140105
|
return;
|
|
140099
140106
|
}
|
|
140100
|
-
const entries = isSandboxArguments(value) ? getSandboxArgumentEntries(value) : Object.entries(value);
|
|
140107
|
+
const entries = isSandboxArguments(value) ? getSandboxArgumentEntries(value) : Object.entries(Object.getOwnPropertyDescriptors(value)).filter(([, descriptor]) => descriptor.enumerable).map(([key3, descriptor]) => [key3, "value" in descriptor ? descriptor.value : void 0]);
|
|
140101
140108
|
usage += entries.length;
|
|
140102
140109
|
for (const [key3, entry] of entries) {
|
|
140103
140110
|
usage += key3.length;
|
|
@@ -144993,7 +145000,7 @@ async function evaluateNode2(node, context) {
|
|
|
144993
145000
|
error: error3
|
|
144994
145001
|
};
|
|
144995
145002
|
}
|
|
144996
|
-
const exception = isCapturedException(error3) ? coerceThrownValue(error3.reason, context.budget, error3.stackFrames, node.span) : coerceThrownValue(error3, context.budget, context.callStack, node.span);
|
|
145003
|
+
const exception = isCapturedException(error3) ? coerceThrownValue(error3.reason, context.budget, error3.stackFrames, node.span, error3.sandbox) : coerceThrownValue(error3, context.budget, context.callStack, node.span, true);
|
|
144997
145004
|
return {
|
|
144998
145005
|
kind: "throw",
|
|
144999
145006
|
hasValue: true,
|
|
@@ -146688,7 +146695,7 @@ async function evaluateStringMethodCall(node, target, methodName, context) {
|
|
|
146688
146695
|
if (isFatalSandboxError(error3)) {
|
|
146689
146696
|
throw error3;
|
|
146690
146697
|
}
|
|
146691
|
-
throw captureException(error3, [...context.callStack, formatStackFrame(node, methodName)]);
|
|
146698
|
+
throw captureException(error3, [...context.callStack, formatStackFrame(node, methodName)], true);
|
|
146692
146699
|
} finally {
|
|
146693
146700
|
leaveCall();
|
|
146694
146701
|
}
|
|
@@ -146715,7 +146722,7 @@ async function evaluateArrayMethodCall(node, target, methodName, context) {
|
|
|
146715
146722
|
if (isFatalSandboxError(error3)) {
|
|
146716
146723
|
throw error3;
|
|
146717
146724
|
}
|
|
146718
|
-
throw captureException(error3, [...context.callStack, formatStackFrame(node, methodName)]);
|
|
146725
|
+
throw captureException(error3, [...context.callStack, formatStackFrame(node, methodName)], true);
|
|
146719
146726
|
} finally {
|
|
146720
146727
|
leaveCall();
|
|
146721
146728
|
}
|
|
@@ -146742,7 +146749,7 @@ async function evaluateMapMethodCall(node, target, methodName, context) {
|
|
|
146742
146749
|
if (isFatalSandboxError(error3)) {
|
|
146743
146750
|
throw error3;
|
|
146744
146751
|
}
|
|
146745
|
-
throw captureException(error3, [...context.callStack, formatStackFrame(node, methodName)]);
|
|
146752
|
+
throw captureException(error3, [...context.callStack, formatStackFrame(node, methodName)], true);
|
|
146746
146753
|
} finally {
|
|
146747
146754
|
leaveCall();
|
|
146748
146755
|
}
|
|
@@ -146769,7 +146776,7 @@ async function evaluateSetMethodCall(node, target, methodName, context) {
|
|
|
146769
146776
|
if (isFatalSandboxError(error3)) {
|
|
146770
146777
|
throw error3;
|
|
146771
146778
|
}
|
|
146772
|
-
throw captureException(error3, [...context.callStack, formatStackFrame(node, methodName)]);
|
|
146779
|
+
throw captureException(error3, [...context.callStack, formatStackFrame(node, methodName)], true);
|
|
146773
146780
|
} finally {
|
|
146774
146781
|
leaveCall();
|
|
146775
146782
|
}
|
|
@@ -147147,7 +147154,7 @@ async function evaluateNumberMethodCall(node, target, methodName, context) {
|
|
|
147147
147154
|
if (isFatalSandboxError(error3)) {
|
|
147148
147155
|
throw error3;
|
|
147149
147156
|
}
|
|
147150
|
-
throw captureException(error3, [...context.callStack, formatStackFrame(node, methodName)]);
|
|
147157
|
+
throw captureException(error3, [...context.callStack, formatStackFrame(node, methodName)], true);
|
|
147151
147158
|
}
|
|
147152
147159
|
}
|
|
147153
147160
|
function createArrayMethodOptions(context) {
|
|
@@ -147189,12 +147196,15 @@ async function invokeSandboxClosure(callee, args, context, stack, span, thisValu
|
|
|
147189
147196
|
if (isSandboxPromise(result) && result.synchronousPrefix !== void 0) {
|
|
147190
147197
|
await result.synchronousPrefix;
|
|
147191
147198
|
}
|
|
147192
|
-
return !construct && callee.async === true ? normalizeClosureResult(
|
|
147199
|
+
return !construct && callee.async === true ? normalizeClosureResult(
|
|
147200
|
+
wrapHostResult(result, stack, callee.sandbox === true),
|
|
147201
|
+
context.budget
|
|
147202
|
+
) : await wrapHostResult(result, stack, callee.sandbox === true);
|
|
147193
147203
|
} catch (error3) {
|
|
147194
147204
|
if (isFatalSandboxError(error3)) {
|
|
147195
147205
|
throw error3;
|
|
147196
147206
|
}
|
|
147197
|
-
throw captureException(error3, stack);
|
|
147207
|
+
throw captureException(error3, stack, callee.sandbox === true);
|
|
147198
147208
|
} finally {
|
|
147199
147209
|
leaveCall();
|
|
147200
147210
|
}
|
|
@@ -147319,19 +147329,19 @@ function isInterpreterError(value) {
|
|
|
147319
147329
|
function hasOwnProperty15(value, name) {
|
|
147320
147330
|
return Object.prototype.hasOwnProperty.call(value, name);
|
|
147321
147331
|
}
|
|
147322
|
-
function wrapHostResult(result, stack) {
|
|
147332
|
+
function wrapHostResult(result, stack, sandbox) {
|
|
147323
147333
|
if (!isPromiseLikeResult(result)) {
|
|
147324
147334
|
return result;
|
|
147325
147335
|
}
|
|
147326
147336
|
return Promise.resolve(result).then(
|
|
147327
147337
|
(value) => value,
|
|
147328
147338
|
(reason) => Promise.reject(
|
|
147329
|
-
isInterpreterError(reason) || reason instanceof SandboxError || isCapturedException(reason) ? reason : createCapturedException(reason, stack)
|
|
147339
|
+
isInterpreterError(reason) || reason instanceof SandboxError || isCapturedException(reason) ? reason : createCapturedException(reason, stack, sandbox)
|
|
147330
147340
|
)
|
|
147331
147341
|
);
|
|
147332
147342
|
}
|
|
147333
|
-
function captureException(error3, stack) {
|
|
147334
|
-
return isCapturedException(error3) ? error3 : createCapturedException(error3, stack);
|
|
147343
|
+
function captureException(error3, stack, sandbox) {
|
|
147344
|
+
return isCapturedException(error3) ? error3 : createCapturedException(error3, stack, sandbox);
|
|
147335
147345
|
}
|
|
147336
147346
|
function isFatalSandboxError(error3) {
|
|
147337
147347
|
return error3 instanceof SandboxError && (error3.code === "budgetExceeded" || error3.code === "reentry");
|
|
@@ -155639,7 +155649,7 @@ var init_package2 = __esm({
|
|
|
155639
155649
|
"package.json"() {
|
|
155640
155650
|
package_default2 = {
|
|
155641
155651
|
name: "poe-code",
|
|
155642
|
-
version: "11.0.
|
|
155652
|
+
version: "11.0.18",
|
|
155643
155653
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
155644
155654
|
license: "MIT",
|
|
155645
155655
|
type: "module",
|