createFileTreeForRegistryItemFiles() — ui Function Reference
Architecture documentation for the createFileTreeForRegistryItemFiles() function in registry.ts from the ui codebase.
Entity Profile
Dependency Diagram
graph TD 526a991f_087f_75e4_6522_19615f7a72ed["createFileTreeForRegistryItemFiles()"] a2cd9f1d_8dbe_d488_4209_1dbd8f522cc1["registry.ts"] 526a991f_087f_75e4_6522_19615f7a72ed -->|defined in| a2cd9f1d_8dbe_d488_4209_1dbd8f522cc1 style 526a991f_087f_75e4_6522_19615f7a72ed fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/v4/lib/registry.ts lines 264–302
export function createFileTreeForRegistryItemFiles(
files: Array<{ path: string; target?: string }>
) {
const root: FileTree[] = []
for (const file of files) {
const path = file.target ?? file.path
const parts = path.split("/")
let currentLevel = root
for (let i = 0; i < parts.length; i++) {
const part = parts[i]
const isFile = i === parts.length - 1
const existingNode = currentLevel.find((node) => node.name === part)
if (existingNode) {
if (isFile) {
// Update existing file node with full path
existingNode.path = path
} else {
// Move to next level in the tree
currentLevel = existingNode.children!
}
} else {
const newNode: FileTree = isFile
? { name: part, path }
: { name: part, children: [] }
currentLevel.push(newNode)
if (!isFile) {
currentLevel = newNode.children!
}
}
}
}
return root
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does createFileTreeForRegistryItemFiles() do?
createFileTreeForRegistryItemFiles() is a function in the ui codebase, defined in apps/v4/lib/registry.ts.
Where is createFileTreeForRegistryItemFiles() defined?
createFileTreeForRegistryItemFiles() is defined in apps/v4/lib/registry.ts at line 264.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free