MCPcopy
hub / github.com/postcss/postcss / generateMap

Method generateMap

lib/map-generator.js:103–135  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

101 }
102
103 generateMap() {
104 if (this.root) {
105 this.generateString()
106 } else if (this.previous().length === 1) {
107 let prev = this.previous()[0].consumer()
108 prev.file = this.outputFile()
109 this.map = SourceMapGenerator.fromSourceMap(prev, {
110 ignoreInvalidMapping: true
111 })
112 } else {
113 this.map = new SourceMapGenerator({
114 file: this.outputFile(),
115 ignoreInvalidMapping: true
116 })
117 this.map.addMapping({
118 generated: { column: 0, line: 1 },
119 original: { column: 0, line: 1 },
120 source: this.opts.from
121 ? this.toUrl(this.path(this.opts.from))
122 : '<no source>'
123 })
124 }
125
126 if (this.isSourcesContent()) this.setSourcesContent()
127 if (this.root && this.previous().length > 0) this.applyPrevMaps()
128 if (this.isAnnotation()) this.addAnnotation()
129
130 if (this.isInline()) {
131 return [this.css]
132 } else {
133 return [this.css, this.map]
134 }
135 }
136
137 generateString() {
138 this.css = ''

Callers 1

generateMethod · 0.95

Calls 12

generateStringMethod · 0.95
previousMethod · 0.95
outputFileMethod · 0.95
toUrlMethod · 0.95
pathMethod · 0.95
isSourcesContentMethod · 0.95
setSourcesContentMethod · 0.95
applyPrevMapsMethod · 0.95
isAnnotationMethod · 0.95
addAnnotationMethod · 0.95
isInlineMethod · 0.95
consumerMethod · 0.80

Tested by

no test coverage detected