shadcn 3.5.4-rc.4 → 3.6.0
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 +41 -41
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/schema/index.d.ts +126 -126
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ declare function getRegistry(name: string, options?: {
|
|
|
12
12
|
items: ({
|
|
13
13
|
type: "registry:base";
|
|
14
14
|
name: string;
|
|
15
|
-
$schema?: string | undefined;
|
|
16
15
|
tailwind?: {
|
|
17
16
|
config?: {
|
|
18
17
|
content?: string[] | undefined;
|
|
@@ -20,11 +19,8 @@ declare function getRegistry(name: string, options?: {
|
|
|
20
19
|
plugins?: string[] | undefined;
|
|
21
20
|
} | undefined;
|
|
22
21
|
} | undefined;
|
|
22
|
+
$schema?: string | undefined;
|
|
23
23
|
config?: {
|
|
24
|
-
$schema?: string | undefined;
|
|
25
|
-
style?: string | undefined;
|
|
26
|
-
rsc?: boolean | undefined;
|
|
27
|
-
tsx?: boolean | undefined;
|
|
28
24
|
tailwind?: {
|
|
29
25
|
config?: string | undefined;
|
|
30
26
|
css?: string | undefined;
|
|
@@ -32,13 +28,17 @@ declare function getRegistry(name: string, options?: {
|
|
|
32
28
|
cssVariables?: boolean | undefined;
|
|
33
29
|
prefix?: string | undefined;
|
|
34
30
|
} | undefined;
|
|
31
|
+
$schema?: string | undefined;
|
|
32
|
+
style?: string | undefined;
|
|
33
|
+
rsc?: boolean | undefined;
|
|
34
|
+
tsx?: boolean | undefined;
|
|
35
35
|
iconLibrary?: string | undefined;
|
|
36
36
|
menuColor?: "default" | "inverted" | undefined;
|
|
37
37
|
menuAccent?: "subtle" | "bold" | undefined;
|
|
38
38
|
aliases?: {
|
|
39
39
|
components?: string | undefined;
|
|
40
|
-
utils?: string | undefined;
|
|
41
40
|
ui?: string | undefined;
|
|
41
|
+
utils?: string | undefined;
|
|
42
42
|
lib?: string | undefined;
|
|
43
43
|
hooks?: string | undefined;
|
|
44
44
|
} | undefined;
|
|
@@ -87,7 +87,6 @@ declare function getRegistry(name: string, options?: {
|
|
|
87
87
|
weight?: string[] | undefined;
|
|
88
88
|
subsets?: string[] | undefined;
|
|
89
89
|
};
|
|
90
|
-
$schema?: string | undefined;
|
|
91
90
|
tailwind?: {
|
|
92
91
|
config?: {
|
|
93
92
|
content?: string[] | undefined;
|
|
@@ -95,6 +94,7 @@ declare function getRegistry(name: string, options?: {
|
|
|
95
94
|
plugins?: string[] | undefined;
|
|
96
95
|
} | undefined;
|
|
97
96
|
} | undefined;
|
|
97
|
+
$schema?: string | undefined;
|
|
98
98
|
css?: Record<string, any> | undefined;
|
|
99
99
|
extends?: string | undefined;
|
|
100
100
|
title?: string | undefined;
|
|
@@ -126,7 +126,6 @@ declare function getRegistry(name: string, options?: {
|
|
|
126
126
|
} | {
|
|
127
127
|
type: "registry:lib" | "registry:block" | "registry:component" | "registry:ui" | "registry:hook" | "registry:page" | "registry:file" | "registry:theme" | "registry:style" | "registry:item" | "registry:example" | "registry:internal";
|
|
128
128
|
name: string;
|
|
129
|
-
$schema?: string | undefined;
|
|
130
129
|
tailwind?: {
|
|
131
130
|
config?: {
|
|
132
131
|
content?: string[] | undefined;
|
|
@@ -134,6 +133,7 @@ declare function getRegistry(name: string, options?: {
|
|
|
134
133
|
plugins?: string[] | undefined;
|
|
135
134
|
} | undefined;
|
|
136
135
|
} | undefined;
|
|
136
|
+
$schema?: string | undefined;
|
|
137
137
|
css?: Record<string, any> | undefined;
|
|
138
138
|
extends?: string | undefined;
|
|
139
139
|
title?: string | undefined;
|
|
@@ -170,7 +170,6 @@ declare function getRegistryItems(items: string[], options?: {
|
|
|
170
170
|
}): Promise<({
|
|
171
171
|
type: "registry:base";
|
|
172
172
|
name: string;
|
|
173
|
-
$schema?: string | undefined;
|
|
174
173
|
tailwind?: {
|
|
175
174
|
config?: {
|
|
176
175
|
content?: string[] | undefined;
|
|
@@ -178,11 +177,8 @@ declare function getRegistryItems(items: string[], options?: {
|
|
|
178
177
|
plugins?: string[] | undefined;
|
|
179
178
|
} | undefined;
|
|
180
179
|
} | undefined;
|
|
180
|
+
$schema?: string | undefined;
|
|
181
181
|
config?: {
|
|
182
|
-
$schema?: string | undefined;
|
|
183
|
-
style?: string | undefined;
|
|
184
|
-
rsc?: boolean | undefined;
|
|
185
|
-
tsx?: boolean | undefined;
|
|
186
182
|
tailwind?: {
|
|
187
183
|
config?: string | undefined;
|
|
188
184
|
css?: string | undefined;
|
|
@@ -190,13 +186,17 @@ declare function getRegistryItems(items: string[], options?: {
|
|
|
190
186
|
cssVariables?: boolean | undefined;
|
|
191
187
|
prefix?: string | undefined;
|
|
192
188
|
} | undefined;
|
|
189
|
+
$schema?: string | undefined;
|
|
190
|
+
style?: string | undefined;
|
|
191
|
+
rsc?: boolean | undefined;
|
|
192
|
+
tsx?: boolean | undefined;
|
|
193
193
|
iconLibrary?: string | undefined;
|
|
194
194
|
menuColor?: "default" | "inverted" | undefined;
|
|
195
195
|
menuAccent?: "subtle" | "bold" | undefined;
|
|
196
196
|
aliases?: {
|
|
197
197
|
components?: string | undefined;
|
|
198
|
-
utils?: string | undefined;
|
|
199
198
|
ui?: string | undefined;
|
|
199
|
+
utils?: string | undefined;
|
|
200
200
|
lib?: string | undefined;
|
|
201
201
|
hooks?: string | undefined;
|
|
202
202
|
} | undefined;
|
|
@@ -245,7 +245,6 @@ declare function getRegistryItems(items: string[], options?: {
|
|
|
245
245
|
weight?: string[] | undefined;
|
|
246
246
|
subsets?: string[] | undefined;
|
|
247
247
|
};
|
|
248
|
-
$schema?: string | undefined;
|
|
249
248
|
tailwind?: {
|
|
250
249
|
config?: {
|
|
251
250
|
content?: string[] | undefined;
|
|
@@ -253,6 +252,7 @@ declare function getRegistryItems(items: string[], options?: {
|
|
|
253
252
|
plugins?: string[] | undefined;
|
|
254
253
|
} | undefined;
|
|
255
254
|
} | undefined;
|
|
255
|
+
$schema?: string | undefined;
|
|
256
256
|
css?: Record<string, any> | undefined;
|
|
257
257
|
extends?: string | undefined;
|
|
258
258
|
title?: string | undefined;
|
|
@@ -284,7 +284,6 @@ declare function getRegistryItems(items: string[], options?: {
|
|
|
284
284
|
} | {
|
|
285
285
|
type: "registry:lib" | "registry:block" | "registry:component" | "registry:ui" | "registry:hook" | "registry:page" | "registry:file" | "registry:theme" | "registry:style" | "registry:item" | "registry:example" | "registry:internal";
|
|
286
286
|
name: string;
|
|
287
|
-
$schema?: string | undefined;
|
|
288
287
|
tailwind?: {
|
|
289
288
|
config?: {
|
|
290
289
|
content?: string[] | undefined;
|
|
@@ -292,6 +291,7 @@ declare function getRegistryItems(items: string[], options?: {
|
|
|
292
291
|
plugins?: string[] | undefined;
|
|
293
292
|
} | undefined;
|
|
294
293
|
} | undefined;
|
|
294
|
+
$schema?: string | undefined;
|
|
295
295
|
css?: Record<string, any> | undefined;
|
|
296
296
|
extends?: string | undefined;
|
|
297
297
|
title?: string | undefined;
|
|
@@ -364,7 +364,6 @@ declare function resolveRegistryItems(items: string[], options?: {
|
|
|
364
364
|
weight?: string[] | undefined;
|
|
365
365
|
subsets?: string[] | undefined;
|
|
366
366
|
};
|
|
367
|
-
$schema?: string | undefined;
|
|
368
367
|
tailwind?: {
|
|
369
368
|
config?: {
|
|
370
369
|
content?: string[] | undefined;
|
|
@@ -372,6 +371,7 @@ declare function resolveRegistryItems(items: string[], options?: {
|
|
|
372
371
|
plugins?: string[] | undefined;
|
|
373
372
|
} | undefined;
|
|
374
373
|
} | undefined;
|
|
374
|
+
$schema?: string | undefined;
|
|
375
375
|
css?: Record<string, any> | undefined;
|
|
376
376
|
extends?: string | undefined;
|
|
377
377
|
title?: string | undefined;
|
|
@@ -414,7 +414,6 @@ declare function getRegistriesConfig(cwd: string, options?: {
|
|
|
414
414
|
declare function getShadcnRegistryIndex(): Promise<({
|
|
415
415
|
type: "registry:base";
|
|
416
416
|
name: string;
|
|
417
|
-
$schema?: string | undefined;
|
|
418
417
|
tailwind?: {
|
|
419
418
|
config?: {
|
|
420
419
|
content?: string[] | undefined;
|
|
@@ -422,11 +421,8 @@ declare function getShadcnRegistryIndex(): Promise<({
|
|
|
422
421
|
plugins?: string[] | undefined;
|
|
423
422
|
} | undefined;
|
|
424
423
|
} | undefined;
|
|
424
|
+
$schema?: string | undefined;
|
|
425
425
|
config?: {
|
|
426
|
-
$schema?: string | undefined;
|
|
427
|
-
style?: string | undefined;
|
|
428
|
-
rsc?: boolean | undefined;
|
|
429
|
-
tsx?: boolean | undefined;
|
|
430
426
|
tailwind?: {
|
|
431
427
|
config?: string | undefined;
|
|
432
428
|
css?: string | undefined;
|
|
@@ -434,13 +430,17 @@ declare function getShadcnRegistryIndex(): Promise<({
|
|
|
434
430
|
cssVariables?: boolean | undefined;
|
|
435
431
|
prefix?: string | undefined;
|
|
436
432
|
} | undefined;
|
|
433
|
+
$schema?: string | undefined;
|
|
434
|
+
style?: string | undefined;
|
|
435
|
+
rsc?: boolean | undefined;
|
|
436
|
+
tsx?: boolean | undefined;
|
|
437
437
|
iconLibrary?: string | undefined;
|
|
438
438
|
menuColor?: "default" | "inverted" | undefined;
|
|
439
439
|
menuAccent?: "subtle" | "bold" | undefined;
|
|
440
440
|
aliases?: {
|
|
441
441
|
components?: string | undefined;
|
|
442
|
-
utils?: string | undefined;
|
|
443
442
|
ui?: string | undefined;
|
|
443
|
+
utils?: string | undefined;
|
|
444
444
|
lib?: string | undefined;
|
|
445
445
|
hooks?: string | undefined;
|
|
446
446
|
} | undefined;
|
|
@@ -489,7 +489,6 @@ declare function getShadcnRegistryIndex(): Promise<({
|
|
|
489
489
|
weight?: string[] | undefined;
|
|
490
490
|
subsets?: string[] | undefined;
|
|
491
491
|
};
|
|
492
|
-
$schema?: string | undefined;
|
|
493
492
|
tailwind?: {
|
|
494
493
|
config?: {
|
|
495
494
|
content?: string[] | undefined;
|
|
@@ -497,6 +496,7 @@ declare function getShadcnRegistryIndex(): Promise<({
|
|
|
497
496
|
plugins?: string[] | undefined;
|
|
498
497
|
} | undefined;
|
|
499
498
|
} | undefined;
|
|
499
|
+
$schema?: string | undefined;
|
|
500
500
|
css?: Record<string, any> | undefined;
|
|
501
501
|
extends?: string | undefined;
|
|
502
502
|
title?: string | undefined;
|
|
@@ -528,7 +528,6 @@ declare function getShadcnRegistryIndex(): Promise<({
|
|
|
528
528
|
} | {
|
|
529
529
|
type: "registry:lib" | "registry:block" | "registry:component" | "registry:ui" | "registry:hook" | "registry:page" | "registry:file" | "registry:theme" | "registry:style" | "registry:item" | "registry:example" | "registry:internal";
|
|
530
530
|
name: string;
|
|
531
|
-
$schema?: string | undefined;
|
|
532
531
|
tailwind?: {
|
|
533
532
|
config?: {
|
|
534
533
|
content?: string[] | undefined;
|
|
@@ -536,6 +535,7 @@ declare function getShadcnRegistryIndex(): Promise<({
|
|
|
536
535
|
plugins?: string[] | undefined;
|
|
537
536
|
} | undefined;
|
|
538
537
|
} | undefined;
|
|
538
|
+
$schema?: string | undefined;
|
|
539
539
|
css?: Record<string, any> | undefined;
|
|
540
540
|
extends?: string | undefined;
|
|
541
541
|
title?: string | undefined;
|
|
@@ -610,7 +610,6 @@ declare function getRegistryBaseColor(baseColor: string): Promise<{
|
|
|
610
610
|
declare function resolveTree(index: z.infer<typeof registryIndexSchema>, names: string[]): Promise<({
|
|
611
611
|
type: "registry:base";
|
|
612
612
|
name: string;
|
|
613
|
-
$schema?: string | undefined;
|
|
614
613
|
tailwind?: {
|
|
615
614
|
config?: {
|
|
616
615
|
content?: string[] | undefined;
|
|
@@ -618,11 +617,8 @@ declare function resolveTree(index: z.infer<typeof registryIndexSchema>, names:
|
|
|
618
617
|
plugins?: string[] | undefined;
|
|
619
618
|
} | undefined;
|
|
620
619
|
} | undefined;
|
|
620
|
+
$schema?: string | undefined;
|
|
621
621
|
config?: {
|
|
622
|
-
$schema?: string | undefined;
|
|
623
|
-
style?: string | undefined;
|
|
624
|
-
rsc?: boolean | undefined;
|
|
625
|
-
tsx?: boolean | undefined;
|
|
626
622
|
tailwind?: {
|
|
627
623
|
config?: string | undefined;
|
|
628
624
|
css?: string | undefined;
|
|
@@ -630,13 +626,17 @@ declare function resolveTree(index: z.infer<typeof registryIndexSchema>, names:
|
|
|
630
626
|
cssVariables?: boolean | undefined;
|
|
631
627
|
prefix?: string | undefined;
|
|
632
628
|
} | undefined;
|
|
629
|
+
$schema?: string | undefined;
|
|
630
|
+
style?: string | undefined;
|
|
631
|
+
rsc?: boolean | undefined;
|
|
632
|
+
tsx?: boolean | undefined;
|
|
633
633
|
iconLibrary?: string | undefined;
|
|
634
634
|
menuColor?: "default" | "inverted" | undefined;
|
|
635
635
|
menuAccent?: "subtle" | "bold" | undefined;
|
|
636
636
|
aliases?: {
|
|
637
637
|
components?: string | undefined;
|
|
638
|
-
utils?: string | undefined;
|
|
639
638
|
ui?: string | undefined;
|
|
639
|
+
utils?: string | undefined;
|
|
640
640
|
lib?: string | undefined;
|
|
641
641
|
hooks?: string | undefined;
|
|
642
642
|
} | undefined;
|
|
@@ -685,7 +685,6 @@ declare function resolveTree(index: z.infer<typeof registryIndexSchema>, names:
|
|
|
685
685
|
weight?: string[] | undefined;
|
|
686
686
|
subsets?: string[] | undefined;
|
|
687
687
|
};
|
|
688
|
-
$schema?: string | undefined;
|
|
689
688
|
tailwind?: {
|
|
690
689
|
config?: {
|
|
691
690
|
content?: string[] | undefined;
|
|
@@ -693,6 +692,7 @@ declare function resolveTree(index: z.infer<typeof registryIndexSchema>, names:
|
|
|
693
692
|
plugins?: string[] | undefined;
|
|
694
693
|
} | undefined;
|
|
695
694
|
} | undefined;
|
|
695
|
+
$schema?: string | undefined;
|
|
696
696
|
css?: Record<string, any> | undefined;
|
|
697
697
|
extends?: string | undefined;
|
|
698
698
|
title?: string | undefined;
|
|
@@ -724,7 +724,6 @@ declare function resolveTree(index: z.infer<typeof registryIndexSchema>, names:
|
|
|
724
724
|
} | {
|
|
725
725
|
type: "registry:lib" | "registry:block" | "registry:component" | "registry:ui" | "registry:hook" | "registry:page" | "registry:file" | "registry:theme" | "registry:style" | "registry:item" | "registry:example" | "registry:internal";
|
|
726
726
|
name: string;
|
|
727
|
-
$schema?: string | undefined;
|
|
728
727
|
tailwind?: {
|
|
729
728
|
config?: {
|
|
730
729
|
content?: string[] | undefined;
|
|
@@ -732,6 +731,7 @@ declare function resolveTree(index: z.infer<typeof registryIndexSchema>, names:
|
|
|
732
731
|
plugins?: string[] | undefined;
|
|
733
732
|
} | undefined;
|
|
734
733
|
} | undefined;
|
|
734
|
+
$schema?: string | undefined;
|
|
735
735
|
css?: Record<string, any> | undefined;
|
|
736
736
|
extends?: string | undefined;
|
|
737
737
|
title?: string | undefined;
|
|
@@ -767,7 +767,6 @@ declare function resolveTree(index: z.infer<typeof registryIndexSchema>, names:
|
|
|
767
767
|
declare function fetchTree(style: string, tree: z.infer<typeof registryIndexSchema>): Promise<({
|
|
768
768
|
type: "registry:base";
|
|
769
769
|
name: string;
|
|
770
|
-
$schema?: string | undefined;
|
|
771
770
|
tailwind?: {
|
|
772
771
|
config?: {
|
|
773
772
|
content?: string[] | undefined;
|
|
@@ -775,11 +774,8 @@ declare function fetchTree(style: string, tree: z.infer<typeof registryIndexSche
|
|
|
775
774
|
plugins?: string[] | undefined;
|
|
776
775
|
} | undefined;
|
|
777
776
|
} | undefined;
|
|
777
|
+
$schema?: string | undefined;
|
|
778
778
|
config?: {
|
|
779
|
-
$schema?: string | undefined;
|
|
780
|
-
style?: string | undefined;
|
|
781
|
-
rsc?: boolean | undefined;
|
|
782
|
-
tsx?: boolean | undefined;
|
|
783
779
|
tailwind?: {
|
|
784
780
|
config?: string | undefined;
|
|
785
781
|
css?: string | undefined;
|
|
@@ -787,13 +783,17 @@ declare function fetchTree(style: string, tree: z.infer<typeof registryIndexSche
|
|
|
787
783
|
cssVariables?: boolean | undefined;
|
|
788
784
|
prefix?: string | undefined;
|
|
789
785
|
} | undefined;
|
|
786
|
+
$schema?: string | undefined;
|
|
787
|
+
style?: string | undefined;
|
|
788
|
+
rsc?: boolean | undefined;
|
|
789
|
+
tsx?: boolean | undefined;
|
|
790
790
|
iconLibrary?: string | undefined;
|
|
791
791
|
menuColor?: "default" | "inverted" | undefined;
|
|
792
792
|
menuAccent?: "subtle" | "bold" | undefined;
|
|
793
793
|
aliases?: {
|
|
794
794
|
components?: string | undefined;
|
|
795
|
-
utils?: string | undefined;
|
|
796
795
|
ui?: string | undefined;
|
|
796
|
+
utils?: string | undefined;
|
|
797
797
|
lib?: string | undefined;
|
|
798
798
|
hooks?: string | undefined;
|
|
799
799
|
} | undefined;
|
|
@@ -842,7 +842,6 @@ declare function fetchTree(style: string, tree: z.infer<typeof registryIndexSche
|
|
|
842
842
|
weight?: string[] | undefined;
|
|
843
843
|
subsets?: string[] | undefined;
|
|
844
844
|
};
|
|
845
|
-
$schema?: string | undefined;
|
|
846
845
|
tailwind?: {
|
|
847
846
|
config?: {
|
|
848
847
|
content?: string[] | undefined;
|
|
@@ -850,6 +849,7 @@ declare function fetchTree(style: string, tree: z.infer<typeof registryIndexSche
|
|
|
850
849
|
plugins?: string[] | undefined;
|
|
851
850
|
} | undefined;
|
|
852
851
|
} | undefined;
|
|
852
|
+
$schema?: string | undefined;
|
|
853
853
|
css?: Record<string, any> | undefined;
|
|
854
854
|
extends?: string | undefined;
|
|
855
855
|
title?: string | undefined;
|
|
@@ -881,7 +881,6 @@ declare function fetchTree(style: string, tree: z.infer<typeof registryIndexSche
|
|
|
881
881
|
} | {
|
|
882
882
|
type: "registry:lib" | "registry:block" | "registry:component" | "registry:ui" | "registry:hook" | "registry:page" | "registry:file" | "registry:theme" | "registry:style" | "registry:item" | "registry:example" | "registry:internal";
|
|
883
883
|
name: string;
|
|
884
|
-
$schema?: string | undefined;
|
|
885
884
|
tailwind?: {
|
|
886
885
|
config?: {
|
|
887
886
|
content?: string[] | undefined;
|
|
@@ -889,6 +888,7 @@ declare function fetchTree(style: string, tree: z.infer<typeof registryIndexSche
|
|
|
889
888
|
plugins?: string[] | undefined;
|
|
890
889
|
} | undefined;
|
|
891
890
|
} | undefined;
|
|
891
|
+
$schema?: string | undefined;
|
|
892
892
|
css?: Record<string, any> | undefined;
|
|
893
893
|
extends?: string | undefined;
|
|
894
894
|
title?: string | undefined;
|
package/dist/index.js
CHANGED
|
@@ -89,5 +89,5 @@ args = ["shadcn@${fe}", "mcp"]`),s.break(),s.info("3. Restart Codex to load the
|
|
|
89
89
|
`).map(x=>{if(x.trim().startsWith("import "))return x;let S=x;return S=S.replace(/\b(asChild\s*\?\s*)Slot(\s*:)/g,"$1__SLOT_PLACEHOLDER__$2"),S=S.replace(/\bReact\.ComponentProps<typeof\s+Slot>/g,"React.ComponentProps<typeof __SLOT_PLACEHOLDER__>"),S=S.replace(/\bComponentProps<typeof\s+Slot>/g,"ComponentProps<typeof __SLOT_PLACEHOLDER__>"),S=S.replace(/(<\/?)Slot(\s*\/?>)/g,"$1__SLOT_PLACEHOLDER__$2"),S=S.replace(/\bSlot\b/g,(M,F,X)=>{let A=X.substring(0,F),Le=(A.match(/"/g)||[]).length,Xr=(A.match(/'/g)||[]).length;return Le%2!==0||Xr%2!==0?M:"__SLOT_PLACEHOLDER__"}),S=S.replace(/__SLOT_PLACEHOLDER__/g,"SlotPrimitive.Slot"),S}).join(`
|
|
90
90
|
`));let g=Array.from(new Set(n));return {content:s,replacedPackages:g}}async function _r(e){let t={};if(!R.existsSync(e.cwd)||!R.existsSync(E__default.resolve(e.cwd,"package.json")))return t["1"]=true,{errors:t,config:null};if(!R.existsSync(E__default.resolve(e.cwd,"components.json")))return t["3"]=true,{errors:t,config:null};try{let r=await i(e.cwd);return {errors:t,config:r}}catch{s.break(),s.error(`An invalid ${d.info("components.json")} file was found at ${d.info(e.cwd)}.
|
|
91
91
|
Before you can run a migration, you must create a valid ${d.info("components.json")} file by running the ${d.info("init")} command.`),s.error(`Learn more at ${d.info("https://ui.shadcn.com/docs/components-json")}.`),s.break(),process.exit(1);}}var Lr=[{name:"icons",description:"migrate your ui components to a different icon library."},{name:"radix",description:"migrate to radix-ui."}],Kn=z$1.object({cwd:z$1.string(),list:z$1.boolean(),yes:z$1.boolean(),migration:z$1.string().refine(e=>e&&Lr.some(t=>t.name===e),{message:"You must specify a valid migration. Run `shadcn migrate --list` to see available migrations."}).optional()}),Vr=new Command().name("migrate").description("run a migration.").argument("[migration]","the migration to run.").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).option("-l, --list","list all migrations.",false).option("-y, --yes","skip confirmation prompt.",false).action(async(e,t)=>{try{let r=Kn.parse({cwd:E__default.resolve(t.cwd),migration:e,list:t.list,yes:t.yes});if(r.list||!r.migration){s.info("Available migrations:");for(let o of Lr)s.info(`- ${o.name}: ${o.description}`);return}if(!r.migration)throw new Error("You must specify a migration. Run `shadcn migrate --list` to see available migrations.");let{errors:i,config:n}=await _r(r);if(i["1"]||i["3"])throw new Error("No `components.json` file found. Ensure you are at the root of your project.");if(!n)throw new Error("Something went wrong reading your `components.json` file. Please ensure you have a valid `components.json` file.");r.migration==="icons"&&await Fr(n),r.migration==="radix"&&await Ar(n,{yes:r.yes});}catch(r){s.break(),N(r);}});async function Mr(e){let t={},r={cwd:e.cwd,registryFile:E__default.resolve(e.cwd,e.registryFile),outputDir:E__default.resolve(e.cwd,e.outputDir)};if(!R.existsSync(r.registryFile))return t["13"]=true,{errors:t,resolvePaths:null,config:null};if(!R.existsSync(E__default.resolve(e.cwd,"components.json")))return t["3"]=true,{errors:t,resolvePaths:null,config:null};await R.mkdir(r.outputDir,{recursive:true});try{let i$1=await i(e.cwd);return {errors:t,config:i$1,resolvePaths:r}}catch{s.break(),s.error(`An invalid ${d.info("components.json")} file was found at ${d.info(e.cwd)}.
|
|
92
|
-
Before you can build the registry, you must create a valid ${d.info("components.json")} file by running the ${d.info("init")} command.`),s.break(),process.exit(1);}}var Hn=z$1.object({cwd:z$1.string(),registryFile:z$1.string(),outputDir:z$1.string(),verbose:z$1.boolean().optional().default(false)}),Wr=new Command().name("registry:build").description("builds the registry [EXPERIMENTAL]").argument("[registry]","path to registry.json file","./registry.json").option("-o, --output <path>","destination directory for json files","./public/r").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).option("-v, --verbose","verbose output").action(async(e,t)=>{await Xn({cwd:E.resolve(t.cwd),registryFile:e,outputDir:t.output,verbose:t.verbose});});async function Xn(e){try{let t$1=Hn.parse(e),[{errors:r,resolvePaths:i,config:n},o$1]=await Promise.all([Mr(t$1),p(t$1.cwd)]);(r["3"]||!n||!o$1)&&(s.error(`A ${d.info("components.json")} file is required to build the registry. Run ${d.info("shadcn init")} to create one.`),s.break(),process.exit(1)),(r["13"]||!i)&&(s.error(`We could not find a registry file at ${d.info(E.resolve(t$1.cwd,t$1.registryFile))}.`),s.break(),process.exit(1));let a=await Y.readFile(i.registryFile,"utf-8"),s$1=o.safeParse(JSON.parse(a));s$1.success||(s.error(`Invalid registry file found at ${d.info(i.registryFile)}.`),s.break(),process.exit(1));let c=t("Building registry..."),m=await Qn(s$1.data,n,o$1);for(let l of m.items)l.files=l.files?.filter((p,u,g)=>u===g.findIndex(w=>w.path===p.path)),l.dependencies&&(l.dependencies=l.dependencies.filter((p,u,g)=>u===g.findIndex(w=>w===p)));for(let l of m.items){if(!l.files)continue;c.start(`Building ${l.name}...`),l.$schema="https://ui.shadcn.com/schema/registry-item.json";for(let u of l.files){let g=E.resolve(i.cwd,u.path);try{if(!(await Y.stat(g)).isFile())continue;u.content=await Y.readFile(g,"utf-8");}catch(w){console.error("Error reading file in registry build:",g,w);continue}}let p=n$1.safeParse(l);if(!p.success){s.error(`Invalid registry item found for ${d.info(l.name)}.`);continue}await Y.writeFile(E.resolve(i.outputDir,`${p.data.name}.json`),JSON.stringify(p.data,null,2));}if(await Y.copyFile(i.registryFile,E.resolve(i.outputDir,"registry.json")),c.succeed("Building registry."),t$1.verbose){t(`The registry has ${d.info(m.items.length.toString())} items:`).succeed();for(let l of m.items){s.log(` - ${l.name} (${d.info(l.type)})`);for(let p of l.files??[])s.log(` - ${p.path}`);}}}catch(t){s.break(),N(t);}}async function Qn(e,t,r){for(let i of e.items)if(i.files?.length)for(let n of i.files){let o=await A(n.path,t,r);o.files=o.files?.filter(a=>a.path!==n.path),o.files&&i.files.push(...o.files),o.dependencies&&(i.dependencies=i.dependencies?i.dependencies.concat(o.dependencies):o.dependencies);}return e}var zr=new Command().name("registry:mcp").description("starts the registry MCP server [DEPRECATED]").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).action(async()=>{s.warn(`The ${d.info("shadcn registry:mcp")} command is deprecated. Use the ${d.info("shadcn mcp")} command instead.`),s.break();});var to=z$1.object({cwd:z$1.string(),query:z$1.string().optional(),limit:z$1.number().optional(),offset:z$1.number().optional()}),Gr=new Command().name("search").alias("list").description("search items from registries").argument("<registries...>","the registry names or urls to search items from. Names must be prefixed with @.").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).option("-q, --query <query>","query string").option("-l, --limit <number>","maximum number of items to display per registry","100").option("-o, --offset <number>","number of items to skip","0").action(async(e,t)=>{try{let r=to.parse({cwd:E__default.resolve(t.cwd),query:t.query,limit:t.limit?parseInt(t.limit,10):void 0,offset:t.offset?parseInt(t.offset,10):void 0});await B(r.cwd);let i$1=n({style:"new-york",resolvedPaths:{cwd:r.cwd}}),n$1=D(i$1),o=E__default.resolve(r.cwd,"components.json");if(R.existsSync(o)){let l=await R.readJson(o),p=c.partial().parse(l);n$1=D({...i$1,...p});}let a=n$1;try{let l=await i(r.cwd);l&&(a=D(l));}catch{}let{config:s,newRegistries:c$1}=await T(e.map(l=>`${l}/registry`),a,{silent:!0,writeFile:!1});c$1.length>0&&(a.registries=s.registries),F(e,a);let m=await ba(e,{query:r.query,limit:r.limit,offset:r.offset,config:a});console.log(JSON.stringify(m,null,2)),process.exit(0);}catch(r){N(r);}finally{E$1();}});var io=z$1.object({cwd:z$1.string()}),qr=new Command().name("view").description("view items from the registry").argument("<items...>","the item names or URLs to view").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).action(async(e,t)=>{try{let r=io.parse({cwd:E__default.resolve(t.cwd)});await B(r.cwd);let i$1=D({}),n=E__default.resolve(r.cwd,"components.json");if(R.existsSync(n)){let m=await R.readJson(n),l=c.partial().parse(m);i$1=D(l);}let o=i$1;try{let m=await i(r.cwd);m&&(o=D(m));}catch{}let{config:a,newRegistries:s}=await T(e,o,{silent:!0,writeFile:!1});s.length>0&&(o.registries=a.registries),F(e,o);let c$1=await P(e,{config:o});console.log(JSON.stringify(c$1,null,2)),process.exit(0);}catch(r){N(r);}finally{E$1();}});var Hr={version:"3.
|
|
92
|
+
Before you can build the registry, you must create a valid ${d.info("components.json")} file by running the ${d.info("init")} command.`),s.break(),process.exit(1);}}var Hn=z$1.object({cwd:z$1.string(),registryFile:z$1.string(),outputDir:z$1.string(),verbose:z$1.boolean().optional().default(false)}),Wr=new Command().name("registry:build").description("builds the registry [EXPERIMENTAL]").argument("[registry]","path to registry.json file","./registry.json").option("-o, --output <path>","destination directory for json files","./public/r").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).option("-v, --verbose","verbose output").action(async(e,t)=>{await Xn({cwd:E.resolve(t.cwd),registryFile:e,outputDir:t.output,verbose:t.verbose});});async function Xn(e){try{let t$1=Hn.parse(e),[{errors:r,resolvePaths:i,config:n},o$1]=await Promise.all([Mr(t$1),p(t$1.cwd)]);(r["3"]||!n||!o$1)&&(s.error(`A ${d.info("components.json")} file is required to build the registry. Run ${d.info("shadcn init")} to create one.`),s.break(),process.exit(1)),(r["13"]||!i)&&(s.error(`We could not find a registry file at ${d.info(E.resolve(t$1.cwd,t$1.registryFile))}.`),s.break(),process.exit(1));let a=await Y.readFile(i.registryFile,"utf-8"),s$1=o.safeParse(JSON.parse(a));s$1.success||(s.error(`Invalid registry file found at ${d.info(i.registryFile)}.`),s.break(),process.exit(1));let c=t("Building registry..."),m=await Qn(s$1.data,n,o$1);for(let l of m.items)l.files=l.files?.filter((p,u,g)=>u===g.findIndex(w=>w.path===p.path)),l.dependencies&&(l.dependencies=l.dependencies.filter((p,u,g)=>u===g.findIndex(w=>w===p)));for(let l of m.items){if(!l.files)continue;c.start(`Building ${l.name}...`),l.$schema="https://ui.shadcn.com/schema/registry-item.json";for(let u of l.files){let g=E.resolve(i.cwd,u.path);try{if(!(await Y.stat(g)).isFile())continue;u.content=await Y.readFile(g,"utf-8");}catch(w){console.error("Error reading file in registry build:",g,w);continue}}let p=n$1.safeParse(l);if(!p.success){s.error(`Invalid registry item found for ${d.info(l.name)}.`);continue}await Y.writeFile(E.resolve(i.outputDir,`${p.data.name}.json`),JSON.stringify(p.data,null,2));}if(await Y.copyFile(i.registryFile,E.resolve(i.outputDir,"registry.json")),c.succeed("Building registry."),t$1.verbose){t(`The registry has ${d.info(m.items.length.toString())} items:`).succeed();for(let l of m.items){s.log(` - ${l.name} (${d.info(l.type)})`);for(let p of l.files??[])s.log(` - ${p.path}`);}}}catch(t){s.break(),N(t);}}async function Qn(e,t,r){for(let i of e.items)if(i.files?.length)for(let n of i.files){let o=await A(n.path,t,r);o.files=o.files?.filter(a=>a.path!==n.path),o.files&&i.files.push(...o.files),o.dependencies&&(i.dependencies=i.dependencies?i.dependencies.concat(o.dependencies):o.dependencies);}return e}var zr=new Command().name("registry:mcp").description("starts the registry MCP server [DEPRECATED]").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).action(async()=>{s.warn(`The ${d.info("shadcn registry:mcp")} command is deprecated. Use the ${d.info("shadcn mcp")} command instead.`),s.break();});var to=z$1.object({cwd:z$1.string(),query:z$1.string().optional(),limit:z$1.number().optional(),offset:z$1.number().optional()}),Gr=new Command().name("search").alias("list").description("search items from registries").argument("<registries...>","the registry names or urls to search items from. Names must be prefixed with @.").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).option("-q, --query <query>","query string").option("-l, --limit <number>","maximum number of items to display per registry","100").option("-o, --offset <number>","number of items to skip","0").action(async(e,t)=>{try{let r=to.parse({cwd:E__default.resolve(t.cwd),query:t.query,limit:t.limit?parseInt(t.limit,10):void 0,offset:t.offset?parseInt(t.offset,10):void 0});await B(r.cwd);let i$1=n({style:"new-york",resolvedPaths:{cwd:r.cwd}}),n$1=D(i$1),o=E__default.resolve(r.cwd,"components.json");if(R.existsSync(o)){let l=await R.readJson(o),p=c.partial().parse(l);n$1=D({...i$1,...p});}let a=n$1;try{let l=await i(r.cwd);l&&(a=D(l));}catch{}let{config:s,newRegistries:c$1}=await T(e.map(l=>`${l}/registry`),a,{silent:!0,writeFile:!1});c$1.length>0&&(a.registries=s.registries),F(e,a);let m=await ba(e,{query:r.query,limit:r.limit,offset:r.offset,config:a});console.log(JSON.stringify(m,null,2)),process.exit(0);}catch(r){N(r);}finally{E$1();}});var io=z$1.object({cwd:z$1.string()}),qr=new Command().name("view").description("view items from the registry").argument("<items...>","the item names or URLs to view").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).action(async(e,t)=>{try{let r=io.parse({cwd:E__default.resolve(t.cwd)});await B(r.cwd);let i$1=D({}),n=E__default.resolve(r.cwd,"components.json");if(R.existsSync(n)){let m=await R.readJson(n),l=c.partial().parse(m);i$1=D(l);}let o=i$1;try{let m=await i(r.cwd);m&&(o=D(m));}catch{}let{config:a,newRegistries:s}=await T(e,o,{silent:!0,writeFile:!1});s.length>0&&(o.registries=a.registries),F(e,o);let c$1=await P(e,{config:o});console.log(JSON.stringify(c$1,null,2)),process.exit(0);}catch(r){N(r);}finally{E$1();}});var Hr={version:"3.6.0"};process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));async function so(){let e=new Command().name("shadcn").description("add items from registries to your project").version(Hr.version,"-v, --version","display the version number");e.addCommand(pr).addCommand(Ir).addCommand(yr).addCommand(Er).addCommand(qr).addCommand(Gr).addCommand(Vr).addCommand(jr).addCommand(vr).addCommand(ft),e.addCommand(Wr).addCommand(zr),e.parse();}so();//# sourceMappingURL=index.js.map
|
|
93
93
|
//# sourceMappingURL=index.js.map
|