You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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