Home / File/ compile.ts — tailwindcss Source File

compile.ts — tailwindcss Source File

Architecture documentation for compile.ts, a typescript file in the tailwindcss codebase. 19 imports, 6 dependents.

File typescript Oxide Extractor 19 imports 6 dependents 7 functions

Entity Profile

Dependency Diagram

graph LR
  eea0ec96_6369_abc2_64b3_490868392e31["compile.ts"]
  b9cbffa4_c352_cf3c_268f_cbb174fb3a47["ast.ts"]
  eea0ec96_6369_abc2_64b3_490868392e31 --> b9cbffa4_c352_cf3c_268f_cbb174fb3a47
  2f6881be_62d9_4b96_7331_a962ced095f7["atRule"]
  eea0ec96_6369_abc2_64b3_490868392e31 --> 2f6881be_62d9_4b96_7331_a962ced095f7
  1369a6dc_e395_347d_5d24_b88e22c5446d["decl"]
  eea0ec96_6369_abc2_64b3_490868392e31 --> 1369a6dc_e395_347d_5d24_b88e22c5446d
  085cf56e_8188_afb1_04da_5ccd0fb7babc["rule"]
  eea0ec96_6369_abc2_64b3_490868392e31 --> 085cf56e_8188_afb1_04da_5ccd0fb7babc
  ba6fca27_7720_5839_0f92_bc2abb8db636["candidate.ts"]
  eea0ec96_6369_abc2_64b3_490868392e31 --> ba6fca27_7720_5839_0f92_bc2abb8db636
  bdedd2f6_da4b_69dc_e990_0814b59fbe6e["design-system.ts"]
  eea0ec96_6369_abc2_64b3_490868392e31 --> bdedd2f6_da4b_69dc_e990_0814b59fbe6e
  ff486f3a_fc85_0cb6_545c_9237f7e2dc5e["CompileAstFlags"]
  eea0ec96_6369_abc2_64b3_490868392e31 --> ff486f3a_fc85_0cb6_545c_9237f7e2dc5e
  d0c5fb85_6a2f_f879_3827_f8d9c67abbdb["property-order.ts"]
  eea0ec96_6369_abc2_64b3_490868392e31 --> d0c5fb85_6a2f_f879_3827_f8d9c67abbdb
  ffde8eb7_7def_91ee_918c_be4f250f76a2["utilities.ts"]
  eea0ec96_6369_abc2_64b3_490868392e31 --> ffde8eb7_7def_91ee_918c_be4f250f76a2
  dfcc5bf9_96ac_0c12_9e9e_7288796d1837["asColor"]
  eea0ec96_6369_abc2_64b3_490868392e31 --> dfcc5bf9_96ac_0c12_9e9e_7288796d1837
  52a5447b_9c77_0591_7ea4_271cf99d1fa6["compare.ts"]
  eea0ec96_6369_abc2_64b3_490868392e31 --> 52a5447b_9c77_0591_7ea4_271cf99d1fa6
  b45e6f94_1ba7_7e51_9816_073c45d06c7a["compare"]
  eea0ec96_6369_abc2_64b3_490868392e31 --> b45e6f94_1ba7_7e51_9816_073c45d06c7a
  efac73cf_6ebb_d715_c95b_77e505446ee2["escape.ts"]
  eea0ec96_6369_abc2_64b3_490868392e31 --> efac73cf_6ebb_d715_c95b_77e505446ee2
  3330a25c_8114_660c_a3c7_8f1aaa37457d["escape"]
  eea0ec96_6369_abc2_64b3_490868392e31 --> 3330a25c_8114_660c_a3c7_8f1aaa37457d
  style eea0ec96_6369_abc2_64b3_490868392e31 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { atRule, decl, rule, type AstNode, type Rule, type StyleRule } from './ast'
import { type Candidate, type Variant } from './candidate'
import { CompileAstFlags, type DesignSystem } from './design-system'
import GLOBAL_PROPERTY_ORDER from './property-order'
import { asColor, type Utility } from './utilities'
import { compare } from './utils/compare'
import { escape } from './utils/escape'
import type { Variants } from './variants'
import { walk, WalkAction } from './walk'

export function compileCandidates(
  rawCandidates: Iterable<string>,
  designSystem: DesignSystem,
  {
    onInvalidCandidate,
    respectImportant,
  }: { onInvalidCandidate?: (candidate: string) => void; respectImportant?: boolean } = {},
) {
  let nodeSorting = new Map<
    AstNode,
    { properties: { order: number[]; count: number }; variants: bigint; candidate: string }
  >()
  let astNodes: AstNode[] = []
  let matches = new Map<string, Candidate[]>()

  // Parse candidates and variants
  for (let rawCandidate of rawCandidates) {
    if (designSystem.invalidCandidates.has(rawCandidate)) {
      onInvalidCandidate?.(rawCandidate)
      continue // Bail, invalid candidate
    }

    let candidates = designSystem.parseCandidate(rawCandidate)
    if (candidates.length === 0) {
      onInvalidCandidate?.(rawCandidate)
      continue // Bail, invalid candidate
    }

    matches.set(rawCandidate, candidates)
  }

  let flags = CompileAstFlags.None

  if (respectImportant ?? true) {
    flags |= CompileAstFlags.RespectImportant
  }

  let variantOrderMap = designSystem.getVariantOrder()

  // Create the AST
  for (let [rawCandidate, candidates] of matches) {
    let found = false

    for (let candidate of candidates) {
      let rules = designSystem.compileAstNodes(candidate, flags)
      if (rules.length === 0) continue

      found = true

      for (let { node, propertySort } of rules) {
// ... (308 more lines)

Domain

Subdomains

Frequently Asked Questions

What does compile.ts do?
compile.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the Oxide domain, Extractor subdomain.
What functions are defined in compile.ts?
compile.ts defines 7 function(s): applyImportant, applyVariant, compileAstNodes, compileBaseUtility, compileCandidates, getPropertySort, isFallbackUtility.
What does compile.ts depend on?
compile.ts imports 19 module(s): CompileAstFlags, Variants, WalkAction, asColor, ast.ts, atRule, candidate.ts, compare, and 11 more.
What files import compile.ts?
compile.ts is imported by 6 file(s): apply.ts, design-system.ts, index.ts, intellisense.ts, sort.ts, variants.ts.
Where is compile.ts in the architecture?
compile.ts is located at packages/tailwindcss/src/compile.ts (domain: Oxide, subdomain: Extractor, directory: packages/tailwindcss/src).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free