@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.
- package/README.md +1 -1
- package/dist/cli.js +12 -4
- package/dist/cli.js.map +1 -1
- package/dist/commands/init.d.ts +3 -2
- package/dist/commands/init.js +50 -62
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/no-deps-diagnostic.d.ts +15 -0
- package/dist/commands/no-deps-diagnostic.js +23 -0
- package/dist/commands/no-deps-diagnostic.js.map +1 -0
- package/dist/commands/scan.d.ts +1 -0
- package/dist/commands/scan.js +126 -82
- package/dist/commands/scan.js.map +1 -1
- package/dist/composition-rollup.d.ts +23 -0
- package/dist/composition-rollup.js +64 -0
- package/dist/composition-rollup.js.map +1 -0
- package/dist/config/loader.js +5 -3
- package/dist/config/loader.js.map +1 -1
- package/dist/config/schema.d.ts +1 -2
- package/dist/config/schema.js.map +1 -1
- package/dist/identity.d.ts +21 -3
- package/dist/identity.js +40 -3
- package/dist/identity.js.map +1 -1
- package/dist/local-index/detect-react.js +224 -47
- package/dist/local-index/detect-react.js.map +1 -1
- package/dist/local-index/index.d.ts +4 -1
- package/dist/local-index/index.js +30 -13
- package/dist/local-index/index.js.map +1 -1
- package/dist/manifest/barrel-parser.d.ts +20 -0
- package/dist/manifest/barrel-parser.js +101 -16
- package/dist/manifest/barrel-parser.js.map +1 -1
- package/dist/manifest/derived-manifest-stub.d.ts +9 -0
- package/dist/manifest/derived-manifest-stub.js +11 -0
- package/dist/manifest/derived-manifest-stub.js.map +1 -0
- package/dist/manifest/diagnostic-filter.d.ts +13 -0
- package/dist/manifest/diagnostic-filter.js +36 -0
- package/dist/manifest/diagnostic-filter.js.map +1 -0
- package/dist/manifest/lazy-resolver.d.ts +44 -0
- package/dist/manifest/lazy-resolver.js +532 -0
- package/dist/manifest/lazy-resolver.js.map +1 -0
- package/dist/occurrences.d.ts +17 -0
- package/dist/occurrences.js +97 -0
- package/dist/occurrences.js.map +1 -0
- package/dist/reporter/index.d.ts +47 -9
- package/dist/reporter/index.js +167 -17
- package/dist/reporter/index.js.map +1 -1
- package/dist/reporter/json.d.ts +6 -2
- package/dist/reporter/json.js +7 -3
- package/dist/reporter/json.js.map +1 -1
- package/dist/reporter/stdout.d.ts +2 -2
- package/dist/reporter/stdout.js +11 -23
- package/dist/reporter/stdout.js.map +1 -1
- package/dist/rollup.d.ts +8 -2
- package/dist/rollup.js +2 -3
- package/dist/rollup.js.map +1 -1
- package/dist/seeds.d.ts +41 -0
- package/dist/seeds.js +145 -0
- package/dist/seeds.js.map +1 -0
- package/dist/types.d.ts +0 -1
- package/dist/workspace/build-graph.d.ts +2 -0
- package/dist/workspace/build-graph.js +117 -0
- package/dist/workspace/build-graph.js.map +1 -0
- package/dist/workspace/declared-deps.d.ts +5 -0
- package/dist/workspace/declared-deps.js +42 -0
- package/dist/workspace/declared-deps.js.map +1 -0
- package/dist/workspace/find-owning-package.d.ts +2 -0
- package/dist/workspace/find-owning-package.js +49 -0
- package/dist/workspace/find-owning-package.js.map +1 -0
- package/dist/workspace/index.d.ts +4 -0
- package/dist/workspace/index.js +4 -0
- package/dist/workspace/index.js.map +1 -0
- package/dist/workspace/types.d.ts +46 -0
- package/dist/workspace/types.js +13 -0
- package/dist/workspace/types.js.map +1 -0
- package/package.json +11 -9
- package/schema/config.schema.json +2 -10
- package/dist/graph/builder.d.ts +0 -25
- package/dist/graph/builder.js +0 -176
- package/dist/graph/builder.js.map +0 -1
- package/dist/manifest/discovery.d.ts +0 -24
- package/dist/manifest/discovery.js +0 -194
- package/dist/manifest/discovery.js.map +0 -1
- package/dist/manifest/index.d.ts +0 -6
- package/dist/manifest/index.js +0 -98
- package/dist/manifest/index.js.map +0 -1
- package/dist/manifest/resolver.d.ts +0 -30
- package/dist/manifest/resolver.js +0 -136
- package/dist/manifest/resolver.js.map +0 -1
- package/dist/manifest/run-discovery.d.ts +0 -12
- package/dist/manifest/run-discovery.js +0 -46
- package/dist/manifest/run-discovery.js.map +0 -1
- package/dist/manifest/types.d.ts +0 -3
- package/dist/manifest/types.js +0 -2
- package/dist/manifest/types.js.map +0 -1
- package/dist/reporter/types.d.ts +0 -69
- package/dist/reporter/types.js +0 -2
- package/dist/reporter/types.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"occurrences.js","sourceRoot":"","sources":["../src/occurrences.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EACL,mBAAmB,GAKpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,8BAA8B,EAAE,MAAM,eAAe,CAAC;AAE/D;;;;;;GAMG;AACH,SAAS,sBAAsB,CAAC,CAAc,EAAE,QAAgB;IAC9D,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,OAAO;QAAE,OAAO,CAAC,CAAC;IACxC,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;IAC7B,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QAAE,OAAO,CAAC,CAAC;IAC9B,OAAO;QACL,GAAG,CAAC;QACJ,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE;KAChF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,OAAsB,EACtB,aAAsB,EACtB,QAAQ,GAAG,EAAE;IAEb,MAAM,GAAG,GAAuB,EAAE,CAAC;IACnC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,uEAAuE;QACvE,oEAAoE;QACpE,0EAA0E;QAC1E,MAAM,QAAQ,GACZ,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YA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AM,GAAqB;gBAC/B,WAAW;gBACX,QAAQ,EAAE,GAAG,CAAC,GAAG,CAAC,IAAI;gBACtB,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,IAAI;gBAClB,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,MAAM;gBACtB,GAAG,EAAE,GAAG,CAAC,GAAG;gBACZ,KAAK;gBACL,YAAY;aACb,CAAC;YACF,IAAI,GAAG,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;gBAChC,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;gBACvC,IAAI,MAAM,EAAE,CAAC;oBACX,MAAM,CAAC,kBAAkB,GAAG,MAAM,CAAC,YAAY,CAAC;gBAClD,CAAC;YACH,CAAC;YACD,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS;gBAAE,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;YACtD,IAAI,GAAG,CAAC,gBAAgB,EAAE,CAAC;gBACzB,MAAM,SAAS,GAAG,QAAQ;oBACxB,CAAC,CAAC,sBAAsB,CAAC,GAAG,CAAC,gBAAgB,EAAE,QAAQ,CAAC;oBACxD,CAAC,CAAC,GAAG,CAAC,gBAAgB,CAAC;gBACzB,MAAM,CAAC,gBAAgB,GAAG,8BAA8B,CAAC,SAAS,CAAC,CAAC;YACtE,CAAC;YACD,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/reporter/index.d.ts
CHANGED
|
@@ -7,18 +7,56 @@
|
|
|
7
7
|
*
|
|
8
8
|
* It does no IO; downstream JSON / stdout reporters consume the result.
|
|
9
9
|
*/
|
|
10
|
-
import type { ManifestComponent,
|
|
10
|
+
import type { AuthoredManifestData, DerivedManifestData, Diagnostic, ManifestComponent, ManifestRef, OutputOccurrence, ScanEnvelope, ScanOutput, ScanStats } from "@component-compass/plugin-core";
|
|
11
11
|
import { type ComponentSeed } from "../rollup.js";
|
|
12
|
-
export
|
|
12
|
+
export type PartialScanStats = Pick<ScanStats, "filesScanned" | "filesWithUsage" | "scanDurationMs">;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
14
|
+
* Builds the two-grain `ScanOutput` from the per-component seeds and the
|
|
15
|
+
* flat occurrence stream. When `packageScopes` is non-empty the emitter
|
|
16
|
+
* applies a final filter: components whose `identity.packageName` matches
|
|
17
|
+
* no scope pattern are dropped, along with every occurrence pointing at
|
|
18
|
+
* them. Local components always pass — `packageScopes` only constrains
|
|
19
|
+
* the external/ds lanes. An empty `packageScopes` array short-circuits
|
|
20
|
+
* the filter (visibility-first: emit everything).
|
|
21
|
+
*
|
|
22
|
+
* Pipeline order: rollup → composition → scope filter.
|
|
23
|
+
*
|
|
24
|
+
* Composition runs BEFORE the scope filter so cross-component parent
|
|
25
|
+
* counts are computed against the full occurrence graph. The scope
|
|
26
|
+
* filter then drops out-of-scope components, their occurrences, and —
|
|
27
|
+
* by transitive consequence — their composition rollup. Running
|
|
28
|
+
* composition AFTER the filter would let a child's parent
|
|
29
|
+
* `occurrenceId` resolve to a dropped component, leaving a dangling
|
|
30
|
+
* reference in the artifact's `renderedByCount`.
|
|
31
|
+
*
|
|
32
|
+
* The filter runs AFTER rollup so the per-component stats already reflect
|
|
33
|
+
* the data the consumer will see in the artifact.
|
|
34
|
+
*/
|
|
35
|
+
export declare function buildScanOutput(envelope: ScanEnvelope, manifests: ManifestRef[], partialStats: PartialScanStats, seeds: ComponentSeed[], occurrences: OutputOccurrence[], packageScopes: string[], diagnostics: Diagnostic[]): ScanOutput;
|
|
36
|
+
type AuthoredEnvelope = {
|
|
37
|
+
source: "authored";
|
|
38
|
+
data: AuthoredManifestData;
|
|
39
|
+
};
|
|
40
|
+
type DerivedEnvelope = {
|
|
41
|
+
source: "derived";
|
|
42
|
+
data: DerivedManifestData;
|
|
43
|
+
};
|
|
44
|
+
type ManifestEnvelope = AuthoredEnvelope | DerivedEnvelope | null;
|
|
45
|
+
/**
|
|
46
|
+
* Pure converter: project a rich `ManifestComponent` (resolver-side domain
|
|
47
|
+
* model) onto the artifact-shape envelope `{ source, data }` consumed by the
|
|
48
|
+
* JSON report. The `data` payload is `AuthoredManifestData` (or its
|
|
49
|
+
* structural twin `DerivedManifestData`) — Phase 3's per-component manifest
|
|
50
|
+
* shape: optional `description`, `lifecycle`, and per-feature record maps
|
|
51
|
+
* (`props`, `slots`, `invocable`). Optional fields are omitted from the
|
|
52
|
+
* payload entirely when the input does not carry them (no `null` synth, no
|
|
53
|
+
* empty maps).
|
|
54
|
+
*
|
|
55
|
+
* Slots and events are CEM-shape only — react/vue ManifestComponents have no
|
|
56
|
+
* `events`/`slots` arrays — so we discriminate on `kind` before reading them.
|
|
20
57
|
*
|
|
21
58
|
* Returns `null` when no manifest entry was matched for the component, so
|
|
22
59
|
* downstream `OutputComponent.manifest` can be set directly.
|
|
23
60
|
*/
|
|
24
|
-
export declare function manifestComponentToOutput(m: ManifestComponent | undefined
|
|
61
|
+
export declare function manifestComponentToOutput(m: ManifestComponent | undefined, source: "authored" | "derived"): ManifestEnvelope;
|
|
62
|
+
export {};
|
package/dist/reporter/index.js
CHANGED
|
@@ -7,36 +7,186 @@
|
|
|
7
7
|
*
|
|
8
8
|
* It does no IO; downstream JSON / stdout reporters consume the result.
|
|
9
9
|
*/
|
|
10
|
+
import picomatch from "picomatch";
|
|
11
|
+
import { applyCompositionRollup } from "../composition-rollup.js";
|
|
10
12
|
import { rollupOccurrencesToComponents } from "../rollup.js";
|
|
11
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Builds the two-grain `ScanOutput` from the per-component seeds and the
|
|
15
|
+
* flat occurrence stream. When `packageScopes` is non-empty the emitter
|
|
16
|
+
* applies a final filter: components whose `identity.packageName` matches
|
|
17
|
+
* no scope pattern are dropped, along with every occurrence pointing at
|
|
18
|
+
* them. Local components always pass — `packageScopes` only constrains
|
|
19
|
+
* the external/ds lanes. An empty `packageScopes` array short-circuits
|
|
20
|
+
* the filter (visibility-first: emit everything).
|
|
21
|
+
*
|
|
22
|
+
* Pipeline order: rollup → composition → scope filter.
|
|
23
|
+
*
|
|
24
|
+
* Composition runs BEFORE the scope filter so cross-component parent
|
|
25
|
+
* counts are computed against the full occurrence graph. The scope
|
|
26
|
+
* filter then drops out-of-scope components, their occurrences, and —
|
|
27
|
+
* by transitive consequence — their composition rollup. Running
|
|
28
|
+
* composition AFTER the filter would let a child's parent
|
|
29
|
+
* `occurrenceId` resolve to a dropped component, leaving a dangling
|
|
30
|
+
* reference in the artifact's `renderedByCount`.
|
|
31
|
+
*
|
|
32
|
+
* The filter runs AFTER rollup so the per-component stats already reflect
|
|
33
|
+
* the data the consumer will see in the artifact.
|
|
34
|
+
*/
|
|
35
|
+
export function buildScanOutput(envelope, manifests, partialStats, seeds, occurrences, packageScopes, diagnostics) {
|
|
36
|
+
const rolled = rollupOccurrencesToComponents(occurrences, seeds);
|
|
37
|
+
const withComposition = applyCompositionRollup(rolled, occurrences);
|
|
38
|
+
const pruned = dropUnreachableLocalSeeds(withComposition);
|
|
39
|
+
const filtered = applyScopeFilter(pruned, occurrences, packageScopes);
|
|
40
|
+
const stats = {
|
|
41
|
+
...partialStats,
|
|
42
|
+
componentsDetected: filtered.components.length,
|
|
43
|
+
totalOccurrences: filtered.occurrences.length,
|
|
44
|
+
};
|
|
12
45
|
return {
|
|
13
46
|
envelope,
|
|
14
|
-
|
|
15
|
-
|
|
47
|
+
manifests,
|
|
48
|
+
stats,
|
|
49
|
+
components: filtered.components,
|
|
50
|
+
occurrences: filtered.occurrences,
|
|
51
|
+
diagnostics,
|
|
16
52
|
};
|
|
17
53
|
}
|
|
18
54
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
55
|
+
* Drops local components that contribute no information to the artifact:
|
|
56
|
+
* no occurrences AND not referenced as parent or child in any composition
|
|
57
|
+
* edge. Workspace-scoped scans accumulate thousands of these — every
|
|
58
|
+
* locally-defined component the include glob walks past, regardless of
|
|
59
|
+
* whether anything in scope renders it. Under the exports-only owner
|
|
60
|
+
* attribution invariant, a local seed that's neither rendered nor owns
|
|
61
|
+
* rendering is unreachable in the dependency graph by construction, so
|
|
62
|
+
* dropping it is lossless.
|
|
63
|
+
*
|
|
64
|
+
* Non-local seeds (ds / external) are preserved unconditionally — they
|
|
65
|
+
* represent identity attribution work the resolver did, not local-index
|
|
66
|
+
* walk-through.
|
|
67
|
+
*/
|
|
68
|
+
function dropUnreachableLocalSeeds(components) {
|
|
69
|
+
return components.filter((c) => {
|
|
70
|
+
if (c.identity.scope !== "local")
|
|
71
|
+
return true;
|
|
72
|
+
if (c.stats.occurrenceCount > 0)
|
|
73
|
+
return true;
|
|
74
|
+
const rendersN = Object.keys(c.composition?.rendersByCount ?? {}).length;
|
|
75
|
+
const renderedByN = Object.keys(c.composition?.renderedByCount ?? {}).length;
|
|
76
|
+
return rendersN > 0 || renderedByN > 0;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Drops components whose `identity.packageName` matches none of the scope
|
|
81
|
+
* patterns and every occurrence pointing at a dropped component. Local
|
|
82
|
+
* components always pass (their `identity.scope === "local"` and they
|
|
83
|
+
* have no `packageName` to match).
|
|
84
|
+
*
|
|
85
|
+
* Empty `packageScopes` is the explicit "no filter" signal — the function
|
|
86
|
+
* returns the inputs untouched (visibility-first emit).
|
|
87
|
+
*/
|
|
88
|
+
function applyScopeFilter(components, occurrences, packageScopes) {
|
|
89
|
+
if (packageScopes.length === 0)
|
|
90
|
+
return { components, occurrences };
|
|
91
|
+
const matchers = packageScopes.map((p) => picomatch(p));
|
|
92
|
+
const allowedIds = new Set();
|
|
93
|
+
const allowedComponents = components.filter((c) => {
|
|
94
|
+
if (c.identity.scope === "local") {
|
|
95
|
+
allowedIds.add(c.id);
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
const pkg = c.identity.packageName ?? "";
|
|
99
|
+
if (matchers.some((m) => m(pkg))) {
|
|
100
|
+
allowedIds.add(c.id);
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
return false;
|
|
104
|
+
});
|
|
105
|
+
const allowedOccurrences = occurrences.filter((o) => allowedIds.has(o.componentId));
|
|
106
|
+
return { components: allowedComponents, occurrences: allowedOccurrences };
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Pure converter: project a rich `ManifestComponent` (resolver-side domain
|
|
110
|
+
* model) onto the artifact-shape envelope `{ source, data }` consumed by the
|
|
111
|
+
* JSON report. The `data` payload is `AuthoredManifestData` (or its
|
|
112
|
+
* structural twin `DerivedManifestData`) — Phase 3's per-component manifest
|
|
113
|
+
* shape: optional `description`, `lifecycle`, and per-feature record maps
|
|
114
|
+
* (`props`, `slots`, `invocable`). Optional fields are omitted from the
|
|
115
|
+
* payload entirely when the input does not carry them (no `null` synth, no
|
|
116
|
+
* empty maps).
|
|
117
|
+
*
|
|
118
|
+
* Slots and events are CEM-shape only — react/vue ManifestComponents have no
|
|
119
|
+
* `events`/`slots` arrays — so we discriminate on `kind` before reading them.
|
|
25
120
|
*
|
|
26
121
|
* Returns `null` when no manifest entry was matched for the component, so
|
|
27
122
|
* downstream `OutputComponent.manifest` can be set directly.
|
|
28
123
|
*/
|
|
29
|
-
export function manifestComponentToOutput(m) {
|
|
124
|
+
export function manifestComponentToOutput(m, source) {
|
|
30
125
|
if (!m)
|
|
31
126
|
return null;
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
props[p.name] = { default: p.default };
|
|
36
|
-
}
|
|
37
|
-
const out = { props };
|
|
127
|
+
const data = {};
|
|
128
|
+
if (m.description !== undefined)
|
|
129
|
+
data.description = m.description;
|
|
38
130
|
if (m.lifecycle !== undefined)
|
|
39
|
-
|
|
131
|
+
data.lifecycle = m.lifecycle;
|
|
132
|
+
if (m.props.length > 0) {
|
|
133
|
+
const props = {};
|
|
134
|
+
for (const p of m.props)
|
|
135
|
+
props[p.name] = projectProp(p);
|
|
136
|
+
data.props = props;
|
|
137
|
+
}
|
|
138
|
+
// Slots and events are CEM-shape only — react/vue ManifestComponents have no
|
|
139
|
+
// events/slots arrays. Discriminate by kind.
|
|
140
|
+
if (m.kind === "custom-element") {
|
|
141
|
+
if (m.slots && m.slots.length > 0) {
|
|
142
|
+
const slots = {};
|
|
143
|
+
for (const s of m.slots)
|
|
144
|
+
slots[s.name] = projectSlot(s);
|
|
145
|
+
data.slots = slots;
|
|
146
|
+
}
|
|
147
|
+
if (m.events && m.events.length > 0) {
|
|
148
|
+
const invocable = {};
|
|
149
|
+
for (const e of m.events)
|
|
150
|
+
invocable[e.name] = projectEventAsInvocable(e);
|
|
151
|
+
data.invocable = invocable;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return source === "authored"
|
|
155
|
+
? { source: "authored", data }
|
|
156
|
+
: { source: "derived", data };
|
|
157
|
+
}
|
|
158
|
+
function projectProp(p) {
|
|
159
|
+
const out = {};
|
|
160
|
+
if (p.type !== undefined)
|
|
161
|
+
out.type = p.type;
|
|
162
|
+
if (p.default !== undefined)
|
|
163
|
+
out.default = p.default;
|
|
164
|
+
if (p.values !== undefined)
|
|
165
|
+
out.values = p.values;
|
|
166
|
+
if (p.required !== undefined)
|
|
167
|
+
out.required = p.required;
|
|
168
|
+
if (p.description !== undefined)
|
|
169
|
+
out.description = p.description;
|
|
170
|
+
if (p.lifecycle !== undefined)
|
|
171
|
+
out.lifecycle = p.lifecycle;
|
|
172
|
+
return out;
|
|
173
|
+
}
|
|
174
|
+
function projectSlot(s) {
|
|
175
|
+
const out = {};
|
|
176
|
+
if (s.description !== undefined)
|
|
177
|
+
out.description = s.description;
|
|
178
|
+
if (s.lifecycle !== undefined)
|
|
179
|
+
out.lifecycle = s.lifecycle;
|
|
180
|
+
return out;
|
|
181
|
+
}
|
|
182
|
+
function projectEventAsInvocable(e) {
|
|
183
|
+
const out = { kind: "dom-event" };
|
|
184
|
+
if (e.payloadType !== undefined)
|
|
185
|
+
out.payloadType = e.payloadType;
|
|
186
|
+
if (e.description !== undefined)
|
|
187
|
+
out.description = e.description;
|
|
188
|
+
if (e.lifecycle !== undefined)
|
|
189
|
+
out.lifecycle = e.lifecycle;
|
|
40
190
|
return out;
|
|
41
191
|
}
|
|
42
192
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/reporter/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/reporter/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,SAAS,MAAM,WAAW,CAAC;AAmBlC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,6BAA6B,EAAsB,MAAM,cAAc,CAAC;AAOjF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAsB,EACtB,SAAwB,EACxB,YAA8B,EAC9B,KAAsB,EACtB,WAA+B,EAC/B,aAAuB,EACvB,WAAyB;IAEzB,MAAM,MAAM,GAAG,6BAA6B,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IACjE,MAAM,eAAe,GAAG,sBAAsB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACpE,MAAM,MAAM,GAAG,yBAAyB,CAAC,eAAe,CAAC,CAAC;IAC1D,MAAM,QAAQ,GAAG,gBAAgB,CAAC,MAAM,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC;IACtE,MAAM,KAAK,GAAc;QACvB,GAAG,YAAY;QACf,kBAAkB,EAAE,QAAQ,CAAC,UAAU,CAAC,MAAM;QAC9C,gBAA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
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { ScanOutput } from "@component-compass/plugin-core";
|
|
2
|
+
/**
|
|
3
|
+
* Writes the v2 ScanOutput artifact to disk as pretty-printed JSON.
|
|
4
|
+
* Creates parent directories as needed.
|
|
5
|
+
*/
|
|
6
|
+
export declare function writeJson(output: ScanOutput, outputPath: string): Promise<void>;
|
package/dist/reporter/json.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { writeFile, mkdir } from "node:fs/promises";
|
|
2
2
|
import { dirname } from "node:path";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Writes the v2 ScanOutput artifact to disk as pretty-printed JSON.
|
|
5
|
+
* Creates parent directories as needed.
|
|
6
|
+
*/
|
|
7
|
+
export async function writeJson(output, outputPath) {
|
|
8
|
+
await mkdir(dirname(outputPath), { recursive: true });
|
|
9
|
+
await writeFile(outputPath, `${JSON.stringify(output, null, 2)}\n`, "utf8");
|
|
6
10
|
}
|
|
7
11
|
//# sourceMappingURL=json.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/reporter/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/reporter/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,MAAkB,EAAE,UAAkB;IACpE,MAAM,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,MAAM,SAAS,CAAC,UAAU,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function printSummary(
|
|
1
|
+
import type { ScanOutput } from "@component-compass/plugin-core";
|
|
2
|
+
export declare function printSummary(out: ScanOutput, outputPath: string): void;
|
package/dist/reporter/stdout.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
export function printSummary(
|
|
2
|
-
const { envelope,
|
|
1
|
+
export function printSummary(out, outputPath) {
|
|
2
|
+
const { envelope, components, stats } = out;
|
|
3
3
|
const lines = [];
|
|
4
4
|
lines.push("");
|
|
5
5
|
lines.push("component-compass scan");
|
|
6
6
|
lines.push("──────────────────────");
|
|
7
7
|
lines.push(`scanId: ${envelope.scanId}`);
|
|
8
8
|
lines.push(`repoId: ${envelope.repoId}`);
|
|
9
|
-
lines.push(`commit: ${envelope.commitSha ?? "(none)"}`);
|
|
10
|
-
lines.push(`branch: ${envelope.branch ?? "(none)"}`);
|
|
11
9
|
lines.push(`timestamp: ${envelope.timestamp}`);
|
|
12
10
|
lines.push("");
|
|
13
11
|
lines.push(`Scanned ${stats.filesScanned} files in ${(stats.scanDurationMs / 1000).toFixed(1)}s — ${stats.filesWithUsage} files use design system components`);
|
|
12
|
+
lines.push(`Components detected: ${stats.componentsDetected}`);
|
|
13
|
+
lines.push(`Total occurrences: ${stats.totalOccurrences}`);
|
|
14
14
|
lines.push("");
|
|
15
15
|
const sorted = [...components]
|
|
16
|
-
.sort((a, b) => b.
|
|
16
|
+
.sort((a, b) => b.stats.occurrenceCount - a.stats.occurrenceCount)
|
|
17
17
|
.slice(0, 5);
|
|
18
18
|
if (sorted.length > 0) {
|
|
19
19
|
lines.push("Top by usage:");
|
|
@@ -22,31 +22,19 @@ export function printSummary(doc, outputPath) {
|
|
|
22
22
|
for (const [i, c] of sorted.entries()) {
|
|
23
23
|
const label = labels[i] ?? "";
|
|
24
24
|
const pad = " ".repeat(widest - label.length + 2);
|
|
25
|
-
lines.push(` ${label}${pad}${c.
|
|
25
|
+
lines.push(` ${label}${pad}${c.stats.occurrenceCount} [${c.identity.kind}]`);
|
|
26
26
|
}
|
|
27
27
|
lines.push("");
|
|
28
28
|
}
|
|
29
|
-
if (warnings.length > 0) {
|
|
30
|
-
const grouped = new Map();
|
|
31
|
-
for (const w of warnings)
|
|
32
|
-
grouped.set(w.code, (grouped.get(w.code) ?? 0) + 1);
|
|
33
|
-
lines.push(`⚠ ${warnings.length} warnings (see component-compass.json#/warnings)`);
|
|
34
|
-
for (const [code, count] of grouped)
|
|
35
|
-
lines.push(` - ${code} × ${count}`);
|
|
36
|
-
lines.push("");
|
|
37
|
-
}
|
|
38
29
|
lines.push(`→ ${outputPath}`);
|
|
39
30
|
lines.push("");
|
|
40
31
|
process.stdout.write(lines.join("\n"));
|
|
41
32
|
}
|
|
42
33
|
function componentLabel(c) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
? c.source.filePath
|
|
49
|
-
: "(unknown)";
|
|
50
|
-
return `${sourceLabel}::${c.export}`;
|
|
34
|
+
const { identity } = c;
|
|
35
|
+
if (identity.kind === "custom-element")
|
|
36
|
+
return identity.tagName ?? "(unknown)";
|
|
37
|
+
const pkg = identity.packageName ?? identity.filePath ?? "(unknown)";
|
|
38
|
+
return `${pkg}::${identity.exportName ?? "(unknown)"}`;
|
|
51
39
|
}
|
|
52
40
|
//# sourceMappingURL=stdout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdout.js","sourceRoot":"","sources":["../../src/reporter/stdout.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,YAAY,CAAC,
|
|
1
|
+
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,CAAC,WAAW,IAAI,QAAQ,CAAC,QAAQ,IAAI,WAAW,CAAC;IACrE,OAAO,GAAG,GAAG,KAAK,QAAQ,CAAC,UAAU,IAAI,WAAW,EAAE,CAAC;AACzD,CAAC"}
|
package/dist/rollup.d.ts
CHANGED
|
@@ -11,11 +11,17 @@
|
|
|
11
11
|
* design-system components present in the repo via `tagRules` surface even
|
|
12
12
|
* when not yet used.
|
|
13
13
|
*/
|
|
14
|
-
import type { OutputComponent, OutputIdentity,
|
|
14
|
+
import type { AuthoredManifestData, DerivedManifestData, OutputComponent, OutputIdentity, OutputOccurrence } from "@component-compass/plugin-core";
|
|
15
15
|
export type ComponentSeed = {
|
|
16
16
|
id: string;
|
|
17
17
|
identity: OutputIdentity;
|
|
18
18
|
derivedTags: string[];
|
|
19
|
-
manifest:
|
|
19
|
+
manifest: {
|
|
20
|
+
source: "authored";
|
|
21
|
+
data: AuthoredManifestData;
|
|
22
|
+
} | {
|
|
23
|
+
source: "derived";
|
|
24
|
+
data: DerivedManifestData;
|
|
25
|
+
} | null;
|
|
20
26
|
};
|
|
21
27
|
export declare function rollupOccurrencesToComponents(occurrences: OutputOccurrence[], seeds: ComponentSeed[]): OutputComponent[];
|
package/dist/rollup.js
CHANGED
|
@@ -41,12 +41,12 @@ export function rollupOccurrencesToComponents(occurrences, seeds) {
|
|
|
41
41
|
}
|
|
42
42
|
// Manifest-declared props with no occurrence usage still need a slot so
|
|
43
43
|
// the rollup can surface "prop X is universally unused / always defaulted".
|
|
44
|
-
for (const name of Object.keys(seed.manifest?.props ?? {}))
|
|
44
|
+
for (const name of Object.keys(seed.manifest?.data?.props ?? {}))
|
|
45
45
|
propsSeen.add(name);
|
|
46
46
|
const props = {};
|
|
47
47
|
for (const name of propsSeen) {
|
|
48
48
|
const dist = emptyDist();
|
|
49
|
-
const hasDefault = seed.manifest?.props?.[name]?.default !== undefined;
|
|
49
|
+
const hasDefault = seed.manifest?.data?.props?.[name]?.default !== undefined;
|
|
50
50
|
for (const o of occs) {
|
|
51
51
|
if (!(name in o.props)) {
|
|
52
52
|
dist.omitted += 1;
|
|
@@ -72,7 +72,6 @@ export function rollupOccurrencesToComponents(occurrences, seeds) {
|
|
|
72
72
|
manifest: seed.manifest,
|
|
73
73
|
stats: { occurrenceCount: occs.length, fileCount: fileSet.size },
|
|
74
74
|
props,
|
|
75
|
-
edges: { renders: [], renderedBy: [] },
|
|
76
75
|
};
|
|
77
76
|
});
|
|
78
77
|
}
|
package/dist/rollup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.js","sourceRoot":"","sources":["../src/rollup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"rollup.js","sourceRoot":"","sources":["../src/rollup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAyBH,MAAM,gBAAgB,GAAG,CAAC,CAAmB,EAAU,EAAE,CACvD,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAElC,MAAM,SAAS,GAAG,CAAC,CAAiB,EAAmC,EAAE,CACvE,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,WAAW,IAAI,CAAC,CAAC;AAE1D,MAAM,SAAS,GAAG,GAAqB,EAAE,CAAC,CAAC;IACzC,YAAY,EAAE,EAAE;IAChB,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,cAAc,EAAE,CAAC;CAClB,CAAC,CAAC;AAEH,MAAM,UAAU,6BAA6B,CAC3C,WAA+B,EAC/B,KAAsB;IAEtB,MAAM,IAAI,GAAG,IAAI,GAAG,EAA8B,CAAC;IACnD,KAAK,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC;QAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;QACrC,IAAI,IAAI,E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,CAAC,EAAE,CAAC;oBACvB,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC;oBAClB,IAAI,UAAU;wBAAE,IAAI,CAAC,cAAc,IAAI,CAAC,CAAC;oBACzC,SAAS;gBACX,CAAC;gBACD,0DAA0D;gBAC1D,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAmB,CAAC;gBAC9C,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;oBACrB,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC;oBAClB,SAAS;gBACX,CAAC;gBACD,MAAM,GAAG,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;gBACpC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;YAC7D,CAAC;YAED,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QACrB,CAAC;QAED,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,KAAK,EAAE,EAAE,eAAe,EAAE,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,IAAI,EAAE;YAChE,KAAK;SACN,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/seeds.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
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 type { IndexedComponent, LocalDefinitionIndex, ParseResult } from "@component-compass/plugin-core";
|
|
11
|
+
import type { TagRule } from "./config/schema.js";
|
|
12
|
+
import type { ComponentSeed } from "./rollup.js";
|
|
13
|
+
import type { WorkspaceGraph } from "./workspace/types.js";
|
|
14
|
+
/**
|
|
15
|
+
* One entry in the resolver snapshot. Each entry pairs an `IndexedComponent`
|
|
16
|
+
* (the manifest-shaped record) with an `enrichmentSource` label distinguishing
|
|
17
|
+
* authored manifest data from heuristically-derived enrichment.
|
|
18
|
+
*/
|
|
19
|
+
export type SnapshotEntry = {
|
|
20
|
+
component: IndexedComponent;
|
|
21
|
+
enrichmentSource: "authored" | "derived";
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Project the resolver snapshot AND parser-emitted occurrences into
|
|
25
|
+
* ComponentSeeds.
|
|
26
|
+
*
|
|
27
|
+
* Two sources contribute:
|
|
28
|
+
* 1. Snapshotted components — full enrichment via `manifestComponentToOutput`,
|
|
29
|
+
* labelled with the snapshot entry's `enrichmentSource`.
|
|
30
|
+
* 2. Components observed in parser walks but absent from the snapshot —
|
|
31
|
+
* emitted with `manifest: null` so they surface in `components[]` per
|
|
32
|
+
* the realignment principle ("manifest is enrichment, not gate").
|
|
33
|
+
*
|
|
34
|
+
* Dedupe by stable id; snapshotted seeds win.
|
|
35
|
+
*
|
|
36
|
+
* Scope derivation follows the three-lane model in identity.ts:
|
|
37
|
+
* - local → source.type === "local"
|
|
38
|
+
* - ds → external + derivedTags.length > 0
|
|
39
|
+
* - external → external + no matching tag rules
|
|
40
|
+
*/
|
|
41
|
+
export declare function buildComponentSeeds(snapshot: SnapshotEntry[], parseResults: ParseResult[], tagRules: TagRule[] | undefined, localIndex?: LocalDefinitionIndex, repoRoot?: string, workspaceGraph?: WorkspaceGraph): ComponentSeed[];
|