Home / File/ migrate-legacy-arbitrary-values.ts — tailwindcss Source File

migrate-legacy-arbitrary-values.ts — tailwindcss Source File

Architecture documentation for migrate-legacy-arbitrary-values.ts, a typescript file in the tailwindcss codebase. 7 imports, 2 dependents.

File typescript UpgradeToolkit Codemods 7 imports 2 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  29d3e557_c0bc_8d75_94ae_12864625aef4["migrate-legacy-arbitrary-values.ts"]
  669e6a28_c71f_3c5e_9c53_915cede7da78["candidate.ts"]
  29d3e557_c0bc_8d75_94ae_12864625aef4 --> 669e6a28_c71f_3c5e_9c53_915cede7da78
  f29ee016_da0a_a564_1658_fedaaac680b6["cloneCandidate"]
  29d3e557_c0bc_8d75_94ae_12864625aef4 --> f29ee016_da0a_a564_1658_fedaaac680b6
  d4b90da0_01b5_b21d_ff05_b37798744576["parseCandidate"]
  29d3e557_c0bc_8d75_94ae_12864625aef4 --> d4b90da0_01b5_b21d_ff05_b37798744576
  af1a6ece_0432_a556_fd63_8cb4a91f12ad["plugin-api.ts"]
  29d3e557_c0bc_8d75_94ae_12864625aef4 --> af1a6ece_0432_a556_fd63_8cb4a91f12ad
  7fd72d4c_e95c_d849_1002_1e1c9d8aca1a["design-system.ts"]
  29d3e557_c0bc_8d75_94ae_12864625aef4 --> 7fd72d4c_e95c_d849_1002_1e1c9d8aca1a
  ef204000_8998_5a6c_5455_324b37624713["segment.ts"]
  29d3e557_c0bc_8d75_94ae_12864625aef4 --> ef204000_8998_5a6c_5455_324b37624713
  f712ed47_45d4_4e5a_dd73_fdefa1da71da["segment"]
  29d3e557_c0bc_8d75_94ae_12864625aef4 --> f712ed47_45d4_4e5a_dd73_fdefa1da71da
  f4ca7aef_34dd_41d1_7087_e56ba17c6394["migrate-legacy-arbitrary-values.test.ts"]
  f4ca7aef_34dd_41d1_7087_e56ba17c6394 --> 29d3e557_c0bc_8d75_94ae_12864625aef4
  75ba60a9_2614_1c57_ad40_3663d4315f3b["migrate.ts"]
  75ba60a9_2614_1c57_ad40_3663d4315f3b --> 29d3e557_c0bc_8d75_94ae_12864625aef4
  style 29d3e557_c0bc_8d75_94ae_12864625aef4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { cloneCandidate, parseCandidate } from '../../../../tailwindcss/src/candidate'
import type { Config } from '../../../../tailwindcss/src/compat/plugin-api'
import type { DesignSystem } from '../../../../tailwindcss/src/design-system'
import { segment } from '../../../../tailwindcss/src/utils/segment'

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 migrate-legacy-arbitrary-values.ts do?
migrate-legacy-arbitrary-values.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the UpgradeToolkit domain, Codemods subdomain.
What functions are defined in migrate-legacy-arbitrary-values.ts?
migrate-legacy-arbitrary-values.ts defines 1 function(s): migrateLegacyArbitraryValues.
What does migrate-legacy-arbitrary-values.ts depend on?
migrate-legacy-arbitrary-values.ts imports 7 module(s): candidate.ts, cloneCandidate, design-system.ts, parseCandidate, plugin-api.ts, segment, segment.ts.
What files import migrate-legacy-arbitrary-values.ts?
migrate-legacy-arbitrary-values.ts is imported by 2 file(s): migrate-legacy-arbitrary-values.test.ts, migrate.ts.
Where is migrate-legacy-arbitrary-values.ts in the architecture?
migrate-legacy-arbitrary-values.ts is located at packages/@tailwindcss-upgrade/src/codemods/template/migrate-legacy-arbitrary-values.ts (domain: UpgradeToolkit, subdomain: Codemods, directory: packages/@tailwindcss-upgrade/src/codemods/template).

Analyze Your Own Codebase

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

Try Supermodel Free