Home / File/ transform.ts — ui Source File

transform.ts — ui Source File

Architecture documentation for transform.ts, a typescript file in the ui codebase. 4 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  b35e7ac9_4f0f_f678_f1a6_1e42325d5108["transform.ts"]
  20ad6f91_6d0b_ef0e_6867_01a114c31d1d["create-style-map.ts"]
  b35e7ac9_4f0f_f678_f1a6_1e42325d5108 --> 20ad6f91_6d0b_ef0e_6867_01a114c31d1d
  cef4e429_7112_fef5_ae0b_a838a57ccf71["transform-style-map.ts"]
  b35e7ac9_4f0f_f678_f1a6_1e42325d5108 --> cef4e429_7112_fef5_ae0b_a838a57ccf71
  69e29c3a_597d_3ecf_b7be_50b09c93f556["transformStyleMap"]
  b35e7ac9_4f0f_f678_f1a6_1e42325d5108 --> 69e29c3a_597d_3ecf_b7be_50b09c93f556
  4f6f7e78_23ff_4f5f_c723_474454f64c85["ts-morph"]
  b35e7ac9_4f0f_f678_f1a6_1e42325d5108 --> 4f6f7e78_23ff_4f5f_c723_474454f64c85
  style b35e7ac9_4f0f_f678_f1a6_1e42325d5108 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { Project, ScriptKind, type SourceFile } from "ts-morph"

import { type StyleMap } from "./create-style-map"
import { transformStyleMap } from "./transform-style-map"

export type TransformerStyle<Output = SourceFile> = (opts: {
  sourceFile: SourceFile
  styleMap: StyleMap
}) => Promise<Output>

export async function transformStyle(
  source: string,
  {
    styleMap,
    transformers = [transformStyleMap],
  }: {
    styleMap: StyleMap
    transformers?: TransformerStyle<SourceFile>[]
  }
) {
  const project = new Project({
    useInMemoryFileSystem: true,
  })

  const sourceFile = project.createSourceFile("component.tsx", source, {
    scriptKind: ScriptKind.TSX,
    overwrite: true,
  })

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

  return sourceFile.getText()
}

Subdomains

Frequently Asked Questions

What does transform.ts do?
transform.ts is a source file in the ui codebase, written in typescript. It belongs to the FrameworkTooling domain, TemplateSync subdomain.
What functions are defined in transform.ts?
transform.ts defines 2 function(s): opts, transformStyle.
What does transform.ts depend on?
transform.ts imports 4 module(s): create-style-map.ts, transform-style-map.ts, transformStyleMap, ts-morph.
Where is transform.ts in the architecture?
transform.ts is located at packages/shadcn/src/styles/transform.ts (domain: FrameworkTooling, subdomain: TemplateSync, directory: packages/shadcn/src/styles).

Analyze Your Own Codebase

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

Try Supermodel Free