postcss 8.4.34 → 8.4.35

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 CHANGED
@@ -1,4 +1,7 @@
1
- import Container, { ContainerProps } from './container.js'
1
+ import Container, {
2
+ ContainerProps,
3
+ ContainerWithChildren
4
+ } from './container.js'
2
5
 
3
6
  declare namespace AtRule {
4
7
  export interface AtRuleRaws extends Record<string, unknown> {
@@ -116,7 +119,7 @@ declare class AtRule_ extends Container {
116
119
  * ```
117
120
  */
118
121
  params: string
119
- parent: Container | undefined
122
+ parent: ContainerWithChildren | undefined
120
123
 
121
124
  raws: AtRule.AtRuleRaws
122
125
 
@@ -5,6 +5,12 @@ import Node, { ChildNode, ChildProps, NodeProps } from './node.js'
5
5
  import Rule from './rule.js'
6
6
 
7
7
  declare namespace Container {
8
+ export class ContainerWithChildren<
9
+ Child extends Node = ChildNode
10
+ > extends Container_<Child> {
11
+ nodes: Child[]
12
+ }
13
+
8
14
  export interface ValueOptions {
9
15
  /**
10
16
  * String that’s used to narrow down values and speed up the regexp search.
@@ -66,7 +72,15 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
66
72
  * @return This node for methods chain.
67
73
  */
68
74
  append(
69
- ...nodes: (ChildProps | ChildProps[] | Node | Node[] | string | string[])[]
75
+ ...nodes: (
76
+ | ChildProps
77
+ | ChildProps[]
78
+ | Node
79
+ | Node[]
80
+ | string
81
+ | string[]
82
+ | undefined
83
+ )[]
70
84
  ): this
71
85
 
72
86
  assign(overrides: Container.ContainerProps | object): this
@@ -146,7 +160,14 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
146
160
  */
147
161
  insertAfter(
148
162
  oldNode: Child | number,
149
- newNode: Child | Child[] | ChildProps | ChildProps[] | string | string[]
163
+ newNode:
164
+ | Child
165
+ | Child[]
166
+ | ChildProps
167
+ | ChildProps[]
168
+ | string
169
+ | string[]
170
+ | undefined
150
171
  ): this
151
172
  /**
152
173
  * Insert new node before old node within the container.
@@ -161,7 +182,14 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
161
182
  */
162
183
  insertBefore(
163
184
  oldNode: Child | number,
164
- newNode: Child | Child[] | ChildProps | ChildProps[] | string | string[]
185
+ newNode:
186
+ | Child
187
+ | Child[]
188
+ | ChildProps
189
+ | ChildProps[]
190
+ | string
191
+ | string[]
192
+ | undefined
165
193
  ): this
166
194
 
167
195
  /**
@@ -202,7 +230,15 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
202
230
  * @return This node for methods chain.
203
231
  */
204
232
  prepend(
205
- ...nodes: (ChildProps | ChildProps[] | Node | Node[] | string | string[])[]
233
+ ...nodes: (
234
+ | ChildProps
235
+ | ChildProps[]
236
+ | Node
237
+ | Node[]
238
+ | string
239
+ | string[]
240
+ | undefined
241
+ )[]
206
242
  ): this
207
243
  /**
208
244
  * Add child to the end of the node.
@@ -447,6 +483,8 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
447
483
  get last(): Child | undefined
448
484
  }
449
485
 
450
- declare class Container<Child extends Node = ChildNode> extends Container_<Child> {}
486
+ declare class Container<
487
+ Child extends Node = ChildNode
488
+ > extends Container_<Child> {}
451
489
 
452
490
  export = Container
package/lib/container.js CHANGED
@@ -173,6 +173,8 @@ class Container extends Node {
173
173
  normalize(nodes, sample) {
174
174
  if (typeof nodes === 'string') {
175
175
  nodes = cleanSource(parse(nodes).nodes)
176
+ } else if (typeof nodes === 'undefined') {
177
+ nodes = []
176
178
  } else if (Array.isArray(nodes)) {
177
179
  nodes = nodes.slice(0)
178
180
  for (let i of nodes) {
@@ -1,4 +1,4 @@
1
- import Container from './container.js'
1
+ import { ContainerWithChildren } from './container.js'
2
2
  import Node from './node.js'
3
3
 
4
4
  declare namespace Declaration {
@@ -79,7 +79,7 @@ declare class Declaration_ extends Node {
79
79
  */
80
80
  important: boolean
81
81
 
82
- parent: Container | undefined
82
+ parent: ContainerWithChildren | undefined
83
83
 
84
84
  /**
85
85
  * The property name for a CSS declaration.
package/lib/node.d.ts CHANGED
@@ -246,7 +246,7 @@ declare abstract class Node_ {
246
246
  * @param newNode New node.
247
247
  * @return This node for methods chain.
248
248
  */
249
- after(newNode: Node | Node.ChildProps | Node[] | string): this
249
+ after(newNode: Node | Node.ChildProps | Node[] | string | undefined): this
250
250
 
251
251
  /**
252
252
  * It assigns properties to an existing node instance.
@@ -273,7 +273,7 @@ declare abstract class Node_ {
273
273
  * @param newNode New node.
274
274
  * @return This node for methods chain.
275
275
  */
276
- before(newNode: Node | Node.ChildProps | Node[] | string): this
276
+ before(newNode: Node | Node.ChildProps | Node[] | string | undefined): this
277
277
 
278
278
  /**
279
279
  * Clear the code style properties for the node and its children.
@@ -531,6 +531,6 @@ declare abstract class Node_ {
531
531
  warn(result: Result, message: string, options?: WarningOptions): Warning
532
532
  }
533
533
 
534
- declare class Node extends Node_ { }
534
+ declare class Node extends Node_ {}
535
535
 
536
536
  export = Node
package/lib/processor.js CHANGED
@@ -7,7 +7,7 @@ let Root = require('./root')
7
7
 
8
8
  class Processor {
9
9
  constructor(plugins = []) {
10
- this.version = '8.4.34'
10
+ this.version = '8.4.35'
11
11
  this.plugins = this.normalize(plugins)
12
12
  }
13
13
 
package/lib/rule.d.ts CHANGED
@@ -1,4 +1,7 @@
1
- import Container, { ContainerProps } from './container.js'
1
+ import Container, {
2
+ ContainerProps,
3
+ ContainerWithChildren
4
+ } from './container.js'
2
5
 
3
6
  declare namespace Rule {
4
7
  export interface RuleRaws extends Record<string, unknown> {
@@ -70,7 +73,7 @@ declare namespace Rule {
70
73
  */
71
74
  declare class Rule_ extends Container {
72
75
  nodes: NonNullable<Container['nodes']>
73
- parent: Container | undefined
76
+ parent: ContainerWithChildren | undefined
74
77
  raws: Rule.RuleRaws
75
78
  /**
76
79
  * The rule’s full selector represented as a string.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postcss",
3
- "version": "8.4.34",
3
+ "version": "8.4.35",
4
4
  "description": "Tool for transforming styles with JS plugins",
5
5
  "engines": {
6
6
  "node": "^10 || ^12 || >=14"