@macrulez/devtoolz 0.1.0 → 0.2.0

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.
Files changed (129) hide show
  1. package/README.md +164 -3
  2. package/dist/cli.js +233 -0
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/circular-imports/core.d.ts +15 -0
  5. package/dist/commands/circular-imports/core.js +95 -0
  6. package/dist/commands/circular-imports/core.js.map +1 -0
  7. package/dist/commands/circular-imports/report.d.ts +3 -0
  8. package/dist/commands/circular-imports/report.js +41 -0
  9. package/dist/commands/circular-imports/report.js.map +1 -0
  10. package/dist/commands/circular-imports/run.d.ts +19 -0
  11. package/dist/commands/circular-imports/run.js +29 -0
  12. package/dist/commands/circular-imports/run.js.map +1 -0
  13. package/dist/commands/dead-exports/core.d.ts +1 -1
  14. package/dist/commands/dead-exports/core.js +2 -2
  15. package/dist/commands/dead-exports/core.js.map +1 -1
  16. package/dist/commands/dead-exports/entry.d.ts +0 -1
  17. package/dist/commands/dead-exports/entry.js +1 -14
  18. package/dist/commands/dead-exports/entry.js.map +1 -1
  19. package/dist/commands/dead-exports/run.js +3 -2
  20. package/dist/commands/dead-exports/run.js.map +1 -1
  21. package/dist/commands/empty-catch/core.d.ts +8 -0
  22. package/dist/commands/empty-catch/core.js +61 -0
  23. package/dist/commands/empty-catch/core.js.map +1 -0
  24. package/dist/commands/empty-catch/report.d.ts +3 -0
  25. package/dist/commands/empty-catch/report.js +27 -0
  26. package/dist/commands/empty-catch/report.js.map +1 -0
  27. package/dist/commands/empty-catch/run.d.ts +17 -0
  28. package/dist/commands/empty-catch/run.js +34 -0
  29. package/dist/commands/empty-catch/run.js.map +1 -0
  30. package/dist/commands/empty-catch/vue.d.ts +2 -0
  31. package/dist/commands/empty-catch/vue.js +16 -0
  32. package/dist/commands/empty-catch/vue.js.map +1 -0
  33. package/dist/commands/orphan-tests/core.d.ts +9 -0
  34. package/dist/commands/orphan-tests/core.js +42 -0
  35. package/dist/commands/orphan-tests/core.js.map +1 -0
  36. package/dist/commands/orphan-tests/report.d.ts +3 -0
  37. package/dist/commands/orphan-tests/report.js +30 -0
  38. package/dist/commands/orphan-tests/report.js.map +1 -0
  39. package/dist/commands/orphan-tests/run.d.ts +25 -0
  40. package/dist/commands/orphan-tests/run.js +55 -0
  41. package/dist/commands/orphan-tests/run.js.map +1 -0
  42. package/dist/commands/readme-check/run.js +8 -3
  43. package/dist/commands/readme-check/run.js.map +1 -1
  44. package/dist/commands/scripts-check/core.d.ts +18 -0
  45. package/dist/commands/scripts-check/core.js +121 -0
  46. package/dist/commands/scripts-check/core.js.map +1 -0
  47. package/dist/commands/scripts-check/report.d.ts +3 -0
  48. package/dist/commands/scripts-check/report.js +34 -0
  49. package/dist/commands/scripts-check/report.js.map +1 -0
  50. package/dist/commands/scripts-check/run.d.ts +15 -0
  51. package/dist/commands/scripts-check/run.js +81 -0
  52. package/dist/commands/scripts-check/run.js.map +1 -0
  53. package/dist/commands/stale-ts-ignore/check.d.ts +23 -0
  54. package/dist/commands/stale-ts-ignore/check.js +104 -0
  55. package/dist/commands/stale-ts-ignore/check.js.map +1 -0
  56. package/dist/commands/stale-ts-ignore/core.d.ts +11 -0
  57. package/dist/commands/stale-ts-ignore/core.js +42 -0
  58. package/dist/commands/stale-ts-ignore/core.js.map +1 -0
  59. package/dist/commands/stale-ts-ignore/report.d.ts +3 -0
  60. package/dist/commands/stale-ts-ignore/report.js +30 -0
  61. package/dist/commands/stale-ts-ignore/report.js.map +1 -0
  62. package/dist/commands/stale-ts-ignore/run.d.ts +23 -0
  63. package/dist/commands/stale-ts-ignore/run.js +101 -0
  64. package/dist/commands/stale-ts-ignore/run.js.map +1 -0
  65. package/dist/commands/stale-ts-ignore/vue.d.ts +9 -0
  66. package/dist/commands/stale-ts-ignore/vue.js +16 -0
  67. package/dist/commands/stale-ts-ignore/vue.js.map +1 -0
  68. package/dist/commands/strip-comments/core.js +2 -56
  69. package/dist/commands/strip-comments/core.js.map +1 -1
  70. package/dist/commands/todo-report/core.d.ts +16 -0
  71. package/dist/commands/todo-report/core.js +112 -0
  72. package/dist/commands/todo-report/core.js.map +1 -0
  73. package/dist/commands/todo-report/report.d.ts +3 -0
  74. package/dist/commands/todo-report/report.js +31 -0
  75. package/dist/commands/todo-report/report.js.map +1 -0
  76. package/dist/commands/todo-report/run.d.ts +22 -0
  77. package/dist/commands/todo-report/run.js +41 -0
  78. package/dist/commands/todo-report/run.js.map +1 -0
  79. package/dist/commands/todo-report/vue.d.ts +2 -0
  80. package/dist/commands/todo-report/vue.js +71 -0
  81. package/dist/commands/todo-report/vue.js.map +1 -0
  82. package/dist/commands/unused-deps/config-files.d.ts +9 -0
  83. package/dist/commands/unused-deps/config-files.js +64 -0
  84. package/dist/commands/unused-deps/config-files.js.map +1 -0
  85. package/dist/commands/unused-deps/core.d.ts +25 -0
  86. package/dist/commands/unused-deps/core.js +121 -0
  87. package/dist/commands/unused-deps/core.js.map +1 -0
  88. package/dist/commands/unused-deps/disk-resolve.d.ts +11 -0
  89. package/dist/commands/unused-deps/disk-resolve.js +40 -0
  90. package/dist/commands/unused-deps/disk-resolve.js.map +1 -0
  91. package/dist/commands/unused-deps/package-name.d.ts +8 -0
  92. package/dist/commands/unused-deps/package-name.js +20 -0
  93. package/dist/commands/unused-deps/package-name.js.map +1 -0
  94. package/dist/commands/unused-deps/report.d.ts +3 -0
  95. package/dist/commands/unused-deps/report.js +32 -0
  96. package/dist/commands/unused-deps/report.js.map +1 -0
  97. package/dist/commands/unused-deps/run.d.ts +18 -0
  98. package/dist/commands/unused-deps/run.js +68 -0
  99. package/dist/commands/unused-deps/run.js.map +1 -0
  100. package/dist/index.d.ts +51 -5
  101. package/dist/index.js +33 -3
  102. package/dist/index.js.map +1 -1
  103. package/dist/utils/escape-regexp.d.ts +1 -0
  104. package/dist/utils/escape-regexp.js +4 -0
  105. package/dist/utils/escape-regexp.js.map +1 -0
  106. package/dist/utils/find-comments.d.ts +10 -0
  107. package/dist/utils/find-comments.js +62 -0
  108. package/dist/utils/find-comments.js.map +1 -0
  109. package/dist/utils/find-package-dir.d.ts +2 -0
  110. package/dist/utils/find-package-dir.js +15 -0
  111. package/dist/utils/find-package-dir.js.map +1 -0
  112. package/dist/utils/line-of.d.ts +2 -0
  113. package/dist/utils/line-of.js +12 -0
  114. package/dist/utils/line-of.js.map +1 -0
  115. package/dist/utils/load-tsconfig.d.ts +20 -0
  116. package/dist/utils/load-tsconfig.js +33 -0
  117. package/dist/utils/load-tsconfig.js.map +1 -0
  118. package/dist/utils/parse-module.d.ts +32 -0
  119. package/dist/utils/parse-module.js +178 -0
  120. package/dist/utils/parse-module.js.map +1 -0
  121. package/dist/utils/resolve-specifier.d.ts +15 -0
  122. package/dist/utils/resolve-specifier.js +63 -0
  123. package/dist/utils/resolve-specifier.js.map +1 -0
  124. package/dist/utils/walk.js +20 -1
  125. package/dist/utils/walk.js.map +1 -1
  126. package/dist/utils/workspace.d.ts +14 -0
  127. package/dist/utils/workspace.js +101 -0
  128. package/dist/utils/workspace.js.map +1 -0
  129. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9,8 +9,19 @@ export { renderConsoleStripReport } from './commands/console-strip/report.js';
