mirror of https://github.com/webpack/webpack.git
				
				
				
			
		
			
				
	
	
		
			29 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
/*
 | 
						|
	MIT License http://www.opensource.org/licenses/mit-license.php
 | 
						|
	Author Tobias Koppers @sokra
 | 
						|
*/
 | 
						|
var ConcatSource = require("webpack-core/lib/ConcatSource");
 | 
						|
 | 
						|
function FunctionModuleTemplate(outputOptions, requestShortener) {
 | 
						|
	this.outputOptions = outputOptions || {};
 | 
						|
	this.requestShortener = requestShortener;
 | 
						|
}
 | 
						|
module.exports = FunctionModuleTemplate;
 | 
						|
 | 
						|
FunctionModuleTemplate.prototype.render = function(module, dependencyTemplates) {
 | 
						|
	var source = new ConcatSource();
 | 
						|
	if(this.outputOptions.pathinfo) {
 | 
						|
		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("/***/ function(module, exports, require) {\n\n");
 | 
						|
	source.add(module.source(dependencyTemplates, this.outputOptions, this.requestShortener));
 | 
						|
	source.add("\n\n/***/ }");
 | 
						|
	return source;
 | 
						|
};
 | 
						|
 | 
						|
FunctionModuleTemplate.prototype.updateHash = function(hash) {
 | 
						|
	hash.update("1");
 | 
						|
}; |