Last change
on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
919 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 |
|
---|
11 | module.exports = class TryNextPlugin {
|
---|
12 | /**
|
---|
13 | * @param {string | ResolveStepHook} source source
|
---|
14 | * @param {string} message message
|
---|
15 | * @param {string | ResolveStepHook} target target
|
---|
16 | */
|
---|
17 | constructor(source, message, target) {
|
---|
18 | this.source = source;
|
---|
19 | this.message = message;
|
---|
20 | this.target = target;
|
---|
21 | }
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * @param {Resolver} resolver the resolver
|
---|
25 | * @returns {void}
|
---|
26 | */
|
---|
27 | apply(resolver) {
|
---|
28 | const target = resolver.ensureHook(this.target);
|
---|
29 | resolver
|
---|
30 | .getHook(this.source)
|
---|
31 | .tapAsync("TryNextPlugin", (request, resolveContext, callback) => {
|
---|
32 | resolver.doResolve(
|
---|
33 | target,
|
---|
34 | request,
|
---|
35 | this.message,
|
---|
36 | resolveContext,
|
---|
37 | callback
|
---|
38 | );
|
---|
39 | });
|
---|
40 | }
|
---|
41 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.