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
  7ea9e5e1_61ed_234e_08e0_af2f43645d35["migrateEmptyArbitraryValues()"]
  b2513b9e_5a88_8d31_01d5_feda722b6dae["migrate-handle-empty-arbitrary-values.ts"]
  7ea9e5e1_61ed_234e_08e0_af2f43645d35 -->|defined in| b2513b9e_5a88_8d31_01d5_feda722b6dae
  style 7ea9e5e1_61ed_234e_08e0_af2f43645d35 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