@component-compass/cli 0.0.3 → 0.0.4
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/dist/cli.js +1 -1
- package/dist/commands/init.js +1 -3
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/scan.d.ts +12 -1
- package/dist/commands/scan.js +158 -55
- package/dist/commands/scan.js.map +1 -1
- package/dist/config/loader.js +5 -9
- package/dist/config/loader.js.map +1 -1
- package/dist/config/schema.d.ts +2 -15
- package/dist/config/schema.js.map +1 -1
- package/dist/envelope/index.d.ts +0 -9
- package/dist/envelope/index.js +1 -46
- package/dist/envelope/index.js.map +1 -1
- package/dist/identity.d.ts +11 -15
- package/dist/identity.js +29 -20
- package/dist/identity.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/local-index/detect-react.d.ts +2 -1
- package/dist/local-index/detect-react.js +135 -115
- package/dist/local-index/detect-react.js.map +1 -1
- package/dist/local-index/detect-vue.d.ts +15 -1
- package/dist/local-index/detect-vue.js +130 -107
- package/dist/local-index/detect-vue.js.map +1 -1
- package/dist/local-index/detect-wc.d.ts +7 -1
- package/dist/local-index/detect-wc.js +56 -60
- package/dist/local-index/detect-wc.js.map +1 -1
- package/dist/local-index/index.d.ts +11 -6
- package/dist/local-index/index.js +25 -27
- package/dist/local-index/index.js.map +1 -1
- package/dist/manifest/barrel-parser.d.ts +10 -0
- package/dist/manifest/barrel-parser.js +11 -0
- package/dist/manifest/barrel-parser.js.map +1 -1
- package/dist/manifest/derived-manifest-stub.d.ts +15 -6
- package/dist/manifest/derived-manifest-stub.js +43 -7
- package/dist/manifest/derived-manifest-stub.js.map +1 -1
- package/dist/manifest/lazy-resolver.d.ts +42 -16
- package/dist/manifest/lazy-resolver.js +122 -49
- package/dist/manifest/lazy-resolver.js.map +1 -1
- package/dist/occurrences.js +20 -4
- package/dist/occurrences.js.map +1 -1
- package/dist/parse-by-ext.d.ts +21 -0
- package/dist/parse-by-ext.js +53 -0
- package/dist/parse-by-ext.js.map +1 -0
- package/dist/reporter/index.d.ts +5 -21
- package/dist/reporter/index.js +6 -52
- package/dist/reporter/index.js.map +1 -1
- package/dist/reporter/stdout.js +4 -4
- package/dist/reporter/stdout.js.map +1 -1
- package/dist/rollup.d.ts +5 -4
- package/dist/rollup.js +7 -4
- package/dist/rollup.js.map +1 -1
- package/dist/scan/cem-index.d.ts +38 -0
- package/dist/scan/cem-index.js +139 -0
- package/dist/scan/cem-index.js.map +1 -0
- package/dist/scan/git-mtime.d.ts +2 -0
- package/dist/scan/git-mtime.js +22 -0
- package/dist/scan/git-mtime.js.map +1 -0
- package/dist/scan/meta.d.ts +5 -0
- package/dist/scan/meta.js +58 -0
- package/dist/scan/meta.js.map +1 -0
- package/dist/scan/stamp-deprecated.d.ts +16 -0
- package/dist/scan/stamp-deprecated.js +33 -0
- package/dist/scan/stamp-deprecated.js.map +1 -0
- package/dist/scan/stamp-version.d.ts +18 -0
- package/dist/scan/stamp-version.js +94 -0
- package/dist/scan/stamp-version.js.map +1 -0
- package/dist/seeds.d.ts +18 -18
- package/dist/seeds.js +82 -45
- package/dist/seeds.js.map +1 -1
- package/dist/types.d.ts +2 -5
- package/dist/util/git.d.ts +8 -0
- package/dist/util/git.js +73 -0
- package/dist/util/git.js.map +1 -1
- package/dist/util/progress.d.ts +21 -0
- package/dist/util/progress.js +54 -0
- package/dist/util/progress.js.map +1 -0
- package/dist/walker/files.d.ts +1 -0
- package/dist/walker/files.js +11 -5
- package/dist/walker/files.js.map +1 -1
- package/dist/workspace/find-owning-package.d.ts +6 -0
- package/dist/workspace/find-owning-package.js +22 -2
- package/dist/workspace/find-owning-package.js.map +1 -1
- package/dist/workspace/index.d.ts +1 -1
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/index.js.map +1 -1
- package/package.json +13 -7
- package/schema/config.schema.json +2 -24
- package/dist/commands/no-deps-diagnostic.d.ts +0 -15
- package/dist/commands/no-deps-diagnostic.js +0 -23
- package/dist/commands/no-deps-diagnostic.js.map +0 -1
- package/dist/config/tag-rules.d.ts +0 -2
- package/dist/config/tag-rules.js +0 -34
- package/dist/config/tag-rules.js.map +0 -1
- package/dist/local-index/walker.d.ts +0 -11
- package/dist/local-index/walker.js +0 -47
- package/dist/local-index/walker.js.map +0 -1
- package/dist/manifest/diagnostic-filter.d.ts +0 -13
- package/dist/manifest/diagnostic-filter.js +0 -36
- package/dist/manifest/diagnostic-filter.js.map +0 -1
package/dist/occurrences.js.map
CHANGED
|
@@ -1 +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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,CAAC,SAAS,CAAC,CAAC;YACtE,CAAC;YACD,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type SFCDescriptor } from "@vue/compiler-sfc";
|
|
2
|
+
import { type DefaultTreeAdapterMap } from "parse5";
|
|
3
|
+
import type { Program } from "@oxc-project/types";
|
|
4
|
+
type Parse5Document = DefaultTreeAdapterMap["document"];
|
|
5
|
+
export type ParsedFile = {
|
|
6
|
+
kind: "babel";
|
|
7
|
+
ast: Program;
|
|
8
|
+
source: string;
|
|
9
|
+
} | {
|
|
10
|
+
kind: "vue";
|
|
11
|
+
descriptor: SFCDescriptor;
|
|
12
|
+
scriptAst?: Program;
|
|
13
|
+
source: string;
|
|
14
|
+
} | {
|
|
15
|
+
kind: "html";
|
|
16
|
+
document: Parse5Document;
|
|
17
|
+
} | {
|
|
18
|
+
kind: "unsupported";
|
|
19
|
+
};
|
|
20
|
+
export declare function parseByExt(filePath: string, source: string): ParsedFile;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single source of truth for file parsing during scan. Default path uses
|
|
3
|
+
* oxc-parser for babel-family files and @vue/compiler-sfc for SFCs.
|
|
4
|
+
*
|
|
5
|
+
* Throws on unrecoverable syntax errors. oxc-parser's error recovery is
|
|
6
|
+
* lenient — it returns a partial Program on syntax errors and surfaces them
|
|
7
|
+
* via `result.errors[]`. parseOxc logs warnings but doesn't throw so the
|
|
8
|
+
* scan can proceed on partially-broken files.
|
|
9
|
+
*/
|
|
10
|
+
import { extname } from "node:path";
|
|
11
|
+
import { parse as parseVueSfc } from "@vue/compiler-sfc";
|
|
12
|
+
import { parse as parseHtmlDoc } from "parse5";
|
|
13
|
+
import { parseSync as oxcParseSync } from "oxc-parser";
|
|
14
|
+
export function parseByExt(filePath, source) {
|
|
15
|
+
const ext = extname(filePath);
|
|
16
|
+
if (ext === ".tsx" || ext === ".jsx" || ext === ".ts" || ext === ".js") {
|
|
17
|
+
return { kind: "babel", ast: parseOxc(filePath, source, ext), source };
|
|
18
|
+
}
|
|
19
|
+
if (ext === ".vue") {
|
|
20
|
+
const { descriptor } = parseVueSfc(source);
|
|
21
|
+
const scriptContent = descriptor.scriptSetup?.content ?? descriptor.script?.content;
|
|
22
|
+
if (scriptContent && scriptContent.length > 0) {
|
|
23
|
+
return {
|
|
24
|
+
kind: "vue",
|
|
25
|
+
descriptor,
|
|
26
|
+
scriptAst: parseOxc(`${filePath}.ts`, scriptContent, ".ts"),
|
|
27
|
+
source: scriptContent,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return { kind: "vue", descriptor, source: "" };
|
|
31
|
+
}
|
|
32
|
+
if (ext === ".html" || ext === ".htm") {
|
|
33
|
+
return { kind: "html", document: parseHtmlDoc(source, { sourceCodeLocationInfo: true }) };
|
|
34
|
+
}
|
|
35
|
+
return { kind: "unsupported" };
|
|
36
|
+
}
|
|
37
|
+
function parseOxc(filePath, source, ext) {
|
|
38
|
+
// For .js/.jsx, oxc doesn't automatically enable JSX parsing the way
|
|
39
|
+
// babel's `plugins: ['jsx']` does. Pass an explicit lang hint so JSX
|
|
40
|
+
// inside .js files (common in non-strict React codebases) parses
|
|
41
|
+
// correctly instead of returning an empty Program.
|
|
42
|
+
const options = ext === ".jsx" || ext === ".js"
|
|
43
|
+
? { lang: "jsx" }
|
|
44
|
+
: undefined;
|
|
45
|
+
const result = options
|
|
46
|
+
? oxcParseSync(filePath, source, options)
|
|
47
|
+
: oxcParseSync(filePath, source);
|
|
48
|
+
if (result.errors.length > 0) {
|
|
49
|
+
process.stderr.write(`[compass] oxc-parser warning in ${filePath}: ${result.errors.map((e) => e.message).join("; ")}\n`);
|
|
50
|
+
}
|
|
51
|
+
return result.program;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=parse-by-ext.js.map
|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M,EAAE,EAAE,EAAE,CAAC;IACjD,CAAC;IAED,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;QACtC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,CAAC,MAAM,EAAE,EAAE,sBAAsB,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAC5F,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;AACjC,CAAC;AAED,SAAS,QAAQ,CAAC,QAAgB,EAAE,MAAc,EAAE,GAAW;IAC7D,qEAAqE;IACrE,qEAAqE;IACrE,iEAAiE;IACjE,mDAAmD;IACnD,MAAM,OAAO,GACX,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,KAAK;QAC7B,CAAC,CAAC,EAAE,IAAI,EAAE,KAAc,EAAE;QAC1B,CAAC,CAAC,SAAS,CAAC;IAChB,MAAM,MAAM,GAAG,OAAO;QACpB,CAAC,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC;QACzC,CAAC,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACnC,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7B,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,mCAAmC,QAAQ,KAAK,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CACnG,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,CAAC;AACxB,CAAC"}
|
package/dist/reporter/index.d.ts
CHANGED
|
@@ -2,37 +2,21 @@
|
|
|
2
2
|
* Reporter assembly entry points.
|
|
3
3
|
*
|
|
4
4
|
* `buildScanOutput` is the pure, in-memory composition that folds the scan
|
|
5
|
-
*
|
|
5
|
+
* meta, per-component seeds, and the flat occurrence stream into the
|
|
6
6
|
* two-grain `ScanOutput` shape exported by `@component-compass/plugin-core`.
|
|
7
7
|
*
|
|
8
8
|
* It does no IO; downstream JSON / stdout reporters consume the result.
|
|
9
9
|
*/
|
|
10
|
-
import type { AuthoredManifestData, DerivedManifestData, Diagnostic, ManifestComponent, ManifestRef, OutputOccurrence,
|
|
10
|
+
import type { AuthoredManifestData, DerivedManifestData, Diagnostic, ManifestComponent, ManifestRef, OutputOccurrence, ScanMeta, ScanOutput, ScanStats } from "@component-compass/plugin-core";
|
|
11
11
|
import { type ComponentSeed } from "../rollup.js";
|
|
12
12
|
export type PartialScanStats = Pick<ScanStats, "filesScanned" | "filesWithUsage" | "scanDurationMs">;
|
|
13
13
|
/**
|
|
14
14
|
* Builds the two-grain `ScanOutput` from the per-component seeds and the
|
|
15
|
-
* flat occurrence stream.
|
|
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).
|
|
15
|
+
* flat occurrence stream.
|
|
21
16
|
*
|
|
22
|
-
* Pipeline order: rollup → composition →
|
|
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.
|
|
17
|
+
* Pipeline order: rollup → composition → local-seed prune.
|
|
34
18
|
*/
|
|
35
|
-
export declare function buildScanOutput(
|
|
19
|
+
export declare function buildScanOutput(meta: ScanMeta, manifests: ManifestRef[], partialStats: PartialScanStats, seeds: ComponentSeed[], occurrences: OutputOccurrence[], diagnostics: Diagnostic[]): ScanOutput;
|
|
36
20
|
type AuthoredEnvelope = {
|
|
37
21
|
source: "authored";
|
|
38
22
|
data: AuthoredManifestData;
|
package/dist/reporter/index.js
CHANGED
|
@@ -2,48 +2,31 @@
|
|
|
2
2
|
* Reporter assembly entry points.
|
|
3
3
|
*
|
|
4
4
|
* `buildScanOutput` is the pure, in-memory composition that folds the scan
|
|
5
|
-
*
|
|
5
|
+
* meta, per-component seeds, and the flat occurrence stream into the
|
|
6
6
|
* two-grain `ScanOutput` shape exported by `@component-compass/plugin-core`.
|
|
7
7
|
*
|
|
8
8
|
* It does no IO; downstream JSON / stdout reporters consume the result.
|
|
9
9
|
*/
|
|
10
|
-
import picomatch from "picomatch";
|
|
11
10
|
import { applyCompositionRollup } from "../composition-rollup.js";
|
|
12
11
|
import { rollupOccurrencesToComponents } from "../rollup.js";
|
|
13
12
|
/**
|
|
14
13
|
* Builds the two-grain `ScanOutput` from the per-component seeds and the
|
|
15
|
-
* flat occurrence stream.
|
|
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).
|
|
14
|
+
* flat occurrence stream.
|
|
21
15
|
*
|
|
22
|
-
* Pipeline order: rollup → composition →
|
|
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.
|
|
16
|
+
* Pipeline order: rollup → composition → local-seed prune.
|
|
34
17
|
*/
|
|
35
|
-
export function buildScanOutput(
|
|
18
|
+
export function buildScanOutput(meta, manifests, partialStats, seeds, occurrences, diagnostics) {
|
|
36
19
|
const rolled = rollupOccurrencesToComponents(occurrences, seeds);
|
|
37
20
|
const withComposition = applyCompositionRollup(rolled, occurrences);
|
|
38
21
|
const pruned = dropUnreachableLocalSeeds(withComposition);
|
|
39
|
-
const filtered =
|
|
22
|
+
const filtered = { components: pruned, occurrences };
|
|
40
23
|
const stats = {
|
|
41
24
|
...partialStats,
|
|
42
25
|
componentsDetected: filtered.components.length,
|
|
43
26
|
totalOccurrences: filtered.occurrences.length,
|
|
44
27
|
};
|
|
45
28
|
return {
|
|
46
|
-
|
|
29
|
+
meta,
|
|
47
30
|
manifests,
|
|
48
31
|
stats,
|
|
49
32
|
components: filtered.components,
|
|
@@ -76,35 +59,6 @@ function dropUnreachableLocalSeeds(components) {
|
|
|
76
59
|
return rendersN > 0 || renderedByN > 0;
|
|
77
60
|
});
|
|
78
61
|
}
|
|
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
62
|
/**
|
|
109
63
|
* Pure converter: project a rich `ManifestComponent` (resolver-side domain
|
|
110
64
|
* model) onto the artifact-shape envelope `{ source, data }` consumed by the
|
|
@@ -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;AAoBH,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,6BAA6B,EAAsB,MAAM,cAAc,CAAC;AAOjF;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAC7B,IAAc,EACd,SAAwB,EACxB,YAA8B,EAC9B,KAAsB,EACtB,WAA+B,EAC/B,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,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IACrD,M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C,CAAC,WAAW,CAAC;IACjE,IAAI,CAAC,CAAC,SAAS,KAAK,SAAS;QAAE,GAAG,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC;IAC3D,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/reporter/stdout.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export function printSummary(out, outputPath) {
|
|
2
|
-
const {
|
|
2
|
+
const { meta, components, stats } = out;
|
|
3
3
|
const lines = [];
|
|
4
4
|
lines.push("");
|
|
5
5
|
lines.push("component-compass scan");
|
|
6
6
|
lines.push("──────────────────────");
|
|
7
|
-
lines.push(`scanId: ${
|
|
8
|
-
lines.push(`repoId: ${
|
|
9
|
-
lines.push(`timestamp: ${
|
|
7
|
+
lines.push(`scanId: ${meta.scanId}`);
|
|
8
|
+
lines.push(`repoId: ${meta.repo.id}`);
|
|
9
|
+
lines.push(`timestamp: ${meta.scannedAt}`);
|
|
10
10
|
lines.push("");
|
|
11
11
|
lines.push(`Scanned ${stats.filesScanned} files in ${(stats.scanDurationMs / 1000).toFixed(1)}s — ${stats.filesWithUsage} files use design system components`);
|
|
12
12
|
lines.push(`Components detected: ${stats.componentsDetected}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdout.js","sourceRoot":"","sources":["../../src/reporter/stdout.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,YAAY,CAAC,GAAe,EAAE,UAAkB;IAC9D,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"stdout.js","sourceRoot":"","sources":["../../src/reporter/stdout.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,YAAY,CAAC,GAAe,EAAE,UAAkB;IAC9D,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC;IACxC,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC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ream plus per-component seeds (identity + manifest)
|
|
3
|
+
* into the rolled `OutputComponent[]` shape.
|
|
4
4
|
*
|
|
5
5
|
* Math invariant per prop:
|
|
6
6
|
* sum(distribution.values) + dynamic + omitted === stats.occurrenceCount
|
|
@@ -8,14 +8,13 @@
|
|
|
8
8
|
* declares a default), not additive.
|
|
9
9
|
*
|
|
10
10
|
* Components with zero occurrences still emit identity + zeroed stats so that
|
|
11
|
-
* design-system components present in the
|
|
11
|
+
* design-system components present in the manifest snapshot surface even
|
|
12
12
|
* when not yet used.
|
|
13
13
|
*/
|
|
14
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
|
-
derivedTags: string[];
|
|
19
18
|
manifest: {
|
|
20
19
|
source: "authored";
|
|
21
20
|
data: AuthoredManifestData;
|
|
@@ -23,5 +22,7 @@ export type ComponentSeed = {
|
|
|
23
22
|
source: "derived";
|
|
24
23
|
data: DerivedManifestData;
|
|
25
24
|
} | null;
|
|
25
|
+
/** Derived from CEM/manifest `deprecated` flag. False when no manifest entry exists. */
|
|
26
|
+
deprecated: boolean;
|
|
26
27
|
};
|
|
27
28
|
export declare function rollupOccurrencesToComponents(occurrences: OutputOccurrence[], seeds: ComponentSeed[]): OutputComponent[];
|
package/dist/rollup.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Folds a flat occurrence stream plus per-component seeds (identity + manifest
|
|
3
|
-
*
|
|
2
|
+
* Folds a flat occurrence stream plus per-component seeds (identity + manifest)
|
|
3
|
+
* into the rolled `OutputComponent[]` shape.
|
|
4
4
|
*
|
|
5
5
|
* Math invariant per prop:
|
|
6
6
|
* sum(distribution.values) + dynamic + omitted === stats.occurrenceCount
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* declares a default), not additive.
|
|
9
9
|
*
|
|
10
10
|
* Components with zero occurrences still emit identity + zeroed stats so that
|
|
11
|
-
* design-system components present in the
|
|
11
|
+
* design-system components present in the manifest snapshot surface even
|
|
12
12
|
* when not yet used.
|
|
13
13
|
*/
|
|
14
14
|
const stringifyLiteral = (v) => v === null ? "null" : String(v);
|
|
@@ -68,10 +68,13 @@ export function rollupOccurrencesToComponents(occurrences, seeds) {
|
|
|
68
68
|
return {
|
|
69
69
|
id: seed.id,
|
|
70
70
|
identity: seed.identity,
|
|
71
|
-
derivedTags: seed.derivedTags,
|
|
72
71
|
manifest: seed.manifest,
|
|
73
72
|
stats: { occurrenceCount: occs.length, fileCount: fileSet.size },
|
|
74
73
|
props,
|
|
74
|
+
version: null,
|
|
75
|
+
deprecated: seed.deprecated,
|
|
76
|
+
createdAt: null,
|
|
77
|
+
updatedAt: null,
|
|
75
78
|
};
|
|
76
79
|
});
|
|
77
80
|
}
|
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;AA0BH,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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AC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single entry in `CemIndex.byTag`.
|
|
3
|
+
*
|
|
4
|
+
* `manifest` is the **per-declaration** payload — one component's data, not
|
|
5
|
+
* the full package manifest. For CCM this is one entry from `components[]`;
|
|
6
|
+
* for CEM this is one declaration from `modules[].declarations[]`.
|
|
7
|
+
* Use `CemIndex.byPackageName` to retrieve the full-package manifest.
|
|
8
|
+
*/
|
|
9
|
+
export type CemIndexEntry = {
|
|
10
|
+
packageName: string;
|
|
11
|
+
manifest: unknown;
|
|
12
|
+
};
|
|
13
|
+
export type CemIndex = {
|
|
14
|
+
byTag: Map<string, CemIndexEntry>;
|
|
15
|
+
byPackageName: Map<string, {
|
|
16
|
+
manifest: unknown;
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Build a global CEM index from all packages reachable from `<root>/node_modules`.
|
|
21
|
+
*
|
|
22
|
+
* Yarn workspace packages are symlinked into `node_modules/<name>`, so they
|
|
23
|
+
* are indexed automatically alongside published dependencies. There's no
|
|
24
|
+
* separate workspace-enumeration pass — `node_modules` covers both.
|
|
25
|
+
*
|
|
26
|
+
* For each package found:
|
|
27
|
+
* - If it ships a `component-compass-manifest.json` (CCM), index its
|
|
28
|
+
* declarations. CCM takes precedence over CEM.
|
|
29
|
+
* - Otherwise, if it ships a CEM (`pkg.customElements` field or
|
|
30
|
+
* `custom-elements.json` at the package root), index its declarations.
|
|
31
|
+
*
|
|
32
|
+
* Each declaration with a `tagName` is added to `byTag`. Each package
|
|
33
|
+
* with any indexed manifest is added to `byPackageName`.
|
|
34
|
+
*
|
|
35
|
+
* @param root Absolute or relative path to the repository root containing
|
|
36
|
+
* a `node_modules` directory.
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildCemIndex(root: string): Promise<CemIndex>;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global CEM index — built once at scan startup.
|
|
3
|
+
*
|
|
4
|
+
* Enumerates every package.json under <root>/node_modules, finds any
|
|
5
|
+
* CEM (`custom-elements.json`) or CCM (`component-compass-manifest.json`)
|
|
6
|
+
* files, and builds two lookup tables:
|
|
7
|
+
* - `byTag` tagName → { packageName, manifest }
|
|
8
|
+
* - `byPackageName` packageName → { manifest }
|
|
9
|
+
*
|
|
10
|
+
* CCM takes precedence over CEM when both exist.
|
|
11
|
+
*
|
|
12
|
+
* Parsers use `byTag` to resolve hyphenated tags (<pie-link>, <sl-button>)
|
|
13
|
+
* unconditionally — no consumer-side config required.
|
|
14
|
+
*
|
|
15
|
+
* Shape contract:
|
|
16
|
+
* - `byTag` entry.manifest is the **per-declaration** manifest payload —
|
|
17
|
+
* a single component's data, not the full package manifest. For CCM this
|
|
18
|
+
* is one entry from `components[]`; for CEM this is one declaration from
|
|
19
|
+
* `modules[].declarations[]`. Use `byPackageName` for the full-package view.
|
|
20
|
+
* - `byPackageName` entry.manifest is the full top-level manifest document
|
|
21
|
+
* (the CCM root object or the CEM root object).
|
|
22
|
+
*/
|
|
23
|
+
import { readFile } from "node:fs/promises";
|
|
24
|
+
import { existsSync } from "node:fs";
|
|
25
|
+
import { join, dirname } from "node:path";
|
|
26
|
+
import { globby } from "globby";
|
|
27
|
+
/**
|
|
28
|
+
* Walk a CEM document and collect all custom-element declarations that carry a
|
|
29
|
+
* `tagName`. Returns each declaration object paired with its tag name so the
|
|
30
|
+
* caller can store the per-declaration entry in `byTag`.
|
|
31
|
+
*/
|
|
32
|
+
function walkCemForTagDeclarations(cem) {
|
|
33
|
+
const results = [];
|
|
34
|
+
for (const mod of cem.modules ?? []) {
|
|
35
|
+
for (const decl of mod.declarations ?? []) {
|
|
36
|
+
if (decl.customElement === true && typeof decl.tagName === "string") {
|
|
37
|
+
results.push({ tagName: decl.tagName, decl });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return results;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Build a global CEM index from all packages reachable from `<root>/node_modules`.
|
|
45
|
+
*
|
|
46
|
+
* Yarn workspace packages are symlinked into `node_modules/<name>`, so they
|
|
47
|
+
* are indexed automatically alongside published dependencies. There's no
|
|
48
|
+
* separate workspace-enumeration pass — `node_modules` covers both.
|
|
49
|
+
*
|
|
50
|
+
* For each package found:
|
|
51
|
+
* - If it ships a `component-compass-manifest.json` (CCM), index its
|
|
52
|
+
* declarations. CCM takes precedence over CEM.
|
|
53
|
+
* - Otherwise, if it ships a CEM (`pkg.customElements` field or
|
|
54
|
+
* `custom-elements.json` at the package root), index its declarations.
|
|
55
|
+
*
|
|
56
|
+
* Each declaration with a `tagName` is added to `byTag`. Each package
|
|
57
|
+
* with any indexed manifest is added to `byPackageName`.
|
|
58
|
+
*
|
|
59
|
+
* @param root Absolute or relative path to the repository root containing
|
|
60
|
+
* a `node_modules` directory.
|
|
61
|
+
*/
|
|
62
|
+
export async function buildCemIndex(root) {
|
|
63
|
+
const index = {
|
|
64
|
+
byTag: new Map(),
|
|
65
|
+
byPackageName: new Map(),
|
|
66
|
+
};
|
|
67
|
+
// Enumerate: unscoped node_modules/*/package.json and scoped node_modules/@*/*/package.json
|
|
68
|
+
const pkgJsonPaths = await globby([
|
|
69
|
+
"node_modules/*/package.json",
|
|
70
|
+
"node_modules/@*/*/package.json",
|
|
71
|
+
], {
|
|
72
|
+
cwd: root,
|
|
73
|
+
absolute: true,
|
|
74
|
+
onlyFiles: true,
|
|
75
|
+
suppressErrors: true,
|
|
76
|
+
// Don't traverse into nested node_modules — only the top-level
|
|
77
|
+
// dependency tree is relevant for CEM discovery.
|
|
78
|
+
ignore: ["node_modules/*/node_modules/**", "node_modules/@*/*/node_modules/**"],
|
|
79
|
+
});
|
|
80
|
+
await Promise.all(pkgJsonPaths.map(async (pkgJsonPath) => {
|
|
81
|
+
const pkgDir = dirname(pkgJsonPath);
|
|
82
|
+
let pkg = null;
|
|
83
|
+
try {
|
|
84
|
+
pkg = JSON.parse(await readFile(pkgJsonPath, "utf8"));
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (!pkg || typeof pkg.name !== "string")
|
|
90
|
+
return;
|
|
91
|
+
const packageName = pkg.name;
|
|
92
|
+
// CCM takes precedence: if both exist, CCM wins.
|
|
93
|
+
const ccmPath = join(pkgDir, "component-compass-manifest.json");
|
|
94
|
+
if (existsSync(ccmPath)) {
|
|
95
|
+
try {
|
|
96
|
+
const ccmJson = JSON.parse(await readFile(ccmPath, "utf8"));
|
|
97
|
+
// CCM format has `components[]` — custom-element entries carry tagName
|
|
98
|
+
if (ccmJson && Array.isArray(ccmJson.components)) {
|
|
99
|
+
for (const c of ccmJson.components) {
|
|
100
|
+
if (c.kind === "custom-element" && typeof c.tagName === "string") {
|
|
101
|
+
index.byTag.set(c.tagName, { packageName, manifest: c });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
index.byPackageName.set(packageName, { manifest: ccmJson });
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
// Malformed CCM — skip.
|
|
109
|
+
}
|
|
110
|
+
return; // CCM found; don't also load CEM for this package.
|
|
111
|
+
}
|
|
112
|
+
// CEM: check `pkg.customElements` field first (authoritative path),
|
|
113
|
+
// then fall back to the conventional `custom-elements.json`.
|
|
114
|
+
const cemRelPath = typeof pkg.customElements === "string"
|
|
115
|
+
? pkg.customElements
|
|
116
|
+
: "custom-elements.json";
|
|
117
|
+
const cemPath = join(pkgDir, cemRelPath);
|
|
118
|
+
if (!existsSync(cemPath))
|
|
119
|
+
return;
|
|
120
|
+
try {
|
|
121
|
+
const cemJson = JSON.parse(await readFile(cemPath, "utf8"));
|
|
122
|
+
const tagDecls = walkCemForTagDeclarations(cemJson);
|
|
123
|
+
// byPackageName is always populated for any CEM-shipping package,
|
|
124
|
+
// regardless of whether it declares any custom elements (e.g. mixin-only
|
|
125
|
+
// packages have no tagName entries but are still valid CEM consumers).
|
|
126
|
+
index.byPackageName.set(packageName, { manifest: cemJson });
|
|
127
|
+
for (const { tagName, decl } of tagDecls) {
|
|
128
|
+
// Store the per-declaration entry so byTag consumers get the specific
|
|
129
|
+
// component's data, not a haystack to search. Mirrors CCM behaviour.
|
|
130
|
+
index.byTag.set(tagName, { packageName, manifest: decl });
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
// Malformed CEM — skip.
|
|
135
|
+
}
|
|
136
|
+
}));
|
|
137
|
+
return index;
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=cem-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cem-index.js","sourceRoot":"","sources":["../../src/scan/cem-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AA+BhC;;;;GAIG;AACH,SAAS,yBAAyB,CAAC,GAAY;IAC7C,MAAM,OAAO,GAA8C,EAAE,CAAC;IAC9D,KAAK,MAAM,GAAG,IAAI,GAAG,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC;QACpC,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,YAAY,IAAI,EAAE,EAAE,CAAC;YAC1C,IAAI,IAAI,CAAC,aAAa,KAAK,IAAI,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;gBACpE,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;YAChD,CAAC;QACH,CAAC;IACH,CAA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;YAC5D,KAAK,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,QAAQ,EAAE,CAAC;gBACzC,sEAAsE;gBACtE,qEAAqE;gBACrE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;YAC5D,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,wBAAwB;QAC1B,CAAC;IACH,CAAC,CAAC,CACH,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { readFileMTimes } from "../util/git.js";
|
|
2
|
+
export async function stampGitMTime(root, components) {
|
|
3
|
+
const localPaths = new Set();
|
|
4
|
+
for (const c of components) {
|
|
5
|
+
if (c.identity.scope === "local" && c.identity.filePath) {
|
|
6
|
+
localPaths.add(c.identity.filePath);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
const map = await readFileMTimes(root, [...localPaths]);
|
|
10
|
+
for (const c of components) {
|
|
11
|
+
if (c.identity.scope === "local" && c.identity.filePath) {
|
|
12
|
+
const range = map.get(c.identity.filePath);
|
|
13
|
+
c.createdAt = range?.firstCommitAt ?? null;
|
|
14
|
+
c.updatedAt = range?.lastCommitAt ?? null;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
c.createdAt = null;
|
|
18
|
+
c.updatedAt = null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=git-mtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-mtime.js","sourceRoot":"","sources":["../../src/scan/git-mtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,IAAY,EACZ,UAA6B;IAE7B,MAAM,UAAU,GAAG,IAAI,GAAG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