Skip to content

Commit

Permalink
docs(pluginutils): Correct minimatch to picomatch (#525)
Browse files Browse the repository at this point in the history
`createFilter` uses picomatch, not minimatch

https://github.com/rollup/plugins/blob/5fa15590e452d568239a6d8e1c7018865c027fe4/packages/pluginutils/src/createFilter.ts#L3

The differences are pretty subtle, but I think it's important to document them for people with more specific use cases, and for people creating packages that depend on `createFilter`.
  • Loading branch information
AlexVipond authored Aug 4, 2020
1 parent 5fa1559 commit ec804d3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/pluginutils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,16 @@ export default function myPlugin(options = {}) {

Constructs a filter function which can be used to determine whether or not certain modules should be operated upon.

Parameters: `(include?: <minmatch>, exclude?: <minmatch>, options?: Object)`<br>
Parameters: `(include?: <picomatch>, exclude?: <picomatch>, options?: Object)`<br>
Returns: `String`

#### `include` and `exclude`

Type: `String | RegExp | Array[...String|RegExp]`<br>

A valid [`minimatch`](https://www.npmjs.com/package/minimatch) pattern, or array of patterns. If `options.include` is omitted or has zero length, filter will return `true` by default. Otherwise, an ID must match one or more of the `minimatch` patterns, and must not match any of the `options.exclude` patterns.
A valid [`picomatch`](https://github.com/micromatch/picomatch#globbing-features) pattern, or array of patterns. If `options.include` is omitted or has zero length, filter will return `true` by default. Otherwise, an ID must match one or more of the `picomatch` patterns, and must not match any of the `options.exclude` patterns.

Note that `picomatch` patterns are very similar to [`minimatch`](https://github.com/isaacs/minimatch#readme) patterns, and in most use cases, they are interchangeable. If you have more specific pattern matching needs, you can view [this comparison table](https://github.com/micromatch/picomatch#library-comparisons) to learn more about where the libraries differ.

#### `options`

Expand Down

0 comments on commit ec804d3

Please sign in to comment.