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.228 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.227 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.226 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.225 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.224 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.9 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.223 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.222 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.221 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.220 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.219 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.218 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.217 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.216 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.215 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.214 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.213 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.212 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.211 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js
smock-0.1.210 node_modules/webpack/lib/dependencies/ContextDependencyHelpers.js