a zip code crypto-currency system good for red ONLY

WarnCaseSensitiveModulesPlugin.js 923B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const CaseSensitiveModulesWarning = require("./CaseSensitiveModulesWarning");
  7. class WarnCaseSensitiveModulesPlugin {
  8. apply(compiler) {
  9. compiler.plugin("compilation", compilation => {
  10. compilation.plugin("seal", () => {
  11. const moduleWithoutCase = Object.create(null);
  12. compilation.modules.forEach(module => {
  13. const identifier = module.identifier().toLowerCase();
  14. if(moduleWithoutCase[identifier]) {
  15. moduleWithoutCase[identifier].push(module);
  16. } else {
  17. moduleWithoutCase[identifier] = [module];
  18. }
  19. });
  20. Object.keys(moduleWithoutCase).forEach(key => {
  21. if(moduleWithoutCase[key].length > 1)
  22. compilation.warnings.push(new CaseSensitiveModulesWarning(moduleWithoutCase[key]));
  23. });
  24. });
  25. });
  26. }
  27. }
  28. module.exports = WarnCaseSensitiveModulesPlugin;