Skip to content

Commit

Permalink
picomatch patch → unmatch
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Dec 15, 2024
1 parent 413c6c1 commit 39fe550
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 57 deletions.
11 changes: 11 additions & 0 deletions @types/unmatch.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
declare module 'unmatch' {
import picomatch = require('picomatch');

const unmatch: typeof picomatch & {
constants: typeof picomatch.constants & {
UNIGNORE: unique symbol;
}
};

export = unmatch;
}
9 changes: 2 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"homepage": "https://github.com/SuperchupuDev/tinyglobby#readme",
"dependencies": {
"fdir": "^6.4.2",
"picomatch": "^4.0.2"
"unmatch": "^1.0.0"
},
"devDependencies": {
"@biomejs/biome": "^1.9.4",
Expand All @@ -59,10 +59,5 @@
"access": "public",
"provenance": true
},
"packageManager": "pnpm@9.13.2",
"pnpm": {
"patchedDependencies": {
"picomatch@4.0.2": "patches/picomatch@4.0.2.patch"
}
}
"packageManager": "pnpm@9.13.2"
}
27 changes: 0 additions & 27 deletions patches/picomatch@4.0.2.patch

This file was deleted.

29 changes: 15 additions & 14 deletions pnpm-lock.yaml

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

12 changes: 6 additions & 6 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 unmatch from 'unmatch';
import { isDynamicPattern } from './utils.ts';

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

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

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

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

const ignore = picomatch(processed.ignore, {
const ignore = unmatch(processed.ignore, {
dot: options.dot,
nocase: options.caseSensitiveMatch === false
});

const exclude = picomatch('*(../)**', {
const exclude = unmatch('*(../)**', {
dot: true,
nocase: options.caseSensitiveMatch === false,
ignore: processed.transformed
Expand Down
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import picomatch from 'picomatch';
import unmatch from 'unmatch';

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

const scan = picomatch.scan(pattern);
const scan = unmatch.scan(pattern);
return scan.isGlob || scan.negated;
}
// #endregion
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
"noEmit": true,
"skipLibCheck": true,

"strict": true
"strict": true,

"typeRoots": ["./node_modules/@types", "./@types"]
}
}

0 comments on commit 39fe550

Please sign in to comment.