postcss 8.4.21 → 8.4.23

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/lib/list.d.ts CHANGED
@@ -1,51 +1,57 @@
1
- export type List = {
2
- /**
3
- * Safely splits values.
4
- *
5
- * ```js
6
- * Once (root, { list }) {
7
- * list.split('1px calc(10% + 1px)', [' ', '\n', '\t']) //=> ['1px', 'calc(10% + 1px)']
8
- * }
9
- * ```
10
- *
11
- * @param string separated values.
12
- * @param separators array of separators.
13
- * @param last boolean indicator.
14
- * @return Split values.
15
- */
16
- split(string: string, separators: string[], last: boolean): string[]
17
- /**
18
- * Safely splits space-separated values (such as those for `background`,
19
- * `border-radius`, and other shorthand properties).
20
- *
21
- * ```js
22
- * Once (root, { list }) {
23
- * list.space('1px calc(10% + 1px)') //=> ['1px', 'calc(10% + 1px)']
24
- * }
25
- * ```
26
- *
27
- * @param str Space-separated values.
28
- * @return Split values.
29
- */
30
- space(str: string): string[]
1
+ declare namespace list {
2
+ type List = {
3
+ default: List
31
4
 
32
- /**
33
- * Safely splits comma-separated values (such as those for `transition-*`
34
- * and `background` properties).
35
- *
36
- * ```js
37
- * Once (root, { list }) {
38
- * list.comma('black, linear-gradient(white, black)')
39
- * //=> ['black', 'linear-gradient(white, black)']
40
- * }
41
- * ```
42
- *
43
- * @param str Comma-separated values.
44
- * @return Split values.
45
- */
46
- comma(str: string): string[]
5
+ /**
6
+ * Safely splits values.
7
+ *
8
+ * ```js
9
+ * Once (root, { list }) {
10
+ * list.split('1px calc(10% + 1px)', [' ', '\n', '\t']) //=> ['1px', 'calc(10% + 1px)']
11
+ * }
12
+ * ```
13
+ *
14
+ * @param string separated values.
15
+ * @param separators array of separators.
16
+ * @param last boolean indicator.
17
+ * @return Split values.
18
+ */
19
+ split(string: string, separators: string[], last: boolean): string[]
20
+
21
+ /**
22
+ * Safely splits space-separated values (such as those for `background`,
23
+ * `border-radius`, and other shorthand properties).
24
+ *
25
+ * ```js
26
+ * Once (root, { list }) {
27
+ * list.space('1px calc(10% + 1px)') //=> ['1px', 'calc(10% + 1px)']
28
+ * }
29
+ * ```
30
+ *
31
+ * @param str Space-separated values.
32
+ * @return Split values.
33
+ */
34
+ space(str: string): string[]
35
+
36
+ /**
37
+ * Safely splits comma-separated values (such as those for `transition-*`
38
+ * and `background` properties).
39
+ *
40
+ * ```js
41
+ * Once (root, { list }) {
42
+ * list.comma('black, linear-gradient(white, black)')
43
+ * //=> ['black', 'linear-gradient(white, black)']
44
+ * }
45
+ * ```
46
+ *
47
+ * @param str Comma-separated values.
48
+ * @return Split values.
49
+ */
50
+ comma(str: string): string[]
51
+ }
47
52
  }
48
53
 
49
- declare const list: List
54
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
55
+ declare const list: list.List
50
56
 
51
- export default list
57
+ export = list
@@ -5,6 +5,11 @@ import Warning from './warning.js'
5
5
  import Root from './root.js'
6
6
  import LazyResult from './lazy-result.js'
7
7
 
8
+ declare namespace NoWorkResult {
9
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
10
+ export { NoWorkResult_ as default }
11
+ }
12
+
8
13
  /**
9
14
  * A Promise proxy for the result of PostCSS transformations.
10
15
  * This lazy result instance doesn't parse css unless `NoWorkResult#root` or `Result#root`
@@ -17,7 +22,7 @@ import LazyResult from './lazy-result.js'
17
22
  * let root = noWorkResult.root // now css is parsed because we accessed the root
18
23
  * ```
19
24
  */
20
- export default class NoWorkResult implements LazyResult {
25
+ declare class NoWorkResult_ implements LazyResult {
21
26
  then: Promise<Result>['then']
22
27
  catch: Promise<Result>['catch']
23
28
  finally: Promise<Result>['finally']
@@ -35,3 +40,7 @@ export default class NoWorkResult implements LazyResult {
35
40
  sync(): Result
36
41
  async(): Promise<Result>
37
42
  }
43
+
44
+ declare class NoWorkResult extends NoWorkResult_ {}
45
+
46
+ export = NoWorkResult
package/lib/node.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import Declaration, { DeclarationProps } from './declaration.js'
2
2
  import Comment, { CommentProps } from './comment.js'
3
3
  import { Stringifier, Syntax } from './postcss.js'
4
- import AtRule, { AtRuleProps } from './at-rule.js'
4
+ import AtRule = require('./at-rule.js')
5
+ import { AtRuleProps } from './at-rule.js'
5
6
  import Rule, { RuleProps } from './rule.js'
6
7
  import Warning, { WarningOptions } from './warning.js'
7
8
  import CssSyntaxError from './css-syntax-error.js'
@@ -11,84 +12,90 @@ import Root from './root.js'
11
12
  import Document from './document.js'
12
13
  import Container from './container.js'
13
14
 
14
- export type ChildNode = AtRule | Rule | Declaration | Comment
15
-
16
- export type AnyNode = AtRule | Rule | Declaration | Comment | Root | Document
17
-
18
- export type ChildProps =
19
- | AtRuleProps
20
- | RuleProps
21
- | DeclarationProps
22
- | CommentProps
23
-
24
- export interface Position {
25
- /**
26
- * Source offset in file. It starts from 0.
27
- */
28
- offset: number
29
-
30
- /**
31
- * Source line in file. In contrast to `offset` it starts from 1.
32
- */
33
- column: number
34
-
35
- /**
36
- * Source column in file.
37
- */
38
- line: number
39
- }
40
-
41
- export interface Range {
42
- /**
43
- * Start position, inclusive.
44
- */
45
- start: Position
46
-
47
- /**
48
- * End position, exclusive.
49
- */
50
- end: Position
51
- }
52
-
53
- export interface Source {
54
- /**
55
- * The file source of the node.
56
- */
57
- input: Input
58
- /**
59
- * The inclusive starting position of the node’s source.
60
- */
61
- start?: Position
62
- /**
63
- * The inclusive ending position of the node's source.
64
- */
65
- end?: Position
66
- }
67
-
68
- export interface NodeProps {
69
- source?: Source
70
- }
71
-
72
- interface NodeErrorOptions {
73
- /**
74
- * Plugin name that created this error. PostCSS will set it automatically.
75
- */
76
- plugin?: string
77
- /**
78
- * A word inside a node's string, that should be highlighted as source
79
- * of error.
80
- */
81
- word?: string
82
- /**
83
- * An index inside a node's string that should be highlighted as source
84
- * of error.
85
- */
86
- index?: number
87
- /**
88
- * An ending index inside a node's string that should be highlighted as
89
- * source of error.
90
- */
91
- endIndex?: number
15
+ declare namespace Node {
16
+ export type ChildNode = AtRule.default | Rule | Declaration | Comment
17
+
18
+ export type AnyNode = AtRule.default | Rule | Declaration | Comment | Root | Document
19
+
20
+ export type ChildProps =
21
+ | AtRuleProps
22
+ | RuleProps
23
+ | DeclarationProps
24
+ | CommentProps
25
+
26
+ export interface Position {
27
+ /**
28
+ * Source offset in file. It starts from 0.
29
+ */
30
+ offset: number
31
+
32
+ /**
33
+ * Source line in file. In contrast to `offset` it starts from 1.
34
+ */
35
+ column: number
36
+
37
+ /**
38
+ * Source column in file.
39
+ */
40
+ line: number
41
+ }
42
+
43
+ export interface Range {
44
+ /**
45
+ * Start position, inclusive.
46
+ */
47
+ start: Position
48
+
49
+ /**
50
+ * End position, exclusive.
51
+ */
52
+ end: Position
53
+ }
54
+
55
+ export interface Source {
56
+ /**
57
+ * The file source of the node.
58
+ */
59
+ input: Input
60
+ /**
61
+ * The inclusive starting position of the node’s source.
62
+ */
63
+ start?: Position
64
+ /**
65
+ * The inclusive ending position of the node's source.
66
+ */
67
+ end?: Position
68
+ }
69
+
70
+ export interface NodeProps {
71
+ source?: Source
72
+ }
73
+
74
+ export interface NodeErrorOptions {
75
+ /**
76
+ * Plugin name that created this error. PostCSS will set it automatically.
77
+ */
78
+ plugin?: string
79
+ /**
80
+ * A word inside a node's string, that should be highlighted as source
81
+ * of error.
82
+ */
83
+ word?: string
84
+ /**
85
+ * An index inside a node's string that should be highlighted as source
86
+ * of error.
87
+ */
88
+ index?: number
89
+ /**
90
+ * An ending index inside a node's string that should be highlighted as
91
+ * source of error.
92
+ */
93
+ endIndex?: number
94
+ }
95
+
96
+ // eslint-disable-next-line @typescript-eslint/no-shadow
97
+ class Node extends Node_ {}
98
+ export { Node as default }
92
99
  }
93
100
 
94
101
  /**
@@ -97,7 +104,7 @@ interface NodeErrorOptions {
97
104
  * You should not extend this classes to create AST for selector or value
98
105
  * parser.
99
106
  */
100
- export default abstract class Node {
107
+ declare abstract class Node_ {
101
108
  /**
102
109
  * tring representing the node’s type. Possible values are `root`, `atrule`,
103
110
  * `rule`, `decl`, or `comment`.
@@ -153,7 +160,7 @@ export default abstract class Node {
153
160
  * }
154
161
  * ```
155
162
  */
156
- source?: Source
163
+ source?: Node.Source
157
164
 
158
165
  /**
159
166
  * Information to generate byte-to-byte equal node string as it was
@@ -222,7 +229,7 @@ export default abstract class Node {
222
229
  *
223
230
  * @return Error object to throw it.
224
231
  */
225
- error(message: string, options?: NodeErrorOptions): CssSyntaxError
232
+ error(message: string, options?: Node.NodeErrorOptions): CssSyntaxError
226
233
 
227
234
  /**
228
235
  * This method is provided as a convenience wrapper for `Result#warn`.
@@ -337,7 +344,7 @@ export default abstract class Node {
337
344
  * @return Current node to methods chain.
338
345
  */
339
346
  replaceWith(
340
- ...nodes: (ChildNode | ChildProps | ChildNode[] | ChildProps[])[]
347
+ ...nodes: (Node.ChildNode | Node.ChildProps | Node.ChildNode[] | Node.ChildProps[])[]
341
348
  ): this
342
349
 
343
350
  /**
@@ -355,7 +362,7 @@ export default abstract class Node {
355
362
  *
356
363
  * @return Next node.
357
364
  */
358
- next(): ChildNode | undefined
365
+ next(): Node.ChildNode | undefined
359
366
 
360
367
  /**
361
368
  * Returns the previous child of the node’s parent.
@@ -370,7 +377,7 @@ export default abstract class Node {
370
377
  *
371
378
  * @return Previous node.
372
379
  */
373
- prev(): ChildNode | undefined
380
+ prev(): Node.ChildNode | undefined
374
381
 
375
382
  /**
376
383
  * Insert new node before current node to current node’s parent.
@@ -384,7 +391,7 @@ export default abstract class Node {
384
391
  * @param newNode New node.
385
392
  * @return This node for methods chain.
386
393
  */
387
- before(newNode: Node | ChildProps | string | Node[]): this
394
+ before(newNode: Node | Node.ChildProps | string | Node[]): this
388
395
 
389
396
  /**
390
397
  * Insert new node after current node to current node’s parent.
@@ -398,7 +405,7 @@ export default abstract class Node {
398
405
  * @param newNode New node.
399
406
  * @return This node for methods chain.
400
407
  */
401
- after(newNode: Node | ChildProps | string | Node[]): this
408
+ after(newNode: Node | Node.ChildProps | string | Node[]): this
402
409
 
403
410
  /**
404
411
  * Finds the Root instance of the node’s tree.
@@ -457,7 +464,7 @@ export default abstract class Node {
457
464
  * @param index The symbol number in the node’s string.
458
465
  * @return Symbol position in file.
459
466
  */
460
- positionInside(index: number): Position
467
+ positionInside(index: number): Node.Position
461
468
 
462
469
  /**
463
470
  * Get the position for a word or an index inside the node.
@@ -465,7 +472,7 @@ export default abstract class Node {
465
472
  * @param opts Options.
466
473
  * @return Position.
467
474
  */
468
- positionBy(opts?: Pick<WarningOptions, 'word' | 'index'>): Position
475
+ positionBy(opts?: Pick<WarningOptions, 'word' | 'index'>): Node.Position
469
476
 
470
477
  /**
471
478
  * Get the range for a word or start and end index inside the node.
@@ -474,5 +481,9 @@ export default abstract class Node {
474
481
  * @param opts Options.
475
482
  * @return Range.
476
483
  */
477
- rangeBy(opts?: Pick<WarningOptions, 'word' | 'index' | 'endIndex'>): Range
484
+ rangeBy(opts?: Pick<WarningOptions, 'word' | 'index' | 'endIndex'>): Node.Range
478
485
  }
486
+
487
+ declare class Node extends Node_ {}
488
+
489
+ export = Node
package/lib/parse.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  import { Parser } from './postcss.js'
2
2
 
3
- declare const parse: Parser
3
+ interface Parse extends Parser {
4
+ default: Parse
5
+ }
4
6
 
5
- export default parse
7
+ declare const parse: Parse
8
+
9
+ export = parse
@@ -0,0 +1,72 @@
1
+ export {
2
+ // postcss function / namespace
3
+ default,
4
+
5
+ // Value exports from postcss.mjs
6
+ stringify,
7
+ fromJSON,
8
+ // @ts-expect-error This value exists, but it’s untyped.
9
+ plugin,
10
+ parse,
11
+ list,
12
+
13
+ document,
14
+ comment,
15
+ atRule,
16
+ rule,
17
+ decl,
18
+ root,
19
+
20
+ CssSyntaxError,
21
+ Declaration,
22
+ Container,
23
+ Processor,
24
+ Document,
25
+ Comment,
26
+ Warning,
27
+ AtRule,
28
+ Result,
29
+ Input,
30
+ Rule,
31
+ Root,
32
+ Node,
33
+
34
+ // Type-only exports
35
+ AcceptedPlugin,
36
+ AnyNode,
37
+ AtRuleProps,
38
+ Builder,
39
+ ChildNode,
40
+ ChildProps,
41
+ CommentProps,
42
+ ContainerProps,
43
+ DeclarationProps,
44
+ DocumentProps,
45
+ FilePosition,
46
+ Helpers,
47
+ JSONHydrator,
48
+ Message,
49
+ NodeErrorOptions,
50
+ NodeProps,
51
+ OldPlugin,
52
+ Parser,
53
+ Plugin,
54
+ PluginCreator,
55
+ Position,
56
+ Postcss,
57
+ ProcessOptions,
58
+ RootProps,
59
+ RuleProps,
60
+ Source,
61
+ SourceMap,
62
+ SourceMapOptions,
63
+ Stringifier,
64
+ Syntax,
65
+ TransformCallback,
66
+ Transformer,
67
+ WarningOptions,
68
+
69
+ // This is a class, but it’s not re-exported. That’s why it’s exported as type-only here.
70
+ type LazyResult,
71
+
72
+ } from './postcss.js'