postcss 8.5.24 → 8.5.26

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/README.md CHANGED
@@ -13,7 +13,7 @@ and JetBrains. The [Autoprefixer] and [Stylelint] PostCSS plugins are some o
13
13
 
14
14
  ---
15
15
 
16
- <img src="https://cdn.evilmartians.com/badges/logo-no-label.svg" alt="" width="22" height="16" />  PostCSS is built by <b><a href="https://evilmartians.com/>Evil Martians</a></b>, an American design and engineering consultancy for <b>developer tools, AI, and cybersecurity startups</b>.
16
+ <img src="https://cdn.evilmartians.com/badges/logo-no-label.svg" alt="" width="22" height="16" />  PostCSS is built by <b><a href="https://evilmartians.com/">Evil Martians</a></b>, an American design and engineering consultancy for <b>developer tools, AI, and cybersecurity startups</b>.
17
17
 
18
18
  ---
19
19
 
@@ -22,3 +22,6 @@ and JetBrains. The [Autoprefixer] and [Stylelint] PostCSS plugins are some o
22
22
  [Autoprefixer]: https://github.com/postcss/autoprefixer
23
23
  [Stylelint]: https://stylelint.io/
24
24
  [plugins]: https://github.com/postcss/postcss#plugins
25
+
26
+ ## Docs
27
+ Read full docs **[here](https://postcss.org/)**.
@@ -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 (typeof string !== 'string') return []
14
15
  let array = []
15
16
  let current = ''
16
17
  let split = false
@@ -1,9 +1,19 @@
1
1
  'use strict'
2
2
 
3
- let { existsSync, readFileSync } = require('fs')
3
+ let { existsSync, readFileSync, realpathSync } = require('fs')
4
4
  let { dirname, isAbsolute, join, relative, sep } = require('path')
5
5
  let { SourceMapConsumer, SourceMapGenerator } = require('source-map-js')
6
6
 
7
+ function realPath(path) {
8
+ try {
9
+ return realpathSync(path)
10
+ } catch {
11
+ // Missing or dangling: keep the literal path. The existsSync() check below
12
+ // still gates the read, and a path that does not exist cannot escape.
13
+ return path
14
+ }
15
+ }
16
+
7
17
  function fromBase64(str) {
8
18
  if (Buffer) {
9
19
  return Buffer.from(str, 'base64').toString()
@@ -89,7 +99,9 @@ class PreviousMap {
89
99
  if (!/\.map$/i.test(path)) return undefined
90
100
  if (!cssFile) return undefined
91
101
 
92
- let rel = relative(dirname(cssFile), path)
102
+ // Compare *resolved* paths: relative() is textual, so without this a
103
+ // symlink at or below the CSS file's directory points the map outside it.
104
+ let rel = relative(realPath(dirname(cssFile)), realPath(path))
93
105
  if (rel === '..' || rel.startsWith('..' + sep) || isAbsolute(rel)) {
94
106
  return undefined
95
107
  }
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.24'
10
+ this.version = '8.5.26'
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.5.24",
3
+ "version": "8.5.26",
4
4
  "description": "Tool for transforming styles with JS plugins",
5
5
  "keywords": [
6
6
  "css",
@@ -78,7 +78,7 @@
78
78
  "./package.json": "./package.json"
79
79
  },
80
80
  "dependencies": {
81
- "nanoid": "^3.3.16",
81
+ "nanoid": "^3.3.17",
82
82
  "picocolors": "^1.1.1",
83
83
  "source-map-js": "^1.2.1"
84
84
  },