fetchRegistryLocal() — ui Function Reference
Architecture documentation for the fetchRegistryLocal() function in fetcher.ts from the ui codebase.
Entity Profile
Dependency Diagram
graph TD e4d9f68e_0586_f1b4_3f6c_469fa01a8a57["fetchRegistryLocal()"] 16316120_c278_1dd6_844b_6f1683d22437["fetcher.ts"] e4d9f68e_0586_f1b4_3f6c_469fa01a8a57 -->|defined in| 16316120_c278_1dd6_844b_6f1683d22437 style e4d9f68e_0586_f1b4_3f6c_469fa01a8a57 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/shadcn/src/registry/fetcher.ts lines 123–156
export async function fetchRegistryLocal(filePath: string) {
try {
// Handle tilde expansion for home directory
let expandedPath = filePath
if (filePath.startsWith("~/")) {
expandedPath = path.join(homedir(), filePath.slice(2))
}
const resolvedPath = path.resolve(expandedPath)
const content = await fs.readFile(resolvedPath, "utf8")
const parsed = JSON.parse(content)
try {
return registryItemSchema.parse(parsed)
} catch (error) {
throw new RegistryParseError(filePath, error)
}
} catch (error) {
// Check if this is a file not found error
if (
error instanceof Error &&
(error.message.includes("ENOENT") ||
error.message.includes("no such file"))
) {
throw new RegistryLocalFileError(filePath, error)
}
// Re-throw parse errors as-is
if (error instanceof RegistryParseError) {
throw error
}
// For other errors (like JSON parse errors), throw as local file error
throw new RegistryLocalFileError(filePath, error)
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does fetchRegistryLocal() do?
fetchRegistryLocal() is a function in the ui codebase, defined in packages/shadcn/src/registry/fetcher.ts.
Where is fetchRegistryLocal() defined?
fetchRegistryLocal() is defined in packages/shadcn/src/registry/fetcher.ts at line 123.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free