Home / File/ migrate-tailwind-directives.test.ts — tailwindcss Source File

migrate-tailwind-directives.test.ts — tailwindcss Source File

Architecture documentation for migrate-tailwind-directives.test.ts, a typescript file in the tailwindcss codebase. 9 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  320d991a_2688_e5d4_fc07_c946ad430e00["migrate-tailwind-directives.test.ts"]
  a088502e_f5da_0531_fbd0_c586a964c369["format-nodes.ts"]
  320d991a_2688_e5d4_fc07_c946ad430e00 --> a088502e_f5da_0531_fbd0_c586a964c369
  9f6b611c_7303_0355_74f7_03283a44c6d0["formatNodes"]
  320d991a_2688_e5d4_fc07_c946ad430e00 --> 9f6b611c_7303_0355_74f7_03283a44c6d0
  ab650bb5_df86_6206_c20d_13143f971e6c["migrate-tailwind-directives.ts"]
  320d991a_2688_e5d4_fc07_c946ad430e00 --> ab650bb5_df86_6206_c20d_13143f971e6c
  bfe5c1d2_37ed_49d0_ef27_f44b54dba6f3["migrateTailwindDirectives"]
  320d991a_2688_e5d4_fc07_c946ad430e00 --> bfe5c1d2_37ed_49d0_ef27_f44b54dba6f3
  a1d91fdc_e00f_534f_abf6_a58adf4778f1["sort-buckets.ts"]
  320d991a_2688_e5d4_fc07_c946ad430e00 --> a1d91fdc_e00f_534f_abf6_a58adf4778f1
  bbbe5224_64f9_042a_8b85_2e287c62c4d1["sortBuckets"]
  320d991a_2688_e5d4_fc07_c946ad430e00 --> bbbe5224_64f9_042a_8b85_2e287c62c4d1
  8ff4bb92_b963_efb6_cca2_1da4b3ea849b["dedent"]
  320d991a_2688_e5d4_fc07_c946ad430e00 --> 8ff4bb92_b963_efb6_cca2_1da4b3ea849b
  7c3c22f8_be1a_4490_9f3e_622280887fe1["postcss"]
  320d991a_2688_e5d4_fc07_c946ad430e00 --> 7c3c22f8_be1a_4490_9f3e_622280887fe1
  f1e05e5f_c1b2_a3f5_b2e8_3317b9243ac3["vitest"]
  320d991a_2688_e5d4_fc07_c946ad430e00 --> f1e05e5f_c1b2_a3f5_b2e8_3317b9243ac3
  style 320d991a_2688_e5d4_fc07_c946ad430e00 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import dedent from 'dedent'
import postcss from 'postcss'
import { expect, it } from 'vitest'
import { formatNodes } from './format-nodes'
import { migrateTailwindDirectives } from './migrate-tailwind-directives'
import { sortBuckets } from './sort-buckets'

const css = dedent

function migrate(input: string, options: { newPrefix: string | null } = { newPrefix: null }) {
  return postcss()
    .use(migrateTailwindDirectives(options))
    .use(sortBuckets())
    .use(formatNodes())
    .process(input, { from: expect.getState().testPath })
    .then((result) => result.css)
}

it("should not migrate `@import 'tailwindcss'`", async () => {
  expect(
    await migrate(css`
      @import 'tailwindcss';
    `),
  ).toEqual(css`
    @import 'tailwindcss';
  `)
})

it("should append a prefix to `@import 'tailwindcss'`", async () => {
  expect(
    await migrate(
      css`
        @import 'tailwindcss';
      `,
      {
        newPrefix: 'tw',
      },
    ),
  ).toEqual(css`
    @import 'tailwindcss' prefix(tw);
  `)
})

it('should migrate the tailwind.css import', async () => {
  expect(
    await migrate(css`
      @import 'tailwindcss/tailwind.css';
    `),
  ).toEqual(css`
    @import 'tailwindcss';
  `)
})

it('should migrate the tailwind.css import with a prefix', async () => {
  expect(
    await migrate(
      css`
        @import 'tailwindcss/tailwind.css';
      `,
      {
// ... (361 more lines)

Subdomains

Functions

Frequently Asked Questions

What does migrate-tailwind-directives.test.ts do?
migrate-tailwind-directives.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 migrate-tailwind-directives.test.ts?
migrate-tailwind-directives.test.ts defines 1 function(s): migrate.
What does migrate-tailwind-directives.test.ts depend on?
migrate-tailwind-directives.test.ts imports 9 module(s): dedent, format-nodes.ts, formatNodes, migrate-tailwind-directives.ts, migrateTailwindDirectives, postcss, sort-buckets.ts, sortBuckets, and 1 more.
Where is migrate-tailwind-directives.test.ts in the architecture?
migrate-tailwind-directives.test.ts is located at packages/@tailwindcss-upgrade/src/codemods/css/migrate-tailwind-directives.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