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
  c5c4e56f_2de5_f92b_af6e_585036b59333["createPreComputedVariantsCache()"]
  207ada18_60f2_10b9_7c9e_99bdb32f4ed7["prepareDesignSystemStorage()"]
  207ada18_60f2_10b9_7c9e_99bdb32f4ed7 -->|calls| c5c4e56f_2de5_f92b_af6e_585036b59333
  cb44739b_2fa4_1336_6907_dd5fe05389f3["entries()"]
  c5c4e56f_2de5_f92b_af6e_585036b59333 -->|calls| cb44739b_2fa4_1336_6907_dd5fe05389f3
  0aa64a1c_efd8_a69d_48ed_649b7a86c854["get()"]
  c5c4e56f_2de5_f92b_af6e_585036b59333 -->|calls| 0aa64a1c_efd8_a69d_48ed_649b7a86c854
  style c5c4e56f_2de5_f92b_af6e_585036b59333 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
}

Domain

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