Home / Function/ migrateCamelcaseInNamedValue() — tailwindcss Function Reference

migrateCamelcaseInNamedValue() — tailwindcss Function Reference

Architecture documentation for the migrateCamelcaseInNamedValue() function in migrate-camelcase-in-named-value.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  e33960a2_fa25_720d_6e49_e29c569295d2["migrateCamelcaseInNamedValue()"]
  52b211e0_83d1_a1d7_814c_3d7122a1a27e["migrate-camelcase-in-named-value.ts"]
  e33960a2_fa25_720d_6e49_e29c569295d2 -->|defined in| 52b211e0_83d1_a1d7_814c_3d7122a1a27e
  6cf757d4_aaad_b18d_cf21_ade24c6e2a77["isMajor()"]
  e33960a2_fa25_720d_6e49_e29c569295d2 -->|calls| 6cf757d4_aaad_b18d_cf21_ade24c6e2a77
  7d328a86_10c6_b5c1_6390_36f4fffe9c14["parseCandidate()"]
  e33960a2_fa25_720d_6e49_e29c569295d2 -->|calls| 7d328a86_10c6_b5c1_6390_36f4fffe9c14
  23c6e5a0_eac4_e9dd_7fcf_1e5c71d28310["cloneCandidate()"]
  e33960a2_fa25_720d_6e49_e29c569295d2 -->|calls| 23c6e5a0_eac4_e9dd_7fcf_1e5c71d28310
  52d86fca_7335_d629_1996_a41f7b2ffa5f["camelToKebab()"]
  e33960a2_fa25_720d_6e49_e29c569295d2 -->|calls| 52d86fca_7335_d629_1996_a41f7b2ffa5f
  2de86ba2_90a4_8c2d_db18_154bb1a1564f["printCandidate()"]
  e33960a2_fa25_720d_6e49_e29c569295d2 -->|calls| 2de86ba2_90a4_8c2d_db18_154bb1a1564f
  style e33960a2_fa25_720d_6e49_e29c569295d2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/@tailwindcss-upgrade/src/codemods/template/migrate-camelcase-in-named-value.ts lines 10–50

export function migrateCamelcaseInNamedValue(
  designSystem: DesignSystem,
  _userConfig: Config | null,
  rawCandidate: string,
): string {
  if (!version.isMajor(3)) return rawCandidate

  for (let candidate of designSystem.parseCandidate(rawCandidate)) {
    if (candidate.kind !== 'functional') continue
    let clone = cloneCandidate(candidate)
    let didChange = false

    if (
      candidate.value &&
      clone.value &&
      candidate.value.kind === 'named' &&
      clone.value.kind === 'named' &&
      candidate.value.value.match(/[A-Z]/)
    ) {
      clone.value.value = camelToKebab(candidate.value.value)
      didChange = true
    }

    if (
      candidate.modifier &&
      clone.modifier &&
      candidate.modifier.kind === 'named' &&
      clone.modifier.kind === 'named' &&
      candidate.modifier.value.match(/[A-Z]/)
    ) {
      clone.modifier.value = camelToKebab(candidate.modifier.value)
      didChange = true
    }

    if (didChange) {
      return designSystem.printCandidate(clone)
    }
  }

  return rawCandidate
}

Subdomains

Frequently Asked Questions

What does migrateCamelcaseInNamedValue() do?
migrateCamelcaseInNamedValue() is a function in the tailwindcss codebase, defined in packages/@tailwindcss-upgrade/src/codemods/template/migrate-camelcase-in-named-value.ts.
Where is migrateCamelcaseInNamedValue() defined?
migrateCamelcaseInNamedValue() is defined in packages/@tailwindcss-upgrade/src/codemods/template/migrate-camelcase-in-named-value.ts at line 10.
What does migrateCamelcaseInNamedValue() call?
migrateCamelcaseInNamedValue() calls 5 function(s): camelToKebab, cloneCandidate, isMajor, parseCandidate, printCandidate.

Analyze Your Own Codebase

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

Try Supermodel Free