postcss 8.5.18 → 8.5.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.
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.5.18'
10
+ this.version = '8.5.19'
11
11
  this.plugins = this.normalize(plugins)
12
12
  }
13
13
 
package/lib/root.js CHANGED
@@ -12,6 +12,19 @@ class Root extends Container {
12
12
  }
13
13
 
14
14
  normalize(child, sample, type) {
15
+ let keepBefore = new Set()
16
+ for (let node of Array.isArray(child) ? child : [child]) {
17
+ if (
18
+ node &&
19
+ typeof node === 'object' &&
20
+ !node.parent &&
21
+ node.raws &&
22
+ typeof node.raws.before !== 'undefined'
23
+ ) {
24
+ keepBefore.add(node.raws)
25
+ }
26
+ }
27
+
15
28
  let nodes = super.normalize(child)
16
29
 
17
30
  if (sample) {
@@ -23,7 +36,9 @@ class Root extends Container {
23
36
  }
24
37
  } else if (this.first !== sample) {
25
38
  for (let node of nodes) {
26
- node.raws.before = sample.raws.before
39
+ if (!keepBefore.has(node.raws)) {
40
+ node.raws.before = sample.raws.before
41
+ }
27
42
  }
28
43
  }
29
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postcss",
3
- "version": "8.5.18",
3
+ "version": "8.5.19",
4
4
  "description": "Tool for transforming styles with JS plugins",
5
5
  "keywords": [
6
6
  "css",