postcss 8.5.26 → 8.5.28
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/container.d.ts +16 -20
- package/lib/declaration.d.ts +2 -2
- package/lib/list.js +4 -2
- package/lib/map-generator.js +3 -2
- package/lib/parser.js +4 -1
- package/lib/postcss.js +1 -1
- package/lib/processor.js +1 -1
- package/lib/stringifier.js +9 -1
- package/package.json +2 -2
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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ContainerWithChildren } from './container.js'
|
|
2
|
-
import Node from './node.js'
|
|
2
|
+
import Node, { NodeProps } from './node.js'
|
|
3
3
|
|
|
4
4
|
declare namespace Declaration {
|
|
5
5
|
export interface DeclarationRaws extends Record<string, unknown> {
|
|
@@ -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
|
@@ -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/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.28",
|
|
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
|
},
|