feat(watching): allow suspend compilation
This commit is contained in:
parent
29068d39ce
commit
df27a5e2bd
|
@ -18,6 +18,18 @@ class MultiWatching {
|
|||
}
|
||||
}
|
||||
|
||||
suspend() {
|
||||
for (const watching of this.watchings) {
|
||||
watching.suspend();
|
||||
}
|
||||
}
|
||||
|
||||
resume() {
|
||||
for (const watching of this.watchings) {
|
||||
watching.resume();
|
||||
}
|
||||
}
|
||||
|
||||
close(callback) {
|
||||
asyncLib.forEach(
|
||||
this.watchings,
|
||||
|
|
|
@ -13,6 +13,7 @@ class Watching {
|
|||
this.handler = handler;
|
||||
this.callbacks = [];
|
||||
this.closed = false;
|
||||
this.suspended = false;
|
||||
if (typeof watchOptions === "number") {
|
||||
this.watchOptions = {
|
||||
aggregateTimeout: watchOptions
|
||||
|
@ -133,7 +134,9 @@ class Watching {
|
|||
this.compiler.fileTimestamps = fileTimestamps;
|
||||
this.compiler.contextTimestamps = contextTimestamps;
|
||||
this.compiler.removedFiles = removedFiles;
|
||||
this._invalidate();
|
||||
if (!this.suspended) {
|
||||
this._invalidate();
|
||||
}
|
||||
},
|
||||
(fileName, changeTime) => {
|
||||
this.compiler.hooks.invalid.call(fileName, changeTime);
|
||||
|
@ -166,6 +169,17 @@ class Watching {
|
|||
}
|
||||
}
|
||||
|
||||
suspend() {
|
||||
this.suspended = true;
|
||||
}
|
||||
|
||||
resume() {
|
||||
if (this.suspended) {
|
||||
this.suspended = false;
|
||||
this._invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
close(callback) {
|
||||
const finalCallback = () => {
|
||||
this.compiler.hooks.watchClose.call();
|
||||
|
|
Loading…
Reference in New Issue