Code coverage report for lib\FunctionModuleTemplatePlugin.js

Statements: 100% (24 / 24)      Branches: 100% (4 / 4)      Functions: 100% (5 / 5)      Lines: 100% (24 / 24)      Ignored: none     

All files » lib\ » FunctionModuleTemplatePlugin.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37        1 1   1   1   1 496 2999 2999 2999 2999 2999   496 2999 2772 2772 2772 2772 2772 2772 2772   227   496 496 496      
/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author Tobias Koppers @sokra
*/
var ConcatSource = require("webpack-core/lib/ConcatSource");
var PrefixSource = require("webpack-core/lib/PrefixSource");
 
function FunctionModuleTemplatePlugin() {
}
module.exports = FunctionModuleTemplatePlugin;
 
FunctionModuleTemplatePlugin.prototype.apply = function(moduleTemplate) {
	moduleTemplate.plugin("render", function(moduleSource, module, chunk) {
		var source = new ConcatSource();
		source.add("/***/ function(" + ["module", "exports", "__webpack_require__"].concat(module.arguments || []).join(", ") + ") {\n\n");
		source.add(new PrefixSource(this.outputOptions.sourcePrefix, moduleSource));
		source.add("\n\n/***/ }");
		return source;
	});
	moduleTemplate.plugin("package", function(moduleSource, module, chunk) {
		if(this.outputOptions.pathinfo) {
			var source = new ConcatSource();
			var req = module.readableIdentifier(this.requestShortener);
			source.add("/*!****" + req.replace(/./g, "*") + "****!*\\\n");
			source.add("  !*** " + req.replace(/\*\//g, "*_/") + " ***!\n");
			source.add("  \\****" + req.replace(/./g, "*") + "****/\n");
			source.add(moduleSource);
			return source;
		}
		return moduleSource;
	});
	moduleTemplate.plugin("hash", function(hash) {
		hash.update("FunctionModuleTemplatePlugin");
		hash.update("2");
	});
};