postcss 8.5.18 → 8.5.23
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 +1 -2
- package/lib/node.d.ts +2 -2
- package/lib/previous-map.js +5 -11
- package/lib/processor.js +1 -1
- package/lib/root.js +16 -1
- package/lib/stringifier.js +26 -7
- package/lib/warning.js +10 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -13,8 +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" />
|
|
17
|
-
<b><a href="https://evilmartians.com/devtools?utm_source=postcss&utm_campaign=devtools-button&utm_medium=github">Evil Martians</a></b>, go-to agency for <b>developer tools</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>.
|
|
18
17
|
|
|
19
18
|
---
|
|
20
19
|
|
package/lib/node.d.ts
CHANGED
|
@@ -31,12 +31,12 @@ declare namespace Node {
|
|
|
31
31
|
|
|
32
32
|
export interface Position {
|
|
33
33
|
/**
|
|
34
|
-
* Source
|
|
34
|
+
* Source column in file. It starts from 1.
|
|
35
35
|
*/
|
|
36
36
|
column: number
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
* Source
|
|
39
|
+
* Source line in file. It starts from 1.
|
|
40
40
|
*/
|
|
41
41
|
line: number
|
|
42
42
|
|
package/lib/previous-map.js
CHANGED
|
@@ -86,19 +86,13 @@ class PreviousMap {
|
|
|
86
86
|
|
|
87
87
|
loadFile(path, cssFile, trusted) {
|
|
88
88
|
if (!trusted && !this.unsafeMap) {
|
|
89
|
-
if (!/\.map$/i.test(path))
|
|
89
|
+
if (!/\.map$/i.test(path)) return undefined
|
|
90
|
+
if (!cssFile) return undefined
|
|
91
|
+
|
|
92
|
+
let rel = relative(dirname(cssFile), path)
|
|
93
|
+
if (rel === '..' || rel.startsWith('..' + sep) || isAbsolute(rel)) {
|
|
90
94
|
return undefined
|
|
91
95
|
}
|
|
92
|
-
if (cssFile) {
|
|
93
|
-
let relativePath = relative(dirname(cssFile), path)
|
|
94
|
-
if (
|
|
95
|
-
relativePath === '..' ||
|
|
96
|
-
relativePath.startsWith('..' + sep) ||
|
|
97
|
-
isAbsolute(relativePath)
|
|
98
|
-
) {
|
|
99
|
-
return undefined
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
96
|
}
|
|
103
97
|
this.root = dirname(path)
|
|
104
98
|
if (existsSync(path)) {
|
package/lib/processor.js
CHANGED
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
|
|
39
|
+
if (!keepBefore.has(node.raws)) {
|
|
40
|
+
node.raws.before = sample.raws.before
|
|
41
|
+
}
|
|
27
42
|
}
|
|
28
43
|
}
|
|
29
44
|
}
|
package/lib/stringifier.js
CHANGED
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
const STYLE_TAG = /(<)(\/?style\b)/gi
|
|
7
7
|
const COMMENT_OPEN = /(<)(!--)/g
|
|
8
8
|
|
|
9
|
+
// Characters that end an at-rule name, mirroring RE_AT_END in the tokenizer.
|
|
10
|
+
// Params starting with anything else need a space to stay separate tokens.
|
|
11
|
+
const AT_NAME_END = /[\t\n\f\r "#'()/;[\\\]{}]/
|
|
12
|
+
|
|
9
13
|
function escapeHTMLInCSS(str) {
|
|
10
14
|
if (typeof str !== 'string') return str
|
|
11
15
|
if (!str.includes('<')) return str
|
|
@@ -34,14 +38,15 @@ function capitalize(str) {
|
|
|
34
38
|
function atruleStart(str, node) {
|
|
35
39
|
let name = '@' + node.name
|
|
36
40
|
let params = node.params ? str.rawValue(node, 'params') : ''
|
|
41
|
+
let afterName = node.raws.afterName
|
|
37
42
|
|
|
38
|
-
if (typeof
|
|
39
|
-
|
|
40
|
-
} else if (params) {
|
|
41
|
-
|
|
43
|
+
if (typeof afterName === 'undefined') {
|
|
44
|
+
afterName = params ? ' ' : ''
|
|
45
|
+
} else if (afterName === '' && params && !AT_NAME_END.test(params[0])) {
|
|
46
|
+
afterName = ' '
|
|
42
47
|
}
|
|
43
48
|
|
|
44
|
-
return name + params
|
|
49
|
+
return name + afterName + params
|
|
45
50
|
}
|
|
46
51
|
|
|
47
52
|
function pushBody(str, stack, node) {
|
|
@@ -55,10 +60,24 @@ function pushBody(str, stack, node) {
|
|
|
55
60
|
let semicolon = str.raw(node, 'semicolon')
|
|
56
61
|
let isDocument = node.type === 'document'
|
|
57
62
|
for (let i = nodes.length - 1; i >= 0; i--) {
|
|
63
|
+
let child = nodes[i]
|
|
64
|
+
let childSemicolon = last !== i || semicolon
|
|
65
|
+
// A childless at-rule or a custom property declaration that still has
|
|
66
|
+
// following siblings must be terminated. Without the semicolon those
|
|
67
|
+
// trailing comments are folded into the at-rule's prelude or the custom
|
|
68
|
+
// property's value and disappear when the output is re-parsed.
|
|
69
|
+
if (
|
|
70
|
+
!childSemicolon &&
|
|
71
|
+
i < nodes.length - 1 &&
|
|
72
|
+
((child.type === 'atrule' && !child.nodes) ||
|
|
73
|
+
(child.type === 'decl' && child.prop.startsWith('--')))
|
|
74
|
+
) {
|
|
75
|
+
childSemicolon = true
|
|
76
|
+
}
|
|
58
77
|
stack.push({
|
|
59
78
|
document: isDocument,
|
|
60
|
-
node:
|
|
61
|
-
semicolon:
|
|
79
|
+
node: child,
|
|
80
|
+
semicolon: childSemicolon
|
|
62
81
|
})
|
|
63
82
|
}
|
|
64
83
|
}
|
package/lib/warning.js
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
let Container = require('./container')
|
|
4
|
+
let { my } = require('./symbols')
|
|
5
|
+
|
|
3
6
|
class Warning {
|
|
4
7
|
constructor(text, opts = {}) {
|
|
5
8
|
this.type = 'warning'
|
|
6
9
|
this.text = text
|
|
7
10
|
|
|
8
11
|
if (opts.node && opts.node.source) {
|
|
12
|
+
if (!opts.node[my]) {
|
|
13
|
+
// The node comes from another PostCSS copy in node_modules, so it does
|
|
14
|
+
// not have this copy’s methods. Container#normalize() rebuilds such
|
|
15
|
+
// nodes on insert, but a node passed straight to Result#warn() never
|
|
16
|
+
// goes through it.
|
|
17
|
+
Container.rebuild(opts.node)
|
|
18
|
+
}
|
|
9
19
|
let range = opts.node.rangeBy(opts)
|
|
10
20
|
this.line = range.start.line
|
|
11
21
|
this.column = range.start.column
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss",
|
|
3
|
-
"version": "8.5.
|
|
3
|
+
"version": "8.5.23",
|
|
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.16",
|
|
82
82
|
"picocolors": "^1.1.1",
|
|
83
83
|
"source-map-js": "^1.2.1"
|
|
84
84
|
},
|