Home / Function/ migrateEmptyArbitraryValues() — tailwindcss Function Reference

migrateEmptyArbitraryValues() — tailwindcss Function Reference

Architecture documentation for the migrateEmptyArbitraryValues() function in migrate-handle-empty-arbitrary-values.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  c21053c4_bf58_de9a_aac7_84c86dc78bd3["migrateEmptyArbitraryValues()"]
  ca0b656a_eb12_8775_7c9e_8ec36fc0519a["migrate-handle-empty-arbitrary-values.ts"]
  c21053c4_bf58_de9a_aac7_84c86dc78bd3 -->|defined in| ca0b656a_eb12_8775_7c9e_8ec36fc0519a
  style c21053c4_bf58_de9a_aac7_84c86dc78bd3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/@tailwindcss-upgrade/src/codemods/template/migrate-handle-empty-arbitrary-values.ts lines 4–27

export function migrateEmptyArbitraryValues(
  designSystem: DesignSystem,
  _userConfig: Config | null,
  rawCandidate: string,
): string {
  // We can parse the candidate, nothing to do
  if (designSystem.parseCandidate(rawCandidate).length > 0) {
    return rawCandidate
  }

  // No need to handle empty arbitrary values
  if (!rawCandidate.includes('[]')) {
    return rawCandidate
  }

  // Add the `&` placeholder to the empty arbitrary values. Other codemods might
  // migrate these away, but if not, then it's at least valid to parse.
  //
  // E.g.: `group-[]:flex` => `group-[&]:flex`
  // E.g.: `group-[]/name:flex` => `group-[&]/name:flex`
  return rawCandidate
    .replaceAll('-[]:', '-[&]:') // End of variant
    .replaceAll('-[]/', '-[&]/') // With modifier
}

Subdomains

Frequently Asked Questions

What does migrateEmptyArbitraryValues() do?
migrateEmptyArbitraryValues() is a function in the tailwindcss codebase, defined in packages/@tailwindcss-upgrade/src/codemods/template/migrate-handle-empty-arbitrary-values.ts.
Where is migrateEmptyArbitraryValues() defined?
migrateEmptyArbitraryValues() is defined in packages/@tailwindcss-upgrade/src/codemods/template/migrate-handle-empty-arbitrary-values.ts at line 4.

Analyze Your Own Codebase

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

Try Supermodel Free