poe-code 4.0.56 → 4.0.58
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/index.js +5 -538
- package/dist/index.js.map +4 -4
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/cached-resource/dist/cache-orchestrator.js +4 -1
- package/packages/safejs/dist/lint/index.js +0 -2
- package/packages/safejs/dist/parse/parser.js +4 -7
- package/packages/safejs/dist/lint/rules/AS002.d.ts +0 -13
- package/packages/safejs/dist/lint/rules/AS002.js +0 -525
package/dist/index.js
CHANGED
|
@@ -121259,13 +121259,13 @@ var init_parser3 = __esm({
|
|
|
121259
121259
|
};
|
|
121260
121260
|
}
|
|
121261
121261
|
parseExpression(options = {}) {
|
|
121262
|
-
const first = this.
|
|
121262
|
+
const first = this.parseAssignmentExpression();
|
|
121263
121263
|
if (options.allowSequence !== true || this.consumePunctuator(",") === void 0) {
|
|
121264
121264
|
return first;
|
|
121265
121265
|
}
|
|
121266
121266
|
const expressions = [first.node];
|
|
121267
121267
|
do {
|
|
121268
|
-
expressions.push(this.
|
|
121268
|
+
expressions.push(this.parseAssignmentExpression().node);
|
|
121269
121269
|
} while (this.consumePunctuator(",") !== void 0);
|
|
121270
121270
|
return {
|
|
121271
121271
|
node: {
|
|
@@ -121276,7 +121276,7 @@ var init_parser3 = __esm({
|
|
|
121276
121276
|
parenthesized: false
|
|
121277
121277
|
};
|
|
121278
121278
|
}
|
|
121279
|
-
|
|
121279
|
+
parseAssignmentExpression() {
|
|
121280
121280
|
const arrowFunction = this.tryParseArrowFunctionExpression();
|
|
121281
121281
|
if (arrowFunction !== void 0) {
|
|
121282
121282
|
return {
|
|
@@ -121284,9 +121284,6 @@ var init_parser3 = __esm({
|
|
|
121284
121284
|
parenthesized: false
|
|
121285
121285
|
};
|
|
121286
121286
|
}
|
|
121287
|
-
return this.parseAssignmentExpression();
|
|
121288
|
-
}
|
|
121289
|
-
parseAssignmentExpression() {
|
|
121290
121287
|
const patternAssignment = this.tryParsePatternAssignmentExpression();
|
|
121291
121288
|
if (patternAssignment !== void 0) {
|
|
121292
121289
|
return {
|
|
@@ -121362,7 +121359,7 @@ var init_parser3 = __esm({
|
|
|
121362
121359
|
}
|
|
121363
121360
|
const consequent = this.parseExpression();
|
|
121364
121361
|
this.expectPunctuator(":");
|
|
121365
|
-
const alternate = this.
|
|
121362
|
+
const alternate = this.parseAssignmentExpression();
|
|
121366
121363
|
return {
|
|
121367
121364
|
node: {
|
|
121368
121365
|
type: "ConditionalExpression",
|
|
@@ -124435,534 +124432,6 @@ var init_AS001 = __esm({
|
|
|
124435
124432
|
}
|
|
124436
124433
|
});
|
|
124437
124434
|
|
|
124438
|
-
// packages/safejs/src/lint/rules/AS002.ts
|
|
124439
|
-
function AS002(source, options = {}) {
|
|
124440
|
-
return new AS002Scanner(options.filename ?? "<input>").scan(source);
|
|
124441
|
-
}
|
|
124442
|
-
var AS002Scanner;
|
|
124443
|
-
var init_AS002 = __esm({
|
|
124444
|
-
"packages/safejs/src/lint/rules/AS002.ts"() {
|
|
124445
|
-
"use strict";
|
|
124446
|
-
init_parser3();
|
|
124447
|
-
AS002Scanner = class {
|
|
124448
|
-
constructor(filename) {
|
|
124449
|
-
this.filename = filename;
|
|
124450
|
-
}
|
|
124451
|
-
filename;
|
|
124452
|
-
diagnostics = [];
|
|
124453
|
-
scopes = [];
|
|
124454
|
-
lambdaStack = [];
|
|
124455
|
-
reportedCaptures = /* @__PURE__ */ new Set();
|
|
124456
|
-
scan(source) {
|
|
124457
|
-
const module = parseModule(source, this.filename);
|
|
124458
|
-
this.visitModule(module);
|
|
124459
|
-
return this.diagnostics;
|
|
124460
|
-
}
|
|
124461
|
-
visitModule(node) {
|
|
124462
|
-
this.withScope(this.collectModuleBindings(node.body), () => {
|
|
124463
|
-
for (const statement of node.body) {
|
|
124464
|
-
this.visitStatement(statement);
|
|
124465
|
-
}
|
|
124466
|
-
});
|
|
124467
|
-
}
|
|
124468
|
-
visitStatement(node) {
|
|
124469
|
-
switch (node.type) {
|
|
124470
|
-
case "BlockStatement":
|
|
124471
|
-
this.visitBlock(node);
|
|
124472
|
-
return;
|
|
124473
|
-
case "ExpressionStatement":
|
|
124474
|
-
this.visitExpressionStatement(node);
|
|
124475
|
-
return;
|
|
124476
|
-
case "IfStatement":
|
|
124477
|
-
this.visitIfStatement(node);
|
|
124478
|
-
return;
|
|
124479
|
-
case "ForStatement":
|
|
124480
|
-
this.visitForStatement(node);
|
|
124481
|
-
return;
|
|
124482
|
-
case "ForInStatement":
|
|
124483
|
-
case "ForOfStatement":
|
|
124484
|
-
this.visitForOfStatement(node);
|
|
124485
|
-
return;
|
|
124486
|
-
case "WhileStatement":
|
|
124487
|
-
case "DoWhileStatement":
|
|
124488
|
-
this.visitWhileStatement(node);
|
|
124489
|
-
return;
|
|
124490
|
-
case "TryStatement":
|
|
124491
|
-
this.visitTryStatement(node);
|
|
124492
|
-
return;
|
|
124493
|
-
case "VariableDeclaration":
|
|
124494
|
-
this.visitVariableDeclaration(node);
|
|
124495
|
-
return;
|
|
124496
|
-
case "ReturnStatement":
|
|
124497
|
-
if (node.argument !== void 0) {
|
|
124498
|
-
this.visitExpression(node.argument);
|
|
124499
|
-
}
|
|
124500
|
-
return;
|
|
124501
|
-
case "ThrowStatement":
|
|
124502
|
-
this.visitThrowStatement(node);
|
|
124503
|
-
return;
|
|
124504
|
-
case "ExportNamedDeclaration":
|
|
124505
|
-
this.visitVariableDeclaration(node.declaration);
|
|
124506
|
-
return;
|
|
124507
|
-
case "ExportDefaultDeclaration":
|
|
124508
|
-
this.visitExpression(node.declaration);
|
|
124509
|
-
return;
|
|
124510
|
-
case "ImportDeclaration":
|
|
124511
|
-
case "BreakStatement":
|
|
124512
|
-
case "ContinueStatement":
|
|
124513
|
-
return;
|
|
124514
|
-
}
|
|
124515
|
-
}
|
|
124516
|
-
visitBlock(node) {
|
|
124517
|
-
this.withScope(this.collectBlockBindings(node.body), () => {
|
|
124518
|
-
for (const statement of node.body) {
|
|
124519
|
-
this.visitStatement(statement);
|
|
124520
|
-
}
|
|
124521
|
-
});
|
|
124522
|
-
}
|
|
124523
|
-
visitExpressionStatement(node) {
|
|
124524
|
-
this.visitExpression(node.expression);
|
|
124525
|
-
}
|
|
124526
|
-
visitIfStatement(node) {
|
|
124527
|
-
this.visitExpression(node.test);
|
|
124528
|
-
this.visitStatement(node.consequent);
|
|
124529
|
-
if (node.alternate !== void 0) {
|
|
124530
|
-
this.visitStatement(node.alternate);
|
|
124531
|
-
}
|
|
124532
|
-
}
|
|
124533
|
-
visitForStatement(node) {
|
|
124534
|
-
const bindings = node.init?.type === "VariableDeclaration" ? this.collectDeclarationBindings(node.init) : [];
|
|
124535
|
-
this.withScope(bindings, () => {
|
|
124536
|
-
if (node.init !== void 0) {
|
|
124537
|
-
if (node.init.type === "VariableDeclaration") {
|
|
124538
|
-
this.visitVariableDeclaration(node.init);
|
|
124539
|
-
} else {
|
|
124540
|
-
this.visitExpression(node.init);
|
|
124541
|
-
}
|
|
124542
|
-
}
|
|
124543
|
-
if (node.test !== void 0) {
|
|
124544
|
-
this.visitExpression(node.test);
|
|
124545
|
-
}
|
|
124546
|
-
if (node.update !== void 0) {
|
|
124547
|
-
this.visitExpression(node.update);
|
|
124548
|
-
}
|
|
124549
|
-
this.visitStatement(node.body);
|
|
124550
|
-
});
|
|
124551
|
-
}
|
|
124552
|
-
visitForOfStatement(node) {
|
|
124553
|
-
const bindings = node.left.type === "VariableDeclaration" ? this.collectDeclarationBindings(node.left) : [];
|
|
124554
|
-
this.withScope(bindings, () => {
|
|
124555
|
-
if (node.left.type === "VariableDeclaration") {
|
|
124556
|
-
this.visitVariableDeclaration(node.left);
|
|
124557
|
-
} else {
|
|
124558
|
-
this.visitAssignmentTarget(node.left);
|
|
124559
|
-
}
|
|
124560
|
-
this.visitExpression(node.right);
|
|
124561
|
-
this.visitStatement(node.body);
|
|
124562
|
-
});
|
|
124563
|
-
}
|
|
124564
|
-
visitWhileStatement(node) {
|
|
124565
|
-
this.visitExpression(node.test);
|
|
124566
|
-
this.visitStatement(node.body);
|
|
124567
|
-
}
|
|
124568
|
-
visitTryStatement(node) {
|
|
124569
|
-
this.visitBlock(node.block);
|
|
124570
|
-
if (node.handler !== void 0) {
|
|
124571
|
-
this.visitCatchClause(node.handler);
|
|
124572
|
-
}
|
|
124573
|
-
if (node.finalizer !== void 0) {
|
|
124574
|
-
this.visitBlock(node.finalizer);
|
|
124575
|
-
}
|
|
124576
|
-
}
|
|
124577
|
-
visitCatchClause(node) {
|
|
124578
|
-
this.withScope(this.collectCatchBindings(node), () => {
|
|
124579
|
-
if (node.param !== void 0) {
|
|
124580
|
-
this.visitBindingPattern(node.param);
|
|
124581
|
-
}
|
|
124582
|
-
this.visitBlock(node.body);
|
|
124583
|
-
});
|
|
124584
|
-
}
|
|
124585
|
-
visitThrowStatement(node) {
|
|
124586
|
-
this.visitExpression(node.argument);
|
|
124587
|
-
}
|
|
124588
|
-
visitVariableDeclaration(node) {
|
|
124589
|
-
for (const declarator of node.declarations) {
|
|
124590
|
-
this.visitVariableDeclarator(declarator);
|
|
124591
|
-
}
|
|
124592
|
-
}
|
|
124593
|
-
visitVariableDeclarator(node) {
|
|
124594
|
-
this.visitBindingPattern(node.id);
|
|
124595
|
-
if (node.init !== void 0) {
|
|
124596
|
-
this.visitExpression(node.init);
|
|
124597
|
-
}
|
|
124598
|
-
}
|
|
124599
|
-
visitExpression(node) {
|
|
124600
|
-
switch (node.type) {
|
|
124601
|
-
case "Identifier":
|
|
124602
|
-
this.visitIdentifier(node);
|
|
124603
|
-
return;
|
|
124604
|
-
case "ArrowFunctionExpression":
|
|
124605
|
-
this.visitArrowFunction(node);
|
|
124606
|
-
return;
|
|
124607
|
-
case "AwaitExpression":
|
|
124608
|
-
this.visitAwaitExpression(node);
|
|
124609
|
-
return;
|
|
124610
|
-
case "ArrayExpression":
|
|
124611
|
-
this.visitArrayExpression(node);
|
|
124612
|
-
return;
|
|
124613
|
-
case "ObjectExpression":
|
|
124614
|
-
this.visitObjectExpression(node);
|
|
124615
|
-
return;
|
|
124616
|
-
case "UnaryExpression":
|
|
124617
|
-
this.visitUnaryExpression(node);
|
|
124618
|
-
return;
|
|
124619
|
-
case "BinaryExpression":
|
|
124620
|
-
this.visitBinaryExpression(node);
|
|
124621
|
-
return;
|
|
124622
|
-
case "LogicalExpression":
|
|
124623
|
-
this.visitLogicalExpression(node);
|
|
124624
|
-
return;
|
|
124625
|
-
case "ConditionalExpression":
|
|
124626
|
-
this.visitConditionalExpression(node);
|
|
124627
|
-
return;
|
|
124628
|
-
case "MemberExpression":
|
|
124629
|
-
this.visitMemberExpression(node);
|
|
124630
|
-
return;
|
|
124631
|
-
case "AssignmentExpression":
|
|
124632
|
-
this.visitAssignmentExpression(node);
|
|
124633
|
-
return;
|
|
124634
|
-
case "CallExpression":
|
|
124635
|
-
this.visitCallExpression(node);
|
|
124636
|
-
return;
|
|
124637
|
-
case "TemplateLiteral":
|
|
124638
|
-
this.visitTemplateLiteral(node);
|
|
124639
|
-
return;
|
|
124640
|
-
case "BooleanLiteral":
|
|
124641
|
-
case "NullLiteral":
|
|
124642
|
-
case "NumericLiteral":
|
|
124643
|
-
case "StringLiteral":
|
|
124644
|
-
case "UndefinedLiteral":
|
|
124645
|
-
return;
|
|
124646
|
-
}
|
|
124647
|
-
}
|
|
124648
|
-
visitArrowFunction(node) {
|
|
124649
|
-
const lambdaContext = {
|
|
124650
|
-
depth: this.lambdaStack.length + 1,
|
|
124651
|
-
nodeId: node.nodeId ?? -1
|
|
124652
|
-
};
|
|
124653
|
-
this.lambdaStack.push(lambdaContext);
|
|
124654
|
-
this.withScope(this.collectParameterBindings(node), () => {
|
|
124655
|
-
for (const parameter of node.params) {
|
|
124656
|
-
this.visitBindingElement(parameter);
|
|
124657
|
-
}
|
|
124658
|
-
if (node.body.type === "BlockStatement") {
|
|
124659
|
-
this.visitBlock(node.body);
|
|
124660
|
-
} else {
|
|
124661
|
-
this.visitExpression(node.body);
|
|
124662
|
-
}
|
|
124663
|
-
});
|
|
124664
|
-
this.lambdaStack.pop();
|
|
124665
|
-
}
|
|
124666
|
-
visitAwaitExpression(node) {
|
|
124667
|
-
this.visitExpression(node.argument);
|
|
124668
|
-
}
|
|
124669
|
-
visitArrayExpression(node) {
|
|
124670
|
-
for (const element of node.elements) {
|
|
124671
|
-
if (element?.type === "SpreadElement") {
|
|
124672
|
-
this.visitSpreadElement(element);
|
|
124673
|
-
continue;
|
|
124674
|
-
}
|
|
124675
|
-
if (element !== void 0) {
|
|
124676
|
-
this.visitExpression(element);
|
|
124677
|
-
}
|
|
124678
|
-
}
|
|
124679
|
-
}
|
|
124680
|
-
visitObjectExpression(node) {
|
|
124681
|
-
for (const property of node.properties) {
|
|
124682
|
-
if (property.type === "SpreadElement") {
|
|
124683
|
-
this.visitSpreadElement(property);
|
|
124684
|
-
continue;
|
|
124685
|
-
}
|
|
124686
|
-
this.visitProperty(property);
|
|
124687
|
-
}
|
|
124688
|
-
}
|
|
124689
|
-
visitUnaryExpression(node) {
|
|
124690
|
-
this.visitExpression(node.argument);
|
|
124691
|
-
}
|
|
124692
|
-
visitBinaryExpression(node) {
|
|
124693
|
-
this.visitExpression(node.left);
|
|
124694
|
-
this.visitExpression(node.right);
|
|
124695
|
-
}
|
|
124696
|
-
visitLogicalExpression(node) {
|
|
124697
|
-
this.visitExpression(node.left);
|
|
124698
|
-
this.visitExpression(node.right);
|
|
124699
|
-
}
|
|
124700
|
-
visitConditionalExpression(node) {
|
|
124701
|
-
this.visitExpression(node.test);
|
|
124702
|
-
this.visitExpression(node.consequent);
|
|
124703
|
-
this.visitExpression(node.alternate);
|
|
124704
|
-
}
|
|
124705
|
-
visitMemberExpression(node) {
|
|
124706
|
-
this.visitExpression(node.object);
|
|
124707
|
-
if (node.computed) {
|
|
124708
|
-
this.visitExpression(node.property);
|
|
124709
|
-
}
|
|
124710
|
-
}
|
|
124711
|
-
visitAssignmentExpression(node) {
|
|
124712
|
-
this.visitAssignmentTarget(node.left);
|
|
124713
|
-
this.visitExpression(node.right);
|
|
124714
|
-
}
|
|
124715
|
-
visitCallExpression(node) {
|
|
124716
|
-
this.visitExpression(node.callee);
|
|
124717
|
-
for (const argument of node.arguments) {
|
|
124718
|
-
if (argument.type === "SpreadElement") {
|
|
124719
|
-
this.visitSpreadElement(argument);
|
|
124720
|
-
continue;
|
|
124721
|
-
}
|
|
124722
|
-
this.visitExpression(argument);
|
|
124723
|
-
}
|
|
124724
|
-
}
|
|
124725
|
-
visitTemplateLiteral(node) {
|
|
124726
|
-
for (const expression of node.expressions) {
|
|
124727
|
-
this.visitExpression(expression);
|
|
124728
|
-
}
|
|
124729
|
-
}
|
|
124730
|
-
visitProperty(node) {
|
|
124731
|
-
if (node.computed) {
|
|
124732
|
-
this.visitExpression(node.key);
|
|
124733
|
-
}
|
|
124734
|
-
this.visitExpression(node.value);
|
|
124735
|
-
}
|
|
124736
|
-
visitSpreadElement(node) {
|
|
124737
|
-
this.visitExpression(node.argument);
|
|
124738
|
-
}
|
|
124739
|
-
visitBindingElement(node) {
|
|
124740
|
-
switch (node.type) {
|
|
124741
|
-
case "AssignmentPattern":
|
|
124742
|
-
this.visitBindingPattern(node.left);
|
|
124743
|
-
this.visitExpression(node.right);
|
|
124744
|
-
return;
|
|
124745
|
-
case "RestElement":
|
|
124746
|
-
this.visitBindingPattern(node.argument);
|
|
124747
|
-
return;
|
|
124748
|
-
default:
|
|
124749
|
-
this.visitBindingPattern(node);
|
|
124750
|
-
return;
|
|
124751
|
-
}
|
|
124752
|
-
}
|
|
124753
|
-
visitBindingPattern(node) {
|
|
124754
|
-
switch (node.type) {
|
|
124755
|
-
case "Identifier":
|
|
124756
|
-
return;
|
|
124757
|
-
case "MemberExpression":
|
|
124758
|
-
this.visitMemberExpression(node);
|
|
124759
|
-
return;
|
|
124760
|
-
case "ArrayPattern":
|
|
124761
|
-
for (const element of node.elements) {
|
|
124762
|
-
if (element !== null) {
|
|
124763
|
-
this.visitBindingElement(element);
|
|
124764
|
-
}
|
|
124765
|
-
}
|
|
124766
|
-
return;
|
|
124767
|
-
case "ObjectPattern":
|
|
124768
|
-
for (const property of node.properties) {
|
|
124769
|
-
if (property.type === "RestElement") {
|
|
124770
|
-
this.visitBindingPattern(property.argument);
|
|
124771
|
-
continue;
|
|
124772
|
-
}
|
|
124773
|
-
this.visitAssignmentProperty(property);
|
|
124774
|
-
}
|
|
124775
|
-
return;
|
|
124776
|
-
}
|
|
124777
|
-
}
|
|
124778
|
-
visitAssignmentProperty(node) {
|
|
124779
|
-
if (node.computed) {
|
|
124780
|
-
this.visitExpression(node.key);
|
|
124781
|
-
}
|
|
124782
|
-
this.visitBindingElement(node.value);
|
|
124783
|
-
}
|
|
124784
|
-
visitAssignmentTarget(node) {
|
|
124785
|
-
switch (node.type) {
|
|
124786
|
-
case "AssignmentPattern":
|
|
124787
|
-
this.visitAssignmentTarget(node.left);
|
|
124788
|
-
this.visitExpression(node.right);
|
|
124789
|
-
return;
|
|
124790
|
-
case "RestElement":
|
|
124791
|
-
this.visitAssignmentTarget(node.argument);
|
|
124792
|
-
return;
|
|
124793
|
-
case "Identifier":
|
|
124794
|
-
this.visitIdentifier(node);
|
|
124795
|
-
return;
|
|
124796
|
-
case "MemberExpression":
|
|
124797
|
-
this.visitMemberExpression(node);
|
|
124798
|
-
return;
|
|
124799
|
-
case "ArrayPattern":
|
|
124800
|
-
for (const element of node.elements) {
|
|
124801
|
-
if (element === null) {
|
|
124802
|
-
continue;
|
|
124803
|
-
}
|
|
124804
|
-
this.visitAssignmentTarget(element);
|
|
124805
|
-
}
|
|
124806
|
-
return;
|
|
124807
|
-
case "ObjectPattern":
|
|
124808
|
-
for (const property of node.properties) {
|
|
124809
|
-
if (property.type === "RestElement") {
|
|
124810
|
-
this.visitAssignmentTarget(property);
|
|
124811
|
-
continue;
|
|
124812
|
-
}
|
|
124813
|
-
if (property.computed) {
|
|
124814
|
-
this.visitExpression(property.key);
|
|
124815
|
-
}
|
|
124816
|
-
this.visitAssignmentTarget(property.value);
|
|
124817
|
-
}
|
|
124818
|
-
return;
|
|
124819
|
-
}
|
|
124820
|
-
}
|
|
124821
|
-
visitIdentifier(node) {
|
|
124822
|
-
const currentLambda = this.lambdaStack[this.lambdaStack.length - 1];
|
|
124823
|
-
if (currentLambda === void 0) {
|
|
124824
|
-
return;
|
|
124825
|
-
}
|
|
124826
|
-
const binding = this.resolveBinding(node.name);
|
|
124827
|
-
if (binding === void 0 || binding.kind !== "let" || binding.ownerLambdaDepth >= currentLambda.depth) {
|
|
124828
|
-
return;
|
|
124829
|
-
}
|
|
124830
|
-
const captureKey = `${currentLambda.nodeId}:${binding.name}`;
|
|
124831
|
-
if (this.reportedCaptures.has(captureKey)) {
|
|
124832
|
-
return;
|
|
124833
|
-
}
|
|
124834
|
-
this.reportedCaptures.add(captureKey);
|
|
124835
|
-
this.diagnostics.push({
|
|
124836
|
-
code: "AS002",
|
|
124837
|
-
severity: "error",
|
|
124838
|
-
message: `Lambda closes over let-bound '${binding.name}' from an outer scope. Change it to const or pass it as a parameter.`,
|
|
124839
|
-
filename: this.filename,
|
|
124840
|
-
line: node.span.start.line,
|
|
124841
|
-
column: node.span.start.column,
|
|
124842
|
-
span: node.span
|
|
124843
|
-
});
|
|
124844
|
-
}
|
|
124845
|
-
withScope(bindings, visit) {
|
|
124846
|
-
const scope = /* @__PURE__ */ new Map();
|
|
124847
|
-
for (const binding of bindings) {
|
|
124848
|
-
scope.set(binding.name, binding);
|
|
124849
|
-
}
|
|
124850
|
-
this.scopes.push(scope);
|
|
124851
|
-
visit();
|
|
124852
|
-
this.scopes.pop();
|
|
124853
|
-
}
|
|
124854
|
-
resolveBinding(name) {
|
|
124855
|
-
for (let index = this.scopes.length - 1; index >= 0; index -= 1) {
|
|
124856
|
-
const binding = this.scopes[index]?.get(name);
|
|
124857
|
-
if (binding !== void 0) {
|
|
124858
|
-
return binding;
|
|
124859
|
-
}
|
|
124860
|
-
}
|
|
124861
|
-
return void 0;
|
|
124862
|
-
}
|
|
124863
|
-
collectModuleBindings(body) {
|
|
124864
|
-
const bindings = [];
|
|
124865
|
-
for (const statement of body) {
|
|
124866
|
-
if (statement.type === "ImportDeclaration") {
|
|
124867
|
-
bindings.push(...this.collectImportBindings(statement));
|
|
124868
|
-
continue;
|
|
124869
|
-
}
|
|
124870
|
-
if (statement.type === "VariableDeclaration") {
|
|
124871
|
-
bindings.push(...this.collectDeclarationBindings(statement));
|
|
124872
|
-
continue;
|
|
124873
|
-
}
|
|
124874
|
-
if (statement.type === "ExportNamedDeclaration") {
|
|
124875
|
-
bindings.push(...this.collectDeclarationBindings(statement.declaration));
|
|
124876
|
-
}
|
|
124877
|
-
}
|
|
124878
|
-
return bindings;
|
|
124879
|
-
}
|
|
124880
|
-
collectBlockBindings(body) {
|
|
124881
|
-
const bindings = [];
|
|
124882
|
-
for (const statement of body) {
|
|
124883
|
-
if (statement.type === "VariableDeclaration") {
|
|
124884
|
-
bindings.push(...this.collectDeclarationBindings(statement));
|
|
124885
|
-
}
|
|
124886
|
-
}
|
|
124887
|
-
return bindings;
|
|
124888
|
-
}
|
|
124889
|
-
collectParameterBindings(node) {
|
|
124890
|
-
const bindings = [];
|
|
124891
|
-
for (const parameter of node.params) {
|
|
124892
|
-
this.collectBindingNamesFromElement(parameter, "param", bindings);
|
|
124893
|
-
}
|
|
124894
|
-
return bindings;
|
|
124895
|
-
}
|
|
124896
|
-
collectDeclarationBindings(node) {
|
|
124897
|
-
const bindings = [];
|
|
124898
|
-
for (const declarator of node.declarations) {
|
|
124899
|
-
this.collectBindingNamesFromPattern(declarator.id, node.kind, bindings);
|
|
124900
|
-
}
|
|
124901
|
-
return bindings;
|
|
124902
|
-
}
|
|
124903
|
-
collectCatchBindings(node) {
|
|
124904
|
-
const bindings = [];
|
|
124905
|
-
if (node.param !== void 0) {
|
|
124906
|
-
this.collectBindingNamesFromPattern(node.param, "let", bindings);
|
|
124907
|
-
}
|
|
124908
|
-
return bindings;
|
|
124909
|
-
}
|
|
124910
|
-
collectImportBindings(node) {
|
|
124911
|
-
const bindings = [];
|
|
124912
|
-
for (const specifier of node.specifiers) {
|
|
124913
|
-
bindings.push(this.createBinding(specifier.local.name, "import"));
|
|
124914
|
-
}
|
|
124915
|
-
return bindings;
|
|
124916
|
-
}
|
|
124917
|
-
collectBindingNamesFromElement(node, kind, bindings) {
|
|
124918
|
-
switch (node.type) {
|
|
124919
|
-
case "AssignmentPattern":
|
|
124920
|
-
this.collectBindingNamesFromPattern(node.left, kind, bindings);
|
|
124921
|
-
return;
|
|
124922
|
-
case "RestElement":
|
|
124923
|
-
this.collectBindingNamesFromPattern(node.argument, kind, bindings);
|
|
124924
|
-
return;
|
|
124925
|
-
default:
|
|
124926
|
-
this.collectBindingNamesFromPattern(node, kind, bindings);
|
|
124927
|
-
return;
|
|
124928
|
-
}
|
|
124929
|
-
}
|
|
124930
|
-
collectBindingNamesFromPattern(node, kind, bindings) {
|
|
124931
|
-
switch (node.type) {
|
|
124932
|
-
case "Identifier":
|
|
124933
|
-
bindings.push(this.createBinding(node.name, kind));
|
|
124934
|
-
return;
|
|
124935
|
-
case "MemberExpression":
|
|
124936
|
-
return;
|
|
124937
|
-
case "ArrayPattern":
|
|
124938
|
-
for (const element of node.elements) {
|
|
124939
|
-
if (element !== null) {
|
|
124940
|
-
this.collectBindingNamesFromElement(element, kind, bindings);
|
|
124941
|
-
}
|
|
124942
|
-
}
|
|
124943
|
-
return;
|
|
124944
|
-
case "ObjectPattern":
|
|
124945
|
-
for (const property of node.properties) {
|
|
124946
|
-
if (property.type === "RestElement") {
|
|
124947
|
-
this.collectBindingNamesFromPattern(property.argument, kind, bindings);
|
|
124948
|
-
continue;
|
|
124949
|
-
}
|
|
124950
|
-
this.collectBindingNamesFromElement(property.value, kind, bindings);
|
|
124951
|
-
}
|
|
124952
|
-
return;
|
|
124953
|
-
}
|
|
124954
|
-
}
|
|
124955
|
-
createBinding(name, kind) {
|
|
124956
|
-
return {
|
|
124957
|
-
kind,
|
|
124958
|
-
name,
|
|
124959
|
-
ownerLambdaDepth: this.lambdaStack.length
|
|
124960
|
-
};
|
|
124961
|
-
}
|
|
124962
|
-
};
|
|
124963
|
-
}
|
|
124964
|
-
});
|
|
124965
|
-
|
|
124966
124435
|
// packages/safejs/src/lint/rules/known-globals.ts
|
|
124967
124436
|
var KNOWN_RUNTIME_GLOBALS;
|
|
124968
124437
|
var init_known_globals = __esm({
|
|
@@ -136295,7 +135764,6 @@ var init_lint3 = __esm({
|
|
|
136295
135764
|
"packages/safejs/src/lint/index.ts"() {
|
|
136296
135765
|
"use strict";
|
|
136297
135766
|
init_AS001();
|
|
136298
|
-
init_AS002();
|
|
136299
135767
|
init_AS003();
|
|
136300
135768
|
init_AS004();
|
|
136301
135769
|
init_AS005();
|
|
@@ -136326,7 +135794,6 @@ var init_lint3 = __esm({
|
|
|
136326
135794
|
init_tokenizer2();
|
|
136327
135795
|
init_parser3();
|
|
136328
135796
|
RULES = [
|
|
136329
|
-
AS002,
|
|
136330
135797
|
AS003,
|
|
136331
135798
|
AS004,
|
|
136332
135799
|
AS005,
|
|
@@ -152713,7 +152180,7 @@ var init_package2 = __esm({
|
|
|
152713
152180
|
"package.json"() {
|
|
152714
152181
|
package_default2 = {
|
|
152715
152182
|
name: "poe-code",
|
|
152716
|
-
version: "4.0.
|
|
152183
|
+
version: "4.0.58",
|
|
152717
152184
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
152718
152185
|
license: "MIT",
|
|
152719
152186
|
type: "module",
|