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. 8 imports, 0 dependents.

File typescript UpgradeToolkit Codemods 8 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  412091df_9a6e_6a86_01bf_19968d3ae586["migrate-at-apply.test.ts"]
  af1a6ece_0432_a556_fd63_8cb4a91f12ad["plugin-api.ts"]
  412091df_9a6e_6a86_01bf_19968d3ae586 --> af1a6ece_0432_a556_fd63_8cb4a91f12ad
  fff09679_e13c_392d_23bb_cebc04ddb008["version.ts"]
  412091df_9a6e_6a86_01bf_19968d3ae586 --> fff09679_e13c_392d_23bb_cebc04ddb008
  a6ecddee_0a56_f3dd_6fd9_8373ce255940["migrate-at-apply.ts"]
  412091df_9a6e_6a86_01bf_19968d3ae586 --> a6ecddee_0a56_f3dd_6fd9_8373ce255940
  66e0bbad_4b95_c393_4a95_0a694140aecd["migrateAtApply"]
  412091df_9a6e_6a86_01bf_19968d3ae586 --> 66e0bbad_4b95_c393_4a95_0a694140aecd
  92f2d961_72a4_d195_92d7_2e66972f8894["node"]
  412091df_9a6e_6a86_01bf_19968d3ae586 --> 92f2d961_72a4_d195_92d7_2e66972f8894
  211db6bb_9759_d0cf_acda_36d7f5733ce2["dedent"]
  412091df_9a6e_6a86_01bf_19968d3ae586 --> 211db6bb_9759_d0cf_acda_36d7f5733ce2
  ba54c7c3_7b1e_9984_bfef_a693a3df2d84["postcss"]
  412091df_9a6e_6a86_01bf_19968d3ae586 --> ba54c7c3_7b1e_9984_bfef_a693a3df2d84
  696bd648_5f24_1b59_8e8b_7a97a692869e["vitest"]
  412091df_9a6e_6a86_01bf_19968d3ae586 --> 696bd648_5f24_1b59_8e8b_7a97a692869e
  style 412091df_9a6e_6a86_01bf_19968d3ae586 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

Dependencies

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 UpgradeToolkit 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 8 module(s): dedent, migrate-at-apply.ts, migrateAtApply, node, plugin-api.ts, postcss, version.ts, vitest.
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: UpgradeToolkit, 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