Home / Function/ createPreComputedVariantsCache() — tailwindcss Function Reference

createPreComputedVariantsCache() — tailwindcss Function Reference

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

Function typescript Oxide Extractor calls 2 called by 1

Entity Profile

Dependency Diagram

graph TD
  2ea649db_a12c_86b8_dd0a_5260b6ba8678["createPreComputedVariantsCache()"]
  f6c14bbb_2e42_58cc_18f1_c89a243da9c0["canonicalize-candidates.ts"]
  2ea649db_a12c_86b8_dd0a_5260b6ba8678 -->|defined in| f6c14bbb_2e42_58cc_18f1_c89a243da9c0
  26169039_1fd2_e320_1f63_11ec10a6fc52["prepareDesignSystemStorage()"]
  26169039_1fd2_e320_1f63_11ec10a6fc52 -->|calls| 2ea649db_a12c_86b8_dd0a_5260b6ba8678
  333e8e98_491a_3493_516c_169c024de8d8["entries()"]
  2ea649db_a12c_86b8_dd0a_5260b6ba8678 -->|calls| 333e8e98_491a_3493_516c_169c024de8d8
  2820372c_b982_9e06_fc23_f8f4ac308d00["get()"]
  2ea649db_a12c_86b8_dd0a_5260b6ba8678 -->|calls| 2820372c_b982_9e06_fc23_f8f4ac308d00
  style 2ea649db_a12c_86b8_dd0a_5260b6ba8678 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, 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