| 
									
										
										
										
											2014-03-31 17:33:17 +08:00
										 |  |  | /* | 
					
						
							|  |  |  | 	MIT License http://www.opensource.org/licenses/mit-license.php
 | 
					
						
							|  |  |  | 	Author Tobias Koppers @sokra | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | var CaseSensitiveModulesWarning = require("./CaseSensitiveModulesWarning"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-08 20:39:02 +08:00
										 |  |  | function WarnCaseSensitiveModulesPlugin() {} | 
					
						
							| 
									
										
										
										
											2014-03-31 17:33:17 +08:00
										 |  |  | module.exports = WarnCaseSensitiveModulesPlugin; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | WarnCaseSensitiveModulesPlugin.prototype.apply = function(compiler) { | 
					
						
							|  |  |  | 	compiler.plugin("compilation", function(compilation) { | 
					
						
							|  |  |  | 		compilation.plugin("seal", function() { | 
					
						
							|  |  |  | 			var moduleWithoutCase = {}; | 
					
						
							|  |  |  | 			this.modules.forEach(function(module) { | 
					
						
							|  |  |  | 				var ident = module.identifier().toLowerCase(); | 
					
						
							| 
									
										
										
										
											2015-07-16 06:19:23 +08:00
										 |  |  | 				if(moduleWithoutCase["$" + ident]) { | 
					
						
							| 
									
										
										
										
											2016-05-05 21:19:54 +08:00
										 |  |  | 					moduleWithoutCase["$" + ident].push(module); | 
					
						
							| 
									
										
										
										
											2014-03-31 17:33:17 +08:00
										 |  |  | 				} else { | 
					
						
							| 
									
										
										
										
											2016-05-05 21:19:54 +08:00
										 |  |  | 					moduleWithoutCase["$" + ident] = [module]; | 
					
						
							| 
									
										
										
										
											2014-03-31 17:33:17 +08:00
										 |  |  | 				} | 
					
						
							|  |  |  | 			}, this); | 
					
						
							| 
									
										
										
										
											2016-05-05 21:19:54 +08:00
										 |  |  | 			Object.keys(moduleWithoutCase).forEach(function(key) { | 
					
						
							|  |  |  | 				if(moduleWithoutCase[key].length > 1) | 
					
						
							|  |  |  | 					this.warnings.push(new CaseSensitiveModulesWarning(moduleWithoutCase[key])); | 
					
						
							|  |  |  | 			}, this); | 
					
						
							| 
									
										
										
										
											2014-03-31 17:33:17 +08:00
										 |  |  | 		}); | 
					
						
							|  |  |  | 	}); | 
					
						
							| 
									
										
										
										
											2015-07-08 20:39:02 +08:00
										 |  |  | }; |