Warning.js 759 B

1234567891011121314151617181920212223242526272829
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. class Warning extends Error {
  7. constructor(warning) {
  8. super(warning);
  9. const {
  10. text,
  11. line,
  12. column
  13. } = warning;
  14. this.name = "Warning";
  15. // Based on https://github.com/postcss/postcss/blob/master/lib/warning.es6#L74
  16. // We don't need `plugin` properties.
  17. this.message = `${this.name}\n\n`;
  18. if (typeof line !== "undefined") {
  19. this.message += `(${line}:${column}) `;
  20. }
  21. this.message += `${text}`;
  22. // We don't need stack https://github.com/postcss/postcss/blob/master/docs/guidelines/runner.md#31-dont-show-js-stack-for-csssyntaxerror
  23. this.stack = false;
  24. }
  25. }
  26. exports.default = Warning;