index.test.ts — tailwindcss Source File
Architecture documentation for index.test.ts, a typescript file in the tailwindcss codebase. 12 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 9c587449_9592_da71_37c3_2f37510d84c5["index.test.ts"] e7639b6d_2132_7e05_9498_c732c7517772["format-nodes.ts"] 9c587449_9592_da71_37c3_2f37510d84c5 --> e7639b6d_2132_7e05_9498_c732c7517772 729a086c_18ec_2750_83e5_bdd730f8fa5e["formatNodes"] 9c587449_9592_da71_37c3_2f37510d84c5 --> 729a086c_18ec_2750_83e5_bdd730f8fa5e 67f80607_3a88_f275_79a1_b9557100d939["migrate.ts"] 9c587449_9592_da71_37c3_2f37510d84c5 --> 67f80607_3a88_f275_79a1_b9557100d939 9ebd84f7_07bc_9b19_28a7_8bd93119c37e["migrateContents"] 9c587449_9592_da71_37c3_2f37510d84c5 --> 9ebd84f7_07bc_9b19_28a7_8bd93119c37e ecf9faa2_4ccf_f16c_bb10_222be63faed0["sort-buckets.ts"] 9c587449_9592_da71_37c3_2f37510d84c5 --> ecf9faa2_4ccf_f16c_bb10_222be63faed0 92a12a9f_b36d_4c66_d885_e04224081f21["sortBuckets"] 9c587449_9592_da71_37c3_2f37510d84c5 --> 92a12a9f_b36d_4c66_d885_e04224081f21 fff09679_e13c_392d_23bb_cebc04ddb008["version.ts"] 9c587449_9592_da71_37c3_2f37510d84c5 --> fff09679_e13c_392d_23bb_cebc04ddb008 92f2d961_72a4_d195_92d7_2e66972f8894["node"] 9c587449_9592_da71_37c3_2f37510d84c5 --> 92f2d961_72a4_d195_92d7_2e66972f8894 211db6bb_9759_d0cf_acda_36d7f5733ce2["dedent"] 9c587449_9592_da71_37c3_2f37510d84c5 --> 211db6bb_9759_d0cf_acda_36d7f5733ce2 2a7660a5_3e09_bd74_37f0_e4e54bc64ce5["node:path"] 9c587449_9592_da71_37c3_2f37510d84c5 --> 2a7660a5_3e09_bd74_37f0_e4e54bc64ce5 ba54c7c3_7b1e_9984_bfef_a693a3df2d84["postcss"] 9c587449_9592_da71_37c3_2f37510d84c5 --> ba54c7c3_7b1e_9984_bfef_a693a3df2d84 696bd648_5f24_1b59_8e8b_7a97a692869e["vitest"] 9c587449_9592_da71_37c3_2f37510d84c5 --> 696bd648_5f24_1b59_8e8b_7a97a692869e style 9c587449_9592_da71_37c3_2f37510d84c5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { __unstable__loadDesignSystem } from '@tailwindcss/node'
import dedent from 'dedent'
import path from 'node:path'
import postcss from 'postcss'
import { expect, it, vi } from 'vitest'
import { formatNodes } from './codemods/css/format-nodes'
import { migrateContents } from './codemods/css/migrate'
import { sortBuckets } from './codemods/css/sort-buckets'
import * as versions from './utils/version'
vi.spyOn(versions, 'isMajor').mockReturnValue(true)
const css = dedent
let designSystem = await __unstable__loadDesignSystem(
css`
@import 'tailwindcss';
`,
{ base: __dirname },
)
let config = {
designSystem,
userConfig: {},
newPrefix: null,
configFilePath: path.resolve(__dirname, './tailwind.config.js'),
jsConfigMigration: null,
}
function migrate(input: string, config: any) {
return migrateContents(input, config, expect.getState().testPath)
.then((result) => postcss([sortBuckets(), formatNodes()]).process(result.root, result.opts))
.then((result) => result.css)
}
it('should print the input as-is', async () => {
expect(
await migrate(
css`
/* above */
.foo/* after */ {
/* above */
color: /* before */ red /* after */;
/* below */
}
`,
config,
),
).toMatchInlineSnapshot(`
"/* above */
.foo/* after */ {
/* above */
color: /* before */ red /* after */;
/* below */
}"
`)
})
it('should migrate a stylesheet', async () => {
expect(
await migrate(
// ... (206 more lines)
Domain
Subdomains
Functions
Dependencies
- dedent
- format-nodes.ts
- formatNodes
- migrate.ts
- migrateContents
- node
- node:path
- postcss
- sort-buckets.ts
- sortBuckets
- version.ts
- vitest
Source
Frequently Asked Questions
What does index.test.ts do?
index.test.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the UpgradeToolkit domain, TemplateAnalysis subdomain.
What functions are defined in index.test.ts?
index.test.ts defines 1 function(s): migrate.
What does index.test.ts depend on?
index.test.ts imports 12 module(s): dedent, format-nodes.ts, formatNodes, migrate.ts, migrateContents, node, node:path, postcss, and 4 more.
Where is index.test.ts in the architecture?
index.test.ts is located at packages/@tailwindcss-upgrade/src/index.test.ts (domain: UpgradeToolkit, subdomain: TemplateAnalysis, directory: packages/@tailwindcss-upgrade/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free