Home / Function/ lookupFile() — vite Function Reference

lookupFile() — vite Function Reference

Architecture documentation for the lookupFile() function in utils.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  934a26da_8b90_f4d4_a1d6_df7aa4fead12["lookupFile()"]
  031bc221_67a8_c579_f2bf_bb30a08beeb2["utils.ts"]
  934a26da_8b90_f4d4_a1d6_df7aa4fead12 -->|defined in| 031bc221_67a8_c579_f2bf_bb30a08beeb2
  4b382358_e92d_2c3c_8d21_bc94472fd5da["getLockfileHash()"]
  4b382358_e92d_2c3c_8d21_bc94472fd5da -->|calls| 934a26da_8b90_f4d4_a1d6_df7aa4fead12
  a9bd45ce_8339_2b77_7543_41c306ebdb02["tryStatSync()"]
  934a26da_8b90_f4d4_a1d6_df7aa4fead12 -->|calls| a9bd45ce_8339_2b77_7543_41c306ebdb02
  style 934a26da_8b90_f4d4_a1d6_df7aa4fead12 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/utils.ts lines 408–422

export function lookupFile(
  dir: string,
  fileNames: string[],
): string | undefined {
  while (dir) {
    for (const fileName of fileNames) {
      const fullPath = path.join(dir, fileName)
      if (tryStatSync(fullPath)?.isFile()) return fullPath
    }
    const parentDir = path.dirname(dir)
    if (parentDir === dir) return

    dir = parentDir
  }
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does lookupFile() do?
lookupFile() is a function in the vite codebase, defined in packages/vite/src/node/utils.ts.
Where is lookupFile() defined?
lookupFile() is defined in packages/vite/src/node/utils.ts at line 408.
What does lookupFile() call?
lookupFile() calls 1 function(s): tryStatSync.
What calls lookupFile()?
lookupFile() is called by 1 function(s): getLockfileHash.

Analyze Your Own Codebase

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

Try Supermodel Free