migrate.test.ts — tailwindcss Source File
Architecture documentation for migrate.test.ts, a typescript file in the tailwindcss codebase. 7 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 3bb17500_8ba9_373d_5ec9_b868ffe18dea["migrate.test.ts"] c056448b_f7a2_9149_54e8_f0f8470fe3aa["default-map.ts"] 3bb17500_8ba9_373d_5ec9_b868ffe18dea --> c056448b_f7a2_9149_54e8_f0f8470fe3aa bf2992f6_4a37_8536_70f8_94b13631027d["DefaultMap"] 3bb17500_8ba9_373d_5ec9_b868ffe18dea --> bf2992f6_4a37_8536_70f8_94b13631027d fff09679_e13c_392d_23bb_cebc04ddb008["version.ts"] 3bb17500_8ba9_373d_5ec9_b868ffe18dea --> fff09679_e13c_392d_23bb_cebc04ddb008 75ba60a9_2614_1c57_ad40_3663d4315f3b["migrate.ts"] 3bb17500_8ba9_373d_5ec9_b868ffe18dea --> 75ba60a9_2614_1c57_ad40_3663d4315f3b 8408bbf2_f1a4_0668_26f9_b4cdef678388["migrateCandidate"] 3bb17500_8ba9_373d_5ec9_b868ffe18dea --> 8408bbf2_f1a4_0668_26f9_b4cdef678388 92f2d961_72a4_d195_92d7_2e66972f8894["node"] 3bb17500_8ba9_373d_5ec9_b868ffe18dea --> 92f2d961_72a4_d195_92d7_2e66972f8894 696bd648_5f24_1b59_8e8b_7a97a692869e["vitest"] 3bb17500_8ba9_373d_5ec9_b868ffe18dea --> 696bd648_5f24_1b59_8e8b_7a97a692869e style 3bb17500_8ba9_373d_5ec9_b868ffe18dea fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { __unstable__loadDesignSystem } from '@tailwindcss/node'
import { describe, expect, test, vi } from 'vitest'
import { DefaultMap } from '../../../../tailwindcss/src/utils/default-map'
import * as versions from '../../utils/version'
import { migrateCandidate as migrate } from './migrate'
vi.spyOn(versions, 'isMajor').mockReturnValue(false)
const designSystems = new DefaultMap((base: string) => {
return new DefaultMap((input: string) => {
return __unstable__loadDesignSystem(input, { base })
})
})
const css = String.raw
describe.each([['default'], ['with-variant'], ['important'], ['prefix']])('%s', (strategy) => {
let testName = '%s => %s (%#)'
if (strategy === 'with-variant') {
testName = testName.replaceAll('%s', 'focus:%s')
} else if (strategy === 'important') {
testName = testName.replaceAll('%s', '%s!')
} else if (strategy === 'prefix') {
testName = testName.replaceAll('%s', 'tw:%s')
}
// Basic input with minimal design system to keep the tests fast
let input = css`
@import 'tailwindcss' ${strategy === 'prefix' ? 'prefix(tw)' : ''};
@theme {
--*: initial;
--spacing: 0.25rem;
--color-red-500: red;
/* Equivalent of blue-500/50 */
--color-primary: color-mix(in oklab, oklch(62.3% 0.214 259.815) 50%, transparent);
}
`
test.each([
// Arbitrary property to named functional utility
['[color:red]', 'text-red-500'],
// Promote data types to more specific utility if it exists
['bg-(position:--my-value)', 'bg-position-(--my-value)'],
// Promote inferred data type to more specific utility if it exists
['bg-[123px]', 'bg-position-[123px]'],
// Do not migrate bare values or arbitrary values to named values that are
// deprecated
['order-[0]', 'order-0'],
['order-0', 'order-0'],
// Migrate deprecated named values to bare values
['order-none', 'order-0'],
// `-0` should not be migrated to `0`.
//
// This used to be a bug that translate `mt-[0px]` into `-mt-[0px]` because
// `-mt-[0px]` translates to `margin-top: calc(0px * -1);` and therefore we
// ... (70 more lines)
Domain
Subdomains
Functions
Dependencies
Source
Frequently Asked Questions
What does migrate.test.ts do?
migrate.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.test.ts?
migrate.test.ts defines 1 function(s): designSystems.
What does migrate.test.ts depend on?
migrate.test.ts imports 7 module(s): DefaultMap, default-map.ts, migrate.ts, migrateCandidate, node, version.ts, vitest.
Where is migrate.test.ts in the architecture?
migrate.test.ts is located at packages/@tailwindcss-upgrade/src/codemods/template/migrate.test.ts (domain: UpgradeToolkit, subdomain: Codemods, directory: packages/@tailwindcss-upgrade/src/codemods/template).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free