fix: match path-exclude fragments as segments, not substrings

This commit is contained in:
Stefano Amorelli committed 2026-07-06 00:27:16 +03:00
1 parent bd2463e0c3
commit 6ef4c8059e
1 file changed
+3 -4
+3 -4
View File
@@ -212,14 +212,13 @@ const EXPOSURE_BASE: Record<Exposure, number> = {
// ============================================================================= // =============================================================================
function isExcluded(path: string, excludeGlobs: string[]): boolean { function isExcluded(path: string, excludeGlobs: string[]): boolean {
// Loose match: any exclude fragment appearing as a path segment (or substring) // Bare fragments match a path SEGMENT only; glob (`*`) entries match as a
// rejects the path. Prototype-grade — not a real glob engine. // substring.
const segments = path.split(sep); const segments = path.split(sep);
for (const ex of excludeGlobs) { for (const ex of excludeGlobs) {
if (!ex) continue; if (!ex) continue;
// Treat a bare fragment as "matches any segment equal to it OR any substring".
if (segments.includes(ex)) return true; if (segments.includes(ex)) return true;
if (path.includes(ex)) return true; if (ex.includes('*') && path.includes(ex.replace(/\*/g, ''))) return true;
} }
return false; return false;
} }