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 Oxide Extractor calls 6 called by 1

Entity Profile

Dependency Diagram

graph TD
  2fa686dc_af14_1b06_e253_cd3be040c4fd["createUtilityPropertiesCache()"]
  f6c14bbb_2e42_58cc_18f1_c89a243da9c0["canonicalize-candidates.ts"]
  2fa686dc_af14_1b06_e253_cd3be040c4fd -->|defined in| f6c14bbb_2e42_58cc_18f1_c89a243da9c0
  26169039_1fd2_e320_1f63_11ec10a6fc52["prepareDesignSystemStorage()"]
  26169039_1fd2_e320_1f63_11ec10a6fc52 -->|calls| 2fa686dc_af14_1b06_e253_cd3be040c4fd
  bafed062_abf8_7e47_4942_385b21bd9b04["parseCandidate()"]
  2fa686dc_af14_1b06_e253_cd3be040c4fd -->|calls| bafed062_abf8_7e47_4942_385b21bd9b04
  e559573b_f2f8_833b_27e7_100efea815c0["canonicalizeAst()"]
  2fa686dc_af14_1b06_e253_cd3be040c4fd -->|calls| e559573b_f2f8_833b_27e7_100efea815c0
  dbd80fa4_4b36_fb8e_fb6e_f2aec789aa6b["cloneAstNode()"]
  2fa686dc_af14_1b06_e253_cd3be040c4fd -->|calls| dbd80fa4_4b36_fb8e_fb6e_f2aec789aa6b
  e7db6358_7af5_e4b2_792d_749691a304cc["add()"]
  2fa686dc_af14_1b06_e253_cd3be040c4fd -->|calls| e7db6358_7af5_e4b2_792d_749691a304cc
  4982d9ce_98d4_85d9_44af_7cc47b93c482["walk()"]
  2fa686dc_af14_1b06_e253_cd3be040c4fd -->|calls| 4982d9ce_98d4_85d9_44af_7cc47b93c482
  2820372c_b982_9e06_fc23_f8f4ac308d00["get()"]
  2fa686dc_af14_1b06_e253_cd3be040c4fd -->|calls| 2820372c_b982_9e06_fc23_f8f4ac308d00
  style 2fa686dc_af14_1b06_e253_cd3be040c4fd 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, 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