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
  ce527735_1fae_b055_e843_536b6f3ab3a6["migrateCached()"]
  e39bed3f_bfbf_a8c6_90a0_aa2ce3be1ef4["migrate.ts"]
  ce527735_1fae_b055_e843_536b6f3ab3a6 -->|defined in| e39bed3f_bfbf_a8c6_90a0_aa2ce3be1ef4
  26169039_1fd2_e320_1f63_11ec10a6fc52["prepareDesignSystemStorage()"]
  ce527735_1fae_b055_e843_536b6f3ab3a6 -->|calls| 26169039_1fd2_e320_1f63_11ec10a6fc52
  4dc6b705_787e_a2cd_e871_d6f226448e19["createSignatureOptions()"]
  ce527735_1fae_b055_e843_536b6f3ab3a6 -->|calls| 4dc6b705_787e_a2cd_e871_d6f226448e19
  fc54d77f_8791_78d0_76a3_105cb9c395cf["canonicalizeCandidates()"]
  ce527735_1fae_b055_e843_536b6f3ab3a6 -->|calls| fc54d77f_8791_78d0_76a3_105cb9c395cf
  2820372c_b982_9e06_fc23_f8f4ac308d00["get()"]
  ce527735_1fae_b055_e843_536b6f3ab3a6 -->|calls| 2820372c_b982_9e06_fc23_f8f4ac308d00
  style ce527735_1fae_b055_e843_536b6f3ab3a6 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