Skip to content

refactor(pluginutils): replace micromatch with more lightweight picomatch. #306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.