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
  80a88206_fcce_6e85_32d2_3f5ca73e8b39["createUtilityPropertiesCache()"]
  7d350d81_5de1_f9f3_5b2c_19ec8fd3c37e["canonicalize-candidates.ts"]
  80a88206_fcce_6e85_32d2_3f5ca73e8b39 -->|defined in| 7d350d81_5de1_f9f3_5b2c_19ec8fd3c37e
  81ec8f98_1fb2_d7c3_dd65_3a9e51b3be39["prepareDesignSystemStorage()"]
  81ec8f98_1fb2_d7c3_dd65_3a9e51b3be39 -->|calls| 80a88206_fcce_6e85_32d2_3f5ca73e8b39
  ef9ad758_33f4_0d23_fff8_8eeaf71d00d8["parseCandidate()"]
  80a88206_fcce_6e85_32d2_3f5ca73e8b39 -->|calls| ef9ad758_33f4_0d23_fff8_8eeaf71d00d8
  b634c4e7_2242_e72b_2b52_bbbae37fc41b["canonicalizeAst()"]
  80a88206_fcce_6e85_32d2_3f5ca73e8b39 -->|calls| b634c4e7_2242_e72b_2b52_bbbae37fc41b
  88bcab2f_f837_9e57_5b6a_fda72a4c3315["cloneAstNode()"]
  80a88206_fcce_6e85_32d2_3f5ca73e8b39 -->|calls| 88bcab2f_f837_9e57_5b6a_fda72a4c3315
  06ed9408_12cf_7ddd_a435_8cdd942de1d4["add()"]
  80a88206_fcce_6e85_32d2_3f5ca73e8b39 -->|calls| 06ed9408_12cf_7ddd_a435_8cdd942de1d4
  ed78da58_8727_ad98_120c_61f35cea357a["walk()"]
  80a88206_fcce_6e85_32d2_3f5ca73e8b39 -->|calls| ed78da58_8727_ad98_120c_61f35cea357a
  5bcf4886_1230_a8ff_7302_a26cc5a9a525["get()"]
  80a88206_fcce_6e85_32d2_3f5ca73e8b39 -->|calls| 5bcf4886_1230_a8ff_7302_a26cc5a9a525
  style 80a88206_fcce_6e85_32d2_3f5ca73e8b39 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, defined in packages/tailwindcss/src/canonicalize-candidates.ts.
Where is createUtilityPropertiesCache() defined?
createUtilityPropertiesCache() is defined in packages/tailwindcss/src/canonicalize-candidates.ts at line 2291.
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