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
  703e6e29_4a38_d9ee_1f63_d1fcb0267d54["fixImport()"]
  c2827044_b928_a1b2_3033_3282c0588350["registry.ts"]
  703e6e29_4a38_d9ee_1f63_d1fcb0267d54 -->|defined in| c2827044_b928_a1b2_3033_3282c0588350
  40a8af4b_5790_4349_e8f7_061bc4fd234c["getFileContent()"]
  40a8af4b_5790_4349_e8f7_061bc4fd234c -->|calls| 703e6e29_4a38_d9ee_1f63_d1fcb0267d54
  style 703e6e29_4a38_d9ee_1f63_d1fcb0267d54 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

deprecated/www/lib/registry.ts lines 205–228

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 deprecated/www/lib/registry.ts.
Where is fixImport() defined?
fixImport() is defined in deprecated/www/lib/registry.ts at line 205.
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