Home / File/ index.test.ts — tailwindcss Source File

index.test.ts — tailwindcss Source File

Architecture documentation for index.test.ts, a typescript file in the tailwindcss codebase. 12 imports, 0 dependents.

File typescript CommandLineInterface Renderer 12 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  150ae0b2_d69c_0142_62f5_7237ef3b13df["index.test.ts"]
  a088502e_f5da_0531_fbd0_c586a964c369["format-nodes.ts"]
  150ae0b2_d69c_0142_62f5_7237ef3b13df --> a088502e_f5da_0531_fbd0_c586a964c369
  9f6b611c_7303_0355_74f7_03283a44c6d0["formatNodes"]
  150ae0b2_d69c_0142_62f5_7237ef3b13df --> 9f6b611c_7303_0355_74f7_03283a44c6d0
  9e542b1f_db4d_cc7b_b37d_1324d5719263["migrate.ts"]
  150ae0b2_d69c_0142_62f5_7237ef3b13df --> 9e542b1f_db4d_cc7b_b37d_1324d5719263
  1be562b7_fe23_7e22_03ec_31b3d101e5e5["migrateContents"]
  150ae0b2_d69c_0142_62f5_7237ef3b13df --> 1be562b7_fe23_7e22_03ec_31b3d101e5e5
  a1d91fdc_e00f_534f_abf6_a58adf4778f1["sort-buckets.ts"]
  150ae0b2_d69c_0142_62f5_7237ef3b13df --> a1d91fdc_e00f_534f_abf6_a58adf4778f1
  bbbe5224_64f9_042a_8b85_2e287c62c4d1["sortBuckets"]
  150ae0b2_d69c_0142_62f5_7237ef3b13df --> bbbe5224_64f9_042a_8b85_2e287c62c4d1
  472e1b98_afcf_f1f2_ad91_916d742bb731["version.ts"]
  150ae0b2_d69c_0142_62f5_7237ef3b13df --> 472e1b98_afcf_f1f2_ad91_916d742bb731
  08129f89_e6ef_0092_629d_821c60228c89["node"]
  150ae0b2_d69c_0142_62f5_7237ef3b13df --> 08129f89_e6ef_0092_629d_821c60228c89
  8ff4bb92_b963_efb6_cca2_1da4b3ea849b["dedent"]
  150ae0b2_d69c_0142_62f5_7237ef3b13df --> 8ff4bb92_b963_efb6_cca2_1da4b3ea849b
  89aef3dd_1eed_c141_d425_b8949215a653["node:path"]
  150ae0b2_d69c_0142_62f5_7237ef3b13df --> 89aef3dd_1eed_c141_d425_b8949215a653
  7c3c22f8_be1a_4490_9f3e_622280887fe1["postcss"]
  150ae0b2_d69c_0142_62f5_7237ef3b13df --> 7c3c22f8_be1a_4490_9f3e_622280887fe1
  f1e05e5f_c1b2_a3f5_b2e8_3317b9243ac3["vitest"]
  150ae0b2_d69c_0142_62f5_7237ef3b13df --> f1e05e5f_c1b2_a3f5_b2e8_3317b9243ac3
  style 150ae0b2_d69c_0142_62f5_7237ef3b13df 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)

Subdomains

Functions

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 CommandLineInterface domain, Renderer 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: CommandLineInterface, subdomain: Renderer, 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