@poe-platform/safe-js 0.1.219 → 0.1.221
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-UIOUG27J.js → chunk-7DK7CIUK.js} +22 -35
- package/dist/safe-js/chunks/{chunk-UIOUG27J.js.map → chunk-7DK7CIUK.js.map} +2 -2
- package/dist/safe-js/chunks/{chunk-T6BZBXWY.js → chunk-VVZQNTZ6.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 +1 -1
- package/package.json +2 -2
- /package/dist/safe-js/chunks/{chunk-T6BZBXWY.js.map → chunk-VVZQNTZ6.js.map} +0 -0
|
@@ -16637,11 +16637,13 @@ async function evaluateTemplateLiteral(node, context) {
|
|
|
16637
16637
|
}
|
|
16638
16638
|
async function evaluateTaggedTemplateExpression(node, context) {
|
|
16639
16639
|
const invokeTag = async (tag2, receiver) => {
|
|
16640
|
-
|
|
16640
|
+
const call = createCallContinuation(node, tag2, context, receiver);
|
|
16641
|
+
context = call.context;
|
|
16641
16642
|
const release = retainValues(context.budget, () => [tag2, receiver]);
|
|
16642
16643
|
try {
|
|
16643
|
-
const values = await
|
|
16644
|
+
const values = await evaluateCallArguments(node.quasi.expressions, context, call.state);
|
|
16644
16645
|
if (!values.ok) return values.result;
|
|
16646
|
+
if (!isSandboxClosure(tag2)) throw new TypeError("Tagged template tag must be a function.");
|
|
16645
16647
|
return {
|
|
16646
16648
|
kind: "normal",
|
|
16647
16649
|
hasValue: true,
|
|
@@ -16658,6 +16660,11 @@ async function evaluateTaggedTemplateExpression(node, context) {
|
|
|
16658
16660
|
release();
|
|
16659
16661
|
}
|
|
16660
16662
|
};
|
|
16663
|
+
const restored = context.generatorResume === void 0 || node.nodeId === void 0 ? void 0 : context.restoredGeneratorExpressionStates?.get(node.nodeId);
|
|
16664
|
+
if (restored !== void 0) {
|
|
16665
|
+
if (restored.kind !== "tagged") throw new TypeError("Invalid tagged template continuation.");
|
|
16666
|
+
return invokeTag(restored.callee, restored.thisValue);
|
|
16667
|
+
}
|
|
16661
16668
|
if (node.tag.type === "MemberExpression") return evaluateMemberAccess(node.tag, context, async (member) => {
|
|
16662
16669
|
if (member.kind === "nullish") throw new TypeError("Tagged template tag must be a function.");
|
|
16663
16670
|
const key = await toPropertyKey(member.property, context.budget, createCoercionContext(context));
|
|
@@ -16667,28 +16674,6 @@ async function evaluateTaggedTemplateExpression(node, context) {
|
|
|
16667
16674
|
const tag = await evaluateNode(node.tag, context);
|
|
16668
16675
|
return tag.kind === "normal" ? invokeTag(tag.value, void 0) : tag;
|
|
16669
16676
|
}
|
|
16670
|
-
async function evaluateTemplateExpressionValues(node, context) {
|
|
16671
|
-
const values = [];
|
|
16672
|
-
const release = retainValues(context.budget, () => values);
|
|
16673
|
-
try {
|
|
16674
|
-
for (const expressionNode of node.expressions) {
|
|
16675
|
-
const expression = await evaluateNode(expressionNode, context);
|
|
16676
|
-
if (expression.kind !== "normal") {
|
|
16677
|
-
return {
|
|
16678
|
-
ok: false,
|
|
16679
|
-
result: expression
|
|
16680
|
-
};
|
|
16681
|
-
}
|
|
16682
|
-
values.push(expression.value);
|
|
16683
|
-
}
|
|
16684
|
-
return {
|
|
16685
|
-
ok: true,
|
|
16686
|
-
value: values
|
|
16687
|
-
};
|
|
16688
|
-
} finally {
|
|
16689
|
-
release();
|
|
16690
|
-
}
|
|
16691
|
-
}
|
|
16692
16677
|
function createTaggedTemplateStrings(node, context) {
|
|
16693
16678
|
context.budget.allocateArrayLength(node.quasis.length);
|
|
16694
16679
|
const strings = node.quasis.map(
|
|
@@ -19111,16 +19096,16 @@ async function invokeSandboxClosure(callee, args, context, stack, span, thisValu
|
|
|
19111
19096
|
}
|
|
19112
19097
|
}
|
|
19113
19098
|
function createCallContinuation(node, callee, context, thisValue = void 0) {
|
|
19114
|
-
const kind = node.type === "NewExpression" ? "new" : "call";
|
|
19099
|
+
const kind = node.type === "NewExpression" ? "new" : node.type === "TaggedTemplateExpression" ? "tagged" : "call";
|
|
19115
19100
|
const restored = context.generatorResume === void 0 || node.nodeId === void 0 ? void 0 : context.restoredGeneratorExpressionStates?.get(node.nodeId);
|
|
19116
|
-
if (restored !== void 0 && (restored.kind !== "call" && restored.kind !== "new" || restored.kind !== kind || !Array.isArray(restored.args)))
|
|
19101
|
+
if (restored !== void 0 && (restored.kind !== "call" && restored.kind !== "new" && restored.kind !== "tagged" || restored.kind !== kind || !Array.isArray(restored.args)))
|
|
19117
19102
|
throw new TypeError("Invalid call expression continuation.");
|
|
19118
19103
|
const state = {
|
|
19119
19104
|
kind,
|
|
19120
19105
|
callee,
|
|
19121
19106
|
thisValue,
|
|
19122
|
-
args: restored?.kind === "call" || restored?.kind === "new" ? restored.args : [],
|
|
19123
|
-
index: restored?.kind === "call" || restored?.kind === "new" ? restored.index : 0
|
|
19107
|
+
args: restored?.kind === "call" || restored?.kind === "new" || restored?.kind === "tagged" ? restored.args : [],
|
|
19108
|
+
index: restored?.kind === "call" || restored?.kind === "new" || restored?.kind === "tagged" ? restored.index : 0
|
|
19124
19109
|
};
|
|
19125
19110
|
return { state, context: context.generatorYield === void 0 || node.nodeId === void 0 ? context : {
|
|
19126
19111
|
...context,
|
|
@@ -22403,7 +22388,7 @@ function validateGuestHeapNode(raw, heap) {
|
|
|
22403
22388
|
fields(expression, ["kind", "values", "index"]);
|
|
22404
22389
|
integer(expression.index);
|
|
22405
22390
|
reference(expression.values, ["array"]);
|
|
22406
|
-
} else if (expression.kind === "call" || expression.kind === "new") {
|
|
22391
|
+
} else if (expression.kind === "call" || expression.kind === "new" || expression.kind === "tagged") {
|
|
22407
22392
|
fields(expression, ["kind", "callee", "thisValue", "args", "index"]);
|
|
22408
22393
|
integer(expression.index);
|
|
22409
22394
|
reference(expression.args, ["array"]);
|
|
@@ -22518,11 +22503,13 @@ function validateGuestFunctionAst(record3, origin) {
|
|
|
22518
22503
|
}
|
|
22519
22504
|
for (const [key, value] of Object.entries(node)) {
|
|
22520
22505
|
if (node.type === "TaggedTemplateExpression" && key === "quasi") {
|
|
22521
|
-
|
|
22522
|
-
|
|
22523
|
-
|
|
22524
|
-
|
|
22525
|
-
|
|
22506
|
+
value.expressions.forEach((expression, index) => {
|
|
22507
|
+
pending.push({
|
|
22508
|
+
value: expression,
|
|
22509
|
+
blocks,
|
|
22510
|
+
finalizers: frame.finalizers,
|
|
22511
|
+
expressions: new Map([...frame.expressions, [node.nodeId, { kind: "tagged", index }]])
|
|
22512
|
+
});
|
|
22526
22513
|
});
|
|
22527
22514
|
continue;
|
|
22528
22515
|
}
|
|
@@ -38775,4 +38762,4 @@ export {
|
|
|
38775
38762
|
FileSnapshotBackend,
|
|
38776
38763
|
run
|
|
38777
38764
|
};
|
|
38778
|
-
//# sourceMappingURL=chunk-
|
|
38765
|
+
//# sourceMappingURL=chunk-7DK7CIUK.js.map
|