format-nodes.test.ts — tailwindcss Source File
Architecture documentation for format-nodes.test.ts, a typescript file in the tailwindcss codebase. 6 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR d416162c_9943_db17_ed57_8be427000ef6["format-nodes.test.ts"] a088502e_f5da_0531_fbd0_c586a964c369["format-nodes.ts"] d416162c_9943_db17_ed57_8be427000ef6 --> a088502e_f5da_0531_fbd0_c586a964c369 9f6b611c_7303_0355_74f7_03283a44c6d0["formatNodes"] d416162c_9943_db17_ed57_8be427000ef6 --> 9f6b611c_7303_0355_74f7_03283a44c6d0 a1d91fdc_e00f_534f_abf6_a58adf4778f1["sort-buckets.ts"] d416162c_9943_db17_ed57_8be427000ef6 --> a1d91fdc_e00f_534f_abf6_a58adf4778f1 bbbe5224_64f9_042a_8b85_2e287c62c4d1["sortBuckets"] d416162c_9943_db17_ed57_8be427000ef6 --> bbbe5224_64f9_042a_8b85_2e287c62c4d1 7c3c22f8_be1a_4490_9f3e_622280887fe1["postcss"] d416162c_9943_db17_ed57_8be427000ef6 --> 7c3c22f8_be1a_4490_9f3e_622280887fe1 f1e05e5f_c1b2_a3f5_b2e8_3317b9243ac3["vitest"] d416162c_9943_db17_ed57_8be427000ef6 --> f1e05e5f_c1b2_a3f5_b2e8_3317b9243ac3 style d416162c_9943_db17_ed57_8be427000ef6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import postcss, { type Plugin } from 'postcss'
import { expect, it } from 'vitest'
import { formatNodes } from './format-nodes'
import { sortBuckets } from './sort-buckets'
function markPretty(): Plugin {
return {
postcssPlugin: '@tailwindcss/upgrade/mark-pretty',
OnceExit(root) {
root.walkAtRules('tw-format', (atRule) => {
atRule.raws.tailwind_pretty = true
})
},
}
}
function migrate(input: string) {
return postcss()
.use(markPretty())
.use(sortBuckets())
.use(formatNodes())
.process(input, { from: expect.getState().testPath })
.then((result) => result.css)
}
it('should format PostCSS nodes', async () => {
expect(await migrate(`@utility .foo { .foo { color: red; } }`)).toMatchInlineSnapshot(`
"@utility .foo {
.foo {
color: red;
}
}"
`)
})
it('should format PostCSS nodes in the `user` bucket', async () => {
expect(await migrate(`@tw-bucket user { @tw-format .bar { .foo { color: red; } } }`))
.toMatchInlineSnapshot(`
"@tw-format .bar {
.foo {
color: red;
}
}"
`)
})
Domain
Subdomains
Functions
Dependencies
- format-nodes.ts
- formatNodes
- postcss
- sort-buckets.ts
- sortBuckets
- vitest
Source
Frequently Asked Questions
What does format-nodes.test.ts do?
format-nodes.test.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the CommandLineInterface domain, Codemods subdomain.
What functions are defined in format-nodes.test.ts?
format-nodes.test.ts defines 2 function(s): markPretty, migrate.
What does format-nodes.test.ts depend on?
format-nodes.test.ts imports 6 module(s): format-nodes.ts, formatNodes, postcss, sort-buckets.ts, sortBuckets, vitest.
Where is format-nodes.test.ts in the architecture?
format-nodes.test.ts is located at packages/@tailwindcss-upgrade/src/codemods/css/format-nodes.test.ts (domain: CommandLineInterface, subdomain: Codemods, directory: packages/@tailwindcss-upgrade/src/codemods/css).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free