Home / Function/ transform() — ui Function Reference

transform() — ui Function Reference

Architecture documentation for the transform() function in index.ts from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  7d044675_0040_220b_aa9c_215286f03b0a["transform()"]
  646bd874_990a_e30f_0d03_073229dd52ad["index.ts"]
  7d044675_0040_220b_aa9c_215286f03b0a -->|defined in| 646bd874_990a_e30f_0d03_073229dd52ad
  93077ff8_bc63_c96c_f291_3382a5913b8c["createTempSourceFile()"]
  7d044675_0040_220b_aa9c_215286f03b0a -->|calls| 93077ff8_bc63_c96c_f291_3382a5913b8c
  style 7d044675_0040_220b_aa9c_215286f03b0a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/shadcn/src/utils/transformers/index.ts lines 42–71

export async function transform(
  opts: TransformOpts,
  transformers: Transformer[] = [
    transformImport,
    transformRsc,
    transformCssVars,
    transformTwPrefixes,
    transformRtl,
    transformIcons,
    transformCleanup,
  ]
) {
  const tempFile = await createTempSourceFile(opts.filename)
  const sourceFile = project.createSourceFile(tempFile, opts.raw, {
    scriptKind: ScriptKind.TSX,
  })

  for (const transformer of transformers) {
    await transformer({ sourceFile, ...opts })
  }

  if (opts.transformJsx) {
    return await transformJsx({
      sourceFile,
      ...opts,
    })
  }

  return sourceFile.getText()
}

Subdomains

Frequently Asked Questions

What does transform() do?
transform() is a function in the ui codebase, defined in packages/shadcn/src/utils/transformers/index.ts.
Where is transform() defined?
transform() is defined in packages/shadcn/src/utils/transformers/index.ts at line 42.
What does transform() call?
transform() calls 1 function(s): createTempSourceFile.

Analyze Your Own Codebase

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

Try Supermodel Free