@component-compass/cli 0.1.22 → 0.1.24

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 (217) hide show
  1. package/dist/cli.js +103503 -104
  2. package/package.json +21 -25
  3. package/dist/auth/browser.d.ts +0 -13
  4. package/dist/auth/browser.js +0 -21
  5. package/dist/auth/browser.js.map +0 -1
  6. package/dist/auth/client.d.ts +0 -48
  7. package/dist/auth/client.js +0 -89
  8. package/dist/auth/client.js.map +0 -1
  9. package/dist/auth/paths.d.ts +0 -2
  10. package/dist/auth/paths.js +0 -14
  11. package/dist/auth/paths.js.map +0 -1
  12. package/dist/auth/session.d.ts +0 -38
  13. package/dist/auth/session.js +0 -88
  14. package/dist/auth/session.js.map +0 -1
  15. package/dist/auth/store.d.ts +0 -16
  16. package/dist/auth/store.js +0 -37
  17. package/dist/auth/store.js.map +0 -1
  18. package/dist/auth/upload-auth.d.ts +0 -22
  19. package/dist/auth/upload-auth.js +0 -51
  20. package/dist/auth/upload-auth.js.map +0 -1
  21. package/dist/cli/help.d.ts +0 -4
  22. package/dist/cli/help.js +0 -52
  23. package/dist/cli/help.js.map +0 -1
  24. package/dist/cli/parse.d.ts +0 -14
  25. package/dist/cli/parse.js +0 -75
  26. package/dist/cli/parse.js.map +0 -1
  27. package/dist/cli/suggest.d.ts +0 -4
  28. package/dist/cli/suggest.js +0 -38
  29. package/dist/cli/suggest.js.map +0 -1
  30. package/dist/cli.d.ts +0 -2
  31. package/dist/cli.js.map +0 -1
  32. package/dist/commands/auth.d.ts +0 -33
  33. package/dist/commands/auth.js +0 -248
  34. package/dist/commands/auth.js.map +0 -1
  35. package/dist/commands/init.d.ts +0 -11
  36. package/dist/commands/init.js +0 -112
  37. package/dist/commands/init.js.map +0 -1
  38. package/dist/commands/scan.d.ts +0 -33
  39. package/dist/commands/scan.js +0 -745
  40. package/dist/commands/scan.js.map +0 -1
  41. package/dist/composition-rollup.d.ts +0 -23
  42. package/dist/composition-rollup.js +0 -64
  43. package/dist/composition-rollup.js.map +0 -1
  44. package/dist/config/loader.d.ts +0 -6
  45. package/dist/config/loader.js +0 -71
  46. package/dist/config/loader.js.map +0 -1
  47. package/dist/config/schema.d.ts +0 -18
  48. package/dist/config/schema.js +0 -15
  49. package/dist/config/schema.js.map +0 -1
  50. package/dist/dispatcher.d.ts +0 -8
  51. package/dist/dispatcher.js +0 -22
  52. package/dist/dispatcher.js.map +0 -1
  53. package/dist/envelope/git.d.ts +0 -13
  54. package/dist/envelope/git.js +0 -69
  55. package/dist/envelope/git.js.map +0 -1
  56. package/dist/envelope/index.d.ts +0 -1
  57. package/dist/envelope/index.js +0 -12
  58. package/dist/envelope/index.js.map +0 -1
  59. package/dist/envelope/repo-id.d.ts +0 -16
  60. package/dist/envelope/repo-id.js +0 -40
  61. package/dist/envelope/repo-id.js.map +0 -1
  62. package/dist/identity.d.ts +0 -56
  63. package/dist/identity.js +0 -115
  64. package/dist/identity.js.map +0 -1
  65. package/dist/index.d.ts +0 -3
  66. package/dist/index.js +0 -3
  67. package/dist/index.js.map +0 -1
  68. package/dist/local-index/declared-props.d.ts +0 -15
  69. package/dist/local-index/declared-props.js +0 -101
  70. package/dist/local-index/declared-props.js.map +0 -1
  71. package/dist/local-index/detect-react.d.ts +0 -3
  72. package/dist/local-index/detect-react.js +0 -378
  73. package/dist/local-index/detect-react.js.map +0 -1
  74. package/dist/local-index/detect-vue.d.ts +0 -16
  75. package/dist/local-index/detect-vue.js +0 -284
  76. package/dist/local-index/detect-vue.js.map +0 -1
  77. package/dist/local-index/detect-wc.d.ts +0 -8
  78. package/dist/local-index/detect-wc.js +0 -70
  79. package/dist/local-index/detect-wc.js.map +0 -1
  80. package/dist/local-index/index.d.ts +0 -14
  81. package/dist/local-index/index.js +0 -46
  82. package/dist/local-index/index.js.map +0 -1
  83. package/dist/local-index/types.d.ts +0 -2
  84. package/dist/local-index/types.js +0 -2
  85. package/dist/local-index/types.js.map +0 -1
  86. package/dist/manifest/barrel-parser.d.ts +0 -35
  87. package/dist/manifest/barrel-parser.js +0 -76
  88. package/dist/manifest/barrel-parser.js.map +0 -1
  89. package/dist/manifest/lazy-resolver.d.ts +0 -123
  90. package/dist/manifest/lazy-resolver.js +0 -712
  91. package/dist/manifest/lazy-resolver.js.map +0 -1
  92. package/dist/occurrences.d.ts +0 -15
  93. package/dist/occurrences.js +0 -101
  94. package/dist/occurrences.js.map +0 -1
  95. package/dist/parse-by-ext.d.ts +0 -21
  96. package/dist/parse-by-ext.js +0 -53
  97. package/dist/parse-by-ext.js.map +0 -1
  98. package/dist/prompts/adapter.d.ts +0 -43
  99. package/dist/prompts/adapter.js +0 -32
  100. package/dist/prompts/adapter.js.map +0 -1
  101. package/dist/reporter/index.d.ts +0 -39
  102. package/dist/reporter/index.js +0 -144
  103. package/dist/reporter/index.js.map +0 -1
  104. package/dist/reporter/json.d.ts +0 -6
  105. package/dist/reporter/json.js +0 -11
  106. package/dist/reporter/json.js.map +0 -1
  107. package/dist/reporter/stdout.d.ts +0 -3
  108. package/dist/reporter/stdout.js +0 -41
  109. package/dist/reporter/stdout.js.map +0 -1
  110. package/dist/rollup.d.ts +0 -26
  111. package/dist/rollup.js +0 -135
  112. package/dist/rollup.js.map +0 -1
  113. package/dist/scan/cem-index.d.ts +0 -38
  114. package/dist/scan/cem-index.js +0 -139
  115. package/dist/scan/cem-index.js.map +0 -1
  116. package/dist/scan/entry-packages.d.ts +0 -42
  117. package/dist/scan/entry-packages.js +0 -87
  118. package/dist/scan/entry-packages.js.map +0 -1
  119. package/dist/scan/framework-root.d.ts +0 -1
  120. package/dist/scan/framework-root.js +0 -22
  121. package/dist/scan/framework-root.js.map +0 -1
  122. package/dist/scan/git-mtime.d.ts +0 -2
  123. package/dist/scan/git-mtime.js +0 -22
  124. package/dist/scan/git-mtime.js.map +0 -1
  125. package/dist/scan/global-components.d.ts +0 -37
  126. package/dist/scan/global-components.js +0 -228
  127. package/dist/scan/global-components.js.map +0 -1
  128. package/dist/scan/meta.d.ts +0 -5
  129. package/dist/scan/meta.js +0 -58
  130. package/dist/scan/meta.js.map +0 -1
  131. package/dist/scan/stamp-version.d.ts +0 -18
  132. package/dist/scan/stamp-version.js +0 -94
  133. package/dist/scan/stamp-version.js.map +0 -1
  134. package/dist/scan/wrap-relationships.d.ts +0 -12
  135. package/dist/scan/wrap-relationships.js +0 -38
  136. package/dist/scan/wrap-relationships.js.map +0 -1
  137. package/dist/seeds.d.ts +0 -81
  138. package/dist/seeds.js +0 -258
  139. package/dist/seeds.js.map +0 -1
  140. package/dist/types/brand.d.ts +0 -11
  141. package/dist/types/brand.js +0 -5
  142. package/dist/types/brand.js.map +0 -1
  143. package/dist/types/component-id.d.ts +0 -2
  144. package/dist/types/component-id.js +0 -2
  145. package/dist/types/component-id.js.map +0 -1
  146. package/dist/types.d.ts +0 -13
  147. package/dist/types.js +0 -2
  148. package/dist/types.js.map +0 -1
  149. package/dist/upload.d.ts +0 -18
  150. package/dist/upload.js +0 -34
  151. package/dist/upload.js.map +0 -1
  152. package/dist/util/color.d.ts +0 -24
  153. package/dist/util/color.js +0 -45
  154. package/dist/util/color.js.map +0 -1
  155. package/dist/util/git.d.ts +0 -10
  156. package/dist/util/git.js +0 -95
  157. package/dist/util/git.js.map +0 -1
  158. package/dist/util/interactive.d.ts +0 -17
  159. package/dist/util/interactive.js +0 -19
  160. package/dist/util/interactive.js.map +0 -1
  161. package/dist/util/log.d.ts +0 -9
  162. package/dist/util/log.js +0 -20
  163. package/dist/util/log.js.map +0 -1
  164. package/dist/util/pkg.d.ts +0 -1
  165. package/dist/util/pkg.js +0 -13
  166. package/dist/util/pkg.js.map +0 -1
  167. package/dist/util/pnp-check.d.ts +0 -1
  168. package/dist/util/pnp-check.js +0 -6
  169. package/dist/util/pnp-check.js.map +0 -1
  170. package/dist/util/posix.d.ts +0 -2
  171. package/dist/util/posix.js +0 -15
  172. package/dist/util/posix.js.map +0 -1
  173. package/dist/util/progress.d.ts +0 -21
  174. package/dist/util/progress.js +0 -54
  175. package/dist/util/progress.js.map +0 -1
  176. package/dist/util/version.d.ts +0 -7
  177. package/dist/util/version.js +0 -13
  178. package/dist/util/version.js.map +0 -1
  179. package/dist/walker/bounded-definition-resolver.d.ts +0 -9
  180. package/dist/walker/bounded-definition-resolver.js +0 -125
  181. package/dist/walker/bounded-definition-resolver.js.map +0 -1
  182. package/dist/walker/files.d.ts +0 -7
  183. package/dist/walker/files.js +0 -24
  184. package/dist/walker/files.js.map +0 -1
  185. package/dist/walker/package-alias-layers.d.ts +0 -7
  186. package/dist/walker/package-alias-layers.js +0 -40
  187. package/dist/walker/package-alias-layers.js.map +0 -1
  188. package/dist/walker/resolve-import.d.ts +0 -25
  189. package/dist/walker/resolve-import.js +0 -243
  190. package/dist/walker/resolve-import.js.map +0 -1
  191. package/dist/walker/tsconfig-discovery.d.ts +0 -36
  192. package/dist/walker/tsconfig-discovery.js +0 -52
  193. package/dist/walker/tsconfig-discovery.js.map +0 -1
  194. package/dist/walker/tsconfig-loader.d.ts +0 -35
  195. package/dist/walker/tsconfig-loader.js +0 -138
  196. package/dist/walker/tsconfig-loader.js.map +0 -1
  197. package/dist/walker/workspace-exports.d.ts +0 -3
  198. package/dist/walker/workspace-exports.js +0 -120
  199. package/dist/walker/workspace-exports.js.map +0 -1
  200. package/dist/workspace/build-graph.d.ts +0 -15
  201. package/dist/workspace/build-graph.js +0 -120
  202. package/dist/workspace/build-graph.js.map +0 -1
  203. package/dist/workspace/declared-deps.d.ts +0 -5
  204. package/dist/workspace/declared-deps.js +0 -42
  205. package/dist/workspace/declared-deps.js.map +0 -1
  206. package/dist/workspace/find-owning-package.d.ts +0 -8
  207. package/dist/workspace/find-owning-package.js +0 -69
  208. package/dist/workspace/find-owning-package.js.map +0 -1
  209. package/dist/workspace/find-workspace-root.d.ts +0 -1
  210. package/dist/workspace/find-workspace-root.js +0 -60
  211. package/dist/workspace/find-workspace-root.js.map +0 -1
  212. package/dist/workspace/index.d.ts +0 -4
  213. package/dist/workspace/index.js +0 -4
  214. package/dist/workspace/index.js.map +0 -1
  215. package/dist/workspace/types.d.ts +0 -49
  216. package/dist/workspace/types.js +0 -13
  217. package/dist/workspace/types.js.map +0 -1
