Home / Function/ createCanonicalizeUtilityCache() — tailwindcss Function Reference

createCanonicalizeUtilityCache() — tailwindcss Function Reference

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

Function typescript Oxide Extractor calls 3 called by 1

Entity Profile

Dependency Diagram

graph TD
  760a1feb_30f8_c4b2_c08b_eab7c29d415e["createCanonicalizeUtilityCache()"]
  f6c14bbb_2e42_58cc_18f1_c89a243da9c0["canonicalize-candidates.ts"]
  760a1feb_30f8_c4b2_c08b_eab7c29d415e -->|defined in| f6c14bbb_2e42_58cc_18f1_c89a243da9c0
  26169039_1fd2_e320_1f63_11ec10a6fc52["prepareDesignSystemStorage()"]
  26169039_1fd2_e320_1f63_11ec10a6fc52 -->|calls| 760a1feb_30f8_c4b2_c08b_eab7c29d415e
  bafed062_abf8_7e47_4942_385b21bd9b04["parseCandidate()"]
  760a1feb_30f8_c4b2_c08b_eab7c29d415e -->|calls| bafed062_abf8_7e47_4942_385b21bd9b04
  23c6e5a0_eac4_e9dd_7fcf_1e5c71d28310["cloneCandidate()"]
  760a1feb_30f8_c4b2_c08b_eab7c29d415e -->|calls| 23c6e5a0_eac4_e9dd_7fcf_1e5c71d28310
  2de86ba2_90a4_8c2d_db18_154bb1a1564f["printCandidate()"]
  760a1feb_30f8_c4b2_c08b_eab7c29d415e -->|calls| 2de86ba2_90a4_8c2d_db18_154bb1a1564f
  style 760a1feb_30f8_c4b2_c08b_eab7c29d415e 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
    })
  })
}

Domain

Subdomains

Frequently Asked Questions

What does createCanonicalizeUtilityCache() do?
createCanonicalizeUtilityCache() is a function in the tailwindcss codebase, defined in packages/tailwindcss/src/canonicalize-candidates.ts.
Where is createCanonicalizeUtilityCache() defined?
createCanonicalizeUtilityCache() is defined in packages/tailwindcss/src/canonicalize-candidates.ts at line 535.
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