@poe-platform/safe-js 0.1.234 → 0.1.236

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.
@@ -27,7 +27,7 @@ import {
27
27
  validateMigrationSemantics,
28
28
  validateSnapshotData,
29
29
  validateSnapshotMigration
30
- } from "./chunk-PV36YBZS.js";
30
+ } from "./chunk-YXXCUBTE.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-HZZVOMG2.js.map
8252
+ //# sourceMappingURL=chunk-IMG6SFST.js.map
@@ -9865,17 +9865,24 @@ function bindIdentifier(pattern, value, target, scope) {
9865
9865
  scope.declare(pattern.name, target.kind, value);
9866
9866
  }
9867
9867
  async function bindAssignmentPattern2(pattern, value, target, scope, context, reference) {
9868
- if (value !== void 0) {
9869
- return bindPattern2(pattern.left, value, target, scope, context, reference);
9868
+ const saved = pattern.nodeId === void 0 ? void 0 : context.restoredPatternState?.(pattern.nodeId);
9869
+ if (saved !== void 0 && saved.kind !== "pattern-source") throw new TypeError("Invalid pattern default continuation.");
9870
+ if (saved !== void 0) value = saved.value;
9871
+ else if (value === void 0) {
9872
+ const defaultValue = await context.evaluate(
9873
+ pattern.right,
9874
+ pattern.left.type === "Identifier" ? pattern.left.name : void 0
9875
+ );
9876
+ if (defaultValue.kind !== "normal") return { ok: false, result: defaultValue };
9877
+ value = defaultValue.value;
9870
9878
  }
9871
- const defaultValue = await context.evaluate(
9872
- pattern.right,
9873
- pattern.left.type === "Identifier" ? pattern.left.name : void 0
9874
- );
9875
- if (defaultValue.kind !== "normal") {
9876
- return { ok: false, result: defaultValue };
9879
+ const bindingContext = pattern.nodeId === void 0 || pattern.left.type !== "ArrayPattern" && pattern.left.type !== "ObjectPattern" ? context : context.withPatternState?.(pattern.nodeId, { kind: "pattern-source", value }) ?? context;
9880
+ const release = context.budget === void 0 ? () => void 0 : retainValues(context.budget, () => [value]);
9881
+ try {
9882
+ return await bindPattern2(pattern.left, value, target, scope, bindingContext, reference);
9883
+ } finally {
9884
+ release();
9877
9885
  }
9878
- return bindPattern2(pattern.left, defaultValue.value, target, scope, context, reference);
9879
9886
  }
9880
9887
  async function bindPatternValue(pattern, readValue, target, scope, context, onRead) {
9881
9888
  let member = pattern;
@@ -15852,10 +15859,19 @@ async function evaluateExportNamedDeclaration(node, context) {
15852
15859
  return evaluateVariableDeclaration(node.declaration, context);
15853
15860
  }
15854
15861
  async function evaluateVariableDeclaration(node, context) {
15862
+ const saved = context.generatorResume === void 0 || node.nodeId === void 0 ? void 0 : context.restoredGeneratorExpressionStates?.get(node.nodeId);
15863
+ if (saved !== void 0 && saved.kind !== "declaration") throw new TypeError("Invalid declaration continuation.");
15855
15864
  if (node.kind !== "var") {
15856
15865
  predeclareDeclarationBindings(node, context.scope);
15857
15866
  }
15858
- for (const declarator of node.declarations) {
15867
+ for (let index = saved?.index ?? 0; index < node.declarations.length; index++) {
15868
+ const declarator = node.declarations[index];
15869
+ if (context.generatorYield !== void 0 && node.nodeId !== void 0) {
15870
+ context = { ...context, generatorExpressionStates: new Map([
15871
+ ...context.generatorExpressionStates ?? [],
15872
+ [node.nodeId, { kind: "declaration", index }]
15873
+ ]) };
15874
+ }
15859
15875
  if (node.kind === "var" && declarator.init === void 0 && declarator.id.type === "Identifier" && context.scope.lookup(declarator.id.name).found) {
15860
15876
  continue;
15861
15877
  }
@@ -16614,6 +16630,12 @@ async function bindIterationVariable(left, value, scope, context) {
16614
16630
  if (left.declarations.length !== 1 || declarator === void 0) {
16615
16631
  throw new TypeError("for...of declarations must include exactly one declarator.");
16616
16632
  }
16633
+ if (context.generatorYield !== void 0 && left.nodeId !== void 0) {
16634
+ context = { ...context, generatorExpressionStates: new Map([
16635
+ ...context.generatorExpressionStates ?? [],
16636
+ [left.nodeId, { kind: "declaration", index: 0 }]
16637
+ ]) };
16638
+ }
16617
16639
  return bindPattern2(declarator.id, value, { kind: left.kind }, scope, createPatternContext(context, scope));
16618
16640
  }
16619
16641
  async function evaluateExpressionStatement(node, context) {
@@ -21011,7 +21033,7 @@ function captureGuestHeapNode(value, encode) {
21011
21033
  ...value.state !== "suspended" || origin2.expressionStates === void 0 ? {} : {
21012
21034
  expressionStates: Object.fromEntries([...origin2.expressionStates].map(([id, expression]) => [
21013
21035
  String(id),
21014
- expression.kind === "binary" ? { kind: "binary", left: encode(expression.left) } : expression.kind === "pattern-source" ? { kind: "pattern-source", value: encode(expression.value) } : expression.kind === "object-pattern" ? {
21036
+ expression.kind === "binary" ? { kind: "binary", left: encode(expression.left) } : expression.kind === "declaration" ? { ...expression } : expression.kind === "pattern-source" ? { kind: "pattern-source", value: encode(expression.value) } : expression.kind === "object-pattern" ? {
21015
21037
  kind: "object-pattern",
21016
21038
  phase: expression.phase,
21017
21039
  index: expression.index,
@@ -22677,6 +22699,9 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
22677
22699
  const expression = record2(raw2);
22678
22700
  if (expression.kind === "binary") {
22679
22701
  fields(expression, ["kind", "left"]);
22702
+ } else if (expression.kind === "declaration") {
22703
+ fields(expression, ["kind", "index"]);
22704
+ integer(expression.index);
22680
22705
  } else if (expression.kind === "pattern-source") {
22681
22706
  fields(expression, ["kind", "value"]);
22682
22707
  } else if (expression.kind === "object-pattern") {
@@ -22885,6 +22910,15 @@ function validateGuestFunctionAst(record3, origin) {
22885
22910
  yieldExpressions = frame.expressions;
22886
22911
  }
22887
22912
  for (const [key, value] of Object.entries(node)) {
22913
+ if (node.type === "VariableDeclaration" && key === "declarations" && typeof node.nodeId === "number" && Array.isArray(value)) {
22914
+ value.forEach((declarator, index) => pending.push({
22915
+ value: declarator,
22916
+ blocks,
22917
+ finalizers: frame.finalizers,
22918
+ expressions: new Map([...frame.expressions, [node.nodeId, { kind: "declaration", index }]])
22919
+ }));
22920
+ continue;
22921
+ }
22888
22922
  if (node.type === "TaggedTemplateExpression" && key === "quasi") {
22889
22923
  value.expressions.forEach((expression, index) => {
22890
22924
  pending.push({
@@ -22948,7 +22982,7 @@ function validateGuestFunctionAst(record3, origin) {
22948
22982
  pending.push({
22949
22983
  value,
22950
22984
  blocks,
22951
- 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, {
22985
+ expressions: (node.type === "VariableDeclarator" && key === "id" && node.init !== void 0 || (node.type === "AssignmentExpression" || node.type === "AssignmentPattern") && 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, {
22952
22986
  kind: "member-assignment",
22953
22987
  key: node.operator !== "=",
22954
22988
  superReceiver: node.left.object.type === "Super"
@@ -39224,4 +39258,4 @@ export {
39224
39258
  FileSnapshotBackend,
39225
39259
  run
39226
39260
  };
39227
- //# sourceMappingURL=chunk-PV36YBZS.js.map
39261
+ //# sourceMappingURL=chunk-YXXCUBTE.js.map