| 
									
										
										
										
											2018-07-23 23:33:29 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 	MIT License http://www.opensource.org/licenses/mit-license.php
 | 
					
						
							|  |  |  | 	Author Tobias Koppers @sokra | 
					
						
							|  |  |  | */ | 
					
						
							| 
									
										
										
										
											2018-07-30 23:08:51 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-23 23:33:29 +08:00
										 |  |  | "use strict"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** @typedef {import("webpack-sources").ReplaceSource} ReplaceSource */ | 
					
						
							| 
									
										
										
										
											2018-08-23 02:17:49 +08:00
										 |  |  | /** @typedef {import("./ChunkGraph")} ChunkGraph */ | 
					
						
							| 
									
										
										
										
											2018-07-30 23:08:51 +08:00
										 |  |  | /** @typedef {import("./Dependency")} Dependency */ | 
					
						
							| 
									
										
										
										
											2018-07-23 23:33:29 +08:00
										 |  |  | /** @typedef {import("./DependencyTemplates")} DependencyTemplates */ | 
					
						
							| 
									
										
										
										
											2018-07-25 03:57:48 +08:00
										 |  |  | /** @typedef {import("./InitFragment")} InitFragment */ | 
					
						
							| 
									
										
										
										
											2018-07-31 03:39:17 +08:00
										 |  |  | /** @typedef {import("./Module")} Module */ | 
					
						
							| 
									
										
										
										
											2018-07-24 23:35:36 +08:00
										 |  |  | /** @typedef {import("./ModuleGraph")} ModuleGraph */ | 
					
						
							| 
									
										
										
										
											2018-07-30 23:08:51 +08:00
										 |  |  | /** @typedef {import("./RuntimeTemplate")} RuntimeTemplate */ | 
					
						
							| 
									
										
										
										
											2018-07-23 23:33:29 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-31 03:39:17 +08:00
										 |  |  | /** | 
					
						
							| 
									
										
										
										
											2018-07-18 01:38:42 +08:00
										 |  |  |  * @typedef {Object} DependencyTemplateContext | 
					
						
							| 
									
										
										
										
											2018-07-31 03:39:17 +08:00
										 |  |  |  * @property {RuntimeTemplate} runtimeTemplate the runtime template | 
					
						
							|  |  |  |  * @property {DependencyTemplates} dependencyTemplates the dependency templates | 
					
						
							| 
									
										
										
										
											2018-07-24 23:35:36 +08:00
										 |  |  |  * @property {ModuleGraph} moduleGraph the module graph | 
					
						
							| 
									
										
										
										
											2018-08-23 02:17:49 +08:00
										 |  |  |  * @property {ChunkGraph} chunkGraph the chunk graph | 
					
						
							| 
									
										
										
										
											2018-07-31 03:39:17 +08:00
										 |  |  |  * @property {Module} module current module | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-23 23:33:29 +08:00
										 |  |  | class DependencyTemplate { | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @abstract | 
					
						
							|  |  |  | 	 * @param {Dependency} dependency the dependency for which the template should be applied | 
					
						
							|  |  |  | 	 * @param {ReplaceSource} source the current replace source which can be modified | 
					
						
							| 
									
										
										
										
											2018-07-18 01:38:42 +08:00
										 |  |  | 	 * @param {DependencyTemplateContext} templateContext the context object | 
					
						
							| 
									
										
										
										
											2018-07-23 23:33:29 +08:00
										 |  |  | 	 * @returns {void} | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-07-18 01:38:42 +08:00
										 |  |  | 	apply(dependency, source, templateContext) { | 
					
						
							| 
									
										
										
										
											2018-07-23 23:33:29 +08:00
										 |  |  | 		throw new Error("DependencyTemplate.apply must be overriden"); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-07-25 03:57:48 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/** | 
					
						
							|  |  |  | 	 * @param {Dependency} dependency the dependency for which the template should be applied | 
					
						
							| 
									
										
										
										
											2018-07-18 01:38:42 +08:00
										 |  |  | 	 * @param {DependencyTemplateContext} templateContext the template context | 
					
						
							| 
									
										
										
										
											2018-07-25 03:57:48 +08:00
										 |  |  | 	 * @returns {InitFragment[]|null} the init fragments | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2018-07-31 03:39:17 +08:00
										 |  |  | 	getInitFragments(dependency, templateContext) { | 
					
						
							| 
									
										
										
										
											2018-07-25 03:57:48 +08:00
										 |  |  | 		return null; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-07-23 23:33:29 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module.exports = DependencyTemplate; |