Projekt

Obecné

Profil

Stáhnout (733 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 AppendPlugin {
8
	constructor(source, appending, target) {
9
		this.source = source;
10
		this.appending = appending;
11
		this.target = target;
12
	}
13

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