Code coverage report for lib\WarnCaseSensitiveModulesPlugin.js

Statements: 100% (15 / 15)      Branches: 75% (3 / 4)      Functions: 100% (5 / 5)      Lines: 100% (15 / 15)      Ignored: none     

All files » lib\ » WarnCaseSensitiveModulesPlugin.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28        1   1   1   1 484 496 496 496 2970 2970 1 1 1 1   2969          
/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author Tobias Koppers @sokra
*/
var CaseSensitiveModulesWarning = require("./CaseSensitiveModulesWarning");
 
function WarnCaseSensitiveModulesPlugin() {
}
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();
				if(moduleWithoutCase["$"+ident]) {
					Eif(moduleWithoutCase["$"+ident] !== true)
						this.warnings.push(new CaseSensitiveModulesWarning(moduleWithoutCase["$"+ident]));
					this.warnings.push(new CaseSensitiveModulesWarning(module));
					moduleWithoutCase["$"+ident] = true;
				} else {
					moduleWithoutCase["$"+ident] = module;
				}
			}, this);
		});
	});
};