@chappibunny/repolens 1.16.3 → 1.16.4
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/CHANGELOG.md +26 -0
- package/README.md +7 -7
- package/package.json +1 -1
- package/src/analyzers/cycle-priority.js +3 -0
- package/src/analyzers/dependency-graph.js +121 -13
- package/src/analyzers/import-parsers.js +47 -14
- package/src/analyzers/ts-elision.js +921 -0
- package/src/renderers/renderAnalysis.js +22 -2
|
@@ -356,6 +356,8 @@ export function renderDependencyGraph(depResult) {
|
|
|
356
356
|
lines.push(`| External packages | ${s.externalDeps} |`);
|
|
357
357
|
}
|
|
358
358
|
lines.push(`| Circular dependencies | ${s.cycles} |`);
|
|
359
|
+
if (s.typeOnlyCycles > 0) lines.push(`| Type-only cycles (not runtime, not counted) | ${s.typeOnlyCycles} |`);
|
|
360
|
+
if (s.typeOnlyEdges > 0) lines.push(`| Type-only imports (not import edges) | ${s.typeOnlyEdges} |`);
|
|
359
361
|
lines.push(`| Orphan files (no imports or importers) | ${s.orphanFiles} |`);
|
|
360
362
|
lines.push("");
|
|
361
363
|
|
|
@@ -395,9 +397,27 @@ export function renderDependencyGraph(depResult) {
|
|
|
395
397
|
}
|
|
396
398
|
|
|
397
399
|
if (Array.isArray(depResult.typeOnlyReports) && depResult.typeOnlyReports.length > 0) {
|
|
400
|
+
const reports = depResult.typeOnlyReports;
|
|
398
401
|
lines.push("## Type-only cycles");
|
|
399
402
|
lines.push("");
|
|
400
|
-
lines.push(`**${
|
|
403
|
+
lines.push(`**${reports.length}** cycle${reports.length === 1 ? " closes" : "s close"} only through type-only imports. The compiler removes those imports, so there is no runtime cycle. They are not counted as circular dependencies and do not lower the health score. Priority: Low — type-only imports; verify.`);
|
|
404
|
+
lines.push("");
|
|
405
|
+
lines.push("A type-only import is `import type`, `export type`, or an import list whose names are all marked `type` (*syntax*). In TypeScript files it is also an import whose names are interfaces or type aliases, or are used only in type positions (*inferred*). Inference is off under `verbatimModuleSyntax`, `preserveValueImports`, `importsNotUsedAsValues: \"preserve\"`, or `erasableSyntaxOnly`, which keep the import at runtime.");
|
|
406
|
+
lines.push("");
|
|
407
|
+
const limit = Math.min(reports.length, 20);
|
|
408
|
+
for (let i = 0; i < limit; i++) {
|
|
409
|
+
const report = reports[i];
|
|
410
|
+
const pathText = Array.isArray(report.path) ? report.path.join("` → `") : String(report.path);
|
|
411
|
+
lines.push(`${i + 1}. \`${pathText}\``);
|
|
412
|
+
const links = Array.isArray(report.typeOnlyLinks) ? report.typeOnlyLinks : [];
|
|
413
|
+
if (links.length > 0) {
|
|
414
|
+
const text = links.map((link) => `\`${link.from}\` → \`${link.to}\` (${link.reason === "inferred" ? "inferred" : "syntax"})`).join("; ");
|
|
415
|
+
lines.push(` Type-only link${links.length === 1 ? "" : "s"}: ${text}`);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
if (reports.length > 20) {
|
|
419
|
+
lines.push(`\n*...and ${reports.length - 20} more type-only cycles*`);
|
|
420
|
+
}
|
|
401
421
|
lines.push("");
|
|
402
422
|
}
|
|
403
423
|
|
|
@@ -434,7 +454,7 @@ export function renderDependencyGraph(depResult) {
|
|
|
434
454
|
|
|
435
455
|
lines.push("---");
|
|
436
456
|
lines.push("");
|
|
437
|
-
lines.push("*Generated by RepoLens import analysis. Dependency detection covers JavaScript and TypeScript (ES modules, dynamic import, CommonJS, re-exports; comments, strings,
|
|
457
|
+
lines.push("*Generated by RepoLens import analysis. Dependency detection covers JavaScript and TypeScript (ES modules, dynamic import, CommonJS, re-exports; comments, strings, and Node.js built-ins are skipped; type-only imports, including TypeScript imports whose names are used only as types, are not import edges), Python (`import` / `from ... import`, including relative imports; `TYPE_CHECKING` blocks are skipped), and Go (`go.mod` module paths, hubs grouped by package). Go `*_test.go` files are not part of the graph.*");
|
|
438
458
|
lines.push("");
|
|
439
459
|
|
|
440
460
|
return lines.join("\n");
|