migrate-modernize-arbitrary-values.ts — tailwindcss Source File
Architecture documentation for migrate-modernize-arbitrary-values.ts, a typescript file in the tailwindcss codebase. 9 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR 01bf11c3_0faa_9a23_ba13_a455d9c3e825["migrate-modernize-arbitrary-values.ts"] 669e6a28_c71f_3c5e_9c53_915cede7da78["candidate.ts"] 01bf11c3_0faa_9a23_ba13_a455d9c3e825 --> 669e6a28_c71f_3c5e_9c53_915cede7da78 f29ee016_da0a_a564_1658_fedaaac680b6["cloneCandidate"] 01bf11c3_0faa_9a23_ba13_a455d9c3e825 --> f29ee016_da0a_a564_1658_fedaaac680b6 d4b90da0_01b5_b21d_ff05_b37798744576["parseCandidate"] 01bf11c3_0faa_9a23_ba13_a455d9c3e825 --> d4b90da0_01b5_b21d_ff05_b37798744576 af1a6ece_0432_a556_fd63_8cb4a91f12ad["plugin-api.ts"] 01bf11c3_0faa_9a23_ba13_a455d9c3e825 --> af1a6ece_0432_a556_fd63_8cb4a91f12ad 7fd72d4c_e95c_d849_1002_1e1c9d8aca1a["design-system.ts"] 01bf11c3_0faa_9a23_ba13_a455d9c3e825 --> 7fd72d4c_e95c_d849_1002_1e1c9d8aca1a de65aaee_2caa_4757_c9fa_c7fb4bc23fc0["replace-object.ts"] 01bf11c3_0faa_9a23_ba13_a455d9c3e825 --> de65aaee_2caa_4757_c9fa_c7fb4bc23fc0 171d2039_b637_0b5d_5082_71ca42e05d86["replaceObject"] 01bf11c3_0faa_9a23_ba13_a455d9c3e825 --> 171d2039_b637_0b5d_5082_71ca42e05d86 c6ac3022_ad0f_45f7_f22a_19fe600e967a["walk-variants.ts"] 01bf11c3_0faa_9a23_ba13_a455d9c3e825 --> c6ac3022_ad0f_45f7_f22a_19fe600e967a ca4a0b1a_7c06_9648_ae90_2860010811a5["walkVariants"] 01bf11c3_0faa_9a23_ba13_a455d9c3e825 --> ca4a0b1a_7c06_9648_ae90_2860010811a5 ee1d35bf_4335_a131_a900_1f9f4b90a0e1["migrate-modernize-arbitrary-values.test.ts"] ee1d35bf_4335_a131_a900_1f9f4b90a0e1 --> 01bf11c3_0faa_9a23_ba13_a455d9c3e825 75ba60a9_2614_1c57_ad40_3663d4315f3b["migrate.ts"] 75ba60a9_2614_1c57_ad40_3663d4315f3b --> 01bf11c3_0faa_9a23_ba13_a455d9c3e825 style 01bf11c3_0faa_9a23_ba13_a455d9c3e825 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { cloneCandidate, parseCandidate } from '../../../../tailwindcss/src/candidate'
import type { Config } from '../../../../tailwindcss/src/compat/plugin-api'
import type { DesignSystem } from '../../../../tailwindcss/src/design-system'
import { replaceObject } from '../../../../tailwindcss/src/utils/replace-object'
import { walkVariants } from '../../utils/walk-variants'
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
Functions
Dependencies
Imported By
Source
Frequently Asked Questions
What does migrate-modernize-arbitrary-values.ts do?
migrate-modernize-arbitrary-values.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-modernize-arbitrary-values.ts?
migrate-modernize-arbitrary-values.ts defines 1 function(s): migrateModernizeArbitraryValues.
What does migrate-modernize-arbitrary-values.ts depend on?
migrate-modernize-arbitrary-values.ts imports 9 module(s): candidate.ts, cloneCandidate, design-system.ts, parseCandidate, plugin-api.ts, replace-object.ts, replaceObject, walk-variants.ts, and 1 more.
What files import migrate-modernize-arbitrary-values.ts?
migrate-modernize-arbitrary-values.ts is imported by 2 file(s): migrate-modernize-arbitrary-values.test.ts, migrate.ts.
Where is migrate-modernize-arbitrary-values.ts in the architecture?
migrate-modernize-arbitrary-values.ts is located at packages/@tailwindcss-upgrade/src/codemods/template/migrate-modernize-arbitrary-values.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