style
This commit is contained in:
parent
14f8f96e89
commit
eaa62d8607
|
@ -1,9 +1,9 @@
|
||||||
import cheapTS from 'rollup-plugin-cheap-ts';
|
import cheap_ts from 'rollup-plugin-cheap-ts';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
input: './src/CheapWatch',
|
input: './src/CheapWatch',
|
||||||
external: name => /^[a-z]/.test(name),
|
external: name => /^[a-z]/.test(name),
|
||||||
plugins: [cheapTS()],
|
plugins: [cheap_ts()],
|
||||||
output: [
|
output: [
|
||||||
{
|
{
|
||||||
file: './dist/CheapWatch.cjs.js',
|
file: './dist/CheapWatch.cjs.js',
|
||||||
|
|
|
@ -134,9 +134,9 @@ export default class CheapWatch extends EventEmitter {
|
||||||
// note the new directory
|
// note the new directory
|
||||||
// start watching it, and report any files in it
|
// start watching it, and report any files in it
|
||||||
await this._recurse(full);
|
await this._recurse(full);
|
||||||
for (const [newPath, stats] of this.paths.entries()) {
|
for (const [new_path, stats] of this.paths.entries()) {
|
||||||
if (newPath.startsWith(path + '/')) {
|
if (new_path.startsWith(path + '/')) {
|
||||||
this.emit('+', { path: newPath, stats, isNew: true });
|
this.emit('+', { path: new_path, stats, isNew: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,17 +147,17 @@ export default class CheapWatch extends EventEmitter {
|
||||||
this.emit('-', { path, stats });
|
this.emit('-', { path, stats });
|
||||||
if (this._watchers.has(path)) {
|
if (this._watchers.has(path)) {
|
||||||
// stop watching it, and report any files/dirs that were in it
|
// stop watching it, and report any files/dirs that were in it
|
||||||
for (const old of this._watchers.keys()) {
|
for (const old_path of this._watchers.keys()) {
|
||||||
if (old === path || old.startsWith(path + '/')) {
|
if (old_path === path || old_path.startsWith(path + '/')) {
|
||||||
this._watchers.get(old).close();
|
this._watchers.get(old_path).close();
|
||||||
this._watchers.delete(old);
|
this._watchers.delete(old_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const old of this.paths.keys()) {
|
for (const old_path of this.paths.keys()) {
|
||||||
if (old.startsWith(path + '/')) {
|
if (old_path.startsWith(path + '/')) {
|
||||||
const stats = this.paths.get(old);
|
const stats = this.paths.get(old_path);
|
||||||
this.paths.delete(old);
|
this.paths.delete(old_path);
|
||||||
this.emit('-', { path: old, stats });
|
this.emit('-', { path: old_path, stats });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue