@component-compass/cli 0.1.23 → 0.1.25
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 +103882 -104
- package/package.json +21 -25
- package/dist/auth/browser.d.ts +0 -13
- package/dist/auth/browser.js +0 -21
- package/dist/auth/browser.js.map +0 -1
- package/dist/auth/client.d.ts +0 -48
- package/dist/auth/client.js +0 -89
- package/dist/auth/client.js.map +0 -1
- package/dist/auth/paths.d.ts +0 -2
- package/dist/auth/paths.js +0 -14
- package/dist/auth/paths.js.map +0 -1
- package/dist/auth/session.d.ts +0 -38
- package/dist/auth/session.js +0 -88
- package/dist/auth/session.js.map +0 -1
- package/dist/auth/store.d.ts +0 -16
- package/dist/auth/store.js +0 -37
- package/dist/auth/store.js.map +0 -1
- package/dist/auth/upload-auth.d.ts +0 -22
- package/dist/auth/upload-auth.js +0 -51
- package/dist/auth/upload-auth.js.map +0 -1
- package/dist/cli/help.d.ts +0 -4
- package/dist/cli/help.js +0 -52
- package/dist/cli/help.js.map +0 -1
- package/dist/cli/parse.d.ts +0 -14
- package/dist/cli/parse.js +0 -75
- package/dist/cli/parse.js.map +0 -1
- package/dist/cli/suggest.d.ts +0 -4
- package/dist/cli/suggest.js +0 -38
- package/dist/cli/suggest.js.map +0 -1
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js.map +0 -1
- package/dist/commands/auth.d.ts +0 -33
- package/dist/commands/auth.js +0 -248
- package/dist/commands/auth.js.map +0 -1
- package/dist/commands/init.d.ts +0 -11
- package/dist/commands/init.js +0 -112
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/scan.d.ts +0 -33
- package/dist/commands/scan.js +0 -691
- package/dist/commands/scan.js.map +0 -1
- package/dist/composition-rollup.d.ts +0 -23
- package/dist/composition-rollup.js +0 -64
- package/dist/composition-rollup.js.map +0 -1
- package/dist/config/loader.d.ts +0 -6
- package/dist/config/loader.js +0 -71
- package/dist/config/loader.js.map +0 -1
- package/dist/config/schema.d.ts +0 -18
- package/dist/config/schema.js +0 -15
- package/dist/config/schema.js.map +0 -1
- package/dist/dispatcher.d.ts +0 -8
- package/dist/dispatcher.js +0 -22
- package/dist/dispatcher.js.map +0 -1
- package/dist/envelope/git.d.ts +0 -13
- package/dist/envelope/git.js +0 -69
- package/dist/envelope/git.js.map +0 -1
- package/dist/envelope/index.d.ts +0 -1
- package/dist/envelope/index.js +0 -12
- package/dist/envelope/index.js.map +0 -1
- package/dist/envelope/repo-id.d.ts +0 -16
- package/dist/envelope/repo-id.js +0 -40
- package/dist/envelope/repo-id.js.map +0 -1
- package/dist/identity.d.ts +0 -56
- package/dist/identity.js +0 -115
- package/dist/identity.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -3
- package/dist/index.js.map +0 -1
- package/dist/local-index/declared-props.d.ts +0 -15
- package/dist/local-index/declared-props.js +0 -101
- package/dist/local-index/declared-props.js.map +0 -1
- package/dist/local-index/detect-react.d.ts +0 -3
- package/dist/local-index/detect-react.js +0 -378
- package/dist/local-index/detect-react.js.map +0 -1
- package/dist/local-index/detect-vue.d.ts +0 -16
- package/dist/local-index/detect-vue.js +0 -284
- package/dist/local-index/detect-vue.js.map +0 -1
- package/dist/local-index/detect-wc.d.ts +0 -8
- package/dist/local-index/detect-wc.js +0 -70
- package/dist/local-index/detect-wc.js.map +0 -1
- package/dist/local-index/index.d.ts +0 -14
- package/dist/local-index/index.js +0 -46
- package/dist/local-index/index.js.map +0 -1
- package/dist/local-index/types.d.ts +0 -2
- package/dist/local-index/types.js +0 -2
- package/dist/local-index/types.js.map +0 -1
- package/dist/manifest/barrel-parser.d.ts +0 -35
- package/dist/manifest/barrel-parser.js +0 -76
- package/dist/manifest/barrel-parser.js.map +0 -1
- package/dist/manifest/lazy-resolver.d.ts +0 -123
- package/dist/manifest/lazy-resolver.js +0 -712
- package/dist/manifest/lazy-resolver.js.map +0 -1
- package/dist/occurrences.d.ts +0 -15
- package/dist/occurrences.js +0 -101
- package/dist/occurrences.js.map +0 -1
- package/dist/parse-by-ext.d.ts +0 -21
- package/dist/parse-by-ext.js +0 -53
- package/dist/parse-by-ext.js.map +0 -1
- package/dist/prompts/adapter.d.ts +0 -43
- package/dist/prompts/adapter.js +0 -32
- package/dist/prompts/adapter.js.map +0 -1
- package/dist/reporter/diagnostic-lines.d.ts +0 -7
- package/dist/reporter/diagnostic-lines.js +0 -40
- package/dist/reporter/diagnostic-lines.js.map +0 -1
- package/dist/reporter/index.d.ts +0 -39
- package/dist/reporter/index.js +0 -144
- package/dist/reporter/index.js.map +0 -1
- package/dist/reporter/json.d.ts +0 -6
- package/dist/reporter/json.js +0 -11
- package/dist/reporter/json.js.map +0 -1
- package/dist/reporter/stdout.d.ts +0 -3
- package/dist/reporter/stdout.js +0 -41
- package/dist/reporter/stdout.js.map +0 -1
- package/dist/rollup.d.ts +0 -26
- package/dist/rollup.js +0 -135
- package/dist/rollup.js.map +0 -1
- package/dist/scan/cem-index.d.ts +0 -38
- package/dist/scan/cem-index.js +0 -139
- package/dist/scan/cem-index.js.map +0 -1
- package/dist/scan/entry-packages.d.ts +0 -42
- package/dist/scan/entry-packages.js +0 -87
- package/dist/scan/entry-packages.js.map +0 -1
- package/dist/scan/framework-root.d.ts +0 -1
- package/dist/scan/framework-root.js +0 -22
- package/dist/scan/framework-root.js.map +0 -1
- package/dist/scan/git-mtime.d.ts +0 -2
- package/dist/scan/git-mtime.js +0 -22
- package/dist/scan/git-mtime.js.map +0 -1
- package/dist/scan/global-components.d.ts +0 -37
- package/dist/scan/global-components.js +0 -228
- package/dist/scan/global-components.js.map +0 -1
- package/dist/scan/meta.d.ts +0 -5
- package/dist/scan/meta.js +0 -58
- package/dist/scan/meta.js.map +0 -1
- package/dist/scan/stamp-version.d.ts +0 -18
- package/dist/scan/stamp-version.js +0 -94
- package/dist/scan/stamp-version.js.map +0 -1
- package/dist/scan/stamp-wraps.d.ts +0 -11
- package/dist/scan/stamp-wraps.js +0 -24
- package/dist/scan/stamp-wraps.js.map +0 -1
- package/dist/scan/wrap-relationships.d.ts +0 -12
- package/dist/scan/wrap-relationships.js +0 -38
- package/dist/scan/wrap-relationships.js.map +0 -1
- package/dist/seeds.d.ts +0 -81
- package/dist/seeds.js +0 -258
- package/dist/seeds.js.map +0 -1
- package/dist/types/brand.d.ts +0 -11
- package/dist/types/brand.js +0 -5
- package/dist/types/brand.js.map +0 -1
- package/dist/types/component-id.d.ts +0 -2
- package/dist/types/component-id.js +0 -2
- package/dist/types/component-id.js.map +0 -1
- package/dist/types.d.ts +0 -13
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/upload.d.ts +0 -18
- package/dist/upload.js +0 -34
- package/dist/upload.js.map +0 -1
- package/dist/util/color.d.ts +0 -24
- package/dist/util/color.js +0 -45
- package/dist/util/color.js.map +0 -1
- package/dist/util/git.d.ts +0 -10
- package/dist/util/git.js +0 -95
- package/dist/util/git.js.map +0 -1
- package/dist/util/interactive.d.ts +0 -17
- package/dist/util/interactive.js +0 -19
- package/dist/util/interactive.js.map +0 -1
- package/dist/util/log.d.ts +0 -9
- package/dist/util/log.js +0 -20
- package/dist/util/log.js.map +0 -1
- package/dist/util/pkg.d.ts +0 -1
- package/dist/util/pkg.js +0 -13
- package/dist/util/pkg.js.map +0 -1
- package/dist/util/pnp-check.d.ts +0 -1
- package/dist/util/pnp-check.js +0 -6
- package/dist/util/pnp-check.js.map +0 -1
- package/dist/util/posix.d.ts +0 -2
- package/dist/util/posix.js +0 -15
- package/dist/util/posix.js.map +0 -1
- package/dist/util/progress.d.ts +0 -21
- package/dist/util/progress.js +0 -54
- package/dist/util/progress.js.map +0 -1
- package/dist/util/version.d.ts +0 -7
- package/dist/util/version.js +0 -13
- package/dist/util/version.js.map +0 -1
- package/dist/walker/bounded-definition-resolver.d.ts +0 -9
- package/dist/walker/bounded-definition-resolver.js +0 -125
- package/dist/walker/bounded-definition-resolver.js.map +0 -1
- package/dist/walker/files.d.ts +0 -7
- package/dist/walker/files.js +0 -24
- package/dist/walker/files.js.map +0 -1
- package/dist/walker/package-alias-layers.d.ts +0 -7
- package/dist/walker/package-alias-layers.js +0 -40
- package/dist/walker/package-alias-layers.js.map +0 -1
- package/dist/walker/resolve-import.d.ts +0 -25
- package/dist/walker/resolve-import.js +0 -243
- package/dist/walker/resolve-import.js.map +0 -1
- package/dist/walker/tsconfig-discovery.d.ts +0 -36
- package/dist/walker/tsconfig-discovery.js +0 -52
- package/dist/walker/tsconfig-discovery.js.map +0 -1
- package/dist/walker/tsconfig-loader.d.ts +0 -35
- package/dist/walker/tsconfig-loader.js +0 -138
- package/dist/walker/tsconfig-loader.js.map +0 -1
- package/dist/walker/workspace-exports.d.ts +0 -3
- package/dist/walker/workspace-exports.js +0 -120
- package/dist/walker/workspace-exports.js.map +0 -1
- package/dist/workspace/build-graph.d.ts +0 -15
- package/dist/workspace/build-graph.js +0 -120
- package/dist/workspace/build-graph.js.map +0 -1
- package/dist/workspace/declared-deps.d.ts +0 -5
- package/dist/workspace/declared-deps.js +0 -42
- package/dist/workspace/declared-deps.js.map +0 -1
- package/dist/workspace/find-owning-package.d.ts +0 -8
- package/dist/workspace/find-owning-package.js +0 -69
- package/dist/workspace/find-owning-package.js.map +0 -1
- package/dist/workspace/find-workspace-root.d.ts +0 -1
- package/dist/workspace/find-workspace-root.js +0 -60
- package/dist/workspace/find-workspace-root.js.map +0 -1
- package/dist/workspace/index.d.ts +0 -4
- package/dist/workspace/index.js +0 -4
- package/dist/workspace/index.js.map +0 -1
- package/dist/workspace/types.d.ts +0 -49
- package/dist/workspace/types.js +0 -13
- package/dist/workspace/types.js.map +0 -1
|
@@ -1,228 +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
|
-
/** 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
|
|
@@ -1 +0,0 @@
|
|
|
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,O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E,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IACD,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;AACxB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,QAAgB;IACxD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;IAC/C,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC;IACtC,IAAI,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"}
|
package/dist/scan/meta.d.ts
DELETED
package/dist/scan/meta.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
import { basename, dirname, join, resolve } from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
import { ulid } from "ulid";
|
|
5
|
-
import { readGitCommit, readGitRemote, readGitBranch, readInitialCommit } from "../util/git.js";
|
|
6
|
-
import { readToolVersion } from "../envelope/index.js";
|
|
7
|
-
export async function stampMeta(opts) {
|
|
8
|
-
const commit = await readGitCommit(opts.cwd);
|
|
9
|
-
if (!commit)
|
|
10
|
-
throw new Error(`not a git repository: ${opts.cwd}`);
|
|
11
|
-
const rawInitialCommit = await readInitialCommit(opts.cwd);
|
|
12
|
-
const initialCommit = rawInitialCommit ?? null;
|
|
13
|
-
if (!initialCommit) {
|
|
14
|
-
process.stderr.write("warn: initial commit unavailable (shallow clone?) — set fetch-depth: 0 in CI for stable repo identity\n");
|
|
15
|
-
}
|
|
16
|
-
const gitRemote = await readGitRemote(opts.cwd);
|
|
17
|
-
const branch = await readGitBranch(opts.cwd);
|
|
18
|
-
const id = opts.repoIdOverride ?? deriveId(gitRemote, opts.cwd);
|
|
19
|
-
return {
|
|
20
|
-
ccVersion: readToolVersion(findCliPackageRoot()),
|
|
21
|
-
scanId: ulid(),
|
|
22
|
-
scannedAt: new Date().toISOString(),
|
|
23
|
-
repo: { id, gitRemote, commit, initialCommit, branch },
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
function deriveId(remote, cwd) {
|
|
27
|
-
if (remote) {
|
|
28
|
-
const match = remote.match(/[/:]([^/]+?)(\.git)?$/);
|
|
29
|
-
if (match?.[1])
|
|
30
|
-
return match[1];
|
|
31
|
-
}
|
|
32
|
-
return basename(cwd);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Walk up from this module's directory until we find the @component-compass/cli
|
|
36
|
-
* package.json. Robust to running from dist/ or src/ (vitest) without
|
|
37
|
-
* hardcoding a relative depth. Mirrors the pattern in envelope/index.ts.
|
|
38
|
-
*/
|
|
39
|
-
function findCliPackageRoot() {
|
|
40
|
-
let dir = dirname(fileURLToPath(import.meta.url));
|
|
41
|
-
for (let i = 0; i < 6; i++) {
|
|
42
|
-
const candidate = join(dir, "package.json");
|
|
43
|
-
try {
|
|
44
|
-
const parsed = JSON.parse(readFileSync(candidate, "utf8"));
|
|
45
|
-
if (parsed.name === "@component-compass/cli")
|
|
46
|
-
return dir;
|
|
47
|
-
}
|
|
48
|
-
catch {
|
|
49
|
-
// continue walking
|
|
50
|
-
}
|
|
51
|
-
const parent = resolve(dir, "..");
|
|
52
|
-
if (parent === dir)
|
|
53
|
-
break;
|
|
54
|
-
dir = parent;
|
|
55
|
-
}
|
|
56
|
-
return dirname(fileURLToPath(import.meta.url));
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=meta.js.map
|
package/dist/scan/meta.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../src/scan/meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,IAA8C;IAC5E,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7C,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAClE,MAAM,gBAAgB,GAAG,MAAM,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC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C,CAAC;QAC5C,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAuB,CAAC;YACjF,IAAI,MAAM,CAAC,IAAI,KAAK,wBAAwB;gBAAE,OAAO,GAAG,CAAC;QAC3D,CAAC;QAAC,MAAM,CAAC;YACP,mBAAmB;QACrB,CAAC;QACD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAClC,IAAI,MAAM,KAAK,GAAG;YAAE,MAAM;QAC1B,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;IACD,OAAO,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { OutputComponent, OutputOccurrence } from "@component-compass/plugin-core";
|
|
2
|
-
/**
|
|
3
|
-
* Reads each external/workspace package's `version` from its installed
|
|
4
|
-
* `package.json` and stamps it onto every component from that package.
|
|
5
|
-
* Local components keep `version: null`.
|
|
6
|
-
*
|
|
7
|
-
* Uses Node-style module resolution: walks upward from a representative
|
|
8
|
-
* occurrence's file directory through ancestor `node_modules` directories
|
|
9
|
-
* until the package is found. Starting from inside the sub-app that uses
|
|
10
|
-
* the package handles multi-app monorepos where deps are installed per-app
|
|
11
|
-
* (e.g. `pie-aperture/nextjs-app-v14/node_modules/`) rather than hoisted
|
|
12
|
-
* to the workspace root. Falls back to `startDir` for packages with no
|
|
13
|
-
* occurrences.
|
|
14
|
-
*
|
|
15
|
-
* Batches IO: one package.json read per unique external package name, not
|
|
16
|
-
* per component.
|
|
17
|
-
*/
|
|
18
|
-
export declare function stampVersion(startDir: string, components: OutputComponent[], occurrences?: OutputOccurrence[]): Promise<void>;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { join, dirname, resolve } from "node:path";
|
|
3
|
-
/**
|
|
4
|
-
* Reads each external/workspace package's `version` from its installed
|
|
5
|
-
* `package.json` and stamps it onto every component from that package.
|
|
6
|
-
* Local components keep `version: null`.
|
|
7
|
-
*
|
|
8
|
-
* Uses Node-style module resolution: walks upward from a representative
|
|
9
|
-
* occurrence's file directory through ancestor `node_modules` directories
|
|
10
|
-
* until the package is found. Starting from inside the sub-app that uses
|
|
11
|
-
* the package handles multi-app monorepos where deps are installed per-app
|
|
12
|
-
* (e.g. `pie-aperture/nextjs-app-v14/node_modules/`) rather than hoisted
|
|
13
|
-
* to the workspace root. Falls back to `startDir` for packages with no
|
|
14
|
-
* occurrences.
|
|
15
|
-
*
|
|
16
|
-
* Batches IO: one package.json read per unique external package name, not
|
|
17
|
-
* per component.
|
|
18
|
-
*/
|
|
19
|
-
export async function stampVersion(startDir, components, occurrences = []) {
|
|
20
|
-
// Collect unique external package names.
|
|
21
|
-
const packageNames = new Set();
|
|
22
|
-
for (const c of components) {
|
|
23
|
-
if (c.identity.scope !== "local" && c.identity.packageName) {
|
|
24
|
-
packageNames.add(c.identity.packageName);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
// componentId → packageName for fast occurrence → package lookup.
|
|
28
|
-
const pkgByComponentId = new Map();
|
|
29
|
-
for (const c of components) {
|
|
30
|
-
if (c.identity.scope !== "local" && c.identity.packageName) {
|
|
31
|
-
pkgByComponentId.set(c.id, c.identity.packageName);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
// packageName → directory to start the walk-up from. Use the parent dir of
|
|
35
|
-
// any occurrence's file path (resolved relative to startDir). Multi-app
|
|
36
|
-
// monorepos install deps per-app, so walking up from inside the sub-app
|
|
37
|
-
// hits the per-app node_modules. Falls back to startDir for packages with
|
|
38
|
-
// no occurrences.
|
|
39
|
-
const starterDirByPackage = new Map();
|
|
40
|
-
for (const o of occurrences) {
|
|
41
|
-
const pkg = pkgByComponentId.get(o.componentId);
|
|
42
|
-
if (pkg && !starterDirByPackage.has(pkg)) {
|
|
43
|
-
starterDirByPackage.set(pkg, dirname(resolve(startDir, o.filePath)));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
// Read each package.json once. Store null when not found / no version field.
|
|
47
|
-
const versionByPackage = new Map();
|
|
48
|
-
await Promise.all([...packageNames].map(async (name) => {
|
|
49
|
-
const searchFrom = starterDirByPackage.get(name) ?? startDir;
|
|
50
|
-
const version = await resolvePackageVersion(searchFrom, name);
|
|
51
|
-
versionByPackage.set(name, version);
|
|
52
|
-
}));
|
|
53
|
-
// Stamp each component.
|
|
54
|
-
for (const c of components) {
|
|
55
|
-
if (c.identity.scope !== "local" && c.identity.packageName) {
|
|
56
|
-
c.version = versionByPackage.get(c.identity.packageName) ?? null;
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
c.version = null;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Walk up the directory tree from `startDir`, trying
|
|
65
|
-
* `<dir>/node_modules/<packageName>/package.json` at each level.
|
|
66
|
-
* Returns the `version` string, or null when not found anywhere.
|
|
67
|
-
*/
|
|
68
|
-
async function resolvePackageVersion(startDir, packageName) {
|
|
69
|
-
let dir = startDir;
|
|
70
|
-
while (true) {
|
|
71
|
-
const pkgPath = join(dir, "node_modules", packageName, "package.json");
|
|
72
|
-
try {
|
|
73
|
-
const raw = await readFile(pkgPath, "utf8");
|
|
74
|
-
try {
|
|
75
|
-
const pkg = JSON.parse(raw);
|
|
76
|
-
return pkg.version ?? null;
|
|
77
|
-
}
|
|
78
|
-
catch {
|
|
79
|
-
// Malformed JSON — file exists, version unreadable.
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
catch {
|
|
84
|
-
// File not found or unreadable — try parent.
|
|
85
|
-
}
|
|
86
|
-
const parent = dirname(dir);
|
|
87
|
-
if (parent === dir) {
|
|
88
|
-
// Reached filesystem root.
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
dir = parent;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
//# sourceMappingURL=stamp-version.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stamp-version.js","sourceRoot":"","sources":["../../src/scan/stamp-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGnD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,QAAgB,EAChB,UAA6B,EAC7B,cAAkC,EAAE;IAEpC,yCAAyC;IACzC,MAAM,YAAY,GAAG,IAAI,GAAG,EAAU,CAAC;IACvC,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;QAC3B,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,KAAK,OAAO,IAAI,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;YAC3D,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAED,kEAAkE;IAClE,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAkB,CAAC;IACnD,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;QAC3B,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,KAAK,OAAO,IAAI,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;YAC3D,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IAED,2EAA2E;IAC3E,wEAAwE;IACxE,wEAAwE;IACxE,0EAA0E;IAC1E,kBAAkB;IAClB,MAAM,mBAAmB,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC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B,IAAI,GAAG,GAAG,QAAQ,CAAC;IACnB,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;QACvE,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAC5C,IAAI,CAAC;gBACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAyB,CAAC;gBACpD,OAAO,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC;YAC7B,CAAC;YAAC,MAAM,CAAC;gBACP,oDAAoD;gBACpD,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,6CAA6C;QAC/C,CAAC;QACD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;YACnB,2BAA2B;YAC3B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ComponentSeed } from "../rollup.js";
|
|
2
|
-
export type WrapperLookup = (packageName: string, exportName: string) => {
|
|
3
|
-
tagName: string;
|
|
4
|
-
packageName: string;
|
|
5
|
-
} | null;
|
|
6
|
-
/**
|
|
7
|
-
* THE `wraps` stamping seam: an external react-component whose package
|
|
8
|
-
* manifest declares a custom element for its export name gets the cross-link,
|
|
9
|
-
* once per component. Pure; a miss returns the seed untouched.
|
|
10
|
-
*/
|
|
11
|
-
export declare function stampWraps(seeds: ComponentSeed[], lookup: WrapperLookup): ComponentSeed[];
|
package/dist/scan/stamp-wraps.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* THE `wraps` stamping seam: an external react-component whose package
|
|
3
|
-
* manifest declares a custom element for its export name gets the cross-link,
|
|
4
|
-
* once per component. Pure; a miss returns the seed untouched.
|
|
5
|
-
*/
|
|
6
|
-
export function stampWraps(seeds, lookup) {
|
|
7
|
-
return seeds.map((seed) => {
|
|
8
|
-
const { identity } = seed;
|
|
9
|
-
if (identity.kind !== "react-component" ||
|
|
10
|
-
identity.scope !== "external" ||
|
|
11
|
-
identity.packageName === undefined ||
|
|
12
|
-
identity.exportName === undefined) {
|
|
13
|
-
return seed;
|
|
14
|
-
}
|
|
15
|
-
const hit = lookup(identity.packageName, identity.exportName);
|
|
16
|
-
if (hit === null)
|
|
17
|
-
return seed;
|
|
18
|
-
return {
|
|
19
|
-
...seed,
|
|
20
|
-
identity: { ...identity, wraps: { kind: "custom-element", tagName: hit.tagName, packageName: hit.packageName } },
|
|
21
|
-
};
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=stamp-wraps.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stamp-wraps.js","sourceRoot":"","sources":["../../src/scan/stamp-wraps.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,KAAsB,EAAE,MAAqB;IACtE,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACxB,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;QAC1B,IACE,QAAQ,CAAC,IAAI,KAAK,iBAAiB;YACnC,QAAQ,CAAC,KAAK,KAAK,UAAU;YAC7B,QAAQ,CAAC,WAAW,KAAK,SAAS;YAClC,QAAQ,CAAC,UAAU,KAAK,SAAS,EACjC,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;QAC9D,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QAC9B,OAAO;YACL,GAAG,IAAI;YACP,QAAQ,EAAE,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,CAAC,WAAW,EAAE,EAAE;SACjH,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { OutputComponent, RelationshipEdge } from "@component-compass/plugin-core";
|
|
2
|
-
/**
|
|
3
|
-
* Post-resolve pass (replaces wrap-aggregation's synthetic-node
|
|
4
|
-
* materialisation): stamps `logicalId` on every component and emits `wraps`
|
|
5
|
-
* relationship edges. Edge targets bind a componentId only when the target
|
|
6
|
-
* custom-element was observed; unobserved targets exist solely as the edge's
|
|
7
|
-
* logicalKey — nothing synthetic enters components[]. Pure.
|
|
8
|
-
*/
|
|
9
|
-
export declare function applyWrapRelationships(components: OutputComponent[]): {
|
|
10
|
-
components: OutputComponent[];
|
|
11
|
-
relationships: RelationshipEdge[];
|
|
12
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { computeLogicalId, logicalKeyFor } from "@component-compass/plugin-core";
|
|
2
|
-
/**
|
|
3
|
-
* Post-resolve pass (replaces wrap-aggregation's synthetic-node
|
|
4
|
-
* materialisation): stamps `logicalId` on every component and emits `wraps`
|
|
5
|
-
* relationship edges. Edge targets bind a componentId only when the target
|
|
6
|
-
* custom-element was observed; unobserved targets exist solely as the edge's
|
|
7
|
-
* logicalKey — nothing synthetic enters components[]. Pure.
|
|
8
|
-
*/
|
|
9
|
-
export function applyWrapRelationships(components) {
|
|
10
|
-
const ceByLogicalKey = new Map();
|
|
11
|
-
for (const c of components) {
|
|
12
|
-
if (c.identity.kind !== "custom-element")
|
|
13
|
-
continue;
|
|
14
|
-
const key = logicalKeyFor(c.identity);
|
|
15
|
-
if (key !== null)
|
|
16
|
-
ceByLogicalKey.set(key, c);
|
|
17
|
-
}
|
|
18
|
-
const relationships = [];
|
|
19
|
-
const stamped = components.map((c) => {
|
|
20
|
-
if ((c.identity.kind === "react-component" || c.identity.kind === "vue-component") &&
|
|
21
|
-
c.identity.wraps !== undefined) {
|
|
22
|
-
// wraps present -> logicalKeyFor is non-null by construction
|
|
23
|
-
const key = logicalKeyFor(c.identity);
|
|
24
|
-
const observed = ceByLogicalKey.get(key);
|
|
25
|
-
relationships.push({
|
|
26
|
-
sourceId: c.id,
|
|
27
|
-
type: "wraps",
|
|
28
|
-
target: { logicalKey: key, ...(observed !== undefined ? { componentId: observed.id } : {}) },
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
return { ...c, logicalId: computeLogicalId(c.identity, c.id) };
|
|
32
|
-
});
|
|
33
|
-
relationships.sort((a, b) => a.sourceId !== b.sourceId
|
|
34
|
-
? (a.sourceId < b.sourceId ? -1 : 1)
|
|
35
|
-
: a.target.logicalKey < b.target.logicalKey ? -1 : a.target.logicalKey > b.target.logicalKey ? 1 : 0);
|
|
36
|
-
return { components: stamped, relationships };
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=wrap-relationships.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wrap-relationships.js","sourceRoot":"","sources":["../../src/scan/wrap-relationships.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAGjF;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CACpC,UAA6B;IAE7B,MAAM,cAAc,GAAG,IAAI,GAAG,EAA2B,CAAC;IAC1D,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;QAC3B,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,KAAK,gBAAgB;YAAE,SAAS;QACnD,MAAM,GAAG,GAAG,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QACtC,IAAI,GAAG,KAAK,IAAI;YAAE,cAAc,CAAC,GAAG,CAAC,G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AC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CACvG,CAAC;IACF,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;AAChD,CAAC"}
|
package/dist/seeds.d.ts
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Builds per-component seeds from parser-emitted occurrences, and separately
|
|
3
|
-
* attaches manifest enrichment from a resolver-emitted snapshot onto those
|
|
4
|
-
* seeds. Seeds are the per-component input to `rollupOccurrencesToComponents`:
|
|
5
|
-
* they carry identity and manifest enrichment but no occurrence data (that is
|
|
6
|
-
* merged separately during rollup).
|
|
7
|
-
*
|
|
8
|
-
* Pure functions; no I/O.
|
|
9
|
-
*/
|
|
10
|
-
import type { IndexedComponent, LocalDefinitionIndex, ParseResult } from "@component-compass/plugin-core";
|
|
11
|
-
import type { ComponentSeed } from "./rollup.js";
|
|
12
|
-
import type { WorkspaceGraph } from "./workspace/types.js";
|
|
13
|
-
/** Output-space view of the engine's component registry. Paths
|
|
14
|
-
* are outputRoot-relative POSIX — the same space `LocalDefinition` uses —
|
|
15
|
-
* so `scan.ts` rebases the engine's graph keys before handing it here. */
|
|
16
|
-
export type RosterRegistry = {
|
|
17
|
-
hasLocal(filePath: string, exportName: string): boolean;
|
|
18
|
-
localEntries(): readonly {
|
|
19
|
-
filePath: string;
|
|
20
|
-
symbol: string;
|
|
21
|
-
exportName: string;
|
|
22
|
-
kind: "react-component" | "vue-component";
|
|
23
|
-
loc: {
|
|
24
|
-
line: number;
|
|
25
|
-
column: number;
|
|
26
|
-
};
|
|
27
|
-
isDefault: boolean;
|
|
28
|
-
}[];
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* One entry in the resolver snapshot. Wraps an `IndexedComponent` for
|
|
32
|
-
* transport from the lazy resolver into `attachManifestEnrichment`.
|
|
33
|
-
*/
|
|
34
|
-
export type SnapshotEntry = {
|
|
35
|
-
component: IndexedComponent;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Project parser-emitted occurrences (and never-referenced local
|
|
39
|
-
* definitions) into observed-only ComponentSeeds.
|
|
40
|
-
*
|
|
41
|
-
* Two sources contribute, both observed:
|
|
42
|
-
* 1. Components observed in parser walks — carry `modulePath` from the
|
|
43
|
-
* resolver and surface with `manifest: null` initially. `manifest` is
|
|
44
|
-
* filled in later, by `attachManifestEnrichment` — the ONE enrichment
|
|
45
|
-
* seam (see below).
|
|
46
|
-
* 2. Local definitions that were never referenced in any occurrence —
|
|
47
|
-
* still need a `components[]` entry so they can serve as owner-edge
|
|
48
|
-
* targets in the composition graph.
|
|
49
|
-
*
|
|
50
|
-
* Observed-only invariant: this function never creates a seed from manifest
|
|
51
|
-
* data. A seed exists here iff it was observed (parsed occurrence or local
|
|
52
|
-
* definition); manifest enrichment can only ever attach to an already-observed
|
|
53
|
-
* seed, never conjure a new one.
|
|
54
|
-
*
|
|
55
|
-
* Scope derivation: "local" for source.type === "local"; "external" otherwise.
|
|
56
|
-
* DS-grouping is the web app's responsibility — CC emits two scopes only.
|
|
57
|
-
*/
|
|
58
|
-
export declare function buildComponentSeeds(parseResults: ParseResult[], localIndex?: LocalDefinitionIndex, repoRoot?: string, workspaceGraph?: WorkspaceGraph, registry?: RosterRegistry,
|
|
59
|
-
/** The scan's `meta.repo.id`, stamped on every local identity. */
|
|
60
|
-
repoId?: string): ComponentSeed[];
|
|
61
|
-
/**
|
|
62
|
-
* Attach manifest enrichment from a resolver snapshot onto already-observed
|
|
63
|
-
* seeds. This is the ONE enrichment seam: every call site that needs a seed's
|
|
64
|
-
* `manifest` populated from a snapshot (legacy parser-observed seeds, or
|
|
65
|
-
* engine-discovered seeds from the reference-graph path) must route through
|
|
66
|
-
* here rather than re-deriving the merge logic.
|
|
67
|
-
*
|
|
68
|
-
* Snapshot entries lack `modulePath`, so their stable id won't collide with
|
|
69
|
-
* an observed seed's id even when they describe the same logical component.
|
|
70
|
-
* Instead of hashing, look up by `{kind, packageName, exportName-or-tagName}`
|
|
71
|
-
* and attach the manifest to that matching seed. Only merge when exactly one
|
|
72
|
-
* seed matches — multiple matches (e.g. two subpaths both exporting
|
|
73
|
-
* `default`) are ambiguous, and an ambiguous or absent match drops the
|
|
74
|
-
* enrichment rather than mutating anything (observed-only invariant:
|
|
75
|
-
* manifests never create `components[]` entries, and here they never create
|
|
76
|
-
* one either — `seeds` is mutated in place, never appended to).
|
|
77
|
-
*
|
|
78
|
-
* Mutates the `ComponentSeed` objects in `seeds` in place; does not resize
|
|
79
|
-
* the array.
|
|
80
|
-
*/
|
|
81
|
-
export declare function attachManifestEnrichment(seeds: ComponentSeed[], snapshot: SnapshotEntry[], workspaceGraph?: WorkspaceGraph): void;
|