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
  e186eef0_e5f2_5d47_3825_19ab57be2de9["migrateLegacyArbitraryValues()"]
  53cf41fe_5903_d247_3bb3_38414ba7d631["parseCandidate()"]
  e186eef0_e5f2_5d47_3825_19ab57be2de9 -->|calls| 53cf41fe_5903_d247_3bb3_38414ba7d631
  6aa3d960_a2f2_03a4_9eb3_642a5598b141["cloneCandidate()"]
  e186eef0_e5f2_5d47_3825_19ab57be2de9 -->|calls| 6aa3d960_a2f2_03a4_9eb3_642a5598b141
  2a20ea29_c850_cd61_5600_aeebbe3dda66["segment()"]
  e186eef0_e5f2_5d47_3825_19ab57be2de9 -->|calls| 2a20ea29_c850_cd61_5600_aeebbe3dda66
  ec55634f_f6e4_3b8b_1267_0b251c4dade1["printCandidate()"]
  e186eef0_e5f2_5d47_3825_19ab57be2de9 -->|calls| ec55634f_f6e4_3b8b_1267_0b251c4dade1
  style e186eef0_e5f2_5d47_3825_19ab57be2de9 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.
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