Home / Function/ createUtilityPropertiesCache() — tailwindcss Function Reference

createUtilityPropertiesCache() — tailwindcss Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  1990afd0_c36f_335a_ba33_c341aee76086["createUtilityPropertiesCache()"]
  20406e7c_6ee8_4626_dbef_5b37708f4d30["prepareDesignSystemStorage()"]
  20406e7c_6ee8_4626_dbef_5b37708f4d30 -->|calls| 1990afd0_c36f_335a_ba33_c341aee76086
  74157cfe_4a6c_d75a_a5ac_16fa6909752f["parseCandidate()"]
  1990afd0_c36f_335a_ba33_c341aee76086 -->|calls| 74157cfe_4a6c_d75a_a5ac_16fa6909752f
  84dbd847_e2eb_8fba_afa7_47012ee6086f["canonicalizeAst()"]
  1990afd0_c36f_335a_ba33_c341aee76086 -->|calls| 84dbd847_e2eb_8fba_afa7_47012ee6086f
  51b06849_01ef_68aa_d189_1f0d4376d897["cloneAstNode()"]
  1990afd0_c36f_335a_ba33_c341aee76086 -->|calls| 51b06849_01ef_68aa_d189_1f0d4376d897
  3ba19013_498f_3c9b_5c44_0eb24efc4394["add()"]
  1990afd0_c36f_335a_ba33_c341aee76086 -->|calls| 3ba19013_498f_3c9b_5c44_0eb24efc4394
  e9d556bc_f22d_356c_1bd2_27442c34b5c7["walk()"]
  1990afd0_c36f_335a_ba33_c341aee76086 -->|calls| e9d556bc_f22d_356c_1bd2_27442c34b5c7
  4cd99e59_ac1e_2a1f_0946_33cc1afd2532["get()"]
  1990afd0_c36f_335a_ba33_c341aee76086 -->|calls| 4cd99e59_ac1e_2a1f_0946_33cc1afd2532
  style 1990afd0_c36f_335a_ba33_c341aee76086 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/canonicalize-candidates.ts lines 2291–2324

function createUtilityPropertiesCache(
  designSystem: DesignSystem,
): DesignSystem['storage'][typeof UTILITY_PROPERTIES_KEY] {
  return new DefaultMap((options: SignatureOptions) => {
    return new DefaultMap((className) => {
      let localPropertyValueLookup = new DefaultMap((_property) => new Set<string>())

      if (designSystem.theme.prefix && !className.startsWith(designSystem.theme.prefix)) {
        className = `${designSystem.theme.prefix}:${className}`
      }
      let parsed = designSystem.parseCandidate(className)
      if (parsed.length === 0) return localPropertyValueLookup

      walk(
        canonicalizeAst(
          designSystem,
          designSystem.compileAstNodes(parsed[0]).map((x) => cloneAstNode(x.node)),
          options,
        ),
        (node) => {
          if (node.kind === 'declaration') {
            localPropertyValueLookup.get(node.property).add(node.value!)
            designSystem.storage[STATIC_UTILITIES_KEY].get(options)
              .get(node.property)
              .get(node.value!)
              .add(className)
          }
        },
      )

      return localPropertyValueLookup
    })
  })
}

Subdomains

Frequently Asked Questions

What does createUtilityPropertiesCache() do?
createUtilityPropertiesCache() is a function in the tailwindcss codebase.
What does createUtilityPropertiesCache() call?
createUtilityPropertiesCache() calls 6 function(s): add, canonicalizeAst, cloneAstNode, get, parseCandidate, walk.
What calls createUtilityPropertiesCache()?
createUtilityPropertiesCache() 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