@usefragments/core 1.7.0 → 1.7.1
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/index.d.ts +34 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/component-contract.ts +12 -0
- package/src/contract-parser.ts +2 -0
package/package.json
CHANGED
|
@@ -25,6 +25,13 @@ export interface ComponentContract {
|
|
|
25
25
|
/** Framework hint (for extraction and documentation) */
|
|
26
26
|
framework?: 'react' | 'vue' | 'svelte' | 'web-components' | 'angular';
|
|
27
27
|
|
|
28
|
+
/** External npm packages required by this component (displayed in docs Setup section) */
|
|
29
|
+
dependencies?: Array<{
|
|
30
|
+
name: string;
|
|
31
|
+
version: string;
|
|
32
|
+
reason?: string;
|
|
33
|
+
}>;
|
|
34
|
+
|
|
28
35
|
/** Path to the component source file, relative to fragments.config.ts root */
|
|
29
36
|
sourcePath: string;
|
|
30
37
|
|
|
@@ -215,6 +222,11 @@ export const componentContractSchema = z.object({
|
|
|
215
222
|
tags: z.array(z.string()).optional(),
|
|
216
223
|
status: z.enum(['stable', 'beta', 'deprecated', 'experimental']).optional(),
|
|
217
224
|
framework: z.enum(['react', 'vue', 'svelte', 'web-components', 'angular']).optional(),
|
|
225
|
+
dependencies: z.array(z.object({
|
|
226
|
+
name: z.string(),
|
|
227
|
+
version: z.string(),
|
|
228
|
+
reason: z.string().optional(),
|
|
229
|
+
})).optional(),
|
|
218
230
|
sourcePath: z.string(),
|
|
219
231
|
exportName: z.string(),
|
|
220
232
|
propsSummary: z.array(z.string()),
|
package/src/contract-parser.ts
CHANGED
|
@@ -21,6 +21,7 @@ export interface CompiledContractOutput {
|
|
|
21
21
|
category: string;
|
|
22
22
|
tags?: string[];
|
|
23
23
|
status?: 'stable' | 'beta' | 'deprecated' | 'experimental';
|
|
24
|
+
dependencies?: Array<{ name: string; version: string; reason?: string }>;
|
|
24
25
|
figma?: string;
|
|
25
26
|
figmaProps?: Record<string, unknown>;
|
|
26
27
|
};
|
|
@@ -112,6 +113,7 @@ export function parseComponentContract(
|
|
|
112
113
|
category: validated.category,
|
|
113
114
|
tags: validated.tags,
|
|
114
115
|
status: validated.status,
|
|
116
|
+
dependencies: validated.dependencies,
|
|
115
117
|
figma: validated.figma?.nodeUrl,
|
|
116
118
|
figmaProps: validated.figma?.propMappings as Record<string, unknown> | undefined,
|
|
117
119
|
},
|