1 |
3a515b92
|
cagy
|
/*
|
2 |
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
3 |
|
|
Author Tobias Koppers @sokra
|
4 |
|
|
*/
|
5 |
|
|
"use strict";
|
6 |
|
|
|
7 |
|
|
module.exports = class ResultPlugin {
|
8 |
|
|
constructor(source) {
|
9 |
|
|
this.source = source;
|
10 |
|
|
}
|
11 |
|
|
|
12 |
|
|
apply(resolver) {
|
13 |
|
|
this.source.tapAsync("ResultPlugin", (request, resolverContext, callback) => {
|
14 |
|
|
const obj = Object.assign({}, request);
|
15 |
|
|
if(resolverContext.log) resolverContext.log("reporting result " + obj.path);
|
16 |
|
|
resolver.hooks.result.callAsync(obj, resolverContext, err => {
|
17 |
|
|
if(err) return callback(err);
|
18 |
|
|
callback(null, obj);
|
19 |
|
|
});
|
20 |
|
|
});
|
21 |
|
|
}
|
22 |
|
|
};
|