Home / Function/ createFileTreeForRegistryItemFiles() — ui Function Reference

createFileTreeForRegistryItemFiles() — ui Function Reference

Architecture documentation for the createFileTreeForRegistryItemFiles() function in registry.ts from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  66e17374_666f_f72b_11a6_bd07454cf92a["createFileTreeForRegistryItemFiles()"]
  c2827044_b928_a1b2_3033_3282c0588350["registry.ts"]
  66e17374_666f_f72b_11a6_bd07454cf92a -->|defined in| c2827044_b928_a1b2_3033_3282c0588350
  style 66e17374_666f_f72b_11a6_bd07454cf92a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

deprecated/www/lib/registry.ts lines 236–274

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
}

Subdomains

Frequently Asked Questions

What does createFileTreeForRegistryItemFiles() do?
createFileTreeForRegistryItemFiles() is a function in the ui codebase, defined in deprecated/www/lib/registry.ts.
Where is createFileTreeForRegistryItemFiles() defined?
createFileTreeForRegistryItemFiles() is defined in deprecated/www/lib/registry.ts at line 236.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free