source: trip-planner-front/node_modules/enhanced-resolve/lib/ResultPlugin.js@ 188ee53

Last change on this file since 188ee53 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 831 bytes
Line 
1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5
6"use strict";
7
8/** @typedef {import("./Resolver")} Resolver */
9/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */
10
11module.exports = class ResultPlugin {
12 /**
13 * @param {ResolveStepHook} source source
14 */
15 constructor(source) {
16 this.source = source;
17 }
18
19 /**
20 * @param {Resolver} resolver the resolver
21 * @returns {void}
22 */
23 apply(resolver) {
24 this.source.tapAsync(
25 "ResultPlugin",
26 (request, resolverContext, callback) => {
27 const obj = { ...request };
28 if (resolverContext.log)
29 resolverContext.log("reporting result " + obj.path);
30 resolver.hooks.result.callAsync(obj, resolverContext, err => {
31 if (err) return callback(err);
32 callback(null, obj);
33 });
34 }
35 );
36 }
37};
Note: See TracBrowser for help on using the repository browser.