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
  c54c0b46_6508_253f_e6ff_d96bcc4246d5["migrateLegacyArbitraryValues()"]
  0bec5ca9_74c8_dcc7_ec12_6404fb6493bd["parseCandidate()"]
  c54c0b46_6508_253f_e6ff_d96bcc4246d5 -->|calls| 0bec5ca9_74c8_dcc7_ec12_6404fb6493bd
  d36b0f78_79bb_ae15_f4f6_4a1b7f01d29f["cloneCandidate()"]
  c54c0b46_6508_253f_e6ff_d96bcc4246d5 -->|calls| d36b0f78_79bb_ae15_f4f6_4a1b7f01d29f
  03b8d706_a876_a776_0056_186ced5d6067["segment()"]
  c54c0b46_6508_253f_e6ff_d96bcc4246d5 -->|calls| 03b8d706_a876_a776_0056_186ced5d6067
  4c29981d_a61a_00fb_b3b5_5a69228c4fff["printCandidate()"]
  c54c0b46_6508_253f_e6ff_d96bcc4246d5 -->|calls| 4c29981d_a61a_00fb_b3b5_5a69228c4fff
  style c54c0b46_6508_253f_e6ff_d96bcc4246d5 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
}

Domain

Subdomains

Frequently Asked Questions

What does migrateLegacyArbitraryValues() do?
migrateLegacyArbitraryValues() is a function in the tailwindcss codebase.
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