@poe-platform/safe-js 0.1.490 → 0.1.491
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-MLSCJH5R.js → chunk-CJDD5FTA.js} +2 -2
- package/dist/safe-js/chunks/{chunk-TEVQUSEL.js → chunk-NQKOR5UJ.js} +33 -6
- package/dist/safe-js/chunks/{chunk-TEVQUSEL.js.map → chunk-NQKOR5UJ.js.map} +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/parse/tokenizer.d.ts +2 -0
- package/package.json +2 -2
- /package/dist/safe-js/chunks/{chunk-MLSCJH5R.js.map → chunk-CJDD5FTA.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-NQKOR5UJ.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-CJDD5FTA.js.map
|
|
@@ -1009,6 +1009,7 @@ var Lexer = class {
|
|
|
1009
1009
|
tokens = [];
|
|
1010
1010
|
groupingStack = [];
|
|
1011
1011
|
lastClosedControlParenthesis = false;
|
|
1012
|
+
legacyStringEscape = false;
|
|
1012
1013
|
tokenize() {
|
|
1013
1014
|
while (!this.isAtEnd()) {
|
|
1014
1015
|
this.skipTrivia();
|
|
@@ -1113,12 +1114,14 @@ var Lexer = class {
|
|
|
1113
1114
|
this.pushToken(privateName ? "private-identifier" : KEYWORDS.has(value) ? "keyword" : "identifier", start, value);
|
|
1114
1115
|
}
|
|
1115
1116
|
readString(start, quote) {
|
|
1117
|
+
this.legacyStringEscape = false;
|
|
1116
1118
|
this.advance();
|
|
1117
1119
|
while (!this.isAtEnd()) {
|
|
1118
1120
|
const char = this.currentChar();
|
|
1119
1121
|
if (char === quote) {
|
|
1120
1122
|
this.advance();
|
|
1121
1123
|
this.pushToken("string", start, this.source.slice(start.offset, this.index));
|
|
1124
|
+
if (this.legacyStringEscape) this.tokens[this.tokens.length - 1].legacyEscape = true;
|
|
1122
1125
|
return;
|
|
1123
1126
|
}
|
|
1124
1127
|
if (char === "\\") {
|
|
@@ -1688,12 +1691,21 @@ var Lexer = class {
|
|
|
1688
1691
|
if (escaped === "0") {
|
|
1689
1692
|
this.advance();
|
|
1690
1693
|
if (isDecimalDigit(this.currentChar())) {
|
|
1691
|
-
this.
|
|
1694
|
+
if (!this.options.allowLegacyEscapes)
|
|
1695
|
+
this.syntaxError("Legacy octal escape sequences are not supported", escapeStart);
|
|
1696
|
+
this.legacyStringEscape = true;
|
|
1692
1697
|
}
|
|
1693
1698
|
return;
|
|
1694
1699
|
}
|
|
1695
1700
|
if (isOctalDigit(escaped)) {
|
|
1696
|
-
this.
|
|
1701
|
+
if (!this.options.allowLegacyEscapes)
|
|
1702
|
+
this.syntaxError("Legacy octal escape sequences are not supported", escapeStart);
|
|
1703
|
+
this.legacyStringEscape = true;
|
|
1704
|
+
}
|
|
1705
|
+
if (escaped === "8" || escaped === "9") {
|
|
1706
|
+
if (!this.options.allowLegacyEscapes)
|
|
1707
|
+
this.syntaxError("Legacy decimal escape sequences are not supported", escapeStart);
|
|
1708
|
+
this.legacyStringEscape = true;
|
|
1697
1709
|
}
|
|
1698
1710
|
this.advance();
|
|
1699
1711
|
}
|
|
@@ -3356,6 +3368,7 @@ var Parser = class {
|
|
|
3356
3368
|
parseBlockStatementBody(start, functionBody = false) {
|
|
3357
3369
|
const body = [];
|
|
3358
3370
|
let directivePrologue = functionBody;
|
|
3371
|
+
let legacyDirective = false;
|
|
3359
3372
|
while (this.consumePunctuator("}") === void 0) {
|
|
3360
3373
|
if (this.currentToken().type === "eof") {
|
|
3361
3374
|
throw new Error(
|
|
@@ -3367,8 +3380,11 @@ var Parser = class {
|
|
|
3367
3380
|
body.push(statement);
|
|
3368
3381
|
if (directivePrologue && this.lexicalContext.grammar !== void 0) {
|
|
3369
3382
|
directivePrologue = statement.type === "ExpressionStatement" && statement.expression.type === "StringLiteral" && firstToken.type === "string" && statement.span.start.offset === firstToken.start.offset && statement.span.end.offset === firstToken.end.offset;
|
|
3370
|
-
if (directivePrologue && statement.type === "ExpressionStatement" && statement.expression.type === "StringLiteral" && (statement.expression.raw === '"use strict"' || statement.expression.raw === "'use strict'"))
|
|
3383
|
+
if (directivePrologue && statement.type === "ExpressionStatement" && statement.expression.type === "StringLiteral" && (statement.expression.raw === '"use strict"' || statement.expression.raw === "'use strict'")) {
|
|
3384
|
+
if (legacyDirective) throw new Error("Legacy escape sequences are not supported in strict directives.");
|
|
3371
3385
|
this.lexicalContext.grammar.strict = true;
|
|
3386
|
+
}
|
|
3387
|
+
if (directivePrologue && firstToken.legacyEscape) legacyDirective = true;
|
|
3372
3388
|
}
|
|
3373
3389
|
let semicolons = 0;
|
|
3374
3390
|
while (statement.type !== "EmptyStatement" && this.consumePunctuator(";") !== void 0) {
|
|
@@ -6005,6 +6021,8 @@ var Parser = class {
|
|
|
6005
6021
|
}
|
|
6006
6022
|
currentToken() {
|
|
6007
6023
|
const token = this.tokens[this.index] ?? this.tokens[this.tokens.length - 1];
|
|
6024
|
+
if (this.lexicalContext.grammar?.strict !== false && token.legacyEscape)
|
|
6025
|
+
throw new Error("Legacy escape sequences are not supported in strict mode.");
|
|
6008
6026
|
if (this.lexicalContext.grammar?.strict !== false && token.type === "numeric" && token.value[0] === "0" && isDecimalDigit3(token.value[1] ?? ""))
|
|
6009
6027
|
throw new Error("Legacy numeric literals are not supported in strict mode.");
|
|
6010
6028
|
return token;
|
|
@@ -6255,7 +6273,7 @@ function createStringLiteral(token) {
|
|
|
6255
6273
|
return {
|
|
6256
6274
|
type: "StringLiteral",
|
|
6257
6275
|
raw: token.value,
|
|
6258
|
-
value: decodeEscapedText(token.value.slice(1, -1)),
|
|
6276
|
+
value: decodeEscapedText(token.value.slice(1, -1), token.legacyEscape),
|
|
6259
6277
|
span: createTokenSpan(token)
|
|
6260
6278
|
};
|
|
6261
6279
|
}
|
|
@@ -6619,7 +6637,7 @@ function skipEscapedCharacter(raw, start) {
|
|
|
6619
6637
|
}
|
|
6620
6638
|
return Math.min(start + 2, raw.length);
|
|
6621
6639
|
}
|
|
6622
|
-
function decodeEscapedText(value) {
|
|
6640
|
+
function decodeEscapedText(value, allowLegacy = false) {
|
|
6623
6641
|
let decoded = "";
|
|
6624
6642
|
let index = 0;
|
|
6625
6643
|
while (index < value.length) {
|
|
@@ -6662,6 +6680,14 @@ function decodeEscapedText(value) {
|
|
|
6662
6680
|
continue;
|
|
6663
6681
|
}
|
|
6664
6682
|
}
|
|
6683
|
+
if (allowLegacy && isOctalDigit2(next)) {
|
|
6684
|
+
const start = index + 1;
|
|
6685
|
+
const limit = next <= "3" ? 3 : 2;
|
|
6686
|
+
index = start + 1;
|
|
6687
|
+
while (index < start + limit && isOctalDigit2(value[index] ?? "")) index++;
|
|
6688
|
+
decoded += String.fromCharCode(Number.parseInt(value.slice(start, index), 8));
|
|
6689
|
+
continue;
|
|
6690
|
+
}
|
|
6665
6691
|
decoded += decodeEscapeCharacter(next);
|
|
6666
6692
|
index += 2;
|
|
6667
6693
|
}
|
|
@@ -6725,6 +6751,7 @@ function parseEmbeddedExpression(source, base, functionContext, lexicalContext,
|
|
|
6725
6751
|
const tokens = tokenize(source, {
|
|
6726
6752
|
allowRegexLiterals: true,
|
|
6727
6753
|
allowLegacyNumbers: lexicalContext.grammar?.strict === false,
|
|
6754
|
+
allowLegacyEscapes: lexicalContext.grammar?.strict === false,
|
|
6728
6755
|
compilation
|
|
6729
6756
|
}).map((token) => ({
|
|
6730
6757
|
...token,
|
|
@@ -57302,4 +57329,4 @@ authorization of the copyright holder.
|
|
|
57302
57329
|
SPDX-License-Identifier: Unicode-3.0
|
|
57303
57330
|
|
|
57304
57331
|
*/
|
|
57305
|
-
//# sourceMappingURL=chunk-
|
|
57332
|
+
//# sourceMappingURL=chunk-NQKOR5UJ.js.map
|