Home / Function/ parentPaths() — tailwindcss Function Reference

parentPaths() — tailwindcss Function Reference

Architecture documentation for the parentPaths() function in prepare-config.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  374e938a_ee2f_054d_3f92_965e3288c0f8["parentPaths()"]
  d58c78f4_5856_72aa_9dca_c418a7d7f31e["prepare-config.ts"]
  374e938a_ee2f_054d_3f92_965e3288c0f8 -->|defined in| d58c78f4_5856_72aa_9dca_c418a7d7f31e
  af4df363_0f48_b01c_23c9_2fbbbb45c164["detectConfigPath()"]
  af4df363_0f48_b01c_23c9_2fbbbb45c164 -->|calls| 374e938a_ee2f_054d_3f92_965e3288c0f8
  style 374e938a_ee2f_054d_3f92_965e3288c0f8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/@tailwindcss-upgrade/src/codemods/template/prepare-config.ts lines 114–133

function* parentPaths(from: string, to: string = from) {
  let fromAbsolute = path.resolve(from)
  let toAbsolute = path.resolve(to)

  if (!fromAbsolute.startsWith(toAbsolute)) {
    throw new Error(`The path ${from} is not a parent of ${to}`)
  }

  if (fromAbsolute === toAbsolute) {
    yield fromAbsolute
    return
  }

  let current = fromAbsolute
  do {
    yield current
    current = path.dirname(current)
  } while (current !== toAbsolute)
  yield toAbsolute
}

Subdomains

Called By

Frequently Asked Questions

What does parentPaths() do?
parentPaths() is a function in the tailwindcss codebase, defined in packages/@tailwindcss-upgrade/src/codemods/template/prepare-config.ts.
Where is parentPaths() defined?
parentPaths() is defined in packages/@tailwindcss-upgrade/src/codemods/template/prepare-config.ts at line 114.
What calls parentPaths()?
parentPaths() is called by 1 function(s): detectConfigPath.

Analyze Your Own Codebase

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

Try Supermodel Free