Sha256: feabd67b3ebcb21031b7fed3c448008b7083999fd0081110dbe6ecc2538ac627

Contents?: true

Size: 1.39 KB

Versions: 13

Compression:

Stored size: 1.39 KB

Contents

/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author Tobias Koppers @sokra
*/
"use strict";

const concord = require("./concord");
const DescriptionFileUtils = require("./DescriptionFileUtils");
const forEachBail = require("./forEachBail");

module.exports = class ConcordExtensionsPlugin {
	constructor(source, options, target) {
		this.source = source;
		this.options = options;
		this.target = target;
	}

	apply(resolver) {
		const target = resolver.ensureHook(this.target);
		resolver.getHook(this.source).tapAsync("ConcordExtensionsPlugin", (request, resolveContext, callback) => {
			const concordField = DescriptionFileUtils.getField(request.descriptionFileData, "concord");
			if(!concordField) return callback();
			const extensions = concord.getExtensions(request.context, concordField);
			if(!extensions) return callback();
			forEachBail(extensions, (appending, callback) => {
				const obj = Object.assign({}, request, {
					path: request.path + appending,
					relativePath: request.relativePath && (request.relativePath + appending)
				});
				resolver.doResolve(target, obj, "concord extension: " + appending, resolveContext, callback);
			}, (err, result) => {
				if(err) return callback(err);

				// Don't allow other processing
				if(result === undefined) return callback(null, null);
				callback(null, result);
			});
		});
	}
};

Version data entries

13 entries across 13 versions & 6 rubygems

Version Path
disco_app-0.18.0 test/dummy/node_modules/enhanced-resolve/lib/ConcordExtensionsPlugin.js
disco_app-0.18.2 test/dummy/node_modules/enhanced-resolve/lib/ConcordExtensionsPlugin.js
enju_library-0.3.8 spec/dummy/node_modules/enhanced-resolve/lib/ConcordExtensionsPlugin.js
jester-data-8.0.0 node_modules/enhanced-resolve/lib/ConcordExtensionsPlugin.js
ezii-os-5.2.1 node_modules/enhanced-resolve/lib/ConcordExtensionsPlugin.js
ezii-os-2.0.1 node_modules/enhanced-resolve/lib/ConcordExtensionsPlugin.js
ezii-os-1.1.0 node_modules/enhanced-resolve/lib/ConcordExtensionsPlugin.js
ezii-os-1.0.0 node_modules/enhanced-resolve/lib/ConcordExtensionsPlugin.js
ezii-os-0.0.0.1.0 node_modules/enhanced-resolve/lib/ConcordExtensionsPlugin.js
ezii-os-0.0.0.0.1 node_modules/enhanced-resolve/lib/ConcordExtensionsPlugin.js
locomotivecms-4.0.0.alpha1 app/javascript/node_modules/enhanced-resolve/lib/ConcordExtensionsPlugin.js
locomotivecms-3.4.0 app/javascript/node_modules/enhanced-resolve/lib/ConcordExtensionsPlugin.js
dragonfly_puppeteer-0.1.0 node_modules/enhanced-resolve/lib/ConcordExtensionsPlugin.js