package/dist/seeds.js DELETED
@@ -1,258 +0,0 @@
1
- /**
2
- * Builds per-component seeds from parser-emitted occurrences, and separately
3
- * attaches manifest enrichment from a resolver-emitted snapshot onto those
4
- * seeds. Seeds are the per-component input to `rollupOccurrencesToComponents`:
5
- * they carry identity and manifest enrichment but no occurrence data (that is
6
- * merged separately during rollup).
7
- *
8
- * Pure functions; no I/O.
9
- */
10
- import { relative, isAbsolute } from "node:path";
11
- import { posixPath } from "@component-compass/plugin-core";
12
- import { manifestComponentToOutput } from "./reporter/index.js";
13
- import { computeOutputIdentity, computeStableIdFromComponentId, } from "./identity.js";
14
- /**
15
- * Project parser-emitted occurrences (and never-referenced local
16
- * definitions) into observed-only ComponentSeeds.
17
- *
18
- * Two sources contribute, both observed:
19
- * 1. Components observed in parser walks — carry `modulePath` from the
20
- * resolver and surface with `manifest: null` initially. `manifest` is
21
- * filled in later, by `attachManifestEnrichment` — the ONE enrichment
22
- * seam (see below).
23
- * 2. Local definitions that were never referenced in any occurrence —
24
- * still need a `components[]` entry so they can serve as owner-edge
25
- * targets in the composition graph.
26
- *
27
- * Observed-only invariant: this function never creates a seed from manifest
28
- * data. A seed exists here iff it was observed (parsed occurrence or local
29
- * definition); manifest enrichment can only ever attach to an already-observed
30
- * seed, never conjure a new one.
31
- *
32
- * Scope derivation: "local" for source.type === "local"; "external" otherwise.
33
- * DS-grouping is the web app's responsibility — CC emits two scopes only.
34
- */
35
- export function buildComponentSeeds(parseResults, localIndex, repoRoot, workspaceGraph, registry,
36
- /** The scan's `meta.repo.id`, stamped on every local identity. */
37
- repoId = "") {
38
- const seedsById = new Map();
39
- // 1. Parser-emitted components first. These carry `modulePath` for
40
- // resolver-driven externals and are the ones occurrences hash against.
41
- for (const result of parseResults) {
42
- for (const occ of result.occurrences) {
43
- // Normalise local filePaths: parsers emit absolute paths; the local index
44
- // uses repo-root-relative POSIX paths. Relativise here so the stable id
45
- // matches the one produced for seeds built from the local index.
46
- const componentId = repoRoot && occ.componentId.source.type === "local" && isAbsolute(occ.componentId.source.filePath)
47
- ? {
48
- ...occ.componentId,
49
- source: {
50
- type: "local",
51
- filePath: posixPath(relative(repoRoot, occ.componentId.source.filePath)),
52
- },
53
- }
54
- : occ.componentId;
55
- const id = computeStableIdFromComponentId(componentId);
56
- if (seedsById.has(id))
57
- continue;
58
- const isLocal = componentId.source.type === "local";
59
- let definitionLoc;
60
- let matchedDeclared;
61
- let matchedIsDefault;
62
- if (isLocal && localIndex) {
63
- let match;
64
- if (componentId.kind === "custom-element") {
65
- match = localIndex.byTag.get(componentId.tagName);
66
- }
67
- else {
68
- const path = componentId.source.type === "local" ? componentId.source.filePath : "";
69
- const defs = localIndex.byPath.get(path) ?? [];
70
- const exportName = componentId.export;
71
- match = defs.find((d) => d.exportName === exportName);
72
- }
73
- if (match?.loc) {
74
- definitionLoc = { line: match.loc.line, column: match.loc.column };
75
- }
76
- matchedDeclared = match?.declared;
77
- matchedIsDefault = match?.isDefault;
78
- }
79
- const identity = computeOutputIdentity({
80
- componentId,
81
- repoId,
82
- ...(workspaceGraph !== undefined ? { workspaceGraph } : {}),
83
- ...(repoRoot !== undefined ? { outputRoot: repoRoot } : {}),
84
- ...(definitionLoc !== undefined ? { definitionLoc } : {}),
85
- });
86
- seedsById.set(id, {
87
- id,
88
- identity,
89
- manifest: null,
90
- ...(matchedDeclared ? { declared: matchedDeclared } : {}),
91
- ...(matchedIsDefault !== undefined ? { isDefaultExport: matchedIsDefault } : {}),
92
- });
93
- }
94
- }
95
- // 2. Local definitions that were never referenced in any occurrence.
96
- // These must still appear in components[] so they can serve as
97
- // owner-edge targets in the composition graph.
98
- if (localIndex) {
99
- for (const [, defs] of localIndex.byPath) {
100
- for (const def of defs) {
101
- // Registry join: the detector proposes, the registry
102
- // decides. A react definition the registry rejects is not a
103
- // component (a factory, a JSX value, an allowlisted wrapper over a
104
- // non-component). Vue and custom-element definitions are not typed
105
- // by the registry and pass through.
106
- if (registry !== undefined &&
107
- def.componentId.kind === "react-component" &&
108
- def.componentId.source.type === "local" &&
109
- !registry.hasLocal(def.componentId.source.filePath, def.exportName)) {
110
- continue;
111
- }
112
- const id = computeStableIdFromComponentId(def.componentId);
113
- if (seedsById.has(id))
114
- continue;
115
- const definitionLoc = def.loc !== undefined
116
- ? { line: def.loc.line, column: def.loc.column }
117
- : undefined;
118
- const identity = computeOutputIdentity({
119
- componentId: def.componentId,
120
- repoId,
121
- ...(workspaceGraph !== undefined ? { workspaceGraph } : {}),
122
- ...(repoRoot !== undefined ? { outputRoot: repoRoot } : {}),
123
- ...(definitionLoc !== undefined ? { definitionLoc } : {}),
124
- });
125
- seedsById.set(id, {
126
- id,
127
- identity,
128
- manifest: null,
129
- ...(def.declared ? { declared: def.declared } : {}),
130
- ...(def.isDefault !== undefined ? { isDefaultExport: def.isDefault } : {}),
131
- });
132
- }
133
- }
134
- }
135
- // 3. Registry entries no detector and no occurrence produced — factory
136
- // products (`const Textarea = createField(...)`, `withHoc(useX, View)`)
137
- // that the syntactic detector cannot classify. Seeded with the
138
- // declaration position; no `declared` (the registry has no AST).
139
- if (registry) {
140
- for (const entry of registry.localEntries()) {
141
- const componentId = {
142
- kind: entry.kind,
143
- export: entry.exportName,
144
- source: { type: "local", filePath: entry.filePath },
145
- };
146
- const id = computeStableIdFromComponentId(componentId);
147
- if (seedsById.has(id))
148
- continue;
149
- const identity = computeOutputIdentity({
150
- componentId,
151
- repoId,
152
- ...(workspaceGraph !== undefined ? { workspaceGraph } : {}),
153
- ...(repoRoot !== undefined ? { outputRoot: repoRoot } : {}),
154
- definitionLoc: entry.loc,
155
- });
156
- seedsById.set(id, { id, identity, manifest: null, isDefaultExport: entry.isDefault });
157
- }
158
- }
159
- return [...seedsById.values()];
160
- }
161
- /**
162
- * Attach manifest enrichment from a resolver snapshot onto already-observed
163
- * seeds. This is the ONE enrichment seam: every call site that needs a seed's
164
- * `manifest` populated from a snapshot (legacy parser-observed seeds, or
165
- * engine-discovered seeds from the reference-graph path) must route through
166
- * here rather than re-deriving the merge logic.
167
- *
168
- * Snapshot entries lack `modulePath`, so their stable id won't collide with
169
- * an observed seed's id even when they describe the same logical component.
170
- * Instead of hashing, look up by `{kind, packageName, exportName-or-tagName}`
171
- * and attach the manifest to that matching seed. Only merge when exactly one
172
- * seed matches — multiple matches (e.g. two subpaths both exporting
173
- * `default`) are ambiguous, and an ambiguous or absent match drops the
174
- * enrichment rather than mutating anything (observed-only invariant:
175
- * manifests never create `components[]` entries, and here they never create
176
- * one either — `seeds` is mutated in place, never appended to).
177
- *
178
- * Mutates the `ComponentSeed` objects in `seeds` in place; does not resize
179
- * the array.
180
- */
181
- export function attachManifestEnrichment(seeds, snapshot, workspaceGraph) {
182
- const workspacePackageNames = new Set(workspaceGraph?.packages.map((p) => p.name) ?? []);
183
- for (const entry of snapshot) {
184
- const componentId = indexedToComponentId(entry.component);
185
- // Workspace-sibling external: the lazy resolver walks
186
- // node_modules/<workspace-pkg> via the symlink and snapshots components
187
- // there as external. The engine emits the LOCAL identity for the
188
- // same component (workspace siblings → local). Skipping the external
189
- // snapshot prevents a phantom external seed surviving without
190
- // occurrences. The manifest enrichment is lost in this path; if/when a
191
- // workspace package authors a CEM, fold it into the local seed via a
192
- // separate code path keyed by filePath rather than packageName.
193
- if (componentId.source.type === "external" &&
194
- workspacePackageNames.has(componentId.source.package)) {
195
- continue;
196
- }
197
- const manifest = manifestComponentToOutput(entry.component);
198
- const mergeTarget = findUnambiguousMergeTarget(seeds, componentId);
199
- if (mergeTarget !== null) {
200
- mergeTarget.manifest = manifest;
201
- }
202
- }
203
- }
204
- /**
205
- * Find an observed seed whose logical identity matches the snapshot's
206
- * `ComponentId`, ignoring `modulePath` (snapshot entries don't carry it).
207
- *
208
- * The match is intentionally narrowed to **unambiguous** cases: if two or more
209
- * seeds share the same `{kind, packageName, exportName/tagName}` (e.g.
210
- * two subpaths of one package both exporting `default`), we cannot safely pick
211
- * one to enrich, so we return null. The caller drops the manifest enrichment
212
- * in that case rather than mutating any seed (observed-only invariant:
213
- * manifests never create `components[]` entries on their own).
214
- */
215
- function findUnambiguousMergeTarget(seeds, candidate) {
216
- if (candidate.source.type !== "external")
217
- return null;
218
- const candidatePackage = candidate.source.package;
219
- let match = null;
220
- for (const seed of seeds) {
221
- if (seed.identity.kind !== candidate.kind)
222
- continue;
223
- if (seed.identity.packageName !== candidatePackage)
224
- continue;
225
- if (candidate.kind === "custom-element") {
226
- if (seed.identity.tagName !== candidate.tagName)
227
- continue;
228
- }
229
- else {
230
- if (seed.identity.exportName !== candidate.export)
231
- continue;
232
- }
233
- if (match !== null)
234
- return null; // ambiguous — bail out
235
- match = seed;
236
- }
237
- return match;
238
- }
239
- /**
240
- * Convert an `IndexedComponent` to a `ComponentId` for use with
241
- * `computeOutputIdentity`. `IndexedComponent` extends `ManifestComponent`
242
- * which shares the same `source` / `kind` / `export` / `tagName` fields.
243
- */
244
- function indexedToComponentId(c) {
245
- if (c.kind === "custom-element") {
246
- return {
247
- kind: "custom-element",
248
- tagName: c.tagName,
249
- source: c.source,
250
- };
251
- }
252
- return {
253
- kind: c.kind,
254
- export: c.export,
255
- source: c.source,
256
- };
257
- }
258
- //# sourceMappingURL=seeds.js.map
package/dist/seeds.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"seeds.js","sourceRoot":"","sources":["../src/seeds.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAU3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EACL,qBAAqB,EACrB,8BAA8B,GAC/B,MAAM,eAAe,CAAC;AA2BvB;;;;;;;;;;;;;;;;;;;;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AmB;IAC/C,IAAI,CAAC,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"}
@@ -1,11 +0,0 @@
1
- export type { TagName, WrapperId } from "@component-compass/plugin-core";
2
- export { asTagName, asWrapperId } from "@component-compass/plugin-core";
3
- declare const __brand: unique symbol;
4
- type Brand<K, T> = K & {
5
- readonly [__brand]: T;
6
- };
7
- export type ComponentId = Brand<string, "ComponentId">;
8
- export type PackageName = Brand<string, "PackageName">;
9
- /** Unsafe constructors — use only at the data-ingest boundary. */
10
- export declare const asComponentId: (s: string) => ComponentId;
11
- export declare const asPackageName: (s: string) => PackageName;
@@ -1,5 +0,0 @@
1
- export { asTagName, asWrapperId } from "@component-compass/plugin-core";
2
- /** Unsafe constructors — use only at the data-ingest boundary. */
3
- export const asComponentId = (s) => s;
4
- export const asPackageName = (s) => s;
5
- //# sourceMappingURL=brand.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"brand.js","sourceRoot":"","sources":["../../src/types/brand.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAQxE,kEAAkE;AAClE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAS,EAAe,EAAE,CAAC,CAAgB,CAAC;AAC1E,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAS,EAAe,EAAE,CAAC,CAAgB,CAAC"}
@@ -1,2 +0,0 @@
1
- export type { ComponentId, ComponentKind, ManifestFile, ManifestComponent, } from "@component-compass/plugin-core";
2
- export { serialiseComponentId, compareComponentId } from "@component-compass/plugin-core";
@@ -1,2 +0,0 @@
1
- export { serialiseComponentId, compareComponentId } from "@component-compass/plugin-core";
2
- //# sourceMappingURL=component-id.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"component-id.js","sourceRoot":"","sources":["../../src/types/component-id.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC"}
package/dist/types.d.ts DELETED
@@ -1,13 +0,0 @@
1
- export type { Loc, WarningCode, Warning } from "@component-compass/plugin-core";
2
- export type ResolvedConfig = {
3
- configPath: string;
4
- configDir: string;
5
- repoId?: string;
6
- host?: string;
7
- include: string[];
8
- exclude: string[];
9
- output: string;
10
- gitignore: boolean;
11
- tsconfigPath?: string;
12
- aliases?: Record<string, string[]>;
13
- };
package/dist/types.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
package/dist/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/dist/upload.d.ts DELETED
@@ -1,18 +0,0 @@
1
- export type UploadResult = {
2
- status: "inserted";
3
- scanId: string;
4
- url: string;
5
- } | {
6
- status: "exists";
7
- scanId: string;
8
- url: string;
9
- };
10
- export declare class UploadError extends Error {
11
- code: number;
12
- constructor(code: number, message: string);
13
- }
14
- export declare function uploadArtifact(opts: {
15
- host: string;
16
- token: string;
17
- artifactJson: string;
18
- }): Promise<UploadResult>;
package/dist/upload.js DELETED
@@ -1,34 +0,0 @@
1
- import { gzipSync } from "node:zlib";
2
- export class UploadError extends Error {
3
- code;
4
- constructor(code, message) {
5
- super(message);
6
- this.code = code;
7
- }
8
- }
9
- const GZIP_THRESHOLD = 1024 * 1024; // 1 MB
10
- export async function uploadArtifact(opts) {
11
- const url = `${opts.host.replace(/\/$/, "")}/api/scans`;
12
- const useGzip = opts.artifactJson.length > GZIP_THRESHOLD;
13
- const body = useGzip
14
- ? gzipSync(Buffer.from(opts.artifactJson, "utf8"))
15
- : opts.artifactJson;
16
- const headers = {
17
- "Content-Type": "application/json",
18
- Authorization: `Bearer ${opts.token}`,
19
- };
20
- if (useGzip)
21
- headers["Content-Encoding"] = "gzip";
22
- const res = await fetch(url, { method: "POST", headers, body });
23
- if (res.status === 201 || res.status === 200) {
24
- const json = (await res.json());
25
- return {
26
- status: res.status === 201 ? "inserted" : "exists",
27
- scanId: json.scanId,
28
- url: json.url,
29
- };
30
- }
31
- const text = await res.text().catch(() => "");
32
- throw new UploadError(res.status, `Upload failed (${res.status}): ${text || res.statusText}`);
33
- }
34
- //# sourceMappingURL=upload.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"upload.js","sourceRoot":"","sources":["../src/upload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAMrC,MAAM,OAAO,WAAY,SAAQ,KAAK;IAE3B;IADT,YACS,IAAY,EACnB,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,SAAI,GAAJ,IAAI,CAAQ;IAIrB,CAAC;CACF;AAED,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,OAAO;AAE3C,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAIpC;IACC,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC;IACxD,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,cAAc,CAAC;IAC1D,MAAM,IAAI,GAAoB,OAAO;QACnC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QAClD,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC;IACtB,MAAM,OAAO,GAA2B;QACtC,cAAc,EAAE,kBAAkB;QAClC,aAAa,EAAE,UAAU,IAAI,CAAC,KAAK,EAAE;KACtC,CAAC;IACF,IAAI,OAAO;QAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,MAAM,CAAC;IAElD,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAChE,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QAC7C,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAoC,CAAC;QACnE,OAAO;YACL,MAAM,EAAE,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ;YAClD,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAC;IACJ,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IAC9C,MAAM,IAAI,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE,kBAAkB,GAAG,CAAC,MAAM,MAAM,IAAI,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;AAChG,CAAC"}
@@ -1,24 +0,0 @@
1
- export type ColorOptions = {
2
- isTTY?: boolean;
3
- env?: NodeJS.ProcessEnv;
4
- };
5
- /**
6
- * Whether to emit ANSI colour. The CLI is a guest in the user's terminal, so:
7
- * NO_COLOR (any non-empty value) disables; FORCE_COLOR (non-empty, not "0")
8
- * forces; otherwise follow the TTY. NO_COLOR wins over FORCE_COLOR.
9
- */
10
- export declare function colorEnabled(opts?: ColorOptions): boolean;
11
- export type Colorizer = {
12
- dim: (s: string) => string;
13
- bold: (s: string) => string;
14
- green: (s: string) => string;
15
- yellow: (s: string) => string;
16
- red: (s: string) => string;
17
- };
18
- /**
19
- * A colour palette mapped to DESIGN.md's three-layer model: dim/bold are chrome
20
- * (monochrome), green/yellow/red are the traffic-light status layer (always
21
- * paired with a glyph + word by the caller). Semantic 16-colour ANSI only —
22
- * it inherits the user's terminal theme rather than imposing brand RGB.
23
- */
24
- export declare function createColor(opts?: ColorOptions): Colorizer;
@@ -1,45 +0,0 @@
1
- const ANSI = {
2
- reset: "\x1b[0m",
3
- dim: "\x1b[2m",
4
- bold: "\x1b[1m",
5
- green: "\x1b[32m",
6
- yellow: "\x1b[33m",
7
- red: "\x1b[31m",
8
- };
9
- /**
10
- * Whether to emit ANSI colour. The CLI is a guest in the user's terminal, so:
11
- * NO_COLOR (any non-empty value) disables; FORCE_COLOR (non-empty, not "0")
12
- * forces; otherwise follow the TTY. NO_COLOR wins over FORCE_COLOR.
13
- */
14
- export function colorEnabled(opts = {}) {
15
- const env = opts.env ?? process.env;
16
- // biome-ignore lint/complexity/useLiteralKeys: env access
17
- const noColor = env["NO_COLOR"];
18
- if (noColor !== undefined && noColor !== "")
19
- return false;
20
- // biome-ignore lint/complexity/useLiteralKeys: env access
21
- const force = env["FORCE_COLOR"];
22
- if (force !== undefined && force !== "" && force !== "0")
23
- return true;
24
- return opts.isTTY ?? Boolean(process.stdout.isTTY);
25
- }
26
- function wrap(code, enabled) {
27
- return enabled ? (s) => `${code}${s}${ANSI.reset}` : (s) => s;
28
- }
29
- /**
30
- * A colour palette mapped to DESIGN.md's three-layer model: dim/bold are chrome
31
- * (monochrome), green/yellow/red are the traffic-light status layer (always
32
- * paired with a glyph + word by the caller). Semantic 16-colour ANSI only —
33
- * it inherits the user's terminal theme rather than imposing brand RGB.
34
- */
35
- export function createColor(opts = {}) {
36
- const on = colorEnabled(opts);
37
- return {
38
- dim: wrap(ANSI.dim, on),
39
- bold: wrap(ANSI.bold, on),
40
- green: wrap(ANSI.green, on),
41
- yellow: wrap(ANSI.yellow, on),
42
- red: wrap(ANSI.red, on),
43
- };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IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;QACvB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QACzB,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;QAC3B,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;QAC7B,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;KACxB,CAAC;AACJ,CAAC"}
@@ -1,10 +0,0 @@
1
- export type MTimeRange = {
2
- firstCommitAt: string;
3
- lastCommitAt: string;
4
- };
5
- export declare function readFileMTimes(root: string, paths: string[]): Promise<Map<string, MTimeRange>>;
6
- export declare function readGitCommit(root: string): Promise<string | undefined>;
7
- export declare function readInitialCommit(root: string): Promise<string | undefined>;
8
- export declare function readGitRemote(root: string): Promise<string | null>;
9
- export declare function readGitBranch(root: string): Promise<string | null>;
10
- export declare function readGitToplevel(root: string): Promise<string | null>;
package/dist/util/git.js DELETED
@@ -1,95 +0,0 @@
1
- import { execFile } from "node:child_process";
2
- import { promisify } from "node:util";
3
- const exec = promisify(execFile);
4
- export async function readFileMTimes(root, paths) {
5
- if (paths.length === 0)
6
- return new Map();
7
- const out = new Map();
8
- // git log --reverse interleaves commits oldest-first. Marker line precedes
9
- // each commit's file list. Walk linearly: track currentDate, then bucket
10
- // each named path into first (set once) / last (overwrite each commit).
11
- // Known fidelity gaps: shallow clones cap firstCommitAt at the depth boundary;
12
- // renames without --follow stop at the rename.
13
- try {
14
- const args = [
15
- "-c",
16
- "core.quotePath=false",
17
- "log",
18
- "--reverse",
19
- "--name-only",
20
- "--format=__CC_COMMIT__ %aI",
21
- "--",
22
- ...paths,
23
- ];
24
- const { stdout } = await exec("git", args, {
25
- cwd: root,
26
- maxBuffer: 64 * 1024 * 1024,
27
- });
28
- let currentDate = null;
29
- for (const line of stdout.split("\n")) {
30
- if (line.startsWith("__CC_COMMIT__ ")) {
31
- currentDate = line.slice("__CC_COMMIT__ ".length).trim();
32
- }
33
- else if (line.trim() && currentDate) {
34
- const p = line.trim();
35
- const existing = out.get(p);
36
- if (existing)
37
- existing.lastCommitAt = currentDate;
38
- else
39
- out.set(p, { firstCommitAt: currentDate, lastCommitAt: currentDate });
40
- }
41
- }
42
- }
43
- catch {
44
- // git failure or buffer overflow — return whatever's accumulated (or empty).
45
- }
46
- return out;
47
- }
48
- export async function readGitCommit(root) {
49
- try {
50
- const { stdout } = await exec("git", ["rev-parse", "HEAD"], { cwd: root });
51
- return stdout.trim();
52
- }
53
- catch {
54
- return undefined;
55
- }
56
- }
57
- export async function readInitialCommit(root) {
58
- try {
59
- const { stdout } = await exec("git", ["rev-list", "--max-parents=0", "HEAD"], { cwd: root });
60
- return stdout.trim().split("\n")[0];
61
- }
62
- catch {
63
- return undefined;
64
- }
65
- }
66
- export async function readGitRemote(root) {
67
- try {
68
- const { stdout } = await exec("git", ["config", "--get", "remote.origin.url"], { cwd: root });
69
- return stdout.trim() || null;
70
- }
71
- catch {
72
- return null;
73
- }
74
- }
75
- export async function readGitBranch(root) {
76
- try {
77
- const { stdout } = await exec("git", ["rev-parse", "--abbrev-ref", "HEAD"], { cwd: root });
78
- const branch = stdout.trim();
79
- // "HEAD" means detached HEAD state — not a named branch.
80
- return branch === "HEAD" ? null : branch || null;
81
- }
82
- catch {
83
- return null;
84
- }
85
- }
86
- export async function readGitToplevel(root) {
87
- try {
88
- const { stdout } = await exec("git", ["rev-parse", "--show-toplevel"], { cwd: root });
89
- return stdout.trim() || null;
90
- }
91
- catch {
92
- return null;
93
- }
94
- }
95
- //# sourceMappingURL=git.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/util/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,IAA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;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAAY;IAC9C,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3F,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;QAC7B,yDAAyD;QACzD,OAAO,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,IAAI,IAAI,CAAC;IACnD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAAY;IAChD,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,iBAAiB,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;QACtF,OAAO,MAAM,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -1,17 +0,0 @@
1
- export type InteractiveOptions = {
2
- stdin?: {
3
- isTTY?: boolean;
4
- };
5
- stdout?: {
6
- isTTY?: boolean;
7
- };
8
- env?: NodeJS.ProcessEnv;
9
- yes?: boolean;
10
- };
11
- /**
12
- * The single gate deciding whether a prompt may be shown. A prompt is reachable
13
- * only when this is true AND the value wasn't already supplied by flag/env/
14
- * config. False in CI, under --yes, or without a TTY on both streams — those
15
- * paths must fall back to the flag-or-error behaviour, never block on stdin.
16
- */
17
- export declare function isInteractive(opts?: InteractiveOptions): boolean;
@@ -1,19 +0,0 @@
1
- /**
2
- * The single gate deciding whether a prompt may be shown. A prompt is reachable
3
- * only when this is true AND the value wasn't already supplied by flag/env/
4
- * config. False in CI, under --yes, or without a TTY on both streams — those
5
- * paths must fall back to the flag-or-error behaviour, never block on stdin.
6
- */
7
- export function isInteractive(opts = {}) {
8
- if (opts.yes)
9
- return false;
10
- const env = opts.env ?? process.env;
11
- // biome-ignore lint/complexity/useLiteralKeys: env access
12
- const ci = env["CI"];
13
- if (ci !== undefined && ci !== "" && ci !== "false" && ci !== "0")
14
- return false;
15
- const stdin = opts.stdin ?? process.stdin;
16
- const stdout = opts.stdout ?? process.stdout;
17
- return Boolean(stdin.isTTY) && Boolean(stdout.isTTY);
18
- }
19
- //# sourceMappingURL=interactive.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"interactive.js","sourceRoot":"","sources":["../../src/util/interactive.ts"],"names":[],"mappings":"AAOA;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,OAA2B,EAAE;IACzD,IAAI,IAAI,CAAC,GAAG;QAAE,OAAO,KAAK,CAAC;IAC3B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IACpC,0DAA0D;IAC1D,MAAM,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;IACrB,IAAI,EAAE,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,OAAO,IAAI,EAAE,KAAK,GAAG;QAAE,OAAO,KAAK,CAAC;IAChF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC;IAC1C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;IAC7C,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACvD,CAAC"}
@@ -1,9 +0,0 @@
1
- import { type Colorizer } from "./color.js";
2
- export declare class Logger {
3
- private quiet;
4
- private readonly color;
5
- constructor(quiet?: boolean, color?: Colorizer);
6
- info(msg: string): void;
7
- warn(msg: string): void;
8
- error(msg: string): void;
9
- }