| 
									
										
										
										
											2014-02-13 18:40:16 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 	MIT License http://www.opensource.org/licenses/mit-license.php
 | 
					
						
							|  |  |  | 	Author Tobias Koppers @sokra | 
					
						
							|  |  |  | */ | 
					
						
							| 
									
										
										
										
											2017-01-13 11:32:24 +08:00
										 |  |  | "use strict"; | 
					
						
							| 
									
										
										
										
											2014-02-13 18:40:16 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-13 11:32:24 +08:00
										 |  |  | const EvalSourceMapDevToolModuleTemplatePlugin = require("./EvalSourceMapDevToolModuleTemplatePlugin"); | 
					
						
							|  |  |  | const SourceMapDevToolModuleOptionsPlugin = require("./SourceMapDevToolModuleOptionsPlugin"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class EvalSourceMapDevToolPlugin { | 
					
						
							|  |  |  | 	constructor(options) { | 
					
						
							|  |  |  | 		if(arguments.length > 1) | 
					
						
							|  |  |  | 			throw new Error("EvalSourceMapDevToolPlugin only takes one argument (pass an options object)"); | 
					
						
							|  |  |  | 		if(typeof options === "string") { | 
					
						
							|  |  |  | 			options = { | 
					
						
							|  |  |  | 				append: options | 
					
						
							|  |  |  | 			}; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if(!options) options = {}; | 
					
						
							|  |  |  | 		this.options = options; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	apply(compiler) { | 
					
						
							| 
									
										
										
										
											2017-02-05 07:23:50 +08:00
										 |  |  | 		const options = this.options; | 
					
						
							| 
									
										
										
										
											2017-01-13 11:32:24 +08:00
										 |  |  | 		compiler.plugin("compilation", (compilation) => { | 
					
						
							|  |  |  | 			new SourceMapDevToolModuleOptionsPlugin(options).apply(compilation); | 
					
						
							| 
									
										
										
										
											2017-11-11 18:27:02 +08:00
										 |  |  | 			compilation.moduleTemplates.javascript.apply(new EvalSourceMapDevToolModuleTemplatePlugin(compilation, options)); | 
					
						
							| 
									
										
										
										
											2017-01-13 11:32:24 +08:00
										 |  |  | 		}); | 
					
						
							| 
									
										
										
										
											2015-04-05 07:52:30 +08:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2014-02-13 18:40:16 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2017-01-13 11:32:24 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-13 18:40:16 +08:00
										 |  |  | module.exports = EvalSourceMapDevToolPlugin; |