Skip to content

Commit 96d9163

Browse files
committed
remove "pass" from progress plugin
we will eventually replace the optimizing with a loop plugin
1 parent 140cbaa commit 96d9163

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

lib/ProgressPlugin.js

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -187,31 +187,23 @@ class ProgressPlugin {
187187
};
188188
const numberOfHooks = Object.keys(hooks).length;
189189
Object.keys(hooks).forEach((name, idx) => {
190-
let pass = 0;
191190
const title = hooks[name];
192191
const percentage = idx / numberOfHooks * 0.25 + 0.7;
193192
compilation.hooks[name].intercept({
194193
name: "ProgressPlugin",
195194
context: true,
196195
call: () => {
197-
if(pass++ > 0)
198-
handler(percentage, title, `pass ${pass}`);
199-
else
200-
handler(percentage, title);
196+
handler(percentage, title);
201197
},
202198
tap: (context, tap) => {
203199
if(context) {
204-
context.reportProgress = (...args) => {
205-
if(pass > 1)
206-
handler(percentage, title, `pass ${pass}`, tap.name, ...args);
207-
else
208-
handler(percentage, title, tap.name, ...args);
200+
// p is percentage from 0 to 1
201+
// args is any number of messages in a hierarchical matter
202+
context.reportProgress = (p, ...args) => {
203+
handler(percentage, title, tap.name, ...args);
209204
};
210205
}
211-
if(pass > 1)
212-
handler(percentage, title, `pass ${pass}`, tap.name);
213-
else
214-
handler(percentage, title, tap.name);
206+
handler(percentage, title, tap.name);
215207
}
216208
});
217209
});
@@ -224,7 +216,7 @@ class ProgressPlugin {
224216
},
225217
tap: (context, tap) => {
226218
if(context) {
227-
context.reportProgress = (...args) => {
219+
context.reportProgress = (p, ...args) => {
228220
handler(0.95, "emitting", tap.name, ...args);
229221
};
230222
}

0 commit comments

Comments
 (0)