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
  a8ebd8e1_4e38_4a06_28e7_e26261806723["migrateLegacyArbitraryValues()"]
  a3df83e7_b177_b92b_d91f_ff6ea6bba20c["migrate-legacy-arbitrary-values.ts"]
  a8ebd8e1_4e38_4a06_28e7_e26261806723 -->|defined in| a3df83e7_b177_b92b_d91f_ff6ea6bba20c
  7d328a86_10c6_b5c1_6390_36f4fffe9c14["parseCandidate()"]
  a8ebd8e1_4e38_4a06_28e7_e26261806723 -->|calls| 7d328a86_10c6_b5c1_6390_36f4fffe9c14
  23c6e5a0_eac4_e9dd_7fcf_1e5c71d28310["cloneCandidate()"]
  a8ebd8e1_4e38_4a06_28e7_e26261806723 -->|calls| 23c6e5a0_eac4_e9dd_7fcf_1e5c71d28310
  c58cbb33_f3cc_0b4f_844a_15bf66a1dc61["segment()"]
  a8ebd8e1_4e38_4a06_28e7_e26261806723 -->|calls| c58cbb33_f3cc_0b4f_844a_15bf66a1dc61
  2de86ba2_90a4_8c2d_db18_154bb1a1564f["printCandidate()"]
  a8ebd8e1_4e38_4a06_28e7_e26261806723 -->|calls| 2de86ba2_90a4_8c2d_db18_154bb1a1564f
  style a8ebd8e1_4e38_4a06_28e7_e26261806723 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