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 committed 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
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.