Skip to content

Commit

Permalink
refactor(pluginutils): replace micromatch with picomatch. (#306)
Browse files Browse the repository at this point in the history
* Replace micromatch with more lightweight picomatch.
This reduces dependency size.

* pluginutils: replace picomatch types with @types/picomatch.

* chore: update pnpm lock

Co-authored-by: shellscape <andrew@shellscape.org>
  • Loading branch information
p-kuen and shellscape committed May 2, 2020
1 parent 96e0900 commit 70780a0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
4 changes: 2 additions & 2 deletions packages/pluginutils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@
"dependencies": {
"@types/estree": "0.0.39",
"estree-walker": "^1.0.1",
"micromatch": "^4.0.2"
"picomatch": "^2.2.2"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-node-resolve": "^7.1.1",
"@rollup/plugin-typescript": "^3.0.0",
"@types/jest": "^24.9.0",
"@types/micromatch": "^3.1.1",
"@types/node": "^12.12.25",
"@types/picomatch": "^2.2.1",
"typescript": "^3.7.5"
},
"ava": {
Expand Down
4 changes: 2 additions & 2 deletions packages/pluginutils/src/createFilter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { resolve, sep, posix } from 'path';

import mm from 'micromatch';
import pm from 'picomatch';

import { CreateFilter } from '../types';

Expand Down Expand Up @@ -34,7 +34,7 @@ const createFilter: CreateFilter = function createFilter(include?, exclude?, opt
test: (what: string) => {
// this refactor is a tad overly verbose but makes for easy debugging
const pattern = getMatcherString(id, resolutionBase);
const fn = mm.matcher(pattern, { dot: true });
const fn = pm(pattern, { dot: true });
const result = fn(what);

return result;
Expand Down
29 changes: 14 additions & 15 deletions pnpm-lock.yaml

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

0 comments on commit 70780a0

Please sign in to comment.