@poe-platform/safe-js 0.1.227 → 0.1.228
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-I56ZVL4C.js → chunk-NJ2FVOTB.js} +2 -2
- package/dist/safe-js/chunks/{chunk-DRN33ZMF.js → chunk-PHJUQHVC.js} +32 -15
- package/dist/safe-js/chunks/chunk-PHJUQHVC.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 +6 -0
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-DRN33ZMF.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-I56ZVL4C.js.map → chunk-NJ2FVOTB.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-PHJUQHVC.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-NJ2FVOTB.js.map
|
|
@@ -8581,7 +8581,7 @@ 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 === "for" ? { kind: "for", phase: expression.phase, loopScope: encode(expression.loopScope), activeScope: encode(expression.activeScope) } : expression.kind === "identifier-assignment" ? { kind: "identifier-assignment", current: encode(expression.current) } : expression.kind === "member-assignment" ? {
|
|
8584
|
+
expression.kind === "binary" ? { kind: "binary", left: encode(expression.left) } : expression.kind === "for-in" ? { ...expression, keys: [...expression.keys], object: encode(expression.object), scope: encode(expression.scope) } : expression.kind === "for" ? { kind: "for", phase: expression.phase, loopScope: encode(expression.loopScope), activeScope: encode(expression.activeScope) } : expression.kind === "identifier-assignment" ? { kind: "identifier-assignment", current: encode(expression.current) } : expression.kind === "member-assignment" ? {
|
|
8585
8585
|
kind: "member-assignment",
|
|
8586
8586
|
object: encode(expression.object),
|
|
8587
8587
|
property: encode(expression.property),
|
|
@@ -17541,7 +17541,9 @@ async function evaluateForOfIterator(node, value, context, restoredEntry) {
|
|
|
17541
17541
|
}
|
|
17542
17542
|
}
|
|
17543
17543
|
async function evaluateForInStatement(node, context) {
|
|
17544
|
-
const
|
|
17544
|
+
const restored = context.generatorResume === void 0 || node.nodeId === void 0 ? void 0 : context.restoredGeneratorExpressionStates?.get(node.nodeId);
|
|
17545
|
+
if (restored !== void 0 && restored.kind !== "for-in") throw new TypeError("Invalid for-in continuation.");
|
|
17546
|
+
const right = restored === void 0 ? await evaluateNode(node.right, context) : { kind: "normal", value: restored.object };
|
|
17545
17547
|
if (right.kind !== "normal") {
|
|
17546
17548
|
return right;
|
|
17547
17549
|
}
|
|
@@ -17550,21 +17552,32 @@ async function evaluateForInStatement(node, context) {
|
|
|
17550
17552
|
return normalEmptyResult();
|
|
17551
17553
|
}
|
|
17552
17554
|
const restoredIteration = consumeRestoredLoopIteration(node, context);
|
|
17553
|
-
const keys = restoredIteration === void 0 || typeof restoredIteration === "number" ? forInKeys(object, context.budget) : restoredIteration.values.map(String);
|
|
17554
|
-
const restoredIndex = typeof restoredIteration === "number" ? restoredIteration : restoredIteration?.index ?? 0;
|
|
17555
|
+
const keys = restored?.keys ?? (restoredIteration === void 0 || typeof restoredIteration === "number" ? forInKeys(object, context.budget) : restoredIteration.values.map(String));
|
|
17556
|
+
const restoredIndex = restored?.index ?? (typeof restoredIteration === "number" ? restoredIteration : restoredIteration?.index ?? 0);
|
|
17555
17557
|
for (let index = restoredIndex; index < keys.length; index += 1) {
|
|
17556
17558
|
context.activeLoopIterations.set(node.nodeId ?? -1, { index, values: keys });
|
|
17557
17559
|
const key = keys[index];
|
|
17558
|
-
|
|
17560
|
+
const resuming = restored !== void 0 && index === restored.index;
|
|
17561
|
+
if (!resuming && !hasForInProperty(object, key, context.budget)) {
|
|
17559
17562
|
continue;
|
|
17560
17563
|
}
|
|
17561
|
-
const scope = context.scope.child();
|
|
17562
|
-
|
|
17563
|
-
|
|
17564
|
-
|
|
17565
|
-
|
|
17564
|
+
const scope = resuming ? restored.scope : context.scope.child();
|
|
17565
|
+
if (!resuming) {
|
|
17566
|
+
const binding = await bindForInLoopVariable(node.left, key, scope, context);
|
|
17567
|
+
if (!binding.ok) {
|
|
17568
|
+
context.activeLoopIterations.delete(node.nodeId ?? -1);
|
|
17569
|
+
return binding.result;
|
|
17570
|
+
}
|
|
17566
17571
|
}
|
|
17567
|
-
const iterationContext = createLoopIterationContext(
|
|
17572
|
+
const iterationContext = createLoopIterationContext({
|
|
17573
|
+
...context,
|
|
17574
|
+
...context.generatorYield === void 0 || node.nodeId === void 0 ? {} : {
|
|
17575
|
+
generatorExpressionStates: new Map([
|
|
17576
|
+
...context.generatorExpressionStates ?? [],
|
|
17577
|
+
[node.nodeId, { kind: "for-in", object: right.value, keys, index, scope }]
|
|
17578
|
+
])
|
|
17579
|
+
}
|
|
17580
|
+
}, scope);
|
|
17568
17581
|
emitLoopIterationBreakpoint(node, iterationContext);
|
|
17569
17582
|
const result = await evaluateNode(node.body, iterationContext);
|
|
17570
17583
|
if (isMatchingBreak(result, loopLabels(node))) {
|
|
@@ -22495,6 +22508,10 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
|
|
|
22495
22508
|
const expression = record2(raw2);
|
|
22496
22509
|
if (expression.kind === "binary") {
|
|
22497
22510
|
fields(expression, ["kind", "left"]);
|
|
22511
|
+
} else if (expression.kind === "for-in") {
|
|
22512
|
+
fields(expression, ["kind", "object", "keys", "index", "scope"]);
|
|
22513
|
+
if (array(expression.keys).some((key) => typeof key !== "string") || integer(expression.index) >= array(expression.keys).length) throw new TypeError("Invalid for-in continuation.");
|
|
22514
|
+
reference(expression.scope, ["scope-frame"]);
|
|
22498
22515
|
} else if (expression.kind === "for") {
|
|
22499
22516
|
fields(expression, ["kind", "phase", "loopScope", "activeScope"]);
|
|
22500
22517
|
if (!["init", "test", "body", "update"].includes(String(expression.phase))) throw new TypeError("Invalid for-loop phase.");
|
|
@@ -22682,7 +22699,7 @@ function validateGuestFunctionAst(record3, origin) {
|
|
|
22682
22699
|
pending.push({
|
|
22683
22700
|
value,
|
|
22684
22701
|
blocks,
|
|
22685
|
-
expressions: 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, {
|
|
22702
|
+
expressions: node.type === "ForInStatement" && key === "body" && typeof node.nodeId === "number" ? new Map([...frame.expressions, [node.nodeId, { kind: "for-in" }]]) : 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, {
|
|
22686
22703
|
kind: "member-assignment",
|
|
22687
22704
|
key: node.operator !== "=",
|
|
22688
22705
|
superReceiver: node.left.object.type === "Super"
|
|
@@ -22712,7 +22729,7 @@ function validateGuestFunctionAst(record3, origin) {
|
|
|
22712
22729
|
for (const [id, expression] of expressions) {
|
|
22713
22730
|
const expected = yieldExpressions?.get(Number(id));
|
|
22714
22731
|
const compatibleKind = expected?.kind === expression.kind || expected?.kind === "call" && expected.member === true && expression.kind === "array-call";
|
|
22715
|
-
if (expected === void 0 || !compatibleKind || expected.kind !== "binary" && expected.kind !== "identifier-assignment" && expected.kind !== "member" && expected.kind !== "member-assignment" && expected.kind !== "for" && expected.index !== expression.index || expected.kind === "for" && expected.phase !== expression.phase || 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"))
|
|
22732
|
+
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.index !== expression.index || expected.kind === "for" && expected.phase !== expression.phase || 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"))
|
|
22716
22733
|
throw new TypeError("Invalid generator AST identity: unrelated expression continuation");
|
|
22717
22734
|
}
|
|
22718
22735
|
}
|
|
@@ -22925,7 +22942,7 @@ function validateDumpReferences(value, path, depth, state, heapIds, heap, role =
|
|
|
22925
22942
|
}
|
|
22926
22943
|
for (const [key, entry] of Object.entries(record3)) {
|
|
22927
22944
|
const childRole = role === "root" && key === "heap" ? "heap" : role === "heap" ? "heap-node" : role === "heap-node" && record3.kind === "guest-generator" && key === "blockScopes" ? "scope-map" : role === "heap-node" && record3.kind === "guest-generator" && key === "expressionStates" ? "expressions" : role === "expressions" ? "expression" : "data";
|
|
22928
|
-
const scopeField = role === "scope-map" || role === "expression" && record3.kind === "for" && ["loopScope", "activeScope"].includes(key) || role === "heap-node" && (record3.kind === "scope-frame" && key === "parent" || record3.kind === "guest-function" && key === "scope" || record3.kind === "guest-generator" && ["scope", "closureScope", "suspendedScope"].includes(key));
|
|
22945
|
+
const scopeField = role === "scope-map" || role === "expression" && (record3.kind === "for" && ["loopScope", "activeScope"].includes(key) || record3.kind === "for-in" && key === "scope") || role === "heap-node" && (record3.kind === "scope-frame" && key === "parent" || record3.kind === "guest-function" && key === "scope" || record3.kind === "guest-generator" && ["scope", "closureScope", "suspendedScope"].includes(key));
|
|
22929
22946
|
validateDumpReferences(entry, `${path}${formatKey(key)}`, depth + 1, state, heapIds, heap, childRole, scopeField);
|
|
22930
22947
|
}
|
|
22931
22948
|
}
|
|
@@ -38958,4 +38975,4 @@ export {
|
|
|
38958
38975
|
FileSnapshotBackend,
|
|
38959
38976
|
run
|
|
38960
38977
|
};
|
|
38961
|
-
//# sourceMappingURL=chunk-
|
|
38978
|
+
//# sourceMappingURL=chunk-PHJUQHVC.js.map
|