Skip to content

Commit 92a24ac

Browse files
authored
refactor: remove minimatch dependency (#462)
1 parent f770164 commit 92a24ac

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

lib/util/get-convert-path.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55
"use strict"
66

7-
const { Minimatch } = require("minimatch")
7+
const globrex = require("globrex")
88

99
/**
1010
* @typedef PathConvertion
@@ -57,13 +57,10 @@ function normalizeValue(x) {
5757

5858
/**
5959
* @param {string} pattern
60-
* @return {Minimatch}
60+
* @return {globrex.Results}
6161
*/
6262
function makeMatcher(pattern) {
63-
const posix = pattern.replace(/\\/g, "/")
64-
return new Minimatch(posix, {
65-
allowWindowsEscape: true,
66-
})
63+
return globrex(pattern, { globstar: true })
6764
}
6865

6966
/**
@@ -78,8 +75,8 @@ function createMatch(includePatterns, excludePatterns) {
7875
const exclude = excludePatterns.map(makeMatcher)
7976

8077
return filePath =>
81-
include.some(m => m.match(filePath)) &&
82-
!exclude.some(m => m.match(filePath))
78+
include.some(m => m.regex.test(filePath)) &&
79+
!exclude.some(m => m.regex.test(filePath))
8380
}
8481

8582
/**

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"globals": "^15.11.0",
2525
"globrex": "^0.1.2",
2626
"ignore": "^5.3.2",
27-
"minimatch": "^9.0.5",
2827
"semver": "^7.6.3",
2928
"ts-declaration-location": "^1.0.6"
3029
},

0 commit comments

Comments
 (0)