Projekt

Obecné

Profil

Stáhnout (744 Bajtů) Statistiky
| Větev: | Revize:
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 JoinRequestPlugin {
8
	constructor(source, target) {
9
		this.source = source;
10
		this.target = target;
11
	}
12

    
13
	apply(resolver) {
14
		const target = resolver.ensureHook(this.target);
15
		resolver.getHook(this.source).tapAsync("JoinRequestPlugin", (request, resolveContext, callback) => {
16
			const obj = Object.assign({}, request, {
17
				path: resolver.join(request.path, request.request),
18
				relativePath: request.relativePath && resolver.join(request.relativePath, request.request),
19
				request: undefined
20
			});
21
			resolver.doResolve(target, obj, null, resolveContext, callback);
22
		});
23
	}
24
};
(14-14/39)