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