aboutsummaryrefslogtreecommitdiff
path: root/node_modules/watchpack/lib/DirectoryWatcher.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/watchpack/lib/DirectoryWatcher.js')
-rw-r--r--node_modules/watchpack/lib/DirectoryWatcher.js48
1 files changed, 31 insertions, 17 deletions
diff --git a/node_modules/watchpack/lib/DirectoryWatcher.js b/node_modules/watchpack/lib/DirectoryWatcher.js
index 908ff2397..8c7c9cea9 100644
--- a/node_modules/watchpack/lib/DirectoryWatcher.js
+++ b/node_modules/watchpack/lib/DirectoryWatcher.js
@@ -56,7 +56,8 @@ function DirectoryWatcher(directoryPath, options) {
ignorePermissionErrors: true,
ignored: options.ignored,
usePolling: options.poll ? true : undefined,
- interval: typeof options.poll === "number" ? options.poll : undefined
+ interval: typeof options.poll === "number" ? options.poll : undefined,
+ disableGlobbing: true
});
this.watcher.on("add", this.onFileAdded.bind(this));
this.watcher.on("addDir", this.onDirectoryAdded.bind(this));
@@ -119,24 +120,37 @@ DirectoryWatcher.prototype.setFileTime = function setFileTime(filePath, mtime, i
};
DirectoryWatcher.prototype.setDirectory = function setDirectory(directoryPath, exist, initial, type) {
- var old = this.directories[directoryPath];
- if(!old) {
- if(exist) {
- if(this.nestedWatching) {
- this.createNestedWatcher(directoryPath);
- } else {
- this.directories[directoryPath] = true;
- }
+ if(directoryPath === this.path) {
+ if(!initial && this.watchers[withoutCase(this.path)]) {
+ this.watchers[withoutCase(this.path)].forEach(function(w) {
+ w.emit("change", directoryPath, w.data, initial ? "initial" : type);
+ });
}
} else {
- if(!exist) {
- if(this.nestedWatching)
- this.directories[directoryPath].close();
- delete this.directories[directoryPath];
- if(!initial && this.watchers[withoutCase(this.path)]) {
- this.watchers[withoutCase(this.path)].forEach(function(w) {
- w.emit("change", directoryPath, w.data, initial ? "initial" : type);
- });
+ var old = this.directories[directoryPath];
+ if(!old) {
+ if(exist) {
+ if(this.nestedWatching) {
+ this.createNestedWatcher(directoryPath);
+ } else {
+ this.directories[directoryPath] = true;
+ }
+ if(!initial && this.watchers[withoutCase(this.path)]) {
+ this.watchers[withoutCase(this.path)].forEach(function(w) {
+ w.emit("change", directoryPath, w.data, initial ? "initial" : type);
+ });
+ }
+ }
+ } else {
+ if(!exist) {
+ if(this.nestedWatching)
+ this.directories[directoryPath].close();
+ delete this.directories[directoryPath];
+ if(!initial && this.watchers[withoutCase(this.path)]) {
+ this.watchers[withoutCase(this.path)].forEach(function(w) {
+ w.emit("change", directoryPath, w.data, initial ? "initial" : type);
+ });
+ }
}
}
}