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
  66c57db2_afd7_9e7b_cea6_76cdb074b086["migrateCandidate()"]
  e39bed3f_bfbf_a8c6_90a0_aa2ce3be1ef4["migrate.ts"]
  66c57db2_afd7_9e7b_cea6_76cdb074b086 -->|defined in| e39bed3f_bfbf_a8c6_90a0_aa2ce3be1ef4
  6d8d6d7e_6e94_511f_8419_616e12ba69b8["migrateAtApply()"]
  6d8d6d7e_6e94_511f_8419_616e12ba69b8 -->|calls| 66c57db2_afd7_9e7b_cea6_76cdb074b086
  f18844e7_09bc_0235_ac39_82d8fe0af50c["migrateContents()"]
  f18844e7_09bc_0235_ac39_82d8fe0af50c -->|calls| 66c57db2_afd7_9e7b_cea6_76cdb074b086
  b779d35b_89d6_7939_9231_39f9aa250ab3["isSafeMigration()"]
  66c57db2_afd7_9e7b_cea6_76cdb074b086 -->|calls| b779d35b_89d6_7939_9231_39f9aa250ab3
  2820372c_b982_9e06_fc23_f8f4ac308d00["get()"]
  66c57db2_afd7_9e7b_cea6_76cdb074b086 -->|calls| 2820372c_b982_9e06_fc23_f8f4ac308d00
  style 66c57db2_afd7_9e7b_cea6_76cdb074b086 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, defined in packages/@tailwindcss-upgrade/src/codemods/template/migrate.ts.
Where is migrateCandidate() defined?
migrateCandidate() is defined in packages/@tailwindcss-upgrade/src/codemods/template/migrate.ts at line 72.
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