You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
656 B

3 months ago
  1. "use strict";
  2. /**
  3. * **PostCSS Plugin Warning**
  4. *
  5. * Loader wrapper for postcss plugin warnings (`root.messages`)
  6. *
  7. * @class Warning
  8. * @extends Error
  9. *
  10. * @param {Object} warning PostCSS Warning
  11. */
  12. class Warning extends Error {
  13. constructor(warning) {
  14. super(warning);
  15. const {
  16. text,
  17. line,
  18. column,
  19. plugin
  20. } = warning;
  21. this.name = "Warning";
  22. this.message = `${this.name}\n\n`;
  23. if (typeof line !== "undefined") {
  24. this.message += `(${line}:${column}) `;
  25. }
  26. this.message += plugin ? `${plugin}: ` : "";
  27. this.message += `${text}`;
  28. this.stack = false;
  29. }
  30. }
  31. module.exports = Warning;