@component-compass/cli 0.0.1 → 0.0.3

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 (96) hide show
  1. package/README.md +1 -1
  2. package/dist/cli.js +12 -4
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/init.d.ts +3 -2
  5. package/dist/commands/init.js +50 -62
  6. package/dist/commands/init.js.map +1 -1
  7. package/dist/commands/no-deps-diagnostic.d.ts +15 -0
  8. package/dist/commands/no-deps-diagnostic.js +23 -0
  9. package/dist/commands/no-deps-diagnostic.js.map +1 -0
  10. package/dist/commands/scan.d.ts +1 -0
  11. package/dist/commands/scan.js +126 -82
  12. package/dist/commands/scan.js.map +1 -1
  13. package/dist/composition-rollup.d.ts +23 -0
  14. package/dist/composition-rollup.js +64 -0
  15. package/dist/composition-rollup.js.map +1 -0
  16. package/dist/config/loader.js +5 -3
  17. package/dist/config/loader.js.map +1 -1
  18. package/dist/config/schema.d.ts +1 -2
  19. package/dist/config/schema.js.map +1 -1
  20. package/dist/identity.d.ts +21 -3
  21. package/dist/identity.js +40 -3
  22. package/dist/identity.js.map +1 -1
  23. package/dist/local-index/detect-react.js +224 -47
  24. package/dist/local-index/detect-react.js.map +1 -1
  25. package/dist/local-index/index.d.ts +4 -1
  26. package/dist/local-index/index.js +30 -13
  27. package/dist/local-index/index.js.map +1 -1
  28. package/dist/manifest/barrel-parser.d.ts +20 -0
  29. package/dist/manifest/barrel-parser.js +101 -16
  30. package/dist/manifest/barrel-parser.js.map +1 -1
  31. package/dist/manifest/derived-manifest-stub.d.ts +9 -0
  32. package/dist/manifest/derived-manifest-stub.js +11 -0
  33. package/dist/manifest/derived-manifest-stub.js.map +1 -0
  34. package/dist/manifest/diagnostic-filter.d.ts +13 -0
  35. package/dist/manifest/diagnostic-filter.js +36 -0
  36. package/dist/manifest/diagnostic-filter.js.map +1 -0
  37. package/dist/manifest/lazy-resolver.d.ts +44 -0
  38. package/dist/manifest/lazy-resolver.js +532 -0
  39. package/dist/manifest/lazy-resolver.js.map +1 -0
  40. package/dist/occurrences.d.ts +17 -0
  41. package/dist/occurrences.js +97 -0
  42. package/dist/occurrences.js.map +1 -0
  43. package/dist/reporter/index.d.ts +47 -9
  44. package/dist/reporter/index.js +167 -17
  45. package/dist/reporter/index.js.map +1 -1
  46. package/dist/reporter/json.d.ts +6 -2
  47. package/dist/reporter/json.js +7 -3
  48. package/dist/reporter/json.js.map +1 -1
  49. package/dist/reporter/stdout.d.ts +2 -2
  50. package/dist/reporter/stdout.js +11 -23
  51. package/dist/reporter/stdout.js.map +1 -1
  52. package/dist/rollup.d.ts +8 -2
  53. package/dist/rollup.js +2 -3
  54. package/dist/rollup.js.map +1 -1
  55. package/dist/seeds.d.ts +41 -0
  56. package/dist/seeds.js +145 -0
  57. package/dist/seeds.js.map +1 -0
  58. package/dist/types.d.ts +0 -1
  59. package/dist/workspace/build-graph.d.ts +2 -0
  60. package/dist/workspace/build-graph.js +117 -0
  61. package/dist/workspace/build-graph.js.map +1 -0
  62. package/dist/workspace/declared-deps.d.ts +5 -0
  63. package/dist/workspace/declared-deps.js +42 -0
  64. package/dist/workspace/declared-deps.js.map +1 -0
  65. package/dist/workspace/find-owning-package.d.ts +2 -0
  66. package/dist/workspace/find-owning-package.js +49 -0
  67. package/dist/workspace/find-owning-package.js.map +1 -0
  68. package/dist/workspace/index.d.ts +4 -0
  69. package/dist/workspace/index.js +4 -0
  70. package/dist/workspace/index.js.map +1 -0
  71. package/dist/workspace/types.d.ts +46 -0
  72. package/dist/workspace/types.js +13 -0
  73. package/dist/workspace/types.js.map +1 -0
  74. package/package.json +11 -9
  75. package/schema/config.schema.json +2 -10
  76. package/dist/graph/builder.d.ts +0 -25
  77. package/dist/graph/builder.js +0 -176
  78. package/dist/graph/builder.js.map +0 -1
  79. package/dist/manifest/discovery.d.ts +0 -24
  80. package/dist/manifest/discovery.js +0 -194
  81. package/dist/manifest/discovery.js.map +0 -1
  82. package/dist/manifest/index.d.ts +0 -6
  83. package/dist/manifest/index.js +0 -98
  84. package/dist/manifest/index.js.map +0 -1
  85. package/dist/manifest/resolver.d.ts +0 -30
  86. package/dist/manifest/resolver.js +0 -136
  87. package/dist/manifest/resolver.js.map +0 -1
  88. package/dist/manifest/run-discovery.d.ts +0 -12
  89. package/dist/manifest/run-discovery.js +0 -46
  90. package/dist/manifest/run-discovery.js.map +0 -1
  91. package/dist/manifest/types.d.ts +0 -3
  92. package/dist/manifest/types.js +0 -2
  93. package/dist/manifest/types.js.map +0 -1
  94. package/dist/reporter/types.d.ts +0 -69
  95. package/dist/reporter/types.js +0 -2
  96. package/dist/reporter/types.js.map +0 -1
