Last change
on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.4 KB
|
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 |
|
---|
10 | module.exports = class LogInfoPlugin {
|
---|
11 | constructor(source) {
|
---|
12 | this.source = source;
|
---|
13 | }
|
---|
14 |
|
---|
15 | /**
|
---|
16 | * @param {Resolver} resolver the resolver
|
---|
17 | * @returns {void}
|
---|
18 | */
|
---|
19 | apply(resolver) {
|
---|
20 | const source = this.source;
|
---|
21 | resolver
|
---|
22 | .getHook(this.source)
|
---|
23 | .tapAsync("LogInfoPlugin", (request, resolveContext, callback) => {
|
---|
24 | if (!resolveContext.log) return callback();
|
---|
25 | const log = resolveContext.log;
|
---|
26 | const prefix = "[" + source + "] ";
|
---|
27 | if (request.path)
|
---|
28 | log(prefix + "Resolving in directory: " + request.path);
|
---|
29 | if (request.request)
|
---|
30 | log(prefix + "Resolving request: " + request.request);
|
---|
31 | if (request.module) log(prefix + "Request is an module request.");
|
---|
32 | if (request.directory) log(prefix + "Request is a directory request.");
|
---|
33 | if (request.query)
|
---|
34 | log(prefix + "Resolving request query: " + request.query);
|
---|
35 | if (request.fragment)
|
---|
36 | log(prefix + "Resolving request fragment: " + request.fragment);
|
---|
37 | if (request.descriptionFilePath)
|
---|
38 | log(
|
---|
39 | prefix + "Has description data from " + request.descriptionFilePath
|
---|
40 | );
|
---|
41 | if (request.relativePath)
|
---|
42 | log(
|
---|
43 | prefix +
|
---|
44 | "Relative path from description file is: " +
|
---|
45 | request.relativePath
|
---|
46 | );
|
---|
47 | callback();
|
---|
48 | });
|
---|
49 | }
|
---|
50 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.