Home / Function/ testDirDep() — vite Function Reference

testDirDep() — vite Function Reference

Architecture documentation for the testDirDep() function in lightningcss-plugins.js from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  9219ad7a_09d4_944e_c784_0b1add38e7c6["testDirDep()"]
  c618defc_3b57_317d_60a6_8c85cb7f6060["lightningcss-plugins.js"]
  9219ad7a_09d4_944e_c784_0b1add38e7c6 -->|defined in| c618defc_3b57_317d_60a6_8c85cb7f6060
  30e771d8_3941_f851_0b89_b35e02c82093["obtainLightningCssAst()"]
  9219ad7a_09d4_944e_c784_0b1add38e7c6 -->|calls| 30e771d8_3941_f851_0b89_b35e02c82093
  style 9219ad7a_09d4_944e_c784_0b1add38e7c6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

playground/css/lightningcss-plugins.js lines 31–56

export function testDirDep() {
  /** @type {string[]} */
  let currentStyleSheetSources
  return {
    StyleSheet(stylesheet) {
      currentStyleSheetSources = stylesheet.sources
    },
    Rule: {
      unknown: {
        test(rule) {
          const location = rule.loc
          const from = currentStyleSheetSources[location.source_index]
          const pattern = normalizePath(
            path.resolve(path.dirname(from), './glob-dep/**/*.css'),
          )
          // FIXME: there's no way to add a dependency
          const files = globSync(pattern, {
            expandDirectories: false,
            absolute: true,
          })
          return files.flatMap((file) => obtainLightningCssAst(file).rules)
        },
      },
    },
  }
}

Domain

Subdomains

Frequently Asked Questions

What does testDirDep() do?
testDirDep() is a function in the vite codebase, defined in playground/css/lightningcss-plugins.js.
Where is testDirDep() defined?
testDirDep() is defined in playground/css/lightningcss-plugins.js at line 31.
What does testDirDep() call?
testDirDep() calls 1 function(s): obtainLightningCssAst.

Analyze Your Own Codebase

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

Try Supermodel Free