@poe-platform/safe-js 0.1.233 → 0.1.234
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-HQP4GXCO.js → chunk-HZZVOMG2.js} +2 -2
- package/dist/safe-js/chunks/{chunk-4EKZGMNU.js → chunk-PV36YBZS.js} +87 -30
- package/dist/safe-js/chunks/chunk-PV36YBZS.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-4EKZGMNU.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-HQP4GXCO.js.map → chunk-HZZVOMG2.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-PV36YBZS.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-HZZVOMG2.js.map
|
|
@@ -10011,38 +10011,65 @@ async function bindObjectPattern2(pattern, value, target, scope, context) {
|
|
|
10011
10011
|
if (value === void 0 || value === null) {
|
|
10012
10012
|
throw new TypeError("Object destructuring requires a non-nullish value.");
|
|
10013
10013
|
}
|
|
10014
|
-
const
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10018
|
-
|
|
10019
|
-
|
|
10014
|
+
const saved = pattern.nodeId === void 0 ? void 0 : context.restoredPatternState?.(pattern.nodeId);
|
|
10015
|
+
if (saved !== void 0 && saved.kind !== "object-pattern") throw new TypeError("Invalid object pattern continuation.");
|
|
10016
|
+
const excludedKeys = new Set(saved?.excludedKeys);
|
|
10017
|
+
const excludedKeyValues = [...excludedKeys];
|
|
10018
|
+
let state;
|
|
10019
|
+
const release = context.budget === void 0 ? () => void 0 : retainValues(
|
|
10020
|
+
context.budget,
|
|
10021
|
+
() => [value, state?.current, state?.key, state?.referenceObject, state?.referenceKey, ...state?.excludedKeys ?? []]
|
|
10022
|
+
);
|
|
10023
|
+
try {
|
|
10024
|
+
for (let index = saved?.index ?? 0; index < pattern.properties.length; index++) {
|
|
10025
|
+
const property = pattern.properties[index];
|
|
10026
|
+
state = saved !== void 0 && index === saved.index ? { ...saved, excludedKeys: excludedKeyValues } : {
|
|
10027
|
+
kind: "object-pattern",
|
|
10028
|
+
phase: property.type === "RestElement" ? "reference" : "key",
|
|
10029
|
+
index,
|
|
10030
|
+
excludedKeys: excludedKeyValues,
|
|
10031
|
+
key: void 0,
|
|
10032
|
+
current: void 0
|
|
10033
|
+
};
|
|
10034
|
+
const currentState = state;
|
|
10035
|
+
const propertyContext = pattern.nodeId === void 0 ? context : context.withPatternState?.(pattern.nodeId, state) ?? context;
|
|
10036
|
+
if (property.type !== "RestElement" && state.phase === "key") {
|
|
10037
|
+
const key = await evaluatePatternKey(property, propertyContext);
|
|
10038
|
+
if (!key.ok) return key;
|
|
10039
|
+
state.key = typeof key.value === "symbol" ? key.value : String(key.value);
|
|
10040
|
+
if (!excludedKeys.has(state.key)) excludedKeyValues.push(state.key);
|
|
10041
|
+
excludedKeys.add(state.key);
|
|
10042
|
+
state.phase = "reference";
|
|
10043
|
+
}
|
|
10044
|
+
const element = property.type === "RestElement" ? property : property.value;
|
|
10045
|
+
const binding = state.phase === "binding" ? await bindPattern2(
|
|
10046
|
+
element,
|
|
10047
|
+
state.current,
|
|
10020
10048
|
target,
|
|
10021
10049
|
scope,
|
|
10022
|
-
|
|
10050
|
+
propertyContext,
|
|
10051
|
+
Object.hasOwn(state, "referenceObject") ? { object: state.referenceObject, key: state.referenceKey } : void 0
|
|
10052
|
+
) : await bindPatternValue(
|
|
10053
|
+
element,
|
|
10054
|
+
async () => ({ value: property.type === "RestElement" ? await copyObjectRestValue(value, excludedKeys, propertyContext) : await propertyContext.getProperty(value, currentState.key) }),
|
|
10055
|
+
target,
|
|
10056
|
+
scope,
|
|
10057
|
+
propertyContext,
|
|
10058
|
+
(current, reference) => {
|
|
10059
|
+
currentState.current = current;
|
|
10060
|
+
currentState.phase = "binding";
|
|
10061
|
+
if (reference !== void 0) {
|
|
10062
|
+
currentState.referenceObject = reference.object;
|
|
10063
|
+
currentState.referenceKey = reference.key;
|
|
10064
|
+
}
|
|
10065
|
+
}
|
|
10023
10066
|
);
|
|
10024
|
-
if (!
|
|
10025
|
-
return binding2;
|
|
10026
|
-
}
|
|
10027
|
-
continue;
|
|
10028
|
-
}
|
|
10029
|
-
const key = await evaluatePatternKey(property, context);
|
|
10030
|
-
if (!key.ok) {
|
|
10031
|
-
return key;
|
|
10032
|
-
}
|
|
10033
|
-
excludedKeys.add(typeof key.value === "symbol" ? key.value : String(key.value));
|
|
10034
|
-
const binding = await bindPatternValue(
|
|
10035
|
-
property.value,
|
|
10036
|
-
async () => ({ value: await context.getProperty(value, key.value) }),
|
|
10037
|
-
target,
|
|
10038
|
-
scope,
|
|
10039
|
-
context
|
|
10040
|
-
);
|
|
10041
|
-
if (!binding.ok) {
|
|
10042
|
-
return binding;
|
|
10067
|
+
if (!binding.ok) return binding;
|
|
10043
10068
|
}
|
|
10069
|
+
return { ok: true };
|
|
10070
|
+
} finally {
|
|
10071
|
+
release();
|
|
10044
10072
|
}
|
|
10045
|
-
return { ok: true };
|
|
10046
10073
|
}
|
|
10047
10074
|
async function bindMemberExpression(pattern, value, context, reference) {
|
|
10048
10075
|
if (reference === void 0) {
|
|
@@ -20984,7 +21011,15 @@ function captureGuestHeapNode(value, encode) {
|
|
|
20984
21011
|
...value.state !== "suspended" || origin2.expressionStates === void 0 ? {} : {
|
|
20985
21012
|
expressionStates: Object.fromEntries([...origin2.expressionStates].map(([id, expression]) => [
|
|
20986
21013
|
String(id),
|
|
20987
|
-
expression.kind === "binary" ? { kind: "binary", left: encode(expression.left) } : expression.kind === "pattern-source" ? { kind: "pattern-source", value: encode(expression.value) } : expression.kind === "
|
|
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" ? {
|
|
21015
|
+
kind: "object-pattern",
|
|
21016
|
+
phase: expression.phase,
|
|
21017
|
+
index: expression.index,
|
|
21018
|
+
excludedKeys: expression.excludedKeys.map(encode),
|
|
21019
|
+
key: encode(expression.key),
|
|
21020
|
+
current: encode(expression.current),
|
|
21021
|
+
...Object.hasOwn(expression, "referenceObject") ? { referenceObject: encode(expression.referenceObject), referenceKey: encode(expression.referenceKey) } : {}
|
|
21022
|
+
} : expression.kind === "array-pattern" ? {
|
|
20988
21023
|
kind: "array-pattern",
|
|
20989
21024
|
phase: expression.phase,
|
|
20990
21025
|
index: expression.index,
|
|
@@ -22644,6 +22679,14 @@ function validateGuestHeapNode(raw, heap, maxArrayLength = 4294967295) {
|
|
|
22644
22679
|
fields(expression, ["kind", "left"]);
|
|
22645
22680
|
} else if (expression.kind === "pattern-source") {
|
|
22646
22681
|
fields(expression, ["kind", "value"]);
|
|
22682
|
+
} else if (expression.kind === "object-pattern") {
|
|
22683
|
+
fields(expression, ["kind", "phase", "index", "excludedKeys", "key", "current"], ["referenceObject", "referenceKey"]);
|
|
22684
|
+
integer(expression.index);
|
|
22685
|
+
if (!["key", "reference", "binding"].includes(String(expression.phase)) || Object.hasOwn(expression, "referenceObject") !== Object.hasOwn(expression, "referenceKey")) throw new TypeError("Invalid object pattern state.");
|
|
22686
|
+
for (const key of array(expression.excludedKeys)) if (typeof key !== "string") reference(key, ["symbol"]);
|
|
22687
|
+
if (!absent(expression.key) && typeof expression.key !== "string") reference(expression.key, ["symbol"]);
|
|
22688
|
+
if (Object.hasOwn(expression, "referenceObject") && expression.phase !== "binding") throw new TypeError("Invalid prepared object pattern reference.");
|
|
22689
|
+
if (Object.hasOwn(expression, "referenceKey") && typeof expression.referenceKey !== "string") reference(expression.referenceKey, ["symbol"]);
|
|
22647
22690
|
} else if (expression.kind === "for-of-array" || expression.kind === "for-of-iterator" || expression.kind === "array-pattern") {
|
|
22648
22691
|
if (expression.kind === "array-pattern") {
|
|
22649
22692
|
fields(expression, ["kind", "phase", "index", "done", "current", "iterator"], ["referenceObject", "referenceKey"]);
|
|
@@ -22853,6 +22896,20 @@ function validateGuestFunctionAst(record3, origin) {
|
|
|
22853
22896
|
});
|
|
22854
22897
|
continue;
|
|
22855
22898
|
}
|
|
22899
|
+
if (node.type === "ObjectPattern" && key === "properties" && typeof node.nodeId === "number" && Array.isArray(value)) {
|
|
22900
|
+
const id = node.nodeId;
|
|
22901
|
+
value.forEach((property, index) => {
|
|
22902
|
+
for (const part of property.type === "RestElement" ? ["argument"] : ["key", "value"]) {
|
|
22903
|
+
pending.push({
|
|
22904
|
+
value: property[part],
|
|
22905
|
+
blocks,
|
|
22906
|
+
finalizers: frame.finalizers,
|
|
22907
|
+
expressions: new Map([...frame.expressions, [id, { kind: "object-pattern", index, key: part === "key" }]])
|
|
22908
|
+
});
|
|
22909
|
+
}
|
|
22910
|
+
});
|
|
22911
|
+
continue;
|
|
22912
|
+
}
|
|
22856
22913
|
if (node.type === "ObjectExpression" && key === "properties" && typeof node.nodeId === "number" && Array.isArray(value)) {
|
|
22857
22914
|
const id = node.nodeId;
|
|
22858
22915
|
value.forEach((property, index) => {
|
|
@@ -22921,7 +22978,7 @@ function validateGuestFunctionAst(record3, origin) {
|
|
|
22921
22978
|
for (const [id, expression] of expressions) {
|
|
22922
22979
|
const expected = yieldExpressions?.get(Number(id));
|
|
22923
22980
|
const compatibleKind = expected?.kind === expression.kind || expected?.kind === "for-of" && (expression.kind === "for-of-iterator" || !expected.async && expression.kind === "for-of-array") || expected?.kind === "call" && expected.member === true && expression.kind === "array-call";
|
|
22924
|
-
if (expected === void 0 || !compatibleKind || expected.kind !== "binary" && expected.kind !== "pattern-source" && expected.kind !== "identifier-assignment" && expected.kind !== "member" && expected.kind !== "member-assignment" && expected.kind !== "for" && expected.kind !== "for-in" && expected.kind !== "for-of" && expected.index !== expression.index || (expected.kind === "for" || expected.kind === "for-of") && expected.phase !== expression.phase || expected.kind === "for-in" && expected.phase !== (expression.phase ?? "body") || expected.kind === "for-of" && expression.kind === "for-of-iterator" && expected.async !== expression.async || 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"))
|
|
22981
|
+
if (expected === void 0 || !compatibleKind || expected.kind !== "binary" && expected.kind !== "pattern-source" && expected.kind !== "identifier-assignment" && expected.kind !== "member" && expected.kind !== "member-assignment" && expected.kind !== "for" && expected.kind !== "for-in" && expected.kind !== "for-of" && expected.index !== expression.index || (expected.kind === "for" || expected.kind === "for-of") && expected.phase !== expression.phase || expected.kind === "for-in" && expected.phase !== (expression.phase ?? "body") || expected.kind === "object-pattern" && expected.key !== (expression.phase === "key") || expected.kind === "for-of" && expression.kind === "for-of-iterator" && expected.async !== expression.async || 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"))
|
|
22925
22982
|
throw new TypeError("Invalid generator AST identity: unrelated expression continuation");
|
|
22926
22983
|
}
|
|
22927
22984
|
}
|
|
@@ -39167,4 +39224,4 @@ export {
|
|
|
39167
39224
|
FileSnapshotBackend,
|
|
39168
39225
|
run
|
|
39169
39226
|
};
|
|
39170
|
-
//# sourceMappingURL=chunk-
|
|
39227
|
+
//# sourceMappingURL=chunk-PV36YBZS.js.map
|