postcss 8.4.49 → 8.5.10
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/LICENSE +1 -1
- package/README.md +8 -8
- package/lib/at-rule.d.ts +9 -10
- package/lib/comment.d.ts +7 -8
- package/lib/container.d.ts +48 -53
- package/lib/container.js +10 -10
- package/lib/css-syntax-error.d.ts +0 -1
- package/lib/declaration.d.ts +9 -10
- package/lib/declaration.js +4 -4
- package/lib/document.d.ts +0 -1
- package/lib/fromJSON.d.ts +1 -1
- package/lib/input.d.ts +49 -20
- package/lib/input.js +51 -26
- package/lib/lazy-result.d.ts +43 -44
- package/lib/lazy-result.js +32 -32
- package/lib/list.d.ts +1 -1
- package/lib/map-generator.js +9 -1
- package/lib/no-work-result.d.ts +5 -6
- package/lib/no-work-result.js +53 -54
- package/lib/node.d.ts +25 -11
- package/lib/node.js +54 -30
- package/lib/parse.d.ts +1 -1
- package/lib/parser.js +4 -2
- package/lib/postcss.d.mts +31 -34
- package/lib/postcss.d.ts +7 -4
- package/lib/previous-map.d.ts +0 -1
- package/lib/previous-map.js +2 -1
- package/lib/processor.d.ts +0 -1
- package/lib/processor.js +1 -1
- package/lib/result.d.ts +10 -11
- package/lib/result.js +5 -5
- package/lib/root.d.ts +0 -1
- package/lib/rule.d.ts +21 -21
- package/lib/rule.js +6 -6
- package/lib/stringifier.d.ts +2 -3
- package/lib/stringifier.js +25 -8
- package/lib/stringify.d.ts +1 -1
- package/lib/warning.d.ts +0 -1
- package/package.json +46 -46
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright 2013 Andrey Sitnik <andrey@sitnik.
|
|
3
|
+
Copyright 2013 Andrey Sitnik <andrey@sitnik.es>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
6
|
this software and associated documentation files (the "Software"), to deal in
|
package/README.md
CHANGED
|
@@ -9,20 +9,20 @@ These plugins can lint your CSS, support variables and mixins,
|
|
|
9
9
|
transpile future CSS syntax, inline images, and more.
|
|
10
10
|
|
|
11
11
|
PostCSS is used by industry leaders including Wikipedia, Twitter, Alibaba,
|
|
12
|
-
and JetBrains. The [Autoprefixer] and [Stylelint] PostCSS plugins
|
|
12
|
+
and JetBrains. The [Autoprefixer] and [Stylelint] PostCSS plugins are some of the most popular CSS tools.
|
|
13
13
|
|
|
14
14
|
---
|
|
15
15
|
|
|
16
|
-
<img src="https://cdn.evilmartians.com/badges/logo-no-label.svg" alt="" width="22" height="16" />
|
|
16
|
+
<img src="https://cdn.evilmartians.com/badges/logo-no-label.svg" alt="" width="22" height="16" /> Built by
|
|
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>.
|
|
17
18
|
|
|
18
19
|
---
|
|
19
20
|
|
|
20
|
-
[Abstract
|
|
21
|
-
[Evil
|
|
22
|
-
[Autoprefixer]:
|
|
23
|
-
[Stylelint]:
|
|
24
|
-
[plugins]:
|
|
25
|
-
|
|
21
|
+
[Abstract Syntax Tree]: https://en.wikipedia.org/wiki/Abstract_syntax_tree
|
|
22
|
+
[Evil Martians]: https://evilmartians.com/?utm_source=postcss
|
|
23
|
+
[Autoprefixer]: https://github.com/postcss/autoprefixer
|
|
24
|
+
[Stylelint]: https://stylelint.io/
|
|
25
|
+
[plugins]: https://github.com/postcss/postcss#plugins
|
|
26
26
|
|
|
27
27
|
## Docs
|
|
28
28
|
Read full docs **[here](https://postcss.org/)**.
|
package/lib/at-rule.d.ts
CHANGED
|
@@ -49,7 +49,6 @@ declare namespace AtRule {
|
|
|
49
49
|
raws?: AtRuleRaws
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
53
52
|
export { AtRule_ as default }
|
|
54
53
|
}
|
|
55
54
|
|
|
@@ -97,19 +96,11 @@ declare class AtRule_ extends Container {
|
|
|
97
96
|
* layer.nodes //=> undefined
|
|
98
97
|
* ```
|
|
99
98
|
*/
|
|
100
|
-
nodes: Container['nodes']
|
|
99
|
+
nodes: Container['nodes'] | undefined
|
|
101
100
|
parent: ContainerWithChildren | undefined
|
|
102
101
|
|
|
103
102
|
raws: AtRule.AtRuleRaws
|
|
104
103
|
type: 'atrule'
|
|
105
|
-
constructor(defaults?: AtRule.AtRuleProps)
|
|
106
|
-
assign(overrides: AtRule.AtRuleProps | object): this
|
|
107
|
-
|
|
108
|
-
clone(overrides?: Partial<AtRule.AtRuleProps>): this
|
|
109
|
-
|
|
110
|
-
cloneAfter(overrides?: Partial<AtRule.AtRuleProps>): this
|
|
111
|
-
|
|
112
|
-
cloneBefore(overrides?: Partial<AtRule.AtRuleProps>): this
|
|
113
104
|
/**
|
|
114
105
|
* The at-rule’s name immediately follows the `@`.
|
|
115
106
|
*
|
|
@@ -121,6 +112,7 @@ declare class AtRule_ extends Container {
|
|
|
121
112
|
*/
|
|
122
113
|
get name(): string
|
|
123
114
|
set name(value: string)
|
|
115
|
+
|
|
124
116
|
/**
|
|
125
117
|
* The at-rule’s parameters, the values that follow the at-rule’s name
|
|
126
118
|
* but precede any `{}` block.
|
|
@@ -132,7 +124,14 @@ declare class AtRule_ extends Container {
|
|
|
132
124
|
* ```
|
|
133
125
|
*/
|
|
134
126
|
get params(): string
|
|
127
|
+
|
|
135
128
|
set params(value: string)
|
|
129
|
+
|
|
130
|
+
constructor(defaults?: AtRule.AtRuleProps)
|
|
131
|
+
assign(overrides: AtRule.AtRuleProps | object): this
|
|
132
|
+
clone(overrides?: Partial<AtRule.AtRuleProps>): this
|
|
133
|
+
cloneAfter(overrides?: Partial<AtRule.AtRuleProps>): this
|
|
134
|
+
cloneBefore(overrides?: Partial<AtRule.AtRuleProps>): this
|
|
136
135
|
}
|
|
137
136
|
|
|
138
137
|
declare class AtRule extends AtRule_ {}
|
package/lib/comment.d.ts
CHANGED
|
@@ -26,7 +26,6 @@ declare namespace Comment {
|
|
|
26
26
|
text: string
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
30
29
|
export { Comment_ as default }
|
|
31
30
|
}
|
|
32
31
|
|
|
@@ -49,18 +48,18 @@ declare class Comment_ extends Node {
|
|
|
49
48
|
parent: Container | undefined
|
|
50
49
|
raws: Comment.CommentRaws
|
|
51
50
|
type: 'comment'
|
|
52
|
-
constructor(defaults?: Comment.CommentProps)
|
|
53
|
-
|
|
54
|
-
assign(overrides: Comment.CommentProps | object): this
|
|
55
|
-
|
|
56
|
-
clone(overrides?: Partial<Comment.CommentProps>): this
|
|
57
|
-
cloneAfter(overrides?: Partial<Comment.CommentProps>): this
|
|
58
|
-
cloneBefore(overrides?: Partial<Comment.CommentProps>): this
|
|
59
51
|
/**
|
|
60
52
|
* The comment's text.
|
|
61
53
|
*/
|
|
62
54
|
get text(): string
|
|
55
|
+
|
|
63
56
|
set text(value: string)
|
|
57
|
+
|
|
58
|
+
constructor(defaults?: Comment.CommentProps)
|
|
59
|
+
assign(overrides: Comment.CommentProps | object): this
|
|
60
|
+
clone(overrides?: Partial<Comment.CommentProps>): this
|
|
61
|
+
cloneAfter(overrides?: Partial<Comment.CommentProps>): this
|
|
62
|
+
cloneBefore(overrides?: Partial<Comment.CommentProps>): this
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
declare class Comment extends Comment_ {}
|
package/lib/container.d.ts
CHANGED
|
@@ -2,14 +2,13 @@ import AtRule from './at-rule.js'
|
|
|
2
2
|
import Comment from './comment.js'
|
|
3
3
|
import Declaration from './declaration.js'
|
|
4
4
|
import Node, { ChildNode, ChildProps, NodeProps } from './node.js'
|
|
5
|
+
import { Root } from './postcss.js'
|
|
5
6
|
import Rule from './rule.js'
|
|
6
7
|
|
|
7
8
|
declare namespace Container {
|
|
8
|
-
export
|
|
9
|
-
Child extends Node = ChildNode
|
|
10
|
-
> extends Container_<Child> {
|
|
9
|
+
export type ContainerWithChildren<Child extends Node = ChildNode> = {
|
|
11
10
|
nodes: Child[]
|
|
12
|
-
}
|
|
11
|
+
} & (AtRule | Root | Rule)
|
|
13
12
|
|
|
14
13
|
export interface ValueOptions {
|
|
15
14
|
/**
|
|
@@ -40,7 +39,6 @@ declare namespace Container {
|
|
|
40
39
|
| string
|
|
41
40
|
| undefined
|
|
42
41
|
|
|
43
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
44
42
|
export { Container_ as default }
|
|
45
43
|
}
|
|
46
44
|
|
|
@@ -65,25 +63,22 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
|
65
63
|
nodes: Child[] | undefined
|
|
66
64
|
|
|
67
65
|
/**
|
|
68
|
-
*
|
|
69
|
-
* child nodes that can then be added to this container.
|
|
70
|
-
*
|
|
71
|
-
* This ensures that the nodes' parent is set to this container, that they use
|
|
72
|
-
* the correct prototype chain, and that they're marked as dirty.
|
|
66
|
+
* The container’s first child.
|
|
73
67
|
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* @param type This should be set to `'prepend'` if the new nodes will be
|
|
78
|
-
* inserted at the beginning of the container.
|
|
79
|
-
* @hidden
|
|
68
|
+
* ```js
|
|
69
|
+
* rule.first === rules.nodes[0]
|
|
70
|
+
* ```
|
|
80
71
|
*/
|
|
81
|
-
|
|
82
|
-
nodes: Container.NewChild,
|
|
83
|
-
sample: Node | undefined,
|
|
84
|
-
type?: 'prepend' | false
|
|
85
|
-
): Child[]
|
|
72
|
+
get first(): Child | undefined
|
|
86
73
|
|
|
74
|
+
/**
|
|
75
|
+
* The container’s last child.
|
|
76
|
+
*
|
|
77
|
+
* ```js
|
|
78
|
+
* rule.last === rule.nodes[rule.nodes.length - 1]
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
get last(): Child | undefined
|
|
87
82
|
/**
|
|
88
83
|
* Inserts new nodes to the end of the container.
|
|
89
84
|
*
|
|
@@ -107,10 +102,10 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
|
107
102
|
append(...nodes: Container.NewChild[]): this
|
|
108
103
|
assign(overrides: Container.ContainerProps | object): this
|
|
109
104
|
clone(overrides?: Partial<Container.ContainerProps>): this
|
|
105
|
+
|
|
110
106
|
cloneAfter(overrides?: Partial<Container.ContainerProps>): this
|
|
111
107
|
|
|
112
108
|
cloneBefore(overrides?: Partial<Container.ContainerProps>): this
|
|
113
|
-
|
|
114
109
|
/**
|
|
115
110
|
* Iterates through the container’s immediate children,
|
|
116
111
|
* calling `callback` for each child.
|
|
@@ -147,6 +142,7 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
|
147
142
|
each(
|
|
148
143
|
callback: (node: Child, index: number) => false | void
|
|
149
144
|
): false | undefined
|
|
145
|
+
|
|
150
146
|
/**
|
|
151
147
|
* Returns `true` if callback returns `true`
|
|
152
148
|
* for all of the container’s children.
|
|
@@ -161,7 +157,6 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
|
161
157
|
every(
|
|
162
158
|
condition: (node: Child, index: number, nodes: Child[]) => boolean
|
|
163
159
|
): boolean
|
|
164
|
-
|
|
165
160
|
/**
|
|
166
161
|
* Returns a `child`’s index within the `Container#nodes` array.
|
|
167
162
|
*
|
|
@@ -173,6 +168,7 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
|
173
168
|
* @return Child index.
|
|
174
169
|
*/
|
|
175
170
|
index(child: Child | number): number
|
|
171
|
+
|
|
176
172
|
/**
|
|
177
173
|
* Insert new node after old node within the container.
|
|
178
174
|
*
|
|
@@ -182,19 +178,6 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
|
182
178
|
*/
|
|
183
179
|
insertAfter(oldNode: Child | number, newNode: Container.NewChild): this
|
|
184
180
|
|
|
185
|
-
/**
|
|
186
|
-
* Insert new node before old node within the container.
|
|
187
|
-
*
|
|
188
|
-
* ```js
|
|
189
|
-
* rule.insertBefore(decl, decl.clone({ prop: '-webkit-' + decl.prop }))
|
|
190
|
-
* ```
|
|
191
|
-
*
|
|
192
|
-
* @param oldNode Child or child’s index.
|
|
193
|
-
* @param newNode New node.
|
|
194
|
-
* @return This node for methods chain.
|
|
195
|
-
*/
|
|
196
|
-
insertBefore(oldNode: Child | number, newNode: Container.NewChild): this
|
|
197
|
-
|
|
198
181
|
/**
|
|
199
182
|
* Traverses the container’s descendant nodes, calling callback
|
|
200
183
|
* for each comment node.
|
|
@@ -212,6 +195,18 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
|
212
195
|
* @return Returns `false` if iteration was broke.
|
|
213
196
|
*/
|
|
214
197
|
|
|
198
|
+
/**
|
|
199
|
+
* Insert new node before old node within the container.
|
|
200
|
+
*
|
|
201
|
+
* ```js
|
|
202
|
+
* rule.insertBefore(decl, decl.clone({ prop: '-webkit-' + decl.prop }))
|
|
203
|
+
* ```
|
|
204
|
+
*
|
|
205
|
+
* @param oldNode Child or child’s index.
|
|
206
|
+
* @param newNode New node.
|
|
207
|
+
* @return This node for methods chain.
|
|
208
|
+
*/
|
|
209
|
+
insertBefore(oldNode: Child | number, newNode: Container.NewChild): this
|
|
215
210
|
/**
|
|
216
211
|
* Inserts new nodes to the start of the container.
|
|
217
212
|
*
|
|
@@ -233,6 +228,7 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
|
233
228
|
* @return This node for methods chain.
|
|
234
229
|
*/
|
|
235
230
|
prepend(...nodes: Container.NewChild[]): this
|
|
231
|
+
|
|
236
232
|
/**
|
|
237
233
|
* Add child to the end of the node.
|
|
238
234
|
*
|
|
@@ -278,7 +274,6 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
|
278
274
|
pattern: RegExp | string,
|
|
279
275
|
replaced: { (substring: string, ...args: any[]): string } | string
|
|
280
276
|
): this
|
|
281
|
-
|
|
282
277
|
/**
|
|
283
278
|
* Passes all declaration values within the container that match pattern
|
|
284
279
|
* through callback, replacing those values with the returned result
|
|
@@ -379,14 +374,13 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
|
379
374
|
nameFilter: RegExp | string,
|
|
380
375
|
callback: (atRule: AtRule, index: number) => false | void
|
|
381
376
|
): false | undefined
|
|
382
|
-
|
|
383
377
|
walkAtRules(
|
|
384
378
|
callback: (atRule: AtRule, index: number) => false | void
|
|
385
379
|
): false | undefined
|
|
380
|
+
|
|
386
381
|
walkComments(
|
|
387
382
|
callback: (comment: Comment, indexed: number) => false | void
|
|
388
383
|
): false | undefined
|
|
389
|
-
|
|
390
384
|
walkComments(
|
|
391
385
|
callback: (comment: Comment, indexed: number) => false | void
|
|
392
386
|
): false | undefined
|
|
@@ -424,11 +418,9 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
|
424
418
|
propFilter: RegExp | string,
|
|
425
419
|
callback: (decl: Declaration, index: number) => false | void
|
|
426
420
|
): false | undefined
|
|
427
|
-
|
|
428
421
|
walkDecls(
|
|
429
422
|
callback: (decl: Declaration, index: number) => false | void
|
|
430
423
|
): false | undefined
|
|
431
|
-
|
|
432
424
|
/**
|
|
433
425
|
* Traverses the container’s descendant nodes, calling callback
|
|
434
426
|
* for each rule node.
|
|
@@ -459,21 +451,24 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
|
459
451
|
callback: (rule: Rule, index: number) => false | void
|
|
460
452
|
): false | undefined
|
|
461
453
|
/**
|
|
462
|
-
*
|
|
454
|
+
* An internal method that converts a {@link NewChild} into a list of actual
|
|
455
|
+
* child nodes that can then be added to this container.
|
|
463
456
|
*
|
|
464
|
-
*
|
|
465
|
-
*
|
|
466
|
-
* ```
|
|
467
|
-
*/
|
|
468
|
-
get first(): Child | undefined
|
|
469
|
-
/**
|
|
470
|
-
* The container’s last child.
|
|
457
|
+
* This ensures that the nodes' parent is set to this container, that they use
|
|
458
|
+
* the correct prototype chain, and that they're marked as dirty.
|
|
471
459
|
*
|
|
472
|
-
*
|
|
473
|
-
*
|
|
474
|
-
*
|
|
460
|
+
* @param mnodes The new node or nodes to add.
|
|
461
|
+
* @param sample A node from whose raws the new node's `before` raw should be
|
|
462
|
+
* taken.
|
|
463
|
+
* @param type This should be set to `'prepend'` if the new nodes will be
|
|
464
|
+
* inserted at the beginning of the container.
|
|
465
|
+
* @hidden
|
|
475
466
|
*/
|
|
476
|
-
|
|
467
|
+
protected normalize(
|
|
468
|
+
nodes: Container.NewChild,
|
|
469
|
+
sample: Node | undefined,
|
|
470
|
+
type?: 'prepend' | false
|
|
471
|
+
): Child[]
|
|
477
472
|
}
|
|
478
473
|
|
|
479
474
|
declare class Container<
|
package/lib/container.js
CHANGED
|
@@ -25,6 +25,16 @@ function markTreeDirty(node) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
class Container extends Node {
|
|
28
|
+
get first() {
|
|
29
|
+
if (!this.proxyOf.nodes) return undefined
|
|
30
|
+
return this.proxyOf.nodes[0]
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
get last() {
|
|
34
|
+
if (!this.proxyOf.nodes) return undefined
|
|
35
|
+
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1]
|
|
36
|
+
}
|
|
37
|
+
|
|
28
38
|
append(...children) {
|
|
29
39
|
for (let child of children) {
|
|
30
40
|
let nodes = this.normalize(child, this.last)
|
|
@@ -391,16 +401,6 @@ class Container extends Node {
|
|
|
391
401
|
}
|
|
392
402
|
})
|
|
393
403
|
}
|
|
394
|
-
|
|
395
|
-
get first() {
|
|
396
|
-
if (!this.proxyOf.nodes) return undefined
|
|
397
|
-
return this.proxyOf.nodes[0]
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
get last() {
|
|
401
|
-
if (!this.proxyOf.nodes) return undefined
|
|
402
|
-
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1]
|
|
403
|
-
}
|
|
404
404
|
}
|
|
405
405
|
|
|
406
406
|
Container.registerParse = dependant => {
|
package/lib/declaration.d.ts
CHANGED
|
@@ -39,7 +39,6 @@ declare namespace Declaration {
|
|
|
39
39
|
value: string
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
43
42
|
export { Declaration_ as default }
|
|
44
43
|
}
|
|
45
44
|
|
|
@@ -68,14 +67,6 @@ declare class Declaration_ extends Node {
|
|
|
68
67
|
|
|
69
68
|
type: 'decl'
|
|
70
69
|
|
|
71
|
-
constructor(defaults?: Declaration.DeclarationProps)
|
|
72
|
-
assign(overrides: Declaration.DeclarationProps | object): this
|
|
73
|
-
|
|
74
|
-
clone(overrides?: Partial<Declaration.DeclarationProps>): this
|
|
75
|
-
|
|
76
|
-
cloneAfter(overrides?: Partial<Declaration.DeclarationProps>): this
|
|
77
|
-
|
|
78
|
-
cloneBefore(overrides?: Partial<Declaration.DeclarationProps>): this
|
|
79
70
|
/**
|
|
80
71
|
* It represents a specificity of the declaration.
|
|
81
72
|
*
|
|
@@ -91,8 +82,8 @@ declare class Declaration_ extends Node {
|
|
|
91
82
|
* ```
|
|
92
83
|
*/
|
|
93
84
|
get important(): boolean
|
|
94
|
-
|
|
95
85
|
set important(value: boolean)
|
|
86
|
+
|
|
96
87
|
/**
|
|
97
88
|
* The property name for a CSS declaration.
|
|
98
89
|
*
|
|
@@ -106,6 +97,7 @@ declare class Declaration_ extends Node {
|
|
|
106
97
|
get prop(): string
|
|
107
98
|
|
|
108
99
|
set prop(value: string)
|
|
100
|
+
|
|
109
101
|
/**
|
|
110
102
|
* The property value for a CSS declaration.
|
|
111
103
|
*
|
|
@@ -125,6 +117,7 @@ declare class Declaration_ extends Node {
|
|
|
125
117
|
*/
|
|
126
118
|
get value(): string
|
|
127
119
|
set value(value: string)
|
|
120
|
+
|
|
128
121
|
/**
|
|
129
122
|
* It represents a getter that returns `true` if a declaration starts with
|
|
130
123
|
* `--` or `$`, which are used to declare variables in CSS and SASS/SCSS.
|
|
@@ -144,6 +137,12 @@ declare class Declaration_ extends Node {
|
|
|
144
137
|
* ```
|
|
145
138
|
*/
|
|
146
139
|
get variable(): boolean
|
|
140
|
+
constructor(defaults?: Declaration.DeclarationProps)
|
|
141
|
+
|
|
142
|
+
assign(overrides: Declaration.DeclarationProps | object): this
|
|
143
|
+
clone(overrides?: Partial<Declaration.DeclarationProps>): this
|
|
144
|
+
cloneAfter(overrides?: Partial<Declaration.DeclarationProps>): this
|
|
145
|
+
cloneBefore(overrides?: Partial<Declaration.DeclarationProps>): this
|
|
147
146
|
}
|
|
148
147
|
|
|
149
148
|
declare class Declaration extends Declaration_ {}
|
package/lib/declaration.js
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
let Node = require('./node')
|
|
4
4
|
|
|
5
5
|
class Declaration extends Node {
|
|
6
|
+
get variable() {
|
|
7
|
+
return this.prop.startsWith('--') || this.prop[0] === '$'
|
|
8
|
+
}
|
|
9
|
+
|
|
6
10
|
constructor(defaults) {
|
|
7
11
|
if (
|
|
8
12
|
defaults &&
|
|
@@ -14,10 +18,6 @@ class Declaration extends Node {
|
|
|
14
18
|
super(defaults)
|
|
15
19
|
this.type = 'decl'
|
|
16
20
|
}
|
|
17
|
-
|
|
18
|
-
get variable() {
|
|
19
|
-
return this.prop.startsWith('--') || this.prop[0] === '$'
|
|
20
|
-
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
module.exports = Declaration
|
package/lib/document.d.ts
CHANGED
package/lib/fromJSON.d.ts
CHANGED
package/lib/input.d.ts
CHANGED
|
@@ -18,6 +18,11 @@ declare namespace Input {
|
|
|
18
18
|
*/
|
|
19
19
|
endLine?: number
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Offset of exclusive end position in source file.
|
|
23
|
+
*/
|
|
24
|
+
endOffset?: number
|
|
25
|
+
|
|
21
26
|
/**
|
|
22
27
|
* Absolute path to the source file.
|
|
23
28
|
*/
|
|
@@ -28,6 +33,11 @@ declare namespace Input {
|
|
|
28
33
|
*/
|
|
29
34
|
line: number
|
|
30
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Offset of inclusive start position in source file.
|
|
38
|
+
*/
|
|
39
|
+
offset: number
|
|
40
|
+
|
|
31
41
|
/**
|
|
32
42
|
* Source code.
|
|
33
43
|
*/
|
|
@@ -39,7 +49,6 @@ declare namespace Input {
|
|
|
39
49
|
url: string
|
|
40
50
|
}
|
|
41
51
|
|
|
42
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
43
52
|
export { Input_ as default }
|
|
44
53
|
}
|
|
45
54
|
|
|
@@ -62,6 +71,17 @@ declare class Input_ {
|
|
|
62
71
|
*/
|
|
63
72
|
css: string
|
|
64
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Input source with support for non-CSS documents.
|
|
76
|
+
*
|
|
77
|
+
* ```js
|
|
78
|
+
* const input = postcss.parse('a{}', { from: file, document: '<style>a {}</style>' }).input
|
|
79
|
+
* input.document //=> "<style>a {}</style>"
|
|
80
|
+
* input.css //=> "a{}"
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
document: string
|
|
84
|
+
|
|
65
85
|
/**
|
|
66
86
|
* The absolute path to the CSS source file defined
|
|
67
87
|
* with the `from` option.
|
|
@@ -100,12 +120,29 @@ declare class Input_ {
|
|
|
100
120
|
*/
|
|
101
121
|
map: PreviousMap
|
|
102
122
|
|
|
123
|
+
/**
|
|
124
|
+
* The CSS source identifier. Contains `Input#file` if the user
|
|
125
|
+
* set the `from` option, or `Input#id` if they did not.
|
|
126
|
+
*
|
|
127
|
+
* ```js
|
|
128
|
+
* const root = postcss.parse(css, { from: 'a.css' })
|
|
129
|
+
* root.source.input.from //=> "/home/ai/a.css"
|
|
130
|
+
*
|
|
131
|
+
* const root = postcss.parse(css)
|
|
132
|
+
* root.source.input.from //=> "<input css 1>"
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
get from(): string
|
|
136
|
+
|
|
103
137
|
/**
|
|
104
138
|
* @param css Input CSS source.
|
|
105
139
|
* @param opts Process options.
|
|
106
140
|
*/
|
|
107
141
|
constructor(css: string, opts?: ProcessOptions)
|
|
108
142
|
|
|
143
|
+
/**
|
|
144
|
+
* Returns `CssSyntaxError` with information about the error and its position.
|
|
145
|
+
*/
|
|
109
146
|
error(
|
|
110
147
|
message: string,
|
|
111
148
|
start:
|
|
@@ -126,29 +163,34 @@ declare class Input_ {
|
|
|
126
163
|
},
|
|
127
164
|
opts?: { plugin?: CssSyntaxError['plugin'] }
|
|
128
165
|
): CssSyntaxError
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Returns `CssSyntaxError` with information about the error and its position.
|
|
132
|
-
*/
|
|
133
166
|
error(
|
|
134
167
|
message: string,
|
|
135
168
|
line: number,
|
|
136
169
|
column: number,
|
|
137
170
|
opts?: { plugin?: CssSyntaxError['plugin'] }
|
|
138
171
|
): CssSyntaxError
|
|
139
|
-
|
|
140
172
|
error(
|
|
141
173
|
message: string,
|
|
142
174
|
offset: number,
|
|
143
175
|
opts?: { plugin?: CssSyntaxError['plugin'] }
|
|
144
176
|
): CssSyntaxError
|
|
145
177
|
|
|
178
|
+
/**
|
|
179
|
+
* Converts source line and column to offset.
|
|
180
|
+
*
|
|
181
|
+
* @param line Source line.
|
|
182
|
+
* @param column Source column.
|
|
183
|
+
* @return Source offset.
|
|
184
|
+
*/
|
|
185
|
+
fromLineAndColumn(line: number, column: number): number
|
|
186
|
+
|
|
146
187
|
/**
|
|
147
188
|
* Converts source offset to line and column.
|
|
148
189
|
*
|
|
149
190
|
* @param offset Source offset.
|
|
150
191
|
*/
|
|
151
192
|
fromOffset(offset: number): { col: number; line: number } | null
|
|
193
|
+
|
|
152
194
|
/**
|
|
153
195
|
* Reads the input source map and returns a symbol position
|
|
154
196
|
* in the input source (e.g., in a Sass file that was compiled
|
|
@@ -174,22 +216,9 @@ declare class Input_ {
|
|
|
174
216
|
endLine?: number,
|
|
175
217
|
endColumn?: number
|
|
176
218
|
): false | Input.FilePosition
|
|
219
|
+
|
|
177
220
|
/** Converts this to a JSON-friendly object representation. */
|
|
178
221
|
toJSON(): object
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* The CSS source identifier. Contains `Input#file` if the user
|
|
182
|
-
* set the `from` option, or `Input#id` if they did not.
|
|
183
|
-
*
|
|
184
|
-
* ```js
|
|
185
|
-
* const root = postcss.parse(css, { from: 'a.css' })
|
|
186
|
-
* root.source.input.from //=> "/home/ai/a.css"
|
|
187
|
-
*
|
|
188
|
-
* const root = postcss.parse(css)
|
|
189
|
-
* root.source.input.from //=> "<input css 1>"
|
|
190
|
-
* ```
|
|
191
|
-
*/
|
|
192
|
-
get from(): string
|
|
193
222
|
}
|
|
194
223
|
|
|
195
224
|
declare class Input extends Input_ {}
|