package/dist/seeds.js ADDED
@@ -0,0 +1,145 @@
1
+ /**
2
+ * Builds per-component seeds from a resolver-emitted snapshot,
3
+ * parser-emitted occurrences, and the workspace tag rules. Seeds are the
4
+ * per-component input to `rollupOccurrencesToComponents`: they carry
5
+ * identity, derivedTags, and manifest enrichment but no occurrence data
6
+ * (that is merged separately during rollup).
7
+ *
8
+ * Pure function; no I/O.
9
+ */
10
+ import { relative, isAbsolute } from "node:path";
11
+ import { evaluateTagRules } from "./config/tag-rules.js";
12
+ import { manifestComponentToOutput } from "./reporter/index.js";
13
+ import { computeOutputIdentity, computeStableId, computeStableIdFromComponentId, } from "./identity.js";
14
+ /**
15
+ * Project the resolver snapshot AND parser-emitted occurrences into
16
+ * ComponentSeeds.
17
+ *
18
+ * Two sources contribute:
19
+ * 1. Snapshotted components — full enrichment via `manifestComponentToOutput`,
20
+ * labelled with the snapshot entry's `enrichmentSource`.
21
+ * 2. Components observed in parser walks but absent from the snapshot —
22
+ * emitted with `manifest: null` so they surface in `components[]` per
23
+ * the realignment principle ("manifest is enrichment, not gate").
24
+ *
25
+ * Dedupe by stable id; snapshotted seeds win.
26
+ *
27
+ * Scope derivation follows the three-lane model in identity.ts:
28
+ * - local → source.type === "local"
29
+ * - ds → external + derivedTags.length > 0
30
+ * - external → external + no matching tag rules
31
+ */
32
+ export function buildComponentSeeds(snapshot, parseResults, tagRules, localIndex, repoRoot, workspaceGraph) {
33
+ const seedsById = new Map();
34
+ // 1. Resolver-snapshotted components first (so they win on dedupe).
35
+ for (const entry of snapshot) {
36
+ const componentId = indexedToComponentId(entry.component);
37
+ const packageName = entry.component.source.type === "external"
38
+ ? entry.component.source.package
39
+ : null;
40
+ const derivedTags = evaluateTagRules(packageName, tagRules);
41
+ const identity = computeOutputIdentity({
42
+ componentId,
43
+ derivedTags,
44
+ repoId: "",
45
+ ...(workspaceGraph !== undefined ? { workspaceGraph } : {}),
46
+ });
47
+ const id = computeStableId(identity);
48
+ const manifest = manifestComponentToOutput(entry.component, entry.enrichmentSource);
49
+ seedsById.set(id, { id, identity, derivedTags, manifest });
50
+ }
51
+ // 2. Components observed in parser walks but not yet seeded.
52
+ // Emitted with manifest: null per the realignment principle.
53
+ for (const result of parseResults) {
54
+ for (const occ of result.occurrences) {
55
+ // Normalise local filePaths: parsers emit absolute paths; the local index
56
+ // uses repo-root-relative POSIX paths. Relativise here so the stable id
57
+ // matches the one produced for seeds built from the local index.
58
+ const componentId = repoRoot && occ.componentId.source.type === "local" && isAbsolute(occ.componentId.source.filePath)
59
+ ? {
60
+ ...occ.componentId,
61
+ source: {
62
+ type: "local",
63
+ filePath: relative(repoRoot, occ.componentId.source.filePath).replace(/\\/g, "/"),
64
+ },
65
+ }
66
+ : occ.componentId;
67
+ const id = computeStableIdFromComponentId(componentId);
68
+ if (seedsById.has(id))
69
+ continue;
70
+ const packageName = componentId.source.type === "external"
71
+ ? componentId.source.package
72
+ : null;
73
+ const derivedTags = evaluateTagRules(packageName, tagRules);
74
+ const isLocal = componentId.source.type === "local";
75
+ let definitionLoc;
76
+ if (isLocal && localIndex) {
77
+ let match;
78
+ if (componentId.kind === "custom-element") {
79
+ match = localIndex.byTag.get(componentId.tagName);
80
+ }
81
+ else {
82
+ const path = componentId.source.type === "local" ? componentId.source.filePath : "";
83
+ const defs = localIndex.byPath.get(path) ?? [];
84
+ const exportName = componentId.export;
85
+ match = defs.find((d) => d.exportName === exportName);
86
+ }
87
+ if (match?.loc) {
88
+ definitionLoc = { line: match.loc.line, column: match.loc.column };
89
+ }
90
+ }
91
+ const identity = computeOutputIdentity({
92
+ componentId,
93
+ derivedTags,
94
+ repoId: "",
95
+ ...(workspaceGraph !== undefined ? { workspaceGraph } : {}),
96
+ ...(definitionLoc !== undefined ? { definitionLoc } : {}),
97
+ });
98
+ seedsById.set(id, { id, identity, derivedTags, manifest: null });
99
+ }
100
+ }
101
+ // 3. Local definitions that were never referenced in any occurrence.
102
+ // These must still appear in components[] so they can serve as
103
+ // owner-edge targets in the composition graph.
104
+ if (localIndex) {
105
+ for (const [, defs] of localIndex.byPath) {
106
+ for (const def of defs) {
107
+ const id = computeStableIdFromComponentId(def.componentId);
108
+ if (seedsById.has(id))
109
+ continue;
110
+ const definitionLoc = def.loc !== undefined
111
+ ? { line: def.loc.line, column: def.loc.column }
112
+ : undefined;
113
+ const identity = computeOutputIdentity({
114
+ componentId: def.componentId,
115
+ derivedTags: [],
116
+ repoId: "",
117
+ ...(workspaceGraph !== undefined ? { workspaceGraph } : {}),
118
+ ...(definitionLoc !== undefined ? { definitionLoc } : {}),
119
+ });
120
+ seedsById.set(id, { id, identity, derivedTags: [], manifest: null });
121
+ }
122
+ }
123
+ }
124
+ return [...seedsById.values()];
125
+ }
126
+ /**
127
+ * Convert an `IndexedComponent` to a `ComponentId` for use with
128
+ * `computeOutputIdentity`. `IndexedComponent` extends `ManifestComponent`
129
+ * which shares the same `source` / `kind` / `export` / `tagName` fields.
130
+ */
131
+ function indexedToComponentId(c) {
132
+ if (c.kind === "custom-element") {
133
+ return {
134
+ kind: "custom-element",
135
+ tagName: c.tagName,
136
+ source: c.source,
137
+ };
138
+ }
139
+ return {
140
+ kind: c.kind,
141
+ export: c.export,
142
+ source: c.source,
143
+ };
144
+ }
145
+ //# sourceMappingURL=seeds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"se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,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;QAChC,OAAO;YACL,IAAI,EAAE,gBAAgB;YACtB,OAAO,EAAE,CAAC,CAAC,OAAO;YAClB,MAAM,EAAE,CAAC,CAAC,MAAM;SACjB,CAAC;IACJ,CAAC;IACD,OAAO;QACL,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,MAAM,EAAE,CAAC,CAAC,MAAM;KACjB,CAAC;AACJ,CAAC"}
package/dist/types.d.ts CHANGED
@@ -6,7 +6,6 @@ export type ResolvedConfig = {
6
6
  configDir: string;
7
7
  repoId: string;
8
8
  packageScopes: string[];
9
- manifestSources?: Record<string, string[]>;
10
9
  include: string[];
11
10
  exclude: string[];
12
11
  captureValues: boolean;
@@ -0,0 +1,2 @@
1
+ import type { WorkspaceGraph } from "./types.js";
2
+ export declare function buildWorkspaceGraph(rootPath: string): WorkspaceGraph;
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Build a workspace graph from a repository root.
3
+ *
4
+ * Two independent steps:
5
+ * - sniffPackageManager: lockfile-based; sets graph.packageManager. Always
6
+ * runs; returns "unknown" when no lockfile is found.
7
+ * - detectWorkspacePackages: pnpm-workspace.yaml → package.json#workspaces →
8
+ * empty array. Independent of step 1.
9
+ *
10
+ * Glob expansion uses globby (already a CLI dep).
11
+ * Pure; no I/O beyond config-file reads.
12
+ */
13
+ import { existsSync, readFileSync } from "node:fs";
14
+ import { join, resolve } from "node:path";
15
+ import { globbySync } from "globby";
16
+ import * as yaml from "js-yaml";
17
+ export function buildWorkspaceGraph(rootPath) {
18
+ const absRoot = resolve(rootPath);
19
+ const rootPkgJsonPath = join(absRoot, "package.json");
20
+ const rootPkg = readJsonSafely(rootPkgJsonPath) ?? {};
21
+ const rootPackageName = typeof rootPkg.name === "string" ? rootPkg.name : "<unnamed>";
22
+ return {
23
+ packageManager: sniffPackageManager(absRoot),
24
+ rootPath: absRoot,
25
+ rootPackageName,
26
+ packages: detectWorkspacePackages(absRoot, rootPkg),
27
+ };
28
+ }
29
+ function sniffPackageManager(absRoot) {
30
+ if (existsSync(join(absRoot, "pnpm-lock.yaml")))
31
+ return "pnpm";
32
+ if (existsSync(join(absRoot, "package-lock.json")))
33
+ return "npm";
34
+ if (existsSync(join(absRoot, "yarn.lock")))
35
+ return "yarn";
36
+ return "unknown";
37
+ }
38
+ function detectWorkspacePackages(absRoot, rootPkg) {
39
+ // pnpm-workspace.yaml wins when both configs present.
40
+ const pnpmYamlPath = join(absRoot, "pnpm-workspace.yaml");
41
+ if (existsSync(pnpmYamlPath)) {
42
+ const yamlContent = readFileSync(pnpmYamlPath, "utf8");
43
+ let parsed;
44
+ try {
45
+ parsed = yaml.load(yamlContent);
46
+ }
47
+ catch {
48
+ parsed = null;
49
+ }
50
+ const globs = isWorkspaceYaml(parsed) ? parsed.packages : [];
51
+ return expandPackages(absRoot, globs);
52
+ }
53
+ // package.json#workspaces (array or object form).
54
+ const workspaces = rootPkg.workspaces;
55
+ if (Array.isArray(workspaces)) {
56
+ return expandPackages(absRoot, workspaces);
57
+ }
58
+ if (workspaces &&
59
+ typeof workspaces === "object" &&
60
+ Array.isArray(workspaces.packages)) {
61
+ return expandPackages(absRoot, workspaces.packages);
62
+ }
63
+ // No workspace config → single-package repo.
64
+ return [];
65
+ }
66
+ function expandPackages(absRoot, entries) {
67
+ if (entries.length === 0)
68
+ return [];
69
+ // Split literal paths from globs: globby (fast-glob) treats a bare "foo"
70
+ // as "foo/**" and returns subdirectories instead of foo itself, so literal
71
+ // workspace entries must be resolved directly.
72
+ const literals = [];
73
+ const globs = [];
74
+ for (const e of entries) {
75
+ if (/[*?[\]{}]/.test(e))
76
+ globs.push(e);
77
+ else
78
+ literals.push(e);
79
+ }
80
+ const matched = literals.map((p) => resolve(absRoot, p));
81
+ if (globs.length > 0) {
82
+ matched.push(...globbySync(globs, {
83
+ cwd: absRoot,
84
+ onlyDirectories: true,
85
+ absolute: true,
86
+ suppressErrors: true,
87
+ }));
88
+ }
89
+ const packages = [];
90
+ const seenNames = new Set();
91
+ for (const dir of matched) {
92
+ const pkgJson = readJsonSafely(join(dir, "package.json"));
93
+ if (!pkgJson)
94
+ continue;
95
+ if (typeof pkgJson.name !== "string" || pkgJson.name.length === 0)
96
+ continue;
97
+ if (seenNames.has(pkgJson.name))
98
+ continue;
99
+ seenNames.add(pkgJson.name);
100
+ packages.push({ name: pkgJson.name, absolutePath: dir, packageJson: pkgJson });
101
+ }
102
+ return packages;
103
+ }
104
+ function readJsonSafely(path) {
105
+ try {
106
+ return JSON.parse(readFileSync(path, "utf8"));
107
+ }
108
+ catch {
109
+ return null;
110
+ }
111
+ }
112
+ function isWorkspaceYaml(p) {
113
+ return (typeof p === "object" &&
114
+ p !== null &&
115
+ Array.isArray(p.packages));
116
+ }
117
+ //# sourceMappingURL=build-graph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-graph.js","sourceRoot":"","sources":["../../src/workspace/build-graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAGhC,MAAM,UAAU,mBAAmB,CAAC,QAAgB;IAClD,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClC,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,cAAc,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;IACtD,MAAM,eAAe,GACnB,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC;IAEhE,OAAO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AI,OAAO,EAAE,CAAC;QAC1B,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC;QAC1D,IAAI,CAAC,OAAO;YAAE,SAAS;QACvB,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAC5E,IAAI,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC;YAAE,SAAS;QAC1C,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,YAAY,EAAE,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC;IACjF,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,cAAc,CAAC,IAAY;IAClC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,CAAU;IACjC,OAAO,CACL,OAAO,CAAC,KAAK,QAAQ;QACrB,CAAC,KAAK,IAAI;QACV,KAAK,CAAC,OAAO,CAAE,CAA4B,CAAC,QAAQ,CAAC,CACtD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { WorkspaceGraph, WorkspacePackage } from "./types.js";
2
+ type PkgJson = WorkspacePackage["packageJson"];
3
+ type ReadPkgJson = (path: string) => PkgJson | null;
4
+ export declare function declaredDeps(graph: WorkspaceGraph, read?: ReadPkgJson): string[];
5
+ export {};
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Union of declared dependencies across the workspace root + every workspace
3
+ * package. Used to warm the lazy resolver's by-tag cache so the resolver knows
4
+ * about every package in the consumer's monorepo, not just the root's deps.
5
+ *
6
+ * Pure; the JSON-read side-effect is injected so tests can drive it without
7
+ * filesystem fixtures.
8
+ */
9
+ import { readFileSync } from "node:fs";
10
+ import { join } from "node:path";
11
+ const defaultReader = (path) => {
12
+ try {
13
+ return JSON.parse(readFileSync(path, "utf8"));
14
+ }
15
+ catch {
16
+ return null;
17
+ }
18
+ };
19
+ export function declaredDeps(graph, read = defaultReader) {
20
+ const all = new Set();
21
+ collect(read(join(graph.rootPath, "package.json")), all);
22
+ for (const pkg of graph.packages) {
23
+ collect(pkg.packageJson, all);
24
+ }
25
+ return [...all];
26
+ }
27
+ function collect(pkg, into) {
28
+ if (!pkg)
29
+ return;
30
+ for (const bucket of [
31
+ pkg.dependencies,
32
+ pkg.devDependencies,
33
+ pkg.peerDependencies,
34
+ pkg.optionalDependencies,
35
+ ]) {
36
+ if (!bucket)
37
+ continue;
38
+ for (const name of Object.keys(bucket))
39
+ into.add(name);
40
+ }
41
+ }
42
+ //# sourceMappingURL=declared-deps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declared-deps.js","sourceRoot":"","sources":["../../src/workspace/declared-deps.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAMjC,MAAM,aAAa,GAAgB,CAAC,IAAI,EAAE,EAAE;IAC1C,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,UAAU,YAAY,CAC1B,KAAqB,EACrB,OAAoB,aAAa;IAEjC,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;IAE9B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAEzD,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QACjC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IAChC,CAAC;IAED,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC;AAClB,CAAC;AAED,SAAS,OAAO,CAAC,GAAmB,EAAE,IAAiB;IACrD,IAAI,CAAC,GAAG;QAAE,OAAO;IACjB,KAAK,MAAM,MAAM,IAAI;QACnB,GAAG,CAAC,YAAY;QAChB,GAAG,CAAC,eAAe;QACnB,GAAG,CAAC,gBAAgB;QACpB,GAAG,CAAC,oBAAoB;KACzB,EAAE,CAAC;QACF,IAAI,CAAC,MAAM;YAAE,SAAS;QACtB,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;YAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACzD,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { WorkspaceGraph, WorkspacePackage } from "./types.js";
2
+ export declare function findOwningPackage(graph: WorkspaceGraph, filePath: string): WorkspacePackage | null;
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Realpath-aware workspace-membership check. Resolves the input path via
3
+ * realpath so node_modules symlinks (yarn/pnpm's usual layout) match their
4
+ * underlying workspace package directories.
5
+ *
6
+ * Returns the WorkspacePackage with the longest absolutePath that is a path
7
+ * prefix of the resolved input. Null when no package owns the file.
8
+ */
9
+ import { realpathSync } from "node:fs";
10
+ export function findOwningPackage(graph, filePath) {
11
+ if (graph.packages.length === 0)
12
+ return null;
13
+ const resolved = resolveRealpath(filePath);
14
+ let best = null;
15
+ let bestPrefixLen = -1;
16
+ for (const pkg of graph.packages) {
17
+ // Realpath the package root too: on macOS tmpdir resolves through
18
+ // /var -> /private/var, and consumers may pass either form into the graph.
19
+ const pkgPath = resolveRealpath(pkg.absolutePath);
20
+ if (!isPathPrefix(pkgPath, resolved))
21
+ continue;
22
+ // Reject paths that fall inside a node_modules under the workspace
23
+ // package: those are vendor packages installed within the workspace
24
+ // (e.g. <app>/node_modules/@vendor/foo), not the workspace's own source.
25
+ // Symlinked sibling workspaces have already collapsed away via realpath.
26
+ if (resolved.slice(pkgPath.length).includes("/node_modules/"))
27
+ continue;
28
+ if (pkgPath.length > bestPrefixLen) {
29
+ best = pkg;
30
+ bestPrefixLen = pkgPath.length;
31
+ }
32
+ }
33
+ return best;
34
+ }
35
+ function resolveRealpath(filePath) {
36
+ try {
37
+ return realpathSync(filePath);
38
+ }
39
+ catch {
40
+ return filePath;
41
+ }
42
+ }
43
+ function isPathPrefix(prefix, candidate) {
44
+ if (candidate === prefix)
45
+ return true;
46
+ const withSep = prefix.endsWith("/") ? prefix : `${prefix}/`;
47
+ return candidate.startsWith(withSep);
48
+ }
49
+ //# sourceMappingURL=find-owning-package.js.map
@@ -0,0 +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,SAAS,eAAe,CAAC,QAAgB;IACvC,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAC;IAClB,CAAC;AACH,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"}
@@ -0,0 +1,4 @@
1
+ export { buildWorkspaceGraph } from "./build-graph.js";
2
+ export { declaredDeps } from "./declared-deps.js";
3
+ export { findOwningPackage } from "./find-owning-package.js";
4
+ export type { PackageManager, WorkspaceGraph, WorkspacePackage } from "./types.js";
@@ -0,0 +1,4 @@
1
+ export { buildWorkspaceGraph } from "./build-graph.js";
2
+ export { declaredDeps } from "./declared-deps.js";
3
+ export { findOwningPackage } from "./find-owning-package.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Workspace graph shape. Built once per scan at scan-start, threaded into the
3
+ * resolver (for workspace-locality classification) and the identity layer
4
+ * (for `OutputIdentity.packageName` enrichment).
5
+ *
6
+ * Two independent axes:
7
+ * - `packageManager` — yarn / npm / pnpm, sniffed from lockfile. Always set.
8
+ * Returns "unknown" when no lockfile is detected (explicit "no signal").
9
+ * - `packages` — workspace packages from pnpm-workspace.yaml or
10
+ * package.json#workspaces. Empty array for single-package repos.
11
+ */
12
+ export type PackageManager = "yarn" | "npm" | "pnpm" | "unknown";
13
+ export type WorkspacePackage = {
14
+ /** Workspace package name from its `package.json#name`. */
15
+ name: string;
16
+ /** Absolute path to the package directory. */
17
+ absolutePath: string;
18
+ /** Parsed `package.json` contents. Cached for `declaredDeps`. */
19
+ packageJson: {
20
+ name?: string;
21
+ dependencies?: Record<string, string>;
22
+ devDependencies?: Record<string, string>;
23
+ peerDependencies?: Record<string, string>;
24
+ optionalDependencies?: Record<string, string>;
25
+ workspaces?: string[] | {
26
+ packages?: string[];
27
+ };
28
+ };
29
+ };
30
+ export type WorkspaceGraph = {
31
+ /**
32
+ * Detected package manager (lockfile-based). `"unknown"` when no lockfile
33
+ * is present — explicit about not knowing. Independent of workspace
34
+ * detection — set even for single-package repos.
35
+ */
36
+ packageManager: PackageManager;
37
+ /** Absolute path to the scan's configDir (the workspace root). */
38
+ rootPath: string;
39
+ /** Root package name; "<unnamed>" if missing. */
40
+ rootPackageName: string;
41
+ /**
42
+ * Detected workspace packages from pnpm-workspace.yaml or
43
+ * package.json#workspaces. Empty array for single-package repos.
44
+ */
45
+ packages: WorkspacePackage[];
46
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Workspace graph shape. Built once per scan at scan-start, threaded into the
3
+ * resolver (for workspace-locality classification) and the identity layer
4
+ * (for `OutputIdentity.packageName` enrichment).
5
+ *
6
+ * Two independent axes:
7
+ * - `packageManager` — yarn / npm / pnpm, sniffed from lockfile. Always set.
8
+ * Returns "unknown" when no lockfile is detected (explicit "no signal").
9
+ * - `packages` — workspace packages from pnpm-workspace.yaml or
10
+ * package.json#workspaces. Empty array for single-package repos.
11
+ */
12
+ export {};
13
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/workspace/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@component-compass/cli",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
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",
7
7
  "main": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
9
9
  "bin": {
10
- "compass": "./dist/cli.js",
11
- "component-compass": "./dist/cli.js"
10
+ "compass": "dist/cli.js",
11
+ "component-compass": "dist/cli.js"
12
12
  },
13
13
  "files": [
14
14
  "dist",
@@ -35,20 +35,22 @@
35
35
  "dependencies": {
36
36
  "@babel/parser": "^7.29.3",
37
37
  "@babel/types": "^7.29.0",
38
- "@component-compass/ast-utils": "^0.0.1",
39
- "@component-compass/parser-html": "^0.0.1",
40
- "@component-compass/parser-lit": "^0.0.1",
41
- "@component-compass/parser-react": "^0.0.1",
42
- "@component-compass/parser-vue": "^0.0.1",
43
- "@component-compass/plugin-core": "^0.0.1",
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",
44
44
  "@vue/compiler-sfc": "^3.5.33",
45
45
  "ajv": "^8.20.0",
46
46
  "glob": "^13.0.0",
47
47
  "globby": "^16.2.0",
48
+ "js-yaml": "^4",
48
49
  "picomatch": "^4.0.4",
49
50
  "ulid": "^3.0.2"
50
51
  },
51
52
  "devDependencies": {
53
+ "@types/js-yaml": "^4",
52
54
  "@types/node": "^24.0.0",
53
55
  "@types/picomatch": "^4.0.3",
54
56
  "typescript": "^5.9.0",
@@ -4,21 +4,13 @@
4
4
  "title": "component-compass config",
5
5
  "type": "object",
6
6
  "additionalProperties": false,
7
- "required": ["repoId", "packageScopes", "include"],
7
+ "required": ["repoId", "include"],
8
8
  "properties": {
9
9
  "$schema": { "type": "string" },
10
10
  "repoId": { "type": "string", "minLength": 1 },
11
11
  "packageScopes": {
12
12
  "type": "array",
13
- "items": { "type": "string", "minLength": 1 },
14
- "minItems": 1
15
- },
16
- "manifestSources": {
17
- "type": "object",
18
- "additionalProperties": {
19
- "type": "array",
20
- "items": { "type": "string", "minLength": 1 }
21
- }
13
+ "items": { "type": "string", "minLength": 1 }
22
14
  },
23
15
  "include": {
24
16
  "type": "array",
@@ -1,25 +0,0 @@
1
- import type { ScanEnvelope } from "@component-compass/plugin-core";
2
- import type { ComponentIndex } from "../manifest/types.js";
3
- import type { ParseResult } from "@component-compass/plugin-core";
4
- import type { Warning } from "../types.js";
5
- import type { OutputDocument, OutputManifestRef } from "../reporter/types.js";
6
- export type BuildGraphOptions = {
7
- index: ComponentIndex;
8
- results: ParseResult[];
9
- filesScanned: number;
10
- scanDurationMs: number;
11
- tool: {
12
- name: string;
13
- version: string;
14
- };
15
- repo: {
16
- name: string;
17
- root: string;
18
- commit?: string | undefined;
19
- };
20
- manifests: OutputManifestRef[];
21
- captureValues: boolean;
22
- extraWarnings?: Warning[];
23
- envelope: ScanEnvelope;
24
- };
25
- export declare function buildGraph(opts: BuildGraphOptions): OutputDocument;