Home / Function/ ensureSourceDetectionRootExists() — tailwindcss Function Reference

ensureSourceDetectionRootExists() — tailwindcss Function Reference

Architecture documentation for the ensureSourceDetectionRootExists() function in compile.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  03c87f72_2fdc_1d3d_6613_e7fdcb165aa5["ensureSourceDetectionRootExists()"]
  4df9cc7a_3b26_a27d_dd17_823de0561e69["compileAst()"]
  4df9cc7a_3b26_a27d_dd17_823de0561e69 -->|calls| 03c87f72_2fdc_1d3d_6613_e7fdcb165aa5
  b5593eac_57a1_0ee5_929c_ee4793c6003c["compile()"]
  b5593eac_57a1_0ee5_929c_ee4793c6003c -->|calls| 03c87f72_2fdc_1d3d_6613_e7fdcb165aa5
  style 03c87f72_2fdc_1d3d_6613_e7fdcb165aa5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/@tailwindcss-node/src/compile.ts lines 66–92

async function ensureSourceDetectionRootExists(compiler: {
  root: Awaited<ReturnType<typeof compile>>['root']
}) {
  // Verify if the `source(…)` path exists (until the glob pattern starts)
  if (compiler.root && compiler.root !== 'none') {
    let globSymbols = /[*{]/
    let basePath = []
    for (let segment of compiler.root.pattern.split('/')) {
      if (globSymbols.test(segment)) {
        break
      }

      basePath.push(segment)
    }

    let exists = await fsPromises
      .stat(path.resolve(compiler.root.base, basePath.join('/')))
      .then((stat) => stat.isDirectory())
      .catch(() => false)

    if (!exists) {
      throw new Error(
        `The \`source(${compiler.root.pattern})\` does not exist or is not a directory.`,
      )
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does ensureSourceDetectionRootExists() do?
ensureSourceDetectionRootExists() is a function in the tailwindcss codebase.
What calls ensureSourceDetectionRootExists()?
ensureSourceDetectionRootExists() is called by 2 function(s): compile, compileAst.

Analyze Your Own Codebase

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

Try Supermodel Free