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 3cba0ed8_8a2c_6367_67e3_fed6b42249a5["ast.test.ts"] b9cbffa4_c352_cf3c_268f_cbb174fb3a47["ast.ts"] 3cba0ed8_8a2c_6367_67e3_fed6b42249a5 --> b9cbffa4_c352_cf3c_268f_cbb174fb3a47 2f6881be_62d9_4b96_7331_a962ced095f7["atRule"] 3cba0ed8_8a2c_6367_67e3_fed6b42249a5 --> 2f6881be_62d9_4b96_7331_a962ced095f7 b75d79c9_e7f1_5470_9b5b_82bcda89d98f["context"] 3cba0ed8_8a2c_6367_67e3_fed6b42249a5 --> b75d79c9_e7f1_5470_9b5b_82bcda89d98f 94749bfc_586d_a227_ed27_a6fae4004c50["cssContext"] 3cba0ed8_8a2c_6367_67e3_fed6b42249a5 --> 94749bfc_586d_a227_ed27_a6fae4004c50 1369a6dc_e395_347d_5d24_b88e22c5446d["decl"] 3cba0ed8_8a2c_6367_67e3_fed6b42249a5 --> 1369a6dc_e395_347d_5d24_b88e22c5446d 9f2a64dc_05ff_3425_1af8_f2dbd33c3b9a["optimizeAst"] 3cba0ed8_8a2c_6367_67e3_fed6b42249a5 --> 9f2a64dc_05ff_3425_1af8_f2dbd33c3b9a 2a22052d_f868_4f88_0a03_2033be58172d["styleRule"] 3cba0ed8_8a2c_6367_67e3_fed6b42249a5 --> 2a22052d_f868_4f88_0a03_2033be58172d 9b49f3c6_0c8d_5c62_965c_30a1db6499f8["toCss"] 3cba0ed8_8a2c_6367_67e3_fed6b42249a5 --> 9b49f3c6_0c8d_5c62_965c_30a1db6499f8 8be42ab2_7e92_957a_da93_ffe4c7d161fe["css-parser.ts"] 3cba0ed8_8a2c_6367_67e3_fed6b42249a5 --> 8be42ab2_7e92_957a_da93_ffe4c7d161fe bdedd2f6_da4b_69dc_e990_0814b59fbe6e["design-system.ts"] 3cba0ed8_8a2c_6367_67e3_fed6b42249a5 --> bdedd2f6_da4b_69dc_e990_0814b59fbe6e e557c8a4_bb27_ee44_c462_9e238157ad04["buildDesignSystem"] 3cba0ed8_8a2c_6367_67e3_fed6b42249a5 --> e557c8a4_bb27_ee44_c462_9e238157ad04 e28cd4a7_4e1a_e79b_76f1_86c479c6640d["theme.ts"] 3cba0ed8_8a2c_6367_67e3_fed6b42249a5 --> e28cd4a7_4e1a_e79b_76f1_86c479c6640d e7a2e966_188e_28f5_d9d6_e54e27e0d0f2["Theme"] 3cba0ed8_8a2c_6367_67e3_fed6b42249a5 --> e7a2e966_188e_28f5_d9d6_e54e27e0d0f2 1b8f1c54_b1e9_e18d_0719_b7ad92808185["walk.ts"] 3cba0ed8_8a2c_6367_67e3_fed6b42249a5 --> 1b8f1c54_b1e9_e18d_0719_b7ad92808185 style 3cba0ed8_8a2c_6367_67e3_fed6b42249a5 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 Oxide domain, PreProcessors 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: Oxide, subdomain: PreProcessors, directory: packages/tailwindcss/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free