MCPcopy
hub / github.com/postcss/postcss / constructor

Method constructor

lib/no-work-result.js:60–93  ·  view source on GitHub ↗
(processor, css, opts)

Source from the content-addressed store, hash-verified

58 }
59
60 constructor(processor, css, opts) {
61 css = css.toString()
62 this.stringified = false
63
64 this._processor = processor
65 this._css = css
66 this._opts = opts
67 this._map = undefined
68
69 let str = stringify
70 this.result = new Result(this._processor, undefined, this._opts)
71 this.result.css = css
72
73 let self = this
74 Object.defineProperty(this.result, 'root', {
75 get() {
76 return self.root
77 }
78 })
79
80 let map = new MapGenerator(str, undefined, this._opts, css)
81 if (map.isMap()) {
82 let [generatedCSS, generatedMap] = map.generate()
83 if (generatedCSS) {
84 this.result.css = generatedCSS
85 }
86 if (generatedMap) {
87 this.result.map = generatedMap
88 }
89 } else {
90 map.clearAnnotation()
91 this.result.css = map.css
92 }
93 }
94
95 async() {
96 if (this.error) return Promise.reject(this.error)

Callers

nothing calls this directly

Calls 4

isMapMethod · 0.95
generateMethod · 0.95
clearAnnotationMethod · 0.95
toStringMethod · 0.45

Tested by

no test coverage detected