| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 	MIT License http://www.opensource.org/licenses/mit-license.php
 | 
					
						
							|  |  |  | 	Author Tobias Koppers @sokra | 
					
						
							|  |  |  | */ | 
					
						
							| 
									
										
										
										
											2013-03-26 23:54:41 +08:00
										 |  |  | var ConcatSource = require("webpack-core/lib/ConcatSource"); | 
					
						
							| 
									
										
										
										
											2013-03-28 17:19:51 +08:00
										 |  |  | var PrefixSource = require("webpack-core/lib/PrefixSource"); | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | function FunctionModuleTemplate(outputOptions, requestShortener) { | 
					
						
							|  |  |  | 	this.outputOptions = outputOptions || {}; | 
					
						
							|  |  |  | 	this.requestShortener = requestShortener; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | module.exports = FunctionModuleTemplate; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-14 21:13:44 +08:00
										 |  |  | FunctionModuleTemplate.prototype.render = function(module, dependencyTemplates, chunk) { | 
					
						
							| 
									
										
										
										
											2013-03-26 23:54:41 +08:00
										 |  |  | 	var source = new ConcatSource(); | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 	if(this.outputOptions.pathinfo) { | 
					
						
							|  |  |  | 		var req = module.readableIdentifier(this.requestShortener); | 
					
						
							| 
									
										
										
										
											2013-03-26 23:54:41 +08:00
										 |  |  | 		source.add("/*!****" + req.replace(/./g, "*") + "****!*\\\n"); | 
					
						
							|  |  |  | 		source.add("  !*** " + req.replace(/\*\//g, "*_/") + " ***!\n"); | 
					
						
							|  |  |  | 		source.add("  \\****" + req.replace(/./g, "*") + "****/\n"); | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2014-03-03 21:56:17 +08:00
										 |  |  | 	source.add("/***/ function(" + ["module", "exports", "__webpack_require__"].concat(module.arguments || []).join(", ") + ") {\n\n"); | 
					
						
							| 
									
										
										
										
											2014-02-11 15:31:08 +08:00
										 |  |  | 	source.add(new PrefixSource(this.outputOptions.sourcePrefix, module.source(dependencyTemplates, this.outputOptions, this.requestShortener))); | 
					
						
							| 
									
										
										
										
											2013-03-26 23:54:41 +08:00
										 |  |  | 	source.add("\n\n/***/ }"); | 
					
						
							|  |  |  | 	return source; | 
					
						
							| 
									
										
										
										
											2013-01-31 01:49:25 +08:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | FunctionModuleTemplate.prototype.updateHash = function(hash) { | 
					
						
							|  |  |  | 	hash.update("1"); | 
					
						
							|  |  |  | }; |