Last change
on this file since 84d0fbb was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
656 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | /**
|
---|
| 4 | * **PostCSS Plugin Warning**
|
---|
| 5 | *
|
---|
| 6 | * Loader wrapper for postcss plugin warnings (`root.messages`)
|
---|
| 7 | *
|
---|
| 8 | * @class Warning
|
---|
| 9 | * @extends Error
|
---|
| 10 | *
|
---|
| 11 | * @param {Object} warning PostCSS Warning
|
---|
| 12 | */
|
---|
| 13 | class Warning extends Error {
|
---|
| 14 | constructor(warning) {
|
---|
| 15 | super(warning);
|
---|
| 16 | const {
|
---|
| 17 | text,
|
---|
| 18 | line,
|
---|
| 19 | column,
|
---|
| 20 | plugin
|
---|
| 21 | } = warning;
|
---|
| 22 | this.name = "Warning";
|
---|
| 23 | this.message = `${this.name}\n\n`;
|
---|
| 24 |
|
---|
| 25 | if (typeof line !== "undefined") {
|
---|
| 26 | this.message += `(${line}:${column}) `;
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | this.message += plugin ? `${plugin}: ` : "";
|
---|
| 30 | this.message += `${text}`;
|
---|
| 31 | this.stack = false;
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | module.exports = Warning; |
---|
Note:
See
TracBrowser
for help on using the repository browser.