Skip to content

Commit 6be1b06

Browse files
authored
fix: transfer from micromatch to picomatch (#264)
* fix: transfer from micromatch to picomatch This will remove dependency on `node/utils` Signed-off-by: Zxilly <zhouxinyu1001@gmail.com> * build: update yarn.lock Signed-off-by: Zxilly <zhouxinyu1001@gmail.com>
1 parent 9232afa commit 6be1b06

File tree

3 files changed

+9
-17
lines changed

3 files changed

+9
-17
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@semantic-release/release-notes-generator": "^9.0.2",
2929
"@types/jest": "^26.0.20",
3030
"@types/lodash": "^4.14.168",
31-
"@types/micromatch": "^4.0.1",
31+
"@types/picomatch": "^2.2.2",
3232
"@types/node": "^10.5.3",
3333
"@typescript-eslint/eslint-plugin": "^4.17.0",
3434
"@typescript-eslint/parser": "^4.17.0",
@@ -53,7 +53,7 @@
5353
"await-lock": "^2.0.1",
5454
"csv-parse": "^4.15.3",
5555
"expression-eval": "^2.0.0",
56-
"micromatch": "^4.0.2"
56+
"picomatch": "^2.2.3"
5757
},
5858
"files": [
5959
"lib",

src/util/builtinOperators.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import * as rbac from '../rbac';
1616
import { ip } from './ip';
17-
import { isMatch } from 'micromatch';
17+
import * as picomatch from 'picomatch';
1818

1919
// regexMatch determines whether key1 matches the pattern of key2 in regular expression.
2020
function regexMatch(key1: string, key2: string): boolean {
@@ -230,8 +230,7 @@ function ipMatchFunc(...args: any[]): boolean {
230230
* ```
231231
*/
232232
function globMatch(string: string, pattern: string): boolean {
233-
const ok = isMatch(string, pattern);
234-
return ok;
233+
return picomatch(pattern)(string);
235234
}
236235

237236
// generateGFunction is the factory method of the g(_, _) function.

yarn.lock

+5-12
Original file line numberDiff line numberDiff line change
@@ -959,11 +959,6 @@
959959
dependencies:
960960
"@babel/types" "^7.3.0"
961961

962-
"@types/braces@*":
963-
version "3.0.0"
964-
resolved "https://registry.npmjs.org/@types/braces/-/braces-3.0.0.tgz#7da1c0d44ff1c7eb660a36ec078ea61ba7eb42cb"
965-
integrity sha512-TbH79tcyi9FHwbyboOKeRachRq63mSuWYXOflsNO9ZyE5ClQ/JaozNKl+aWUq87qPNsXasXxi2AbgfwIJ+8GQw==
966-
967962
"@types/graceful-fs@^4.1.2":
968963
version "4.1.5"
969964
resolved "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.5.tgz#21ffba0d98da4350db64891f92a9e5db3cdb4e15"
@@ -1008,13 +1003,6 @@
10081003
resolved "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.168.tgz#fe24632e79b7ade3f132891afff86caa5e5ce008"
10091004
integrity sha512-oVfRvqHV/V6D1yifJbVRU3TMp8OT6o6BG+U9MkwuJ3U8/CsDHvalRpsxBqivn71ztOFZBTfJMvETbqHiaNSj7Q==
10101005

1011-
"@types/micromatch@^4.0.1":
1012-
version "4.0.1"
1013-
resolved "https://registry.npmjs.org/@types/micromatch/-/micromatch-4.0.1.tgz#9381449dd659fc3823fd2a4190ceacc985083bc7"
1014-
integrity sha512-my6fLBvpY70KattTNzYOK6KU1oR1+UCz9ug/JbcF5UrEmeCt9P7DV2t7L8+t18mMPINqGQCE4O8PLOPbI84gxw==
1015-
dependencies:
1016-
"@types/braces" "*"
1017-
10181006
"@types/minimatch@^3.0.3":
10191007
version "3.0.4"
10201008
resolved "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.4.tgz#f0ec25dbf2f0e4b18647313ac031134ca5b24b21"
@@ -1045,6 +1033,11 @@
10451033
resolved "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0"
10461034
integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==
10471035

1036+
"@types/picomatch@^2.2.2":
1037+
version "2.2.2"
1038+
resolved "https://registry.npmjs.org/@types/picomatch/-/picomatch-2.2.2.tgz#e0022f77aa64475ff20326e9ff9728aaae191503"
1039+
integrity sha512-XygLVvHxaFK0w9sDf7Mk1wrugM0ig44Y5Fb2NmQcvznPkEfENprS6GhXVoO3AGicbhkRrmu9J7Lu7FFKqkCS8g==
1040+
10481041
"@types/prettier@^2.0.0":
10491042
version "2.2.3"
10501043
resolved "https://registry.npmjs.org/@types/prettier/-/prettier-2.2.3.tgz#ef65165aea2924c9359205bf748865b8881753c0"

0 commit comments

Comments
 (0)