9
9
  export { analyzeDeadExports } from './commands/dead-exports/core.js';
10
10
  export { runDeadExports } from './commands/dead-exports/run.js';
11
11
  export { renderDeadExportsReport } from './commands/dead-exports/report.js';
12
- export { detectWorkspace } from './commands/dead-exports/workspace.js';
13
- export { resolvePublicEntries, findNearestPackageDir } from './commands/dead-exports/entry.js';
12
+ export { detectWorkspace } from './utils/workspace.js';
13
+ export { analyzeCircularImports } from './commands/circular-imports/core.js';
14
+ export { runCircularImports } from './commands/circular-imports/run.js';
15
+ export { renderCircularImportsReport } from './commands/circular-imports/report.js';
16
+ export { analyzeUnusedDeps } from './commands/unused-deps/core.js';
17
+ export { runUnusedDeps } from './commands/unused-deps/run.js';
18
+ export { renderUnusedDepsReport } from './commands/unused-deps/report.js';
19
+ export { packageNameFromSpecifier } from './commands/unused-deps/package-name.js';
20
+ export { resolvePackageDir, declaredBinNames } from './commands/unused-deps/disk-resolve.js';
21
+ export { analyzeFile } from './utils/parse-module.js';
22
+ export { resolveRelativeSpecifier } from './utils/resolve-specifier.js';
23
+ export { resolvePublicEntries } from './commands/dead-exports/entry.js';
24
+ export { findNearestPackageDir } from './utils/find-package-dir.js';
14
25
  export { checkSpecifierCase } from './commands/case-check/resolve-case.js';
