@poe-platform/safe-js 0.1.146 → 0.1.148
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-P6ZTK7QA.js → chunk-AJOCDNNB.js} +2 -2
- package/dist/safe-js/chunks/{chunk-OVRBSGVT.js → chunk-F6FZXBQR.js} +74 -43
- package/dist/safe-js/chunks/chunk-F6FZXBQR.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/index.js.map +2 -2
- package/dist/safe-js/interp/scope.d.ts +1 -0
- package/dist/safe-js/loader/find-exported.d.ts +2 -2
- package/dist/safe-js/parse/parse-export.d.ts +4 -4
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-OVRBSGVT.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-P6ZTK7QA.js.map → chunk-AJOCDNNB.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-F6FZXBQR.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-AJOCDNNB.js.map
|
|
@@ -3298,10 +3298,8 @@ var Parser = class {
|
|
|
3298
3298
|
parseExportDefaultDeclaration(exportToken) {
|
|
3299
3299
|
this.index += 1;
|
|
3300
3300
|
if (this.currentToken().value === "class") {
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
this.currentToken().start
|
|
3304
|
-
);
|
|
3301
|
+
const named = isIdentifierLikeToken(this.peekToken(1)) && this.peekToken(1).value !== "extends";
|
|
3302
|
+
return createExportDefaultDeclaration(exportToken, this.parseClass(named));
|
|
3305
3303
|
}
|
|
3306
3304
|
const declaration = this.parseExpression().node;
|
|
3307
3305
|
return createExportDefaultDeclaration(exportToken, declaration);
|
|
@@ -14113,7 +14111,8 @@ var AS003Scanner = class {
|
|
|
14113
14111
|
this.visitVariableDeclaration(node.declaration);
|
|
14114
14112
|
return;
|
|
14115
14113
|
case "ExportDefaultDeclaration":
|
|
14116
|
-
this.
|
|
14114
|
+
if (node.declaration.type === "ClassDeclaration") this.visitStatement(node.declaration);
|
|
14115
|
+
else this.visitExpression(node.declaration);
|
|
14117
14116
|
return;
|
|
14118
14117
|
case "ImportDeclaration":
|
|
14119
14118
|
case "BreakStatement":
|
|
@@ -14521,6 +14520,10 @@ var AS003Scanner = class {
|
|
|
14521
14520
|
bindings.push(...this.collectDeclarationBindings(declaration));
|
|
14522
14521
|
}
|
|
14523
14522
|
for (const statement of body) {
|
|
14523
|
+
if (statement.type === "ExportDefaultDeclaration" && statement.declaration.type === "ClassDeclaration") {
|
|
14524
|
+
bindings.push({ kind: "let", name: statement.declaration.id.name });
|
|
14525
|
+
continue;
|
|
14526
|
+
}
|
|
14524
14527
|
if (statement.type === "ImportDeclaration") {
|
|
14525
14528
|
bindings.push(...this.collectImportBindings(statement));
|
|
14526
14529
|
continue;
|
|
@@ -14859,7 +14862,8 @@ var AS006007Scanner = class {
|
|
|
14859
14862
|
this.visitVariableDeclaration(node.declaration);
|
|
14860
14863
|
return;
|
|
14861
14864
|
case "ExportDefaultDeclaration":
|
|
14862
|
-
this.
|
|
14865
|
+
if (node.declaration.type === "ClassDeclaration") this.visitStatement(node.declaration);
|
|
14866
|
+
else this.visitExpression(node.declaration);
|
|
14863
14867
|
return;
|
|
14864
14868
|
case "BlockStatement":
|
|
14865
14869
|
this.visitBlock(node);
|
|
@@ -15556,7 +15560,8 @@ var AS009Scanner = class {
|
|
|
15556
15560
|
this.visitVariableDeclaration(node.declaration);
|
|
15557
15561
|
return;
|
|
15558
15562
|
case "ExportDefaultDeclaration":
|
|
15559
|
-
this.
|
|
15563
|
+
if (node.declaration.type === "ClassDeclaration") this.visitStatement(node.declaration);
|
|
15564
|
+
else this.visitExpression(node.declaration);
|
|
15560
15565
|
return;
|
|
15561
15566
|
case "ImportDeclaration":
|
|
15562
15567
|
case "BreakStatement":
|
|
@@ -16062,7 +16067,8 @@ var AS010Scanner = class {
|
|
|
16062
16067
|
this.visitVariableDeclaration(node.declaration);
|
|
16063
16068
|
return;
|
|
16064
16069
|
case "ExportDefaultDeclaration":
|
|
16065
|
-
this.
|
|
16070
|
+
if (node.declaration.type === "ClassDeclaration") this.visitStatement(node.declaration);
|
|
16071
|
+
else this.visitExpression(node.declaration);
|
|
16066
16072
|
return;
|
|
16067
16073
|
case "ImportDeclaration":
|
|
16068
16074
|
case "BreakStatement":
|
|
@@ -16713,7 +16719,8 @@ var AS011Scanner = class {
|
|
|
16713
16719
|
this.visitVariableDeclaration(node.declaration);
|
|
16714
16720
|
return;
|
|
16715
16721
|
case "ExportDefaultDeclaration":
|
|
16716
|
-
this.
|
|
16722
|
+
if (node.declaration.type === "ClassDeclaration") this.visitStatement(node.declaration);
|
|
16723
|
+
else this.visitExpression(node.declaration);
|
|
16717
16724
|
return;
|
|
16718
16725
|
case "ImportDeclaration":
|
|
16719
16726
|
case "BreakStatement":
|
|
@@ -17136,7 +17143,8 @@ var AS015Scanner = class {
|
|
|
17136
17143
|
this.visitVariableDeclaration(node.declaration);
|
|
17137
17144
|
return;
|
|
17138
17145
|
case "ExportDefaultDeclaration":
|
|
17139
|
-
this.
|
|
17146
|
+
if (node.declaration.type === "ClassDeclaration") this.visitStatement(node.declaration);
|
|
17147
|
+
else this.visitExpression(node.declaration);
|
|
17140
17148
|
return;
|
|
17141
17149
|
case "ImportDeclaration":
|
|
17142
17150
|
case "BreakStatement":
|
|
@@ -17470,7 +17478,8 @@ var ASAsyncNotNeededScanner = class {
|
|
|
17470
17478
|
this.visitFunctionExpression(node.declaration, true);
|
|
17471
17479
|
return;
|
|
17472
17480
|
}
|
|
17473
|
-
this.
|
|
17481
|
+
if (node.declaration.type === "ClassDeclaration") this.visitStatement(node.declaration);
|
|
17482
|
+
else this.visitExpression(node.declaration);
|
|
17474
17483
|
return;
|
|
17475
17484
|
case "ImportDeclaration":
|
|
17476
17485
|
case "BreakStatement":
|
|
@@ -17825,7 +17834,7 @@ function statementContainsAwait(node) {
|
|
|
17825
17834
|
case "ExportNamedDeclaration":
|
|
17826
17835
|
return variableDeclarationContainsAwait(node.declaration);
|
|
17827
17836
|
case "ExportDefaultDeclaration":
|
|
17828
|
-
return expressionContainsAwait(node.declaration);
|
|
17837
|
+
return node.declaration.type === "ClassDeclaration" ? statementContainsAwait(node.declaration) : expressionContainsAwait(node.declaration);
|
|
17829
17838
|
case "ImportDeclaration":
|
|
17830
17839
|
case "FunctionDeclaration":
|
|
17831
17840
|
case "BreakStatement":
|
|
@@ -18025,7 +18034,8 @@ var ASDestructureNullDefaultScanner = class {
|
|
|
18025
18034
|
this.visitVariableDeclaration(node.declaration);
|
|
18026
18035
|
return;
|
|
18027
18036
|
case "ExportDefaultDeclaration":
|
|
18028
|
-
this.
|
|
18037
|
+
if (node.declaration.type === "ClassDeclaration") this.visitStatement(node.declaration);
|
|
18038
|
+
else this.visitExpression(node.declaration);
|
|
18029
18039
|
return;
|
|
18030
18040
|
case "ImportDeclaration":
|
|
18031
18041
|
case "BreakStatement":
|
|
@@ -18493,7 +18503,8 @@ var Scanner = class {
|
|
|
18493
18503
|
} else {
|
|
18494
18504
|
this.visitDefaultExportSignature(node.declaration);
|
|
18495
18505
|
}
|
|
18496
|
-
this.
|
|
18506
|
+
if (node.declaration.type === "ClassDeclaration") this.visitStatement(node.declaration);
|
|
18507
|
+
else this.visitExpression(node.declaration);
|
|
18497
18508
|
return;
|
|
18498
18509
|
case "BlockStatement":
|
|
18499
18510
|
for (const statement of node.body) {
|
|
@@ -18925,7 +18936,8 @@ var ASFloatingPromiseScanner = class {
|
|
|
18925
18936
|
this.visitVariableDeclaration(node.declaration);
|
|
18926
18937
|
return;
|
|
18927
18938
|
case "ExportDefaultDeclaration":
|
|
18928
|
-
this.
|
|
18939
|
+
if (node.declaration.type === "ClassDeclaration") this.visitStatement(node.declaration);
|
|
18940
|
+
else this.visitExpression(node.declaration);
|
|
18929
18941
|
return;
|
|
18930
18942
|
case "ImportDeclaration":
|
|
18931
18943
|
case "BreakStatement":
|
|
@@ -19541,7 +19553,8 @@ var ASFrontmatterFieldUnusedScanner = class {
|
|
|
19541
19553
|
this.visitVariableDeclaration(node.declaration);
|
|
19542
19554
|
return;
|
|
19543
19555
|
case "ExportDefaultDeclaration":
|
|
19544
|
-
this.
|
|
19556
|
+
if (node.declaration.type === "ClassDeclaration") this.visitStatement(node.declaration);
|
|
19557
|
+
else this.visitExpression(node.declaration);
|
|
19545
19558
|
return;
|
|
19546
19559
|
case "ImportDeclaration":
|
|
19547
19560
|
case "BreakStatement":
|
|
@@ -20063,7 +20076,8 @@ var ASJsdocTypeScanner = class {
|
|
|
20063
20076
|
);
|
|
20064
20077
|
return;
|
|
20065
20078
|
case "ExportDefaultDeclaration":
|
|
20066
|
-
this.
|
|
20079
|
+
if (node.declaration.type === "ClassDeclaration") this.visitStatement(node.declaration);
|
|
20080
|
+
else this.visitExpression(node.declaration);
|
|
20067
20081
|
return;
|
|
20068
20082
|
case "ImportDeclaration":
|
|
20069
20083
|
case "BreakStatement":
|
|
@@ -20793,7 +20807,8 @@ var ASLargeLiteralScanner = class {
|
|
|
20793
20807
|
this.visitVariableDeclaration(node.declaration);
|
|
20794
20808
|
return;
|
|
20795
20809
|
case "ExportDefaultDeclaration":
|
|
20796
|
-
this.
|
|
20810
|
+
if (node.declaration.type === "ClassDeclaration") this.visitStatement(node.declaration);
|
|
20811
|
+
else this.visitExpression(node.declaration);
|
|
20797
20812
|
return;
|
|
20798
20813
|
case "ImportDeclaration":
|
|
20799
20814
|
case "BreakStatement":
|
|
@@ -21158,7 +21173,8 @@ var ASMissingAsyncScanner = class {
|
|
|
21158
21173
|
this.visitVariableDeclaration(node.declaration);
|
|
21159
21174
|
return;
|
|
21160
21175
|
case "ExportDefaultDeclaration":
|
|
21161
|
-
this.
|
|
21176
|
+
if (node.declaration.type === "ClassDeclaration") this.visitStatement(node.declaration);
|
|
21177
|
+
else this.visitExpression(node.declaration);
|
|
21162
21178
|
return;
|
|
21163
21179
|
case "ImportDeclaration":
|
|
21164
21180
|
case "BreakStatement":
|
|
@@ -21500,7 +21516,7 @@ function statementContainsAwait2(node) {
|
|
|
21500
21516
|
case "ExportNamedDeclaration":
|
|
21501
21517
|
return variableDeclarationContainsAwait2(node.declaration);
|
|
21502
21518
|
case "ExportDefaultDeclaration":
|
|
21503
|
-
return expressionContainsAwait2(node.declaration);
|
|
21519
|
+
return node.declaration.type === "ClassDeclaration" ? statementContainsAwait2(node.declaration) : expressionContainsAwait2(node.declaration);
|
|
21504
21520
|
case "ImportDeclaration":
|
|
21505
21521
|
case "FunctionDeclaration":
|
|
21506
21522
|
case "BreakStatement":
|
|
@@ -21710,7 +21726,8 @@ var ASMutatingFrozenScanner = class {
|
|
|
21710
21726
|
this.visitVariableDeclaration(node.declaration);
|
|
21711
21727
|
return;
|
|
21712
21728
|
case "ExportDefaultDeclaration":
|
|
21713
|
-
this.
|
|
21729
|
+
if (node.declaration.type === "ClassDeclaration") this.visitStatement(node.declaration);
|
|
21730
|
+
else this.visitExpression(node.declaration);
|
|
21714
21731
|
return;
|
|
21715
21732
|
case "ImportDeclaration":
|
|
21716
21733
|
case "BreakStatement":
|
|
@@ -22233,7 +22250,8 @@ var ASNeedlessTemplateScanner = class {
|
|
|
22233
22250
|
this.visitVariableDeclaration(node.declaration);
|
|
22234
22251
|
return;
|
|
22235
22252
|
case "ExportDefaultDeclaration":
|
|
22236
|
-
this.
|
|
22253
|
+
if (node.declaration.type === "ClassDeclaration") this.visitStatement(node.declaration);
|
|
22254
|
+
else this.visitExpression(node.declaration);
|
|
22237
22255
|
return;
|
|
22238
22256
|
case "ImportDeclaration":
|
|
22239
22257
|
case "BreakStatement":
|
|
@@ -22622,7 +22640,8 @@ var ASShadowGlobalScanner = class {
|
|
|
22622
22640
|
this.visitVariableDeclaration(node.declaration);
|
|
22623
22641
|
return;
|
|
22624
22642
|
case "ExportDefaultDeclaration":
|
|
22625
|
-
this.
|
|
22643
|
+
if (node.declaration.type === "ClassDeclaration") this.visitStatement(node.declaration);
|
|
22644
|
+
else this.visitExpression(node.declaration);
|
|
22626
22645
|
return;
|
|
22627
22646
|
case "ImportDeclaration":
|
|
22628
22647
|
case "BreakStatement":
|
|
@@ -23036,7 +23055,8 @@ var ASUnboundedLoopScanner = class {
|
|
|
23036
23055
|
this.visitVariableDeclaration(node.declaration);
|
|
23037
23056
|
return;
|
|
23038
23057
|
case "ExportDefaultDeclaration":
|
|
23039
|
-
this.
|
|
23058
|
+
if (node.declaration.type === "ClassDeclaration") this.visitStatement(node.declaration);
|
|
23059
|
+
else this.visitExpression(node.declaration);
|
|
23040
23060
|
return;
|
|
23041
23061
|
case "ImportDeclaration":
|
|
23042
23062
|
case "BreakStatement":
|
|
@@ -23420,7 +23440,8 @@ var ASUnreachableScanner = class {
|
|
|
23420
23440
|
this.visitVariableDeclaration(node.declaration);
|
|
23421
23441
|
return false;
|
|
23422
23442
|
case "ExportDefaultDeclaration":
|
|
23423
|
-
this.
|
|
23443
|
+
if (node.declaration.type === "ClassDeclaration") this.visitStatement(node.declaration);
|
|
23444
|
+
else this.visitExpression(node.declaration);
|
|
23424
23445
|
return false;
|
|
23425
23446
|
case "ImportDeclaration":
|
|
23426
23447
|
case "EmptyStatement":
|
|
@@ -23707,7 +23728,8 @@ var ASUnusedImportScanner = class {
|
|
|
23707
23728
|
this.visitVariableDeclaration(node.declaration);
|
|
23708
23729
|
return;
|
|
23709
23730
|
case "ExportDefaultDeclaration":
|
|
23710
|
-
this.
|
|
23731
|
+
if (node.declaration.type === "ClassDeclaration") this.visitStatement(node.declaration);
|
|
23732
|
+
else this.visitExpression(node.declaration);
|
|
23711
23733
|
return;
|
|
23712
23734
|
case "BlockStatement":
|
|
23713
23735
|
this.visitBlock(node);
|
|
@@ -28499,10 +28521,14 @@ var Scope = class _Scope {
|
|
|
28499
28521
|
if (existing !== void 0 && existing.kind !== kind) {
|
|
28500
28522
|
throw new Error(`Cannot redeclare binding '${name}' in the same scope.`);
|
|
28501
28523
|
}
|
|
28502
|
-
|
|
28503
|
-
|
|
28504
|
-
|
|
28505
|
-
|
|
28524
|
+
if (existing !== void 0) existing.value = value;
|
|
28525
|
+
else this.#bindings.set(name, { kind, value });
|
|
28526
|
+
}
|
|
28527
|
+
declareAlias(name, target) {
|
|
28528
|
+
if (this.#bindings.has(name)) throw new Error(`Cannot redeclare binding '${name}' in the same scope.`);
|
|
28529
|
+
const binding = this.#bindings.get(target);
|
|
28530
|
+
if (binding === void 0) throw new ReferenceError(`Identifier '${target}' is not defined.`);
|
|
28531
|
+
this.#bindings.set(name, binding);
|
|
28506
28532
|
}
|
|
28507
28533
|
declareVar(name) {
|
|
28508
28534
|
const boundary = this.options.functionBoundary === true ? this : this.parent;
|
|
@@ -28549,10 +28575,7 @@ var Scope = class _Scope {
|
|
|
28549
28575
|
if (binding.kind === "const") {
|
|
28550
28576
|
throw new TypeError(`Cannot assign to const binding '${name}'.`);
|
|
28551
28577
|
}
|
|
28552
|
-
|
|
28553
|
-
kind: binding.kind,
|
|
28554
|
-
value
|
|
28555
|
-
});
|
|
28578
|
+
binding.value = value;
|
|
28556
28579
|
}
|
|
28557
28580
|
lookup(name) {
|
|
28558
28581
|
const binding = this.#bindings.get(name);
|
|
@@ -28599,10 +28622,9 @@ var Scope = class _Scope {
|
|
|
28599
28622
|
this.declare(name, sourceBinding.kind, sourceBinding.value);
|
|
28600
28623
|
continue;
|
|
28601
28624
|
}
|
|
28602
|
-
targetScope.#bindings.
|
|
28603
|
-
|
|
28604
|
-
|
|
28605
|
-
});
|
|
28625
|
+
const targetBinding = targetScope.#bindings.get(name);
|
|
28626
|
+
targetBinding.kind = sourceBinding.kind;
|
|
28627
|
+
targetBinding.value = sourceBinding.value;
|
|
28606
28628
|
}
|
|
28607
28629
|
}
|
|
28608
28630
|
resolveScope(name) {
|
|
@@ -28803,7 +28825,7 @@ async function interpret(node, options = {}) {
|
|
|
28803
28825
|
}
|
|
28804
28826
|
async function evaluateNode(node, context) {
|
|
28805
28827
|
context.assertActive?.();
|
|
28806
|
-
if (context.inferredName !== void 0 && node.type !== "ClassExpression" &&
|
|
28828
|
+
if (context.inferredName !== void 0 && node.type !== "ClassExpression" && node.type !== "FunctionExpression" && node.type !== "ArrowFunctionExpression") context = { ...context, inferredName: void 0 };
|
|
28807
28829
|
const replayWait = promiseReplayContext.getStore()?.beforeNode(node.nodeId);
|
|
28808
28830
|
if (replayWait !== void 0) await suspendJob(replayWait);
|
|
28809
28831
|
assertPromiseExecutionAllowed();
|
|
@@ -29410,11 +29432,15 @@ async function evaluateMetaProperty(_node, context) {
|
|
|
29410
29432
|
};
|
|
29411
29433
|
}
|
|
29412
29434
|
async function evaluateExportDefaultDeclaration(node, context) {
|
|
29413
|
-
const declaration = await evaluateNode(node.declaration, context);
|
|
29435
|
+
const declaration = await evaluateNode(node.declaration, { ...context, inferredName: "default" });
|
|
29414
29436
|
if (declaration.kind !== "normal") {
|
|
29415
29437
|
return declaration;
|
|
29416
29438
|
}
|
|
29417
|
-
|
|
29439
|
+
if (node.declaration.type === "ClassDeclaration") {
|
|
29440
|
+
context.scope.declareAlias("default", node.declaration.id.name);
|
|
29441
|
+
} else {
|
|
29442
|
+
context.scope.declare("default", "const", declaration.value);
|
|
29443
|
+
}
|
|
29418
29444
|
return {
|
|
29419
29445
|
kind: "normal",
|
|
29420
29446
|
hasValue: false,
|
|
@@ -29633,6 +29659,11 @@ function predeclareStatementListBindings(statements, context, functionBody = fal
|
|
|
29633
29659
|
const { scope } = context;
|
|
29634
29660
|
const names = /* @__PURE__ */ new Set();
|
|
29635
29661
|
for (const statement of statements) {
|
|
29662
|
+
if (statement.type === "ExportDefaultDeclaration" && statement.declaration.type === "ClassDeclaration") {
|
|
29663
|
+
scope.predeclare(statement.declaration.id.name, "let");
|
|
29664
|
+
names.add(statement.declaration.id.name);
|
|
29665
|
+
continue;
|
|
29666
|
+
}
|
|
29636
29667
|
if (statement.type === "ClassDeclaration") {
|
|
29637
29668
|
scope.predeclare(statement.id.name, "let");
|
|
29638
29669
|
names.add(statement.id.name);
|
|
@@ -31651,7 +31682,7 @@ function createInterpretedClosure(node, context, evaluateNode2, homeObject) {
|
|
|
31651
31682
|
sandbox: true,
|
|
31652
31683
|
length: getFunctionLength(node.params),
|
|
31653
31684
|
...node.async ? { async: true } : {},
|
|
31654
|
-
...node.type === "FunctionDeclaration" || node.type === "FunctionExpression" ? node.id === void 0 ? { name: context.inferredName } : { name: node.id.name } : {},
|
|
31685
|
+
...node.type === "FunctionDeclaration" || node.type === "FunctionExpression" ? node.id === void 0 ? { name: context.inferredName } : { name: node.id.name } : { name: context.inferredName },
|
|
31655
31686
|
...construct === void 0 ? {} : { construct },
|
|
31656
31687
|
retainedValues: () => [...context.scope.retainedValues(), context.functionEnvironment?.homeObject, context.functionEnvironment?.newTarget],
|
|
31657
31688
|
call: (args, callContext) => {
|
|
@@ -35534,4 +35565,4 @@ export {
|
|
|
35534
35565
|
FileSnapshotBackend,
|
|
35535
35566
|
run
|
|
35536
35567
|
};
|
|
35537
|
-
//# sourceMappingURL=chunk-
|
|
35568
|
+
//# sourceMappingURL=chunk-F6FZXBQR.js.map
|