Home / Function/ migrateContents() — tailwindcss Function Reference

migrateContents() — tailwindcss Function Reference

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

Function typescript OxideCore Extractor calls 3 called by 1

Entity Profile

Dependency Diagram

graph TD
  871e666f_c351_cfe2_299d_26df411fa6c5["migrateContents()"]
  49deb237_8387_627a_1b1d_a2683b818ef3["migrate()"]
  49deb237_8387_627a_1b1d_a2683b818ef3 -->|calls| 871e666f_c351_cfe2_299d_26df411fa6c5
  cf01f0e3_ef67_8b4b_af37_98cfc7983fba["extractRawCandidates()"]
  871e666f_c351_cfe2_299d_26df411fa6c5 -->|calls| cf01f0e3_ef67_8b4b_af37_98cfc7983fba
  a8567d3a_b9d2_a553_2828_a5a6b62364da["migrateCandidate()"]
  871e666f_c351_cfe2_299d_26df411fa6c5 -->|calls| a8567d3a_b9d2_a553_2828_a5a6b62364da
  6b927f2f_b400_6a29_35a5_dc81ebd77d62["spliceChangesIntoString()"]
  871e666f_c351_cfe2_299d_26df411fa6c5 -->|calls| 6b927f2f_b400_6a29_35a5_dc81ebd77d62
  style 871e666f_c351_cfe2_299d_26df411fa6c5 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)
}

Domain

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