Warning.js 756 B

1234567891011121314151617181920212223242526272829303132
  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'; // Based on https://github.com/postcss/postcss/blob/master/lib/warning.es6#L74
  15. // We don't need `plugin` properties.
  16. this.message = `${this.name}\n\n`;
  17. if (typeof line !== 'undefined') {
  18. this.message += `(${line}:${column}) `;
  19. }
  20. this.message += `${text}`; // We don't need stack https://github.com/postcss/postcss/blob/master/docs/guidelines/runner.md#31-dont-show-js-stack-for-csssyntaxerror
  21. this.stack = false;
  22. }
  23. }
  24. exports.default = Warning;