@component-compass/cli 0.1.15 → 0.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/auth/paths.js +2 -2
  2. package/dist/auth/paths.js.map +1 -1
  3. package/dist/auth/session.d.ts +1 -1
  4. package/dist/auth/session.js +5 -5
  5. package/dist/auth/session.js.map +1 -1
  6. package/dist/auth/store.js +1 -1
  7. package/dist/auth/store.js.map +1 -1
  8. package/dist/auth/upload-auth.d.ts +2 -2
  9. package/dist/auth/upload-auth.js +3 -3
  10. package/dist/auth/upload-auth.js.map +1 -1
  11. package/dist/cli/help.d.ts +2 -2
  12. package/dist/cli/help.js +9 -15
  13. package/dist/cli/help.js.map +1 -1
  14. package/dist/cli/parse.d.ts +1 -1
  15. package/dist/cli/parse.js +4 -7
  16. package/dist/cli/parse.js.map +1 -1
  17. package/dist/cli.js +2 -20
  18. package/dist/cli.js.map +1 -1
  19. package/dist/commands/auth.js +30 -7
  20. package/dist/commands/auth.js.map +1 -1
  21. package/dist/commands/init.js +1 -1
  22. package/dist/commands/init.js.map +1 -1
  23. package/dist/commands/scan.js +12 -12
  24. package/dist/commands/scan.js.map +1 -1
  25. package/dist/config/loader.js +1 -1
  26. package/dist/config/loader.js.map +1 -1
  27. package/dist/manifest/barrel-parser.d.ts +6 -23
  28. package/dist/manifest/barrel-parser.js +9 -101
  29. package/dist/manifest/barrel-parser.js.map +1 -1
  30. package/dist/manifest/lazy-resolver.js +9 -11
  31. package/dist/manifest/lazy-resolver.js.map +1 -1
  32. package/dist/parse-by-ext.js +1 -1
  33. package/dist/parse-by-ext.js.map +1 -1
  34. package/dist/scan/global-components.d.ts +37 -0
  35. package/dist/scan/global-components.js +228 -0
  36. package/dist/scan/global-components.js.map +1 -0
  37. package/examples/github-actions-workflow.yml +1 -1
  38. package/package.json +8 -9
  39. package/dist/commands/db-import.d.ts +0 -12
  40. package/dist/commands/db-import.js +0 -59
  41. package/dist/commands/db-import.js.map +0 -1
  42. package/dist/scan/auto-import-manifest.d.ts +0 -28
  43. package/dist/scan/auto-import-manifest.js +0 -81
  44. package/dist/scan/auto-import-manifest.js.map +0 -1
