@parcel/watcher
Advanced tools
Comparing version 2.0.7 to 2.1.0
declare type FilePath = string; | ||
declare type GlobPattern = string; | ||
@@ -12,3 +13,3 @@ declare namespace ParcelWatcher { | ||
export interface Options { | ||
ignore?: FilePath[]; | ||
ignore?: (FilePath|GlobPattern)[]; | ||
backend?: BackendType; | ||
@@ -15,0 +16,0 @@ } |
37
index.js
const binding = require('node-gyp-build')(__dirname); | ||
const path = require('path'); | ||
const micromatch = require('micromatch'); | ||
const isGlob = require('is-glob'); | ||
function normalizeOptions(dir, opts = {}) { | ||
if (Array.isArray(opts.ignore)) { | ||
opts = Object.assign({}, opts, { | ||
ignore: opts.ignore.map((ignore) => path.resolve(dir, ignore)), | ||
}); | ||
const { ignore, ...rest } = opts; | ||
if (Array.isArray(ignore)) { | ||
opts = { ...rest }; | ||
for (const value of ignore) { | ||
if (isGlob(value)) { | ||
if (!opts.ignoreGlobs) { | ||
opts.ignoreGlobs = []; | ||
} | ||
const regex = micromatch.makeRe(value, { | ||
// We set `dot: true` to workaround an issue with the | ||
// regular expression on Linux where the resulting | ||
// negative lookahead `(?!(\\/|^)` was never matching | ||
// in some cases. See also https://bit.ly/3UZlQDm | ||
dot: true, | ||
// C++ does not support lookbehind regex patterns, they | ||
// were only added later to JavaScript engines | ||
// (https://bit.ly/3V7S6UL) | ||
lookbehinds: false | ||
}); | ||
opts.ignoreGlobs.push(regex.source); | ||
} else { | ||
if (!opts.ignorePaths) { | ||
opts.ignorePaths = []; | ||
} | ||
opts.ignorePaths.push(path.resolve(dir, value)); | ||
} | ||
} | ||
} | ||
@@ -10,0 +39,0 @@ |
{ | ||
"name": "@parcel/watcher", | ||
"version": "2.0.7", | ||
"version": "2.1.0", | ||
"main": "index.js", | ||
@@ -51,2 +51,4 @@ "types": "index.d.ts", | ||
"dependencies": { | ||
"is-glob": "^4.0.3", | ||
"micromatch": "^4.0.5", | ||
"node-addon-api": "^3.2.1", | ||
@@ -58,5 +60,5 @@ "node-gyp-build": "^4.3.0" | ||
"husky": "^7.0.2", | ||
"lint-staged": "^11.1.2", | ||
"mocha": "^9.1.1", | ||
"prebuildify": "^4.2.1", | ||
"lint-staged": "^11.1.2", | ||
"prettier": "^2.3.2" | ||
@@ -63,0 +65,0 @@ }, |
@@ -105,3 +105,5 @@ # @parcel/watcher | ||
- `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 can be relative or 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. | ||
@@ -108,0 +110,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2194421
42
112
121
4
+ Addedis-glob@^4.0.3
+ Addedmicromatch@^4.0.5
+ Addedbraces@3.0.3(transitive)
+ Addedfill-range@7.1.1(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-glob@4.0.3(transitive)
+ Addedis-number@7.0.0(transitive)
+ Addedmicromatch@4.0.8(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedto-regex-range@5.0.1(transitive)