Comparing version 3.4.0 to 3.4.1
14
index.js
@@ -879,6 +879,16 @@ 'use strict'; | ||
/** | ||
* | ||
* Closes all watchers for a path | ||
* @param {Path} path | ||
*/ | ||
_closePath(path) { | ||
this._closeFile(path) | ||
const dir = sysPath.dirname(path); | ||
this._getWatchedDir(dir).remove(sysPath.basename(path)); | ||
} | ||
/** | ||
* Closes only file-specific watchers | ||
* @param {Path} path | ||
*/ | ||
_closeFile(path) { | ||
const closers = this._closers.get(path); | ||
@@ -888,4 +898,2 @@ if (!closers) return; | ||
this._closers.delete(path); | ||
const dir = sysPath.dirname(path); | ||
this._getWatchedDir(dir).remove(sysPath.basename(path)); | ||
} | ||
@@ -892,0 +900,0 @@ |
@@ -62,1 +62,2 @@ 'use strict'; | ||
exports.isMacos = platform === 'darwin'; | ||
exports.isLinux = platform === 'linux'; |
@@ -106,3 +106,3 @@ 'use strict'; | ||
*/ | ||
function setFSEventsListener(path, realPath, listener, rawEmitter, fsw) { | ||
function setFSEventsListener(path, realPath, listener, rawEmitter) { | ||
let watchPath = sysPath.extname(path) ? sysPath.dirname(path) : path; | ||
@@ -150,3 +150,3 @@ const parentPath = sysPath.dirname(watchPath); | ||
watcher: createFSEventsInstance(watchPath, (fullPath, flags) => { | ||
if (fsw.closed) return; | ||
if (!cont.listeners.size) return; | ||
const info = fsevents.getInfo(fullPath, flags); | ||
@@ -358,4 +358,3 @@ cont.listeners.forEach(list => { | ||
watchCallback, | ||
this.fsw._emitRaw, | ||
this.fsw | ||
this.fsw._emitRaw | ||
); | ||
@@ -362,0 +361,0 @@ |
@@ -9,2 +9,3 @@ 'use strict'; | ||
isWindows, | ||
isLinux, | ||
EMPTY_FN, | ||
@@ -360,4 +361,3 @@ EMPTY_STR, | ||
// kick off the watcher | ||
const closer = this._watchWithNodeFs(file, async (path, newStats) => { | ||
const listener = async (path, newStats) => { | ||
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5)) return; | ||
@@ -374,3 +374,9 @@ if (!newStats || newStats.mtimeMs === 0) { | ||
} | ||
prevStats = newStats; | ||
if (isLinux && prevStats.ino !== newStats.ino) { | ||
this.fsw._closeFile(path) | ||
prevStats = newStats; | ||
this.fsw._addPathCloser(path, this._watchWithNodeFs(file, listener)); | ||
} else { | ||
prevStats = newStats; | ||
} | ||
} catch (error) { | ||
@@ -380,3 +386,3 @@ // Fix issues where mtime is null but file is still present | ||
} | ||
// add is about to be emitted if file not already tracked in parent | ||
// add is about to be emitted if file not already tracked in parent | ||
} else if (parent.has(basename)) { | ||
@@ -391,3 +397,5 @@ // Check that change event was not fired because of changed only accessTime. | ||
} | ||
}); | ||
} | ||
// kick off the watcher | ||
const closer = this._watchWithNodeFs(file, listener); | ||
@@ -394,0 +402,0 @@ // emit an add event if we're supposed to |
{ | ||
"name": "chokidar", | ||
"description": "A neat wrapper around node.js fs.watch / fs.watchFile / fsevents.", | ||
"version": "3.4.0", | ||
"version": "3.4.1", | ||
"homepage": "https://github.com/paulmillr/chokidar", | ||
@@ -28,6 +28,6 @@ "author": "Paul Miller (https://paulmillr.com)", | ||
"devDependencies": { | ||
"@types/node": "^13", | ||
"@types/node": "^14", | ||
"chai": "^4.2", | ||
"dtslint": "^3.3.0", | ||
"eslint": "^6.6.0", | ||
"eslint": "^7.0.0", | ||
"mocha": "^7.0.0", | ||
@@ -34,0 +34,0 @@ "nyc": "^15.0.0", |
@@ -256,5 +256,5 @@ # Chokidar [![Weekly downloads](https://img.shields.io/npm/dw/chokidar.svg)](https://github.com/paulmillr/chokidar) [![Yearly downloads](https://img.shields.io/npm/dy/chokidar.svg)](https://github.com/paulmillr/chokidar) | ||
name and path for every event other than `ready`, `raw`, and `error`. `raw` is internal, use it carefully. | ||
* `.unwatch(path / paths)`: **async** Stop watching files, directories, or glob patterns. | ||
* `.unwatch(path / paths)`: Stop watching files, directories, or glob patterns. | ||
Takes an array of strings or just one string. Use with `await` to ensure bugs don't happen. | ||
* `.close()`: Removes all listeners from watched files. Asynchronous, returns Promise. | ||
* `.close()`: **async** Removes all listeners from watched files. Asynchronous, returns Promise. | ||
* `.getWatched()`: Returns an object representing all the paths on the file | ||
@@ -299,4 +299,10 @@ system being watched by this `FSWatcher` instance. The object's keys are all the | ||
## Also | ||
Why was chokidar named this way? What's the meaning behind it? | ||
>Chowkidar is a transliteration of a Hindi word meaning 'watchman, gatekeeper', चौकीदार. This ultimately comes from Sanskrit _ चतुष्क_ (crossway, quadrangle, consisting-of-four). | ||
## License | ||
MIT (c) Paul Miller (<https://paulmillr.com>), see [LICENSE](LICENSE) file. |
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
89589
2074
307