@poe-platform/safe-js 0.1.232 → 0.1.233
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-CCJSAZ73.js → chunk-4EKZGMNU.js} +44 -23
- package/dist/safe-js/chunks/{chunk-CCJSAZ73.js.map → chunk-4EKZGMNU.js.map} +3 -3
- package/dist/safe-js/chunks/{chunk-HRN2V5KG.js → chunk-HQP4GXCO.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/generator-expression-state.d.ts +3 -0
- package/package.json +2 -2
- /package/dist/safe-js/chunks/{chunk-HRN2V5KG.js.map → chunk-HQP4GXCO.js.map} +0 -0
|
@@ -15520,19 +15520,26 @@ async function evaluateBinaryExpression(node, context) {
|
|
|
15520
15520
|
}
|
|
15521
15521
|
async function evaluateAssignmentExpression(node, context) {
|
|
15522
15522
|
if (node.left.type === "ArrayPattern" || node.left.type === "ObjectPattern") {
|
|
15523
|
-
const
|
|
15523
|
+
const restored2 = context.generatorResume === void 0 || node.nodeId === void 0 ? void 0 : context.restoredGeneratorExpressionStates?.get(node.nodeId);
|
|
15524
|
+
if (restored2 !== void 0 && restored2.kind !== "pattern-source") throw new TypeError("Invalid pattern source continuation.");
|
|
15525
|
+
const right = restored2 === void 0 ? await evaluateNode(node.right, context) : { kind: "normal", hasValue: true, value: restored2.value };
|
|
15524
15526
|
if (right.kind !== "normal") {
|
|
15525
15527
|
return right;
|
|
15526
15528
|
}
|
|
15527
|
-
|
|
15528
|
-
|
|
15529
|
-
|
|
15529
|
+
if (context.generatorYield !== void 0 && node.nodeId !== void 0) {
|
|
15530
|
+
context = { ...context, generatorExpressionStates: new Map([
|
|
15531
|
+
...context.generatorExpressionStates ?? [],
|
|
15532
|
+
[node.nodeId, { kind: "pattern-source", value: right.value }]
|
|
15533
|
+
]) };
|
|
15534
|
+
}
|
|
15535
|
+
const release2 = retainValues(context.budget, () => [right.value]);
|
|
15536
|
+
try {
|
|
15537
|
+
const binding2 = await bindPattern2(node.left, right.value, { assign: true }, context.scope, createPatternContext(context));
|
|
15538
|
+
if (!binding2.ok) return binding2.result;
|
|
15539
|
+
return { kind: "normal", hasValue: true, value: right.value };
|
|
15540
|
+
} finally {
|
|
15541
|
+
release2();
|
|
15530
15542
|
}
|
|
15531
|
-
return {
|
|
15532
|
-
kind: "normal",
|
|
15533
|
-
hasValue: true,
|
|
15534
|
-
value: right.value
|
|
15535
|
-
};
|
|
15536
15543
|
}
|
|
15537
15544
|
if (node.left.type === "MemberExpression") {
|
|
15538
15545
|
return evaluateMemberAssignmentExpression(node, context);
|
|
@@ -15842,8 +15849,10 @@ async function evaluateVariableDeclaration(node, context) {
|
|
|
15842
15849
|
continue;
|
|
15843
15850
|
}
|
|
15844
15851
|
}
|
|
15852
|
+
const restoredSource = context.generatorResume === void 0 || declarator.nodeId === void 0 ? void 0 : context.restoredGeneratorExpressionStates?.get(declarator.nodeId);
|
|
15853
|
+
if (restoredSource !== void 0 && restoredSource.kind !== "pattern-source") throw new TypeError("Invalid declaration source continuation.");
|
|
15845
15854
|
const restoredValue = declarator.id.type === "Identifier" ? context.scope.consumeRestoredBinding(declarator.id.name) : { found: false };
|
|
15846
|
-
const value = restoredValue.found && isRestorableBindingValue(restoredValue.value) ? {
|
|
15855
|
+
const value = restoredSource !== void 0 ? { kind: "normal", hasValue: true, value: restoredSource.value } : restoredValue.found && isRestorableBindingValue(restoredValue.value) ? {
|
|
15847
15856
|
kind: "normal",
|
|
15848
15857
|
hasValue: true,
|
|
15849
15858
|
value: restoredValue.value
|
|
@@ -15855,15 +15864,25 @@ async function evaluateVariableDeclaration(node, context) {
|
|
|
15855
15864
|
if (value.kind !== "normal") {
|
|
15856
15865
|
return value;
|
|
15857
15866
|
}
|
|
15858
|
-
const
|
|
15859
|
-
|
|
15860
|
-
|
|
15861
|
-
|
|
15862
|
-
|
|
15863
|
-
|
|
15864
|
-
|
|
15865
|
-
|
|
15866
|
-
|
|
15867
|
+
const bindingContext = context.generatorYield === void 0 || declarator.nodeId === void 0 || declarator.init === void 0 || declarator.id.type === "Identifier" ? context : {
|
|
15868
|
+
...context,
|
|
15869
|
+
generatorExpressionStates: new Map([
|
|
15870
|
+
...context.generatorExpressionStates ?? [],
|
|
15871
|
+
[declarator.nodeId, { kind: "pattern-source", value: value.value }]
|
|
15872
|
+
])
|
|
15873
|
+
};
|
|
15874
|
+
const release = retainValues(context.budget, () => [value.value]);
|
|
15875
|
+
try {
|
|
15876
|
+
const binding = await bindPattern2(
|
|
15877
|
+
declarator.id,
|
|
15878
|
+
value.value,
|
|
15879
|
+
{ kind: node.kind },
|
|
15880
|
+
context.scope,
|
|
15881
|
+
createPatternContext(bindingContext)
|
|
15882
|
+
);
|
|
15883
|
+
if (!binding.ok) return binding.result;
|
|
15884
|
+
} finally {
|
|
15885
|
+
release();
|
|
15867
15886
|
}
|
|
15868
15887
|
}
|
|
15869
15888
|
return {
|
|
@@ -20965,7 +20984,7 @@ function captureGuestHeapNode(value, encode) {
|
|
|
20965
20984
|
...value.state !== "suspended" || origin2.expressionStates === void 0 ? {} : {
|
|
20966
20985
|
expressionStates: Object.fromEntries([...origin2.expressionStates].map(([id, expression]) => [
|
|
20967
20986
|
String(id),
|
|
20968
|
-
expression.kind === "binary" ? { kind: "binary", left: encode(expression.left) } : expression.kind === "array-pattern" ? {
|
|
20987
|
+
expression.kind === "binary" ? { kind: "binary", left: encode(expression.left) } : expression.kind === "pattern-source" ? { kind: "pattern-source", value: encode(expression.value) } : expression.kind === "array-pattern" ? {
|
|
20969
20988
|
kind: "array-pattern",
|
|
20970
20989
|
phase: expression.phase,
|
|
20971
20990
|
index: expression.index,
|
|
@@ -22623,6 +22642,8 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
|
|
|
22623
22642
|
const expression = record2(raw2);
|
|
22624
22643
|
if (expression.kind === "binary") {
|
|
22625
22644
|
fields(expression, ["kind", "left"]);
|
|
22645
|
+
} else if (expression.kind === "pattern-source") {
|
|
22646
|
+
fields(expression, ["kind", "value"]);
|
|
22626
22647
|
} else if (expression.kind === "for-of-array" || expression.kind === "for-of-iterator" || expression.kind === "array-pattern") {
|
|
22627
22648
|
if (expression.kind === "array-pattern") {
|
|
22628
22649
|
fields(expression, ["kind", "phase", "index", "done", "current", "iterator"], ["referenceObject", "referenceKey"]);
|
|
@@ -22870,7 +22891,7 @@ function validateGuestFunctionAst(record3, origin) {
|
|
|
22870
22891
|
pending.push({
|
|
22871
22892
|
value,
|
|
22872
22893
|
blocks,
|
|
22873
|
-
expressions: node.type === "ForOfStatement" && ["left", "body"].includes(key) && typeof node.nodeId === "number" ? new Map([...frame.expressions, [node.nodeId, { kind: "for-of", phase: key, async: node.await === true }]]) : node.type === "ForInStatement" && ["left", "body"].includes(key) && typeof node.nodeId === "number" ? new Map([...frame.expressions, [node.nodeId, { kind: "for-in", phase: key }]]) : node.type === "ForStatement" && ["init", "test", "body", "update"].includes(key) && typeof node.nodeId === "number" ? new Map([...frame.expressions, [node.nodeId, { kind: "for", phase: key }]]) : node.type === "BinaryExpression" && key === "right" && typeof node.nodeId === "number" ? new Map([...frame.expressions, [node.nodeId, { kind: "binary" }]]) : node.type === "AssignmentExpression" && key === "right" && typeof node.nodeId === "number" && node.left.type === "Identifier" ? new Map([...frame.expressions, [node.nodeId, { kind: "identifier-assignment" }]]) : node.type === "AssignmentExpression" && key === "right" && typeof node.nodeId === "number" && node.left.type === "MemberExpression" ? new Map([...frame.expressions, [node.nodeId, {
|
|
22894
|
+
expressions: (node.type === "VariableDeclarator" && key === "id" && node.init !== void 0 || node.type === "AssignmentExpression" && key === "left") && typeof node.nodeId === "number" && ["ArrayPattern", "ObjectPattern"].includes(String(value?.type)) ? new Map([...frame.expressions, [node.nodeId, { kind: "pattern-source" }]]) : node.type === "ForOfStatement" && ["left", "body"].includes(key) && typeof node.nodeId === "number" ? new Map([...frame.expressions, [node.nodeId, { kind: "for-of", phase: key, async: node.await === true }]]) : node.type === "ForInStatement" && ["left", "body"].includes(key) && typeof node.nodeId === "number" ? new Map([...frame.expressions, [node.nodeId, { kind: "for-in", phase: key }]]) : node.type === "ForStatement" && ["init", "test", "body", "update"].includes(key) && typeof node.nodeId === "number" ? new Map([...frame.expressions, [node.nodeId, { kind: "for", phase: key }]]) : node.type === "BinaryExpression" && key === "right" && typeof node.nodeId === "number" ? new Map([...frame.expressions, [node.nodeId, { kind: "binary" }]]) : node.type === "AssignmentExpression" && key === "right" && typeof node.nodeId === "number" && node.left.type === "Identifier" ? new Map([...frame.expressions, [node.nodeId, { kind: "identifier-assignment" }]]) : node.type === "AssignmentExpression" && key === "right" && typeof node.nodeId === "number" && node.left.type === "MemberExpression" ? new Map([...frame.expressions, [node.nodeId, {
|
|
22874
22895
|
kind: "member-assignment",
|
|
22875
22896
|
key: node.operator !== "=",
|
|
22876
22897
|
superReceiver: node.left.object.type === "Super"
|
|
@@ -22900,7 +22921,7 @@ function validateGuestFunctionAst(record3, origin) {
|
|
|
22900
22921
|
for (const [id, expression] of expressions) {
|
|
22901
22922
|
const expected = yieldExpressions?.get(Number(id));
|
|
22902
22923
|
const compatibleKind = expected?.kind === expression.kind || expected?.kind === "for-of" && (expression.kind === "for-of-iterator" || !expected.async && expression.kind === "for-of-array") || expected?.kind === "call" && expected.member === true && expression.kind === "array-call";
|
|
22903
|
-
if (expected === void 0 || !compatibleKind || expected.kind !== "binary" && expected.kind !== "identifier-assignment" && expected.kind !== "member" && expected.kind !== "member-assignment" && expected.kind !== "for" && expected.kind !== "for-in" && expected.kind !== "for-of" && expected.index !== expression.index || (expected.kind === "for" || expected.kind === "for-of") && expected.phase !== expression.phase || expected.kind === "for-in" && expected.phase !== (expression.phase ?? "body") || expected.kind === "for-of" && expression.kind === "for-of-iterator" && expected.async !== expression.async || expected.kind === "member-assignment" && (expected.key !== Object.hasOwn(expression, "key") || expected.superReceiver !== Object.hasOwn(expression, "superReceiver")) || expected.kind === "member" && expected.superReceiver !== Object.hasOwn(expression, "superReceiver") || expected.kind === "object" && expected.key !== Object.hasOwn(expression, "key"))
|
|
22924
|
+
if (expected === void 0 || !compatibleKind || expected.kind !== "binary" && expected.kind !== "pattern-source" && expected.kind !== "identifier-assignment" && expected.kind !== "member" && expected.kind !== "member-assignment" && expected.kind !== "for" && expected.kind !== "for-in" && expected.kind !== "for-of" && expected.index !== expression.index || (expected.kind === "for" || expected.kind === "for-of") && expected.phase !== expression.phase || expected.kind === "for-in" && expected.phase !== (expression.phase ?? "body") || expected.kind === "for-of" && expression.kind === "for-of-iterator" && expected.async !== expression.async || expected.kind === "member-assignment" && (expected.key !== Object.hasOwn(expression, "key") || expected.superReceiver !== Object.hasOwn(expression, "superReceiver")) || expected.kind === "member" && expected.superReceiver !== Object.hasOwn(expression, "superReceiver") || expected.kind === "object" && expected.key !== Object.hasOwn(expression, "key"))
|
|
22904
22925
|
throw new TypeError("Invalid generator AST identity: unrelated expression continuation");
|
|
22905
22926
|
}
|
|
22906
22927
|
}
|
|
@@ -39146,4 +39167,4 @@ export {
|
|
|
39146
39167
|
FileSnapshotBackend,
|
|
39147
39168
|
run
|
|
39148
39169
|
};
|
|
39149
|
-
//# sourceMappingURL=chunk-
|
|
39170
|
+
//# sourceMappingURL=chunk-4EKZGMNU.js.map
|