@component-compass/cli 0.0.3 → 0.0.5

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 (101) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/commands/init.js +1 -3
  3. package/dist/commands/init.js.map +1 -1
  4. package/dist/commands/scan.d.ts +12 -1
  5. package/dist/commands/scan.js +158 -55
  6. package/dist/commands/scan.js.map +1 -1
  7. package/dist/config/loader.js +5 -9
  8. package/dist/config/loader.js.map +1 -1
  9. package/dist/config/schema.d.ts +2 -15
  10. package/dist/config/schema.js.map +1 -1
  11. package/dist/envelope/index.d.ts +0 -9
  12. package/dist/envelope/index.js +1 -46
  13. package/dist/envelope/index.js.map +1 -1
  14. package/dist/identity.d.ts +11 -15
  15. package/dist/identity.js +29 -20
  16. package/dist/identity.js.map +1 -1
  17. package/dist/index.d.ts +2 -0
  18. package/dist/index.js +1 -0
  19. package/dist/index.js.map +1 -1
  20. package/dist/local-index/detect-react.d.ts +2 -1
  21. package/dist/local-index/detect-react.js +135 -115
  22. package/dist/local-index/detect-react.js.map +1 -1
  23. package/dist/local-index/detect-vue.d.ts +15 -1
  24. package/dist/local-index/detect-vue.js +130 -107
  25. package/dist/local-index/detect-vue.js.map +1 -1
  26. package/dist/local-index/detect-wc.d.ts +7 -1
  27. package/dist/local-index/detect-wc.js +56 -60
  28. package/dist/local-index/detect-wc.js.map +1 -1
  29. package/dist/local-index/index.d.ts +11 -6
  30. package/dist/local-index/index.js +25 -27
  31. package/dist/local-index/index.js.map +1 -1
  32. package/dist/manifest/barrel-parser.d.ts +10 -0
  33. package/dist/manifest/barrel-parser.js +11 -0
  34. package/dist/manifest/barrel-parser.js.map +1 -1
  35. package/dist/manifest/derived-manifest-stub.d.ts +15 -6
  36. package/dist/manifest/derived-manifest-stub.js +43 -7
  37. package/dist/manifest/derived-manifest-stub.js.map +1 -1
  38. package/dist/manifest/lazy-resolver.d.ts +42 -16
  39. package/dist/manifest/lazy-resolver.js +122 -49
  40. package/dist/manifest/lazy-resolver.js.map +1 -1
  41. package/dist/occurrences.js +20 -4
  42. package/dist/occurrences.js.map +1 -1
  43. package/dist/parse-by-ext.d.ts +21 -0
  44. package/dist/parse-by-ext.js +53 -0
  45. package/dist/parse-by-ext.js.map +1 -0
  46. package/dist/reporter/index.d.ts +5 -21
  47. package/dist/reporter/index.js +6 -52
  48. package/dist/reporter/index.js.map +1 -1
  49. package/dist/reporter/stdout.js +4 -4
  50. package/dist/reporter/stdout.js.map +1 -1
  51. package/dist/rollup.d.ts +5 -4
  52. package/dist/rollup.js +7 -4
  53. package/dist/rollup.js.map +1 -1
  54. package/dist/scan/cem-index.d.ts +38 -0
  55. package/dist/scan/cem-index.js +139 -0
  56. package/dist/scan/cem-index.js.map +1 -0
  57. package/dist/scan/git-mtime.d.ts +2 -0
  58. package/dist/scan/git-mtime.js +22 -0
  59. package/dist/scan/git-mtime.js.map +1 -0
  60. package/dist/scan/meta.d.ts +5 -0
  61. package/dist/scan/meta.js +58 -0
  62. package/dist/scan/meta.js.map +1 -0
  63. package/dist/scan/stamp-deprecated.d.ts +16 -0
  64. package/dist/scan/stamp-deprecated.js +33 -0
  65. package/dist/scan/stamp-deprecated.js.map +1 -0
  66. package/dist/scan/stamp-version.d.ts +18 -0
  67. package/dist/scan/stamp-version.js +94 -0
  68. package/dist/scan/stamp-version.js.map +1 -0
  69. package/dist/seeds.d.ts +18 -18
  70. package/dist/seeds.js +82 -45
  71. package/dist/seeds.js.map +1 -1
  72. package/dist/types.d.ts +2 -5
  73. package/dist/util/git.d.ts +8 -0
  74. package/dist/util/git.js +73 -0
  75. package/dist/util/git.js.map +1 -1
  76. package/dist/util/progress.d.ts +21 -0
  77. package/dist/util/progress.js +54 -0
  78. package/dist/util/progress.js.map +1 -0
  79. package/dist/walker/files.d.ts +1 -0
  80. package/dist/walker/files.js +11 -5
  81. package/dist/walker/files.js.map +1 -1
  82. package/dist/workspace/find-owning-package.d.ts +6 -0
  83. package/dist/workspace/find-owning-package.js +22 -2
  84. package/dist/workspace/find-owning-package.js.map +1 -1
  85. package/dist/workspace/index.d.ts +1 -1
  86. package/dist/workspace/index.js +1 -1
  87. package/dist/workspace/index.js.map +1 -1
  88. package/package.json +13 -7
  89. package/schema/config.schema.json +2 -24
  90. package/dist/commands/no-deps-diagnostic.d.ts +0 -15
  91. package/dist/commands/no-deps-diagnostic.js +0 -23
  92. package/dist/commands/no-deps-diagnostic.js.map +0 -1
  93. package/dist/config/tag-rules.d.ts +0 -2
  94. package/dist/config/tag-rules.js +0 -34
  95. package/dist/config/tag-rules.js.map +0 -1
  96. package/dist/local-index/walker.d.ts +0 -11
  97. package/dist/local-index/walker.js +0 -47
  98. package/dist/local-index/walker.js.map +0 -1
  99. package/dist/manifest/diagnostic-filter.d.ts +0 -13
  100. package/dist/manifest/diagnostic-filter.js +0 -36
  101. package/dist/manifest/diagnostic-filter.js.map +0 -1
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Rate-limited progress reporter for the scan loop. Emits a single line on
3
+ * stderr — rewriting in place when stderr is a TTY, appending one line per
4
+ * tick otherwise (CI logs).
5
+ *
6
+ * Rate limit: emit when either ≥50 ticks have happened since the last emit
7
+ * OR ≥250ms have elapsed. Tuned so the line moves smoothly on TTYs without
8
+ * spamming non-TTY logs.
9
+ */
10
+ const COUNT_THRESHOLD = 50;
11
+ const TIME_THRESHOLD_MS = 250;
12
+ export function createProgress(opts) {
13
+ const start = Date.now();
14
+ let processed = 0;
15
+ let lastEmitCount = -1; // forces emission on the first tick
16
+ let lastEmitTime = 0;
17
+ const label = opts.label ?? "Scanned";
18
+ function emit() {
19
+ const pct = opts.total > 0 ? ((processed / opts.total) * 100).toFixed(1) : "0.0";
20
+ const elapsedS = ((Date.now() - start) / 1000).toFixed(1);
21
+ const body = `${label} ${processed} / ${opts.total} files (${pct}%) — ${elapsedS}s elapsed`;
22
+ if (opts.isTTY) {
23
+ opts.writer(`\r${body}\x1b[K`);
24
+ }
25
+ else {
26
+ opts.writer(`${body}\n`);
27
+ }
28
+ lastEmitCount = processed;
29
+ lastEmitTime = Date.now();
30
+ }
31
+ return {
32
+ tick() {
33
+ processed += 1;
34
+ // sinceEmit counts the current tick, so the COUNT_THRESHOLDth tick since
35
+ // the last emit fires this branch (e.g. with threshold 50: emit at the
36
+ // 1st tick, then at the 50th, 99th, …). Always emit on the final tick
37
+ // so the bar shows 100% before the next phase starts.
38
+ const sinceEmit = processed - lastEmitCount;
39
+ const elapsedSinceEmit = Date.now() - lastEmitTime;
40
+ if (lastEmitCount === -1 ||
41
+ sinceEmit >= COUNT_THRESHOLD - 1 ||
42
+ elapsedSinceEmit >= TIME_THRESHOLD_MS ||
43
+ processed === opts.total) {
44
+ emit();
45
+ }
46
+ },
47
+ done() {
48
+ if (opts.isTTY && lastEmitCount > 0) {
49
+ opts.writer("\r\x1b[K");
50
+ }
51
+ },
52
+ };
53
+ }
54
+ //# sourceMappingURL=progress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progress.js","sourceRoot":"","sources":["../../src/util/progress.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAeH,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,MAAM,UAAU,cAAc,CAAC,IAAqB;IAClD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACzB,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,IAAI,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC,oCAAoC;IAC5D,IAAI,YAAY,GAAG,CAAC,CAAC;IAErB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,SAAS,CAAC;IAEtC,SAAS,IAAI;QACX,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC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];
4
4
  exclude: string[];
