remove "pass" from progress plugin

we will eventually replace the optimizing with a loop plugin
This commit is contained in:
Tobias Koppers 2017-12-13 10:09:35 +01:00
parent 140cbaad21
commit 96d91631f6
1 changed files with 7 additions and 15 deletions

View File

@ -187,31 +187,23 @@ class ProgressPlugin {
};
const numberOfHooks = Object.keys(hooks).length;
Object.keys(hooks).forEach((name, idx) => {
let pass = 0;
const title = hooks[name];
const percentage = idx / numberOfHooks * 0.25 + 0.7;
compilation.hooks[name].intercept({
name: "ProgressPlugin",
context: true,
call: () => {
if(pass++ > 0)
handler(percentage, title, `pass ${pass}`);
else
handler(percentage, title);
handler(percentage, title);
},
tap: (context, tap) => {
if(context) {
context.reportProgress = (...args) => {
if(pass > 1)
handler(percentage, title, `pass ${pass}`, tap.name, ...args);
else
handler(percentage, title, tap.name, ...args);
// p is percentage from 0 to 1
// args is any number of messages in a hierarchical matter
context.reportProgress = (p, ...args) => {
handler(percentage, title, tap.name, ...args);
};
}
if(pass > 1)
handler(percentage, title, `pass ${pass}`, tap.name);
else
handler(percentage, title, tap.name);
handler(percentage, title, tap.name);
}
});
});
@ -224,7 +216,7 @@ class ProgressPlugin {
},
tap: (context, tap) => {
if(context) {
context.reportProgress = (...args) => {
context.reportProgress = (p, ...args) => {
handler(0.95, "emitting", tap.name, ...args);
};
}