| 
									
										
										
										
											2013-02-13 21:42:34 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 	MIT License http://www.opensource.org/licenses/mit-license.php
 | 
					
						
							|  |  |  | 	Author Tobias Koppers @sokra | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | function CriticalDependenciesWarning(module, dependencies) { | 
					
						
							|  |  |  | 	Error.call(this); | 
					
						
							|  |  |  | 	Error.captureStackTrace(this, CriticalDependenciesWarning); | 
					
						
							|  |  |  | 	this.name = "CriticalDependenciesWarning"; | 
					
						
							| 
									
										
										
										
											2014-03-11 23:08:22 +08:00
										 |  |  | 	this.message = "Critical dependencies:"; | 
					
						
							|  |  |  | 	this.message += dependencies.filter(function(d) { | 
					
						
							|  |  |  | 		return typeof d.critical === "string" || d.loc; | 
					
						
							|  |  |  | 	}).map(function(dep) { | 
					
						
							|  |  |  | 		var line = []; | 
					
						
							| 
									
										
										
										
											2015-07-16 06:19:23 +08:00
										 |  |  | 		if(dep.loc) line.push(dep.loc.start.line + ":" + dep.loc.start.column + "-" + | 
					
						
							| 
									
										
										
										
											2014-06-25 00:53:32 +08:00
										 |  |  | 			(dep.loc.start.line !== dep.loc.end.line ? dep.loc.end.line + ":" : "") + dep.loc.end.column); | 
					
						
							| 
									
										
										
										
											2015-07-16 06:19:23 +08:00
										 |  |  | 		if(typeof dep.critical === "string") line.push(dep.critical); | 
					
						
							| 
									
										
										
										
											2014-03-11 23:08:22 +08:00
										 |  |  | 		return "\n" + line.join(" "); | 
					
						
							|  |  |  | 	}).join(""); | 
					
						
							| 
									
										
										
										
											2013-02-13 21:42:34 +08:00
										 |  |  | 	this.dependencies = dependencies; | 
					
						
							|  |  |  | 	this.origin = this.module = module; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | module.exports = CriticalDependenciesWarning; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | CriticalDependenciesWarning.prototype = Object.create(Error.prototype); |