15
26
  export { checkFile } from './commands/case-check/core.js';
16
27
  export { runCaseCheck } from './commands/case-check/run.js';
@@ -21,9 +32,28 @@ export { runExportsDoctor } from './commands/exports-doctor/run.js';
21
32
  export { renderExportsDoctorReport } from './commands/exports-doctor/report.js';
22
33
  export { extractCodeBlocks } from './commands/readme-check/extract.js';
23
34
  export { typecheckBlock } from './commands/readme-check/typecheck.js';
24
- export { loadCompilerOptions } from './commands/readme-check/tsconfig.js';
35
+ export { loadTsconfig } from './utils/load-tsconfig.js';
25
36
  export { checkMarkdownFile } from './commands/readme-check/core.js';
26
37
  export { runReadmeCheck } from './commands/readme-check/run.js';
27
38
  export { renderReadmeCheckReport } from './commands/readme-check/report.js';
39
+ export { analyzeEmptyCatch } from './commands/empty-catch/core.js';
40
+ export { analyzeEmptyCatchVue } from './commands/empty-catch/vue.js';
41
+ export { runEmptyCatch } from './commands/empty-catch/run.js';
42
+ export { renderEmptyCatchReport } from './commands/empty-catch/report.js';
43
+ export { analyzeTodoReport, buildTagMatcher, DEFAULT_TAGS } from './commands/todo-report/core.js';
44
+ export { analyzeTodoReportVue } from './commands/todo-report/vue.js';
45
+ export { runTodoReport } from './commands/todo-report/run.js';
46
+ export { renderTodoReportReport } from './commands/todo-report/report.js';
47
+ export { analyzeScriptsCheck, extractMentionedScripts, isScriptMentioned, isReservedLifecycleScript, } from './commands/scripts-check/core.js';
48
+ export { runScriptsCheck } from './commands/scripts-check/run.js';
49
+ export { renderScriptsCheckReport } from './commands/scripts-check/report.js';
50
+ export { parseTestFile, hasMatchingSource, candidateSourceDirs, } from './commands/orphan-tests/core.js';
51
+ export { runOrphanTests } from './commands/orphan-tests/run.js';
52
+ export { renderOrphanTestsReport } from './commands/orphan-tests/report.js';
53
+ export { findTsIgnoreDirectives, blankDirectives } from './commands/stale-ts-ignore/core.js';
54
+ export { extractVueScript, findVueTsIgnoreDirectives, } from './commands/stale-ts-ignore/vue.js';
55
+ export { runProjectTypecheck, checkIsolatedFile } from './commands/stale-ts-ignore/check.js';
56
+ export { runStaleTsIgnore } from './commands/stale-ts-ignore/run.js';
57
+ export { renderStaleTsIgnoreReport } from './commands/stale-ts-ignore/report.js';
28
58
  export { walk } from './utils/walk.js';
