Home / Function/ createUtilityPropertiesCache() — tailwindcss Function Reference

createUtilityPropertiesCache() — tailwindcss Function Reference

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

Function typescript OxideCore Scanner calls 6 called by 1

Entity Profile

Dependency Diagram

graph TD
  69cc8435_e606_a151_8be0_cd5f1378ad52["createUtilityPropertiesCache()"]
  207ada18_60f2_10b9_7c9e_99bdb32f4ed7["prepareDesignSystemStorage()"]
  207ada18_60f2_10b9_7c9e_99bdb32f4ed7 -->|calls| 69cc8435_e606_a151_8be0_cd5f1378ad52
  c98bf5b0_e31e_f92d_3810_96d1e1308d34["parseCandidate()"]
  69cc8435_e606_a151_8be0_cd5f1378ad52 -->|calls| c98bf5b0_e31e_f92d_3810_96d1e1308d34
  3c29a5ca_8e68_4fa2_4e91_392cf24c5a01["canonicalizeAst()"]
  69cc8435_e606_a151_8be0_cd5f1378ad52 -->|calls| 3c29a5ca_8e68_4fa2_4e91_392cf24c5a01
  5869f1b5_a990_0c82_42cb_68e660c3f400["cloneAstNode()"]
  69cc8435_e606_a151_8be0_cd5f1378ad52 -->|calls| 5869f1b5_a990_0c82_42cb_68e660c3f400
  24d95be4_356f_a1f9_9702_2a4f413db0f5["add()"]
  69cc8435_e606_a151_8be0_cd5f1378ad52 -->|calls| 24d95be4_356f_a1f9_9702_2a4f413db0f5
  fd9d5dae_4dbc_46b8_74f1_c7c51a381d0a["walk()"]
  69cc8435_e606_a151_8be0_cd5f1378ad52 -->|calls| fd9d5dae_4dbc_46b8_74f1_c7c51a381d0a
  0aa64a1c_efd8_a69d_48ed_649b7a86c854["get()"]
  69cc8435_e606_a151_8be0_cd5f1378ad52 -->|calls| 0aa64a1c_efd8_a69d_48ed_649b7a86c854
  style 69cc8435_e606_a151_8be0_cd5f1378ad52 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
    })
  })
}

Domain

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