Home / File/ apply-compat-hooks.ts — tailwindcss Source File

apply-compat-hooks.ts — tailwindcss Source File

Architecture documentation for apply-compat-hooks.ts, a typescript file in the tailwindcss codebase. 36 imports, 1 dependents.

File typescript Oxide PreProcessors 36 imports 1 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  2745c5e0_8ea4_a1c7_4f84_369746e3eb63["apply-compat-hooks.ts"]
  b9cbffa4_c352_cf3c_268f_cbb174fb3a47["ast.ts"]
  2745c5e0_8ea4_a1c7_4f84_369746e3eb63 --> b9cbffa4_c352_cf3c_268f_cbb174fb3a47
  94749bfc_586d_a227_ed27_a6fae4004c50["cssContext"]
  2745c5e0_8ea4_a1c7_4f84_369746e3eb63 --> 94749bfc_586d_a227_ed27_a6fae4004c50
  2a22052d_f868_4f88_0a03_2033be58172d["styleRule"]
  2745c5e0_8ea4_a1c7_4f84_369746e3eb63 --> 2a22052d_f868_4f88_0a03_2033be58172d
  9b49f3c6_0c8d_5c62_965c_30a1db6499f8["toCss"]
  2745c5e0_8ea4_a1c7_4f84_369746e3eb63 --> 9b49f3c6_0c8d_5c62_965c_30a1db6499f8
  bdedd2f6_da4b_69dc_e990_0814b59fbe6e["design-system.ts"]
  2745c5e0_8ea4_a1c7_4f84_369746e3eb63 --> bdedd2f6_da4b_69dc_e990_0814b59fbe6e
  665aa4ed_d86e_30e5_80d5_cd56b8ca8b62["DesignSystem"]
  2745c5e0_8ea4_a1c7_4f84_369746e3eb63 --> 665aa4ed_d86e_30e5_80d5_cd56b8ca8b62
  45262882_ddec_eb81_dedb_b4f286a3f721["source.ts"]
  2745c5e0_8ea4_a1c7_4f84_369746e3eb63 --> 45262882_ddec_eb81_dedb_b4f286a3f721
  0befe1e4_cbdb_e481_9c0a_5c5c6d3e2a01["SourceLocation"]
  2745c5e0_8ea4_a1c7_4f84_369746e3eb63 --> 0befe1e4_cbdb_e481_9c0a_5c5c6d3e2a01
  bb9924cc_8308_a1f9_0e30_76de45a64970["segment.ts"]
  2745c5e0_8ea4_a1c7_4f84_369746e3eb63 --> bb9924cc_8308_a1f9_0e30_76de45a64970
  c58cbb33_f3cc_0b4f_844a_15bf66a1dc61["segment"]
  2745c5e0_8ea4_a1c7_4f84_369746e3eb63 --> c58cbb33_f3cc_0b4f_844a_15bf66a1dc61
  1b8f1c54_b1e9_e18d_0719_b7ad92808185["walk.ts"]
  2745c5e0_8ea4_a1c7_4f84_369746e3eb63 --> 1b8f1c54_b1e9_e18d_0719_b7ad92808185
  4982d9ce_98d4_85d9_44af_7cc47b93c482["walk"]
  2745c5e0_8ea4_a1c7_4f84_369746e3eb63 --> 4982d9ce_98d4_85d9_44af_7cc47b93c482
  47187d1b_a6f7_f734_0752_446b87b5cd9e["WalkAction"]
  2745c5e0_8ea4_a1c7_4f84_369746e3eb63 --> 47187d1b_a6f7_f734_0752_446b87b5cd9e
  8d84257d_f3b2_cdf8_542f_835967da0481["apply-config-to-theme.ts"]
  2745c5e0_8ea4_a1c7_4f84_369746e3eb63 --> 8d84257d_f3b2_cdf8_542f_835967da0481
  style 2745c5e0_8ea4_a1c7_4f84_369746e3eb63 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { Features } from '..'
import { cssContext, styleRule, toCss, type AstNode } from '../ast'
import type { DesignSystem } from '../design-system'
import type { SourceLocation } from '../source-maps/source'
import { segment } from '../utils/segment'
import { walk, WalkAction } from '../walk'
import { applyConfigToTheme } from './apply-config-to-theme'
import { applyKeyframesToTheme } from './apply-keyframes-to-theme'
import { createCompatConfig } from './config/create-compat-config'
import { resolveConfig } from './config/resolve-config'
import type { UserConfig } from './config/types'
import { registerContainerCompat } from './container'
import { darkModePlugin } from './dark-mode'
import { registerLegacyUtilities } from './legacy-utilities'
import { buildPluginApi, type CssPluginOptions, type Plugin } from './plugin-api'
import { registerScreensConfig } from './screens-config'
import { registerThemeVariantOverrides } from './theme-variants'

const IS_VALID_PREFIX = /^[a-z]+$/

export async function applyCompatibilityHooks({
  designSystem,
  base,
  ast,
  loadModule,
  sources,
}: {
  designSystem: DesignSystem
  base: string
  ast: AstNode[]
  loadModule: (
    path: string,
    base: string,
    resourceHint: 'plugin' | 'config',
  ) => Promise<{
    path: string
    base: string
    module: any
  }>
  sources: { base: string; pattern: string; negated: boolean }[]
}) {
  let features = Features.None
  let pluginPaths: [
    { id: string; base: string; reference: boolean; src: SourceLocation | undefined },
    CssPluginOptions | null,
  ][] = []
  let configPaths: {
    id: string
    base: string
    reference: boolean
    src: SourceLocation | undefined
  }[] = []

  walk(ast, (node, _ctx) => {
    if (node.kind !== 'at-rule') return
    let ctx = cssContext(_ctx)

    // Collect paths from `@plugin` at-rules
    if (node.name === '@plugin') {
      if (ctx.parent !== null) {
// ... (364 more lines)

Domain

Subdomains

Frequently Asked Questions

What does apply-compat-hooks.ts do?
apply-compat-hooks.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the Oxide domain, PreProcessors subdomain.
What functions are defined in apply-compat-hooks.ts?
apply-compat-hooks.ts defines 2 function(s): applyCompatibilityHooks, upgradeToFullPluginSupport.
What does apply-compat-hooks.ts depend on?
apply-compat-hooks.ts imports 36 module(s): .., DesignSystem, SourceLocation, UserConfig, WalkAction, apply-config-to-theme.ts, apply-keyframes-to-theme.ts, applyConfigToTheme, and 28 more.
What files import apply-compat-hooks.ts?
apply-compat-hooks.ts is imported by 1 file(s): index.ts.
Where is apply-compat-hooks.ts in the architecture?
apply-compat-hooks.ts is located at packages/tailwindcss/src/compat/apply-compat-hooks.ts (domain: Oxide, subdomain: PreProcessors, directory: packages/tailwindcss/src/compat).

Analyze Your Own Codebase

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

Try Supermodel Free