ast.test.ts — tailwindcss Source File
Architecture documentation for ast.test.ts, a typescript file in the tailwindcss codebase. 17 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR e1775747_ac0a_9408_d4ff_3677e8085ed9["ast.test.ts"] 42640952_ea63_55f1_1ff1_00816e2980ae["ast.ts"] e1775747_ac0a_9408_d4ff_3677e8085ed9 --> 42640952_ea63_55f1_1ff1_00816e2980ae f9b19679_c1f0_28d6_4d1a_31a10c52e42d["atRule"] e1775747_ac0a_9408_d4ff_3677e8085ed9 --> f9b19679_c1f0_28d6_4d1a_31a10c52e42d 2cb0bb18_cebb_3874_811d_77095e27cf0d["context"] e1775747_ac0a_9408_d4ff_3677e8085ed9 --> 2cb0bb18_cebb_3874_811d_77095e27cf0d b50aa380_a654_a283_9fe1_91a9a42ca527["cssContext"] e1775747_ac0a_9408_d4ff_3677e8085ed9 --> b50aa380_a654_a283_9fe1_91a9a42ca527 c203f636_607a_d332_b4c5_6a40c108f778["decl"] e1775747_ac0a_9408_d4ff_3677e8085ed9 --> c203f636_607a_d332_b4c5_6a40c108f778 47b4c875_7e44_6ff9_fb06_16ecf9254223["optimizeAst"] e1775747_ac0a_9408_d4ff_3677e8085ed9 --> 47b4c875_7e44_6ff9_fb06_16ecf9254223 36be1773_d660_31ac_0b0b_88dbd7f6f7a8["styleRule"] e1775747_ac0a_9408_d4ff_3677e8085ed9 --> 36be1773_d660_31ac_0b0b_88dbd7f6f7a8 2da63033_d079_7b37_5cfb_3877674a70b9["toCss"] e1775747_ac0a_9408_d4ff_3677e8085ed9 --> 2da63033_d079_7b37_5cfb_3877674a70b9 54851997_7544_bab2_96ab_548e5f5df205["css-parser.ts"] e1775747_ac0a_9408_d4ff_3677e8085ed9 --> 54851997_7544_bab2_96ab_548e5f5df205 7fd72d4c_e95c_d849_1002_1e1c9d8aca1a["design-system.ts"] e1775747_ac0a_9408_d4ff_3677e8085ed9 --> 7fd72d4c_e95c_d849_1002_1e1c9d8aca1a 9b965fd7_d8e9_0b43_cd5d_c9294ab598ed["buildDesignSystem"] e1775747_ac0a_9408_d4ff_3677e8085ed9 --> 9b965fd7_d8e9_0b43_cd5d_c9294ab598ed 80295787_127f_69e6_91b3_4bea3a484544["theme.ts"] e1775747_ac0a_9408_d4ff_3677e8085ed9 --> 80295787_127f_69e6_91b3_4bea3a484544 734cf7ec_fb2a_2532_7b20_b3a815c7e3e6["Theme"] e1775747_ac0a_9408_d4ff_3677e8085ed9 --> 734cf7ec_fb2a_2532_7b20_b3a815c7e3e6 d1b39b63_c9d5_6c28_0206_0ddc8b895876["walk.ts"] e1775747_ac0a_9408_d4ff_3677e8085ed9 --> d1b39b63_c9d5_6c28_0206_0ddc8b895876 style e1775747_ac0a_9408_d4ff_3677e8085ed9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { expect, it } from 'vitest'
import {
atRule,
context,
cssContext,
decl,
optimizeAst,
styleRule,
toCss,
type AstNode,
} from './ast'
import * as CSS from './css-parser'
import { buildDesignSystem } from './design-system'
import { Theme } from './theme'
import { walk, WalkAction } from './walk'
const css = String.raw
const defaultDesignSystem = buildDesignSystem(new Theme())
it('should pretty print an AST', () => {
expect(toCss(optimizeAst(CSS.parse('.foo{color:red;&:hover{color:blue;}}'), defaultDesignSystem)))
.toMatchInlineSnapshot(`
".foo {
color: red;
&:hover {
color: blue;
}
}
"
`)
})
it('allows the placement of context nodes', () => {
let ast: AstNode[] = [
styleRule('.foo', [decl('color', 'red')]),
context({ context: 'a' }, [
styleRule('.bar', [
decl('color', 'blue'),
context({ context: 'b' }, [
//
styleRule('.baz', [decl('color', 'green')]),
]),
]),
]),
]
let redContext
let blueContext
let greenContext
walk(ast, (node, _ctx) => {
if (node.kind !== 'declaration') return
let ctx = cssContext(_ctx)
switch (node.value) {
case 'red':
redContext = ctx.context
break
case 'blue':
blueContext = ctx.context
break
// ... (563 more lines)
Domain
Subdomains
Functions
Dependencies
Source
Frequently Asked Questions
What does ast.test.ts do?
ast.test.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 ast.test.ts?
ast.test.ts defines 1 function(s): id.
What does ast.test.ts depend on?
ast.test.ts imports 17 module(s): Theme, WalkAction, ast.ts, atRule, buildDesignSystem, context, css-parser.ts, cssContext, and 9 more.
Where is ast.test.ts in the architecture?
ast.test.ts is located at packages/tailwindcss/src/ast.test.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