ira-review 3.1.8 → 3.1.9
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/cli.js +7 -12
- package/dist/index.cjs +7 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -12
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/dist/cli.js
CHANGED
|
@@ -519,6 +519,7 @@ function annotateDiffWithLineNumbers(diff) {
|
|
|
519
519
|
// src/utils/rulesFile.ts
|
|
520
520
|
import { readFileSync as readFileSync4, existsSync as existsSync6 } from "fs";
|
|
521
521
|
import { resolve } from "path";
|
|
522
|
+
import picomatch from "picomatch";
|
|
522
523
|
var VALID_SEVERITIES = ["BLOCKER", "CRITICAL", "MAJOR", "MINOR"];
|
|
523
524
|
var RULES_SOFT_WARN_THRESHOLD = 500;
|
|
524
525
|
function loadRawRulesFile(cwd) {
|
|
@@ -652,20 +653,14 @@ function filterRulesByPath(rules, filePath) {
|
|
|
652
653
|
return rule.paths.some((pattern) => matchPattern(pattern, filePath));
|
|
653
654
|
});
|
|
654
655
|
}
|
|
656
|
+
var matcherCache = /* @__PURE__ */ new Map();
|
|
655
657
|
function matchPattern(pattern, filePath) {
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
return filePath.endsWith(ext);
|
|
661
|
-
}
|
|
662
|
-
return filePath.endsWith("/" + suffix) || filePath === suffix;
|
|
663
|
-
}
|
|
664
|
-
if (pattern.endsWith("/**")) {
|
|
665
|
-
const prefix = pattern.slice(0, -3);
|
|
666
|
-
return filePath.startsWith(prefix + "/") || filePath === prefix;
|
|
658
|
+
let isMatch = matcherCache.get(pattern);
|
|
659
|
+
if (!isMatch) {
|
|
660
|
+
isMatch = picomatch(pattern, { dot: true });
|
|
661
|
+
matcherCache.set(pattern, isMatch);
|
|
667
662
|
}
|
|
668
|
-
return filePath
|
|
663
|
+
return isMatch(filePath);
|
|
669
664
|
}
|
|
670
665
|
function loadSensitiveAreas(cwd) {
|
|
671
666
|
const parsed = loadRawRulesFile(cwd);
|
package/dist/index.cjs
CHANGED
|
@@ -757,6 +757,7 @@ function annotateDiffWithLineNumbers(diff) {
|
|
|
757
757
|
// src/utils/rulesFile.ts
|
|
758
758
|
var import_node_fs6 = require("fs");
|
|
759
759
|
var import_node_path6 = require("path");
|
|
760
|
+
var import_picomatch = __toESM(require("picomatch"), 1);
|
|
760
761
|
var VALID_SEVERITIES = ["BLOCKER", "CRITICAL", "MAJOR", "MINOR"];
|
|
761
762
|
var RULES_SOFT_WARN_THRESHOLD = 500;
|
|
762
763
|
function loadRawRulesFile(cwd) {
|
|
@@ -890,20 +891,14 @@ function filterRulesByPath(rules, filePath) {
|
|
|
890
891
|
return rule.paths.some((pattern) => matchPattern(pattern, filePath));
|
|
891
892
|
});
|
|
892
893
|
}
|
|
894
|
+
var matcherCache = /* @__PURE__ */ new Map();
|
|
893
895
|
function matchPattern(pattern, filePath) {
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
return filePath.endsWith(ext);
|
|
899
|
-
}
|
|
900
|
-
return filePath.endsWith("/" + suffix) || filePath === suffix;
|
|
901
|
-
}
|
|
902
|
-
if (pattern.endsWith("/**")) {
|
|
903
|
-
const prefix = pattern.slice(0, -3);
|
|
904
|
-
return filePath.startsWith(prefix + "/") || filePath === prefix;
|
|
896
|
+
let isMatch = matcherCache.get(pattern);
|
|
897
|
+
if (!isMatch) {
|
|
898
|
+
isMatch = (0, import_picomatch.default)(pattern, { dot: true });
|
|
899
|
+
matcherCache.set(pattern, isMatch);
|
|
905
900
|
}
|
|
906
|
-
return filePath
|
|
901
|
+
return isMatch(filePath);
|
|
907
902
|
}
|
|
908
903
|
function loadSensitiveAreas(cwd) {
|
|
909
904
|
const parsed = loadRawRulesFile(cwd);
|