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 9f73b711_0f71_129f_7fdb_764a3c0df282["migrateModernizeArbitraryValues()"] 01bf11c3_0faa_9a23_ba13_a455d9c3e825["migrate-modernize-arbitrary-values.ts"] 9f73b711_0f71_129f_7fdb_764a3c0df282 -->|defined in| 01bf11c3_0faa_9a23_ba13_a455d9c3e825 d4b90da0_01b5_b21d_ff05_b37798744576["parseCandidate()"] 9f73b711_0f71_129f_7fdb_764a3c0df282 -->|calls| d4b90da0_01b5_b21d_ff05_b37798744576 f29ee016_da0a_a564_1658_fedaaac680b6["cloneCandidate()"] 9f73b711_0f71_129f_7fdb_764a3c0df282 -->|calls| f29ee016_da0a_a564_1658_fedaaac680b6 ca4a0b1a_7c06_9648_ae90_2860010811a5["walkVariants()"] 9f73b711_0f71_129f_7fdb_764a3c0df282 -->|calls| ca4a0b1a_7c06_9648_ae90_2860010811a5 171d2039_b637_0b5d_5082_71ca42e05d86["replaceObject()"] 9f73b711_0f71_129f_7fdb_764a3c0df282 -->|calls| 171d2039_b637_0b5d_5082_71ca42e05d86 7ba77268_84c7_7083_8f22_251a4a791d25["parseVariant()"] 9f73b711_0f71_129f_7fdb_764a3c0df282 -->|calls| 7ba77268_84c7_7083_8f22_251a4a791d25 87ba7eab_3a52_d53e_dfd4_e507e9763b55["printCandidate()"] 9f73b711_0f71_129f_7fdb_764a3c0df282 -->|calls| 87ba7eab_3a52_d53e_dfd4_e507e9763b55 style 9f73b711_0f71_129f_7fdb_764a3c0df282 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