Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

Commit

Permalink
Add "resolve" option to createFilter (#61)
Browse files Browse the repository at this point in the history
* Add option to create a filter relative to a base dir

* Also allow disabling resolution altogether

* Use npm ci for testing, add Node 12 test

* Update dependencies

* Specify the absolute dir in a more platform independent way

* Also resolve strings starting with `\0`

* Remove ability to resolve strings starting with `\0` again

* Update dependencies
  • Loading branch information
lukastaegert committed May 15, 2019
1 parent b8d5c4a commit e15f18a
Show file tree
Hide file tree
Showing 7 changed files with 961 additions and 1,235 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ node_js:
- "6"
- "8"
- "10"
- "12"
env:
global:
- BUILD_TIMEOUT=10000
install: npm install --ignore-scripts
install: npm ci --ignore-scripts
before_install:
- if [[ $TRAVIS_NODE_VERSION -lt 8 ]]; then npm install --global npm@5; fi
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ export default function myPlugin ( options = {} ) {
}
```

If you want to resolve the patterns against a directory other than
`process.cwd()`, you can additionally pass a `resolve` option:

```js
var filter = createFilter( options.include, options.exclude, {resolve: '/my/base/dir'} )
```

If `resolve` is a string, then this value will be used as the base directory.
Relative paths will be resolved against `process.cwd()` first. If `resolve` is
`false`, then the patterns will not be resolved against any directory. This can
be useful if you want to create a filter for virtual module names.


### makeLegalIdentifier

Expand Down

0 comments on commit e15f18a

Please sign in to comment.