postcss 8.4.25 → 8.4.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.
Potentially problematic release.
This version of postcss might be problematic. Click here for more details.
- package/README.md +3 -8
- package/lib/at-rule.d.ts +3 -3
- package/lib/comment.d.ts +3 -3
- package/lib/container.d.ts +39 -38
- package/lib/declaration.d.ts +16 -14
- package/lib/document.d.ts +5 -0
- package/lib/node.d.ts +10 -10
- package/lib/processor.js +1 -1
- package/lib/root.d.ts +5 -1
- package/lib/rule.d.ts +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
@@ -1,12 +1,9 @@
|
|
1
|
-
# PostCSS
|
1
|
+
# PostCSS
|
2
2
|
|
3
3
|
<img align="right" width="95" height="95"
|
4
4
|
alt="Philosopher’s stone, logo of PostCSS"
|
5
5
|
src="https://postcss.org/logo.svg">
|
6
6
|
|
7
|
-
[chat-img]: https://img.shields.io/badge/Gitter-Join_the_PostCSS_chat-brightgreen.svg
|
8
|
-
[chat]: https://gitter.im/postcss/postcss
|
9
|
-
|
10
7
|
PostCSS is a tool for transforming styles with JS plugins.
|
11
8
|
These plugins can lint your CSS, support variables and mixins,
|
12
9
|
transpile future CSS syntax, inline images, and more.
|
@@ -20,10 +17,8 @@ PostCSS takes a CSS file and provides an API to analyze and modify its rules
|
|
20
17
|
This API can then be used by [plugins] to do a lot of useful things,
|
21
18
|
e.g., to find errors automatically, or to insert vendor prefixes.
|
22
19
|
|
23
|
-
**
|
24
|
-
|
25
|
-
**VK.com page:** [postcss](https://vk.com/postcss)<br>
|
26
|
-
**中文翻译**: [`docs/README-cn.md`](./docs/README-cn.md)
|
20
|
+
**Twitter account:** [@postcss](https://twitter.com/postcss)<br>
|
21
|
+
**中文翻译**: [`docs/README-cn.md`](./docs/README-cn.md)
|
27
22
|
|
28
23
|
For PostCSS commercial support (consulting, improving the front-end culture
|
29
24
|
of your company, PostCSS plugins), contact [Evil Martians]
|
package/lib/at-rule.d.ts
CHANGED
@@ -105,9 +105,9 @@ declare class AtRule_ extends Container {
|
|
105
105
|
|
106
106
|
constructor(defaults?: AtRule.AtRuleProps)
|
107
107
|
assign(overrides: AtRule.AtRuleProps | object): this
|
108
|
-
clone(overrides?: Partial<AtRule.AtRuleProps>):
|
109
|
-
cloneAfter(overrides?: Partial<AtRule.AtRuleProps>):
|
110
|
-
cloneBefore(overrides?: Partial<AtRule.AtRuleProps>):
|
108
|
+
clone(overrides?: Partial<AtRule.AtRuleProps>): AtRule
|
109
|
+
cloneAfter(overrides?: Partial<AtRule.AtRuleProps>): AtRule
|
110
|
+
cloneBefore(overrides?: Partial<AtRule.AtRuleProps>): AtRule
|
111
111
|
}
|
112
112
|
|
113
113
|
declare class AtRule extends AtRule_ {}
|
package/lib/comment.d.ts
CHANGED
@@ -57,9 +57,9 @@ declare class Comment_ extends Node {
|
|
57
57
|
|
58
58
|
constructor(defaults?: Comment.CommentProps)
|
59
59
|
assign(overrides: Comment.CommentProps | object): this
|
60
|
-
clone(overrides?: Partial<Comment.CommentProps>):
|
61
|
-
cloneAfter(overrides?: Partial<Comment.CommentProps>):
|
62
|
-
cloneBefore(overrides?: Partial<Comment.CommentProps>):
|
60
|
+
clone(overrides?: Partial<Comment.CommentProps>): Comment
|
61
|
+
cloneAfter(overrides?: Partial<Comment.CommentProps>): Comment
|
62
|
+
cloneBefore(overrides?: Partial<Comment.CommentProps>): Comment
|
63
63
|
}
|
64
64
|
|
65
65
|
declare class Comment extends Comment_ {}
|
package/lib/container.d.ts
CHANGED
@@ -32,9 +32,7 @@ declare namespace Container {
|
|
32
32
|
* Note that all containers can store any content. If you write a rule inside
|
33
33
|
* a rule, PostCSS will parse it.
|
34
34
|
*/
|
35
|
-
declare abstract class Container_<
|
36
|
-
Child extends Node = ChildNode
|
37
|
-
> extends Node {
|
35
|
+
declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
38
36
|
/**
|
39
37
|
* An array containing the container’s children.
|
40
38
|
*
|
@@ -71,6 +69,11 @@ declare abstract class Container_<
|
|
71
69
|
...nodes: (ChildProps | ChildProps[] | Node | Node[] | string | string[])[]
|
72
70
|
): this
|
73
71
|
|
72
|
+
assign(overrides: Container.ContainerProps | object): this
|
73
|
+
clone(overrides?: Partial<Container.ContainerProps>): Container<Child>
|
74
|
+
cloneAfter(overrides?: Partial<Container.ContainerProps>): Container<Child>
|
75
|
+
cloneBefore(overrides?: Partial<Container.ContainerProps>): Container<Child>
|
76
|
+
|
74
77
|
/**
|
75
78
|
* Iterates through the container’s immediate children,
|
76
79
|
* calling `callback` for each child.
|
@@ -122,7 +125,6 @@ declare abstract class Container_<
|
|
122
125
|
every(
|
123
126
|
condition: (node: Child, index: number, nodes: Child[]) => boolean
|
124
127
|
): boolean
|
125
|
-
|
126
128
|
/**
|
127
129
|
* The container’s first child.
|
128
130
|
*
|
@@ -155,6 +157,23 @@ declare abstract class Container_<
|
|
155
157
|
newNode: Child | Child[] | ChildProps | ChildProps[] | string | string[]
|
156
158
|
): this
|
157
159
|
|
160
|
+
/**
|
161
|
+
* Traverses the container’s descendant nodes, calling callback
|
162
|
+
* for each comment node.
|
163
|
+
*
|
164
|
+
* Like `Container#each`, this method is safe
|
165
|
+
* to use if you are mutating arrays during iteration.
|
166
|
+
*
|
167
|
+
* ```js
|
168
|
+
* root.walkComments(comment => {
|
169
|
+
* comment.remove()
|
170
|
+
* })
|
171
|
+
* ```
|
172
|
+
*
|
173
|
+
* @param callback Iterator receives each node and index.
|
174
|
+
* @return Returns `false` if iteration was broke.
|
175
|
+
*/
|
176
|
+
|
158
177
|
/**
|
159
178
|
* Insert new node before old node within the container.
|
160
179
|
*
|
@@ -202,6 +221,7 @@ declare abstract class Container_<
|
|
202
221
|
prepend(
|
203
222
|
...nodes: (ChildProps | ChildProps[] | Node | Node[] | string | string[])[]
|
204
223
|
): this
|
224
|
+
|
205
225
|
/**
|
206
226
|
* Add child to the end of the node.
|
207
227
|
*
|
@@ -214,23 +234,6 @@ declare abstract class Container_<
|
|
214
234
|
*/
|
215
235
|
push(child: Child): this
|
216
236
|
|
217
|
-
/**
|
218
|
-
* Traverses the container’s descendant nodes, calling callback
|
219
|
-
* for each comment node.
|
220
|
-
*
|
221
|
-
* Like `Container#each`, this method is safe
|
222
|
-
* to use if you are mutating arrays during iteration.
|
223
|
-
*
|
224
|
-
* ```js
|
225
|
-
* root.walkComments(comment => {
|
226
|
-
* comment.remove()
|
227
|
-
* })
|
228
|
-
* ```
|
229
|
-
*
|
230
|
-
* @param callback Iterator receives each node and index.
|
231
|
-
* @return Returns `false` if iteration was broke.
|
232
|
-
*/
|
233
|
-
|
234
237
|
/**
|
235
238
|
* Removes all children from the container
|
236
239
|
* and cleans their parent properties.
|
@@ -243,6 +246,7 @@ declare abstract class Container_<
|
|
243
246
|
* @return This node for methods chain.
|
244
247
|
*/
|
245
248
|
removeAll(): this
|
249
|
+
|
246
250
|
/**
|
247
251
|
* Removes node from the container and cleans the parent properties
|
248
252
|
* from the node and its children.
|
@@ -259,6 +263,11 @@ declare abstract class Container_<
|
|
259
263
|
*/
|
260
264
|
removeChild(child: Child | number): this
|
261
265
|
|
266
|
+
replaceValues(
|
267
|
+
pattern: RegExp | string,
|
268
|
+
replaced: { (substring: string, ...args: any[]): string } | string
|
269
|
+
): this
|
270
|
+
|
262
271
|
/**
|
263
272
|
* Passes all declaration values within the container that match pattern
|
264
273
|
* through callback, replacing those values with the returned result
|
@@ -288,11 +297,6 @@ declare abstract class Container_<
|
|
288
297
|
replaced: { (substring: string, ...args: any[]): string } | string
|
289
298
|
): this
|
290
299
|
|
291
|
-
replaceValues(
|
292
|
-
pattern: RegExp | string,
|
293
|
-
replaced: { (substring: string, ...args: any[]): string } | string
|
294
|
-
): this
|
295
|
-
|
296
300
|
/**
|
297
301
|
* Returns `true` if callback returns `true` for (at least) one
|
298
302
|
* of the container’s children.
|
@@ -330,11 +334,6 @@ declare abstract class Container_<
|
|
330
334
|
walk(
|
331
335
|
callback: (node: ChildNode, index: number) => false | void
|
332
336
|
): false | undefined
|
333
|
-
|
334
|
-
walkAtRules(
|
335
|
-
callback: (atRule: AtRule, index: number) => false | void
|
336
|
-
): false | undefined
|
337
|
-
|
338
337
|
/**
|
339
338
|
* Traverses the container’s descendant nodes, calling callback
|
340
339
|
* for each at-rule node.
|
@@ -369,6 +368,10 @@ declare abstract class Container_<
|
|
369
368
|
callback: (atRule: AtRule, index: number) => false | void
|
370
369
|
): false | undefined
|
371
370
|
|
371
|
+
walkAtRules(
|
372
|
+
callback: (atRule: AtRule, index: number) => false | void
|
373
|
+
): false | undefined
|
374
|
+
|
372
375
|
walkComments(
|
373
376
|
callback: (comment: Comment, indexed: number) => false | void
|
374
377
|
): false | undefined
|
@@ -376,9 +379,6 @@ declare abstract class Container_<
|
|
376
379
|
walkComments(
|
377
380
|
callback: (comment: Comment, indexed: number) => false | void
|
378
381
|
): false | undefined
|
379
|
-
walkDecls(
|
380
|
-
callback: (decl: Declaration, index: number) => false | void
|
381
|
-
): false | undefined
|
382
382
|
|
383
383
|
/**
|
384
384
|
* Traverses the container’s descendant nodes, calling callback
|
@@ -413,11 +413,9 @@ declare abstract class Container_<
|
|
413
413
|
propFilter: RegExp | string,
|
414
414
|
callback: (decl: Declaration, index: number) => false | void
|
415
415
|
): false | undefined
|
416
|
-
|
417
|
-
|
418
|
-
callback: (rule: Rule, index: number) => false | void
|
416
|
+
walkDecls(
|
417
|
+
callback: (decl: Declaration, index: number) => false | void
|
419
418
|
): false | undefined
|
420
|
-
|
421
419
|
/**
|
422
420
|
* Traverses the container’s descendant nodes, calling callback
|
423
421
|
* for each rule node.
|
@@ -444,6 +442,9 @@ declare abstract class Container_<
|
|
444
442
|
selectorFilter: RegExp | string,
|
445
443
|
callback: (rule: Rule, index: number) => false | void
|
446
444
|
): false | undefined
|
445
|
+
walkRules(
|
446
|
+
callback: (rule: Rule, index: number) => false | void
|
447
|
+
): false | undefined
|
447
448
|
}
|
448
449
|
|
449
450
|
declare class Container<Child extends Node = ChildNode> extends Container_<Child> {}
|
package/lib/declaration.d.ts
CHANGED
@@ -58,8 +58,8 @@ declare namespace Declaration {
|
|
58
58
|
* const root = postcss.parse('a { color: black }')
|
59
59
|
* const decl = root.first?.first
|
60
60
|
*
|
61
|
-
*
|
62
|
-
*
|
61
|
+
* decl.type //=> 'decl'
|
62
|
+
* decl.toString() //=> ' color: black'
|
63
63
|
* ```
|
64
64
|
*/
|
65
65
|
declare class Declaration_ extends Node {
|
@@ -73,20 +73,22 @@ declare class Declaration_ extends Node {
|
|
73
73
|
* ```js
|
74
74
|
* const root = postcss.parse('a { color: black !important; color: red }')
|
75
75
|
*
|
76
|
-
*
|
77
|
-
*
|
76
|
+
* root.first.first.important //=> true
|
77
|
+
* root.first.last.important //=> undefined
|
78
78
|
* ```
|
79
79
|
*/
|
80
80
|
important: boolean
|
81
|
+
|
81
82
|
parent: Container | undefined
|
83
|
+
|
82
84
|
/**
|
83
85
|
* The property name for a CSS declaration.
|
84
86
|
*
|
85
87
|
* ```js
|
86
88
|
* const root = postcss.parse('a { color: black }')
|
87
|
-
* const decl = root.first
|
89
|
+
* const decl = root.first.first
|
88
90
|
*
|
89
|
-
*
|
91
|
+
* decl.prop //=> 'color'
|
90
92
|
* ```
|
91
93
|
*/
|
92
94
|
prop: string
|
@@ -107,9 +109,9 @@ declare class Declaration_ extends Node {
|
|
107
109
|
*
|
108
110
|
* ```js
|
109
111
|
* const root = postcss.parse('a { color: black }')
|
110
|
-
* const decl = root.first
|
112
|
+
* const decl = root.first.first
|
111
113
|
*
|
112
|
-
*
|
114
|
+
* decl.value //=> 'black'
|
113
115
|
* ```
|
114
116
|
*/
|
115
117
|
value: string
|
@@ -120,25 +122,25 @@ declare class Declaration_ extends Node {
|
|
120
122
|
*
|
121
123
|
* ```js
|
122
124
|
* const root = postcss.parse(':root { --one: 1 }')
|
123
|
-
* const one = root.first
|
125
|
+
* const one = root.first.first
|
124
126
|
*
|
125
|
-
*
|
127
|
+
* one.variable //=> true
|
126
128
|
* ```
|
127
129
|
*
|
128
130
|
* ```js
|
129
131
|
* const root = postcss.parse('$one: 1')
|
130
132
|
* const one = root.first
|
131
133
|
*
|
132
|
-
*
|
134
|
+
* one.variable //=> true
|
133
135
|
* ```
|
134
136
|
*/
|
135
137
|
variable: boolean
|
136
138
|
|
137
139
|
constructor(defaults?: Declaration.DeclarationProps)
|
138
140
|
assign(overrides: Declaration.DeclarationProps | object): this
|
139
|
-
clone(overrides?: Partial<Declaration.DeclarationProps>):
|
140
|
-
cloneAfter(overrides?: Partial<Declaration.DeclarationProps>):
|
141
|
-
cloneBefore(overrides?: Partial<Declaration.DeclarationProps>):
|
141
|
+
clone(overrides?: Partial<Declaration.DeclarationProps>): Declaration
|
142
|
+
cloneAfter(overrides?: Partial<Declaration.DeclarationProps>): Declaration
|
143
|
+
cloneBefore(overrides?: Partial<Declaration.DeclarationProps>): Declaration
|
142
144
|
}
|
143
145
|
|
144
146
|
declare class Declaration extends Declaration_ {}
|
package/lib/document.d.ts
CHANGED
@@ -40,6 +40,11 @@ declare class Document_ extends Container<Root> {
|
|
40
40
|
|
41
41
|
constructor(defaults?: Document.DocumentProps)
|
42
42
|
|
43
|
+
assign(overrides: Document.DocumentProps | object): this
|
44
|
+
clone(overrides?: Partial<Document.DocumentProps>): Document
|
45
|
+
cloneAfter(overrides?: Partial<Document.DocumentProps>): Document
|
46
|
+
cloneBefore(overrides?: Partial<Document.DocumentProps>): Document
|
47
|
+
|
43
48
|
/**
|
44
49
|
* Returns a `Result` instance representing the document’s CSS roots.
|
45
50
|
*
|
package/lib/node.d.ts
CHANGED
@@ -128,7 +128,7 @@ declare abstract class Node_ {
|
|
128
128
|
* It represents parent of the current node.
|
129
129
|
*
|
130
130
|
* ```js
|
131
|
-
*
|
131
|
+
* root.nodes[0].parent === root //=> true
|
132
132
|
* ```
|
133
133
|
*/
|
134
134
|
parent: Container | Document | undefined
|
@@ -164,7 +164,7 @@ declare abstract class Node_ {
|
|
164
164
|
*
|
165
165
|
* ```js
|
166
166
|
* const root = postcss.parse('a {\n color:black\n}')
|
167
|
-
*
|
167
|
+
* root.first.first.raws //=> { before: '\n ', between: ':' }
|
168
168
|
* ```
|
169
169
|
*/
|
170
170
|
raws: any
|
@@ -183,9 +183,9 @@ declare abstract class Node_ {
|
|
183
183
|
* source to a node created manually.
|
184
184
|
*
|
185
185
|
* ```js
|
186
|
-
*
|
187
|
-
*
|
188
|
-
*
|
186
|
+
* decl.source.input.from //=> '/home/ai/source.css'
|
187
|
+
* decl.source.start //=> { line: 10, column: 2 }
|
188
|
+
* decl.source.end //=> { line: 10, column: 12 }
|
189
189
|
* ```
|
190
190
|
*
|
191
191
|
* ```js
|
@@ -227,7 +227,7 @@ declare abstract class Node_ {
|
|
227
227
|
* value: 'black'
|
228
228
|
* })
|
229
229
|
*
|
230
|
-
*
|
230
|
+
* declaration.type //=> 'decl'
|
231
231
|
* ```
|
232
232
|
*/
|
233
233
|
type: string
|
@@ -303,7 +303,7 @@ declare abstract class Node_ {
|
|
303
303
|
*
|
304
304
|
* @return Duplicate of the node instance.
|
305
305
|
*/
|
306
|
-
clone(overrides?: object):
|
306
|
+
clone(overrides?: object): Node
|
307
307
|
|
308
308
|
/**
|
309
309
|
* Shortcut to clone the node and insert the resulting cloned node
|
@@ -312,7 +312,7 @@ declare abstract class Node_ {
|
|
312
312
|
* @param overrides New properties to override in the clone.
|
313
313
|
* @return New node.
|
314
314
|
*/
|
315
|
-
cloneAfter(overrides?: object):
|
315
|
+
cloneAfter(overrides?: object): Node
|
316
316
|
|
317
317
|
/**
|
318
318
|
* Shortcut to clone the node and insert the resulting cloned node
|
@@ -326,7 +326,7 @@ declare abstract class Node_ {
|
|
326
326
|
*
|
327
327
|
* @return New node
|
328
328
|
*/
|
329
|
-
cloneBefore(overrides?: object):
|
329
|
+
cloneBefore(overrides?: object): Node
|
330
330
|
|
331
331
|
/**
|
332
332
|
* It creates an instance of the class `CssSyntaxError` and parameters passed
|
@@ -502,7 +502,7 @@ declare abstract class Node_ {
|
|
502
502
|
* depending on it's type.
|
503
503
|
*
|
504
504
|
* ```js
|
505
|
-
*
|
505
|
+
* new Rule({ selector: 'a' }).toString() //=> "a {}"
|
506
506
|
* ```
|
507
507
|
*
|
508
508
|
* @param stringifier A syntax to use in string generation.
|
package/lib/processor.js
CHANGED
package/lib/root.d.ts
CHANGED
@@ -61,6 +61,10 @@ declare class Root_ extends Container {
|
|
61
61
|
constructor(defaults?: Root.RootProps)
|
62
62
|
|
63
63
|
assign(overrides: object | Root.RootProps): this
|
64
|
+
clone(overrides?: Partial<Root.RootProps>): Root
|
65
|
+
cloneAfter(overrides?: Partial<Root.RootProps>): Root
|
66
|
+
cloneBefore(overrides?: Partial<Root.RootProps>): Root
|
67
|
+
|
64
68
|
/**
|
65
69
|
* Returns a `Result` instance representing the root’s CSS.
|
66
70
|
*
|
@@ -74,7 +78,7 @@ declare class Root_ extends Container {
|
|
74
78
|
* @param opts Options.
|
75
79
|
* @return Result with current root’s CSS.
|
76
80
|
*/
|
77
|
-
|
81
|
+
toResult(options?: ProcessOptions): Result
|
78
82
|
}
|
79
83
|
|
80
84
|
declare class Root extends Root_ {}
|
package/lib/rule.d.ts
CHANGED
@@ -103,9 +103,9 @@ declare class Rule_ extends Container {
|
|
103
103
|
|
104
104
|
constructor(defaults?: Rule.RuleProps)
|
105
105
|
assign(overrides: object | Rule.RuleProps): this
|
106
|
-
clone(overrides?: Partial<Rule.RuleProps>):
|
107
|
-
cloneAfter(overrides?: Partial<Rule.RuleProps>):
|
108
|
-
cloneBefore(overrides?: Partial<Rule.RuleProps>):
|
106
|
+
clone(overrides?: Partial<Rule.RuleProps>): Rule
|
107
|
+
cloneAfter(overrides?: Partial<Rule.RuleProps>): Rule
|
108
|
+
cloneBefore(overrides?: Partial<Rule.RuleProps>): Rule
|
109
109
|
}
|
110
110
|
|
111
111
|
declare class Rule extends Rule_ {}
|