1
|
/*
|
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 LogInfoPlugin {
|
8
|
constructor(source) {
|
9
|
this.source = source;
|
10
|
}
|
11
|
|
12
|
apply(resolver) {
|
13
|
const source = this.source;
|
14
|
resolver.getHook(this.source).tapAsync("LogInfoPlugin", (request, resolveContext, callback) => {
|
15
|
if(!resolveContext.log) return callback();
|
16
|
const log = resolveContext.log;
|
17
|
const prefix = "[" + source + "] ";
|
18
|
if(request.path) log(prefix + "Resolving in directory: " + request.path);
|
19
|
if(request.request) log(prefix + "Resolving request: " + request.request);
|
20
|
if(request.module) log(prefix + "Request is an module request.");
|
21
|
if(request.directory) log(prefix + "Request is a directory request.");
|
22
|
if(request.query) log(prefix + "Resolving request query: " + request.query);
|
23
|
if(request.descriptionFilePath) log(prefix + "Has description data from " + request.descriptionFilePath);
|
24
|
if(request.relativePath) log(prefix + "Relative path from description file is: " + request.relativePath);
|
25
|
callback();
|
26
|
});
|
27
|
}
|
28
|
};
|