Sha256: 5d4e6d70616f0e4ecb6409968dc778ed4363a502c80fa73dbd98e240cfce4f1e

Contents?: true

Size: 1.37 KB

Versions: 62

Compression:

Stored size: 1.37 KB

Contents

/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author Tobias Koppers @sokra
*/
var ContextDependencyHelpers = exports;

ContextDependencyHelpers.create = function(Dep, range, param, expr, options) {
	if(param.isWrapped() && param.prefix.isString()) {
		var prefix = param.prefix.string;
		var postfix = param.postfix.isString() ? param.postfix.string : "";
		var prefixRange = param.prefix.range;
		var valueRange = [prefixRange ? prefixRange[1] : param.range[0], param.range[1]];
		var idx = prefix.lastIndexOf("/");
		var context = ".";
		if(idx >= 0) {
			context = prefix.substr(0, idx);
			prefix = "." + prefix.substr(idx);
		}
		var regExp = new RegExp("^" +
			prefix.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") +
			options.wrappedContextRegExp.source +
			postfix.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") + "$");
		var dep = new Dep(context, options.wrappedContextRecursive, regExp, range, valueRange);
		dep.loc = expr.loc;
		dep.prepend = prefix;
		dep.critical = options.wrappedContextCritical && "a part of the request of a dependency is an expression";
		return dep;
	} else {
		var dep = new Dep(options.exprContextRequest, options.exprContextRecursive, options.exprContextRegExp, range, param.range);
		dep.loc = expr.loc;
		dep.critical = options.exprContextCritical && "the request of a dependency is an expression";
		return dep;
	}
};

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
smock-0.1.268 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.267 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.266 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.265 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.264 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.263 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.262 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.261 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.260 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.259 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.258 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.256 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.255 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.254 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.253 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.252 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.251 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.250 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.249 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.247 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js