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
  404037a5_0bed_880c_5e9a_954d7ffbf6d7["migrateContents()"]
  75ba60a9_2614_1c57_ad40_3663d4315f3b["migrate.ts"]
  404037a5_0bed_880c_5e9a_954d7ffbf6d7 -->|defined in| 75ba60a9_2614_1c57_ad40_3663d4315f3b
  046679c3_bf1c_c3e5_7a64_9181e0909da0["migrate()"]
  046679c3_bf1c_c3e5_7a64_9181e0909da0 -->|calls| 404037a5_0bed_880c_5e9a_954d7ffbf6d7
  f2c36345_eddf_1720_9a42_e1a49f2c7132["extractRawCandidates()"]
  404037a5_0bed_880c_5e9a_954d7ffbf6d7 -->|calls| f2c36345_eddf_1720_9a42_e1a49f2c7132
  8408bbf2_f1a4_0668_26f9_b4cdef678388["migrateCandidate()"]
  404037a5_0bed_880c_5e9a_954d7ffbf6d7 -->|calls| 8408bbf2_f1a4_0668_26f9_b4cdef678388
  0ad23c56_9291_b80b_7e43_b919fbc7087f["spliceChangesIntoString()"]
  404037a5_0bed_880c_5e9a_954d7ffbf6d7 -->|calls| 0ad23c56_9291_b80b_7e43_b919fbc7087f
  style 404037a5_0bed_880c_5e9a_954d7ffbf6d7 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, defined in packages/@tailwindcss-upgrade/src/codemods/template/migrate.ts.
Where is migrateContents() defined?
migrateContents() is defined in packages/@tailwindcss-upgrade/src/codemods/template/migrate.ts at line 91.
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