technical-debt-radar 1.0.5 → 1.0.6
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 +15 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17735,14 +17735,15 @@ var require_dead_code_detector = __commonJS({
|
|
|
17735
17735
|
excludeTypes: true,
|
|
17736
17736
|
severity: "info"
|
|
17737
17737
|
};
|
|
17738
|
-
async function detectDeadCode(input, config = {}) {
|
|
17738
|
+
async function detectDeadCode(input, config = {}, projectRoot) {
|
|
17739
17739
|
const cfg = { ...DEFAULT_CONFIG, ...config };
|
|
17740
17740
|
if (!cfg.enabled) {
|
|
17741
17741
|
return emptyResult();
|
|
17742
17742
|
}
|
|
17743
17743
|
const project = createProject(input);
|
|
17744
17744
|
const sourceFiles = /* @__PURE__ */ new Map();
|
|
17745
|
-
const
|
|
17745
|
+
const effectiveRoot = projectRoot ?? input.projectRoot;
|
|
17746
|
+
const { aliases } = parsePathAliases(input, effectiveRoot);
|
|
17746
17747
|
for (const sf of project.getSourceFiles()) {
|
|
17747
17748
|
const filePath = normalizeFilePath(sf.getFilePath());
|
|
17748
17749
|
sourceFiles.set(filePath, sf);
|
|
@@ -17984,18 +17985,22 @@ var require_dead_code_detector = __commonJS({
|
|
|
17984
17985
|
function isTypeExport(type) {
|
|
17985
17986
|
return type === "type" || type === "interface" || type === "enum";
|
|
17986
17987
|
}
|
|
17987
|
-
function parsePathAliases(input) {
|
|
17988
|
+
function parsePathAliases(input, projectRoot) {
|
|
17988
17989
|
let tsconfigContent;
|
|
17989
17990
|
const tsconfigFile = input.changedFiles.find((f) => f.status !== "deleted" && /tsconfig(?:\.build)?\.json$/.test(f.path));
|
|
17990
17991
|
if (tsconfigFile) {
|
|
17991
17992
|
tsconfigContent = tsconfigFile.content;
|
|
17992
17993
|
}
|
|
17993
|
-
|
|
17994
|
+
const root = projectRoot ?? input.projectRoot;
|
|
17995
|
+
if (!tsconfigContent && root) {
|
|
17994
17996
|
try {
|
|
17995
17997
|
const fs9 = require("fs");
|
|
17996
|
-
const
|
|
17997
|
-
|
|
17998
|
-
|
|
17998
|
+
for (const name of ["tsconfig.json", "tsconfig.build.json"]) {
|
|
17999
|
+
const tsconfigPath = path9.join(root, name);
|
|
18000
|
+
if (fs9.existsSync(tsconfigPath)) {
|
|
18001
|
+
tsconfigContent = fs9.readFileSync(tsconfigPath, "utf-8");
|
|
18002
|
+
break;
|
|
18003
|
+
}
|
|
17999
18004
|
}
|
|
18000
18005
|
} catch {
|
|
18001
18006
|
}
|
|
@@ -18007,7 +18012,8 @@ var require_dead_code_detector = __commonJS({
|
|
|
18007
18012
|
const stripped = tsconfigContent.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "").replace(/,\s*([}\]])/g, "$1");
|
|
18008
18013
|
const tsconfig = JSON.parse(stripped);
|
|
18009
18014
|
const compilerOptions = tsconfig.compilerOptions ?? {};
|
|
18010
|
-
const
|
|
18015
|
+
const rawBaseUrl = (compilerOptions.baseUrl ?? ".").replace(/\/+$/, "");
|
|
18016
|
+
const baseUrl = rawBaseUrl === "" ? "." : rawBaseUrl;
|
|
18011
18017
|
const paths = compilerOptions.paths ?? {};
|
|
18012
18018
|
const aliases = [];
|
|
18013
18019
|
for (const [pattern, targets] of Object.entries(paths)) {
|
|
@@ -18538,7 +18544,7 @@ var require_orchestrator = __commonJS({
|
|
|
18538
18544
|
(0, reliability_detector_1.detectReliabilityIssues)(filteredInput, policy),
|
|
18539
18545
|
(0, duplication_detector_1.detectDuplication)(filteredInput),
|
|
18540
18546
|
projectRoot ? (0, missing_tests_detector_1.detectMissingTests)(filteredInput, projectRoot) : Promise.resolve(null),
|
|
18541
|
-
(0, dead_code_detector_1.detectDeadCode)(filteredInput),
|
|
18547
|
+
(0, dead_code_detector_1.detectDeadCode)(filteredInput, {}, projectRoot),
|
|
18542
18548
|
projectRoot ? Promise.resolve((0, coverage_delta_detector_1.detectCoverageDelta)(projectRoot)) : Promise.resolve(null)
|
|
18543
18549
|
]);
|
|
18544
18550
|
const runtimeViolations = runtimeResult.violations;
|