Skip to content

Commit 39fe550

Browse files
committed
picomatch patch → unmatch
1 parent 413c6c1 commit 39fe550

7 files changed

Lines changed: 39 additions & 57 deletions

File tree

@types/unmatch.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
declare module 'unmatch' {
2+
import picomatch = require('picomatch');
3+
4+
const unmatch: typeof picomatch & {
5+
constants: typeof picomatch.constants & {
6+
UNIGNORE: unique symbol;
7+
}
8+
};
9+
10+
export = unmatch;
11+
}

package.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"homepage": "https://github.com/SuperchupuDev/tinyglobby#readme",
4343
"dependencies": {
4444
"fdir": "^6.4.2",
45-
"picomatch": "^4.0.2"
45+
"unmatch": "^1.0.0"
4646
},
4747
"devDependencies": {
4848
"@biomejs/biome": "^1.9.4",
@@ -59,10 +59,5 @@
5959
"access": "public",
6060
"provenance": true
6161
},
62-
"packageManager": "pnpm@9.13.2",
63-
"pnpm": {
64-
"patchedDependencies": {
65-
"picomatch@4.0.2": "patches/picomatch@4.0.2.patch"
66-
}
67-
}
62+
"packageManager": "pnpm@9.13.2"
6863
}

patches/picomatch@4.0.2.patch

Lines changed: 0 additions & 27 deletions
This file was deleted.

pnpm-lock.yaml

Lines changed: 15 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import path, { posix } from 'node:path';
22
import { type Options as FdirOptions, fdir } from 'fdir';
3-
import picomatch from 'picomatch';
3+
import unmatch from 'unmatch';
44
import { isDynamicPattern } from './utils.ts';
55

66
export interface GlobOptions {
@@ -177,21 +177,21 @@ function crawl(options: GlobOptions, cwd: string, sync: boolean) {
177177

178178
const processed = processPatterns(options, cwd, properties);
179179

180-
const unignoreMatcher = processed.unignore.length === 0 ? undefined : picomatch(processed.unignore)
180+
const unignoreMatcher = processed.unignore.length === 0 ? undefined : unmatch(processed.unignore)
181181

182-
const matcher = picomatch(processed.match, {
182+
const matcher = unmatch(processed.match, {
183183
dot: options.dot,
184184
nocase: options.caseSensitiveMatch === false,
185185
ignore: processed.ignore,
186-
onIgnore: unignoreMatcher ? (result => unignoreMatcher(result.output)) : undefined
186+
onIgnore: unignoreMatcher ? (result => unignoreMatcher(result.output) && unmatch.constants.UNIGNORE) : undefined
187187
});
188188

189-
const ignore = picomatch(processed.ignore, {
189+
const ignore = unmatch(processed.ignore, {
190190
dot: options.dot,
191191
nocase: options.caseSensitiveMatch === false
192192
});
193193

194-
const exclude = picomatch('*(../)**', {
194+
const exclude = unmatch('*(../)**', {
195195
dot: true,
196196
nocase: options.caseSensitiveMatch === false,
197197
ignore: processed.transformed

src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import picomatch from 'picomatch';
1+
import unmatch from 'unmatch';
22

33
// #region convertPathToPattern
44
const ESCAPED_WIN32_BACKSLASHES = /\\(?![()[\]{}!+@])/g;
@@ -49,7 +49,7 @@ export function isDynamicPattern(pattern: string, options?: { caseSensitiveMatch
4949
return true;
5050
}
5151

52-
const scan = picomatch.scan(pattern);
52+
const scan = unmatch.scan(pattern);
5353
return scan.isGlob || scan.negated;
5454
}
5555
// #endregion

tsconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
"noEmit": true,
1818
"skipLibCheck": true,
1919

20-
"strict": true
20+
"strict": true,
21+
22+
"typeRoots": ["./node_modules/@types", "./@types"]
2123
}
2224
}

0 commit comments

Comments
 (0)