Skip to content

Commit

Permalink
fix: transfer from micromatch to picomatch (#264)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
Zxilly authored May 2, 2021
1 parent 9232afa commit 6be1b06
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@semantic-release/release-notes-generator": "^9.0.2",
"@types/jest": "^26.0.20",
"@types/lodash": "^4.14.168",
"@types/micromatch": "^4.0.1",
"@types/picomatch": "^2.2.2",
"@types/node": "^10.5.3",
"@typescript-eslint/eslint-plugin": "^4.17.0",
"@typescript-eslint/parser": "^4.17.0",
Expand All @@ -53,7 +53,7 @@
"await-lock": "^2.0.1",
"csv-parse": "^4.15.3",
"expression-eval": "^2.0.0",
"micromatch": "^4.0.2"
"picomatch": "^2.2.3"
},
"files": [
"lib",
Expand Down
5 changes: 2 additions & 3 deletions src/util/builtinOperators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import * as rbac from '../rbac';
import { ip } from './ip';
import { isMatch } from 'micromatch';
import * as picomatch from 'picomatch';

// regexMatch determines whether key1 matches the pattern of key2 in regular expression.
function regexMatch(key1: string, key2: string): boolean {
Expand Down Expand Up @@ -230,8 +230,7 @@ function ipMatchFunc(...args: any[]): boolean {
* ```
*/
function globMatch(string: string, pattern: string): boolean {
const ok = isMatch(string, pattern);
return ok;
return picomatch(pattern)(string);
}

// generateGFunction is the factory method of the g(_, _) function.
Expand Down
17 changes: 5 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -959,11 +959,6 @@
dependencies:
"@babel/types" "^7.3.0"

"@types/braces@*":
version "3.0.0"
resolved "https://registry.npmjs.org/@types/braces/-/braces-3.0.0.tgz#7da1c0d44ff1c7eb660a36ec078ea61ba7eb42cb"
integrity sha512-TbH79tcyi9FHwbyboOKeRachRq63mSuWYXOflsNO9ZyE5ClQ/JaozNKl+aWUq87qPNsXasXxi2AbgfwIJ+8GQw==

"@types/graceful-fs@^4.1.2":
version "4.1.5"
resolved "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.5.tgz#21ffba0d98da4350db64891f92a9e5db3cdb4e15"
Expand Down Expand Up @@ -1008,13 +1003,6 @@
resolved "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.168.tgz#fe24632e79b7ade3f132891afff86caa5e5ce008"
integrity sha512-oVfRvqHV/V6D1yifJbVRU3TMp8OT6o6BG+U9MkwuJ3U8/CsDHvalRpsxBqivn71ztOFZBTfJMvETbqHiaNSj7Q==

"@types/micromatch@^4.0.1":
version "4.0.1"
resolved "https://registry.npmjs.org/@types/micromatch/-/micromatch-4.0.1.tgz#9381449dd659fc3823fd2a4190ceacc985083bc7"
integrity sha512-my6fLBvpY70KattTNzYOK6KU1oR1+UCz9ug/JbcF5UrEmeCt9P7DV2t7L8+t18mMPINqGQCE4O8PLOPbI84gxw==
dependencies:
"@types/braces" "*"

"@types/minimatch@^3.0.3":
version "3.0.4"
resolved "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.4.tgz#f0ec25dbf2f0e4b18647313ac031134ca5b24b21"
Expand Down Expand Up @@ -1045,6 +1033,11 @@
resolved "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0"
integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==

"@types/picomatch@^2.2.2":
version "2.2.2"
resolved "https://registry.npmjs.org/@types/picomatch/-/picomatch-2.2.2.tgz#e0022f77aa64475ff20326e9ff9728aaae191503"
integrity sha512-XygLVvHxaFK0w9sDf7Mk1wrugM0ig44Y5Fb2NmQcvznPkEfENprS6GhXVoO3AGicbhkRrmu9J7Lu7FFKqkCS8g==

"@types/prettier@^2.0.0":
version "2.2.3"
resolved "https://registry.npmjs.org/@types/prettier/-/prettier-2.2.3.tgz#ef65165aea2924c9359205bf748865b8881753c0"
Expand Down

0 comments on commit 6be1b06

Please sign in to comment.