@poe-platform/safe-js 0.1.309 → 0.1.310
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-A5S5VD23.js → chunk-K33MF7AA.js} +39 -8
- package/dist/safe-js/chunks/chunk-K33MF7AA.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-KZ2S6QYZ.js → chunk-S2EJB3SL.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/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-S2EJB3SL.js.map} +0 -0
|
@@ -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";
|
|
@@ -41636,4 +41667,4 @@ export {
|
|
|
41636
41667
|
FileSnapshotBackend,
|
|
41637
41668
|
run
|
|
41638
41669
|
};
|
|
41639
|
-
//# sourceMappingURL=chunk-
|
|
41670
|
+
//# sourceMappingURL=chunk-K33MF7AA.js.map
|