Home / File/ compile.ts — tailwindcss Source File

compile.ts — tailwindcss Source File

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

File typescript OxideEngine Extractor 18 imports 6 dependents 7 functions

Entity Profile

Dependency Diagram

graph LR
  214bac69_e516_bea4_67fa_4e9e092ced3b["compile.ts"]
  42640952_ea63_55f1_1ff1_00816e2980ae["ast.ts"]
  214bac69_e516_bea4_67fa_4e9e092ced3b --> 42640952_ea63_55f1_1ff1_00816e2980ae
  f9b19679_c1f0_28d6_4d1a_31a10c52e42d["atRule"]
  214bac69_e516_bea4_67fa_4e9e092ced3b --> f9b19679_c1f0_28d6_4d1a_31a10c52e42d
  c203f636_607a_d332_b4c5_6a40c108f778["decl"]
  214bac69_e516_bea4_67fa_4e9e092ced3b --> c203f636_607a_d332_b4c5_6a40c108f778
  66319c06_7c38_f9ea_4bf0_2a0e18bac1a4["rule"]
  214bac69_e516_bea4_67fa_4e9e092ced3b --> 66319c06_7c38_f9ea_4bf0_2a0e18bac1a4
  669e6a28_c71f_3c5e_9c53_915cede7da78["candidate.ts"]
  214bac69_e516_bea4_67fa_4e9e092ced3b --> 669e6a28_c71f_3c5e_9c53_915cede7da78
  7fd72d4c_e95c_d849_1002_1e1c9d8aca1a["design-system.ts"]
  214bac69_e516_bea4_67fa_4e9e092ced3b --> 7fd72d4c_e95c_d849_1002_1e1c9d8aca1a
  adf524a1_dded_5e00_c140_1dfbb0344210["CompileAstFlags"]
  214bac69_e516_bea4_67fa_4e9e092ced3b --> adf524a1_dded_5e00_c140_1dfbb0344210
  8362228f_a9aa_0b1a_b1b9_8a06801c18ef["property-order.ts"]
  214bac69_e516_bea4_67fa_4e9e092ced3b --> 8362228f_a9aa_0b1a_b1b9_8a06801c18ef
  2bc6f8eb_6339_d09c_79df_e9025a479c97["utilities.ts"]
  214bac69_e516_bea4_67fa_4e9e092ced3b --> 2bc6f8eb_6339_d09c_79df_e9025a479c97
  862a63f1_955e_2605_54a1_0a25a475b9e9["asColor"]
  214bac69_e516_bea4_67fa_4e9e092ced3b --> 862a63f1_955e_2605_54a1_0a25a475b9e9
  2735e2c9_52ba_b31c_44c9_a72c4826e6b7["compare.ts"]
  214bac69_e516_bea4_67fa_4e9e092ced3b --> 2735e2c9_52ba_b31c_44c9_a72c4826e6b7
  7787e2e6_2e19_8e07_7666_21a94194841f["compare"]
  214bac69_e516_bea4_67fa_4e9e092ced3b --> 7787e2e6_2e19_8e07_7666_21a94194841f
  e28f6b6c_be9a_6950_8075_180c1b66f0ea["escape.ts"]
  214bac69_e516_bea4_67fa_4e9e092ced3b --> e28f6b6c_be9a_6950_8075_180c1b66f0ea
  433dc479_0296_0a89_fd12_79fc4ea2b8bd["escape"]
  214bac69_e516_bea4_67fa_4e9e092ced3b --> 433dc479_0296_0a89_fd12_79fc4ea2b8bd
  style 214bac69_e516_bea4_67fa_4e9e092ced3b 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 OxideEngine 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 18 module(s): CompileAstFlags, WalkAction, asColor, ast.ts, atRule, candidate.ts, compare, compare.ts, and 10 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: OxideEngine, 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