Home / Function/ migrateCandidate() — tailwindcss Function Reference

migrateCandidate() — tailwindcss Function Reference

Architecture documentation for the migrateCandidate() function in migrate.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  cfb6acb7_b44a_cb88_3d14_926fd4e357da["migrateCandidate()"]
  03d4ca08_7ec2_689c_47d8_1be20f931aa5["migrateAtApply()"]
  03d4ca08_7ec2_689c_47d8_1be20f931aa5 -->|calls| cfb6acb7_b44a_cb88_3d14_926fd4e357da
  079e0035_1ce3_3d9d_3017_71b47a7375a1["migrateContents()"]
  079e0035_1ce3_3d9d_3017_71b47a7375a1 -->|calls| cfb6acb7_b44a_cb88_3d14_926fd4e357da
  15780a15_d07b_4940_2fae_2b625b686371["isSafeMigration()"]
  cfb6acb7_b44a_cb88_3d14_926fd4e357da -->|calls| 15780a15_d07b_4940_2fae_2b625b686371
  4cd99e59_ac1e_2a1f_0946_33cc1afd2532["get()"]
  cfb6acb7_b44a_cb88_3d14_926fd4e357da -->|calls| 4cd99e59_ac1e_2a1f_0946_33cc1afd2532
  style cfb6acb7_b44a_cb88_3d14_926fd4e357da fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/@tailwindcss-upgrade/src/codemods/template/migrate.ts lines 72–89

export async function migrateCandidate(
  designSystem: DesignSystem,
  userConfig: Config | null,
  rawCandidate: string,
  // Location is only set when migrating a candidate from a source file
  location?: {
    contents: string
    start: number
    end: number
  },
): Promise<string> {
  // Skip this migration if we think that the migration is unsafe
  if (location && !isSafeMigration(rawCandidate, location, designSystem)) {
    return rawCandidate
  }

  return migrateCached.get(designSystem).get(userConfig).get(rawCandidate)
}

Subdomains

Frequently Asked Questions

What does migrateCandidate() do?
migrateCandidate() is a function in the tailwindcss codebase.
What does migrateCandidate() call?
migrateCandidate() calls 2 function(s): get, isSafeMigration.
What calls migrateCandidate()?
migrateCandidate() is called by 2 function(s): migrateAtApply, migrateContents.

Analyze Your Own Codebase

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

Try Supermodel Free