postcss 8.4.17 → 8.4.18

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.

@@ -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.map.setSourceContent(
101
- this.toUrl(this.path(from)),
102
- node.source.input.css
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.mapOpts.absolute) {
239
- if (pathToFileURL) {
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
@@ -7,7 +7,7 @@ let Root = require('./root')
7
7
 
8
8
  class Processor {
9
9
  constructor(plugins = []) {
10
- this.version = '8.4.17'
10
+ this.version = '8.4.18'
11
11
  this.plugins = this.normalize(plugins)
12
12
  }
13
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postcss",
3
- "version": "8.4.17",
3
+ "version": "8.4.18",
4
4
  "description": "Tool for transforming styles with JS plugins",
5
5
  "engines": {
6
6
  "node": "^10 || ^12 || >=14"