Skip to content

Commit

Permalink
picomatch patch → unmatch
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Feb 18, 2025
1 parent f15ca04 commit b603afc
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 66 deletions.
10 changes: 2 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,11 @@
},
"dependencies": {
"fdir": "^6.4.3",
"picomatch": "^4.0.2"
"unmatch": "^1.0.1"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
"@types/node": "^22.13.4",
"@types/picomatch": "^3.0.2",
"fs-fixture": "^2.7.0",
"tsup": "^8.3.6",
"typescript": "^5.7.3"
Expand All @@ -62,10 +61,5 @@
"access": "public",
"provenance": true
},
"packageManager": "pnpm@10.4.1",
"pnpm": {
"patchedDependencies": {
"picomatch@4.0.2": "patches/picomatch@4.0.2.patch"
}
}
"packageManager": "pnpm@10.4.1"
}
27 changes: 0 additions & 27 deletions patches/picomatch@4.0.2.patch

This file was deleted.

37 changes: 15 additions & 22 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path, { posix } from 'node:path';
import { type Options as FdirOptions, fdir } from 'fdir';
import picomatch from 'picomatch';
import match from 'unmatch';
import { escapePath, getPartialMatcher, isDynamicPattern, log, splitPattern } from './utils.ts';

const PARENT_DIRECTORY = /^(\/?\.\.)+/;
Expand Down Expand Up @@ -184,16 +184,16 @@ function crawl(options: GlobOptions, cwd: string, sync: boolean) {
log('internal processing patterns:', processed);
}

const unignoreMatcher = processed.unignore.length === 0 ? undefined : picomatch(processed.unignore);
const unignoreMatcher = processed.unignore.length === 0 ? undefined : match(processed.unignore);

const matcher = picomatch(processed.match, {
const matcher = match(processed.match, {
dot: options.dot,
nocase,
ignore: processed.ignore,
onIgnore: unignoreMatcher ? result => unignoreMatcher(result.output) : undefined
onIgnore: unignoreMatcher ? result => unignoreMatcher(result.output) && match.constants.UNIGNORE : undefined
});

const ignore = picomatch(processed.ignore, {
const ignore = match(processed.ignore, {
dot: options.dot,
nocase
});
Expand Down
8 changes: 4 additions & 4 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import picomatch, { type Matcher } from 'picomatch';
import match, { type Matcher } from 'unmatch';

// #region PARTIAL MATCHER
export interface PartialMatcherOptions {
Expand All @@ -18,7 +18,7 @@ export function getPartialMatcher(patterns: string[], options?: PartialMatcherOp
const partsCount = parts.length;
const partRegexes = Array(partsCount);
for (let j = 0; j < partsCount; j++) {
partRegexes[j] = picomatch.makeRe(parts[j], options);
partRegexes[j] = match.makeRe(parts[j], options);
}
regexes[i] = partRegexes;
}
Expand Down Expand Up @@ -72,7 +72,7 @@ const splitPatternOptions = { parts: true };

// if a pattern has no slashes outside glob symbols, results.parts is []
export function splitPattern(path: string): string[] {
const result = picomatch.scan(path, splitPatternOptions);
const result = match.scan(path, splitPatternOptions);
return result.parts?.length ? result.parts : [path];
}
// #endregion
Expand Down Expand Up @@ -129,7 +129,7 @@ export function isDynamicPattern(pattern: string, options?: { caseSensitiveMatch
return true;
}

const scan = picomatch.scan(pattern);
const scan = match.scan(pattern);
return scan.isGlob || scan.negated;
}
// #endregion
Expand Down

0 comments on commit b603afc

Please sign in to comment.