| 
									
										
										
										
											2014-03-31 17:33:17 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 	MIT License http://www.opensource.org/licenses/mit-license.php
 | 
					
						
							|  |  |  | 	Author Tobias Koppers @sokra | 
					
						
							|  |  |  | */ | 
					
						
							| 
									
										
										
										
											2016-05-05 21:19:54 +08:00
										 |  |  | function CaseSensitiveModulesWarning(modules) { | 
					
						
							| 
									
										
										
										
											2014-03-31 17:33:17 +08:00
										 |  |  | 	Error.call(this); | 
					
						
							|  |  |  | 	Error.captureStackTrace(this, CaseSensitiveModulesWarning); | 
					
						
							|  |  |  | 	this.name = "CaseSensitiveModulesWarning"; | 
					
						
							| 
									
										
										
										
											2016-06-08 05:48:04 +08:00
										 |  |  | 	var modulesList = modules.slice().sort(function(a, b) { | 
					
						
							|  |  |  | 		a = a.identifier(); | 
					
						
							|  |  |  | 		b = b.identifier(); | 
					
						
							|  |  |  | 		if(a < b) return -1; | 
					
						
							|  |  |  | 		if(a > b) return 1; | 
					
						
							|  |  |  | 		return 0; | 
					
						
							|  |  |  | 	}).map(function(m) { | 
					
						
							| 
									
										
										
										
											2016-06-05 01:51:22 +08:00
										 |  |  | 		var message = "* " + m.identifier(); | 
					
						
							| 
									
										
										
										
											2016-06-05 02:02:44 +08:00
										 |  |  | 		var validReasons = m.reasons.filter(function(r) { | 
					
						
							|  |  |  | 			return r.module; | 
					
						
							|  |  |  | 		}); | 
					
						
							| 
									
										
										
										
											2016-06-05 01:51:22 +08:00
										 |  |  | 		if(validReasons.length > 0) { | 
					
						
							|  |  |  | 			message += "\n    Used by " + validReasons.length + " module(s), i. e."; | 
					
						
							|  |  |  | 			message += "\n    " + validReasons[0].module.identifier(); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		return message; | 
					
						
							| 
									
										
										
										
											2016-05-05 21:19:54 +08:00
										 |  |  | 	}).join("\n"); | 
					
						
							|  |  |  | 	this.message = "There are multiple modules with names that only differ in casing.\n" + | 
					
						
							| 
									
										
										
										
											2014-03-31 17:33:17 +08:00
										 |  |  | 		"This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.\n" + | 
					
						
							| 
									
										
										
										
											2016-05-05 21:19:54 +08:00
										 |  |  | 		"Use equal casing. Compare these module identifiers:\n" + | 
					
						
							|  |  |  | 		modulesList; | 
					
						
							|  |  |  | 	this.origin = this.module = modules[0]; | 
					
						
							| 
									
										
										
										
											2014-03-31 17:33:17 +08:00
										 |  |  | } | 
					
						
							|  |  |  | module.exports = CaseSensitiveModulesWarning; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | CaseSensitiveModulesWarning.prototype = Object.create(Error.prototype); | 
					
						
							| 
									
										
										
										
											2016-05-20 13:39:36 +08:00
										 |  |  | CaseSensitiveModulesWarning.prototype.constructor = CaseSensitiveModulesWarning; |