Skip to content
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

Support simple glob patterns for ignore rules #106

Merged
merged 14 commits into from
Jan 5, 2023
Prev Previous commit
Next Next commit
update docs
bpasero committed Dec 19, 2022

Verified

This commit was signed with the committer’s verified signature.
targos Michaël Zasso
commit 3c513c032d9aff23bf293943016a49e64ecbed0e
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -102,7 +102,9 @@ You can specify the exact backend you wish to use by passing the `backend` optio

All of the APIs in `@parcel/watcher` support the following options, which are passed as an object as the last function argument.

- `ignore` - an array of paths to ignore. They can be either files or directories. No events will be emitted about these files or directories or their children.
- `ignore` - an array of paths or glob patterns to ignore. uses [`is-glob`](https://github.com/micromatch/is-glob) to distinguish paths from globs. glob patterns are parsed with [`micromatch`](https://github.com/micromatch/micromatch) (see [features](https://github.com/micromatch/micromatch#matching-features)).
- paths have to be absolute and can either be files or directories. No events will be emitted about these files or directories or their children.
- glob patterns match on relative paths from the root that is watched. No events will be emitted for matching paths.
- `backend` - the name of an explicitly chosen backend to use. Allowed options are `"fs-events"`, `"watchman"`, `"inotify"`, `"windows"`, or `"brute-force"` (only for querying). If the specified backend is not available on the current platform, the default backend will be used instead.

## Who is using this?
3 changes: 2 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
declare type FilePath = string;
declare type GlobPattern = string;

declare namespace ParcelWatcher {
export type BackendType =
@@ -9,7 +10,7 @@ declare namespace ParcelWatcher {
| 'brute-force';
export type EventType = 'create' | 'update' | 'delete';
export interface Options {
ignore?: FilePath[];
ignore?: (FilePath|GlobPattern)[];
backend?: BackendType;
}
export type SubscribeCallback = (
3 changes: 2 additions & 1 deletion index.js.flow
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @flow
declare type FilePath = string;
declare type GlobPattern = string;

export type BackendType =
| 'fs-events'
@@ -9,7 +10,7 @@ export type BackendType =
| 'brute-force';
export type EventType = 'create' | 'update' | 'delete';
export interface Options {
ignore?: Array<FilePath>,
ignore?: Array<FilePath | GlobPattern>,
backend?: BackendType
}
export type SubscribeCallback = (