2023-07-24 03:13:08 +00:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
let Warning = require('./warning')
|
|
|
|
|
|
|
|
class Result {
|
|
|
|
constructor(processor, root, opts) {
|
|
|
|
this.processor = processor
|
|
|
|
this.messages = []
|
|
|
|
this.root = root
|
|
|
|
this.opts = opts
|
|
|
|
this.css = undefined
|
|
|
|
this.map = undefined
|
|
|
|
}
|
|
|
|
|
2023-09-06 01:51:55 +00:00
|
|
|
get content() {
|
|
|
|
return this.css
|
|
|
|
}
|
|
|
|
|
2023-07-24 03:13:08 +00:00
|
|
|
toString() {
|
|
|
|
return this.css
|
|
|
|
}
|
|
|
|
|
|
|
|
warn(text, opts = {}) {
|
|
|
|
if (!opts.plugin) {
|
|
|
|
if (this.lastPlugin && this.lastPlugin.postcssPlugin) {
|
|
|
|
opts.plugin = this.lastPlugin.postcssPlugin
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
let warning = new Warning(text, opts)
|
|
|
|
this.messages.push(warning)
|
|
|
|
|
|
|
|
return warning
|
|
|
|
}
|
|
|
|
|
|
|
|
warnings() {
|
|
|
|
return this.messages.filter(i => i.type === 'warning')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Result
|
|
|
|
Result.default = Result
|