29
59
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAA;AAGjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AAEnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AAOnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAA;AAE/E,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AAQ/D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AAEjE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AAQjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAA;AAE7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAOpE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAG/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAA;AAE3E,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAA;AAGtE,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AAE9F,O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AE,MAAM,gCAAgC,CAAA;AAG/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAA;AAE3E,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA;AAG5F,OAAO,EACL,gBAAgB,EAChB,yBAAyB,GAE1B,MAAM,mCAAmC,CAAA;AAE1C,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AAE5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AAOpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAA;AAEhF,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA"}
@@ -0,0 +1 @@
1
+ export declare function escapeRegExp(s: string): string;
@@ -0,0 +1,4 @@
1
+ export function escapeRegExp(s) {
2
+ return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
3
+ }
4
+ //# sourceMappingURL=escape-regexp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escape-regexp.js","sourceRoot":"","sources":["../../src/utils/escape-regexp.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,YAAY,CAAC,CAAS;IACpC,OAAO,CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAA;AACjD,CAAC"}
@@ -0,0 +1,10 @@
1
+ import ts from 'typescript';
2
+ export type Range = [start: number, end: number];
3
+ /**
4
+ * Finds every REAL comment range in `text` — string/template/regex/JSX
5
+ * text contents are masked first (same length, so positions don't shift)
6
+ * so a `//` or `/*` inside one of those is never mistaken for a comment.
7
+ * Shared by `strip-comments` (deletes these ranges) and `todo-report`
8
+ * (reads their text) — same non-negotiable requirement, same fix.
9
+ */
10
+ export declare function findCommentRanges(text: string, sf: ts.SourceFile): Range[];
@@ -0,0 +1,62 @@
1
+ import ts from 'typescript';
2
+ const LITERAL_KINDS = new Set([
3
+ ts.SyntaxKind.StringLiteral,
4
+ ts.SyntaxKind.NoSubstitutionTemplateLiteral,
5
+ ts.SyntaxKind.TemplateHead,
6
+ ts.SyntaxKind.TemplateMiddle,
7
+ ts.SyntaxKind.TemplateTail,
8
+ ts.SyntaxKind.RegularExpressionLiteral,
9
+ ts.SyntaxKind.JsxText,
10
+ ]);
11
+ function findLiteralRanges(sf) {
12
+ const ranges = [];
13
+ function visit(node) {
14
+ if (LITERAL_KINDS.has(node.kind)) {
15
+ ranges.push([node.getStart(sf), node.getEnd()]);
16
+ }
17
+ ts.forEachChild(node, visit);
18
+ }
19
+ visit(sf);
20
+ return ranges;
21
+ }
22
+ function maskLiterals(text, ranges) {
23
+ // `ts.SourceFile` positions are UTF-16 CODE UNIT offsets (same as
24
+ // `string.length`/`charAt`) — `[...text]`/`Array.from(text)` iterate by
25
+ // CODE POINT instead, collapsing any surrogate pair (an emoji, or any
26
+ // character outside the BMP) into a single array element, drifting
27
+ // every later position. `split('')` is UTF-16-code-unit based, so it
28
+ // stays aligned with the parser's own positions.
29
+ const chars = text.split('');
30
+ for (const [s, e] of ranges) {
31
+ for (let i = s; i < e; i++) {
32
+ if (chars[i] !== '\n')
33
+ chars[i] = 'x';
34
+ }
35
+ }
36
+ return chars.join('');
37
+ }
38
+ function scanCommentRanges(maskedText) {
39
+ const ranges = [];
40
+ const scanner = ts.createScanner(ts.ScriptTarget.Latest, false, ts.LanguageVariant.Standard, maskedText);
41
+ let tok = scanner.scan();
42
+ while (tok !== ts.SyntaxKind.EndOfFileToken) {
43
+ if (tok === ts.SyntaxKind.SingleLineCommentTrivia ||
44
+ tok === ts.SyntaxKind.MultiLineCommentTrivia) {
45
+ ranges.push([scanner.getTokenStart(), scanner.getTokenEnd()]);
46
+ }
47
+ tok = scanner.scan();
48
+ }
49
+ return ranges;
50
+ }
51
+ /**
52
+ * Finds every REAL comment range in `text` — string/template/regex/JSX
53
+ * text contents are masked first (same length, so positions don't shift)
54
+ * so a `//` or `/*` inside one of those is never mistaken for a comment.
55
+ * Shared by `strip-comments` (deletes these ranges) and `todo-report`
56
+ * (reads their text) — same non-negotiable requirement, same fix.
57
+ */
58
+ export function findCommentRanges(text, sf) {
59
+ const masked = maskLiterals(text, findLiteralRanges(sf));
60
+ return scanCommentRanges(masked);
61
+ }
62
+ //# sourceMappingURL=find-comments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-comments.js","sourceRoot":"","sources":["../../src/utils/find-comments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAI3B,MAAM,aAAa,GAAG,IAAI,GAAG,CAAgB;IAC3C,EAAE,CAAC,UAAU,CAAC,aAAa;IAC3B,EAAE,CAAC,UAAU,CAAC,6BAA6B;IAC3C,EAAE,CAAC,UAAU,CAAC,YAAY;IAC1B,EAAE,CAAC,UAAU,CAAC,cAAc;IAC5B,EAAE,CAAC,UAAU,CAAC,YAAY;IAC1B,EAAE,CAAC,UAAU,CAAC,wBAAwB;IACtC,EAAE,CAAC,UAAU,CAAC,OAAO;CACtB,CAAC,CAAA;AAEF,SAAS,iBAAiB,CAAC,EAAiB;IAC1C,MAAM,MAAM,GAAY,EAAE,CAAA;IAC1B,SAAS,KAAK,CAAC,IAAa;QAC1B,IAAI,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACjC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;QACjD,CAAC;QACD,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IAC9B,CAAC;IACD,KAAK,CAAC,EAAE,CAAC,CAAA;IACT,OAAO,MAAM,CAAA;AACf,CAAC;AAED,SAAS,YAAY,CAAC,IAAY,EAAE,MAAe;IACjD,kEAAkE;IAClE,wEAAwE;IACxE,sEAAsE;IACtE,mEAAmE;IACnE,qEAAqE;IACrE,iDAAiD;IACjD,MAAM,KAAK,GAAG,I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AO,iBAAiB,CAAC,MAAM,CAAC,CAAA;AAClC,CAAC"}
@@ -0,0 +1,2 @@
1
+ /** Walks up from `startDir` to the nearest ancestor directory containing a `package.json`. */
2
+ export declare function findNearestPackageDir(startDir: string): string | null;
@@ -0,0 +1,15 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { dirname, join, resolve } from 'node:path';
3
+ /** Walks up from `startDir` to the nearest ancestor directory containing a `package.json`. */
4
+ export function findNearestPackageDir(startDir) {
5
+ let dir = resolve(startDir);
6
+ for (;;) {
7
+ if (existsSync(join(dir, 'package.json')))
8
+ return dir;
9
+ const parent = dirname(dir);
10
+ if (parent === dir)
11
+ return null;
12
+ dir = parent;
13
+ }
14
+ }
15
+ //# sourceMappingURL=find-package-dir.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-package-dir.js","sourceRoot":"","sources":["../../src/utils/find-package-dir.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAElD,8FAA8F;AAC9F,MAAM,UAAU,qBAAqB,CAAC,QAAgB;IACpD,IAAI,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC3B,SAAS,CAAC;QACR,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;YAAE,OAAO,GAAG,CAAA;QACrD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;QAC3B,IAAI,MAAM,KAAK,GAAG;YAAE,OAAO,IAAI,CAAA;QAC/B,GAAG,GAAG,MAAM,CAAA;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function lineOf(text: string, index: number): number;
2
+ export declare function columnOf(text: string, index: number): number;
@@ -0,0 +1,12 @@
1
+ // Plain-text line/column lookup for commands that scan prose/YAML instead
2
+ // of parsing an AST (`readme-check`'s own markdown extraction does this
3
+ // inline; pulled out here the moment a second non-AST text scanner
4
+ // needed the same thing — `scripts-check`).
5
+ export function lineOf(text, index) {
6
+ return (text.slice(0, index).match(/\n/g) ?? []).length + 1;
7
+ }
8
+ export function columnOf(text, index) {
9
+ const lastNewline = text.lastIndexOf('\n', index - 1);
10
+ return index - lastNewline;
11
+ }
12
+ //# sourceMappingURL=line-of.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"line-of.js","sourceRoot":"","sources":["../../src/utils/line-of.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,wEAAwE;AACxE,mEAAmE;AACnE,4CAA4C;AAE5C,MAAM,UAAU,MAAM,CAAC,IAAY,EAAE,KAAa;IAChD,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;AAC7D,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,KAAa;IAClD,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;IACrD,OAAO,KAAK,GAAG,WAAW,CAAA;AAC5B,CAAC"}
@@ -0,0 +1,20 @@
1
+ import ts from 'typescript';
2
+ export interface LoadedTsconfig {
3
+ options: ts.CompilerOptions;
4
+ /** every source file the project's tsconfig resolves to — absolute paths */
5
+ fileNames: string[];
6
+ configPath: string;
7
+ }
8
+ export type LoadTsconfigResult = LoadedTsconfig | {
9
+ error: string;
10
+ };
11
+ /**
12
+ * Resolves a real `ts.CompilerOptions` (plus the project's real file
13
+ * list) the way `tsc` itself would — auto-detecting `tsconfig.json` via
14
+ * `ts.findConfigFile`, or an explicit override. Shared by `readme-check`
15
+ * (only ever needs `options`, to typecheck one virtual file) and
16
+ * `stale-ts-ignore` (needs `fileNames` too, for a real whole-project
17
+ * typecheck) — extracted the moment the second consumer needed it, same
18
+ * as the rest of this project's shared infra.
19
+ */
20
+ export declare function loadTsconfig(packageDir: string, tsconfigOverride?: string): LoadTsconfigResult;
@@ -0,0 +1,33 @@
1
+ import ts from 'typescript';
2
+ import { dirname, resolve } from 'node:path';
3
+ /**
4
+ * Resolves a real `ts.CompilerOptions` (plus the project's real file
5
+ * list) the way `tsc` itself would — auto-detecting `tsconfig.json` via
6
+ * `ts.findConfigFile`, or an explicit override. Shared by `readme-check`
7
+ * (only ever needs `options`, to typecheck one virtual file) and
8
+ * `stale-ts-ignore` (needs `fileNames` too, for a real whole-project
9
+ * typecheck) — extracted the moment the second consumer needed it, same
10
+ * as the rest of this project's shared infra.
11
+ */
12
+ export function loadTsconfig(packageDir, tsconfigOverride) {
13
+ const configPath = tsconfigOverride
14
+ ? resolve(packageDir, tsconfigOverride)
15
+ : ts.findConfigFile(packageDir, ts.sys.fileExists, 'tsconfig.json');
16
+ if (!configPath || !ts.sys.fileExists(configPath)) {
17
+ return { error: `no tsconfig.json found under ${packageDir}` };
18
+ }
19
+ const read = ts.readConfigFile(configPath, ts.sys.readFile);
20
+ if (read.error) {
21
+ return { error: ts.flattenDiagnosticMessageText(read.error.messageText, '\n') };
22
+ }
23
+ const parsed = ts.parseJsonConfigFileContent(read.config, ts.sys, dirname(configPath));
24
+ if (parsed.errors.length > 0) {
25
+ return {
26
+ error: parsed.errors
27
+ .map((e) => ts.flattenDiagnosticMessageText(e.messageText, '\n'))
28
+ .join('\n'),
29
+ };
30
+ }
31
+ return { options: parsed.options, fileNames: parsed.fileNames, configPath };
32
+ }
33
+ //# sourceMappingURL=load-tsconfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load-tsconfig.js","sourceRoot":"","sources":["../../src/utils/load-tsconfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAW5C;;;;;;;;GAQG;AACH,MAAM,UA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,32 @@
1
+ export interface ExportedName {
2
+ name: string;
3
+ isType: boolean;
4
+ isDefault: boolean;
5
+ line: number;
6
+ }
7
+ export interface ReexportEntry {
8
+ /** the raw specifier, e.g. './core.js' */
9
+ from: string;
10
+ /** the name as exported by the SOURCE module, or '*' for `export * from`/`export * as x from` */
11
+ imported: string;
12
+ /** the name this file re-exports it as (may differ via `as`); '*' mirrors `imported` */
13
+ exportedAs: string;
14
+ isType: boolean;
15
+ }
16
+ export interface ImportedName {
17
+ /** the raw specifier */
18
+ from: string;
19
+ /** the name as exported by the source module, 'default', or '*' for a namespace import */
20
+ imported: string;
21
+ isType: boolean;
22
+ /** 1-based line of the import declaration itself, for commands that report on the import site */
23
+ line: number;
24
+ }
25
+ export interface FileAnalysis {
26
+ exports: ExportedName[];
27
+ reexports: ReexportEntry[];
28
+ imports: ImportedName[];
29
+ /** a dynamic import() whose argument isn't a string literal — can't be resolved, worth flagging */
30
+ hasUnresolvableDynamicImport: boolean;
31
+ }
32
+ export declare function analyzeFile(text: string, file: string): FileAnalysis;
@@ -0,0 +1,178 @@
1
+ // Per-file extraction of exports/imports via a real TS parse — no regex
2
+ // guessing at `export`/`import` keywords, so a string/comment containing
3
+ // those words is never mistaken for the real thing. Shared by every
4
+ // command that needs a file's import/export surface (dead-exports,
5
+ // circular-imports, unused-deps) — not specific to any one of them.
6
+ import ts from 'typescript';
7
+ function scriptKindFor(file) {
8
+ return file.endsWith('.tsx')
9
+ ? ts.ScriptKind.TSX
10
+ : file.endsWith('.jsx')
11
+ ? ts.ScriptKind.JSX
12
+ : ts.ScriptKind.TS;
13
+ }
14
+ function hasExportModifier(node) {
15
+ return (ts.canHaveModifiers(node) &&
16
+ (ts.getModifiers(node)?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword) ?? false));
17
+ }
18
+ function hasDefaultModifier(node) {
19
+ return (ts.canHaveModifiers(node) &&
20
+ (ts.getModifiers(node)?.some((m) => m.kind === ts.SyntaxKind.DefaultKeyword) ?? false));
21
+ }
22
+ // Not `ts.isImportCall` — that helper exists at runtime but isn't part of
23
+ // this TypeScript version's typed public API. A dynamic `import(...)`
24
+ // parses as a CallExpression whose callee is the `import` keyword itself
25
+ // used as an expression; checking that structurally is exactly what the
26
+ // untyped helper does internally.
27
+ function isDynamicImportCall(node) {
28
+ return ts.isCallExpression(node) && node.expression.kind === ts.SyntaxKind.ImportKeyword;
29
+ }
30
+ function collectBindingNames(name, out) {
31
+ // Only plain identifiers are attributed — `export const { a, b } = obj`
32
+ // (destructured) is a rare enough pattern for a top-level export that
33
+ // skipping it (rather than guessing) is the safer default.
34
+ if (ts.isIdentifier(name))
35
+ out.push(name.text);
36
+ }
37
+ export function analyzeFile(text, file) {
38
+ const sf = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, scriptKindFor(file));
39
+ function lineOf(node) {
40
+ return sf.getLineAndCharacterOfPosition(node.getStart(sf)).line + 1;
41
+ }
42
+ const exports = [];
43
+ const reexports = [];
44
+ const imports = [];
45
+ let hasUnresolvableDynamicImport = false;
46
+ for (const stmt of sf.statements) {
47
+ if (ts.isExportDeclaration(stmt)) {
48
+ const isTypeOnly = stmt.isTypeOnly;
49
+ const moduleSpecifier = stmt.moduleSpecifier && ts.isStringLiteral(stmt.moduleSpecifier)
50
+ ? stmt.moduleSpecifier.text
51
+ : null;
52
+ if (stmt.exportClause) {
53
+ if (ts.isNamedExports(stmt.exportClause)) {
54
+ for (const el of stmt.exportClause.elements) {
55
+ const importedName = (el.propertyName ?? el.name).text;
56
+ const exportedAs = el.name.text;
57
+ const elIsType = isTypeOnly || el.isTypeOnly;
58
+ if (moduleSpecifier) {
59
+ reexports.push({
60
+ from: moduleSpecifier,
61
+ imported: importedName,
62
+ exportedAs,
63
+ isType: elIsType,
64
+ });
65
+ }
66
+ else {
67
+ exports.push({
68
+ name: exportedAs,
69
+ isType: elIsType,
70
+ isDefault: false,
71
+ line: lineOf(el),
72
+ });
73
+ }
74
+ }
75
+ }
76
+ else if (ts.isNamespaceExport(stmt.exportClause) && moduleSpecifier) {
77
+ // `export * as ns from './y'` — ns itself is a real named export
78
+ // of THIS file (a namespace object), not traced further.
79
+ exports.push({
80
+ name: stmt.exportClause.name.text,
81
+ isType: isTypeOnly,
82
+ isDefault: false,
83
+ line: lineOf(stmt.exportClause),
84
+ });
85
+ }
86
+ }
87
+ else if (moduleSpecifier) {
88
+ // `export * from './y'` — every name './y' exports becomes
89
+ // reachable through this file too; resolved in core.ts once every
90
+ // file's own export list is known.
91
+ reexports.push({
92
+ from: moduleSpecifier,
93
+ imported: '*',
94
+ exportedAs: '*',
95
+ isType: isTypeOnly,
96
+ });
97
+ }
98
+ continue;
99
+ }
100
+ if (ts.isExportAssignment(stmt)) {
101
+ // `export default expr` and legacy `export = expr` both surface as
102
+ // this file's default-like export — see FileAnalysis' isDefault
103
+ // doc: usage detection for it is intentionally loose.
104
+ exports.push({ name: 'default', isType: false, isDefault: true, line: lineOf(stmt) });
105
+ continue;
106
+ }
107
+ if (ts.isImportDeclaration(stmt) && ts.isStringLiteral(stmt.moduleSpecifier)) {
108
+ const from = stmt.moduleSpecifier.text;
109
+ const clause = stmt.importClause;
110
+ const line = lineOf(stmt);
111
+ if (!clause)
112
+ continue; // bare `import './x'` — side-effect only, not a usage of any named export
113
+ if (clause.name)
114
+ imports.push({ from, imported: 'default', isType: clause.isTypeOnly, line });
115
+ if (clause.namedBindings) {
116
+ if (ts.isNamespaceImport(clause.namedBindings)) {
117
+ imports.push({ from, imported: '*', isType: clause.isTypeOnly, line });
118
+ }
119
+ else if (ts.isNamedImports(clause.namedBindings)) {
120
+ for (const el of clause.namedBindings.elements) {
121
+ const importedName = (el.propertyName ?? el.name).text;
122
+ imports.push({
123
+ from,
124
+ imported: importedName,
125
+ isType: clause.isTypeOnly || el.isTypeOnly,
126
+ line,
127
+ });
128
+ }
129
+ }
130
+ }
131
+ continue;
132
+ }
133
+ if (hasExportModifier(stmt)) {
134
+ const isType = ts.isTypeAliasDeclaration(stmt) || ts.isInterfaceDeclaration(stmt);
135
+ const isDefault = hasDefaultModifier(stmt);
136
+ if (ts.isVariableStatement(stmt)) {
137
+ for (const decl of stmt.declarationList.declarations) {
138
+ const names = [];
139
+ collectBindingNames(decl.name, names);
140
+ for (const name of names) {
141
+ exports.push({ name, isType: false, isDefault: false, line: lineOf(decl) });
142
+ }
143
+ }
144
+ }
145
+ else if ((ts.isFunctionDeclaration(stmt) ||
146
+ ts.isClassDeclaration(stmt) ||
147
+ ts.isInterfaceDeclaration(stmt) ||
148
+ ts.isTypeAliasDeclaration(stmt) ||
149
+ ts.isEnumDeclaration(stmt) ||
150
+ ts.isModuleDeclaration(stmt)) &&
151
+ stmt.name) {
152
+ const name = ts.isIdentifier(stmt.name) ? stmt.name.text : stmt.name.text;
153
+ exports.push({ name: isDefault ? 'default' : name, isType, isDefault, line: lineOf(stmt) });
154
+ }
155
+ }
156
+ }
157
+ // Dynamic import() calls can appear anywhere in an expression, not just
158
+ // at the top level — a full walk (not just top-level statements) is
159
+ // needed to find them all.
160
+ function visit(node) {
161
+ if (isDynamicImportCall(node)) {
162
+ const arg = node.arguments[0];
163
+ if (arg && ts.isStringLiteral(arg)) {
164
+ // A literal path we can resolve — conservatively treat the whole
165
+ // target module as used (see core.ts) rather than trying to trace
166
+ // which bindings a `const { x } = await import(...)` destructures.
167
+ imports.push({ from: arg.text, imported: '*', isType: false, line: lineOf(node) });
168
+ }
169
+ else {
170
+ hasUnresolvableDynamicImport = true;
171
+ }
172
+ }
173
+ ts.forEachChild(node, visit);
174
+ }
175
+ visit(sf);
176
+ return { exports, reexports, imports, hasUnresolvableDynamicImport };
177
+ }
178
+ //# sourceMappingURL=parse-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-module.js","sourceRoot":"","sources":["../../src/utils/parse-module.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,yEAAyE;AACzE,oEAAoE;AACpE,mEAAmE;AACnE,oEAAoE;AAEpE,OAAO,EAAE,MAAM,YAAY,CAA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a relative import specifier (`./foo`, `../bar/baz`) against
3
+ * the file that contains it to a real, existing file on disk — or `null`
4
+ * if nothing matches any of the conventions this project's commands rely
5
+ * on elsewhere (extensionless imports, NodeNext `.js`-means-`.ts`,
6
+ * directory-with-index). Only ever called with specifiers that already
7
+ * look relative (`.`/`..`-prefixed) — bare package specifiers are a
8
+ * separate concern (see utils/workspace.ts for the one case that needs
9
+ * to resolve those, to a sibling workspace package).
10
+ *
11
+ * Shared by every command that walks a local import graph
12
+ * (dead-exports, circular-imports, unused-deps) — not specific to any
13
+ * one of them.
14
+ */
15
+ export declare function resolveRelativeSpecifier(fromFile: string, specifier: string): string | null;
@@ -0,0 +1,63 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { dirname, join, resolve } from 'node:path';
3
+ const CANDIDATE_EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs'];
4
+ // A NodeNext-style project writes `import { x } from './core.js'` in a
5
+ // .ts file even though the real file on disk is `./core.ts` — the
6
+ // specifier names the file's post-build extension, not its source one
7
+ // (devtoolz's own codebase does exactly this — see src/cli.ts). When the
8
+ // literal specifier doesn't resolve, each of these swaps is tried too.
9
+ const NODENEXT_SWAPS = {
10
+ '.js': ['.ts', '.tsx'],
11
+ '.mjs': ['.mts'],
12
+ '.cjs': ['.cts'],
13
+ };
14
+ function tryFile(path) {
15
+ return existsSync(path) ? path : null;
16
+ }
17
+ /**
18
+ * Resolves a relative import specifier (`./foo`, `../bar/baz`) against
19
+ * the file that contains it to a real, existing file on disk — or `null`
20
+ * if nothing matches any of the conventions this project's commands rely
21
+ * on elsewhere (extensionless imports, NodeNext `.js`-means-`.ts`,
22
+ * directory-with-index). Only ever called with specifiers that already
23
+ * look relative (`.`/`..`-prefixed) — bare package specifiers are a
24
+ * separate concern (see utils/workspace.ts for the one case that needs
25
+ * to resolve those, to a sibling workspace package).
26
+ *
27
+ * Shared by every command that walks a local import graph
28
+ * (dead-exports, circular-imports, unused-deps) — not specific to any
29
+ * one of them.
30
+ */
31
+ export function resolveRelativeSpecifier(fromFile, specifier) {
32
+ const base = resolve(dirname(fromFile), specifier);
33
+ const direct = tryFile(base);
34
+ if (direct)
35
+ return direct;
36
+ const lastDot = base.lastIndexOf('.');
37
+ const lastSlash = Math.max(base.lastIndexOf('/'), base.lastIndexOf('\\'));
38
+ const hasExt = lastDot > lastSlash;
39
+ if (hasExt) {
40
+ const ext = base.slice(lastDot);
41
+ const withoutExt = base.slice(0, lastDot);
42
+ for (const swap of NODENEXT_SWAPS[ext] ?? []) {
43
+ const swapped = tryFile(withoutExt + swap);
44
+ if (swapped)
45
+ return swapped;
46
+ }
47
+ // Had an extension that didn't match anything above — don't also
48
+ // try appending a second extension or treating it as a directory.
49
+ return null;
50
+ }
51
+ for (const ext of CANDIDATE_EXTENSIONS) {
52
+ const withExt = tryFile(base + ext);
53
+ if (withExt)
54
+ return withExt;
55
+ }
56
+ for (const ext of CANDIDATE_EXTENSIONS) {
57
+ const withIndex = tryFile(join(base, `index${ext}`));
58
+ if (withIndex)
59
+ return withIndex;
60
+ }
61
+ return null;
62
+ }
63
+ //# sourceMappingURL=resolve-specifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-specifier.js","sourceRoot":"","sources":["../../src/utils/resolve-specifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAElD,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AAE3E,uEAAuE;AACvE,kEAAkE;AAClE,sEAAsE;AACtE,yEAAyE;AACzE,uEAAuE;AACvE,MAAM,cAAc,GAA6B;IAC/C,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,CAAC,MAAM,CAAC;IAChB,MA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AAC,CAAA;QACnC,IAAI,OAAO;YAAE,OAAO,OAAO,CAAA;IAC7B,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,oBAAoB,EAAE,CAAC;QACvC,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,GAAG,EAAE,CAAC,CAAC,CAAA;QACpD,IAAI,SAAS;YAAE,OAAO,SAAS,CAAA;IACjC,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -15,7 +15,26 @@ const ignore = require('ignore');
15
15
  // Every dev-toolz command that scans a tree agrees on this default —
