@poe-platform/safe-js 0.1.217 → 0.1.218
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-F2O4RZOG.js → chunk-7FIJ3D55.js} +58 -6
- package/dist/safe-js/chunks/chunk-7FIJ3D55.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-42FLUHBI.js → chunk-Z3GR3FJR.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 +5 -0
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-F2O4RZOG.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-42FLUHBI.js.map → chunk-Z3GR3FJR.js.map} +0 -0
|
@@ -8538,7 +8538,12 @@ function captureGuestHeapNode(value, encode) {
|
|
|
8538
8538
|
...value.state !== "suspended" || origin2.expressionStates === void 0 ? {} : {
|
|
8539
8539
|
expressionStates: Object.fromEntries([...origin2.expressionStates].map(([id, expression]) => [
|
|
8540
8540
|
String(id),
|
|
8541
|
-
expression.kind === "binary" ? { kind: "binary", left: encode(expression.left) } : expression.kind === "
|
|
8541
|
+
expression.kind === "binary" ? { kind: "binary", left: encode(expression.left) } : expression.kind === "object" ? {
|
|
8542
|
+
kind: "object",
|
|
8543
|
+
value: encode(expression.value),
|
|
8544
|
+
index: expression.index,
|
|
8545
|
+
...Object.hasOwn(expression, "key") ? { key: encode(expression.key) } : {}
|
|
8546
|
+
} : expression.kind === "array" ? { kind: "array", values: encode(expression.values), index: expression.index } : expression.kind === "array-call" ? { kind: "array-call", target: encode(expression.target), method: expression.method, args: encode(expression.args), index: expression.index } : { kind: expression.kind, callee: encode(expression.callee), thisValue: encode(expression.thisValue), args: encode(expression.args), index: expression.index }
|
|
8542
8547
|
]))
|
|
8543
8548
|
},
|
|
8544
8549
|
sent: channel.sent.map((completion) => ({ type: completion.type, value: encode(completion.value) })),
|
|
@@ -16508,10 +16513,31 @@ async function evaluateArrayExpression(node, context) {
|
|
|
16508
16513
|
}
|
|
16509
16514
|
}
|
|
16510
16515
|
async function evaluateObjectExpression(node, context) {
|
|
16511
|
-
const
|
|
16516
|
+
const restored = context.generatorResume === void 0 || node.nodeId === void 0 ? void 0 : context.restoredGeneratorExpressionStates?.get(node.nodeId);
|
|
16517
|
+
if (restored !== void 0 && (restored.kind !== "object" || restored.value === null || typeof restored.value !== "object" || Array.isArray(restored.value)))
|
|
16518
|
+
throw new TypeError("Invalid object expression continuation.");
|
|
16519
|
+
const object = restored?.kind === "object" ? restored.value : /* @__PURE__ */ Object.create(null);
|
|
16520
|
+
const state = {
|
|
16521
|
+
kind: "object",
|
|
16522
|
+
value: object,
|
|
16523
|
+
index: restored?.kind === "object" ? restored.index : 0
|
|
16524
|
+
};
|
|
16525
|
+
if (restored?.kind === "object" && Object.hasOwn(restored, "key")) {
|
|
16526
|
+
if (typeof restored.key !== "string" && typeof restored.key !== "number" && typeof restored.key !== "symbol")
|
|
16527
|
+
throw new TypeError("Invalid object expression key.");
|
|
16528
|
+
state.key = restored.key;
|
|
16529
|
+
}
|
|
16530
|
+
if (context.generatorYield !== void 0 && node.nodeId !== void 0) context = {
|
|
16531
|
+
...context,
|
|
16532
|
+
generatorExpressionStates: new Map([...context.generatorExpressionStates ?? [], [node.nodeId, state]])
|
|
16533
|
+
};
|
|
16512
16534
|
const release = retainValues(context.budget, () => [object]);
|
|
16513
16535
|
try {
|
|
16514
|
-
|
|
16536
|
+
const startIndex = state.index;
|
|
16537
|
+
for (let index = startIndex; index < node.properties.length; index++) {
|
|
16538
|
+
state.index = index;
|
|
16539
|
+
if (index !== startIndex) delete state.key;
|
|
16540
|
+
const property = node.properties[index];
|
|
16515
16541
|
if (property.type === "SpreadElement") {
|
|
16516
16542
|
const spreadEntries = await evaluateObjectSpread(property, context);
|
|
16517
16543
|
if (!spreadEntries.ok) {
|
|
@@ -16522,10 +16548,11 @@ async function evaluateObjectExpression(node, context) {
|
|
|
16522
16548
|
}
|
|
16523
16549
|
continue;
|
|
16524
16550
|
}
|
|
16525
|
-
const key = await evaluateObjectPropertyKey(property, context);
|
|
16551
|
+
const key = Object.hasOwn(state, "key") ? { ok: true, value: state.key } : await evaluateObjectPropertyKey(property, context);
|
|
16526
16552
|
if (!key.ok) {
|
|
16527
16553
|
return key.result;
|
|
16528
16554
|
}
|
|
16555
|
+
state.key = key.value;
|
|
16529
16556
|
const releaseKey = retainValues(context.budget, () => [key.value]);
|
|
16530
16557
|
let value;
|
|
16531
16558
|
try {
|
|
@@ -22355,6 +22382,10 @@ function validateGuestHeapNode(raw, heap) {
|
|
|
22355
22382
|
const expression = record2(raw2);
|
|
22356
22383
|
if (expression.kind === "binary") {
|
|
22357
22384
|
fields(expression, ["kind", "left"]);
|
|
22385
|
+
} else if (expression.kind === "object") {
|
|
22386
|
+
fields(expression, ["kind", "value", "index"], ["key"]);
|
|
22387
|
+
integer(expression.index);
|
|
22388
|
+
reference(expression.value, ["object", "guest-object"]);
|
|
22358
22389
|
} else if (expression.kind === "array") {
|
|
22359
22390
|
fields(expression, ["kind", "values", "index"]);
|
|
22360
22391
|
integer(expression.index);
|
|
@@ -22473,6 +22504,27 @@ function validateGuestFunctionAst(record3, origin) {
|
|
|
22473
22504
|
yieldExpressions = frame.expressions;
|
|
22474
22505
|
}
|
|
22475
22506
|
for (const [key, value] of Object.entries(node)) {
|
|
22507
|
+
if (node.type === "ObjectExpression" && key === "properties" && typeof node.nodeId === "number" && Array.isArray(value)) {
|
|
22508
|
+
const id = node.nodeId;
|
|
22509
|
+
value.forEach((property, index) => {
|
|
22510
|
+
if (property.type === "SpreadElement") {
|
|
22511
|
+
pending.push({
|
|
22512
|
+
value: property.argument,
|
|
22513
|
+
blocks,
|
|
22514
|
+
finalizers: frame.finalizers,
|
|
22515
|
+
expressions: new Map([...frame.expressions, [id, { kind: "object", index, key: false }]])
|
|
22516
|
+
});
|
|
22517
|
+
} else {
|
|
22518
|
+
for (const part of ["key", "value"]) pending.push({
|
|
22519
|
+
value: property[part],
|
|
22520
|
+
blocks,
|
|
22521
|
+
finalizers: frame.finalizers,
|
|
22522
|
+
expressions: new Map([...frame.expressions, [id, { kind: "object", index, key: part === "value" }]])
|
|
22523
|
+
});
|
|
22524
|
+
}
|
|
22525
|
+
});
|
|
22526
|
+
continue;
|
|
22527
|
+
}
|
|
22476
22528
|
if ((node.type === "ArrayExpression" && key === "elements" || (node.type === "CallExpression" || node.type === "NewExpression") && key === "arguments") && typeof node.nodeId === "number" && Array.isArray(value)) {
|
|
22477
22529
|
const kind = node.type === "ArrayExpression" ? "array" : node.type === "CallExpression" ? "call" : "new";
|
|
22478
22530
|
value.forEach((element, index) => pending.push({
|
|
@@ -22516,7 +22568,7 @@ function validateGuestFunctionAst(record3, origin) {
|
|
|
22516
22568
|
for (const [id, expression] of expressions) {
|
|
22517
22569
|
const expected = yieldExpressions?.get(Number(id));
|
|
22518
22570
|
const compatibleKind = expected?.kind === expression.kind || expected?.kind === "call" && expected.member === true && expression.kind === "array-call";
|
|
22519
|
-
if (expected === void 0 || !compatibleKind || expected.kind !== "binary" && expected.index !== expression.index)
|
|
22571
|
+
if (expected === void 0 || !compatibleKind || expected.kind !== "binary" && expected.index !== expression.index || expected.kind === "object" && expected.key !== Object.hasOwn(expression, "key"))
|
|
22520
22572
|
throw new TypeError("Invalid generator AST identity: unrelated expression continuation");
|
|
22521
22573
|
}
|
|
22522
22574
|
}
|
|
@@ -38701,4 +38753,4 @@ export {
|
|
|
38701
38753
|
FileSnapshotBackend,
|
|
38702
38754
|
run
|
|
38703
38755
|
};
|
|
38704
|
-
//# sourceMappingURL=chunk-
|
|
38756
|
+
//# sourceMappingURL=chunk-7FIJ3D55.js.map
|