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
  22a76912_be9a_9a1c_8ed9_7b747fc5364e["ensureSourceDetectionRootExists()"]
  69d3ce9e_56db_8f40_5261_64f91b0dee31["compile.ts"]
  22a76912_be9a_9a1c_8ed9_7b747fc5364e -->|defined in| 69d3ce9e_56db_8f40_5261_64f91b0dee31
  89f6305c_3dac_2769_1013_f51b1fdda2c5["compileAst()"]
  89f6305c_3dac_2769_1013_f51b1fdda2c5 -->|calls| 22a76912_be9a_9a1c_8ed9_7b747fc5364e
  8bfefc24_aab5_bf8b_3c07_0671c8a3efe8["compile()"]
  8bfefc24_aab5_bf8b_3c07_0671c8a3efe8 -->|calls| 22a76912_be9a_9a1c_8ed9_7b747fc5364e
  style 22a76912_be9a_9a1c_8ed9_7b747fc5364e 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, defined in packages/@tailwindcss-node/src/compile.ts.
Where is ensureSourceDetectionRootExists() defined?
ensureSourceDetectionRootExists() is defined in packages/@tailwindcss-node/src/compile.ts at line 66.
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