getDependencyFromModuleSpecifier() — ui Function Reference
Architecture documentation for the getDependencyFromModuleSpecifier() function in utils.ts from the ui codebase.
Entity Profile
Dependency Diagram
graph TD 79799d76_cdb2_3542_2249_0f44998edeea["getDependencyFromModuleSpecifier()"] edc2979a_e040_ab0c_5174_c69f7c8fa905["utils.ts"] 79799d76_cdb2_3542_2249_0f44998edeea -->|defined in| edc2979a_e040_ab0c_5174_c69f7c8fa905 1c6f4236_a28d_b482_92b7_3da2a29a6be9["recursivelyResolveFileImports()"] 1c6f4236_a28d_b482_92b7_3da2a29a6be9 -->|calls| 79799d76_cdb2_3542_2249_0f44998edeea style 79799d76_cdb2_3542_2249_0f44998edeea fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/shadcn/src/registry/utils.ts lines 33–57
export function getDependencyFromModuleSpecifier(
moduleSpecifier: string
): string | null {
// Skip if the dependency matches any pattern in the skip list
if (DEPENDENCY_SKIP_LIST.some((pattern) => pattern.test(moduleSpecifier))) {
return null
}
// If the module specifier does not start with `@` and has a /, add the dependency first part only.
// E.g. `foo/bar` -> `foo`
if (!moduleSpecifier.startsWith("@") && moduleSpecifier.includes("/")) {
moduleSpecifier = moduleSpecifier.split("/")[0]
}
// For scoped packages, we want to keep the first two parts
// E.g. `@types/react/dom` -> `@types/react`
if (moduleSpecifier.startsWith("@")) {
const parts = moduleSpecifier.split("/")
if (parts.length > 2) {
moduleSpecifier = parts.slice(0, 2).join("/")
}
}
return moduleSpecifier
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does getDependencyFromModuleSpecifier() do?
getDependencyFromModuleSpecifier() is a function in the ui codebase, defined in packages/shadcn/src/registry/utils.ts.
Where is getDependencyFromModuleSpecifier() defined?
getDependencyFromModuleSpecifier() is defined in packages/shadcn/src/registry/utils.ts at line 33.
What calls getDependencyFromModuleSpecifier()?
getDependencyFromModuleSpecifier() is called by 1 function(s): recursivelyResolveFileImports.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free