Home / Function/ createPreComputedVariantsCache() — tailwindcss Function Reference

createPreComputedVariantsCache() — tailwindcss Function Reference

Architecture documentation for the createPreComputedVariantsCache() function in canonicalize-candidates.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  8c5582ba_aaf8_a292_b77c_aba1d1c33ab5["createPreComputedVariantsCache()"]
  20406e7c_6ee8_4626_dbef_5b37708f4d30["prepareDesignSystemStorage()"]
  20406e7c_6ee8_4626_dbef_5b37708f4d30 -->|calls| 8c5582ba_aaf8_a292_b77c_aba1d1c33ab5
  92969a3b_d253_e151_139a_8e2f44014af0["entries()"]
  8c5582ba_aaf8_a292_b77c_aba1d1c33ab5 -->|calls| 92969a3b_d253_e151_139a_8e2f44014af0
  4cd99e59_ac1e_2a1f_0946_33cc1afd2532["get()"]
  8c5582ba_aaf8_a292_b77c_aba1d1c33ab5 -->|calls| 4cd99e59_ac1e_2a1f_0946_33cc1afd2532
  style 8c5582ba_aaf8_a292_b77c_aba1d1c33ab5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/canonicalize-candidates.ts lines 2488–2504

function createPreComputedVariantsCache(
  designSystem: DesignSystem,
): DesignSystem['storage'][typeof PRE_COMPUTED_VARIANTS_KEY] {
  let signatures = designSystem.storage[VARIANT_SIGNATURE_KEY]
  let lookup = new DefaultMap<string, string[]>(() => [])

  // Actual static variants
  for (let [root, variant] of designSystem.variants.entries()) {
    if (variant.kind === 'static') {
      let signature = signatures.get(root)
      if (typeof signature !== 'string') continue
      lookup.get(signature).push(root)
    }
  }

  return lookup
}

Subdomains

Frequently Asked Questions

What does createPreComputedVariantsCache() do?
createPreComputedVariantsCache() is a function in the tailwindcss codebase.
What does createPreComputedVariantsCache() call?
createPreComputedVariantsCache() calls 2 function(s): entries, get.
What calls createPreComputedVariantsCache()?
createPreComputedVariantsCache() is called by 1 function(s): prepareDesignSystemStorage.

Analyze Your Own Codebase

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

Try Supermodel Free