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
  f18844e7_09bc_0235_ac39_82d8fe0af50c["migrateContents()"]
  e39bed3f_bfbf_a8c6_90a0_aa2ce3be1ef4["migrate.ts"]
  f18844e7_09bc_0235_ac39_82d8fe0af50c -->|defined in| e39bed3f_bfbf_a8c6_90a0_aa2ce3be1ef4
  af7447ce_3295_6173_2897_ddd297a6bfb9["migrate()"]
  af7447ce_3295_6173_2897_ddd297a6bfb9 -->|calls| f18844e7_09bc_0235_ac39_82d8fe0af50c
  8b1ca68c_6690_d65e_cc71_429e9efe9dc5["extractRawCandidates()"]
  f18844e7_09bc_0235_ac39_82d8fe0af50c -->|calls| 8b1ca68c_6690_d65e_cc71_429e9efe9dc5
  66c57db2_afd7_9e7b_cea6_76cdb074b086["migrateCandidate()"]
  f18844e7_09bc_0235_ac39_82d8fe0af50c -->|calls| 66c57db2_afd7_9e7b_cea6_76cdb074b086
  e861d3a6_b533_683d_56f9_f09ab6c0d58e["spliceChangesIntoString()"]
  f18844e7_09bc_0235_ac39_82d8fe0af50c -->|calls| e861d3a6_b533_683d_56f9_f09ab6c0d58e
  style f18844e7_09bc_0235_ac39_82d8fe0af50c 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