Home / Function/ createCanonicalizeUtilityCache() — tailwindcss Function Reference

createCanonicalizeUtilityCache() — tailwindcss Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  19312e09_c0b9_b4d3_7181_315ee63b4c14["createCanonicalizeUtilityCache()"]
  20406e7c_6ee8_4626_dbef_5b37708f4d30["prepareDesignSystemStorage()"]
  20406e7c_6ee8_4626_dbef_5b37708f4d30 -->|calls| 19312e09_c0b9_b4d3_7181_315ee63b4c14
  74157cfe_4a6c_d75a_a5ac_16fa6909752f["parseCandidate()"]
  19312e09_c0b9_b4d3_7181_315ee63b4c14 -->|calls| 74157cfe_4a6c_d75a_a5ac_16fa6909752f
  6aa3d960_a2f2_03a4_9eb3_642a5598b141["cloneCandidate()"]
  19312e09_c0b9_b4d3_7181_315ee63b4c14 -->|calls| 6aa3d960_a2f2_03a4_9eb3_642a5598b141
  ec55634f_f6e4_3b8b_1267_0b251c4dade1["printCandidate()"]
  19312e09_c0b9_b4d3_7181_315ee63b4c14 -->|calls| ec55634f_f6e4_3b8b_1267_0b251c4dade1
  style 19312e09_c0b9_b4d3_7181_315ee63b4c14 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/canonicalize-candidates.ts lines 535–555

function createCanonicalizeUtilityCache(): DesignSystem['storage'][typeof CANONICALIZE_UTILITY_KEY] {
  return new DefaultMap((options: InternalCanonicalizeOptions) => {
    let designSystem = options.designSystem
    return new DefaultMap((rawCandidate: string): string => {
      for (let readonlyCandidate of designSystem.parseCandidate(rawCandidate)) {
        let replacement = cloneCandidate(readonlyCandidate) as Writable<typeof readonlyCandidate>

        for (let fn of UTILITY_CANONICALIZATIONS) {
          replacement = fn(replacement, options)
        }

        let canonicalizedCandidate = designSystem.printCandidate(replacement)
        if (rawCandidate !== canonicalizedCandidate) {
          return canonicalizedCandidate
        }
      }

      return rawCandidate
    })
  })
}

Subdomains

Frequently Asked Questions

What does createCanonicalizeUtilityCache() do?
createCanonicalizeUtilityCache() is a function in the tailwindcss codebase.
What does createCanonicalizeUtilityCache() call?
createCanonicalizeUtilityCache() calls 3 function(s): cloneCandidate, parseCandidate, printCandidate.
What calls createCanonicalizeUtilityCache()?
createCanonicalizeUtilityCache() 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