postcss 8.4.17 → 8.4.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of postcss might be problematic. Click here for more details.
- package/lib/container.js +1 -1
- package/lib/map-generator.js +17 -12
- package/lib/processor.js +1 -1
- package/package.json +1 -1
package/lib/container.js
CHANGED
@@ -177,7 +177,7 @@ class Container extends Node {
|
|
177
177
|
|
178
178
|
insertBefore(exist, add) {
|
179
179
|
let existIndex = this.index(exist)
|
180
|
-
let type =
|
180
|
+
let type = existIndex === 0 ? 'prepend' : false
|
181
181
|
let nodes = this.normalize(add, this.proxyOf.nodes[existIndex], type).reverse()
|
182
182
|
existIndex = this.index(exist)
|
183
183
|
for (let node of nodes) this.proxyOf.nodes.splice(existIndex, 0, node)
|
package/lib/map-generator.js
CHANGED
@@ -16,6 +16,7 @@ class MapGenerator {
|
|
16
16
|
this.root = root
|
17
17
|
this.opts = opts
|
18
18
|
this.css = cssString
|
19
|
+
this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute
|
19
20
|
}
|
20
21
|
|
21
22
|
isMap() {
|
@@ -97,10 +98,10 @@ class MapGenerator {
|
|
97
98
|
let from = node.source.input.from
|
98
99
|
if (from && !already[from]) {
|
99
100
|
already[from] = true
|
100
|
-
this.
|
101
|
-
this.
|
102
|
-
|
103
|
-
)
|
101
|
+
let fromUrl = this.usesFileUrls
|
102
|
+
? this.toFileUrl(from)
|
103
|
+
: this.toUrl(this.path(from))
|
104
|
+
this.map.setSourceContent(fromUrl, node.source.input.css)
|
104
105
|
}
|
105
106
|
}
|
106
107
|
})
|
@@ -232,17 +233,21 @@ class MapGenerator {
|
|
232
233
|
return encodeURI(path).replace(/[#?]/g, encodeURIComponent)
|
233
234
|
}
|
234
235
|
|
236
|
+
toFileUrl(path) {
|
237
|
+
if (pathToFileURL) {
|
238
|
+
return pathToFileURL(path).toString()
|
239
|
+
} else {
|
240
|
+
throw new Error(
|
241
|
+
'`map.absolute` option is not available in this PostCSS build'
|
242
|
+
)
|
243
|
+
}
|
244
|
+
}
|
245
|
+
|
235
246
|
sourcePath(node) {
|
236
247
|
if (this.mapOpts.from) {
|
237
248
|
return this.toUrl(this.mapOpts.from)
|
238
|
-
} else if (this.
|
239
|
-
|
240
|
-
return pathToFileURL(node.source.input.from).toString()
|
241
|
-
} else {
|
242
|
-
throw new Error(
|
243
|
-
'`map.absolute` option is not available in this PostCSS build'
|
244
|
-
)
|
245
|
-
}
|
249
|
+
} else if (this.usesFileUrls) {
|
250
|
+
return this.toFileUrl(node.source.input.from)
|
246
251
|
} else {
|
247
252
|
return this.toUrl(this.path(node.source.input.from))
|
248
253
|
}
|
package/lib/processor.js
CHANGED