migrateModernizeArbitraryValues() — tailwindcss Function Reference
Architecture documentation for the migrateModernizeArbitraryValues() function in migrate-modernize-arbitrary-values.ts from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 95e8edc9_45de_ca00_e4d2_601d3ae22f9f["migrateModernizeArbitraryValues()"] 5d3b10aa_da00_02c8_3f52_47b3ae3aa06e["migrate-modernize-arbitrary-values.ts"] 95e8edc9_45de_ca00_e4d2_601d3ae22f9f -->|defined in| 5d3b10aa_da00_02c8_3f52_47b3ae3aa06e 7d328a86_10c6_b5c1_6390_36f4fffe9c14["parseCandidate()"] 95e8edc9_45de_ca00_e4d2_601d3ae22f9f -->|calls| 7d328a86_10c6_b5c1_6390_36f4fffe9c14 23c6e5a0_eac4_e9dd_7fcf_1e5c71d28310["cloneCandidate()"] 95e8edc9_45de_ca00_e4d2_601d3ae22f9f -->|calls| 23c6e5a0_eac4_e9dd_7fcf_1e5c71d28310 abd55297_2562_3a6c_6827_3710e8d45c54["walkVariants()"] 95e8edc9_45de_ca00_e4d2_601d3ae22f9f -->|calls| abd55297_2562_3a6c_6827_3710e8d45c54 38b866f2_6f5f_ed0c_8931_4489835420d2["replaceObject()"] 95e8edc9_45de_ca00_e4d2_601d3ae22f9f -->|calls| 38b866f2_6f5f_ed0c_8931_4489835420d2 5719096b_0f51_ab16_7fbd_4455f835804c["parseVariant()"] 95e8edc9_45de_ca00_e4d2_601d3ae22f9f -->|calls| 5719096b_0f51_ab16_7fbd_4455f835804c 2de86ba2_90a4_8c2d_db18_154bb1a1564f["printCandidate()"] 95e8edc9_45de_ca00_e4d2_601d3ae22f9f -->|calls| 2de86ba2_90a4_8c2d_db18_154bb1a1564f style 95e8edc9_45de_ca00_e4d2_601d3ae22f9f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/@tailwindcss-upgrade/src/codemods/template/migrate-modernize-arbitrary-values.ts lines 7–72
export function migrateModernizeArbitraryValues(
designSystem: DesignSystem,
_userConfig: Config | null,
rawCandidate: string,
): string {
for (let candidate of parseCandidate(rawCandidate, designSystem)) {
let clone = cloneCandidate(candidate)
let changed = false
for (let [variant] of walkVariants(clone)) {
// Forward modifier from the root to the compound variant
if (
variant.kind === 'compound' &&
(variant.root === 'has' || variant.root === 'not' || variant.root === 'in')
) {
if (variant.modifier !== null) {
if ('modifier' in variant.variant) {
variant.variant.modifier = variant.modifier
variant.modifier = null
}
}
}
// Promote `group-[]:flex` to `in-[.group]:flex`
// ^^ Yes, this is empty
// Promote `group-[]/name:flex` to `in-[.group\/name]:flex`
if (
variant.kind === 'compound' &&
variant.root === 'group' &&
variant.variant.kind === 'arbitrary' &&
variant.variant.selector === '&'
) {
// `group-[]`
if (variant.modifier === null) {
changed = true
replaceObject(
variant,
designSystem.parseVariant(
designSystem.theme.prefix
? `in-[.${designSystem.theme.prefix}\\:group]`
: 'in-[.group]',
),
)
}
// `group-[]/name`
else if (variant.modifier.kind === 'named') {
changed = true
replaceObject(
variant,
designSystem.parseVariant(
designSystem.theme.prefix
? `in-[.${designSystem.theme.prefix}\\:group\\/${variant.modifier.value}]`
: `in-[.group\\/${variant.modifier.value}]`,
),
)
}
continue
}
}
return changed ? designSystem.printCandidate(clone) : rawCandidate
}
return rawCandidate
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does migrateModernizeArbitraryValues() do?
migrateModernizeArbitraryValues() is a function in the tailwindcss codebase, defined in packages/@tailwindcss-upgrade/src/codemods/template/migrate-modernize-arbitrary-values.ts.
Where is migrateModernizeArbitraryValues() defined?
migrateModernizeArbitraryValues() is defined in packages/@tailwindcss-upgrade/src/codemods/template/migrate-modernize-arbitrary-values.ts at line 7.
What does migrateModernizeArbitraryValues() call?
migrateModernizeArbitraryValues() calls 6 function(s): cloneCandidate, parseCandidate, parseVariant, printCandidate, replaceObject, walkVariants.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free