@@ -0,0 +1,37 @@
1
+ import { type AutoImportComponent } from "@component-compass/parser-vue";
2
+ /**
3
+ * Reader for generated `GlobalComponents` declarations (#346, #491).
4
+ *
5
+ * `GlobalComponents` is the declaration the whole Vue ecosystem agrees on:
6
+ * it is the only lane Vue's own type checker has, so generated files,
7
+ * hand-written declarations and library packages all augment it. CC consumes
8
+ * the artefact the ecosystem already generates for static tools (tsc/Volar);
9
+ * it never re-derives the naming convention.
10
+ *
11
+ * Nuxt is the first (only) producer we probe for. It writes its registry
12
+ * twice — once as an `export const` list, once as this augmentation — and the
13
+ * two files moved apart between majors: Nuxt 3 puts both forms in
14
+ * `.nuxt/components.d.ts`; Nuxt 4 leaves the `export const` list there and
15
+ * moves the augmentation to `.nuxt/types/components.d.ts`. Both paths are
16
+ * probed, in that order.
17
+ */
18
+ export type GlobalComponentsRegistry = {
19
+ /** The declaration file the registry was read from. */
20
+ declarationPath: string;
21
+ /** Keyed by parse5's lowercased tag forms (see `vueTagForms`). */
22
+ lookup: (tagForm: string) => AutoImportComponent | undefined;
23
+ /** In-repo entries whose resolved file no longer exists (stale declaration). */
24
+ stale: Array<{
25
+ componentName: string;
26
+ target: string;
27
+ }>;
28
+ };
29
+ export declare function loadGlobalComponents(scanRoot: string): GlobalComponentsRegistry | null;
30
+ /**
31
+ * Warning-only framework sniff: an app that depends on `nuxt` but has no
32
+ * generated declarations will scan with auto-imports invisible. Never gates
33
+ * behaviour — only feeds the `auto-import-manifest-missing` diagnostic.
34
+ */
35
+ export declare function detectAutoImportFramework(scanRoot: string): {
36
+ expectedPath: string;
37
+ } | null;
@@ -0,0 +1,228 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { dirname, isAbsolute, join, resolve } from "node:path";
3
+ import { vueTagForms } from "@component-compass/parser-vue";
4
+ /** Declaration files probed, in order. First one that resolves entries wins. */
5
+ const CANDIDATE_PATHS = [join(".nuxt", "components.d.ts"), join(".nuxt", "types", "components.d.ts")];
6
+ // The modules a GlobalComponents augmentation can target. Both forms are live
7
+ // in the ecosystem: `@vue/runtime-core` is the historical one, `vue` the
8
+ // current one.
9
+ const AUGMENTED_MODULE = /declare\s+module\s+["'](?:vue|@vue\/runtime-core)["']\s*\{/g;
10
+ // `interface Name extends A, B {` — with or without `export` / `declare`.
11
+ const INTERFACE_DECL = /(?:^|[\s;}])(?:export\s+)?(?:declare\s+)?interface\s+([A-Za-z_$][\w$]*)\s*(?:extends\s+([^{]*?))?\s*\{/g;
12
+ // One member of a GlobalComponents interface. The key is a bare identifier or
13
+ // a quoted string — quoted keys carry the names an identifier can't spell,
14
+ // which for components means the kebab forms (`'my-card'`). The type is the
15
+ // bare `typeof import(...)` or a wrapper around it (`LazyComponent<...>`,
16
+ // `IslandComponent<...>`).
17
+ const MEMBER = /^\s*(?:["']([^"']+)["']|([A-Za-z_$][\w$]*))\??\s*:\s*.*typeof import\(["']([^"']+)["']\)\[["']([^"']+)["']\]/;
18
+ /** Body text between `open` (index of `{`) and its matching `}`, or null if unbalanced. */
19
+ function matchingBlock(source, open) {
20
+ let depth = 0;
21
+ for (let i = open; i < source.length; i++) {
22
+ const ch = source[i];
23
+ if (ch === "{")
24
+ depth++;
25
+ else if (ch === "}") {
26
+ depth--;
27
+ if (depth === 0)
28
+ return { body: source.slice(open + 1, i), end: i };
29
+ }
30
+ }
31
+ return null;
32
+ }
33
+ /** Every `interface` declaration in the file, in source order. */
34
+ function collectInterfaces(source) {
35
+ const out = [];
36
+ INTERFACE_DECL.lastIndex = 0;
37
+ for (let m = INTERFACE_DECL.exec(source); m !== null; m = INTERFACE_DECL.exec(source)) {
38
+ const open = m.index + m[0].length - 1;
39
+ const block = matchingBlock(source, open);
40
+ if (block === null)
41
+ continue;
42
+ out.push({
43
+ name: m[1],
44
+ extends: (m[2] ?? "")
45
+ .split(",")
46
+ .map((s) => s.trim())
47
+ .filter((s) => s !== ""),
48
+ body: block.body,
49
+ start: m.index,
50
+ });
51
+ // Members can't declare interfaces, but nested blocks can — resume after
52
+ // the whole declaration so an inner `interface` is still seen once.
53
+ INTERFACE_DECL.lastIndex = open + 1;
54
+ }
55
+ return out;
56
+ }
57
+ /** Character ranges covered by a `declare module 'vue' { ... }` block. */
58
+ function augmentedRanges(source) {
59
+ const out = [];
60
+ AUGMENTED_MODULE.lastIndex = 0;
61
+ for (let m = AUGMENTED_MODULE.exec(source); m !== null; m = AUGMENTED_MODULE.exec(source)) {
62
+ const open = m.index + m[0].length - 1;
63
+ const block = matchingBlock(source, open);
64
+ if (block === null)
65
+ continue;
66
+ out.push([m.index, block.end]);
67
+ AUGMENTED_MODULE.lastIndex = block.end;
68
+ }
69
+ return out;
70
+ }
71
+ /**
72
+ * Members contributed by `decl`, own-first then inherited — TypeScript's own
73
+ * precedence, so a first-wins consumer resolves a shadowed name the way the
74
+ * type checker would. `seen` breaks `extends` cycles.
75
+ */
76
+ function flatten(decl, byName, seen) {
77
+ if (seen.has(decl.name))
78
+ return [];
79
+ seen.add(decl.name);
80
+ const lines = decl.body.split("\n");
81
+ for (const parent of decl.extends) {
82
+ const target = byName.get(parent);
83
+ if (target !== undefined)
84
+ lines.push(...flatten(target, byName, seen));
85
+ }
86
+ return lines;
87
+ }
88
+ /**
89
+ * Every `GlobalComponents` member line in `source`, in precedence order, or
90
+ * null when the file declares no `GlobalComponents` at all — the signal that
91
+ * a probe should move on to the next candidate.
92
+ */
93
+ function globalComponentMembers(source) {
94
+ const ranges = augmentedRanges(source);
95
+ if (ranges.length === 0)
96
+ return null;
97
+ const interfaces = collectInterfaces(source);
98
+ // Same-name declarations merge, as TypeScript merges them — a parent split
99
+ // across two `interface _GlobalComponents` blocks contributes both.
100
+ const byName = new Map();
101
+ for (const decl of interfaces) {
102
+ const prior = byName.get(decl.name);
103
+ byName.set(decl.name, prior === undefined
104
+ ? decl
105
+ : { ...prior, extends: [...prior.extends, ...decl.extends], body: `${prior.body}\n${decl.body}` });
106
+ }
107
+ const declarations = interfaces.filter((decl) => decl.name === "GlobalComponents" &&
108
+ ranges.some(([start, end]) => decl.start > start && decl.start < end));
109
+ if (declarations.length === 0)
110
+ return null;
111
+ // Multiple declarations merge, as TypeScript merges them.
112
+ return declarations.flatMap((decl) => flatten(decl, byName, new Set()));
113
+ }
114
+ export function loadGlobalComponents(scanRoot) {
115
+ for (const candidate of CANDIDATE_PATHS) {
116
+ const declarationPath = join(scanRoot, candidate);
117
+ if (!existsSync(declarationPath))
118
+ continue;
119
+ // Misses degrade to diagnostics, never gate the scan — an unreadable
120
+ // candidate (EACCES, EISDIR, etc.) is skipped rather than throwing and
121
+ // aborting the whole scan.
122
+ let raw;
123
+ try {
124
+ raw = readFileSync(declarationPath, "utf8");
125
+ }
126
+ catch {
127
+ continue;
128
+ }
129
+ const members = globalComponentMembers(raw);
130
+ if (members === null)
131
+ continue;
132
+ const parsed = parseMembers(dirname(declarationPath), members);
133
+ // A declaration that resolves to nothing usable is not the registry —
134
+ // its members may be inherited from a file this candidate can't reach.
135
+ // Keep probing rather than locking in an empty result, which would also
136
+ // suppress the missing-declaration diagnostic and lose the scan silently.
137
+ if (parsed.map.size === 0 && parsed.stale.length === 0)
138
+ continue;
139
+ return { declarationPath, lookup: (tagForm) => parsed.map.get(tagForm), stale: parsed.stale };
140
+ }
141
+ return null;
142
+ }
143
+ /** A module specifier that names a package rather than a path (`vuetify/components`). */
144
+ function isBareSpecifier(importPath) {
145
+ if (isAbsolute(importPath))
146
+ return false;
147
+ // `.`/`..` are relative; `#` (subpath imports) and `~`/`@/` (bundler
148
+ // aliases) are neither bare nor resolvable here, so they keep the
149
+ // resolve-and-check path that surfaces a diagnostic instead of an identity.
150
+ return !/^[.#~\\/]/.test(importPath) && !importPath.startsWith("@/");
151
+ }
152
+ function parseMembers(baseDir, members) {
153
+ const map = new Map();
154
+ const stale = [];
155
+ for (const line of members) {
156
+ const m = MEMBER.exec(line);
157
+ if (m === null)
158
+ continue;
159
+ const name = (m[1] ?? m[2]);
160
+ const importPath = m[3];
161
+ const imported = m[4];
162
+ let specifier;
163
+ if (isBareSpecifier(importPath)) {
164
+ // A hand-written or library declaration names its own package
165
+ // (`typeof import('vuetify/components')`). It is already the bare
166
+ // specifier the external-identity route wants, and resolving it against
167
+ // baseDir would invent an in-repo path that never existed.
168
+ specifier = importPath;
169
+ }
170
+ else {
171
+ const abs = isAbsolute(importPath) ? importPath : resolve(baseDir, importPath);
172
+ // Normalise backslashes before the node_modules search so Windows-style
173
+ // absolute paths (`resolve()`'s native separator) still locate the
174
+ // segment; search + slice both run on the POSIX form so the returned
175
+ // specifier is always POSIX, not just the portion before node_modules/.
176
+ const posixAbs = abs.replaceAll("\\", "/");
177
+ const nmIdx = posixAbs.lastIndexOf("node_modules/");
178
+ if (nmIdx >= 0) {
179
+ // Generated paths reach into node_modules (often via pnpm's `.pnpm`
180
+ // store); the substring after the LAST `node_modules/` is the bare
181
+ // specifier, which flows the normal external-identity route.
182
+ specifier = posixAbs.slice(nmIdx + "node_modules/".length);
183
+ }
184
+ else {
185
+ // In-repo entry: a dead path must never become an identity.
186
+ if (!existsSync(abs)) {
187
+ stale.push({ componentName: name, target: abs });
188
+ continue;
189
+ }
190
+ specifier = abs;
191
+ }
192
+ }
193
+ const entry = { specifier, imported, name };
194
+ for (const form of vueTagForms(name)) {
195
+ if (!map.has(form))
196
+ map.set(form, entry);
197
+ }
198
+ }
199
+ return { map, stale };
200
+ }
201
+ /**
202
+ * Warning-only framework sniff: an app that depends on `nuxt` but has no
203
+ * generated declarations will scan with auto-imports invisible. Never gates
204
+ * behaviour — only feeds the `auto-import-manifest-missing` diagnostic.
205
+ */
206
+ export function detectAutoImportFramework(scanRoot) {
207
+ const pkgPath = join(scanRoot, "package.json");
208
+ if (!existsSync(pkgPath))
209
+ return null;
210
+ try {
211
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
212
+ // biome-ignore lint/complexity/useLiteralKeys: noPropertyAccessFromIndexSignature requires bracket notation
213
+ const hasNuxt = pkg.dependencies?.["nuxt"] !== undefined || pkg.devDependencies?.["nuxt"] !== undefined;
214
+ if (!hasNuxt)
215
+ return null;
216
+ // Name a candidate that is actually absent. Pointing at an existing file
217
+ // — Nuxt 4 leaves a populated `.nuxt/components.d.ts` behind even when the
218
+ // augmentation under `.nuxt/types/` is the missing one — sends the reader
219
+ // to the wrong artefact. With nothing generated at all this is the first
220
+ // candidate, which is what `nuxt prepare` writes.
221
+ const candidates = CANDIDATE_PATHS.map((c) => join(scanRoot, c));
222
+ return { expectedPath: candidates.find((p) => !existsSync(p)) ?? candidates[0] };
223
+ }
224
+ catch {
225
+ return null;
226
+ }
227
+ }
228
+ //# sourceMappingURL=global-components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"global-components.js","sourceRoot":"","sources":["../../src/scan/global-components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,WAAW,EAA4B,MAAM,+BAA+B,CAAC;AA2BtF,gFAAgF;AAChF,MAAM,eAAe,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,iBAAiB,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAEtG,8EAA8E;AAC9E,yEAAyE;AACzE,eAAe;AACf,MAAM,gBAAgB,GAAG,6DAA6D,CAAC;AAEvF,0EAA0E;AAC1E,MAAM,cAAc,GAAG,yGAAyG,CAAC;AAEjI,8EAA8E;AAC9E,2EAA2E;AAC3E,4EAA4E;AAC5E,0EAA0E;AAC1E,2BAA2B;AAC3B,MAAM,MAAM,GACV,8GAA8G,CAAC;AAIjH,2FAA2F;AAC3F,SAAS,aAAa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,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAGnD,CAAC;QACF,4GAA4G;QAC5G,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,KAAK,SAAS,IAAI,GAAG,CAAC,eAAe,EAAE,CAAC,MAAM,CAAC,KAAK,SAAS,CAAC;QACxG,IAAI,CAAC,OAAO;YAAE,OAAO,IAAI,CAAC;QAC1B,yEAAyE;QACzE,2EAA2E;QAC3E,0EAA0E;QAC1E,yEAAyE;QACzE,kDAAkD;QAClD,MAAM,UAAU,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;QACjE,OAAO,EAAE,YAAY,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAK,UAAU,CAAC,CAAC,CAAY,EAAE,CAAC;IAC/F,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -11,7 +11,7 @@ jobs:
11
11
  - uses: actions/checkout@v4
12
12
  - uses: actions/setup-node@v4
13
13
  with:
14
- node-version: 18
14
+ node-version: 24.18.0
15
15
  - run: corepack enable && yarn install --immutable
16
16
  - run: yarn dlx component-compass scan --quiet
17
17
  - uses: actions/upload-artifact@v4
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@component-compass/cli",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "Open-source CLI for measuring design-system component usage across multi-framework consumer repos.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
9
9
  "bin": {
10
- "compass": "dist/cli.js",
11
10
  "component-compass": "dist/cli.js"
12
11
  },
13
12
  "files": [
@@ -36,13 +35,13 @@
36
35
  "@babel/parser": "7.29.3",
37
36
  "@babel/types": "7.29.0",
38
37
  "@clack/prompts": "^1.5.1",
39
- "@component-compass/ast-utils": "0.1.15",
40
- "@component-compass/parser-html": "0.1.15",
41
- "@component-compass/parser-lit": "0.1.15",
42
- "@component-compass/parser-react": "0.1.15",
43
- "@component-compass/parser-vue": "0.1.15",
44
- "@component-compass/plugin-core": "0.1.15",
45
- "@component-compass/reference-graph": "0.1.15",
38
+ "@component-compass/ast-utils": "0.1.17",
39
+ "@component-compass/parser-html": "0.1.17",
40
+ "@component-compass/parser-lit": "0.1.17",
41
+ "@component-compass/parser-react": "0.1.17",
42
+ "@component-compass/parser-vue": "0.1.17",
43
+ "@component-compass/plugin-core": "0.1.17",
44
+ "@component-compass/reference-graph": "0.1.17",
46
45
  "@vue/compiler-sfc": "3.5.33",
47
46
  "ajv": "8.20.0",
48
47
  "glob": "13.0.6",
@@ -1,12 +0,0 @@
1
- export type DbImportOptions = {
2
- dir?: string;
3
- hostOverride?: string;
4
- };
5
- export type DbImportResult = {
6
- exitCode: number;
7
- inserted: number;
8
- skipped: number;
9
- failed: number;
10
- total: number;
11
- };
12
- export declare function runDbImport(opts?: DbImportOptions): Promise<DbImportResult>;
@@ -1,59 +0,0 @@
1
- import { readFile, readdir } from "node:fs/promises";
2
- import { homedir } from "node:os";
3
- import { join } from "node:path";
4
- import { UploadError } from "../upload.js";
5
- import { createAuthedUploader } from "../auth/upload-auth.js";
6
- import { formatAuthError } from "../auth/session.js";
7
- export async function runDbImport(opts = {}) {
8
- const dir = opts.dir ?? join(homedir(), ".cc-artifacts");
9
- let uploader;
10
- try {
11
- uploader = await createAuthedUploader(opts.hostOverride !== undefined ? { flagHost: opts.hostOverride } : {});
12
- }
13
- catch (err) {
14
- process.stderr.write(`${formatAuthError(err) ?? (err instanceof Error ? err.message : String(err))}\n`);
15
- return { exitCode: 1, inserted: 0, skipped: 0, failed: 0, total: 0 };
16
- }
17
- let repoDirs;
18
- try {
19
- const entries = await readdir(dir, { withFileTypes: true });
20
- repoDirs = entries.filter((e) => e.isDirectory()).map((e) => e.name);
21
- }
22
- catch {
23
- process.stderr.write(`No artifact directory at ${dir}\n`);
24
- return { exitCode: 1, inserted: 0, skipped: 0, failed: 0, total: 0 };
25
- }
26
- let inserted = 0;
27
- let skipped = 0;
28
- let failed = 0;
29
- let total = 0;
30
- for (const repo of repoDirs) {
31
- const repoDir = join(dir, repo);
32
- const files = (await readdir(repoDir)).filter((n) => n.endsWith(".json"));
33
- for (const f of files) {
34
- total++;
35
- const path = join(repoDir, f);
36
- try {
37
- const json = await readFile(path, "utf8");
38
- const result = await uploader.upload(json);
39
- if (result.status === "inserted")
40
- inserted++;
41
- else
42
- skipped++;
43
- process.stdout.write(`${result.status === "inserted" ? "+" : "="} ${repo}/${f} → ${result.scanId}\n`);
44
- }
45
- catch (err) {
46
- failed++;
47
- const msg = err instanceof UploadError
48
- ? `HTTP ${err.code}: ${err.message}`
49
- : err instanceof Error
50
- ? err.message
51
- : String(err);
52
- process.stderr.write(`! ${repo}/${f}: ${msg}\n`);
53
- }
54
- }
55
- }
56
- process.stdout.write(`\nImported ${inserted} new, skipped ${skipped} existing, failed ${failed} of ${total}.\n`);
57
- return { exitCode: failed > 0 ? 1 : 0, inserted, skipped, failed, total };
58
- }
59
- //# sourceMappingURL=db-import.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"db-import.js","sourceRoot":"","sources":["../../src/commands/db-import.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,E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EAAE,CAAC;gBACT,MAAM,GAAG,GACP,GAAG,YAAY,WAAW;oBACxB,CAAC,CAAC,QAAQ,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,OAAO,EAAE;oBACpC,CAAC,CAAC,GAAG,YAAY,KAAK;wBACpB,CAAC,CAAC,GAAG,CAAC,OAAO;wBACb,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBACpB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,cAAc,QAAQ,iBAAiB,OAAO,qBAAqB,MAAM,OAAO,KAAK,KAAK,CAC3F,CAAC;IAEF,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAC5E,CAAC"}
@@ -1,28 +0,0 @@
1
- import { type AutoImportComponent } from "@component-compass/parser-vue";
2
- /**
3
- * Reader for generated component auto-import manifests (#346). First (only)
4
- * provider: Nuxt's `.nuxt/components.d.ts` — the post-config truth for every
5
- * auto-importable component name, including Lazy variants and
6
- * module-provided components. CC consumes the artifact the ecosystem already
7
- * generates for static tools (tsc/Volar); it never re-derives the naming
8
- * convention.
9
- */
10
- export type AutoImportManifest = {
11
- manifestPath: string;
12
- /** Keyed by parse5's lowercased tag forms (see `vueTagForms`). */
13
- lookup: (tagForm: string) => AutoImportComponent | undefined;
14
- /** In-repo entries whose resolved file no longer exists (stale manifest). */
15
- stale: Array<{
16
- componentName: string;
17
- target: string;
18
- }>;
19
- };
20
- export declare function loadAutoImportManifest(scanRoot: string): AutoImportManifest | null;
21
- /**
22
- * Warning-only framework sniff: an app that depends on `nuxt` but has no
23
- * generated manifest will scan with auto-imports invisible. Never gates
24
- * behaviour — only feeds the `auto-import-manifest-missing` diagnostic.
25
- */
26
- export declare function detectAutoImportFramework(scanRoot: string): {
27
- expectedPath: string;
28
- } | null;
@@ -1,81 +0,0 @@
1
- import { existsSync, readFileSync } from "node:fs";
2
- import { dirname, isAbsolute, join, resolve } from "node:path";
3
- import { vueTagForms } from "@component-compass/parser-vue";
4
- // Matches plain, LazyComponent<...>, and IslandComponent<...> entry shapes:
5
- // export const Name: typeof import("<path>")['<export>']
6
- // export const LazyName: LazyComponent<typeof import("<path>")['default']>
7
- const ENTRY = /^export const (\w+): .*typeof import\("([^"]+)"\)\['([^']+)'\]/;
8
- export function loadAutoImportManifest(scanRoot) {
9
- const manifestPath = join(scanRoot, ".nuxt", "components.d.ts");
10
- if (!existsSync(manifestPath))
11
- return null;
12
- // Misses degrade to diagnostics, never gate the scan — an unreadable
13
- // manifest (EACCES, EISDIR, etc.) falls back to the missing-manifest path
14
- // rather than throwing and aborting the whole scan.
15
- let raw;
16
- try {
17
- raw = readFileSync(manifestPath, "utf8");
18
- }
19
- catch {
20
- return null;
21
- }
22
- const baseDir = dirname(manifestPath);
23
- const map = new Map();
24
- const stale = [];
25
- for (const line of raw.split("\n")) {
26
- const m = ENTRY.exec(line.trim());
27
- if (!m)
28
- continue;
29
- const name = m[1];
30
- const importPath = m[2];
31
- const imported = m[3];
32
- const abs = isAbsolute(importPath) ? importPath : resolve(baseDir, importPath);
33
- // Normalise backslashes before the node_modules search so Windows-style
34
- // absolute paths (`resolve()`'s native separator) still locate the
35
- // segment; search + slice both run on the POSIX form so the returned
36
- // specifier is always POSIX, not just the portion before node_modules/.
37
- const posixAbs = abs.replaceAll("\\", "/");
38
- const nmIdx = posixAbs.lastIndexOf("node_modules/");
39
- let specifier;
40
- if (nmIdx >= 0) {
41
- // Manifest paths reach into node_modules (often via pnpm's `.pnpm`
42
- // store); the substring after the LAST `node_modules/` is the bare
43
- // specifier, which flows the normal external-identity route.
44
- specifier = posixAbs.slice(nmIdx + "node_modules/".length);
45
- }
46
- else {
47
- // In-repo entry: a dead path must never become an identity.
48
- if (!existsSync(abs)) {
49
- stale.push({ componentName: name, target: abs });
50
- continue;
51
- }
52
- specifier = abs;
53
- }
54
- const entry = { specifier, imported, name };
55
- for (const form of vueTagForms(name)) {
56
- if (!map.has(form))
57
- map.set(form, entry);
58
- }
59
- }
60
- return { manifestPath, lookup: (tagForm) => map.get(tagForm), stale };
61
- }
62
- /**
63
- * Warning-only framework sniff: an app that depends on `nuxt` but has no
64
- * generated manifest will scan with auto-imports invisible. Never gates
65
- * behaviour — only feeds the `auto-import-manifest-missing` diagnostic.
66
- */
67
- export function detectAutoImportFramework(scanRoot) {
68
- const pkgPath = join(scanRoot, "package.json");
69
- if (!existsSync(pkgPath))
70
- return null;
71
- try {
72
- const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
73
- // biome-ignore lint/complexity/useLiteralKeys: noPropertyAccessFromIndexSignature requires bracket notation
74
- const hasNuxt = pkg.dependencies?.["nuxt"] !== undefined || pkg.devDependencies?.["nuxt"] !== undefined;
75
- return hasNuxt ? { expectedPath: join(scanRoot, ".nuxt", "components.d.ts") } : null;
76
- }
77
- catch {
78
- return null;
79
- }
80
- }
81
- //# sourceMappingURL=auto-import-manifest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-import-manifest.js","sourceRoot":"","sources":["../../src/scan/auto-import-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,WAAW,EAA4B,MAAM,+BAA+B,CAAC;AAkBtF,4EAA4E;AAC5E,2DAA2D;AAC3D,6EAA6E;AAC7E,MAAM,KAAK,GAAG,gEAAgE,CAAC;AAE/E,MAAM,UAAU,sBAAsB,CAAC,QAAgB;IACrD,MAAM,YAAY,GAAG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