@component-compass/plugin-core 0.1.23 → 0.1.28
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/diagnostic.d.ts +15 -27
- package/dist/diagnostic.js +4 -8
- package/dist/diagnostic.js.map +1 -1
- package/dist/index.d.ts +3 -11
- package/dist/index.js +1 -6
- package/dist/index.js.map +1 -1
- package/dist/occurrence-id.d.ts +4 -4
- package/dist/occurrence-id.js +4 -4
- package/dist/project-props.d.ts +4 -4
- package/dist/project-props.js +3 -3
- package/dist/scan-types.d.ts +16 -121
- package/dist/scan-types.js +1 -2
- package/dist/scan-types.js.map +1 -1
- package/dist/types.d.ts +0 -62
- package/dist/v2/component-key.d.ts +3 -0
- package/dist/v2/component-key.js +12 -0
- package/dist/v2/component-key.js.map +1 -0
- package/dist/v2/index.d.ts +9 -0
- package/dist/v2/index.js +9 -0
- package/dist/v2/index.js.map +1 -0
- package/dist/v2/resolved-occurrences.d.ts +4 -0
- package/dist/v2/resolved-occurrences.js +8 -0
- package/dist/v2/resolved-occurrences.js.map +1 -0
- package/dist/v2/scan-stats.d.ts +16 -0
- package/dist/v2/scan-stats.js +13 -0
- package/dist/v2/scan-stats.js.map +1 -0
- package/dist/v2/schema-version.d.ts +8 -0
- package/dist/v2/schema-version.js +16 -0
- package/dist/v2/schema-version.js.map +1 -0
- package/dist/v2/schema.d.ts +4875 -0
- package/dist/v2/schema.js +188 -0
- package/dist/v2/schema.js.map +1 -0
- package/dist/v2/tag-attribution.d.ts +9 -0
- package/dist/v2/tag-attribution.js +70 -0
- package/dist/v2/tag-attribution.js.map +1 -0
- package/dist/v2/tag-vocabulary.d.ts +17 -0
- package/dist/v2/tag-vocabulary.js +33 -0
- package/dist/v2/tag-vocabulary.js.map +1 -0
- package/dist/v2/validate.d.ts +18 -0
- package/dist/v2/validate.js +20 -0
- package/dist/v2/validate.js.map +1 -0
- package/package.json +19 -6
- package/dist/builder.d.ts +0 -21
- package/dist/builder.js +0 -49
- package/dist/builder.js.map +0 -1
- package/dist/enrichment.d.ts +0 -28
- package/dist/enrichment.js +0 -2
- package/dist/enrichment.js.map +0 -1
- package/dist/logical-id.d.ts +0 -4
- package/dist/logical-id.js +0 -48
- package/dist/logical-id.js.map +0 -1
- package/dist/output-types.d.ts +0 -316
- package/dist/output-types.js +0 -2
- package/dist/output-types.js.map +0 -1
- package/dist/schema.d.ts +0 -204
- package/dist/schema.js +0 -62
- package/dist/schema.js.map +0 -1
- package/dist/validate.d.ts +0 -9
- package/dist/validate.js +0 -18
- package/dist/validate.js.map +0 -1
- package/dist/via-types.d.ts +0 -64
- package/dist/via-types.js +0 -2
- package/dist/via-types.js.map +0 -1
package/dist/output-types.d.ts
DELETED
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Types describing the CLI's emitted JSON artifact (two-grain: components +
|
|
3
|
-
* occurrences). Lives in plugin-core so consumers (cli, future analytics,
|
|
4
|
-
* agents) share one source of truth without depending on cli internals.
|
|
5
|
-
*/
|
|
6
|
-
import type { Diagnostic } from "./diagnostic.js";
|
|
7
|
-
import type { OccurrenceVia } from "./via-types.js";
|
|
8
|
-
import type { Lifecycle } from "./types.js";
|
|
9
|
-
export type ComponentScope = "external" | "local";
|
|
10
|
-
export type ComponentKindOutput = "custom-element" | "react-component" | "vue-component";
|
|
11
|
-
export type OutputIdentity = {
|
|
12
|
-
scope: ComponentScope;
|
|
13
|
-
kind: ComponentKindOutput;
|
|
14
|
-
/**
|
|
15
|
-
* For external lane: the npm package name as resolved by the manifest layer.
|
|
16
|
-
* For local lane: the owning workspace package's name when the file resides inside
|
|
17
|
-
* one. Absent for root-level local files (non-workspace single-package repos).
|
|
18
|
-
*/
|
|
19
|
-
packageName?: string;
|
|
20
|
-
/**
|
|
21
|
-
* For external identities reached via a subpath import: the subpath after
|
|
22
|
-
* the package name (e.g. `@shoelace-style/shoelace/dist/components/button`
|
|
23
|
-
* → `"dist/components/button"`), POSIX-normalised. Disambiguates distinct
|
|
24
|
-
* components reached via different subpaths of the same package.
|
|
25
|
-
* - Populated string: import specifier carried a subpath.
|
|
26
|
-
* - Absent (`undefined`): not applicable — bare package specifier (e.g.
|
|
27
|
-
* `react`), byTag-driven external identities, or local identities.
|
|
28
|
-
* Derived from the specifier string alone — does not depend on whether
|
|
29
|
-
* the moduleResolver succeeded. Independent canonical signal.
|
|
30
|
-
*/
|
|
31
|
-
modulePath?: string;
|
|
32
|
-
/** For react-component / vue-component. */
|
|
33
|
-
exportName?: string;
|
|
34
|
-
/** For custom-element. */
|
|
35
|
-
tagName?: string;
|
|
36
|
-
/** Present for local; absent for external. */
|
|
37
|
-
repoId?: string;
|
|
38
|
-
/** Present for local; absent for external. Repo-relative path of the defining file. */
|
|
39
|
-
filePath?: string;
|
|
40
|
-
/**
|
|
41
|
-
* Source position of the local-component declaration (the function/class
|
|
42
|
-
* keyword for declarations; the variable identifier for `const Foo = ...`).
|
|
43
|
-
* Only set when `scope === "local"`. Absent for external / custom-element.
|
|
44
|
-
*/
|
|
45
|
-
definition?: {
|
|
46
|
-
line: number;
|
|
47
|
-
column: number;
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Cross-link from a framework wrapper to the underlying custom element it wraps.
|
|
51
|
-
* Set on react-component and vue-component identities whose package's CEM
|
|
52
|
-
* declares a custom-element with `className === this.exportName`.
|
|
53
|
-
* Absent when no CEM match or for non-wrapper imports.
|
|
54
|
-
* Does NOT participate in componentId hashing.
|
|
55
|
-
*/
|
|
56
|
-
wraps?: {
|
|
57
|
-
kind: "custom-element";
|
|
58
|
-
tagName: string;
|
|
59
|
-
packageName: string;
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
export type PropDecl = {
|
|
63
|
-
type?: string;
|
|
64
|
-
default?: string | number | boolean | null;
|
|
65
|
-
values?: string[];
|
|
66
|
-
required?: boolean;
|
|
67
|
-
description?: string;
|
|
68
|
-
lifecycle?: Lifecycle;
|
|
69
|
-
};
|
|
70
|
-
export type SlotDecl = {
|
|
71
|
-
description?: string;
|
|
72
|
-
lifecycle?: Lifecycle;
|
|
73
|
-
};
|
|
74
|
-
export type InvocableDecl = {
|
|
75
|
-
kind: "dom-event" | "callback-prop";
|
|
76
|
-
payloadType?: string;
|
|
77
|
-
description?: string;
|
|
78
|
-
lifecycle?: Lifecycle;
|
|
79
|
-
};
|
|
80
|
-
/**
|
|
81
|
-
* Per-component manifest payload as it appears in `component-compass.json`.
|
|
82
|
-
*/
|
|
83
|
-
export type AuthoredManifestData = {
|
|
84
|
-
description?: string;
|
|
85
|
-
lifecycle?: Lifecycle;
|
|
86
|
-
props?: Record<string, PropDecl>;
|
|
87
|
-
slots?: Record<string, SlotDecl>;
|
|
88
|
-
invocable?: Record<string, InvocableDecl>;
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* Per-occurrence prop value (keyed by prop name on OutputOccurrence.props).
|
|
92
|
-
* Same tiers as PropUsage minus `name`. Absent prop → key omitted.
|
|
93
|
-
*/
|
|
94
|
-
export type PropValueState = {
|
|
95
|
-
tier: "written";
|
|
96
|
-
value: string | number | boolean | null;
|
|
97
|
-
} | {
|
|
98
|
-
tier: "written";
|
|
99
|
-
valueSet: (string | number | boolean)[];
|
|
100
|
-
} | {
|
|
101
|
-
tier: "reference";
|
|
102
|
-
ref: string;
|
|
103
|
-
} | {
|
|
104
|
-
tier: "dynamic";
|
|
105
|
-
};
|
|
106
|
-
/** One enumerable value bucket in a component-grain prop distribution. */
|
|
107
|
-
export type PropValueEntry = {
|
|
108
|
-
provenance: "written";
|
|
109
|
-
value: string | number | boolean | null;
|
|
110
|
-
count: number;
|
|
111
|
-
} | {
|
|
112
|
-
provenance: "written";
|
|
113
|
-
valueSet: (string | number | boolean)[];
|
|
114
|
-
count: number;
|
|
115
|
-
} | {
|
|
116
|
-
provenance: "reference";
|
|
117
|
-
ref: string;
|
|
118
|
-
count: number;
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* Component-grain rollup for one prop.
|
|
122
|
-
* Invariant: sum(values[].count) + dynamic + (other ?? 0) + omitted === occurrenceCount
|
|
123
|
-
* `defaultApplied` is a SUBSET of `omitted` (manifest declares a default), not additive.
|
|
124
|
-
*/
|
|
125
|
-
export type PropDistribution = {
|
|
126
|
-
values: PropValueEntry[];
|
|
127
|
-
dynamic: number;
|
|
128
|
-
omitted: number;
|
|
129
|
-
defaultApplied: number;
|
|
130
|
-
other?: number;
|
|
131
|
-
truncated?: number;
|
|
132
|
-
};
|
|
133
|
-
/**
|
|
134
|
-
* One prop in a source-derived declared API. Every field is explicit-only:
|
|
135
|
-
* present iff the declaration site literally states it.
|
|
136
|
-
*/
|
|
137
|
-
export type DeclaredProp = {
|
|
138
|
-
/** Inline type annotation as verbatim source text (Vue type-literal only;
|
|
139
|
-
* absent for React — a destructure exposes no reliable type). */
|
|
140
|
-
type?: string;
|
|
141
|
-
/** Optionality when stated. Vue: from the `?` marker. React: `false` when the
|
|
142
|
-
* prop has any default (a default makes it optional); otherwise absent. */
|
|
143
|
-
required?: boolean;
|
|
144
|
-
/** Literal default value, when the default is a literal. Same union as
|
|
145
|
-
* `PropValueEntry.value`, so it stringifies identically to observed written
|
|
146
|
-
* values. Absent for no default or a non-literal default. */
|
|
147
|
-
default?: string | number | boolean | null;
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* Source-derived declared prop API for a local component. Absent on
|
|
151
|
-
* `OutputComponent` when the declaration site is unreadable (see readability
|
|
152
|
-
* gate). External components use `manifest` instead; the two can co-exist on a
|
|
153
|
-
* local workspace component that also ships an authored manifest.
|
|
154
|
-
*/
|
|
155
|
-
export type DeclaredPropApi = {
|
|
156
|
-
/** Prop name → what the site explicitly states. Keys in source order. */
|
|
157
|
-
props: Record<string, DeclaredProp>;
|
|
158
|
-
/** Component destructures `...rest` / declares an index signature. */
|
|
159
|
-
hasRest: boolean;
|
|
160
|
-
};
|
|
161
|
-
export type CompositionRollup = {
|
|
162
|
-
/** child componentId → count of occurrences owned by this component (owner-edge children). */
|
|
163
|
-
rendersByCount: Record<string, number>;
|
|
164
|
-
/** parent componentId → count of occurrences in which this component is owned by that parent. */
|
|
165
|
-
renderedByCount: Record<string, number>;
|
|
166
|
-
/** # of this component's occurrences with no ownerComponentId. */
|
|
167
|
-
isRootCount: number;
|
|
168
|
-
/** # of this component's occurrences whose component has empty rendersByCount. */
|
|
169
|
-
isLeafCount: number;
|
|
170
|
-
};
|
|
171
|
-
/** Per-component consumer-event usage rollup. `boundCount` = occurrences binding this event. */
|
|
172
|
-
export type EventDistribution = {
|
|
173
|
-
boundCount: number;
|
|
174
|
-
};
|
|
175
|
-
/**
|
|
176
|
-
* Entry/wrapper package through which this repo reached the component.
|
|
177
|
-
* Scan-observational provenance — how the repo imported it — not identity. `version` is the entry package's installed version, null when
|
|
178
|
-
* its package.json is unreadable or unversioned.
|
|
179
|
-
*/
|
|
180
|
-
export type EntryPackageRef = {
|
|
181
|
-
package: string;
|
|
182
|
-
version: string | null;
|
|
183
|
-
};
|
|
184
|
-
/**
|
|
185
|
-
* Why this component is in the inventory.
|
|
186
|
-
* Total classification; precedence: direct > root > none.
|
|
187
|
-
* - direct: ≥1 parsed occurrence (JSX / template / HTML tag).
|
|
188
|
-
* - root: local, zero occurrences, framework entry-point file's default export.
|
|
189
|
-
* - none: anything else, including external zero-occurrence rows. Catch-all.
|
|
190
|
-
* Manifest-derived components are never emitted, so no catalogue value exists.
|
|
191
|
-
*/
|
|
192
|
-
export type UsageKind = "direct" | "root" | "none";
|
|
193
|
-
export type OutputComponent = {
|
|
194
|
-
id: string;
|
|
195
|
-
identity: OutputIdentity;
|
|
196
|
-
/**
|
|
197
|
-
* Logical-component id this physical identity realizes.
|
|
198
|
-
* Singletons carry their own `id`; wrap chains share the tag-keyed hash.
|
|
199
|
-
* See plugin-core/src/logical-id.ts — the ONE derivation seam.
|
|
200
|
-
*/
|
|
201
|
-
logicalId: string;
|
|
202
|
-
manifest: {
|
|
203
|
-
source: "authored";
|
|
204
|
-
data: AuthoredManifestData;
|
|
205
|
-
} | null;
|
|
206
|
-
stats: {
|
|
207
|
-
occurrenceCount: number;
|
|
208
|
-
fileCount: number;
|
|
209
|
-
};
|
|
210
|
-
/** Why this component is in the inventory. See UsageKind. */
|
|
211
|
-
usage: UsageKind;
|
|
212
|
-
props: Record<string, PropDistribution>;
|
|
213
|
-
/** Consumer-bound events rolled up across occurrences (Vue/html/lit native + React on* props). */
|
|
214
|
-
events?: Record<string, EventDistribution>;
|
|
215
|
-
/** Per-component composition rollup (owner-edge driven). Always emitted. */
|
|
216
|
-
composition?: CompositionRollup;
|
|
217
|
-
/** Source-derived declared prop API. Local components only; absent when the
|
|
218
|
-
* declaration site is unreadable. Orthogonal to `manifest`. */
|
|
219
|
-
declared?: DeclaredPropApi;
|
|
220
|
-
/** Entry/wrapper packages this repo reached the component through.
|
|
221
|
-
* Deduped by {package, version}, sorted. Present only when non-empty. */
|
|
222
|
-
entryPackages?: EntryPackageRef[];
|
|
223
|
-
/** Package version from package.json or CEM. Null for external packages not versioned at scan time. */
|
|
224
|
-
version: string | null;
|
|
225
|
-
/** Git-mtime: first commit of the declaring file. ISO 8601 string, or null for external packages. */
|
|
226
|
-
createdAt: string | null;
|
|
227
|
-
/** Git-mtime: last commit of the declaring file. ISO 8601 string, or null for external packages. */
|
|
228
|
-
updatedAt: string | null;
|
|
229
|
-
};
|
|
230
|
-
export type OutputOccurrence = {
|
|
231
|
-
componentId: string;
|
|
232
|
-
filePath: string;
|
|
233
|
-
line: number;
|
|
234
|
-
column: number;
|
|
235
|
-
/** Outer-most access pattern (alias for viaChain[0]). */
|
|
236
|
-
via: OccurrenceVia;
|
|
237
|
-
/** Full provenance chain from JSX site to resolved identity, outermost-first.
|
|
238
|
-
* Single-element for direct imports; multi-element for HOC chains, lazy boundaries
|
|
239
|
-
* through barrels, etc. */
|
|
240
|
-
viaChain: OccurrenceVia[];
|
|
241
|
-
props: Record<string, PropValueState>;
|
|
242
|
-
/** Event names bound at this call site (Vue/html/lit). React handlers stay in `props`. */
|
|
243
|
-
events?: string[];
|
|
244
|
-
/** Stable id keyed on (componentId, filePath, line, column). */
|
|
245
|
-
occurrenceId: string;
|
|
246
|
-
/** occurrenceId of nearest tracked ancestor. Absent if root in this scope. */
|
|
247
|
-
parentOccurrenceId?: string;
|
|
248
|
-
/** Distance from highest tracked-rootless ancestor in same lexical scope. */
|
|
249
|
-
depth?: number;
|
|
250
|
-
/**
|
|
251
|
-
* Stable id of the component-definition that lexically contains this call
|
|
252
|
-
* site (the enclosing function/class). Drives the owner-edge composition
|
|
253
|
-
* graph. Absent when the occurrence is module-scope JSX, in a `.html`
|
|
254
|
-
* file, or the parser couldn't resolve an enclosing tracked component.
|
|
255
|
-
*/
|
|
256
|
-
ownerComponentId?: string;
|
|
257
|
-
};
|
|
258
|
-
/**
|
|
259
|
-
* Top-level metadata block in the scan artifact.
|
|
260
|
-
* Captures repo identity, git state, and scan timing for cross-scan joins and provenance.
|
|
261
|
-
*/
|
|
262
|
-
export type ScanMeta = {
|
|
263
|
-
/** CC version that created this artifact. */
|
|
264
|
-
ccVersion: string;
|
|
265
|
-
/** ULID generated once per scan. Unique across scans; stable within a single run. */
|
|
266
|
-
scanId: string;
|
|
267
|
-
/** ISO 8601 timestamp of the scan. */
|
|
268
|
-
scannedAt: string;
|
|
269
|
-
/** Repository identification and git state. */
|
|
270
|
-
repo: {
|
|
271
|
-
/** Stable repo identifier: git remote basename, config override, or working-directory basename. */
|
|
272
|
-
id: string;
|
|
273
|
-
/** Git remote URL (or null if not configured). For provenance tracking. */
|
|
274
|
-
gitRemote: string | null;
|
|
275
|
-
/** Current HEAD commit SHA. */
|
|
276
|
-
commit: string;
|
|
277
|
-
/** First commit SHA in the repo history. Stable across force-pushes and rebases. Null on shallow clones where git rev-list --max-parents=0 is unavailable. */
|
|
278
|
-
initialCommit: string | null;
|
|
279
|
-
/** Current branch name, or null for detached HEAD / shallow clones where branch is unavailable. */
|
|
280
|
-
branch: string | null;
|
|
281
|
-
};
|
|
282
|
-
};
|
|
283
|
-
/**
|
|
284
|
-
* First-class realization edge. The edge target is a logical key,
|
|
285
|
-
* bound to a physical componentId only when that target was observed in this
|
|
286
|
-
* repo's scan.
|
|
287
|
-
* Only "wraps" is emitted today; the union stays open for future sources
|
|
288
|
-
* ("re-exports" provenance is already carried by leaf folding and
|
|
289
|
-
* entryPackages).
|
|
290
|
-
*/
|
|
291
|
-
export type RelationshipEdge = {
|
|
292
|
-
sourceId: string;
|
|
293
|
-
type: "wraps";
|
|
294
|
-
target: {
|
|
295
|
-
logicalKey: string;
|
|
296
|
-
componentId?: string;
|
|
297
|
-
};
|
|
298
|
-
};
|
|
299
|
-
/**
|
|
300
|
-
* The complete scan artifact shape produced by the CLI.
|
|
301
|
-
* Two-grain structure: components (rolled-up identity + manifest + composition) +
|
|
302
|
-
* occurrences (per call-site, linked to components by id).
|
|
303
|
-
*/
|
|
304
|
-
export type ScanArtifact = {
|
|
305
|
-
meta: ScanMeta;
|
|
306
|
-
components: OutputComponent[];
|
|
307
|
-
occurrences: OutputOccurrence[];
|
|
308
|
-
relationships: RelationshipEdge[];
|
|
309
|
-
/**
|
|
310
|
-
* Observations the scan could not turn into a component — unresolved tags,
|
|
311
|
-
* unresolved imports, bailed-out re-export chains. Reader surfaces project
|
|
312
|
-
* from these to tell a consumer what the scan could NOT see, which no
|
|
313
|
-
* component row can express.
|
|
314
|
-
*/
|
|
315
|
-
diagnostics: Diagnostic[];
|
|
316
|
-
};
|
package/dist/output-types.js
DELETED
package/dist/output-types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"output-types.js","sourceRoot":"","sources":["../src/output-types.ts"],"names":[],"mappings":""}
|
package/dist/schema.d.ts
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
export declare const manifestJsonSchema: {
|
|
2
|
-
readonly $id: "https://component-compass.dev/manifest-2.0.0.json";
|
|
3
|
-
readonly type: "object";
|
|
4
|
-
readonly required: readonly ["schemaVersion", "source", "package", "components"];
|
|
5
|
-
readonly additionalProperties: true;
|
|
6
|
-
readonly properties: {
|
|
7
|
-
readonly schemaVersion: {
|
|
8
|
-
readonly const: "2.0.0";
|
|
9
|
-
};
|
|
10
|
-
readonly source: {
|
|
11
|
-
readonly enum: readonly ["cem", "react", "vue"];
|
|
12
|
-
};
|
|
13
|
-
readonly package: {
|
|
14
|
-
readonly type: "string";
|
|
15
|
-
readonly minLength: 1;
|
|
16
|
-
};
|
|
17
|
-
readonly components: {
|
|
18
|
-
readonly type: "array";
|
|
19
|
-
readonly items: {
|
|
20
|
-
readonly type: "object";
|
|
21
|
-
readonly required: readonly ["kind", "source", "props"];
|
|
22
|
-
readonly properties: {
|
|
23
|
-
readonly kind: {
|
|
24
|
-
readonly enum: readonly ["custom-element", "react-component", "vue-component"];
|
|
25
|
-
};
|
|
26
|
-
readonly source: {
|
|
27
|
-
readonly type: "object";
|
|
28
|
-
readonly required: readonly ["type"];
|
|
29
|
-
readonly properties: {
|
|
30
|
-
readonly type: {
|
|
31
|
-
readonly enum: readonly ["external", "local"];
|
|
32
|
-
};
|
|
33
|
-
readonly package: {
|
|
34
|
-
readonly type: "string";
|
|
35
|
-
readonly minLength: 1;
|
|
36
|
-
};
|
|
37
|
-
readonly filePath: {
|
|
38
|
-
readonly type: "string";
|
|
39
|
-
readonly minLength: 1;
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
readonly allOf: readonly [{
|
|
43
|
-
readonly if: {
|
|
44
|
-
readonly properties: {
|
|
45
|
-
readonly type: {
|
|
46
|
-
readonly const: "external";
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
readonly then: {
|
|
51
|
-
readonly required: readonly ["package"];
|
|
52
|
-
};
|
|
53
|
-
}, {
|
|
54
|
-
readonly if: {
|
|
55
|
-
readonly properties: {
|
|
56
|
-
readonly type: {
|
|
57
|
-
readonly const: "local";
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
readonly then: {
|
|
62
|
-
readonly required: readonly ["filePath"];
|
|
63
|
-
};
|
|
64
|
-
}];
|
|
65
|
-
};
|
|
66
|
-
readonly export: {
|
|
67
|
-
readonly type: "string";
|
|
68
|
-
};
|
|
69
|
-
readonly tagName: {
|
|
70
|
-
readonly type: "string";
|
|
71
|
-
};
|
|
72
|
-
readonly description: {
|
|
73
|
-
readonly type: "string";
|
|
74
|
-
};
|
|
75
|
-
readonly lifecycle: {
|
|
76
|
-
readonly type: "object";
|
|
77
|
-
};
|
|
78
|
-
readonly props: {
|
|
79
|
-
readonly type: "array";
|
|
80
|
-
readonly items: {
|
|
81
|
-
readonly type: "object";
|
|
82
|
-
readonly required: readonly ["name"];
|
|
83
|
-
readonly properties: {
|
|
84
|
-
readonly name: {
|
|
85
|
-
readonly type: "string";
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
readonly events: {
|
|
91
|
-
readonly type: "array";
|
|
92
|
-
};
|
|
93
|
-
readonly slots: {
|
|
94
|
-
readonly type: "array";
|
|
95
|
-
};
|
|
96
|
-
readonly cssParts: {
|
|
97
|
-
readonly type: "array";
|
|
98
|
-
};
|
|
99
|
-
readonly cssProperties: {
|
|
100
|
-
readonly type: "array";
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
readonly allOf: readonly [{
|
|
104
|
-
readonly if: {
|
|
105
|
-
readonly properties: {
|
|
106
|
-
readonly kind: {
|
|
107
|
-
readonly const: "custom-element";
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
|
-
readonly then: {
|
|
112
|
-
readonly required: readonly ["tagName"];
|
|
113
|
-
};
|
|
114
|
-
}, {
|
|
115
|
-
readonly if: {
|
|
116
|
-
readonly properties: {
|
|
117
|
-
readonly kind: {
|
|
118
|
-
readonly const: "react-component";
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
};
|
|
122
|
-
readonly then: {
|
|
123
|
-
readonly required: readonly ["export"];
|
|
124
|
-
};
|
|
125
|
-
}, {
|
|
126
|
-
readonly if: {
|
|
127
|
-
readonly properties: {
|
|
128
|
-
readonly kind: {
|
|
129
|
-
readonly const: "vue-component";
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
};
|
|
133
|
-
readonly then: {
|
|
134
|
-
readonly required: readonly ["export"];
|
|
135
|
-
};
|
|
136
|
-
}];
|
|
137
|
-
};
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
readonly allOf: readonly [{
|
|
141
|
-
readonly if: {
|
|
142
|
-
readonly properties: {
|
|
143
|
-
readonly source: {
|
|
144
|
-
readonly const: "react";
|
|
145
|
-
};
|
|
146
|
-
};
|
|
147
|
-
};
|
|
148
|
-
readonly then: {
|
|
149
|
-
readonly properties: {
|
|
150
|
-
readonly components: {
|
|
151
|
-
readonly items: {
|
|
152
|
-
readonly properties: {
|
|
153
|
-
readonly kind: {
|
|
154
|
-
readonly const: "react-component";
|
|
155
|
-
};
|
|
156
|
-
};
|
|
157
|
-
};
|
|
158
|
-
};
|
|
159
|
-
};
|
|
160
|
-
};
|
|
161
|
-
}, {
|
|
162
|
-
readonly if: {
|
|
163
|
-
readonly properties: {
|
|
164
|
-
readonly source: {
|
|
165
|
-
readonly const: "vue";
|
|
166
|
-
};
|
|
167
|
-
};
|
|
168
|
-
};
|
|
169
|
-
readonly then: {
|
|
170
|
-
readonly properties: {
|
|
171
|
-
readonly components: {
|
|
172
|
-
readonly items: {
|
|
173
|
-
readonly properties: {
|
|
174
|
-
readonly kind: {
|
|
175
|
-
readonly const: "vue-component";
|
|
176
|
-
};
|
|
177
|
-
};
|
|
178
|
-
};
|
|
179
|
-
};
|
|
180
|
-
};
|
|
181
|
-
};
|
|
182
|
-
}, {
|
|
183
|
-
readonly if: {
|
|
184
|
-
readonly properties: {
|
|
185
|
-
readonly source: {
|
|
186
|
-
readonly const: "cem";
|
|
187
|
-
};
|
|
188
|
-
};
|
|
189
|
-
};
|
|
190
|
-
readonly then: {
|
|
191
|
-
readonly properties: {
|
|
192
|
-
readonly components: {
|
|
193
|
-
readonly items: {
|
|
194
|
-
readonly properties: {
|
|
195
|
-
readonly kind: {
|
|
196
|
-
readonly const: "custom-element";
|
|
197
|
-
};
|
|
198
|
-
};
|
|
199
|
-
};
|
|
200
|
-
};
|
|
201
|
-
};
|
|
202
|
-
};
|
|
203
|
-
}];
|
|
204
|
-
};
|
package/dist/schema.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
export const manifestJsonSchema = {
|
|
2
|
-
$id: "https://component-compass.dev/manifest-2.0.0.json",
|
|
3
|
-
type: "object",
|
|
4
|
-
required: ["schemaVersion", "source", "package", "components"],
|
|
5
|
-
additionalProperties: true,
|
|
6
|
-
properties: {
|
|
7
|
-
schemaVersion: { const: "2.0.0" },
|
|
8
|
-
source: { enum: ["cem", "react", "vue"] },
|
|
9
|
-
package: { type: "string", minLength: 1 },
|
|
10
|
-
components: {
|
|
11
|
-
type: "array",
|
|
12
|
-
items: {
|
|
13
|
-
type: "object",
|
|
14
|
-
required: ["kind", "source", "props"],
|
|
15
|
-
properties: {
|
|
16
|
-
kind: { enum: ["custom-element", "react-component", "vue-component"] },
|
|
17
|
-
source: {
|
|
18
|
-
type: "object",
|
|
19
|
-
required: ["type"],
|
|
20
|
-
properties: {
|
|
21
|
-
type: { enum: ["external", "local"] },
|
|
22
|
-
package: { type: "string", minLength: 1 },
|
|
23
|
-
filePath: { type: "string", minLength: 1 },
|
|
24
|
-
},
|
|
25
|
-
allOf: [
|
|
26
|
-
// biome-ignore lint/suspicious/noThenProperty: JSON Schema if/then for source.type conditional
|
|
27
|
-
{ if: { properties: { type: { const: "external" } } }, then: { required: ["package"] } },
|
|
28
|
-
// biome-ignore lint/suspicious/noThenProperty: JSON Schema if/then for source.type conditional
|
|
29
|
-
{ if: { properties: { type: { const: "local" } } }, then: { required: ["filePath"] } },
|
|
30
|
-
],
|
|
31
|
-
},
|
|
32
|
-
export: { type: "string" },
|
|
33
|
-
tagName: { type: "string" },
|
|
34
|
-
description: { type: "string" },
|
|
35
|
-
lifecycle: { type: "object" },
|
|
36
|
-
props: { type: "array", items: { type: "object", required: ["name"], properties: { name: { type: "string" } } } },
|
|
37
|
-
events: { type: "array" },
|
|
38
|
-
slots: { type: "array" },
|
|
39
|
-
cssParts: { type: "array" },
|
|
40
|
-
cssProperties: { type: "array" },
|
|
41
|
-
},
|
|
42
|
-
allOf: [
|
|
43
|
-
// biome-ignore lint/suspicious/noThenProperty: JSON Schema if/then for kind conditional
|
|
44
|
-
{ if: { properties: { kind: { const: "custom-element" } } }, then: { required: ["tagName"] } },
|
|
45
|
-
// biome-ignore lint/suspicious/noThenProperty: JSON Schema if/then for kind conditional
|
|
46
|
-
{ if: { properties: { kind: { const: "react-component" } } }, then: { required: ["export"] } },
|
|
47
|
-
// biome-ignore lint/suspicious/noThenProperty: JSON Schema if/then for kind conditional
|
|
48
|
-
{ if: { properties: { kind: { const: "vue-component" } } }, then: { required: ["export"] } },
|
|
49
|
-
],
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
allOf: [
|
|
54
|
-
// biome-ignore lint/suspicious/noThenProperty: JSON Schema if/then for source conditional
|
|
55
|
-
{ if: { properties: { source: { const: "react" } } }, then: { properties: { components: { items: { properties: { kind: { const: "react-component" } } } } } } },
|
|
56
|
-
// biome-ignore lint/suspicious/noThenProperty: JSON Schema if/then for source conditional
|
|
57
|
-
{ if: { properties: { source: { const: "vue" } } }, then: { properties: { components: { items: { properties: { kind: { const: "vue-component" } } } } } } },
|
|
58
|
-
// biome-ignore lint/suspicious/noThenProperty: JSON Schema if/then for source conditional
|
|
59
|
-
{ if: { properties: { source: { const: "cem" } } }, then: { properties: { components: { items: { properties: { kind: { const: "custom-element" } } } } } } },
|
|
60
|
-
],
|
|
61
|
-
};
|
|
62
|
-
//# sourceMappingURL=schema.js.map
|
package/dist/schema.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
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
import { manifestJsonSchema } from "./schema.js";
|
|
3
|
-
// ajv is a CJS-only package. Under module: NodeNext, the bare default import
|
|
4
|
-
// is the namespace, not the class. createRequire is Node's official escape
|
|
5
|
-
// hatch for loading CJS from ESM. (Same pattern as packages/cli/src/config/schema.ts.)
|
|
6
|
-
const require = createRequire(import.meta.url);
|
|
7
|
-
const Ajv = require("ajv").default ?? require("ajv");
|
|
8
|
-
const ajv = new Ajv({ allErrors: true, strict: false });
|
|
9
|
-
const validate = ajv.compile(manifestJsonSchema);
|
|
10
|
-
export function validateManifest(doc) {
|
|
11
|
-
if (validate(doc))
|
|
12
|
-
return { ok: true, data: doc };
|
|
13
|
-
return {
|
|
14
|
-
ok: false,
|
|
15
|
-
errors: (validate.errors ?? []).map((e) => `${e.instancePath || "/"} ${e.message ?? "unknown error"}`),
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=validate.js.map
|
package/dist/validate.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGjD,6EAA6E;AAC7E,2EAA2E;AAC3E,uFAAuF;AACvF,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,GAAG,GAA2B,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;AAE7E,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AACxD,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAMjD,MAAM,UAAU,gBAAgB,CAAC,GAAY;IAC3C,IAAI,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,GAAmB,EAAE,CAAC;IAClE,OAAO;QACL,EAAE,EAAE,KAAK;QACT,MAAM,EAAE,CAAC,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,GAAG,CACjC,CAAC,CAAc,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,YAAY,IAAI,GAAG,IAAI,CAAC,CAAC,OAAO,IAAI,eAAe,EAAE,CAC/E;KACF,CAAC;AACJ,CAAC"}
|