Home / Function/ migrateCached() — tailwindcss Function Reference

migrateCached() — tailwindcss Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  b03e5261_3989_5eb9_7d45_392073ad41fd["migrateCached()"]
  20406e7c_6ee8_4626_dbef_5b37708f4d30["prepareDesignSystemStorage()"]
  b03e5261_3989_5eb9_7d45_392073ad41fd -->|calls| 20406e7c_6ee8_4626_dbef_5b37708f4d30
  4f8241bf_79d2_9225_23f3_34c8a7157609["createSignatureOptions()"]
  b03e5261_3989_5eb9_7d45_392073ad41fd -->|calls| 4f8241bf_79d2_9225_23f3_34c8a7157609
  0c93fc33_6ff1_7638_3219_621fdee3ade6["canonicalizeCandidates()"]
  b03e5261_3989_5eb9_7d45_392073ad41fd -->|calls| 0c93fc33_6ff1_7638_3219_621fdee3ade6
  4cd99e59_ac1e_2a1f_0946_33cc1afd2532["get()"]
  b03e5261_3989_5eb9_7d45_392073ad41fd -->|calls| 4cd99e59_ac1e_2a1f_0946_33cc1afd2532
  style b03e5261_3989_5eb9_7d45_392073ad41fd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/@tailwindcss-upgrade/src/codemods/template/migrate.ts lines 46–70

let migrateCached = new DefaultMap((baseDesignSystem: DesignSystem) => {
  let designSystem = prepareDesignSystemStorage(baseDesignSystem)
  let options = createSignatureOptions(designSystem)

  return new DefaultMap((userConfig: Config | null) => {
    return new DefaultMap(async (rawCandidate) => {
      let original = rawCandidate

      for (let migration of DEFAULT_MIGRATIONS) {
        rawCandidate = await migration(designSystem, userConfig, rawCandidate)
      }

      // Canonicalize the final migrated candidate to its final form
      rawCandidate = designSystem.canonicalizeCandidates([rawCandidate]).pop()!

      // Verify that the candidate actually makes sense at all. E.g.: `duration`
      // is not a valid candidate, but it will parse because `duration-<number>`
      // exists.
      let signature = designSystem.storage[UTILITY_SIGNATURE_KEY].get(options).get(rawCandidate)
      if (typeof signature !== 'string') return original

      return rawCandidate
    })
  })
})

Subdomains

Frequently Asked Questions

What does migrateCached() do?
migrateCached() is a function in the tailwindcss codebase.
What does migrateCached() call?
migrateCached() calls 4 function(s): canonicalizeCandidates, createSignatureOptions, get, prepareDesignSystemStorage.

Analyze Your Own Codebase

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

Try Supermodel Free