@poe-platform/safe-js 0.1.582 → 0.1.583
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-ONUOT3QR.js → chunk-27YAKAEE.js} +3 -3
- package/dist/safe-js/chunks/{chunk-6H4RX6ZZ.js → chunk-3YD5RZJH.js} +2 -2
- package/dist/safe-js/chunks/{chunk-FGSHNQZD.js → chunk-4WKBTY6W.js} +3 -3
- package/dist/safe-js/chunks/{chunk-GT6KJSXR.js → chunk-7IEVHJ7R.js} +4 -4
- package/dist/safe-js/chunks/{chunk-J56RIONZ.js → chunk-CGIQDK6Z.js} +2 -2
- package/dist/safe-js/chunks/{chunk-FVBRBOAB.js → chunk-FRTUNUVH.js} +2 -2
- package/dist/safe-js/chunks/{chunk-ADUXPMQM.js → chunk-HENSQ4YT.js} +2 -2
- package/dist/safe-js/chunks/{chunk-47LQJKGT.js → chunk-HUD3ISAJ.js} +45 -34
- package/dist/safe-js/chunks/chunk-HUD3ISAJ.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-GMWNREUZ.js → chunk-P3M3BXHT.js} +3 -3
- package/dist/safe-js/chunks/{chunk-WBFZHDKE.js → chunk-QNAVME3B.js} +6 -6
- package/dist/safe-js/chunks/{chunk-H4K3LRXJ.js → chunk-XM6DQK7C.js} +2 -2
- package/dist/safe-js/chunks/{chunk-2LRIFIS2.js → chunk-YUMLRCTH.js} +2 -2
- package/dist/safe-js/chunks/{chunk-BZ2HQIKQ.js → chunk-ZEN6IY6M.js} +4 -4
- package/dist/safe-js/chunks/{cli-runtime-GKFPKXDB.js → cli-runtime-R4XQ76EV.js} +13 -13
- package/dist/safe-js/chunks/{dump-QOUJIAJ6.js → dump-7N6NYNQE.js} +4 -4
- package/dist/safe-js/chunks/{fs-IAKJ3MES.js → fs-DJXSKCFB.js} +4 -4
- package/dist/safe-js/chunks/harness-I47WMMSB.js +10 -0
- package/dist/safe-js/chunks/mcp-43SITYLO.js +11 -0
- package/dist/safe-js/chunks/migration-file-TKW2VXE5.js +12 -0
- package/dist/safe-js/chunks/restore-ITFWVMAU.js +13 -0
- package/dist/safe-js/chunks/run-P3JBDBSD.js +17 -0
- package/dist/safe-js/chunks/runtime-modules-AAL3MW44.js +10 -0
- package/dist/safe-js/cli.js +2 -2
- package/dist/safe-js/core.js +7 -7
- package/dist/safe-js/index.js +13 -13
- package/dist/safe-js/parse/tokenizer.d.ts +1 -0
- package/dist/safe-js/workerd.js +43 -32
- package/dist/safe-js/workerd.js.map +2 -2
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-47LQJKGT.js.map +0 -7
- package/dist/safe-js/chunks/harness-6OV7HVLE.js +0 -10
- package/dist/safe-js/chunks/mcp-6IGCCQLK.js +0 -11
- package/dist/safe-js/chunks/migration-file-BOE3NXK3.js +0 -12
- package/dist/safe-js/chunks/restore-B6CSGGER.js +0 -13
- package/dist/safe-js/chunks/run-OGRMHDQG.js +0 -17
- package/dist/safe-js/chunks/runtime-modules-M3KCXZ62.js +0 -10
- /package/dist/safe-js/chunks/{chunk-ONUOT3QR.js.map → chunk-27YAKAEE.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-6H4RX6ZZ.js.map → chunk-3YD5RZJH.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-FGSHNQZD.js.map → chunk-4WKBTY6W.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-GT6KJSXR.js.map → chunk-7IEVHJ7R.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-J56RIONZ.js.map → chunk-CGIQDK6Z.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-FVBRBOAB.js.map → chunk-FRTUNUVH.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-ADUXPMQM.js.map → chunk-HENSQ4YT.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-GMWNREUZ.js.map → chunk-P3M3BXHT.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-WBFZHDKE.js.map → chunk-QNAVME3B.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-H4K3LRXJ.js.map → chunk-XM6DQK7C.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-2LRIFIS2.js.map → chunk-YUMLRCTH.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-BZ2HQIKQ.js.map → chunk-ZEN6IY6M.js.map} +0 -0
- /package/dist/safe-js/chunks/{cli-runtime-GKFPKXDB.js.map → cli-runtime-R4XQ76EV.js.map} +0 -0
- /package/dist/safe-js/chunks/{dump-QOUJIAJ6.js.map → dump-7N6NYNQE.js.map} +0 -0
- /package/dist/safe-js/chunks/{fs-IAKJ3MES.js.map → fs-DJXSKCFB.js.map} +0 -0
- /package/dist/safe-js/chunks/{harness-6OV7HVLE.js.map → harness-I47WMMSB.js.map} +0 -0
- /package/dist/safe-js/chunks/{mcp-6IGCCQLK.js.map → mcp-43SITYLO.js.map} +0 -0
- /package/dist/safe-js/chunks/{migration-file-BOE3NXK3.js.map → migration-file-TKW2VXE5.js.map} +0 -0
- /package/dist/safe-js/chunks/{restore-B6CSGGER.js.map → restore-ITFWVMAU.js.map} +0 -0
- /package/dist/safe-js/chunks/{run-OGRMHDQG.js.map → run-P3JBDBSD.js.map} +0 -0
- /package/dist/safe-js/chunks/{runtime-modules-M3KCXZ62.js.map → runtime-modules-AAL3MW44.js.map} +0 -0
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
declareHostOperation,
|
|
8
8
|
runResources
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-YUMLRCTH.js";
|
|
10
10
|
import {
|
|
11
11
|
hostErrorData
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-HUD3ISAJ.js";
|
|
13
13
|
|
|
14
14
|
// packages/safe-js/src/modules/mcp.ts
|
|
15
15
|
var DEFAULT_TOOL_BATCH_CONCURRENCY = 4;
|
|
@@ -402,4 +402,4 @@ function isPlainObjectRecord(value) {
|
|
|
402
402
|
export {
|
|
403
403
|
makeMcpModule
|
|
404
404
|
};
|
|
405
|
-
//# sourceMappingURL=chunk-
|
|
405
|
+
//# sourceMappingURL=chunk-27YAKAEE.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isSandboxClosure
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YUMLRCTH.js";
|
|
4
4
|
|
|
5
5
|
// packages/safe-js/src/lint/runtime-modules.ts
|
|
6
6
|
var AsyncFunction = (async () => void 0).constructor;
|
|
@@ -34,4 +34,4 @@ function isAsyncRuntimeExport(value) {
|
|
|
34
34
|
export {
|
|
35
35
|
createLintModulesFromRuntimeRegistry
|
|
36
36
|
};
|
|
37
|
-
//# sourceMappingURL=chunk-
|
|
37
|
+
//# sourceMappingURL=chunk-3YD5RZJH.js.map
|
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
HostCallJournal,
|
|
3
3
|
decodeReplayData,
|
|
4
4
|
validateSnapshotData
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-YUMLRCTH.js";
|
|
6
6
|
import {
|
|
7
7
|
CompileScope,
|
|
8
8
|
SandboxError,
|
|
9
9
|
functionSources,
|
|
10
10
|
parse,
|
|
11
11
|
parseModule
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-HUD3ISAJ.js";
|
|
13
13
|
|
|
14
14
|
// packages/safe-js/src/parse/hash.ts
|
|
15
15
|
var FNV_OFFSET_BASIS = 2166136261;
|
|
@@ -219,4 +219,4 @@ export {
|
|
|
219
219
|
validateMigrationReconciliation,
|
|
220
220
|
validateSnapshotMigration
|
|
221
221
|
};
|
|
222
|
-
//# sourceMappingURL=chunk-
|
|
222
|
+
//# sourceMappingURL=chunk-4WKBTY6W.js.map
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
validateMigrationReconciliation,
|
|
8
8
|
validateMigrationSemantics,
|
|
9
9
|
validateSnapshotMigration
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-4WKBTY6W.js";
|
|
11
11
|
import {
|
|
12
12
|
DUMP_FORMAT_VERSION,
|
|
13
13
|
EXECUTION_SEMANTICS,
|
|
@@ -17,10 +17,10 @@ import {
|
|
|
17
17
|
serializeSafeJSSnapshot,
|
|
18
18
|
validateDumpEnvelope,
|
|
19
19
|
validateSnapshotData
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-YUMLRCTH.js";
|
|
21
21
|
import {
|
|
22
22
|
parseModule
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-HUD3ISAJ.js";
|
|
24
24
|
|
|
25
25
|
// packages/safe-js/src/migration-file.ts
|
|
26
26
|
import { randomUUID } from "node:crypto";
|
|
@@ -179,4 +179,4 @@ export {
|
|
|
179
179
|
migrateSnapshot,
|
|
180
180
|
migrateSnapshotFile
|
|
181
181
|
};
|
|
182
|
-
//# sourceMappingURL=chunk-
|
|
182
|
+
//# sourceMappingURL=chunk-7IEVHJ7R.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-SJZWSPWD.js";
|
|
7
7
|
import {
|
|
8
8
|
declareHostOperation
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-YUMLRCTH.js";
|
|
10
10
|
|
|
11
11
|
// packages/safe-js/src/modules/fs.ts
|
|
12
12
|
import { constants as nodeFsConstants } from "node:fs";
|
|
@@ -673,4 +673,4 @@ export {
|
|
|
673
673
|
FS_OPTION_SURFACE,
|
|
674
674
|
makeFsModule
|
|
675
675
|
};
|
|
676
|
-
//# sourceMappingURL=chunk-
|
|
676
|
+
//# sourceMappingURL=chunk-CGIQDK6Z.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
deepCopyToSandbox
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YUMLRCTH.js";
|
|
4
4
|
|
|
5
5
|
// packages/safe-js/src/modules/harness.ts
|
|
6
6
|
function makeHarnessModule(frontmatter, meta) {
|
|
@@ -52,4 +52,4 @@ ${prompt}`;
|
|
|
52
52
|
export {
|
|
53
53
|
makeHarnessModule
|
|
54
54
|
};
|
|
55
|
-
//# sourceMappingURL=chunk-
|
|
55
|
+
//# sourceMappingURL=chunk-FRTUNUVH.js.map
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
safeEndSpan,
|
|
14
14
|
safeRecordException,
|
|
15
15
|
safeStartSpan
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-HUD3ISAJ.js";
|
|
17
17
|
|
|
18
18
|
// packages/safe-js/src/error/format.ts
|
|
19
19
|
var DEFAULT_MAX_MESSAGE_LENGTH = 1e4;
|
|
@@ -2842,4 +2842,4 @@ export {
|
|
|
2842
2842
|
makeLogModule,
|
|
2843
2843
|
makeMetricModule
|
|
2844
2844
|
};
|
|
2845
|
-
//# sourceMappingURL=chunk-
|
|
2845
|
+
//# sourceMappingURL=chunk-HENSQ4YT.js.map
|
|
@@ -1149,7 +1149,7 @@ var KEYWORDS = /* @__PURE__ */ new Set([
|
|
|
1149
1149
|
]);
|
|
1150
1150
|
var EXPRESSION_ENDING_KEYWORDS = /* @__PURE__ */ new Set(["true", "false", "null"]);
|
|
1151
1151
|
var RESERVED_IDENTIFIER_SPELLINGS = /* @__PURE__ */ new Set(["case", "default", "debugger", "enum", "export", "new", "switch", "var"]);
|
|
1152
|
-
var CONTROL_FLOW_PAREN_KEYWORDS = /* @__PURE__ */ new Set(["if", "while", "with", "for", "catch"]);
|
|
1152
|
+
var CONTROL_FLOW_PAREN_KEYWORDS = /* @__PURE__ */ new Set(["if", "while", "with", "for", "catch", "switch"]);
|
|
1153
1153
|
var MAX_UNICODE_CODE_POINT = 1114111;
|
|
1154
1154
|
var IDENTIFIER_START_PATTERN = new RegExp("^\\p{ID_Start}$", "u");
|
|
1155
1155
|
var IDENTIFIER_PART_PATTERN = new RegExp("^\\p{ID_Continue}$", "u");
|
|
@@ -1220,7 +1220,7 @@ function tokenize(source, options = {}) {
|
|
|
1220
1220
|
}
|
|
1221
1221
|
function collectComments(source) {
|
|
1222
1222
|
const comments = [];
|
|
1223
|
-
tokenize(source, { allowRegexLiterals: true, comments });
|
|
1223
|
+
tokenize(source, { allowRegexLiterals: true, statementList: true, comments });
|
|
1224
1224
|
return comments;
|
|
1225
1225
|
}
|
|
1226
1226
|
var Lexer = class {
|
|
@@ -1235,7 +1235,7 @@ var Lexer = class {
|
|
|
1235
1235
|
column = 1;
|
|
1236
1236
|
tokens = [];
|
|
1237
1237
|
groupingStack = [];
|
|
1238
|
-
|
|
1238
|
+
lastClosedStatementBoundary = false;
|
|
1239
1239
|
legacyStringEscape = false;
|
|
1240
1240
|
lineHasToken = false;
|
|
1241
1241
|
tokenize() {
|
|
@@ -1408,7 +1408,7 @@ var Lexer = class {
|
|
|
1408
1408
|
let depth = 1;
|
|
1409
1409
|
const tokens = [];
|
|
1410
1410
|
const groupingStack = [];
|
|
1411
|
-
let
|
|
1411
|
+
let lastClosedStatementBoundary = false;
|
|
1412
1412
|
while (!this.isAtEnd() && depth > 0) {
|
|
1413
1413
|
this.skipTrivia();
|
|
1414
1414
|
if (this.isAtEnd()) break;
|
|
@@ -1419,13 +1419,13 @@ var Lexer = class {
|
|
|
1419
1419
|
if (char === "'" || char === '"') {
|
|
1420
1420
|
this.skipQuotedString(char);
|
|
1421
1421
|
tokens.push({ type: "string", value: char });
|
|
1422
|
-
|
|
1422
|
+
lastClosedStatementBoundary = false;
|
|
1423
1423
|
continue;
|
|
1424
1424
|
}
|
|
1425
1425
|
if (char === "`") {
|
|
1426
1426
|
this.skipNestedTemplate();
|
|
1427
1427
|
tokens.push({ type: "template", value: "`" });
|
|
1428
|
-
|
|
1428
|
+
lastClosedStatementBoundary = false;
|
|
1429
1429
|
continue;
|
|
1430
1430
|
}
|
|
1431
1431
|
if (char === "/" && this.peekChar(1) === "/") {
|
|
@@ -1464,22 +1464,22 @@ var Lexer = class {
|
|
|
1464
1464
|
isStart = false;
|
|
1465
1465
|
}
|
|
1466
1466
|
tokens.push({ type: KEYWORDS.has(value) ? "keyword" : "identifier", value });
|
|
1467
|
-
|
|
1467
|
+
lastClosedStatementBoundary = false;
|
|
1468
1468
|
continue;
|
|
1469
1469
|
}
|
|
1470
1470
|
if (isDecimalDigit(char) || char === "." && isDecimalDigit(this.peekChar(1))) {
|
|
1471
1471
|
const start2 = this.position();
|
|
1472
1472
|
const value = this.scanNumber(start2);
|
|
1473
1473
|
tokens.push({ type: "numeric", value });
|
|
1474
|
-
|
|
1474
|
+
lastClosedStatementBoundary = false;
|
|
1475
1475
|
continue;
|
|
1476
1476
|
}
|
|
1477
1477
|
if (char === "{") {
|
|
1478
1478
|
depth += 1;
|
|
1479
1479
|
this.advance();
|
|
1480
|
-
groupingStack.
|
|
1480
|
+
updateGroupingState(groupingStack, tokens[tokens.length - 1], "{", lastClosedStatementBoundary);
|
|
1481
1481
|
tokens.push({ type: "punctuator", value: "{" });
|
|
1482
|
-
|
|
1482
|
+
lastClosedStatementBoundary = false;
|
|
1483
1483
|
continue;
|
|
1484
1484
|
}
|
|
1485
1485
|
if (char === "}") {
|
|
@@ -1488,19 +1488,18 @@ var Lexer = class {
|
|
|
1488
1488
|
if (depth === 0) {
|
|
1489
1489
|
return;
|
|
1490
1490
|
}
|
|
1491
|
-
|
|
1491
|
+
lastClosedStatementBoundary = updateGroupingState(groupingStack, tokens[tokens.length - 1], "}", lastClosedStatementBoundary);
|
|
1492
1492
|
tokens.push({ type: "punctuator", value: "}" });
|
|
1493
|
-
lastClosedControlParenthesis = false;
|
|
1494
1493
|
continue;
|
|
1495
1494
|
}
|
|
1496
|
-
if (char === "/" && shouldRejectRegexLiteral(tokens[tokens.length - 1],
|
|
1495
|
+
if (char === "/" && shouldRejectRegexLiteral(tokens[tokens.length - 1], lastClosedStatementBoundary, tokens)) {
|
|
1497
1496
|
if (!this.options.allowRegexLiterals) {
|
|
1498
1497
|
this.syntaxError("Regular expression literals are not supported", this.position());
|
|
1499
1498
|
}
|
|
1500
1499
|
const start2 = this.position();
|
|
1501
1500
|
const value = this.scanRegexLiteral(start2);
|
|
1502
1501
|
tokens.push({ type: "regex", value });
|
|
1503
|
-
|
|
1502
|
+
lastClosedStatementBoundary = false;
|
|
1504
1503
|
continue;
|
|
1505
1504
|
}
|
|
1506
1505
|
const punctuator = matchPunctuator(this.source, this.index);
|
|
@@ -1508,10 +1507,13 @@ var Lexer = class {
|
|
|
1508
1507
|
const previousToken = tokens[tokens.length - 1];
|
|
1509
1508
|
this.advanceBy(punctuator.length);
|
|
1510
1509
|
tokens.push({ type: "punctuator", value: punctuator });
|
|
1511
|
-
|
|
1510
|
+
lastClosedStatementBoundary = updateGroupingState(
|
|
1512
1511
|
groupingStack,
|
|
1513
1512
|
previousToken,
|
|
1514
|
-
punctuator
|
|
1513
|
+
punctuator,
|
|
1514
|
+
lastClosedStatementBoundary,
|
|
1515
|
+
false,
|
|
1516
|
+
tokens[tokens.length - 3]
|
|
1515
1517
|
);
|
|
1516
1518
|
continue;
|
|
1517
1519
|
}
|
|
@@ -1782,7 +1784,7 @@ var Lexer = class {
|
|
|
1782
1784
|
}
|
|
1783
1785
|
}
|
|
1784
1786
|
readSlashOrPunctuator(start) {
|
|
1785
|
-
if (this.currentChar() === "/" && shouldRejectRegexLiteral(this.lastSignificantToken(), this.
|
|
1787
|
+
if (this.currentChar() === "/" && shouldRejectRegexLiteral(this.lastSignificantToken(), this.lastClosedStatementBoundary, this.tokens)) {
|
|
1786
1788
|
if (!this.options.allowRegexLiterals) {
|
|
1787
1789
|
this.syntaxError("Regular expression literals are not supported", start);
|
|
1788
1790
|
}
|
|
@@ -1869,14 +1871,17 @@ var Lexer = class {
|
|
|
1869
1871
|
};
|
|
1870
1872
|
this.tokens.push(token);
|
|
1871
1873
|
if (type === "punctuator") {
|
|
1872
|
-
this.
|
|
1874
|
+
this.lastClosedStatementBoundary = updateGroupingState(
|
|
1873
1875
|
this.groupingStack,
|
|
1874
1876
|
previousToken,
|
|
1875
|
-
value
|
|
1877
|
+
value,
|
|
1878
|
+
this.lastClosedStatementBoundary,
|
|
1879
|
+
this.options.statementList === true,
|
|
1880
|
+
this.tokens[this.tokens.length - 3]
|
|
1876
1881
|
);
|
|
1877
1882
|
return;
|
|
1878
1883
|
}
|
|
1879
|
-
this.
|
|
1884
|
+
this.lastClosedStatementBoundary = false;
|
|
1880
1885
|
}
|
|
1881
1886
|
currentChar() {
|
|
1882
1887
|
return this.source[this.index] ?? "";
|
|
@@ -2078,7 +2083,7 @@ function matchPunctuator(source, index) {
|
|
|
2078
2083
|
(punctuator) => source.startsWith(punctuator, index) && (punctuator !== "?." || !isDecimalDigit(source[index + 2] ?? ""))
|
|
2079
2084
|
);
|
|
2080
2085
|
}
|
|
2081
|
-
function shouldRejectRegexLiteral(previousToken,
|
|
2086
|
+
function shouldRejectRegexLiteral(previousToken, lastClosedStatementBoundary, tokens) {
|
|
2082
2087
|
if (previousToken === void 0) {
|
|
2083
2088
|
return true;
|
|
2084
2089
|
}
|
|
@@ -2089,8 +2094,8 @@ function shouldRejectRegexLiteral(previousToken, lastClosedControlParenthesis, t
|
|
|
2089
2094
|
if (previousToken.value === "of") return endsWithForOfSeparator(tokens);
|
|
2090
2095
|
return !EXPRESSION_ENDING_KEYWORDS.has(previousToken.value);
|
|
2091
2096
|
}
|
|
2092
|
-
if (previousToken.value === ")") {
|
|
2093
|
-
return
|
|
2097
|
+
if (previousToken.value === ")" || previousToken.value === "}") {
|
|
2098
|
+
return lastClosedStatementBoundary;
|
|
2094
2099
|
}
|
|
2095
2100
|
return !isExpressionEndingPunctuator(previousToken.value);
|
|
2096
2101
|
}
|
|
@@ -2123,11 +2128,11 @@ function endsWithForOfSeparator(tokens) {
|
|
|
2123
2128
|
}
|
|
2124
2129
|
return false;
|
|
2125
2130
|
}
|
|
2126
|
-
function updateGroupingState(groupingStack, previousToken, punctuator) {
|
|
2131
|
+
function updateGroupingState(groupingStack, previousToken, punctuator, previousStatementBoundary, initialStatementList = false, beforePreviousToken) {
|
|
2127
2132
|
if (punctuator === "(") {
|
|
2128
2133
|
groupingStack.push({
|
|
2129
2134
|
value: "(",
|
|
2130
|
-
isControlCondition: previousToken?.type === "keyword" && CONTROL_FLOW_PAREN_KEYWORDS.has(previousToken.value)
|
|
2135
|
+
isControlCondition: (previousToken?.type === "keyword" || previousToken?.type === "identifier") && (CONTROL_FLOW_PAREN_KEYWORDS.has(previousToken.value) || previousToken.value === "await" && beforePreviousToken?.type === "keyword" && beforePreviousToken.value === "for") && beforePreviousToken?.value !== "." && beforePreviousToken?.value !== "?."
|
|
2131
2136
|
});
|
|
2132
2137
|
return false;
|
|
2133
2138
|
}
|
|
@@ -2136,7 +2141,13 @@ function updateGroupingState(groupingStack, previousToken, punctuator) {
|
|
|
2136
2141
|
return false;
|
|
2137
2142
|
}
|
|
2138
2143
|
if (punctuator === "{") {
|
|
2139
|
-
groupingStack.
|
|
2144
|
+
const parent = groupingStack[groupingStack.length - 1];
|
|
2145
|
+
const closesStatement = previousToken === void 0 ? initialStatementList : previousStatementBoundary || ["{", ";"].includes(previousToken.value) && (parent === void 0 || parent.statementList === true) || previousToken.type === "keyword" && ["else", "do", "try", "finally"].includes(previousToken.value);
|
|
2146
|
+
groupingStack.push({
|
|
2147
|
+
value: "{",
|
|
2148
|
+
closesStatement,
|
|
2149
|
+
statementList: closesStatement || previousToken?.value === ")" || previousToken?.value === "=>" || previousToken?.value === "static"
|
|
2150
|
+
});
|
|
2140
2151
|
return false;
|
|
2141
2152
|
}
|
|
2142
2153
|
if (punctuator === ")") {
|
|
@@ -2147,8 +2158,7 @@ function updateGroupingState(groupingStack, previousToken, punctuator) {
|
|
|
2147
2158
|
return false;
|
|
2148
2159
|
}
|
|
2149
2160
|
if (punctuator === "}") {
|
|
2150
|
-
popGroupingContext(groupingStack, "{");
|
|
2151
|
-
return false;
|
|
2161
|
+
return popGroupingContext(groupingStack, "{")?.closesStatement === true;
|
|
2152
2162
|
}
|
|
2153
2163
|
return false;
|
|
2154
2164
|
}
|
|
@@ -3136,7 +3146,7 @@ function parseModule(source, filename = "<input>", owner) {
|
|
|
3136
3146
|
try {
|
|
3137
3147
|
const result = assignIds(
|
|
3138
3148
|
new Parser(
|
|
3139
|
-
tokenize(source, { allowRegexLiterals: true, compilation }),
|
|
3149
|
+
tokenize(source, { allowRegexLiterals: true, statementList: true, compilation }),
|
|
3140
3150
|
source,
|
|
3141
3151
|
compilation
|
|
3142
3152
|
).parseModule()
|
|
@@ -3160,7 +3170,7 @@ function parseExecutableModule(source, filename = "<input>", owner) {
|
|
|
3160
3170
|
try {
|
|
3161
3171
|
const result = assignIds(
|
|
3162
3172
|
new Parser(
|
|
3163
|
-
tokenize(source, { allowRegexLiterals: true, compilation }),
|
|
3173
|
+
tokenize(source, { allowRegexLiterals: true, statementList: true, compilation }),
|
|
3164
3174
|
source,
|
|
3165
3175
|
compilation,
|
|
3166
3176
|
"top-level",
|
|
@@ -3192,6 +3202,7 @@ function parseEvalScript(source, context = {}, owner) {
|
|
|
3192
3202
|
const grammar = { await: false, yield: false, strict: context.strict === true };
|
|
3193
3203
|
const parser = new Parser(tokenize(source, {
|
|
3194
3204
|
allowRegexLiterals: true,
|
|
3205
|
+
statementList: true,
|
|
3195
3206
|
allowLegacyNumbers: true,
|
|
3196
3207
|
allowLegacyEscapes: true,
|
|
3197
3208
|
allowHtmlComments: true,
|
|
@@ -3235,8 +3246,8 @@ ${body}
|
|
|
3235
3246
|
}`;
|
|
3236
3247
|
const source = `${prefix} anonymous(${parameters}
|
|
3237
3248
|
) ${bodySource}`;
|
|
3238
|
-
const createParser = (text) => new Parser(
|
|
3239
|
-
tokenize(text, { allowRegexLiterals: true, allowLegacyNumbers: true, allowLegacyEscapes: true, allowHtmlComments: true, compilation }),
|
|
3249
|
+
const createParser = (text, statementList = false) => new Parser(
|
|
3250
|
+
tokenize(text, { allowRegexLiterals: true, statementList, allowLegacyNumbers: true, allowLegacyEscapes: true, allowHtmlComments: true, compilation }),
|
|
3240
3251
|
text,
|
|
3241
3252
|
compilation,
|
|
3242
3253
|
kind,
|
|
@@ -3248,7 +3259,7 @@ ${body}
|
|
|
3248
3259
|
false
|
|
3249
3260
|
);
|
|
3250
3261
|
createParser(parameterSource).parseDynamicParameters();
|
|
3251
|
-
createParser(bodySource).parseDynamicBody();
|
|
3262
|
+
createParser(bodySource, true).parseDynamicBody();
|
|
3252
3263
|
const node = assignIds(createParser(source).parseDynamicExpression());
|
|
3253
3264
|
if (source.includes("#")) validatePrivateNames(node);
|
|
3254
3265
|
return node;
|
|
@@ -7310,4 +7321,4 @@ export {
|
|
|
7310
7321
|
Float16Array2 as Float16Array,
|
|
7311
7322
|
numericTypedArrayConstructors
|
|
7312
7323
|
};
|
|
7313
|
-
//# sourceMappingURL=chunk-
|
|
7324
|
+
//# sourceMappingURL=chunk-HUD3ISAJ.js.map
|