Skip to content

Commit

Permalink
Fix bug where ./ would always match root-patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
nafarlee committed Nov 30, 2023
1 parent c793e63 commit c33590c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions dist/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24722,11 +24722,12 @@ async function directMatch(patterns) {
}
function hoist(rootPatterns, paths) {
const roots = [];
let remaining = [...paths, "./"];
let remaining = [...paths];
do {
roots.push(...(0, import_micromatch.default)(remaining, rootPatterns));
remaining = import_micromatch.default.not(remaining, rootPatterns).map((x) => `${(0, import_path.dirname)(x)}/`).filter((x) => x !== "./");
} while (remaining.length > 0);
remaining = import_micromatch.default.not(remaining, rootPatterns).map((x) => `${(0, import_path.dirname)(x)}/`);
} while (remaining.filter((x) => x !== "./").length > 0);
roots.push(...(0, import_micromatch.default)(remaining, rootPatterns));
return Array.from(new Set(roots));
}
async function hoistMatch(rootPatterns, filterPatterns) {
Expand Down
8 changes: 4 additions & 4 deletions main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ async function directMatch(patterns) {

function hoist(rootPatterns, paths) {
const roots = [];
let remaining = [...paths, './'];
let remaining = [...paths];
do {
roots.push(...micromatch(remaining, rootPatterns));
remaining = micromatch
.not(remaining, rootPatterns)
.map((x) => `${dirname(x)}/`)
.filter((x) => x !== './');
} while (remaining.length > 0);
.map((x) => `${dirname(x)}/`);
} while (remaining.filter((x) => x !== './').length > 0);
roots.push(...micromatch(remaining, rootPatterns));
return Array.from(new Set(roots));
}

Expand Down

0 comments on commit c33590c

Please sign in to comment.