Last change
on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
745 bytes
|
Line | |
---|
1 | 'use strict'
|
---|
2 |
|
---|
3 | let Warning = require('./warning')
|
---|
4 |
|
---|
5 | class Result {
|
---|
6 | constructor(processor, root, opts) {
|
---|
7 | this.processor = processor
|
---|
8 | this.messages = []
|
---|
9 | this.root = root
|
---|
10 | this.opts = opts
|
---|
11 | this.css = undefined
|
---|
12 | this.map = undefined
|
---|
13 | }
|
---|
14 |
|
---|
15 | toString() {
|
---|
16 | return this.css
|
---|
17 | }
|
---|
18 |
|
---|
19 | warn(text, opts = {}) {
|
---|
20 | if (!opts.plugin) {
|
---|
21 | if (this.lastPlugin && this.lastPlugin.postcssPlugin) {
|
---|
22 | opts.plugin = this.lastPlugin.postcssPlugin
|
---|
23 | }
|
---|
24 | }
|
---|
25 |
|
---|
26 | let warning = new Warning(text, opts)
|
---|
27 | this.messages.push(warning)
|
---|
28 |
|
---|
29 | return warning
|
---|
30 | }
|
---|
31 |
|
---|
32 | warnings() {
|
---|
33 | return this.messages.filter(i => i.type === 'warning')
|
---|
34 | }
|
---|
35 |
|
---|
36 | get content() {
|
---|
37 | return this.css
|
---|
38 | }
|
---|
39 | }
|
---|
40 |
|
---|
41 | module.exports = Result
|
---|
42 | Result.default = Result
|
---|
Note:
See
TracBrowser
for help on using the repository browser.