traceDependencies() — tailwindcss Function Reference
Architecture documentation for the traceDependencies() function in get-module-dependencies.ts from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 2cf35aaf_0103_6bdb_ca72_680b1b6f6271["traceDependencies()"] e35c65f4_7d0a_1c14_2967_e3c608b092bd["getModuleDependencies()"] e35c65f4_7d0a_1c14_2967_e3c608b092bd -->|calls| 2cf35aaf_0103_6bdb_ca72_680b1b6f6271 f05f80d8_4478_95e6_1f75_bee67cf167ad["resolveWithExtension()"] 2cf35aaf_0103_6bdb_ca72_680b1b6f6271 -->|calls| f05f80d8_4478_95e6_1f75_bee67cf167ad style 2cf35aaf_0103_6bdb_ca72_680b1b6f6271 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/@tailwindcss-node/src/get-module-dependencies.ts lines 51–87
async function traceDependencies(
seen: Set<string>,
filename: string,
base: string,
ext: string,
): Promise<void> {
// Try to find the file
let extensions = JS_EXTENSIONS.includes(ext) ? JS_RESOLUTION_ORDER : TS_RESOLUTION_ORDER
let absoluteFile = await resolveWithExtension(path.resolve(base, filename), extensions)
if (absoluteFile === null) return // File doesn't exist
// Prevent infinite loops when there are circular dependencies
if (seen.has(absoluteFile)) return // Already seen
// Mark the file as a dependency
seen.add(absoluteFile)
// Resolve new base for new imports/requires
base = path.dirname(absoluteFile)
ext = path.extname(absoluteFile)
let contents = await fs.readFile(absoluteFile, 'utf-8')
// Recursively trace dependencies in parallel
let promises = []
for (let pattern of DEPENDENCY_PATTERNS) {
for (let match of contents.matchAll(pattern)) {
// Bail out if it's not a relative file
if (!match[1].startsWith('.')) continue
promises.push(traceDependencies(seen, match[1], base, ext))
}
}
await Promise.all(promises)
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does traceDependencies() do?
traceDependencies() is a function in the tailwindcss codebase.
What does traceDependencies() call?
traceDependencies() calls 1 function(s): resolveWithExtension.
What calls traceDependencies()?
traceDependencies() is called by 1 function(s): getModuleDependencies.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free