CommentCompilationWarning.js 1020 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const WebpackError = require("./WebpackError");
  7. const makeSerializable = require("./util/makeSerializable");
  8. /** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
  9. /**
  10. * Warning used for comment-related compilation issues, such as malformed magic
  11. * comments that webpack can parse but wants to report.
  12. */
  13. class CommentCompilationWarning extends WebpackError {
  14. /**
  15. * Captures a warning message together with the dependency location that
  16. * triggered it.
  17. * @param {string} message warning message
  18. * @param {DependencyLocation} loc affected lines of code
  19. */
  20. constructor(message, loc) {
  21. super(message);
  22. /** @type {string} */
  23. this.name = "CommentCompilationWarning";
  24. /** @type {DependencyLocation} */
  25. this.loc = loc;
  26. }
  27. }
  28. makeSerializable(
  29. CommentCompilationWarning,
  30. "webpack/lib/CommentCompilationWarning"
  31. );
  32. module.exports = CommentCompilationWarning;