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
  925f824e_7de6_8274_5146_0e23e9481728["migrateCached()"]
  75ba60a9_2614_1c57_ad40_3663d4315f3b["migrate.ts"]
  925f824e_7de6_8274_5146_0e23e9481728 -->|defined in| 75ba60a9_2614_1c57_ad40_3663d4315f3b
  81ec8f98_1fb2_d7c3_dd65_3a9e51b3be39["prepareDesignSystemStorage()"]
  925f824e_7de6_8274_5146_0e23e9481728 -->|calls| 81ec8f98_1fb2_d7c3_dd65_3a9e51b3be39
  d8e28189_3751_77bd_c810_1cd9c626b480["createSignatureOptions()"]
  925f824e_7de6_8274_5146_0e23e9481728 -->|calls| d8e28189_3751_77bd_c810_1cd9c626b480
  e4f6e1fd_7086_5c1c_46c8_96f3c90e6782["canonicalizeCandidates()"]
  925f824e_7de6_8274_5146_0e23e9481728 -->|calls| e4f6e1fd_7086_5c1c_46c8_96f3c90e6782
  5bcf4886_1230_a8ff_7302_a26cc5a9a525["get()"]
  925f824e_7de6_8274_5146_0e23e9481728 -->|calls| 5bcf4886_1230_a8ff_7302_a26cc5a9a525
  style 925f824e_7de6_8274_5146_0e23e9481728 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, defined in packages/@tailwindcss-upgrade/src/codemods/template/migrate.ts.
Where is migrateCached() defined?
migrateCached() is defined in packages/@tailwindcss-upgrade/src/codemods/template/migrate.ts at line 46.
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