@component-compass/cli 0.0.2 → 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 +5 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/init.js +1 -3
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/scan.d.ts +13 -1
- package/dist/commands/scan.js +192 -72
- package/dist/commands/scan.js.map +1 -1
- package/dist/composition-rollup.d.ts +16 -14
- package/dist/composition-rollup.js +33 -43
- package/dist/composition-rollup.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 +19 -17
- package/dist/identity.js +42 -21
- 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 +269 -72
- 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 +12 -4
- package/dist/local-index/index.js +40 -25
- 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 +16 -7
- 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 +52 -34
- package/dist/manifest/lazy-resolver.js +269 -69
- package/dist/manifest/lazy-resolver.js.map +1 -1
- package/dist/occurrences.d.ts +4 -4
- package/dist/occurrences.js +49 -9
- 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 +27 -28
- package/dist/reporter/index.js +99 -58
- 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 +13 -6
- package/dist/rollup.js +9 -6
- 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 +20 -19
- package/dist/seeds.js +136 -68
- 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/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 +8 -0
- package/dist/workspace/find-owning-package.js +69 -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 +15 -7
- package/schema/config.schema.json +2 -24
- 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 -12
- package/dist/manifest/diagnostic-filter.js +0 -23
- package/dist/manifest/diagnostic-filter.js.map +0 -1
package/dist/occurrences.js
CHANGED
|
@@ -7,24 +7,59 @@
|
|
|
7
7
|
* value was literal null).
|
|
8
8
|
*
|
|
9
9
|
* Phase 2: also resolves parser-side `parentRef` (intra-ParseResult occurrence
|
|
10
|
-
* index) into artifact-side `parentOccurrenceId`
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* index) into artifact-side `parentOccurrenceId` strings and carries through
|
|
11
|
+
* `depth`. Parent resolution stays scoped to one ParseResult — cross-file
|
|
12
|
+
* composition is not tracked.
|
|
13
13
|
*
|
|
14
14
|
* Pure function; no I/O.
|
|
15
15
|
*/
|
|
16
|
+
import { relative, isAbsolute } from "node:path";
|
|
16
17
|
import { computeOccurrenceId, } from "@component-compass/plugin-core";
|
|
17
18
|
import { computeStableIdFromComponentId } from "./identity.js";
|
|
18
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Normalise a local-source ComponentId's filePath to be repo-root-relative so
|
|
21
|
+
* that the stable hash matches the one produced for seeds built from the local
|
|
22
|
+
* index (which uses relative paths from the walker). Without this, owner edges
|
|
23
|
+
* from parsers (which use absolute file paths) would hash-diverge from the
|
|
24
|
+
* component entries they reference.
|
|
25
|
+
*/
|
|
26
|
+
function normaliseLocalFilePath(c, repoRoot) {
|
|
27
|
+
if (c.source.type !== "local")
|
|
28
|
+
return c;
|
|
29
|
+
const fp = c.source.filePath;
|
|
30
|
+
if (!isAbsolute(fp))
|
|
31
|
+
return c;
|
|
32
|
+
return {
|
|
33
|
+
...c,
|
|
34
|
+
source: { type: "local", filePath: relative(repoRoot, fp).replace(/\\/g, "/") },
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Convert an absolute scan-time path into a repo-root-relative POSIX path so
|
|
39
|
+
* outputs (and the occurrenceId hash that includes the path) are stable
|
|
40
|
+
* across machines. Paths outside the repo come back with `..` prefix and are
|
|
41
|
+
* still stable as long as cwd is. Absolute paths with no repoRoot context
|
|
42
|
+
* pass through unchanged (test/legacy callers that don't pass repoRoot).
|
|
43
|
+
*/
|
|
44
|
+
function toRelativePath(absPath, repoRoot) {
|
|
45
|
+
if (!repoRoot || !isAbsolute(absPath))
|
|
46
|
+
return absPath;
|
|
47
|
+
return relative(repoRoot, absPath).replace(/\\/g, "/");
|
|
48
|
+
}
|
|
49
|
+
export function parseResultsToOccurrences(results, captureValues, repoRoot = "") {
|
|
19
50
|
const out = [];
|
|
20
51
|
for (const result of results) {
|
|
21
52
|
// First pass: compute (final componentId hash, occurrenceId) for every
|
|
22
53
|
// parser-emitted occurrence in THIS ParseResult. Indexes align with
|
|
23
54
|
// result.occurrences, so parentRef indices resolve correctly in pass two.
|
|
55
|
+
// filePath is normalised to repo-root-relative BEFORE hashing so the
|
|
56
|
+
// occurrenceId is identical across machines (Ben's laptop, CI, contributor
|
|
57
|
+
// forks).
|
|
24
58
|
const computed = result.occurrences.map((occ) => {
|
|
25
59
|
const componentId = computeStableIdFromComponentId(occ.componentId);
|
|
26
|
-
const
|
|
27
|
-
|
|
60
|
+
const relPath = toRelativePath(occ.loc.file, repoRoot);
|
|
61
|
+
const occurrenceId = computeOccurrenceId(componentId, relPath, occ.loc.line, occ.loc.column);
|
|
62
|
+
return { componentId, occurrenceId, relPath };
|
|
28
63
|
});
|
|
29
64
|
// Second pass: project to OutputOccurrence, resolving parentRef.
|
|
30
65
|
for (let i = 0; i < result.occurrences.length; i++) {
|
|
@@ -32,7 +67,7 @@ export function parseResultsToOccurrences(results, captureValues) {
|
|
|
32
67
|
const meta = computed[i];
|
|
33
68
|
if (!occ || !meta)
|
|
34
69
|
continue;
|
|
35
|
-
const { componentId, occurrenceId } = meta;
|
|
70
|
+
const { componentId, occurrenceId, relPath } = meta;
|
|
36
71
|
const props = {};
|
|
37
72
|
for (const p of occ.props) {
|
|
38
73
|
if (p.isDynamic) {
|
|
@@ -49,7 +84,7 @@ export function parseResultsToOccurrences(results, captureValues) {
|
|
|
49
84
|
}
|
|
50
85
|
const output = {
|
|
51
86
|
componentId,
|
|
52
|
-
filePath:
|
|
87
|
+
filePath: relPath,
|
|
53
88
|
line: occ.loc.line,
|
|
54
89
|
column: occ.loc.column,
|
|
55
90
|
via: occ.via,
|
|
@@ -60,11 +95,16 @@ export function parseResultsToOccurrences(results, captureValues) {
|
|
|
60
95
|
const parent = computed[occ.parentRef];
|
|
61
96
|
if (parent) {
|
|
62
97
|
output.parentOccurrenceId = parent.occurrenceId;
|
|
63
|
-
output.parentComponentId = parent.componentId;
|
|
64
98
|
}
|
|
65
99
|
}
|
|
66
100
|
if (occ.depth !== undefined)
|
|
67
101
|
output.depth = occ.depth;
|
|
102
|
+
if (occ.ownerComponentId) {
|
|
103
|
+
const normOwner = repoRoot
|
|
104
|
+
? normaliseLocalFilePath(occ.ownerComponentId, repoRoot)
|
|
105
|
+
: occ.ownerComponentId;
|
|
106
|
+
output.ownerComponentId = computeStableIdFromComponentId(normOwner);
|
|
107
|
+
}
|
|
68
108
|
out.push(output);
|
|
69
109
|
}
|
|
70
110
|
}
|
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,EACL,mBAAmB,
|
|
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;;;;;;GAMG;AACH,SAAS,cAAc,CAAC,OAAe,EAAE,QAAgB;IACvD,IAAI,CAAC,QAAQ,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC;IACtD,OAAO,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,OAAsB,EACtB,aAAsB,EACtB,QAAQ,GAAG,EAAE;IAEb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H,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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-by-ext.js","sourceRoot":"","sources":["../src/parse-by-ext.ts"],"names":[],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AAC;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,46 +2,45 @@
|
|
|
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 { ManifestComponent, ManifestRef,
|
|
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 `parentComponentId`
|
|
29
|
-
* point at a dropped component, leaving a dangling reference in the
|
|
30
|
-
* artifact.
|
|
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;
|
|
20
|
+
type AuthoredEnvelope = {
|
|
21
|
+
source: "authored";
|
|
22
|
+
data: AuthoredManifestData;
|
|
23
|
+
};
|
|
24
|
+
type DerivedEnvelope = {
|
|
25
|
+
source: "derived";
|
|
26
|
+
data: DerivedManifestData;
|
|
27
|
+
};
|
|
28
|
+
type ManifestEnvelope = AuthoredEnvelope | DerivedEnvelope | null;
|
|
36
29
|
/**
|
|
37
|
-
* Pure converter: project a rich `ManifestComponent` (
|
|
38
|
-
* model) onto the artifact-shape `
|
|
39
|
-
* report.
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
30
|
+
* Pure converter: project a rich `ManifestComponent` (resolver-side domain
|
|
31
|
+
* model) onto the artifact-shape envelope `{ source, data }` consumed by the
|
|
32
|
+
* JSON report. The `data` payload is `AuthoredManifestData` (or its
|
|
33
|
+
* structural twin `DerivedManifestData`) — Phase 3's per-component manifest
|
|
34
|
+
* shape: optional `description`, `lifecycle`, and per-feature record maps
|
|
35
|
+
* (`props`, `slots`, `invocable`). Optional fields are omitted from the
|
|
36
|
+
* payload entirely when the input does not carry them (no `null` synth, no
|
|
37
|
+
* empty maps).
|
|
38
|
+
*
|
|
39
|
+
* Slots and events are CEM-shape only — react/vue ManifestComponents have no
|
|
40
|
+
* `events`/`slots` arrays — so we discriminate on `kind` before reading them.
|
|
43
41
|
*
|
|
44
42
|
* Returns `null` when no manifest entry was matched for the component, so
|
|
45
43
|
* downstream `OutputComponent.manifest` can be set directly.
|
|
46
44
|
*/
|
|
47
|
-
export declare function manifestComponentToOutput(m: ManifestComponent | undefined, source: "authored" | "derived"):
|
|
45
|
+
export declare function manifestComponentToOutput(m: ManifestComponent | undefined, source: "authored" | "derived"): ManifestEnvelope;
|
|
46
|
+
export {};
|
package/dist/reporter/index.js
CHANGED
|
@@ -2,89 +2,75 @@
|
|
|
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 `parentComponentId`
|
|
29
|
-
* point at a dropped component, leaving a dangling reference in the
|
|
30
|
-
* artifact.
|
|
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
|
-
const
|
|
21
|
+
const pruned = dropUnreachableLocalSeeds(withComposition);
|
|
22
|
+
const filtered = { components: pruned, occurrences };
|
|
39
23
|
const stats = {
|
|
40
24
|
...partialStats,
|
|
41
25
|
componentsDetected: filtered.components.length,
|
|
42
26
|
totalOccurrences: filtered.occurrences.length,
|
|
43
27
|
};
|
|
44
28
|
return {
|
|
45
|
-
|
|
29
|
+
meta,
|
|
46
30
|
manifests,
|
|
47
31
|
stats,
|
|
48
32
|
components: filtered.components,
|
|
49
33
|
occurrences: filtered.occurrences,
|
|
34
|
+
diagnostics,
|
|
50
35
|
};
|
|
51
36
|
}
|
|
52
37
|
/**
|
|
53
|
-
* Drops components
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
38
|
+
* Drops local components that contribute no information to the artifact:
|
|
39
|
+
* no occurrences AND not referenced as parent or child in any composition
|
|
40
|
+
* edge. Workspace-scoped scans accumulate thousands of these — every
|
|
41
|
+
* locally-defined component the include glob walks past, regardless of
|
|
42
|
+
* whether anything in scope renders it. Under the exports-only owner
|
|
43
|
+
* attribution invariant, a local seed that's neither rendered nor owns
|
|
44
|
+
* rendering is unreachable in the dependency graph by construction, so
|
|
45
|
+
* dropping it is lossless.
|
|
57
46
|
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
47
|
+
* Non-local seeds (ds / external) are preserved unconditionally — they
|
|
48
|
+
* represent identity attribution work the resolver did, not local-index
|
|
49
|
+
* walk-through.
|
|
60
50
|
*/
|
|
61
|
-
function
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const matchers = packageScopes.map((p) => picomatch(p));
|
|
65
|
-
const allowedIds = new Set();
|
|
66
|
-
const allowedComponents = components.filter((c) => {
|
|
67
|
-
if (c.identity.scope === "local") {
|
|
68
|
-
allowedIds.add(c.id);
|
|
51
|
+
function dropUnreachableLocalSeeds(components) {
|
|
52
|
+
return components.filter((c) => {
|
|
53
|
+
if (c.identity.scope !== "local")
|
|
69
54
|
return true;
|
|
70
|
-
|
|
71
|
-
const pkg = c.identity.packageName ?? "";
|
|
72
|
-
if (matchers.some((m) => m(pkg))) {
|
|
73
|
-
allowedIds.add(c.id);
|
|
55
|
+
if (c.stats.occurrenceCount > 0)
|
|
74
56
|
return true;
|
|
75
|
-
}
|
|
76
|
-
|
|
57
|
+
const rendersN = Object.keys(c.composition?.rendersByCount ?? {}).length;
|
|
58
|
+
const renderedByN = Object.keys(c.composition?.renderedByCount ?? {}).length;
|
|
59
|
+
return rendersN > 0 || renderedByN > 0;
|
|
77
60
|
});
|
|
78
|
-
const allowedOccurrences = occurrences.filter((o) => allowedIds.has(o.componentId));
|
|
79
|
-
return { components: allowedComponents, occurrences: allowedOccurrences };
|
|
80
61
|
}
|
|
81
62
|
/**
|
|
82
|
-
* Pure converter: project a rich `ManifestComponent` (
|
|
83
|
-
* model) onto the artifact-shape `
|
|
84
|
-
* report.
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
63
|
+
* Pure converter: project a rich `ManifestComponent` (resolver-side domain
|
|
64
|
+
* model) onto the artifact-shape envelope `{ source, data }` consumed by the
|
|
65
|
+
* JSON report. The `data` payload is `AuthoredManifestData` (or its
|
|
66
|
+
* structural twin `DerivedManifestData`) — Phase 3's per-component manifest
|
|
67
|
+
* shape: optional `description`, `lifecycle`, and per-feature record maps
|
|
68
|
+
* (`props`, `slots`, `invocable`). Optional fields are omitted from the
|
|
69
|
+
* payload entirely when the input does not carry them (no `null` synth, no
|
|
70
|
+
* empty maps).
|
|
71
|
+
*
|
|
72
|
+
* Slots and events are CEM-shape only — react/vue ManifestComponents have no
|
|
73
|
+
* `events`/`slots` arrays — so we discriminate on `kind` before reading them.
|
|
88
74
|
*
|
|
89
75
|
* Returns `null` when no manifest entry was matched for the component, so
|
|
90
76
|
* downstream `OutputComponent.manifest` can be set directly.
|
|
@@ -92,14 +78,69 @@ function applyScopeFilter(components, occurrences, packageScopes) {
|
|
|
92
78
|
export function manifestComponentToOutput(m, source) {
|
|
93
79
|
if (!m)
|
|
94
80
|
return null;
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
props[p.name] = { default: p.default };
|
|
99
|
-
}
|
|
100
|
-
const out = { source, props };
|
|
81
|
+
const data = {};
|
|
82
|
+
if (m.description !== undefined)
|
|
83
|
+
data.description = m.description;
|
|
101
84
|
if (m.lifecycle !== undefined)
|
|
102
|
-
|
|
85
|
+
data.lifecycle = m.lifecycle;
|
|
86
|
+
if (m.props.length > 0) {
|
|
87
|
+
const props = {};
|
|
88
|
+
for (const p of m.props)
|
|
89
|
+
props[p.name] = projectProp(p);
|
|
90
|
+
data.props = props;
|
|
91
|
+
}
|
|
92
|
+
// Slots and events are CEM-shape only — react/vue ManifestComponents have no
|
|
93
|
+
// events/slots arrays. Discriminate by kind.
|
|
94
|
+
if (m.kind === "custom-element") {
|
|
95
|
+
if (m.slots && m.slots.length > 0) {
|
|
96
|
+
const slots = {};
|
|
97
|
+
for (const s of m.slots)
|
|
98
|
+
slots[s.name] = projectSlot(s);
|
|
99
|
+
data.slots = slots;
|
|
100
|
+
}
|
|
101
|
+
if (m.events && m.events.length > 0) {
|
|
102
|
+
const invocable = {};
|
|
103
|
+
for (const e of m.events)
|
|
104
|
+
invocable[e.name] = projectEventAsInvocable(e);
|
|
105
|
+
data.invocable = invocable;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return source === "authored"
|
|
109
|
+
? { source: "authored", data }
|
|
110
|
+
: { source: "derived", data };
|
|
111
|
+
}
|
|
112
|
+
function projectProp(p) {
|
|
113
|
+
const out = {};
|
|
114
|
+
if (p.type !== undefined)
|
|
115
|
+
out.type = p.type;
|
|
116
|
+
if (p.default !== undefined)
|
|
117
|
+
out.default = p.default;
|
|
118
|
+
if (p.values !== undefined)
|
|
119
|
+
out.values = p.values;
|
|
120
|
+
if (p.required !== undefined)
|
|
121
|
+
out.required = p.required;
|
|
122
|
+
if (p.description !== undefined)
|
|
123
|
+
out.description = p.description;
|
|
124
|
+
if (p.lifecycle !== undefined)
|
|
125
|
+
out.lifecycle = p.lifecycle;
|
|
126
|
+
return out;
|
|
127
|
+
}
|
|
128
|
+
function projectSlot(s) {
|
|
129
|
+
const out = {};
|
|
130
|
+
if (s.description !== undefined)
|
|
131
|
+
out.description = s.description;
|
|
132
|
+
if (s.lifecycle !== undefined)
|
|
133
|
+
out.lifecycle = s.lifecycle;
|
|
134
|
+
return out;
|
|
135
|
+
}
|
|
136
|
+
function projectEventAsInvocable(e) {
|
|
137
|
+
const out = { kind: "dom-event" };
|
|
138
|
+
if (e.payloadType !== undefined)
|
|
139
|
+
out.payloadType = e.payloadType;
|
|
140
|
+
if (e.description !== undefined)
|
|
141
|
+
out.description = e.description;
|
|
142
|
+
if (e.lifecycle !== undefined)
|
|
143
|
+
out.lifecycle = e.lifecycle;
|
|
103
144
|
return out;
|
|
104
145
|
}
|
|
105
146
|
//# 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;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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AAC,WAAW,KAAK,SAAS;QAAE,GAAG,CAAC,WAAW,GAAG,CAAC,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,I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-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,14 +8,21 @@
|
|
|
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
|
-
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
|
-
|
|
19
|
-
|
|
18
|
+
manifest: {
|
|
19
|
+
source: "authored";
|
|
20
|
+
data: AuthoredManifestData;
|
|
21
|
+
} | {
|
|
22
|
+
source: "derived";
|
|
23
|
+
data: DerivedManifestData;
|
|
24
|
+
} | null;
|
|
25
|
+
/** Derived from CEM/manifest `deprecated` flag. False when no manifest entry exists. */
|
|
26
|
+
deprecated: boolean;
|
|
20
27
|
};
|
|
21
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);
|
|
@@ -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;
|
|
@@ -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,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,EAAE,CAAC;YACT,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACf,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACxB,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;QACrC,MAAM,OAAO,GAAG,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