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
  c80497ee_3abb_7410_a35b_842038c6a0af["migrateCached()"]
  207ada18_60f2_10b9_7c9e_99bdb32f4ed7["prepareDesignSystemStorage()"]
  c80497ee_3abb_7410_a35b_842038c6a0af -->|calls| 207ada18_60f2_10b9_7c9e_99bdb32f4ed7
  a36abaf5_b2bc_57c5_1398_dffcc9edbd56["createSignatureOptions()"]
  c80497ee_3abb_7410_a35b_842038c6a0af -->|calls| a36abaf5_b2bc_57c5_1398_dffcc9edbd56
  74a4389f_06f5_9213_9ee9_31f7f355cad8["canonicalizeCandidates()"]
  c80497ee_3abb_7410_a35b_842038c6a0af -->|calls| 74a4389f_06f5_9213_9ee9_31f7f355cad8
  0aa64a1c_efd8_a69d_48ed_649b7a86c854["get()"]
  c80497ee_3abb_7410_a35b_842038c6a0af -->|calls| 0aa64a1c_efd8_a69d_48ed_649b7a86c854
  style c80497ee_3abb_7410_a35b_842038c6a0af 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
    })
  })
})

Domain

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