postcss 8.4.40 → 8.4.41
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/at-rule.d.ts +23 -23
- package/lib/comment.d.ts +8 -8
- package/lib/container.d.ts +8 -8
- package/lib/container.js +1 -1
- package/lib/declaration.d.ts +15 -16
- package/lib/document.d.ts +3 -3
- package/lib/input.d.ts +3 -0
- package/lib/list.d.ts +0 -1
- package/lib/map-generator.js +1 -1
- package/lib/node.d.ts +5 -5
- package/lib/postcss.d.mts +1 -4
- package/lib/postcss.d.ts +14 -5
- package/lib/previous-map.js +7 -5
- package/lib/processor.js +1 -1
- package/lib/result.d.ts +0 -1
- package/lib/root.d.ts +3 -3
- package/lib/rule.d.ts +24 -17
- package/package.json +1 -1
package/lib/at-rule.d.ts
CHANGED
@@ -79,18 +79,6 @@ declare namespace AtRule {
|
|
79
79
|
* ```
|
80
80
|
*/
|
81
81
|
declare class AtRule_ extends Container {
|
82
|
-
/**
|
83
|
-
* The at-rule’s name immediately follows the `@`.
|
84
|
-
*
|
85
|
-
* ```js
|
86
|
-
* const root = postcss.parse('@media print {}')
|
87
|
-
* const media = root.first
|
88
|
-
* media.name //=> 'media'
|
89
|
-
* ```
|
90
|
-
*/
|
91
|
-
get name(): string
|
92
|
-
set name(value: string)
|
93
|
-
|
94
82
|
/**
|
95
83
|
* An array containing the layer’s children.
|
96
84
|
*
|
@@ -110,6 +98,29 @@ declare class AtRule_ extends Container {
|
|
110
98
|
* ```
|
111
99
|
*/
|
112
100
|
nodes: Container['nodes']
|
101
|
+
parent: ContainerWithChildren | undefined
|
102
|
+
|
103
|
+
raws: AtRule.AtRuleRaws
|
104
|
+
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
|
+
/**
|
114
|
+
* The at-rule’s name immediately follows the `@`.
|
115
|
+
*
|
116
|
+
* ```js
|
117
|
+
* const root = postcss.parse('@media print {}')
|
118
|
+
* const media = root.first
|
119
|
+
* media.name //=> 'media'
|
120
|
+
* ```
|
121
|
+
*/
|
122
|
+
get name(): string
|
123
|
+
set name(value: string)
|
113
124
|
/**
|
114
125
|
* The at-rule’s parameters, the values that follow the at-rule’s name
|
115
126
|
* but precede any `{}` block.
|
@@ -122,17 +133,6 @@ declare class AtRule_ extends Container {
|
|
122
133
|
*/
|
123
134
|
get params(): string
|
124
135
|
set params(value: string)
|
125
|
-
parent: ContainerWithChildren | undefined
|
126
|
-
|
127
|
-
raws: AtRule.AtRuleRaws
|
128
|
-
|
129
|
-
type: 'atrule'
|
130
|
-
|
131
|
-
constructor(defaults?: AtRule.AtRuleProps)
|
132
|
-
assign(overrides: AtRule.AtRuleProps | object): this
|
133
|
-
clone(overrides?: Partial<AtRule.AtRuleProps>): AtRule
|
134
|
-
cloneAfter(overrides?: Partial<AtRule.AtRuleProps>): AtRule
|
135
|
-
cloneBefore(overrides?: Partial<AtRule.AtRuleProps>): AtRule
|
136
136
|
}
|
137
137
|
|
138
138
|
declare class AtRule extends AtRule_ {}
|
package/lib/comment.d.ts
CHANGED
@@ -48,19 +48,19 @@ declare namespace Comment {
|
|
48
48
|
declare class Comment_ extends Node {
|
49
49
|
parent: Container | undefined
|
50
50
|
raws: Comment.CommentRaws
|
51
|
+
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
|
51
59
|
/**
|
52
60
|
* The comment's text.
|
53
61
|
*/
|
54
62
|
get text(): string
|
55
63
|
set text(value: string)
|
56
|
-
|
57
|
-
type: 'comment'
|
58
|
-
|
59
|
-
constructor(defaults?: Comment.CommentProps)
|
60
|
-
assign(overrides: Comment.CommentProps | object): this
|
61
|
-
clone(overrides?: Partial<Comment.CommentProps>): Comment
|
62
|
-
cloneAfter(overrides?: Partial<Comment.CommentProps>): Comment
|
63
|
-
cloneBefore(overrides?: Partial<Comment.CommentProps>): Comment
|
64
64
|
}
|
65
65
|
|
66
66
|
declare class Comment extends Comment_ {}
|
package/lib/container.d.ts
CHANGED
@@ -24,7 +24,7 @@ declare namespace Container {
|
|
24
24
|
}
|
25
25
|
|
26
26
|
export interface ContainerProps extends NodeProps {
|
27
|
-
nodes?: (
|
27
|
+
nodes?: (Node | ChildProps)[]
|
28
28
|
}
|
29
29
|
|
30
30
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
@@ -84,9 +84,9 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
84
84
|
): this
|
85
85
|
|
86
86
|
assign(overrides: Container.ContainerProps | object): this
|
87
|
-
clone(overrides?: Partial<Container.ContainerProps>):
|
88
|
-
cloneAfter(overrides?: Partial<Container.ContainerProps>):
|
89
|
-
cloneBefore(overrides?: Partial<Container.ContainerProps>):
|
87
|
+
clone(overrides?: Partial<Container.ContainerProps>): this
|
88
|
+
cloneAfter(overrides?: Partial<Container.ContainerProps>): this
|
89
|
+
cloneBefore(overrides?: Partial<Container.ContainerProps>): this
|
90
90
|
|
91
91
|
/**
|
92
92
|
* Iterates through the container’s immediate children,
|
@@ -161,8 +161,8 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
161
161
|
insertAfter(
|
162
162
|
oldNode: Child | number,
|
163
163
|
newNode:
|
164
|
-
|
|
165
|
-
|
|
164
|
+
| Node
|
165
|
+
| Node[]
|
166
166
|
| ChildProps
|
167
167
|
| ChildProps[]
|
168
168
|
| string
|
@@ -183,8 +183,8 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
183
183
|
insertBefore(
|
184
184
|
oldNode: Child | number,
|
185
185
|
newNode:
|
186
|
-
|
|
187
|
-
|
|
186
|
+
| Node
|
187
|
+
| Node[]
|
188
188
|
| ChildProps
|
189
189
|
| ChildProps[]
|
190
190
|
| string
|
package/lib/container.js
CHANGED
@@ -198,7 +198,7 @@ class Container extends Node {
|
|
198
198
|
nodes.value = String(nodes.value)
|
199
199
|
}
|
200
200
|
nodes = [new Declaration(nodes)]
|
201
|
-
} else if (nodes.selector) {
|
201
|
+
} else if (nodes.selector || nodes.selectors) {
|
202
202
|
nodes = [new Rule(nodes)]
|
203
203
|
} else if (nodes.name) {
|
204
204
|
nodes = [new AtRule(nodes)]
|
package/lib/declaration.d.ts
CHANGED
@@ -63,6 +63,19 @@ declare namespace Declaration {
|
|
63
63
|
* ```
|
64
64
|
*/
|
65
65
|
declare class Declaration_ extends Node {
|
66
|
+
parent: ContainerWithChildren | undefined
|
67
|
+
raws: Declaration.DeclarationRaws
|
68
|
+
|
69
|
+
type: 'decl'
|
70
|
+
|
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
|
66
79
|
/**
|
67
80
|
* It represents a specificity of the declaration.
|
68
81
|
*
|
@@ -78,10 +91,8 @@ declare class Declaration_ extends Node {
|
|
78
91
|
* ```
|
79
92
|
*/
|
80
93
|
get important(): boolean
|
81
|
-
set important(value: boolean)
|
82
|
-
|
83
|
-
parent: ContainerWithChildren | undefined
|
84
94
|
|
95
|
+
set important(value: boolean)
|
85
96
|
/**
|
86
97
|
* The property name for a CSS declaration.
|
87
98
|
*
|
@@ -93,12 +104,8 @@ declare class Declaration_ extends Node {
|
|
93
104
|
* ```
|
94
105
|
*/
|
95
106
|
get prop(): string
|
96
|
-
set prop(value: string)
|
97
|
-
|
98
|
-
raws: Declaration.DeclarationRaws
|
99
|
-
|
100
|
-
type: 'decl'
|
101
107
|
|
108
|
+
set prop(value: string)
|
102
109
|
/**
|
103
110
|
* The property value for a CSS declaration.
|
104
111
|
*
|
@@ -118,7 +125,6 @@ declare class Declaration_ extends Node {
|
|
118
125
|
*/
|
119
126
|
get value(): string
|
120
127
|
set value(value: string)
|
121
|
-
|
122
128
|
/**
|
123
129
|
* It represents a getter that returns `true` if a declaration starts with
|
124
130
|
* `--` or `$`, which are used to declare variables in CSS and SASS/SCSS.
|
@@ -138,13 +144,6 @@ declare class Declaration_ extends Node {
|
|
138
144
|
* ```
|
139
145
|
*/
|
140
146
|
get variable(): boolean
|
141
|
-
set varaible(value: string)
|
142
|
-
|
143
|
-
constructor(defaults?: Declaration.DeclarationProps)
|
144
|
-
assign(overrides: Declaration.DeclarationProps | object): this
|
145
|
-
clone(overrides?: Partial<Declaration.DeclarationProps>): Declaration
|
146
|
-
cloneAfter(overrides?: Partial<Declaration.DeclarationProps>): Declaration
|
147
|
-
cloneBefore(overrides?: Partial<Declaration.DeclarationProps>): Declaration
|
148
147
|
}
|
149
148
|
|
150
149
|
declare class Declaration extends Declaration_ {}
|
package/lib/document.d.ts
CHANGED
@@ -42,9 +42,9 @@ declare class Document_ extends Container<Root> {
|
|
42
42
|
constructor(defaults?: Document.DocumentProps)
|
43
43
|
|
44
44
|
assign(overrides: Document.DocumentProps | object): this
|
45
|
-
clone(overrides?: Partial<Document.DocumentProps>):
|
46
|
-
cloneAfter(overrides?: Partial<Document.DocumentProps>):
|
47
|
-
cloneBefore(overrides?: Partial<Document.DocumentProps>):
|
45
|
+
clone(overrides?: Partial<Document.DocumentProps>): this
|
46
|
+
cloneAfter(overrides?: Partial<Document.DocumentProps>): this
|
47
|
+
cloneBefore(overrides?: Partial<Document.DocumentProps>): this
|
48
48
|
|
49
49
|
/**
|
50
50
|
* Returns a `Result` instance representing the document’s CSS roots.
|
package/lib/input.d.ts
CHANGED
package/lib/list.d.ts
CHANGED
package/lib/map-generator.js
CHANGED
package/lib/node.d.ts
CHANGED
@@ -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): this
|
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): this
|
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): this
|
330
330
|
|
331
331
|
/**
|
332
332
|
* It creates an instance of the class `CssSyntaxError` and parameters passed
|
@@ -472,8 +472,8 @@ declare abstract class Node_ {
|
|
472
472
|
*/
|
473
473
|
replaceWith(
|
474
474
|
...nodes: (
|
475
|
-
| Node
|
476
|
-
| Node
|
475
|
+
| Node
|
476
|
+
| Node[]
|
477
477
|
| Node.ChildProps
|
478
478
|
| Node.ChildProps[]
|
479
479
|
)[]
|
package/lib/postcss.d.mts
CHANGED
@@ -9,14 +9,12 @@ export {
|
|
9
9
|
plugin,
|
10
10
|
parse,
|
11
11
|
list,
|
12
|
-
|
13
12
|
document,
|
14
13
|
comment,
|
15
14
|
atRule,
|
16
15
|
rule,
|
17
16
|
decl,
|
18
17
|
root,
|
19
|
-
|
20
18
|
CssSyntaxError,
|
21
19
|
Declaration,
|
22
20
|
Container,
|
@@ -67,6 +65,5 @@ export {
|
|
67
65
|
WarningOptions,
|
68
66
|
|
69
67
|
// This is a class, but it’s not re-exported. That’s why it’s exported as type-only here.
|
70
|
-
type LazyResult
|
71
|
-
|
68
|
+
type LazyResult
|
72
69
|
} from './postcss.js'
|
package/lib/postcss.d.ts
CHANGED
@@ -28,13 +28,22 @@ type DocumentProcessor = (
|
|
28
28
|
document: Document,
|
29
29
|
helper: postcss.Helpers
|
30
30
|
) => Promise<void> | void
|
31
|
-
type RootProcessor = (
|
31
|
+
type RootProcessor = (
|
32
|
+
root: Root,
|
33
|
+
helper: postcss.Helpers
|
34
|
+
) => Promise<void> | void
|
32
35
|
type DeclarationProcessor = (
|
33
36
|
decl: Declaration,
|
34
37
|
helper: postcss.Helpers
|
35
38
|
) => Promise<void> | void
|
36
|
-
type RuleProcessor = (
|
37
|
-
|
39
|
+
type RuleProcessor = (
|
40
|
+
rule: Rule,
|
41
|
+
helper: postcss.Helpers
|
42
|
+
) => Promise<void> | void
|
43
|
+
type AtRuleProcessor = (
|
44
|
+
atRule: AtRule,
|
45
|
+
helper: postcss.Helpers
|
46
|
+
) => Promise<void> | void
|
38
47
|
type CommentProcessor = (
|
39
48
|
comment: Comment,
|
40
49
|
helper: postcss.Helpers
|
@@ -176,9 +185,9 @@ declare namespace postcss {
|
|
176
185
|
WarningOptions
|
177
186
|
}
|
178
187
|
|
179
|
-
export type SourceMap =
|
188
|
+
export type SourceMap = {
|
180
189
|
toJSON(): RawSourceMap
|
181
|
-
}
|
190
|
+
} & SourceMapGenerator
|
182
191
|
|
183
192
|
export type Helpers = { postcss: Postcss; result: Result } & Postcss
|
184
193
|
|
package/lib/previous-map.js
CHANGED
@@ -41,12 +41,14 @@ class PreviousMap {
|
|
41
41
|
let charsetUri = /^data:application\/json;charset=utf-?8,/
|
42
42
|
let uri = /^data:application\/json,/
|
43
43
|
|
44
|
-
|
45
|
-
|
44
|
+
let uriMatch = text.match(charsetUri) || text.match(uri)
|
45
|
+
if (uriMatch) {
|
46
|
+
return decodeURIComponent(text.substr(uriMatch[0].length))
|
46
47
|
}
|
47
48
|
|
48
|
-
|
49
|
-
|
49
|
+
let baseUriMatch = text.match(baseCharsetUri) || text.match(baseUri)
|
50
|
+
if (baseUriMatch) {
|
51
|
+
return fromBase64(text.substr(baseUriMatch[0].length))
|
50
52
|
}
|
51
53
|
|
52
54
|
let encoding = text.match(/data:application\/json;([^,]+),/)[1]
|
@@ -67,7 +69,7 @@ class PreviousMap {
|
|
67
69
|
}
|
68
70
|
|
69
71
|
loadAnnotation(css) {
|
70
|
-
let comments = css.match(/\/\*\s*# sourceMappingURL=/
|
72
|
+
let comments = css.match(/\/\*\s*# sourceMappingURL=/g)
|
71
73
|
if (!comments) return
|
72
74
|
|
73
75
|
// sourceMappingURLs from comments, strings, etc.
|
package/lib/processor.js
CHANGED
package/lib/result.d.ts
CHANGED
package/lib/root.d.ts
CHANGED
@@ -62,9 +62,9 @@ declare class Root_ extends Container {
|
|
62
62
|
constructor(defaults?: Root.RootProps)
|
63
63
|
|
64
64
|
assign(overrides: object | Root.RootProps): this
|
65
|
-
clone(overrides?: Partial<Root.RootProps>):
|
66
|
-
cloneAfter(overrides?: Partial<Root.RootProps>):
|
67
|
-
cloneBefore(overrides?: Partial<Root.RootProps>):
|
65
|
+
clone(overrides?: Partial<Root.RootProps>): this
|
66
|
+
cloneAfter(overrides?: Partial<Root.RootProps>): this
|
67
|
+
cloneBefore(overrides?: Partial<Root.RootProps>): this
|
68
68
|
|
69
69
|
/**
|
70
70
|
* Returns a `Result` instance representing the root’s CSS.
|
package/lib/rule.d.ts
CHANGED
@@ -40,14 +40,21 @@ declare namespace Rule {
|
|
40
40
|
semicolon?: boolean
|
41
41
|
}
|
42
42
|
|
43
|
-
export
|
43
|
+
export type RuleProps = ContainerProps & {
|
44
44
|
/** Information used to generate byte-to-byte equal node string as it was in the origin input. */
|
45
45
|
raws?: RuleRaws
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
46
|
+
} & (
|
47
|
+
| {
|
48
|
+
/** Selector or selectors of the rule. */
|
49
|
+
selector: string
|
50
|
+
selectors?: never
|
51
|
+
}
|
52
|
+
| {
|
53
|
+
/** Selectors of the rule represented as an array of strings. */
|
54
|
+
selectors: string[]
|
55
|
+
selector?: never
|
56
|
+
}
|
57
|
+
)
|
51
58
|
|
52
59
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
53
60
|
export { Rule_ as default }
|
@@ -75,6 +82,15 @@ declare class Rule_ extends Container {
|
|
75
82
|
nodes: NonNullable<Container['nodes']>
|
76
83
|
parent: ContainerWithChildren | undefined
|
77
84
|
raws: Rule.RuleRaws
|
85
|
+
type: 'rule'
|
86
|
+
constructor(defaults?: Rule.RuleProps)
|
87
|
+
|
88
|
+
assign(overrides: object | Rule.RuleProps): this
|
89
|
+
clone(overrides?: Partial<Rule.RuleProps>): this
|
90
|
+
|
91
|
+
cloneAfter(overrides?: Partial<Rule.RuleProps>): this
|
92
|
+
|
93
|
+
cloneBefore(overrides?: Partial<Rule.RuleProps>): this
|
78
94
|
/**
|
79
95
|
* The rule’s full selector represented as a string.
|
80
96
|
*
|
@@ -85,8 +101,7 @@ declare class Rule_ extends Container {
|
|
85
101
|
* ```
|
86
102
|
*/
|
87
103
|
get selector(): string
|
88
|
-
set selector(value: string)
|
89
|
-
|
104
|
+
set selector(value: string)
|
90
105
|
/**
|
91
106
|
* An array containing the rule’s individual selectors.
|
92
107
|
* Groups of selectors are split at commas.
|
@@ -103,15 +118,7 @@ declare class Rule_ extends Container {
|
|
103
118
|
* ```
|
104
119
|
*/
|
105
120
|
get selectors(): string[]
|
106
|
-
set selectors(values: string[])
|
107
|
-
|
108
|
-
type: 'rule'
|
109
|
-
|
110
|
-
constructor(defaults?: Rule.RuleProps)
|
111
|
-
assign(overrides: object | Rule.RuleProps): this
|
112
|
-
clone(overrides?: Partial<Rule.RuleProps>): Rule
|
113
|
-
cloneAfter(overrides?: Partial<Rule.RuleProps>): Rule
|
114
|
-
cloneBefore(overrides?: Partial<Rule.RuleProps>): Rule
|
121
|
+
set selectors(values: string[])
|
115
122
|
}
|
116
123
|
|
117
124
|
declare class Rule extends Rule_ {}
|