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
  9bfd300c_61da_302b_28fb_2b46aadf0748["createPreComputedVariantsCache()"]
  7d350d81_5de1_f9f3_5b2c_19ec8fd3c37e["canonicalize-candidates.ts"]
  9bfd300c_61da_302b_28fb_2b46aadf0748 -->|defined in| 7d350d81_5de1_f9f3_5b2c_19ec8fd3c37e
  81ec8f98_1fb2_d7c3_dd65_3a9e51b3be39["prepareDesignSystemStorage()"]
  81ec8f98_1fb2_d7c3_dd65_3a9e51b3be39 -->|calls| 9bfd300c_61da_302b_28fb_2b46aadf0748
  8a1ac231_1225_a863_301e_a2e539358b72["entries()"]
  9bfd300c_61da_302b_28fb_2b46aadf0748 -->|calls| 8a1ac231_1225_a863_301e_a2e539358b72
  5bcf4886_1230_a8ff_7302_a26cc5a9a525["get()"]
  9bfd300c_61da_302b_28fb_2b46aadf0748 -->|calls| 5bcf4886_1230_a8ff_7302_a26cc5a9a525
  style 9bfd300c_61da_302b_28fb_2b46aadf0748 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, defined in packages/tailwindcss/src/canonicalize-candidates.ts.
Where is createPreComputedVariantsCache() defined?
createPreComputedVariantsCache() is defined in packages/tailwindcss/src/canonicalize-candidates.ts at line 2488.
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