@poe-platform/safe-js 0.1.217 → 0.1.219
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-42FLUHBI.js → chunk-T6BZBXWY.js} +2 -2
- package/dist/safe-js/chunks/{chunk-F2O4RZOG.js → chunk-UIOUG27J.js} +84 -10
- package/dist/safe-js/chunks/chunk-UIOUG27J.js.map +7 -0
- 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 +9 -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-T6BZBXWY.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-UIOUG27J.js";
|
|
31
31
|
|
|
32
32
|
// packages/safe-js/src/migrate.ts
|
|
33
33
|
import { createHash } from "node:crypto";
|
|
@@ -8249,4 +8249,4 @@ export {
|
|
|
8249
8249
|
parseMcpConfig,
|
|
8250
8250
|
makeMcpModule
|
|
8251
8251
|
};
|
|
8252
|
-
//# sourceMappingURL=chunk-
|
|
8252
|
+
//# sourceMappingURL=chunk-T6BZBXWY.js.map
|
|
@@ -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 === "template" ? { ...expression } : 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 {
|
|
@@ -16573,11 +16600,20 @@ function isObjectPrototypeSetterProperty(property, key) {
|
|
|
16573
16600
|
return !property.computed && !property.shorthand && key === "__proto__" && !(property.value.type === "FunctionExpression" && property.value.method === true);
|
|
16574
16601
|
}
|
|
16575
16602
|
async function evaluateTemplateLiteral(node, context) {
|
|
16576
|
-
|
|
16603
|
+
const restored = context.generatorResume === void 0 || node.nodeId === void 0 ? void 0 : context.restoredGeneratorExpressionStates?.get(node.nodeId);
|
|
16604
|
+
if (restored !== void 0 && restored.kind !== "template") throw new TypeError("Invalid template continuation.");
|
|
16605
|
+
const state = { kind: "template", prefix: restored?.prefix ?? "", index: restored?.index ?? 0 };
|
|
16606
|
+
let value = context.budget.allocateString(restored?.prefix ?? node.quasis[0]?.value.cooked ?? "");
|
|
16607
|
+
if (context.generatorYield !== void 0 && node.nodeId !== void 0) context = {
|
|
16608
|
+
...context,
|
|
16609
|
+
generatorExpressionStates: new Map([...context.generatorExpressionStates ?? [], [node.nodeId, state]])
|
|
16610
|
+
};
|
|
16577
16611
|
let input = void 0;
|
|
16578
16612
|
const release = retainValues(context.budget, () => [value, input]);
|
|
16579
16613
|
try {
|
|
16580
|
-
for (let index =
|
|
16614
|
+
for (let index = state.index; index < node.expressions.length; index += 1) {
|
|
16615
|
+
state.index = index;
|
|
16616
|
+
state.prefix = value;
|
|
16581
16617
|
const expression = await evaluateNode(node.expressions[index], context);
|
|
16582
16618
|
if (expression.kind !== "normal") {
|
|
16583
16619
|
return expression;
|
|
@@ -22355,6 +22391,14 @@ function validateGuestHeapNode(raw, heap) {
|
|
|
22355
22391
|
const expression = record2(raw2);
|
|
22356
22392
|
if (expression.kind === "binary") {
|
|
22357
22393
|
fields(expression, ["kind", "left"]);
|
|
22394
|
+
} else if (expression.kind === "template") {
|
|
22395
|
+
fields(expression, ["kind", "prefix", "index"]);
|
|
22396
|
+
integer(expression.index);
|
|
22397
|
+
if (typeof expression.prefix !== "string") throw new TypeError("Invalid template prefix.");
|
|
22398
|
+
} else if (expression.kind === "object") {
|
|
22399
|
+
fields(expression, ["kind", "value", "index"], ["key"]);
|
|
22400
|
+
integer(expression.index);
|
|
22401
|
+
reference(expression.value, ["object", "guest-object"]);
|
|
22358
22402
|
} else if (expression.kind === "array") {
|
|
22359
22403
|
fields(expression, ["kind", "values", "index"]);
|
|
22360
22404
|
integer(expression.index);
|
|
@@ -22473,8 +22517,38 @@ function validateGuestFunctionAst(record3, origin) {
|
|
|
22473
22517
|
yieldExpressions = frame.expressions;
|
|
22474
22518
|
}
|
|
22475
22519
|
for (const [key, value] of Object.entries(node)) {
|
|
22476
|
-
if (
|
|
22477
|
-
|
|
22520
|
+
if (node.type === "TaggedTemplateExpression" && key === "quasi") {
|
|
22521
|
+
pending.push({
|
|
22522
|
+
value: value.expressions,
|
|
22523
|
+
blocks,
|
|
22524
|
+
finalizers: frame.finalizers,
|
|
22525
|
+
expressions: frame.expressions
|
|
22526
|
+
});
|
|
22527
|
+
continue;
|
|
22528
|
+
}
|
|
22529
|
+
if (node.type === "ObjectExpression" && key === "properties" && typeof node.nodeId === "number" && Array.isArray(value)) {
|
|
22530
|
+
const id = node.nodeId;
|
|
22531
|
+
value.forEach((property, index) => {
|
|
22532
|
+
if (property.type === "SpreadElement") {
|
|
22533
|
+
pending.push({
|
|
22534
|
+
value: property.argument,
|
|
22535
|
+
blocks,
|
|
22536
|
+
finalizers: frame.finalizers,
|
|
22537
|
+
expressions: new Map([...frame.expressions, [id, { kind: "object", index, key: false }]])
|
|
22538
|
+
});
|
|
22539
|
+
} else {
|
|
22540
|
+
for (const part of ["key", "value"]) pending.push({
|
|
22541
|
+
value: property[part],
|
|
22542
|
+
blocks,
|
|
22543
|
+
finalizers: frame.finalizers,
|
|
22544
|
+
expressions: new Map([...frame.expressions, [id, { kind: "object", index, key: part === "value" }]])
|
|
22545
|
+
});
|
|
22546
|
+
}
|
|
22547
|
+
});
|
|
22548
|
+
continue;
|
|
22549
|
+
}
|
|
22550
|
+
if ((node.type === "ArrayExpression" && key === "elements" || node.type === "TemplateLiteral" && key === "expressions" || (node.type === "CallExpression" || node.type === "NewExpression") && key === "arguments") && typeof node.nodeId === "number" && Array.isArray(value)) {
|
|
22551
|
+
const kind = node.type === "ArrayExpression" ? "array" : node.type === "TemplateLiteral" ? "template" : node.type === "CallExpression" ? "call" : "new";
|
|
22478
22552
|
value.forEach((element, index) => pending.push({
|
|
22479
22553
|
value: element,
|
|
22480
22554
|
blocks,
|
|
@@ -22516,7 +22590,7 @@ function validateGuestFunctionAst(record3, origin) {
|
|
|
22516
22590
|
for (const [id, expression] of expressions) {
|
|
22517
22591
|
const expected = yieldExpressions?.get(Number(id));
|
|
22518
22592
|
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)
|
|
22593
|
+
if (expected === void 0 || !compatibleKind || expected.kind !== "binary" && expected.index !== expression.index || expected.kind === "object" && expected.key !== Object.hasOwn(expression, "key"))
|
|
22520
22594
|
throw new TypeError("Invalid generator AST identity: unrelated expression continuation");
|
|
22521
22595
|
}
|
|
22522
22596
|
}
|
|
@@ -38701,4 +38775,4 @@ export {
|
|
|
38701
38775
|
FileSnapshotBackend,
|
|
38702
38776
|
run
|
|
38703
38777
|
};
|
|
38704
|
-
//# sourceMappingURL=chunk-
|
|
38778
|
+
//# sourceMappingURL=chunk-UIOUG27J.js.map
|