postcss 8.5.23 → 8.5.25

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.
@@ -503,14 +503,24 @@ class LazyResult {
503
503
 
504
504
  if (visit.iterator !== 0) {
505
505
  let iterator = visit.iterator
506
+ // Advance past the child we just finished visiting. Like
507
+ // `Container#each`, the index is incremented only after a child has
508
+ // been fully processed, so a node inserted right after the current
509
+ // child is not skipped by the `existIndex < index` adjustment in
510
+ // `Container#insertAfter()` (which would fire exit events too early).
511
+ if (visit.descending) {
512
+ visit.descending = false
513
+ node.indexes[iterator] += 1
514
+ }
506
515
  let child
507
516
  while ((child = node.nodes[node.indexes[iterator]])) {
508
- node.indexes[iterator] += 1
509
517
  if (!child[isClean]) {
510
518
  child[isClean] = true
519
+ visit.descending = true
511
520
  stack.push(toStack(child))
512
521
  return
513
522
  }
523
+ node.indexes[iterator] += 1
514
524
  }
515
525
  visit.iterator = 0
516
526
  delete node.indexes[iterator]
@@ -548,12 +558,22 @@ class LazyResult {
548
558
 
549
559
  if (visit.iterator !== 0) {
550
560
  let iterator = visit.iterator
561
+ // Advance past the child we just finished visiting. Like
562
+ // `Container#each`, the index is incremented only after a child has
563
+ // been fully processed. Incrementing before (as this loop used to)
564
+ // makes a node inserted right after the current child get skipped by
565
+ // the `existIndex < index` adjustment in `Container#insertAfter()`,
566
+ // which fires exit events before those new siblings are visited.
567
+ if (visit.descending) {
568
+ visit.descending = false
569
+ visitNode.indexes[iterator] += 1
570
+ }
551
571
  let child
552
572
  let descended = false
553
573
  while ((child = visitNode.nodes[visitNode.indexes[iterator]])) {
554
- visitNode.indexes[iterator] += 1
555
574
  if (!child[isClean]) {
556
575
  child[isClean] = true
576
+ visit.descending = true
557
577
  stack.push({
558
578
  eventIndex: 0,
559
579
  events: getEvents(child),
@@ -563,6 +583,7 @@ class LazyResult {
563
583
  descended = true
564
584
  break
565
585
  }
586
+ visitNode.indexes[iterator] += 1
566
587
  }
567
588
  if (descended) continue
568
589
  visit.iterator = 0
package/lib/list.js CHANGED
@@ -11,6 +11,7 @@ let list = {
11
11
  },
12
12
 
13
13
  split(string, separators, last) {
14
+ if (!string) return []
14
15
  let array = []
15
16
  let current = ''
16
17
  let split = false
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.23'
10
+ this.version = '8.5.25'
11
11
  this.plugins = this.normalize(plugins)
12
12
  }
13
13
 
@@ -424,6 +424,9 @@ class Stringifier {
424
424
  }
425
425
 
426
426
  root(node) {
427
+ if (node.source && node.source.input.hasBOM) {
428
+ this.builder('\uFEFF', node, 'start')
429
+ }
427
430
  this.body(node)
428
431
  if (node.raws.after) {
429
432
  let after = node.raws.after
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postcss",
3
- "version": "8.5.23",
3
+ "version": "8.5.25",
4
4
  "description": "Tool for transforming styles with JS plugins",
5
5
  "keywords": [
6
6
  "css",