ast.test.ts — tailwindcss Source File
Architecture documentation for ast.test.ts, a typescript file in the tailwindcss codebase. 10 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR afa9c75b_3990_72fb_2aba_c3e6b361eec3["ast.test.ts"] 42640952_ea63_55f1_1ff1_00816e2980ae["ast.ts"] afa9c75b_3990_72fb_2aba_c3e6b361eec3 --> 42640952_ea63_55f1_1ff1_00816e2980ae 2da63033_d079_7b37_5cfb_3877674a70b9["toCss"] afa9c75b_3990_72fb_2aba_c3e6b361eec3 --> 2da63033_d079_7b37_5cfb_3877674a70b9 54851997_7544_bab2_96ab_548e5f5df205["css-parser.ts"] afa9c75b_3990_72fb_2aba_c3e6b361eec3 --> 54851997_7544_bab2_96ab_548e5f5df205 b8a15b09_3dfb_7181_b1f8_368422e178e4["parse"] afa9c75b_3990_72fb_2aba_c3e6b361eec3 --> b8a15b09_3dfb_7181_b1f8_368422e178e4 25f462e7_c718_35c5_7ff1_b1b41cc176bf["ast.ts"] afa9c75b_3990_72fb_2aba_c3e6b361eec3 --> 25f462e7_c718_35c5_7ff1_b1b41cc176bf 2b13c224_9fb8_311a_1669_17e838226ea5["cssAstToPostCssAst"] afa9c75b_3990_72fb_2aba_c3e6b361eec3 --> 2b13c224_9fb8_311a_1669_17e838226ea5 117741fb_51f9_63e4_669e_170efd25ca86["postCssAstToCssAst"] afa9c75b_3990_72fb_2aba_c3e6b361eec3 --> 117741fb_51f9_63e4_669e_170efd25ca86 211db6bb_9759_d0cf_acda_36d7f5733ce2["dedent"] afa9c75b_3990_72fb_2aba_c3e6b361eec3 --> 211db6bb_9759_d0cf_acda_36d7f5733ce2 ba54c7c3_7b1e_9984_bfef_a693a3df2d84["postcss"] afa9c75b_3990_72fb_2aba_c3e6b361eec3 --> ba54c7c3_7b1e_9984_bfef_a693a3df2d84 696bd648_5f24_1b59_8e8b_7a97a692869e["vitest"] afa9c75b_3990_72fb_2aba_c3e6b361eec3 --> 696bd648_5f24_1b59_8e8b_7a97a692869e style afa9c75b_3990_72fb_2aba_c3e6b361eec3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import dedent from 'dedent'
import postcss from 'postcss'
import { expect, it } from 'vitest'
import { toCss } from '../../tailwindcss/src/ast'
import { parse } from '../../tailwindcss/src/css-parser'
import { cssAstToPostCssAst, postCssAstToCssAst } from './ast'
let css = dedent
it('should convert a PostCSS AST into a Tailwind CSS AST', () => {
let input = css`
@charset "UTF-8";
@layer foo, bar, baz;
@import 'tailwindcss';
.foo {
color: red;
&:hover {
color: blue;
}
.bar {
color: green !important;
background-color: yellow;
@media (min-width: 640px) {
color: orange;
}
}
}
`
let ast = postcss.parse(input)
let transformedAst = postCssAstToCssAst(ast)
expect(toCss(transformedAst)).toMatchInlineSnapshot(`
"@charset "UTF-8";
@layer foo, bar, baz;
@import 'tailwindcss';
.foo {
color: red;
&:hover {
color: blue;
}
.bar {
color: green !important;
background-color: yellow;
@media (min-width: 640px) {
color: orange;
}
}
}
"
`)
})
it('should convert a Tailwind CSS AST into a PostCSS AST', () => {
let input = css`
@charset "UTF-8";
@layer foo, bar, baz;
@import 'tailwindcss';
.foo {
color: red;
&:hover {
color: blue;
}
.bar {
color: green !important;
background-color: yellow;
@media (min-width: 640px) {
color: orange;
}
}
}
`
let ast = parse(input)
let transformedAst = cssAstToPostCssAst(postcss, ast)
expect(transformedAst.toString()).toMatchInlineSnapshot(`
"@charset "UTF-8";
@layer foo, bar, baz;
@import 'tailwindcss';
.foo {
color: red;
&:hover {
color: blue;
}
.bar {
color: green !important;
background-color: yellow;
@media (min-width: 640px) {
color: orange;
}
}
}"
`)
})
Domain
Dependencies
- ast.ts
- ast.ts
- css-parser.ts
- cssAstToPostCssAst
- dedent
- parse
- postCssAstToCssAst
- postcss
- toCss
- vitest
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 BuildIntegrations domain.
What does ast.test.ts depend on?
ast.test.ts imports 10 module(s): ast.ts, ast.ts, css-parser.ts, cssAstToPostCssAst, dedent, parse, postCssAstToCssAst, postcss, and 2 more.
Where is ast.test.ts in the architecture?
ast.test.ts is located at packages/@tailwindcss-postcss/src/ast.test.ts (domain: BuildIntegrations, directory: packages/@tailwindcss-postcss/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free