Home / Function/ createUtilitySignatureCache() — tailwindcss Function Reference

createUtilitySignatureCache() — tailwindcss Function Reference

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

Function typescript Oxide Extractor calls 7 called by 1

Entity Profile

Dependency Diagram

graph TD
  6e657054_f39b_c09e_18b9_3bc9c9e15d42["createUtilitySignatureCache()"]
  f6c14bbb_2e42_58cc_18f1_c89a243da9c0["canonicalize-candidates.ts"]
  6e657054_f39b_c09e_18b9_3bc9c9e15d42 -->|defined in| f6c14bbb_2e42_58cc_18f1_c89a243da9c0
  26169039_1fd2_e320_1f63_11ec10a6fc52["prepareDesignSystemStorage()"]
  26169039_1fd2_e320_1f63_11ec10a6fc52 -->|calls| 6e657054_f39b_c09e_18b9_3bc9c9e15d42
  2a22052d_f868_4f88_0a03_2033be58172d["styleRule()"]
  6e657054_f39b_c09e_18b9_3bc9c9e15d42 -->|calls| 2a22052d_f868_4f88_0a03_2033be58172d
  2f6881be_62d9_4b96_7331_a962ced095f7["atRule()"]
  6e657054_f39b_c09e_18b9_3bc9c9e15d42 -->|calls| 2f6881be_62d9_4b96_7331_a962ced095f7
  a661983a_5661_09de_3802_5c161f8f271c["temporarilyDisableThemeInline()"]
  6e657054_f39b_c09e_18b9_3bc9c9e15d42 -->|calls| a661983a_5661_09de_3802_5c161f8f271c
  bafed062_abf8_7e47_4942_385b21bd9b04["parseCandidate()"]
  6e657054_f39b_c09e_18b9_3bc9c9e15d42 -->|calls| bafed062_abf8_7e47_4942_385b21bd9b04
  7ad9d996_c0ff_47f5_d131_ab2ead06506e["substituteAtApply()"]
  6e657054_f39b_c09e_18b9_3bc9c9e15d42 -->|calls| 7ad9d996_c0ff_47f5_d131_ab2ead06506e
  e559573b_f2f8_833b_27e7_100efea815c0["canonicalizeAst()"]
  6e657054_f39b_c09e_18b9_3bc9c9e15d42 -->|calls| e559573b_f2f8_833b_27e7_100efea815c0
  9b49f3c6_0c8d_5c62_965c_30a1db6499f8["toCss()"]
  6e657054_f39b_c09e_18b9_3bc9c9e15d42 -->|calls| 9b49f3c6_0c8d_5c62_965c_30a1db6499f8
  style 6e657054_f39b_c09e_18b9_3bc9c9e15d42 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/canonicalize-candidates.ts lines 2026–2066

function createUtilitySignatureCache(
  designSystem: DesignSystem,
): DesignSystem['storage'][typeof UTILITY_SIGNATURE_KEY] {
  return new DefaultMap((options: SignatureOptions) => {
    return new DefaultMap<string, string | Symbol>((utility) => {
      try {
        // Ensure the prefix is added to the utility if it is not already present.
        utility =
          designSystem.theme.prefix && !utility.startsWith(designSystem.theme.prefix)
            ? `${designSystem.theme.prefix}:${utility}`
            : utility

        // Use `@apply` to normalize the selector to `.x`
        let ast: AstNode[] = [styleRule('.x', [atRule('@apply', utility)])]

        temporarilyDisableThemeInline(designSystem, () => {
          // There's separate utility caches for respect important vs not
          // so we want to compile them both with `@theme inline` disabled
          for (let candidate of designSystem.parseCandidate(utility)) {
            designSystem.compileAstNodes(candidate, CompileAstFlags.RespectImportant)
          }

          substituteAtApply(ast, designSystem)
        })

        // Optimize the AST. This is needed such that any internal intermediate
        // nodes are gone. This will also cleanup declaration nodes with undefined
        // values or `--tw-sort` declarations.
        canonicalizeAst(designSystem, ast, options)

        // Compute the final signature, by generating the CSS for the utility
        let signature = toCss(ast)
        return signature
      } catch {
        // A unique symbol is returned to ensure that 2 signatures resulting in
        // `null` are not considered equal.
        return Symbol()
      }
    })
  })
}

Domain

Subdomains

Frequently Asked Questions

What does createUtilitySignatureCache() do?
createUtilitySignatureCache() is a function in the tailwindcss codebase, defined in packages/tailwindcss/src/canonicalize-candidates.ts.
Where is createUtilitySignatureCache() defined?
createUtilitySignatureCache() is defined in packages/tailwindcss/src/canonicalize-candidates.ts at line 2026.
What does createUtilitySignatureCache() call?
createUtilitySignatureCache() calls 7 function(s): atRule, canonicalizeAst, parseCandidate, styleRule, substituteAtApply, temporarilyDisableThemeInline, toCss.
What calls createUtilitySignatureCache()?
createUtilitySignatureCache() 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