Home / Function/ migrateContents() — tailwindcss Function Reference

migrateContents() — tailwindcss Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  079e0035_1ce3_3d9d_3017_71b47a7375a1["migrateContents()"]
  a6633139_ebc1_9ae0_25b2_81b98419e559["migrate()"]
  a6633139_ebc1_9ae0_25b2_81b98419e559 -->|calls| 079e0035_1ce3_3d9d_3017_71b47a7375a1
  32321edd_136f_72af_2493_29416c9351fa["extractRawCandidates()"]
  079e0035_1ce3_3d9d_3017_71b47a7375a1 -->|calls| 32321edd_136f_72af_2493_29416c9351fa
  cfb6acb7_b44a_cb88_3d14_926fd4e357da["migrateCandidate()"]
  079e0035_1ce3_3d9d_3017_71b47a7375a1 -->|calls| cfb6acb7_b44a_cb88_3d14_926fd4e357da
  c36514d1_be3d_c915_4996_66befada0375["spliceChangesIntoString()"]
  079e0035_1ce3_3d9d_3017_71b47a7375a1 -->|calls| c36514d1_be3d_c915_4996_66befada0375
  style 079e0035_1ce3_3d9d_3017_71b47a7375a1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/@tailwindcss-upgrade/src/codemods/template/migrate.ts lines 91–120

export default async function migrateContents(
  designSystem: DesignSystem,
  userConfig: Config | null,
  contents: string,
  extension: string,
): Promise<string> {
  let candidates = await extractRawCandidates(contents, extension)

  let changes: StringChange[] = []

  for (let { rawCandidate, start, end } of candidates) {
    let migratedCandidate = await migrateCandidate(designSystem, userConfig, rawCandidate, {
      contents,
      start,
      end,
    })

    if (migratedCandidate === rawCandidate) {
      continue
    }

    changes.push({
      start,
      end,
      replacement: migratedCandidate,
    })
  }

  return spliceChangesIntoString(contents, changes)
}

Subdomains

Called By

Frequently Asked Questions

What does migrateContents() do?
migrateContents() is a function in the tailwindcss codebase.
What does migrateContents() call?
migrateContents() calls 3 function(s): extractRawCandidates, migrateCandidate, spliceChangesIntoString.
What calls migrateContents()?
migrateContents() is called by 1 function(s): migrate.

Analyze Your Own Codebase

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

Try Supermodel Free