@poe-platform/safe-js 0.1.309 → 0.1.311
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-KZ2S6QYZ.js → chunk-7LBVMJQT.js} +2 -2
- package/dist/safe-js/chunks/{chunk-A5S5VD23.js → chunk-GWV7ELQW.js} +113 -8
- package/dist/safe-js/chunks/chunk-GWV7ELQW.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/package.json +2 -2
- package/dist/safe-js/chunks/chunk-A5S5VD23.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-KZ2S6QYZ.js.map → chunk-7LBVMJQT.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-GWV7ELQW.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-7LBVMJQT.js.map
|
|
@@ -1175,7 +1175,7 @@ var Lexer = class {
|
|
|
1175
1175
|
lastClosedControlParenthesis = false;
|
|
1176
1176
|
continue;
|
|
1177
1177
|
}
|
|
1178
|
-
if (char === "/" && this.peekChar(1) !== "=" && shouldRejectRegexLiteral(tokens[tokens.length - 1], lastClosedControlParenthesis)) {
|
|
1178
|
+
if (char === "/" && this.peekChar(1) !== "=" && shouldRejectRegexLiteral(tokens[tokens.length - 1], lastClosedControlParenthesis, tokens)) {
|
|
1179
1179
|
if (!this.options.allowRegexLiterals) {
|
|
1180
1180
|
this.syntaxError("Regular expression literals are not supported", this.position());
|
|
1181
1181
|
}
|
|
@@ -1444,7 +1444,7 @@ var Lexer = class {
|
|
|
1444
1444
|
}
|
|
1445
1445
|
}
|
|
1446
1446
|
readSlashOrPunctuator(start) {
|
|
1447
|
-
if (this.currentChar() === "/" && this.peekChar(1) !== "=" && shouldRejectRegexLiteral(this.lastSignificantToken(), this.lastClosedControlParenthesis)) {
|
|
1447
|
+
if (this.currentChar() === "/" && this.peekChar(1) !== "=" && shouldRejectRegexLiteral(this.lastSignificantToken(), this.lastClosedControlParenthesis, this.tokens)) {
|
|
1448
1448
|
if (!this.options.allowRegexLiterals) {
|
|
1449
1449
|
this.syntaxError("Regular expression literals are not supported", start);
|
|
1450
1450
|
}
|
|
@@ -1728,7 +1728,7 @@ function matchPunctuator(source, index) {
|
|
|
1728
1728
|
(punctuator) => source.startsWith(punctuator, index) && (punctuator !== "?." || !isDecimalDigit(source[index + 2] ?? ""))
|
|
1729
1729
|
);
|
|
1730
1730
|
}
|
|
1731
|
-
function shouldRejectRegexLiteral(previousToken, lastClosedControlParenthesis) {
|
|
1731
|
+
function shouldRejectRegexLiteral(previousToken, lastClosedControlParenthesis, tokens) {
|
|
1732
1732
|
if (previousToken === void 0) {
|
|
1733
1733
|
return true;
|
|
1734
1734
|
}
|
|
@@ -1736,6 +1736,7 @@ function shouldRejectRegexLiteral(previousToken, lastClosedControlParenthesis) {
|
|
|
1736
1736
|
return false;
|
|
1737
1737
|
}
|
|
1738
1738
|
if (previousToken.type === "keyword") {
|
|
1739
|
+
if (previousToken.value === "of") return endsWithForOfSeparator(tokens);
|
|
1739
1740
|
return !EXPRESSION_ENDING_KEYWORDS.has(previousToken.value);
|
|
1740
1741
|
}
|
|
1741
1742
|
if (previousToken.value === ")") {
|
|
@@ -1743,6 +1744,35 @@ function shouldRejectRegexLiteral(previousToken, lastClosedControlParenthesis) {
|
|
|
1743
1744
|
}
|
|
1744
1745
|
return !isExpressionEndingPunctuator(previousToken.value);
|
|
1745
1746
|
}
|
|
1747
|
+
function endsWithForOfSeparator(tokens) {
|
|
1748
|
+
let depth = 0;
|
|
1749
|
+
let start = -1;
|
|
1750
|
+
for (let index = tokens.length - 2; index >= 0; index--) {
|
|
1751
|
+
const token = tokens[index];
|
|
1752
|
+
if (token.type !== "punctuator") continue;
|
|
1753
|
+
if ([")", "]", "}"].includes(token.value)) depth++;
|
|
1754
|
+
else if (["(", "[", "{"].includes(token.value)) {
|
|
1755
|
+
if (depth > 0) {
|
|
1756
|
+
depth--;
|
|
1757
|
+
continue;
|
|
1758
|
+
}
|
|
1759
|
+
if (token.value === "(" && (tokens[index - 1]?.value === "for" || tokens[index - 1]?.value === "await" && tokens[index - 2]?.value === "for")) start = index + 1;
|
|
1760
|
+
break;
|
|
1761
|
+
} else if (depth === 0 && token.value === ";") break;
|
|
1762
|
+
}
|
|
1763
|
+
if (start < 0) return false;
|
|
1764
|
+
depth = 0;
|
|
1765
|
+
for (let index = start; index < tokens.length; index++) {
|
|
1766
|
+
const token = tokens[index];
|
|
1767
|
+
if (token.type === "punctuator") {
|
|
1768
|
+
if (["(", "[", "{"].includes(token.value)) depth++;
|
|
1769
|
+
else if ([")", "]", "}"].includes(token.value)) depth--;
|
|
1770
|
+
}
|
|
1771
|
+
if (depth === 0 && token.type === "keyword" && token.value === "of" && index !== start && tokens[index - 1]?.value !== "." && tokens[index - 1]?.value !== "?." && !(index === start + 1 && ["const", "let", "var"].includes(tokens[start].value)))
|
|
1772
|
+
return index === tokens.length - 1;
|
|
1773
|
+
}
|
|
1774
|
+
return false;
|
|
1775
|
+
}
|
|
1746
1776
|
function updateGroupingState(groupingStack, previousToken, punctuator) {
|
|
1747
1777
|
if (punctuator === "(") {
|
|
1748
1778
|
groupingStack.push({
|
|
@@ -5532,6 +5562,7 @@ var Parser = class {
|
|
|
5532
5562
|
return void 0;
|
|
5533
5563
|
}
|
|
5534
5564
|
findTopLevelForIterationOperator(startIndex) {
|
|
5565
|
+
let operator;
|
|
5535
5566
|
let depth = 0;
|
|
5536
5567
|
let previousToken;
|
|
5537
5568
|
for (let index = startIndex; index < this.tokens.length; index += 1) {
|
|
@@ -5541,15 +5572,15 @@ var Parser = class {
|
|
|
5541
5572
|
depth += 1;
|
|
5542
5573
|
} else if (token.value === ")" || token.value === "]" || token.value === "}") {
|
|
5543
5574
|
if (depth === 0 && token.value === ")") {
|
|
5544
|
-
return
|
|
5575
|
+
return operator;
|
|
5545
5576
|
}
|
|
5546
5577
|
depth -= 1;
|
|
5547
5578
|
} else if (depth === 0 && token.value === ";") {
|
|
5548
5579
|
return void 0;
|
|
5549
5580
|
}
|
|
5550
5581
|
}
|
|
5551
|
-
if (depth === 0 && token.type === "keyword" && (token.value === "of" || token.value === "in") && previousToken?.value !== "." && previousToken?.value !== "?.") {
|
|
5552
|
-
|
|
5582
|
+
if (depth === 0 && token.type === "keyword" && (token.value === "of" || token.value === "in") && index !== startIndex && !(token.value === "of" && index === startIndex + 1 && ["const", "let", "var"].includes(previousToken?.value ?? "")) && previousToken?.value !== "." && previousToken?.value !== "?.") {
|
|
5583
|
+
operator ??= token;
|
|
5553
5584
|
}
|
|
5554
5585
|
previousToken = token;
|
|
5555
5586
|
}
|
|
@@ -6542,7 +6573,7 @@ function isLiteralPropertyKey(token) {
|
|
|
6542
6573
|
return token.type === "numeric" || token.type === "string";
|
|
6543
6574
|
}
|
|
6544
6575
|
function isIdentifierLikeToken(token) {
|
|
6545
|
-
return token.type === "identifier" || token.type === "keyword" && token.value === "async";
|
|
6576
|
+
return token.type === "identifier" || token.type === "keyword" && (token.value === "async" || token.value === "of");
|
|
6546
6577
|
}
|
|
6547
6578
|
function isNewToken(token) {
|
|
6548
6579
|
return token.value === "new";
|
|
@@ -9520,6 +9551,8 @@ async function acquireSandboxIterator(value, budget, context, asyncProtocol = fa
|
|
|
9520
9551
|
const iterator = await invokeBuiltinClosure(factory, [], budget, context, value);
|
|
9521
9552
|
if (typeof iterator !== "object" && typeof iterator !== "function" || iterator === null)
|
|
9522
9553
|
throw new TypeError("Iterator must be an object.");
|
|
9554
|
+
if (!asyncProtocol && isSandboxGenerator(iterator) && !iterator.async && !hasExplicitSandboxPrototype(iterator) && getSandboxPropertyDescriptor(iterator, "next", budget) === void 0)
|
|
9555
|
+
return getSandboxIterator(iterator, budget, context);
|
|
9523
9556
|
const next = await context.getProperty(iterator, "next");
|
|
9524
9557
|
return guestIterator(iterator, next, asyncProtocol, budget, context, signal);
|
|
9525
9558
|
}
|
|
@@ -14573,6 +14606,78 @@ function createFloat32ArrayPrototypes(budget, constructor) {
|
|
|
14573
14606
|
construct: abstractCall
|
|
14574
14607
|
});
|
|
14575
14608
|
Object.defineProperty(materializeFunctionProperties(typedArray), "prototype", { value: shared, writable: false });
|
|
14609
|
+
Object.defineProperty(materializeFunctionProperties(typedArray), "from", {
|
|
14610
|
+
writable: true,
|
|
14611
|
+
configurable: true,
|
|
14612
|
+
value: createSandboxClosure({
|
|
14613
|
+
guest: true,
|
|
14614
|
+
sandbox: true,
|
|
14615
|
+
name: "from",
|
|
14616
|
+
length: 1,
|
|
14617
|
+
call: async (args, context) => {
|
|
14618
|
+
const target = context?.thisValue;
|
|
14619
|
+
const [source, mapper, receiver] = args;
|
|
14620
|
+
if (!isSandboxClosure(target) || target.construct === void 0)
|
|
14621
|
+
throw new TypeError("TypedArray.from requires a constructor receiver.");
|
|
14622
|
+
if (mapper !== void 0 && !isSandboxClosure(mapper))
|
|
14623
|
+
throw new TypeError("TypedArray.from mapper must be callable.");
|
|
14624
|
+
if (source === null || source === void 0)
|
|
14625
|
+
throw new TypeError("TypedArray.from requires a non-null source.");
|
|
14626
|
+
const callerContext = context;
|
|
14627
|
+
context = {
|
|
14628
|
+
...callerContext,
|
|
14629
|
+
stack: callerContext?.stack ?? [],
|
|
14630
|
+
thisValue: target,
|
|
14631
|
+
getProperty: callerContext?.getProperty ?? ((value, key) => {
|
|
14632
|
+
const descriptor = getSandboxPropertyDescriptor(value, key, budget);
|
|
14633
|
+
return descriptor === void 0 ? getSandboxDataProperty(value, key, budget) : readPropertyDescriptor(descriptor, value, context);
|
|
14634
|
+
}),
|
|
14635
|
+
invokeClosure: callerContext?.invokeClosure ?? ((callee, values2, thisValue, construct) => invokeBuiltinClosure(callee, values2, budget, callerContext, thisValue, construct))
|
|
14636
|
+
};
|
|
14637
|
+
let result;
|
|
14638
|
+
let current;
|
|
14639
|
+
let iterator;
|
|
14640
|
+
const values = [];
|
|
14641
|
+
const release = retainValues(budget, () => [target, result, current, iterator?.retainedValue, values, ...args]);
|
|
14642
|
+
const checkData = createDataCheckpoint(budget, context);
|
|
14643
|
+
const read = (key) => context?.getProperty === void 0 ? getSandboxDataProperty(source, key, budget) : context.getProperty(source, key);
|
|
14644
|
+
try {
|
|
14645
|
+
iterator = await acquireSandboxIterator(source, budget, context);
|
|
14646
|
+
let length;
|
|
14647
|
+
if (iterator !== void 0) {
|
|
14648
|
+
while (true) {
|
|
14649
|
+
budget.visitNode();
|
|
14650
|
+
const next = await iterator.next();
|
|
14651
|
+
if (typeof next !== "object" || next === null) throw new TypeError("Iterator result must be an object.");
|
|
14652
|
+
if ((await readIteratorResult(iterator, next, "done")).value) break;
|
|
14653
|
+
current = (await readIteratorResult(iterator, next, "value")).value;
|
|
14654
|
+
budget.allocateArrayLength(values.length + 1);
|
|
14655
|
+
values.push(current);
|
|
14656
|
+
checkData(values, 1 + (budget.limits.dataSize === void 0 ? 0 : measureSandboxData([current])));
|
|
14657
|
+
}
|
|
14658
|
+
length = values.length;
|
|
14659
|
+
} else {
|
|
14660
|
+
const number = await sandboxNumber(await read("length"), budget, context);
|
|
14661
|
+
length = Number.isNaN(number) || number <= 0 ? 0 : Math.min(Math.trunc(number), Number.MAX_SAFE_INTEGER);
|
|
14662
|
+
}
|
|
14663
|
+
result = await invokeBuiltinClosure(target, [length], budget, context, void 0, true);
|
|
14664
|
+
if (!isFloat32Array(result) || float32Storage(result).length < length)
|
|
14665
|
+
throw new TypeError("TypedArray.from constructor must return sufficient typed storage.");
|
|
14666
|
+
checkData(result, 0, true);
|
|
14667
|
+
for (let index = 0; index < length; index++) {
|
|
14668
|
+
budget.visitNode();
|
|
14669
|
+
current = iterator === void 0 ? await read(String(index)) : values[index];
|
|
14670
|
+
if (mapper !== void 0)
|
|
14671
|
+
current = await invokeBuiltinClosure(mapper, [current, index], budget, context, receiver);
|
|
14672
|
+
result[index] = await sandboxNumber(current, budget, context);
|
|
14673
|
+
}
|
|
14674
|
+
return result;
|
|
14675
|
+
} finally {
|
|
14676
|
+
release();
|
|
14677
|
+
}
|
|
14678
|
+
}
|
|
14679
|
+
})
|
|
14680
|
+
});
|
|
14576
14681
|
Object.defineProperty(materializeFunctionProperties(typedArray), "of", {
|
|
14577
14682
|
writable: true,
|
|
14578
14683
|
configurable: true,
|
|
@@ -41636,4 +41741,4 @@ export {
|
|
|
41636
41741
|
FileSnapshotBackend,
|
|
41637
41742
|
run
|
|
41638
41743
|
};
|
|
41639
|
-
//# sourceMappingURL=chunk-
|
|
41744
|
+
//# sourceMappingURL=chunk-GWV7ELQW.js.map
|