Comparing version 2.0.0-beta.7 to 2.0.0-beta.8
@@ -571,7 +571,7 @@ /* | ||
const times = w.directoryWatcher.getTimes(); | ||
Object.keys(times).forEach(function(file) { | ||
for (const file of Object.keys(times)) { | ||
const time = times[file]; | ||
safeTime = Math.max(safeTime, time); | ||
obj[file] = time; | ||
}); | ||
} | ||
} | ||
@@ -578,0 +578,0 @@ obj[this.path] = safeTime; |
@@ -58,3 +58,3 @@ /* | ||
if (linkResolved.length > 1 && parentResolved.length > 1) { | ||
// when both contain links we need to depulicate them with a Set | ||
// when both contain links we need to duplicate them with a Set | ||
const resultSet = new Set(linkResolved); | ||
@@ -61,0 +61,0 @@ // add the link |
@@ -66,9 +66,10 @@ /* | ||
const oldDirWatchers = this.dirWatchers; | ||
const filter = this.watcherOptions.ignored | ||
? path => !this.watcherOptions.ignored.test(path.replace(/\\/g, "/")) | ||
const ignored = this.watcherOptions.ignored; | ||
const filter = ignored | ||
? path => !ignored.test(path.replace(/\\/g, "/")) | ||
: () => true; | ||
this.fileWatchers = []; | ||
this.dirWatchers = []; | ||
if (this.watcherOptions.followSymlinks) { | ||
const resolver = new LinkResolver(); | ||
this.fileWatchers = []; | ||
this.dirWatchers = []; | ||
for (const file of files) { | ||
@@ -117,22 +118,23 @@ if (filter(file)) { | ||
} else { | ||
this.fileWatchers = files | ||
.filter(filter) | ||
.map(file => | ||
this._fileWatcher( | ||
for (const file of files) { | ||
if (filter(file)) { | ||
const watcher = this._fileWatcher( | ||
file, | ||
watcherManager.watchFile(file, this.watcherOptions, startTime) | ||
) | ||
) | ||
.filter(Boolean); | ||
this.dirWatchers = directories | ||
.filter(filter) | ||
.map(dir => | ||
this._dirWatcher( | ||
); | ||
if (watcher) this.fileWatchers.push(watcher); | ||
} | ||
} | ||
for (const dir of directories) { | ||
if (filter(dir)) { | ||
const watcher = this._dirWatcher( | ||
dir, | ||
watcherManager.watchDirectory(dir, this.watcherOptions, startTime) | ||
) | ||
); | ||
); | ||
if (watcher) this.dirWatchers.push(watcher); | ||
} | ||
} | ||
} | ||
oldFileWatchers.forEach(w => w.close()); | ||
oldDirWatchers.forEach(w => w.close()); | ||
for (const w of oldFileWatchers) w.close(); | ||
for (const w of oldDirWatchers) w.close(); | ||
} | ||
@@ -143,4 +145,4 @@ | ||
if (this.aggregateTimeout) clearTimeout(this.aggregateTimeout); | ||
this.fileWatchers.forEach(w => w.close()); | ||
this.dirWatchers.forEach(w => w.close()); | ||
for (const w of this.fileWatchers) w.close(); | ||
for (const w of this.dirWatchers) w.close(); | ||
this.fileWatchers.length = 0; | ||
@@ -162,3 +164,3 @@ this.dirWatchers.length = 0; | ||
const times = w.getTimes(); | ||
Object.keys(times).forEach(file => (obj[file] = times[file])); | ||
for (const file of Object.keys(times)) obj[file] = times[file]; | ||
} | ||
@@ -165,0 +167,0 @@ return obj; |
{ | ||
"name": "watchpack", | ||
"version": "2.0.0-beta.7", | ||
"version": "2.0.0-beta.8", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./lib/watchpack.js", |
@@ -54,3 +54,3 @@ # watchpack | ||
// Watchpack.prototype.watch(files: string[], directories: string[], startTime?: number) | ||
// Watchpack.prototype.watch(files: Iterable<string>, directories: Iterable<string>, startTime?: number) | ||
wp.watch(listOfFiles, listOfDirectories, Date.now() - 10000); | ||
@@ -69,2 +69,3 @@ // starts watching these files and directories | ||
// removals: a Set of all removed files | ||
// watchpack gives up ownership on these Sets. | ||
}); | ||
@@ -86,3 +87,3 @@ | ||
// key: absolute path, value: object with { safeTime, timestamp } | ||
// safeTime: the time before that all changes happened | ||
// safeTime: a point in time at which it is safe to say all changes happened before that | ||
// timestamp: only for files, the mtime timestamp of the file | ||
@@ -89,0 +90,0 @@ |
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
34832
985
108