getRegistry() — ui Function Reference
Architecture documentation for the getRegistry() function in api.ts from the ui codebase.
Entity Profile
Dependency Diagram
graph TD 95834bbc_689d_8b36_7d45_d37bbccd3517["getRegistry()"] c41eed12_c415_48c8_bcf4_9d09d3424a18["api.ts"] 95834bbc_689d_8b36_7d45_d37bbccd3517 -->|defined in| c41eed12_c415_48c8_bcf4_9d09d3424a18 e6f35579_6ae8_ff1e_5451_66a5bfd635b0["searchRegistries()"] e6f35579_6ae8_ff1e_5451_66a5bfd635b0 -->|calls| 95834bbc_689d_8b36_7d45_d37bbccd3517 style 95834bbc_689d_8b36_7d45_d37bbccd3517 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/shadcn/src/registry/api.ts lines 43–92
export async function getRegistry(
name: string,
options?: {
config?: Partial<Config>
useCache?: boolean
}
) {
const { config, useCache } = options || {}
if (isUrl(name)) {
const [result] = await fetchRegistry([name], { useCache })
try {
return registrySchema.parse(result)
} catch (error) {
throw new RegistryParseError(name, error)
}
}
if (!name.startsWith("@")) {
throw new RegistryInvalidNamespaceError(name)
}
let registryName = name
if (!registryName.endsWith("/registry")) {
registryName = `${registryName}/registry`
}
const urlAndHeaders = buildUrlAndHeadersForRegistryItem(
registryName as `@${string}`,
configWithDefaults(config)
)
if (!urlAndHeaders?.url) {
throw new RegistryNotFoundError(registryName)
}
if (urlAndHeaders.headers && Object.keys(urlAndHeaders.headers).length > 0) {
setRegistryHeaders({
[urlAndHeaders.url]: urlAndHeaders.headers,
})
}
const [result] = await fetchRegistry([urlAndHeaders.url], { useCache })
try {
return registrySchema.parse(result)
} catch (error) {
throw new RegistryParseError(registryName, error)
}
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does getRegistry() do?
getRegistry() is a function in the ui codebase, defined in packages/shadcn/src/registry/api.ts.
Where is getRegistry() defined?
getRegistry() is defined in packages/shadcn/src/registry/api.ts at line 43.
What calls getRegistry()?
getRegistry() is called by 1 function(s): searchRegistries.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free