@poe-platform/safe-js 0.1.224 → 0.1.226
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-DQY3GFKQ.js → chunk-EY6YV2R2.js} +76 -27
- package/dist/safe-js/chunks/chunk-EY6YV2R2.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-NP47NXCT.js → chunk-XOV3P7HH.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 +10 -0
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-DQY3GFKQ.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-NP47NXCT.js.map → chunk-XOV3P7HH.js.map} +0 -0
|
@@ -8581,7 +8581,14 @@ function captureGuestHeapNode(value, encode) {
|
|
|
8581
8581
|
...value.state !== "suspended" || origin2.expressionStates === void 0 ? {} : {
|
|
8582
8582
|
expressionStates: Object.fromEntries([...origin2.expressionStates].map(([id, expression]) => [
|
|
8583
8583
|
String(id),
|
|
8584
|
-
expression.kind === "binary" ? { kind: "binary", left: encode(expression.left) } : expression.kind === "member" ? {
|
|
8584
|
+
expression.kind === "binary" ? { kind: "binary", left: encode(expression.left) } : expression.kind === "identifier-assignment" ? { kind: "identifier-assignment", current: encode(expression.current) } : expression.kind === "member-assignment" ? {
|
|
8585
|
+
kind: "member-assignment",
|
|
8586
|
+
object: encode(expression.object),
|
|
8587
|
+
property: encode(expression.property),
|
|
8588
|
+
current: encode(expression.current),
|
|
8589
|
+
...Object.hasOwn(expression, "key") ? { key: encode(expression.key) } : {},
|
|
8590
|
+
...Object.hasOwn(expression, "superReceiver") ? { superReceiver: encode(expression.superReceiver) } : {}
|
|
8591
|
+
} : expression.kind === "member" ? {
|
|
8585
8592
|
kind: "member",
|
|
8586
8593
|
object: encode(expression.object),
|
|
8587
8594
|
...Object.hasOwn(expression, "superReceiver") ? { superReceiver: encode(expression.superReceiver) } : {}
|
|
@@ -16805,18 +16812,18 @@ async function evaluateBinaryExpression(node, context) {
|
|
|
16805
16812
|
}
|
|
16806
16813
|
async function evaluateAssignmentExpression(node, context) {
|
|
16807
16814
|
if (node.left.type === "ArrayPattern" || node.left.type === "ObjectPattern") {
|
|
16808
|
-
const
|
|
16809
|
-
if (
|
|
16810
|
-
return
|
|
16815
|
+
const right = await evaluateNode(node.right, context);
|
|
16816
|
+
if (right.kind !== "normal") {
|
|
16817
|
+
return right;
|
|
16811
16818
|
}
|
|
16812
|
-
const binding2 = await bindPattern2(node.left,
|
|
16819
|
+
const binding2 = await bindPattern2(node.left, right.value, { assign: true }, context.scope, createPatternContext(context));
|
|
16813
16820
|
if (!binding2.ok) {
|
|
16814
16821
|
return binding2.result;
|
|
16815
16822
|
}
|
|
16816
16823
|
return {
|
|
16817
16824
|
kind: "normal",
|
|
16818
16825
|
hasValue: true,
|
|
16819
|
-
value:
|
|
16826
|
+
value: right.value
|
|
16820
16827
|
};
|
|
16821
16828
|
}
|
|
16822
16829
|
if (node.left.type === "MemberExpression") {
|
|
@@ -16832,11 +16839,13 @@ async function evaluateAssignmentExpression(node, context) {
|
|
|
16832
16839
|
)
|
|
16833
16840
|
};
|
|
16834
16841
|
}
|
|
16835
|
-
const
|
|
16842
|
+
const restored = context.generatorResume === void 0 || node.nodeId === void 0 ? void 0 : context.restoredGeneratorExpressionStates?.get(node.nodeId);
|
|
16843
|
+
if (restored !== void 0 && restored.kind !== "identifier-assignment") throw new TypeError("Invalid identifier assignment continuation.");
|
|
16844
|
+
const binding = node.operator === "=" || restored !== void 0 ? void 0 : context.scope.lookup(node.left.name);
|
|
16836
16845
|
if (binding?.found === false) {
|
|
16837
16846
|
throw new ReferenceError(`Cannot assign to undeclared binding '${node.left.name}'.`);
|
|
16838
16847
|
}
|
|
16839
|
-
const current = binding?.value;
|
|
16848
|
+
const current = restored === void 0 ? binding?.value : restored.current;
|
|
16840
16849
|
if (node.operator === "&&=" && !isTruthy(current)) {
|
|
16841
16850
|
return {
|
|
16842
16851
|
kind: "normal",
|
|
@@ -16858,29 +16867,42 @@ async function evaluateAssignmentExpression(node, context) {
|
|
|
16858
16867
|
value: current
|
|
16859
16868
|
};
|
|
16860
16869
|
}
|
|
16861
|
-
|
|
16862
|
-
|
|
16863
|
-
|
|
16870
|
+
if (context.generatorYield !== void 0 && node.nodeId !== void 0) {
|
|
16871
|
+
context = { ...context, generatorExpressionStates: new Map([
|
|
16872
|
+
...context.generatorExpressionStates ?? [],
|
|
16873
|
+
[node.nodeId, { kind: "identifier-assignment", current }]
|
|
16874
|
+
]) };
|
|
16875
|
+
}
|
|
16876
|
+
const release = retainValues(context.budget, () => [current]);
|
|
16877
|
+
try {
|
|
16878
|
+
const right = await evaluateNode(node.right, { ...context, inferredName: node.left.name });
|
|
16879
|
+
if (right.kind !== "normal") {
|
|
16880
|
+
return right;
|
|
16881
|
+
}
|
|
16882
|
+
const value = node.operator === "=" || node.operator === "&&=" || node.operator === "||=" || node.operator === "??=" ? right.value : await applyCompoundAssignmentOperator(node.operator, current, right.value, context);
|
|
16883
|
+
context.scope.assign(node.left.name, value);
|
|
16884
|
+
return {
|
|
16885
|
+
kind: "normal",
|
|
16886
|
+
hasValue: true,
|
|
16887
|
+
value
|
|
16888
|
+
};
|
|
16889
|
+
} finally {
|
|
16890
|
+
release();
|
|
16864
16891
|
}
|
|
16865
|
-
const value = node.operator === "=" || node.operator === "&&=" || node.operator === "||=" || node.operator === "??=" ? right.value : await applyCompoundAssignmentOperator(node.operator, current, right.value, context);
|
|
16866
|
-
context.scope.assign(node.left.name, value);
|
|
16867
|
-
return {
|
|
16868
|
-
kind: "normal",
|
|
16869
|
-
hasValue: true,
|
|
16870
|
-
value
|
|
16871
|
-
};
|
|
16872
16892
|
}
|
|
16873
16893
|
async function evaluateMemberAssignmentExpression(node, context) {
|
|
16874
16894
|
if (node.left.type !== "MemberExpression") {
|
|
16875
16895
|
throw new TypeError("Expected member assignment target.");
|
|
16876
16896
|
}
|
|
16877
|
-
|
|
16897
|
+
const restored = context.generatorResume === void 0 || node.nodeId === void 0 ? void 0 : context.restoredGeneratorExpressionStates?.get(node.nodeId);
|
|
16898
|
+
if (restored !== void 0 && restored.kind !== "member-assignment") throw new TypeError("Invalid assignment continuation.");
|
|
16899
|
+
const assign = async (member) => {
|
|
16878
16900
|
if (member.kind === "nullish") {
|
|
16879
16901
|
throw new TypeError("Cannot assign properties of null or undefined.");
|
|
16880
16902
|
}
|
|
16881
|
-
let property;
|
|
16882
|
-
let current =
|
|
16883
|
-
if (node.operator !== "=") {
|
|
16903
|
+
let property = restored?.key;
|
|
16904
|
+
let current = restored?.current;
|
|
16905
|
+
if (node.operator !== "=" && restored === void 0) {
|
|
16884
16906
|
if (member.object === null || member.object === void 0) {
|
|
16885
16907
|
throw new TypeError("Cannot assign properties of null or undefined.");
|
|
16886
16908
|
}
|
|
@@ -16917,7 +16939,18 @@ async function evaluateMemberAssignmentExpression(node, context) {
|
|
|
16917
16939
|
value: current
|
|
16918
16940
|
};
|
|
16919
16941
|
}
|
|
16920
|
-
|
|
16942
|
+
if (context.generatorYield !== void 0 && node.nodeId !== void 0) {
|
|
16943
|
+
const state = {
|
|
16944
|
+
kind: "member-assignment",
|
|
16945
|
+
object: member.object,
|
|
16946
|
+
property: member.property,
|
|
16947
|
+
current,
|
|
16948
|
+
...property === void 0 ? {} : { key: property },
|
|
16949
|
+
...member.superReceiver === void 0 ? {} : { superReceiver: member.superReceiver.value }
|
|
16950
|
+
};
|
|
16951
|
+
context = { ...context, generatorExpressionStates: new Map([...context.generatorExpressionStates ?? [], [node.nodeId, state]]) };
|
|
16952
|
+
}
|
|
16953
|
+
let operands = [current, property, member.object, member.property, member.superReceiver?.value];
|
|
16921
16954
|
const release = retainValues(context.budget, () => operands);
|
|
16922
16955
|
try {
|
|
16923
16956
|
const right = await evaluateNode(node.right, context);
|
|
@@ -16929,7 +16962,7 @@ async function evaluateMemberAssignmentExpression(node, context) {
|
|
|
16929
16962
|
if (member.object === null || member.object === void 0) {
|
|
16930
16963
|
throw new TypeError("Cannot assign properties of null or undefined.");
|
|
16931
16964
|
}
|
|
16932
|
-
operands = [value];
|
|
16965
|
+
operands = [value, member.object, member.property, member.superReceiver?.value];
|
|
16933
16966
|
property ??= await toPropertyKey(
|
|
16934
16967
|
member.property,
|
|
16935
16968
|
context.budget,
|
|
@@ -16954,7 +16987,14 @@ async function evaluateMemberAssignmentExpression(node, context) {
|
|
|
16954
16987
|
} finally {
|
|
16955
16988
|
release();
|
|
16956
16989
|
}
|
|
16990
|
+
};
|
|
16991
|
+
if (restored !== void 0) return assign({
|
|
16992
|
+
kind: "resolved",
|
|
16993
|
+
object: restored.object,
|
|
16994
|
+
property: restored.property,
|
|
16995
|
+
...Object.hasOwn(restored, "superReceiver") ? { superReceiver: { value: restored.superReceiver } } : {}
|
|
16957
16996
|
});
|
|
16997
|
+
return evaluateMemberAccess(node.left, context, assign);
|
|
16958
16998
|
}
|
|
16959
16999
|
async function evaluateLogicalExpression(node, context) {
|
|
16960
17000
|
if (context.generatorResume !== void 0 && containsResumeTarget(node.right, /* @__PURE__ */ new Set([context.generatorResume.yieldNodeId])))
|
|
@@ -22445,6 +22485,11 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
|
|
|
22445
22485
|
const expression = record2(raw2);
|
|
22446
22486
|
if (expression.kind === "binary") {
|
|
22447
22487
|
fields(expression, ["kind", "left"]);
|
|
22488
|
+
} else if (expression.kind === "identifier-assignment") {
|
|
22489
|
+
fields(expression, ["kind", "current"]);
|
|
22490
|
+
} else if (expression.kind === "member-assignment") {
|
|
22491
|
+
fields(expression, ["kind", "object", "property", "current"], ["key", "superReceiver"]);
|
|
22492
|
+
if (Object.hasOwn(expression, "key") && typeof expression.key !== "string") reference(expression.key, ["symbol"]);
|
|
22448
22493
|
} else if (expression.kind === "member") {
|
|
22449
22494
|
fields(expression, ["kind", "object"], ["superReceiver"]);
|
|
22450
22495
|
} else if (expression.kind === "template") {
|
|
@@ -22622,7 +22667,11 @@ function validateGuestFunctionAst(record3, origin) {
|
|
|
22622
22667
|
pending.push({
|
|
22623
22668
|
value,
|
|
22624
22669
|
blocks,
|
|
22625
|
-
expressions: node.type === "BinaryExpression" && key === "right" && typeof node.nodeId === "number" ? new Map([...frame.expressions, [node.nodeId, { kind: "binary" }]]) : node.type === "
|
|
22670
|
+
expressions: 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, {
|
|
22671
|
+
kind: "member-assignment",
|
|
22672
|
+
key: node.operator !== "=",
|
|
22673
|
+
superReceiver: node.left.object.type === "Super"
|
|
22674
|
+
}]]) : node.type === "MemberExpression" && node.computed === true && key === "property" && typeof node.nodeId === "number" ? new Map([...frame.expressions, [node.nodeId, { kind: "member", superReceiver: node.object.type === "Super" }]]) : frame.expressions,
|
|
22626
22675
|
finalizers: node.type === "TryStatement" && key === "finalizer" && typeof node.nodeId === "number" ? /* @__PURE__ */ new Set([...frame.finalizers, node.nodeId]) : frame.finalizers
|
|
22627
22676
|
});
|
|
22628
22677
|
}
|
|
@@ -22648,7 +22697,7 @@ function validateGuestFunctionAst(record3, origin) {
|
|
|
22648
22697
|
for (const [id, expression] of expressions) {
|
|
22649
22698
|
const expected = yieldExpressions?.get(Number(id));
|
|
22650
22699
|
const compatibleKind = expected?.kind === expression.kind || expected?.kind === "call" && expected.member === true && expression.kind === "array-call";
|
|
22651
|
-
if (expected === void 0 || !compatibleKind || expected.kind !== "binary" && expected.kind !== "member" && expected.index !== expression.index || expected.kind === "member" && expected.superReceiver !== Object.hasOwn(expression, "superReceiver") || expected.kind === "object" && expected.key !== Object.hasOwn(expression, "key"))
|
|
22700
|
+
if (expected === void 0 || !compatibleKind || expected.kind !== "binary" && expected.kind !== "identifier-assignment" && expected.kind !== "member" && expected.kind !== "member-assignment" && expected.index !== expression.index || 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"))
|
|
22652
22701
|
throw new TypeError("Invalid generator AST identity: unrelated expression continuation");
|
|
22653
22702
|
}
|
|
22654
22703
|
}
|
|
@@ -38894,4 +38943,4 @@ export {
|
|
|
38894
38943
|
FileSnapshotBackend,
|
|
38895
38944
|
run
|
|
38896
38945
|
};
|
|
38897
|
-
//# sourceMappingURL=chunk-
|
|
38946
|
+
//# sourceMappingURL=chunk-EY6YV2R2.js.map
|