@poe-platform/safe-js 0.1.211 → 0.1.213
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-BGKGK6BB.js → chunk-LQN7F4MV.js} +2 -2
- package/dist/safe-js/chunks/{chunk-EIW7KQCL.js → chunk-X6T66CDS.js} +50 -19
- package/dist/safe-js/chunks/chunk-X6T66CDS.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/dist/safe-js/parse/parser.d.ts +1 -0
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-EIW7KQCL.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-BGKGK6BB.js.map → chunk-LQN7F4MV.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-X6T66CDS.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-LQN7F4MV.js.map
|
|
@@ -2927,6 +2927,7 @@ var Parser = class {
|
|
|
2927
2927
|
conditionalExpressionDepth = 0;
|
|
2928
2928
|
ifStatementDepth = 0;
|
|
2929
2929
|
loopDepth = 0;
|
|
2930
|
+
activeLabels = /* @__PURE__ */ new Map();
|
|
2930
2931
|
scopes = [/* @__PURE__ */ new Map()];
|
|
2931
2932
|
functionScopes = /* @__PURE__ */ new WeakSet();
|
|
2932
2933
|
parenthesizedNodes = /* @__PURE__ */ new WeakSet();
|
|
@@ -3241,13 +3242,14 @@ var Parser = class {
|
|
|
3241
3242
|
return this.parseVariableDeclaration();
|
|
3242
3243
|
}
|
|
3243
3244
|
if (token.type === "keyword" && token.value === "break") {
|
|
3244
|
-
|
|
3245
|
+
this.index += 1;
|
|
3246
|
+
const label = this.consumeControlLabel(token);
|
|
3247
|
+
if (label !== void 0 && !this.activeLabels.has(label.value)) throw new Error(`Unknown break label '${label.value}'.`);
|
|
3248
|
+
if (label === void 0 && this.breakableDepth === 0) {
|
|
3245
3249
|
throw new Error(
|
|
3246
3250
|
`Illegal break statement outside a loop or switch at line ${token.start.line}, column ${token.start.column}.`
|
|
3247
3251
|
);
|
|
3248
3252
|
}
|
|
3249
|
-
this.index += 1;
|
|
3250
|
-
const label = this.consumeControlLabel(token);
|
|
3251
3253
|
return {
|
|
3252
3254
|
type: "BreakStatement",
|
|
3253
3255
|
...label === void 0 ? {} : { label: label.value },
|
|
@@ -3262,6 +3264,7 @@ var Parser = class {
|
|
|
3262
3264
|
}
|
|
3263
3265
|
this.index += 1;
|
|
3264
3266
|
const label = this.consumeControlLabel(token);
|
|
3267
|
+
if (label !== void 0 && this.activeLabels.get(label.value) !== true) throw new Error(`Invalid continue label '${label.value}'.`);
|
|
3265
3268
|
return {
|
|
3266
3269
|
type: "ContinueStatement",
|
|
3267
3270
|
...label === void 0 ? {} : { label: label.value },
|
|
@@ -3291,16 +3294,22 @@ var Parser = class {
|
|
|
3291
3294
|
this.index += 2;
|
|
3292
3295
|
return this.parseLabeledStatement([...labels, token.value], firstLabelToken);
|
|
3293
3296
|
}
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3297
|
+
const iteration = token.type === "keyword" && ["for", "while", "do"].includes(token.value);
|
|
3298
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3299
|
+
for (const label of labels) {
|
|
3300
|
+
if (seen.has(label) || this.activeLabels.has(label)) throw new Error(`Duplicate label '${label}'.`);
|
|
3301
|
+
seen.add(label);
|
|
3299
3302
|
}
|
|
3300
|
-
|
|
3301
|
-
|
|
3303
|
+
for (const label of labels) this.activeLabels.set(label, iteration);
|
|
3304
|
+
try {
|
|
3305
|
+
if (token.type === "keyword" && token.value === "for") return this.parseForStatement(labels);
|
|
3306
|
+
if (token.type === "keyword" && token.value === "while") return this.parseWhileStatement(labels);
|
|
3307
|
+
if (token.type === "keyword" && token.value === "do") return this.parseDoWhileStatement(labels);
|
|
3308
|
+
if (token.type === "punctuator" && token.value === "{") return { ...this.parseBlockStatement(), labels };
|
|
3309
|
+
throw new DisallowedSyntaxError("label", firstLabelToken.start);
|
|
3310
|
+
} finally {
|
|
3311
|
+
for (const label of labels) this.activeLabels.delete(label);
|
|
3302
3312
|
}
|
|
3303
|
-
throw new DisallowedSyntaxError("label", firstLabelToken.start);
|
|
3304
3313
|
}
|
|
3305
3314
|
parseIfStatement() {
|
|
3306
3315
|
if (this.ifStatementDepth >= MAX_IF_STATEMENT_DEPTH) {
|
|
@@ -5543,15 +5552,18 @@ var Parser = class {
|
|
|
5543
5552
|
withFunctionContext(functionContext, callback) {
|
|
5544
5553
|
const previousBreakableDepth = this.breakableDepth;
|
|
5545
5554
|
const previousLoopDepth = this.loopDepth;
|
|
5555
|
+
const previousLabels = this.activeLabels;
|
|
5546
5556
|
const previousFunctionContext = this.functionContext;
|
|
5547
5557
|
this.breakableDepth = 0;
|
|
5548
5558
|
this.loopDepth = 0;
|
|
5559
|
+
this.activeLabels = /* @__PURE__ */ new Map();
|
|
5549
5560
|
this.functionContext = functionContext;
|
|
5550
5561
|
try {
|
|
5551
5562
|
return callback();
|
|
5552
5563
|
} finally {
|
|
5553
5564
|
this.breakableDepth = previousBreakableDepth;
|
|
5554
5565
|
this.loopDepth = previousLoopDepth;
|
|
5566
|
+
this.activeLabels = previousLabels;
|
|
5555
5567
|
this.functionContext = previousFunctionContext;
|
|
5556
5568
|
}
|
|
5557
5569
|
}
|
|
@@ -15140,6 +15152,8 @@ async function evaluateBlockStatement(node, context) {
|
|
|
15140
15152
|
continue;
|
|
15141
15153
|
}
|
|
15142
15154
|
const result = await evaluateNode(statement, blockContext);
|
|
15155
|
+
if (result.kind === "break" && result.label !== void 0 && node.labels?.includes(result.label))
|
|
15156
|
+
return { kind: "normal", hasValue: false, value: void 0 };
|
|
15143
15157
|
if (result.kind !== "normal") {
|
|
15144
15158
|
return result;
|
|
15145
15159
|
}
|
|
@@ -23841,7 +23855,7 @@ var AS001Scanner = class {
|
|
|
23841
23855
|
braceContextStack,
|
|
23842
23856
|
nextSignificantChar
|
|
23843
23857
|
);
|
|
23844
|
-
if (canStartStatement && nextSignificantChar === ":" && token.value !== "default" && !this.
|
|
23858
|
+
if (canStartStatement && nextSignificantChar === ":" && token.value !== "default" && !this.isSupportedLabelStart()) {
|
|
23845
23859
|
this.report(
|
|
23846
23860
|
"label",
|
|
23847
23861
|
token.start,
|
|
@@ -24097,13 +24111,14 @@ var AS001Scanner = class {
|
|
|
24097
24111
|
const nextIndex = this.skipTriviaFrom(this.index);
|
|
24098
24112
|
return nextIndex >= this.source.length ? void 0 : this.source[nextIndex];
|
|
24099
24113
|
}
|
|
24100
|
-
|
|
24114
|
+
isSupportedLabelStart() {
|
|
24101
24115
|
let index = this.skipTriviaFrom(this.index);
|
|
24102
24116
|
if (this.source[index] !== ":") {
|
|
24103
24117
|
return false;
|
|
24104
24118
|
}
|
|
24105
24119
|
index = this.skipTriviaFrom(index + 1);
|
|
24106
24120
|
while (index < this.source.length) {
|
|
24121
|
+
if (this.source[index] === "{") return true;
|
|
24107
24122
|
const identifier = readIdentifierAt(this.source, index);
|
|
24108
24123
|
if (identifier === void 0) {
|
|
24109
24124
|
return false;
|
|
@@ -33406,6 +33421,7 @@ var ASUnreachableScanner = class {
|
|
|
33406
33421
|
}
|
|
33407
33422
|
filename;
|
|
33408
33423
|
diagnostics = [];
|
|
33424
|
+
breakTargets = /* @__PURE__ */ new Map();
|
|
33409
33425
|
scan(source) {
|
|
33410
33426
|
this.visitModule(parseModule(source, this.filename));
|
|
33411
33427
|
return this.diagnostics;
|
|
@@ -33471,6 +33487,11 @@ var ASUnreachableScanner = class {
|
|
|
33471
33487
|
this.visitThrowStatement(node);
|
|
33472
33488
|
return true;
|
|
33473
33489
|
case "BreakStatement":
|
|
33490
|
+
if (node.label !== void 0) {
|
|
33491
|
+
const target = this.breakTargets.get(node.label);
|
|
33492
|
+
if (target !== void 0) target.reached = true;
|
|
33493
|
+
}
|
|
33494
|
+
return true;
|
|
33474
33495
|
case "ContinueStatement":
|
|
33475
33496
|
return true;
|
|
33476
33497
|
case "ExportNamedDeclaration":
|
|
@@ -33486,7 +33507,11 @@ var ASUnreachableScanner = class {
|
|
|
33486
33507
|
}
|
|
33487
33508
|
}
|
|
33488
33509
|
visitBlock(node) {
|
|
33489
|
-
|
|
33510
|
+
const target = { reached: false };
|
|
33511
|
+
for (const label of node.labels ?? []) this.breakTargets.set(label, target);
|
|
33512
|
+
const terminated = this.visitStatements(node.body);
|
|
33513
|
+
for (const label of node.labels ?? []) this.breakTargets.delete(label);
|
|
33514
|
+
return terminated && !target.reached;
|
|
33490
33515
|
}
|
|
33491
33516
|
visitIfStatement(node) {
|
|
33492
33517
|
this.visitExpression(node.test);
|
|
@@ -33619,11 +33644,17 @@ var ASUnreachableScanner = class {
|
|
|
33619
33644
|
}
|
|
33620
33645
|
}
|
|
33621
33646
|
visitArrowFunction(node) {
|
|
33622
|
-
|
|
33623
|
-
|
|
33624
|
-
|
|
33647
|
+
const outerTargets = this.breakTargets;
|
|
33648
|
+
this.breakTargets = /* @__PURE__ */ new Map();
|
|
33649
|
+
try {
|
|
33650
|
+
if (node.body.type === "BlockStatement") {
|
|
33651
|
+
this.visitBlock(node.body);
|
|
33652
|
+
return;
|
|
33653
|
+
}
|
|
33654
|
+
this.visitExpression(node.body);
|
|
33655
|
+
} finally {
|
|
33656
|
+
this.breakTargets = outerTargets;
|
|
33625
33657
|
}
|
|
33626
|
-
this.visitExpression(node.body);
|
|
33627
33658
|
}
|
|
33628
33659
|
visitArrayExpression(node) {
|
|
33629
33660
|
for (const element of node.elements) {
|
|
@@ -37931,4 +37962,4 @@ export {
|
|
|
37931
37962
|
FileSnapshotBackend,
|
|
37932
37963
|
run
|
|
37933
37964
|
};
|
|
37934
|
-
//# sourceMappingURL=chunk-
|
|
37965
|
+
//# sourceMappingURL=chunk-X6T66CDS.js.map
|