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