16
16
  // listed once here instead of copy-pasted per command. `--ignore` (per
17
17
  // command) adds to this, it never has to re-list these.
18
- const DEFAULT_IGNORES = ['node_modules', 'dist', 'build', '.git', 'coverage'];
18
+ //
19
+ // `.nuxt`/`.output`/`.next` — real dogfooding against vue-image-kit's
20
+ // `demo-nuxt/` (2026-09-25, empty-catch) found minified build output
21
+ // getting scanned as real source, producing nonsense findings at
22
+ // column 138282 in a single-line bundle. `.gitignore` support alone
23
+ // doesn't catch this: it only reads the root `<cwd>/.gitignore`, not a
24
+ // nested project's own one (`demo-nuxt` here has its own, several
25
+ // levels down) — so a framework's own well-known build-output
26
+ // directory name needs to be a hardcoded default, the same as
27
+ // `dist`/`build` already are, not left to `.gitignore` to catch.
28
+ const DEFAULT_IGNORES = [
29
+ 'node_modules',
30
+ 'dist',
31
+ 'build',
32
+ '.git',
33
+ 'coverage',
34
+ '.nuxt',
35
+ '.output',
36
+ '.next',
37
+ ];
19
38
  function buildMatcher(options) {
20
39
  const matcher = ignore();
21
40
  matcher.add(DEFAULT_IGNORES);
@@ -1 +1 @@
1
- {"version":3,"file":"walk.js","sourceRoot":"","sources":["../../src/utils/walk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAC7D,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAA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