Home / File/ migrate-at-apply.test.ts — tailwindcss Source File

migrate-at-apply.test.ts — tailwindcss Source File

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

Entity Profile

Dependency Diagram

graph LR
  031a0782_4b19_e996_bb0e_a2f940729176["migrate-at-apply.test.ts"]
  da5d1116_ab2a_437a_6b13_c1429fd546fa["plugin-api.ts"]
  031a0782_4b19_e996_bb0e_a2f940729176 --> da5d1116_ab2a_437a_6b13_c1429fd546fa
  0255ffc0_a3d5_e883_5143_99660766448f["Config"]
  031a0782_4b19_e996_bb0e_a2f940729176 --> 0255ffc0_a3d5_e883_5143_99660766448f
  472e1b98_afcf_f1f2_ad91_916d742bb731["version.ts"]
  031a0782_4b19_e996_bb0e_a2f940729176 --> 472e1b98_afcf_f1f2_ad91_916d742bb731
  587045dd_6997_cdb6_9548_cd81dc79a115["migrate-at-apply.ts"]
  031a0782_4b19_e996_bb0e_a2f940729176 --> 587045dd_6997_cdb6_9548_cd81dc79a115
  6d8d6d7e_6e94_511f_8419_616e12ba69b8["migrateAtApply"]
  031a0782_4b19_e996_bb0e_a2f940729176 --> 6d8d6d7e_6e94_511f_8419_616e12ba69b8
  08129f89_e6ef_0092_629d_821c60228c89["node"]
  031a0782_4b19_e996_bb0e_a2f940729176 --> 08129f89_e6ef_0092_629d_821c60228c89
  8ff4bb92_b963_efb6_cca2_1da4b3ea849b["dedent"]
  031a0782_4b19_e996_bb0e_a2f940729176 --> 8ff4bb92_b963_efb6_cca2_1da4b3ea849b
  7c3c22f8_be1a_4490_9f3e_622280887fe1["postcss"]
  031a0782_4b19_e996_bb0e_a2f940729176 --> 7c3c22f8_be1a_4490_9f3e_622280887fe1
  f1e05e5f_c1b2_a3f5_b2e8_3317b9243ac3["vitest"]
  031a0782_4b19_e996_bb0e_a2f940729176 --> f1e05e5f_c1b2_a3f5_b2e8_3317b9243ac3
  style 031a0782_4b19_e996_bb0e_a2f940729176 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { __unstable__loadDesignSystem } from '@tailwindcss/node'
import dedent from 'dedent'
import postcss from 'postcss'
import { expect, it, vi } from 'vitest'
import type { Config } from '../../../../tailwindcss/src/compat/plugin-api'
import * as versions from '../../utils/version'
import { migrateAtApply } from './migrate-at-apply'
vi.spyOn(versions, 'isMajor').mockReturnValue(true)

const css = dedent

async function migrate(input: string, config: Config = {}) {
  let designSystem = await __unstable__loadDesignSystem(
    css`
      @import 'tailwindcss';

      /* TODO(perf): Only here to speed up the tests */
      @theme {
        --*: initial;
      }
    `,
    { base: __dirname },
  )

  return postcss()
    .use(
      migrateAtApply({
        designSystem,
        userConfig: config,
      }),
    )
    .process(input, { from: expect.getState().testPath })
    .then((result) => result.css)
}

it('should not migrate `@apply`, when there are no issues', async () => {
  expect(
    await migrate(css`
      .foo {
        @apply flex flex-col items-center;
      }
    `),
  ).toMatchInlineSnapshot(`
    ".foo {
      @apply flex flex-col items-center;
    }"
  `)
})

it('should append `!` to each utility, when using `!important`', async () => {
  expect(
    await migrate(css`
      .foo {
        @apply flex flex-col !important;
      }
    `),
  ).toMatchInlineSnapshot(`
    ".foo {
      @apply flex! flex-col!;
    }"
// ... (74 more lines)

Subdomains

Functions

Frequently Asked Questions

What does migrate-at-apply.test.ts do?
migrate-at-apply.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-at-apply.test.ts?
migrate-at-apply.test.ts defines 1 function(s): migrate.
What does migrate-at-apply.test.ts depend on?
migrate-at-apply.test.ts imports 9 module(s): Config, dedent, migrate-at-apply.ts, migrateAtApply, node, plugin-api.ts, postcss, version.ts, and 1 more.
Where is migrate-at-apply.test.ts in the architecture?
migrate-at-apply.test.ts is located at packages/@tailwindcss-upgrade/src/codemods/css/migrate-at-apply.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