5
+ gitignore: boolean;
5
6
  };
6
7
  export declare function walkFiles(opts: WalkOptions): Promise<string[]>;
@@ -1,12 +1,18 @@
1
- import { glob } from "glob";
1
+ import { globby } from "globby";
2
2
  export async function walkFiles(opts) {
3
- const matched = await glob(opts.include, {
3
+ // `dot: false` skips `.next/`, `.nuxt/`, `.turbo/`, etc. unless the user
4
+ // explicitly globs them in. `gitignore: true` is the default at the config
5
+ // layer; the explicit knob exists so users can opt out for WIP scans of
6
+ // untracked work. `suppressErrors` silences EACCES on unreadable dirs
7
+ // (vendored fixtures, transient OS turds) — the walker keeps going.
8
+ return globby(opts.include, {
4
9
  cwd: opts.root,
5
- nodir: true,
6
- absolute: true,
7
10
  ignore: opts.exclude,
11
+ gitignore: opts.gitignore,
8
12
  dot: false,
13
+ absolute: true,
14
+ onlyFiles: true,
15
+ suppressErrors: true,
9
16
  });
10
- return matched;
11
17
  }
12
18
  //# sourceMappingURL=files.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/walker/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAQ5B,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,IAAiB;IAC/C,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;QACvC,GAAG,EAAE,IAAI,CAAC,IAAI;QACd,KAAK,EAAE,IAAI;QACX,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,IAAI,CAAC,OAAO;QACpB,GAAG,EAAE,KAAK;KACX,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC"}
1
+ {"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/walker/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAShC,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,IAAiB;IAC/C,yEAAyE;IACzE,2EAA2E;IAC3E,wEAAwE;IACxE,sEAAsE;IACtE,oEAAoE;IACpE,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE;QAC1B,GAAG,EAAE,IAAI,CAAC,IAAI;QACd,MAAM,EAAE,IAAI,CAAC,OAAO;QACpB,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,GAAG,EAAE,KAAK;QACV,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,IAAI;QACf,cAAc,EAAE,IAAI;KACrB,CAAC,CAAC;AACL,CAAC"}
@@ -1,2 +1,8 @@
1
1
  import type { WorkspaceGraph, WorkspacePackage } from "./types.js";
2
2
  export declare function findOwningPackage(graph: WorkspaceGraph, filePath: string): WorkspacePackage | null;
3
+ /**
4
+ * Reset the realpath memoization cache. Call between scans (or in test
5
+ * setup) when filesystem state may have changed. Within a single scan,
6
+ * realpath results are stable and cache hits are correct.
7
+ */
8
+ export declare function resetFindOwningPackageCache(): void;
@@ -5,8 +5,14 @@
5
5
  *
6
6
  * Returns the WorkspacePackage with the longest absolutePath that is a path
7
7
  * prefix of the resolved input. Null when no package owns the file.
8
+ *
9
+ * Performance: realpath results are memoized per scan. Without caching this
10
+ * is the dominant cost on workspace-heavy monorepos — every call did 1 + N
11
+ * realpath syscalls (input + every workspace package, every time). Now it's
12
+ * O(1) on warm cache.
8
13
  */
9
14
  import { realpathSync } from "node:fs";
15
+ const realpathCache = new Map();
10
16
  export function findOwningPackage(graph, filePath) {
11
17
  if (graph.packages.length === 0)
12
18
  return null;
@@ -32,13 +38,27 @@ export function findOwningPackage(graph, filePath) {
32
38
  }
33
39
  return best;
34
40
  }
41
+ /**
42
+ * Reset the realpath memoization cache. Call between scans (or in test
43
+ * setup) when filesystem state may have changed. Within a single scan,
44
+ * realpath results are stable and cache hits are correct.
45
+ */
46
+ export function resetFindOwningPackageCache() {
47
+ realpathCache.clear();
48
+ }
35
49
  function resolveRealpath(filePath) {
50
+ const hit = realpathCache.get(filePath);
51
+ if (hit !== undefined)
52
+ return hit;
53
+ let resolved;
36
54
  try {
37
- return realpathSync(filePath);
55
+ resolved = realpathSync(filePath);
38
56
  }
39
57
  catch {
40
- return filePath;
58
+ resolved = filePath;
41
59
  }
60
+ realpathCache.set(filePath, resolved);
61
+ return resolved;
42
62
  }
43
63
  function isPathPrefix(prefix, candidate) {
44
64
  if (candidate === prefix)
@@ -1 +1 @@
1
- {"version":3,"file":"find-owning-package.js","sourceRoot":"","sources":["../../src/workspace/find-owning-package.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,MAAM,UAAU,iBAAiB,CAC/B,KAAqB,EACrB,QAAgB;IAEhB,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7C,MAAM,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC3C,IAAI,IAAI,GAA4B,IAAI,CAAC;IACzC,IAAI,aAAa,GAAG,CAAC,CAAC,CAAC;IACvB,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QACjC,kEAAkE;QAClE,2EAA2E;QAC3E,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAClD,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC;YAAE,SAAS;QAC/C,mEAAmE;QACnE,oEAAoE;QACpE,yEAAyE;QACzE,yEAAyE;QACzE,IAAI,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC;YAAE,SAAS;QACxE,IAAI,OAAO,CAAC,MAAM,GAAG,aAAa,EAAE,CAAC;YACnC,IAAI,GAAG,GAAG,CAAC;YACX,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;QACjC,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED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AQ,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC;YAAE,SAAS;QACxE,IAAI,OAAO,CAAC,MAAM,GAAG,aAAa,EAAE,CAAC;YACnC,IAAI,GAAG,GAAG,CAAC;YACX,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;QACjC,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,2BAA2B;IACzC,aAAa,CAAC,KAAK,EAAE,CAAC;AACxB,CAAC;AAED,SAAS,eAAe,CAAC,QAAgB;IACvC,MAAM,GAAG,GAAG,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACxC,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,GAAG,CAAC;IAClC,IAAI,QAAgB,CAAC;IACrB,IAAI,CAAC;QACH,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,QAAQ,GAAG,QAAQ,CAAC;IACtB,CAAC;IACD,aAAa,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACtC,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,YAAY,CAAC,MAAc,EAAE,SAAiB;IACrD,IAAI,SAAS,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC;IACtC,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,CAAC;IAC7D,OAAO,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AACvC,CAAC"}
@@ -1,4 +1,4 @@
1
1
  export { buildWorkspaceGraph } from "./build-graph.js";
2
2
  export { declaredDeps } from "./declared-deps.js";
3
- export { findOwningPackage } from "./find-owning-package.js";
3
+ export { findOwningPackage, resetFindOwningPackageCache, } from "./find-owning-package.js";
4
4
  export type { PackageManager, WorkspaceGraph, WorkspacePackage } from "./types.js";
@@ -1,4 +1,4 @@
1
1
  export { buildWorkspaceGraph } from "./build-graph.js";
2
2
  export { declaredDeps } from "./declared-deps.js";
3
- export { findOwningPackage } from "./find-owning-package.js";
3
+ export { findOwningPackage, resetFindOwningPackageCache, } from "./find-owning-package.js";
4
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/workspace/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/workspace/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACL,iBAAiB,EACjB,2BAA2B,GAC5B,MAAM,0BAA0B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@component-compass/cli",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Open-source CLI for measuring design-system component usage across multi-framework consumer repos.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -35,21 +35,27 @@
35
35
  "dependencies": {
36
36
  "@babel/parser": "^7.29.3",
37
37
  "@babel/types": "^7.29.0",
38
- "@component-compass/ast-utils": "^0.0.3",
39
- "@component-compass/parser-html": "^0.0.3",
40
- "@component-compass/parser-lit": "^0.0.3",
41
- "@component-compass/parser-react": "^0.0.3",
42
- "@component-compass/parser-vue": "^0.0.3",
43
- "@component-compass/plugin-core": "^0.0.3",
38
+ "@component-compass/ast-utils": "^0.0.4",
39
+ "@component-compass/manifest-react": "^0.0.5",
40
+ "@component-compass/manifest-vue": "^0.0.5",
41
+ "@component-compass/parser-html": "^0.0.5",
42
+ "@component-compass/parser-lit": "^0.0.5",
43
+ "@component-compass/parser-react": "^0.0.5",
44
+ "@component-compass/parser-vue": "^0.0.5",
45
+ "@component-compass/plugin-core": "^0.0.5",
44
46
  "@vue/compiler-sfc": "^3.5.33",
45
47
  "ajv": "^8.20.0",
46
48
  "glob": "^13.0.0",
47
49
  "globby": "^16.2.0",
48
50
  "js-yaml": "^4",
51
+ "oxc-parser": "^0.130.0",
52
+ "oxc-walker": "^1.0.0",
53
+ "parse5": "^8.0.0",
49
54
  "picomatch": "^4.0.4",
50
55
  "ulid": "^3.0.2"
51
56
  },
52
57
  "devDependencies": {
58
+ "@oxc-project/types": "^0.130.0",
53
59
  "@types/js-yaml": "^4",
54
60
  "@types/node": "^24.0.0",
55
61
  "@types/picomatch": "^4.0.3",
@@ -4,14 +4,10 @@
4
4
  "title": "component-compass config",
5
5
  "type": "object",
6
6
  "additionalProperties": false,
7
- "required": ["repoId", "include"],
7
+ "required": ["include"],
8
8
  "properties": {
9
9
  "$schema": { "type": "string" },
10
10
  "repoId": { "type": "string", "minLength": 1 },
11
- "packageScopes": {
12
- "type": "array",
13
- "items": { "type": "string", "minLength": 1 }
14
- },
15
11
  "include": {
16
12
  "type": "array",
17
13
  "items": { "type": "string", "minLength": 1 },
@@ -22,6 +18,7 @@
22
18
  "items": { "type": "string", "minLength": 1 }
23
19
  },
24
20
  "captureValues": { "type": "boolean" },
21
+ "gitignore": { "type": "boolean" },
25
22
  "output": { "type": "string", "minLength": 1 },
26
23
  "tsconfigPath": { "type": "string", "minLength": 1 },
27
24
  "aliases": {
@@ -30,25 +27,6 @@
30
27
  "type": "array",
31
28
  "items": { "type": "string", "minLength": 1 }
32
29
  }
33
- },
34
- "tagRules": {
35
- "type": "array",
36
- "items": {
37
- "type": "object",
38
- "required": ["tag", "match"],
39
- "additionalProperties": false,
40
- "properties": {
41
- "tag": { "type": "string", "minLength": 1 },
42
- "match": {
43
- "type": "object",
44
- "required": ["packageName"],
45
- "additionalProperties": false,
46
- "properties": {
47
- "packageName": { "type": "string", "minLength": 1 }
48
- }
49
- }
50
- }
51
- }
52
30
  }
53
31
  }
54
32
  }
@@ -1,15 +0,0 @@
1
- import type { Diagnostic } from "@component-compass/plugin-core";
2
- import type { WorkspaceGraph } from "../workspace/types.js";
3
- export type NoDepsMatchScopesDiagnostic = Extract<Diagnostic, {
4
- code: "no-deps-match-scopes";
5
- }>;
6
- /**
7
- * Surfaces a common configuration mistake: the user declared `packageScopes`
8
- * but none of the declared deps across root + workspace siblings matched any
9
- * scope. Typical causes are a typo in the glob, scanning outside the
10
- * directory containing the monorepo's package.json, or deps not installed.
11
- *
12
- * Returns `null` when there is nothing to report (no scopes declared, or at
13
- * least one dep matched). Caller is responsible for emission.
14
- */
15
- export declare function computeNoDepsMatchScopes(packageScopes: readonly string[], warmedRoots: readonly string[], graph: WorkspaceGraph): NoDepsMatchScopesDiagnostic | null;
@@ -1,23 +0,0 @@
1
- /**
2
- * Surfaces a common configuration mistake: the user declared `packageScopes`
3
- * but none of the declared deps across root + workspace siblings matched any
4
- * scope. Typical causes are a typo in the glob, scanning outside the
5
- * directory containing the monorepo's package.json, or deps not installed.
6
- *
7
- * Returns `null` when there is nothing to report (no scopes declared, or at
8
- * least one dep matched). Caller is responsible for emission.
9
- */
10
- export function computeNoDepsMatchScopes(packageScopes, warmedRoots, graph) {
11
- if (packageScopes.length === 0)
12
- return null;
13
- if (warmedRoots.length > 0)
14
- return null;
15
- return {
16
- code: "no-deps-match-scopes",
17
- severity: "info",
18
- packageScopes,
19
- packageManager: graph.packageManager,
20
- workspacePackageCount: graph.packages.length,
21
- };
22
- }
23
- //# sourceMappingURL=no-deps-diagnostic.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"no-deps-diagnostic.js","sourceRoot":"","sources":["../../src/commands/no-deps-diagnostic.ts"],"names":[],"mappings":"AAQA;;;;;;;;GAQG;AACH,MAAM,UAAU,wBAAwB,CACtC,aAAgC,EAChC,WAA8B,EAC9B,KAAqB;IAErB,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC5C,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACxC,OAAO;QACL,IAAI,EAAE,sBAAsB;QAC5B,QAAQ,EAAE,MAAM;QAChB,aAAa;QACb,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,qBAAqB,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM;KAC7C,CAAC;AACJ,CAAC"}
@@ -1,2 +0,0 @@
1
- import type { TagRule } from "./schema.js";
2
- export declare function evaluateTagRules(packageName: string | null, rules: TagRule[] | undefined): string[];
@@ -1,34 +0,0 @@
1
- /**
2
- * Pre-computes the list of tags that apply to a Component identity given its
3
- * resolved `packageName` and the user's configured `tagRules`. Pure function;
4
- * called once per Component during scan-time identity assembly.
5
- *
6
- * v1 rules match by `packageName` only, with `*` as the sole glob metacharacter
7
- * (zero-or-more chars). All other regex metacharacters are escaped so patterns
8
- * are interpreted literally. See spec §6.
9
- *
10
- * Local components (those without a resolved package) have `packageName === null`
11
- * and never match any rule.
12
- */
13
- const REGEX_META = /[.+?^${}()|[\]\\]/g;
14
- const cache = new Map();
15
- function matcher(pattern) {
16
- const cached = cache.get(pattern);
17
- if (cached)
18
- return cached;
19
- const compiled = new RegExp(`^${pattern.replace(REGEX_META, "\\$&").replace(/\*/g, ".*")}$`);
20
- cache.set(pattern, compiled);
21
- return compiled;
22
- }
23
- export function evaluateTagRules(packageName, rules) {
24
- if (packageName === null || !rules || rules.length === 0)
25
- return [];
26
- const tags = [];
27
- for (const rule of rules) {
28
- if (matcher(rule.match.packageName).test(packageName)) {
29
- tags.push(rule.tag);
30
- }
31
- }
32
- return tags;
33
- }
34
- //# sourceMappingURL=tag-rules.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tag-rules.js","sourceRoot":"","sources":["../../src/config/tag-rules.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAEH,MAAM,UAAU,GAAG,oBAAoB,CAAC;AAExC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;AAExC,SAAS,OAAO,CAAC,OAAe;IAC9B,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAClC,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAC1B,MAAM,QAAQ,GAAG,IAAI,MAAM,CACzB,IAAI,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAChE,CAAC;IACF,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC7B,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,WAA0B,EAC1B,KAA4B;IAE5B,IAAI,WAAW,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACpE,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;YACtD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,11 +0,0 @@
1
- export type WalkedFile = {
2
- absolutePath: string;
3
- filePath: string;
4
- extension: string;
5
- source: string;
6
- };
7
- export type WalkOptions = {
8
- repoRoot: string;
9
- extraIgnoreGlobs?: string[];
10
- };
11
- export declare function walkLocalSources(opts: WalkOptions): Promise<WalkedFile[]>;
@@ -1,47 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
- import { extname, relative } from "node:path";
3
- import { posixPath } from "@component-compass/ast-utils";
4
- import { globby } from "globby";
5
- const DEFAULT_IGNORES = [
6
- "**/node_modules/**",
7
- "**/dist/**",
8
- "**/build/**",
9
- "**/.next/**",
10
- "**/.nuxt/**",
11
- "**/coverage/**",
12
- "**/*.test.*",
13
- "**/*.spec.*",
14
- "**/__tests__/**",
15
- "**/*.stories.*",
16
- ];
17
- const DEFAULT_EXTENSIONS = [".tsx", ".jsx", ".ts", ".js", ".vue"];
18
- export async function walkLocalSources(opts) {
19
- const ignore = [...DEFAULT_IGNORES, ...(opts.extraIgnoreGlobs ?? [])];
20
- const matched = await globby(["**/*"], {
21
- cwd: opts.repoRoot,
22
- gitignore: true,
23
- ignore,
24
- absolute: true,
25
- onlyFiles: true,
26
- });
27
- const out = [];
28
- for (const abs of matched) {
29
- if (!DEFAULT_EXTENSIONS.includes(extname(abs)))
30
- continue;
31
- let source;
32
- try {
33
- source = readFileSync(abs, "utf8");
34
- }
35
- catch {
36
- continue;
37
- }
38
- out.push({
39
- absolutePath: abs,
40
- filePath: posixPath(relative(opts.repoRoot, abs)),
41
- extension: extname(abs),
42
- source,
43
- });
44
- }
45
- return out;
46
- }
47
- //# sourceMappingURL=walker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"walker.js","sourceRoot":"","sources":["../../src/local-index/walker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,eAAe,GAAG;IACtB,oBAAoB;IACpB,YAAY;IACZ,aAAa;IACb,aAAa;IACb,aAAa;IACb,gBAAgB;IAChB,aAAa;IACb,aAAa;IACb,iBAAiB;IACjB,gBAAgB;CACjB,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAclE,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAAiB;IACtD,MAAM,MAAM,GAAG,CAAC,GAAG,eAAe,EAAE,GAAG,CAAC,IAAI,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC,CAAC;IACtE,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,CAAC,MAAM,CAAC,EAAE;QACrC,GAAG,EAAE,IAAI,CAAC,QAAQ;QAClB,SAAS,EAAE,IAAI;QACf,MAAM;QACN,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC;IACH,MAAM,GAAG,GAAiB,EAAE,CAAC;IAC7B,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAAE,SAAS;QACzD,IAAI,MAAc,CAAC;QACnB,IAAI,CAAC;YACH,MAAM,GAAG,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACrC,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;QACD,GAAG,CAAC,IAAI,CAAC;YACP,YAAY,EAAE,GAAG;YACjB,QAAQ,EAAE,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;YACjD,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC;YACvB,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1,13 +0,0 @@
1
- import type { Diagnostic } from "@component-compass/plugin-core";
2
- /**
3
- * Builds the predicate scan.ts uses to decide whether a resolver diagnostic
4
- * should reach stderr.
5
- *
6
- * Empty `packageScopes` is the explicit "no filter" signal — every
7
- * diagnostic surfaces. Otherwise the scopes act as an allowlist matched
8
- * against the diagnostic's `packageName`. A diagnostic with no resolvable
9
- * `packageName` is dropped under an active filter (we cannot prove the
10
- * source is in scope, so it is treated as out-of-scope noise) — except
11
- * scan-level codes, which are workspace-config signals and always surface.
12
- */
13
- export declare function buildDiagnosticGate(packageScopes: string[]): (d: Diagnostic) => boolean;
@@ -1,36 +0,0 @@
1
- import picomatch from "picomatch";
2
- /**
3
- * Codes that describe a scan-level / config-level condition rather than a
4
- * package-specific finding. They have no `packageName` by design and must
5
- * pass the scope gate unconditionally — the gate's job is to drop noisy
6
- * per-package signals from out-of-scope dependencies, not to silence the
7
- * "your scopes matched nothing" report.
8
- */
9
- const SCAN_LEVEL_CODES = new Set([
10
- "no-deps-match-scopes",
11
- ]);
12
- /**
13
- * Builds the predicate scan.ts uses to decide whether a resolver diagnostic
14
- * should reach stderr.
15
- *
16
- * Empty `packageScopes` is the explicit "no filter" signal — every
17
- * diagnostic surfaces. Otherwise the scopes act as an allowlist matched
18
- * against the diagnostic's `packageName`. A diagnostic with no resolvable
19
- * `packageName` is dropped under an active filter (we cannot prove the
20
- * source is in scope, so it is treated as out-of-scope noise) — except
21
- * scan-level codes, which are workspace-config signals and always surface.
22
- */
23
- export function buildDiagnosticGate(packageScopes) {
24
- if (packageScopes.length === 0)
25
- return () => true;
26
- const matchers = packageScopes.map((p) => picomatch(p));
27
- return (d) => {
28
- if (SCAN_LEVEL_CODES.has(d.code))
29
- return true;
30
- const pkg = "packageName" in d ? d.packageName : undefined;
31
- if (!pkg)
32
- return false;
33
- return matchers.some((m) => m(pkg));
34
- };
35
- }
36
- //# sourceMappingURL=diagnostic-filter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"diagnostic-filter.js","sourceRoot":"","sources":["../../src/manifest/diagnostic-filter.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAC;AAGlC;;;;;;GAMG;AACH,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAqB;IACnD,sBAAsB;CACvB,CAAC,CAAC;AAEH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CACjC,aAAuB;IAEvB,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC;IAClD,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,OAAO,CAAC,CAAC,EAAE,EAAE;QACX,IAAI,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QAC9C,MAAM,GAAG,GAAG,aAAa,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;QAC3D,IAAI,CAAC,GAAG;YAAE,OAAO,KAAK,CAAC;QACvB,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACtC,CAAC,CAAC;AACJ,CAAC"}