Home / Function/ fixImport() — ui Function Reference

fixImport() — ui Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  0fa50f6a_094e_5135_c598_8c14721a1d3f["fixImport()"]
  a2cd9f1d_8dbe_d488_4209_1dbd8f522cc1["registry.ts"]
  0fa50f6a_094e_5135_c598_8c14721a1d3f -->|defined in| a2cd9f1d_8dbe_d488_4209_1dbd8f522cc1
  c743b8aa_a35c_4c96_c711_c91af6b33fba["getFileContent()"]
  c743b8aa_a35c_4c96_c711_c91af6b33fba -->|calls| 0fa50f6a_094e_5135_c598_8c14721a1d3f
  style 0fa50f6a_094e_5135_c598_8c14721a1d3f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/lib/registry.ts lines 233–256

export function fixImport(content: string) {
  const regex = /@\/(.+?)\/((?:.*?\/)?(?:components|ui|hooks|lib))\/([\w-]+)/g

  const replacement = (
    match: string,
    path: string,
    type: string,
    component: string
  ) => {
    if (type.endsWith("components")) {
      return `@/components/${component}`
    } else if (type.endsWith("ui")) {
      return `@/components/ui/${component}`
    } else if (type.endsWith("hooks")) {
      return `@/hooks/${component}`
    } else if (type.endsWith("lib")) {
      return `@/lib/${component}`
    }

    return match
  }

  return content.replace(regex, replacement)
}

Subdomains

Called By

Frequently Asked Questions

What does fixImport() do?
fixImport() is a function in the ui codebase, defined in apps/v4/lib/registry.ts.
Where is fixImport() defined?
fixImport() is defined in apps/v4/lib/registry.ts at line 233.
What calls fixImport()?
fixImport() is called by 1 function(s): getFileContent.

Analyze Your Own Codebase

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

Try Supermodel Free