Home / Function/ testDirDep() — vite Function Reference

testDirDep() — vite Function Reference

Architecture documentation for the testDirDep() function in postcss.config.js from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  79c9af4f_e8ea_5d96_6038_30f89cc79f8a["testDirDep()"]
  6432e4e3_1309_4b33_9744_036f5048ffb8["postcss.config.js"]
  79c9af4f_e8ea_5d96_6038_30f89cc79f8a -->|defined in| 6432e4e3_1309_4b33_9744_036f5048ffb8
  style 79c9af4f_e8ea_5d96_6038_30f89cc79f8a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

playground/css/postcss.config.js lines 14–45

function testDirDep() {
  return {
    postcssPlugin: 'dir-dep',
    AtRule(atRule, { result, Comment }) {
      if (atRule.name === 'test') {
        const pattern = normalizePath(
          path.resolve(path.dirname(result.opts.from), './glob-dep/**/*.css'),
        )
        const files = globSync(pattern, { expandDirectories: false })
        const text = files.map((f) => fs.readFileSync(f, 'utf-8')).join('\n')
        atRule.parent.insertAfter(atRule, text)
        atRule.remove()

        result.messages.push({
          type: 'dir-dependency',
          plugin: 'dir-dep',
          dir: './glob-dep',
          glob: '*.css',
          parent: result.opts.from,
        })

        result.messages.push({
          type: 'dir-dependency',
          plugin: 'dir-dep',
          dir: './glob-dep/nested (dir)', // includes special characters in glob
          glob: '*.css',
          parent: result.opts.from,
        })
      }
    },
  }
}

Domain

Subdomains

Frequently Asked Questions

What does testDirDep() do?
testDirDep() is a function in the vite codebase, defined in playground/css/postcss.config.js.
Where is testDirDep() defined?
testDirDep() is defined in playground/css/postcss.config.js at line 14.

Analyze Your Own Codebase

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

Try Supermodel Free