Home / Function/ migrateLegacyArbitraryValues() — tailwindcss Function Reference

migrateLegacyArbitraryValues() — tailwindcss Function Reference

Architecture documentation for the migrateLegacyArbitraryValues() function in migrate-legacy-arbitrary-values.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  2d17c912_6324_fc2c_8ab3_065595647555["migrateLegacyArbitraryValues()"]
  29d3e557_c0bc_8d75_94ae_12864625aef4["migrate-legacy-arbitrary-values.ts"]
  2d17c912_6324_fc2c_8ab3_065595647555 -->|defined in| 29d3e557_c0bc_8d75_94ae_12864625aef4
  d4b90da0_01b5_b21d_ff05_b37798744576["parseCandidate()"]
  2d17c912_6324_fc2c_8ab3_065595647555 -->|calls| d4b90da0_01b5_b21d_ff05_b37798744576
  f29ee016_da0a_a564_1658_fedaaac680b6["cloneCandidate()"]
  2d17c912_6324_fc2c_8ab3_065595647555 -->|calls| f29ee016_da0a_a564_1658_fedaaac680b6
  f712ed47_45d4_4e5a_dd73_fdefa1da71da["segment()"]
  2d17c912_6324_fc2c_8ab3_065595647555 -->|calls| f712ed47_45d4_4e5a_dd73_fdefa1da71da
  87ba7eab_3a52_d53e_dfd4_e507e9763b55["printCandidate()"]
  2d17c912_6324_fc2c_8ab3_065595647555 -->|calls| 87ba7eab_3a52_d53e_dfd4_e507e9763b55
  style 2d17c912_6324_fc2c_8ab3_065595647555 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/@tailwindcss-upgrade/src/codemods/template/migrate-legacy-arbitrary-values.ts lines 6–29

export function migrateLegacyArbitraryValues(
  designSystem: DesignSystem,
  _userConfig: Config | null,
  rawCandidate: string,
): string {
  for (let candidate of parseCandidate(rawCandidate, designSystem)) {
    let clone = cloneCandidate(candidate)
    let changed = false

    // Convert commas to spaces. E.g.: [auto,1fr] to [auto_1fr]
    if (
      clone.kind === 'functional' &&
      clone.value?.kind === 'arbitrary' &&
      (clone.root === 'grid-cols' || clone.root == 'grid-rows' || clone.root == 'object')
    ) {
      changed = true
      clone.value.value = segment(clone.value.value, ',').join(' ')
    }

    return changed ? designSystem.printCandidate(clone) : rawCandidate
  }

  return rawCandidate
}

Subdomains

Frequently Asked Questions

What does migrateLegacyArbitraryValues() do?
migrateLegacyArbitraryValues() is a function in the tailwindcss codebase, defined in packages/@tailwindcss-upgrade/src/codemods/template/migrate-legacy-arbitrary-values.ts.
Where is migrateLegacyArbitraryValues() defined?
migrateLegacyArbitraryValues() is defined in packages/@tailwindcss-upgrade/src/codemods/template/migrate-legacy-arbitrary-values.ts at line 6.
What does migrateLegacyArbitraryValues() call?
migrateLegacyArbitraryValues() calls 4 function(s): cloneCandidate, parseCandidate, printCandidate, segment.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free