diff --git a/package.json b/package.json index 0e5b85a..3772abb 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", diff --git a/src/util/builtinOperators.ts b/src/util/builtinOperators.ts index 6a5c6ae..e8b4f57 100644 --- a/src/util/builtinOperators.ts +++ b/src/util/builtinOperators.ts @@ -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 { @@ -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. diff --git a/yarn.lock b/yarn.lock index 8e17710..d29d8c6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" @@ -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" @@ -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"