postcss 8.5.25 → 8.5.27
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 +4 -1
- package/lib/container.d.ts +16 -20
- package/lib/declaration.d.ts +1 -1
- package/lib/list.js +5 -3
- package/lib/map-generator.js +3 -2
- package/lib/parser.js +4 -1
- package/lib/postcss.js +1 -1
- package/lib/previous-map.js +14 -2
- package/lib/processor.js +1 -1
- package/lib/stringifier.js +9 -1
- package/package.json +2 -2
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
|
|
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/)**.
|
package/lib/container.d.ts
CHANGED
|
@@ -178,23 +178,6 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
|
178
178
|
*/
|
|
179
179
|
insertAfter(oldNode: Child | number, newNode: Container.NewChild): this
|
|
180
180
|
|
|
181
|
-
/**
|
|
182
|
-
* Traverses the container’s descendant nodes, calling callback
|
|
183
|
-
* for each comment node.
|
|
184
|
-
*
|
|
185
|
-
* Like `Container#each`, this method is safe
|
|
186
|
-
* to use if you are mutating arrays during iteration.
|
|
187
|
-
*
|
|
188
|
-
* ```js
|
|
189
|
-
* root.walkComments(comment => {
|
|
190
|
-
* comment.remove()
|
|
191
|
-
* })
|
|
192
|
-
* ```
|
|
193
|
-
*
|
|
194
|
-
* @param callback Iterator receives each node and index.
|
|
195
|
-
* @return Returns `false` if iteration was broke.
|
|
196
|
-
*/
|
|
197
|
-
|
|
198
181
|
/**
|
|
199
182
|
* Insert new node before old node within the container.
|
|
200
183
|
*
|
|
@@ -378,9 +361,22 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
|
378
361
|
callback: (atRule: AtRule, index: number) => false | void
|
|
379
362
|
): false | undefined
|
|
380
363
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
364
|
+
/**
|
|
365
|
+
* Traverses the container’s descendant nodes, calling callback
|
|
366
|
+
* for each comment node.
|
|
367
|
+
*
|
|
368
|
+
* Like `Container#each`, this method is safe
|
|
369
|
+
* to use if you are mutating arrays during iteration.
|
|
370
|
+
*
|
|
371
|
+
* ```js
|
|
372
|
+
* root.walkComments(comment => {
|
|
373
|
+
* comment.remove()
|
|
374
|
+
* })
|
|
375
|
+
* ```
|
|
376
|
+
*
|
|
377
|
+
* @param callback Iterator receives each node and index.
|
|
378
|
+
* @return Returns `false` if iteration was broke.
|
|
379
|
+
*/
|
|
384
380
|
walkComments(
|
|
385
381
|
callback: (comment: Comment, indexed: number) => false | void
|
|
386
382
|
): false | undefined
|
package/lib/declaration.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ declare namespace Declaration {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
export interface DeclarationProps {
|
|
31
|
+
export interface DeclarationProps extends NodeProps {
|
|
32
32
|
/** Whether the declaration has an `!important` annotation. */
|
|
33
33
|
important?: boolean
|
|
34
34
|
/** Name of the declaration. */
|
package/lib/list.js
CHANGED
|
@@ -11,7 +11,7 @@ let list = {
|
|
|
11
11
|
},
|
|
12
12
|
|
|
13
13
|
split(string, separators, last) {
|
|
14
|
-
if (
|
|
14
|
+
if (typeof string !== 'string') return []
|
|
15
15
|
let array = []
|
|
16
16
|
let current = ''
|
|
17
17
|
let split = false
|
|
@@ -42,7 +42,8 @@ let list = {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
if (split) {
|
|
45
|
-
|
|
45
|
+
let value = current.trim()
|
|
46
|
+
if (last || value !== '') array.push(value)
|
|
46
47
|
current = ''
|
|
47
48
|
split = false
|
|
48
49
|
} else {
|
|
@@ -50,7 +51,8 @@ let list = {
|
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
|
|
54
|
+
let value = current.trim()
|
|
55
|
+
if (last || value !== '') array.push(value)
|
|
54
56
|
return array
|
|
55
57
|
}
|
|
56
58
|
}
|
package/lib/map-generator.js
CHANGED
|
@@ -75,9 +75,10 @@ class MapGenerator {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
} else if (this.css) {
|
|
78
|
+
let annotation = '/*# sourceMappingURL='
|
|
78
79
|
let startIndex
|
|
79
|
-
while ((startIndex = this.css.lastIndexOf(
|
|
80
|
-
let endIndex = this.css.indexOf('*/', startIndex +
|
|
80
|
+
while ((startIndex = this.css.lastIndexOf(annotation)) !== -1) {
|
|
81
|
+
let endIndex = this.css.indexOf('*/', startIndex + annotation.length)
|
|
81
82
|
if (endIndex === -1) break
|
|
82
83
|
while (startIndex > 0 && this.css[startIndex - 1] === '\n') {
|
|
83
84
|
startIndex--
|
package/lib/parser.js
CHANGED
|
@@ -354,8 +354,11 @@ class Parser {
|
|
|
354
354
|
if (prev && prev.type === 'rule' && !prev.raws.ownSemicolon) {
|
|
355
355
|
prev.raws.ownSemicolon = this.spaces
|
|
356
356
|
this.spaces = ''
|
|
357
|
+
// `ownSemicolon` also holds the spaces before the semicolon, but
|
|
358
|
+
// the position above is the semicolon itself, so the node ends
|
|
359
|
+
// right after it.
|
|
357
360
|
prev.source.end = this.getPosition(token[2])
|
|
358
|
-
prev.source.end.offset
|
|
361
|
+
prev.source.end.offset++
|
|
359
362
|
}
|
|
360
363
|
}
|
|
361
364
|
}
|
package/lib/postcss.js
CHANGED
|
@@ -38,7 +38,7 @@ postcss.plugin = function plugin(name, initializer) {
|
|
|
38
38
|
': postcss.plugin was deprecated. Migration guide:\n' +
|
|
39
39
|
'https://evilmartians.com/chronicles/postcss-8-plugin-migration'
|
|
40
40
|
)
|
|
41
|
-
if (process.env.LANG && process.env.LANG.startsWith('
|
|
41
|
+
if (process.env.LANG && process.env.LANG.startsWith('zh')) {
|
|
42
42
|
/* c8 ignore next 7 */
|
|
43
43
|
// eslint-disable-next-line no-console
|
|
44
44
|
console.warn(
|
package/lib/previous-map.js
CHANGED
|
@@ -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
|
-
|
|
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
package/lib/stringifier.js
CHANGED
|
@@ -49,6 +49,14 @@ function atruleStart(str, node) {
|
|
|
49
49
|
return name + afterName + params
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
// `*--x` is not a custom property: the parser checks the first token, and the
|
|
53
|
+
// `*`/`_` hack prefix moves from `prop` into `before` only after that.
|
|
54
|
+
function isCustomProperty(node) {
|
|
55
|
+
if (!node.prop.startsWith('--')) return false
|
|
56
|
+
let before = node.raws.before
|
|
57
|
+
return typeof before === 'undefined' || !/\S$/.test(before)
|
|
58
|
+
}
|
|
59
|
+
|
|
52
60
|
function pushBody(str, stack, node) {
|
|
53
61
|
let nodes = node.nodes
|
|
54
62
|
let last = nodes.length - 1
|
|
@@ -70,7 +78,7 @@ function pushBody(str, stack, node) {
|
|
|
70
78
|
!childSemicolon &&
|
|
71
79
|
i < nodes.length - 1 &&
|
|
72
80
|
((child.type === 'atrule' && !child.nodes) ||
|
|
73
|
-
(child.type === 'decl' && child
|
|
81
|
+
(child.type === 'decl' && isCustomProperty(child)))
|
|
74
82
|
) {
|
|
75
83
|
childSemicolon = true
|
|
76
84
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss",
|
|
3
|
-
"version": "8.5.
|
|
3
|
+
"version": "8.5.27",
|
|
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.
|
|
81
|
+
"nanoid": "^3.3.18",
|
|
82
82
|
"picocolors": "^1.1.1",
|
|
83
83
|
"source-map-js": "^1.2.1"
|
|
84
84
|
},
|