Skip to content

Commit

Permalink
perf(findFile): test input itself if matching filename
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Mar 3, 2025
1 parent bda0f16 commit 05a0a3c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/resolve/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ export async function findFile(
const leadingSlash = basePath[0] === "/";
const segments = basePath.split("/").filter(Boolean);

// Test input itself first
if (filenames.includes(segments.at(-1)!) && (await options.test(basePath))) {
// return basePath;
}

// Restore leading slash
if (leadingSlash) {
segments[0] = "/" + segments[0];
Expand Down

0 comments on commit 05a0a3c

Please sign in to comment.