File tree Expand file tree Collapse file tree 1 file changed +17
-8
lines changed
apps/registry/server/utils Expand file tree Collapse file tree 1 file changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,17 @@ function parseImportsFromCode(code: string): string[] {
8383 }
8484}
8585
86+ function extractRegistrySlug ( modulePath : string , basePath : string ) : string {
87+ if ( ! modulePath . startsWith ( basePath ) )
88+ return ''
89+
90+ const rest = modulePath . slice ( basePath . length )
91+ . split ( '/' )
92+ . filter ( Boolean )
93+
94+ return rest [ 0 ] || ''
95+ }
96+
8697function analyzeDependencies (
8798 imports : string [ ] ,
8899 allowedDeps : Set < string > ,
@@ -110,18 +121,16 @@ function analyzeDependencies(
110121
111122 // Handle shadcn-vue components
112123 if ( mod . startsWith ( '@/components/ui/' ) ) {
113- const componentName = mod . split ( '/' ) . pop ( ) || ''
114- if ( componentName ) {
115- registryDependencies . add ( componentName )
116- }
124+ const slug = extractRegistrySlug ( mod , '@/components/ui/' )
125+ if ( slug )
126+ registryDependencies . add ( slug )
117127 }
118128
119129 // Handle AI elements components
120130 if ( mod . startsWith ( '@/components/ai-elements/' ) ) {
121- const componentName = mod . split ( '/' ) . pop ( ) || ''
122- if ( componentName ) {
123- registryDependencies . add ( `/${ componentName } .json` )
124- }
131+ const slug = extractRegistrySlug ( mod , '@/components/ai-elements/' )
132+ if ( slug )
133+ registryDependencies . add ( slug )
125134 }
126135 }
127136
You can’t perform that action at this time.
0 commit comments