postcss 8.3.9 → 8.4.31

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.
Files changed (44) hide show
  1. package/README.md +7 -23
  2. package/lib/at-rule.d.ts +58 -49
  3. package/lib/comment.d.ts +43 -32
  4. package/lib/container.d.ts +233 -223
  5. package/lib/container.js +251 -244
  6. package/lib/css-syntax-error.d.ts +117 -61
  7. package/lib/css-syntax-error.js +10 -3
  8. package/lib/declaration.d.ts +85 -61
  9. package/lib/document.d.ts +27 -16
  10. package/lib/fromJSON.d.ts +6 -2
  11. package/lib/input.d.ts +118 -54
  12. package/lib/input.js +87 -55
  13. package/lib/lazy-result.d.ts +82 -67
  14. package/lib/lazy-result.js +234 -232
  15. package/lib/list.d.ts +53 -47
  16. package/lib/list.js +16 -14
  17. package/lib/map-generator.js +231 -172
  18. package/lib/no-work-result.d.ts +46 -0
  19. package/lib/no-work-result.js +135 -0
  20. package/lib/node.d.ts +345 -253
  21. package/lib/node.js +200 -139
  22. package/lib/parse.d.ts +6 -2
  23. package/lib/parser.js +354 -309
  24. package/lib/postcss.d.mts +72 -0
  25. package/lib/postcss.d.ts +288 -319
  26. package/lib/postcss.js +18 -12
  27. package/lib/postcss.mjs +1 -0
  28. package/lib/previous-map.d.ts +23 -14
  29. package/lib/previous-map.js +37 -40
  30. package/lib/processor.d.ts +55 -41
  31. package/lib/processor.js +20 -27
  32. package/lib/result.d.ts +87 -76
  33. package/lib/root.d.ts +49 -36
  34. package/lib/root.js +12 -10
  35. package/lib/rule.d.ts +54 -45
  36. package/lib/stringifier.d.ts +46 -0
  37. package/lib/stringifier.js +140 -138
  38. package/lib/stringify.d.ts +6 -2
  39. package/lib/terminal-highlight.js +11 -11
  40. package/lib/tokenize.js +2 -2
  41. package/lib/warn-once.js +1 -0
  42. package/lib/warning.d.ts +79 -36
  43. package/lib/warning.js +6 -4
  44. package/package.json +20 -10
package/lib/postcss.js CHANGED
@@ -27,22 +27,27 @@ function postcss(...plugins) {
27
27
  }
28
28
 
29
29
  postcss.plugin = function plugin(name, initializer) {
30
- if (console && console.warn) {
31
- console.warn(
32
- name +
33
- ': postcss.plugin was deprecated. Migration guide:\n' +
34
- 'https://evilmartians.com/chronicles/postcss-8-plugin-migration'
35
- )
36
- if (process.env.LANG && process.env.LANG.startsWith('cn')) {
37
- // istanbul ignore next
30
+ let warningPrinted = false
31
+ function creator(...args) {
32
+ // eslint-disable-next-line no-console
33
+ if (console && console.warn && !warningPrinted) {
34
+ warningPrinted = true
35
+ // eslint-disable-next-line no-console
38
36
  console.warn(
39
37
  name +
40
- ': 里面 postcss.plugin 被弃用. 迁移指南:\n' +
41
- 'https://www.w3ctech.com/topic/2226'
38
+ ': postcss.plugin was deprecated. Migration guide:\n' +
39
+ 'https://evilmartians.com/chronicles/postcss-8-plugin-migration'
42
40
  )
41
+ if (process.env.LANG && process.env.LANG.startsWith('cn')) {
42
+ /* c8 ignore next 7 */
43
+ // eslint-disable-next-line no-console
44
+ console.warn(
45
+ name +
46
+ ': 里面 postcss.plugin 被弃用. 迁移指南:\n' +
47
+ 'https://www.w3ctech.com/topic/2226'
48
+ )
49
+ }
43
50
  }
44
- }
45
- function creator(...args) {
46
51
  let transformer = initializer(...args)
47
52
  transformer.postcssPlugin = name
48
53
  transformer.postcssVersion = new Processor().version
@@ -79,6 +84,7 @@ postcss.document = defaults => new Document(defaults)
79
84
  postcss.CssSyntaxError = CssSyntaxError
80
85
  postcss.Declaration = Declaration
81
86
  postcss.Container = Container
87
+ postcss.Processor = Processor
82
88
  postcss.Document = Document
83
89
  postcss.Comment = Comment
84
90
  postcss.Warning = Warning
package/lib/postcss.mjs CHANGED
@@ -18,6 +18,7 @@ export const root = postcss.root
18
18
  export const CssSyntaxError = postcss.CssSyntaxError
19
19
  export const Declaration = postcss.Declaration
20
20
  export const Container = postcss.Container
21
+ export const Processor = postcss.Processor
21
22
  export const Document = postcss.Document
22
23
  export const Comment = postcss.Comment
23
24
  export const Warning = postcss.Warning
@@ -2,6 +2,11 @@ import { SourceMapConsumer } from 'source-map-js'
2
2
 
3
3
  import { ProcessOptions } from './postcss.js'
4
4
 
5
+ declare namespace PreviousMap {
6
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
7
+ export { PreviousMap_ as default }
8
+ }
9
+
5
10
  /**
6
11
  * Source map information from input CSS.
7
12
  * For example, source map after Sass compiler.
@@ -14,37 +19,37 @@ import { ProcessOptions } from './postcss.js'
14
19
  * root.input.map //=> PreviousMap
15
20
  * ```
16
21
  */
17
- export default class PreviousMap {
22
+ declare class PreviousMap_ {
18
23
  /**
19
- * Was source map inlined by data-uri to input CSS.
24
+ * `sourceMappingURL` content.
20
25
  */
21
- inline: boolean
26
+ annotation?: string
22
27
 
23
28
  /**
24
- * `sourceMappingURL` content.
29
+ * The CSS source identifier. Contains `Input#file` if the user
30
+ * set the `from` option, or `Input#id` if they did not.
25
31
  */
26
- annotation?: string
32
+ file?: string
27
33
 
28
34
  /**
29
- * Source map file content.
35
+ * Was source map inlined by data-uri to input CSS.
30
36
  */
31
- text?: string
37
+ inline: boolean
32
38
 
33
39
  /**
34
- * The directory with source map file, if source map is in separated file.
40
+ * Path to source map file.
35
41
  */
36
- root?: string
42
+ mapFile?: string
37
43
 
38
44
  /**
39
- * The CSS source identifier. Contains `Input#file` if the user
40
- * set the `from` option, or `Input#id` if they did not.
45
+ * The directory with source map file, if source map is in separated file.
41
46
  */
42
- file?: string
47
+ root?: string
43
48
 
44
49
  /**
45
- * Path to source map file.
50
+ * Source map file content.
46
51
  */
47
- mapFile?: string
52
+ text?: string
48
53
 
49
54
  /**
50
55
  * @param css Input CSS source.
@@ -70,3 +75,7 @@ export default class PreviousMap {
70
75
  */
71
76
  withContent(): boolean
72
77
  }
78
+
79
+ declare class PreviousMap extends PreviousMap_ {}
80
+
81
+ export = PreviousMap
@@ -8,7 +8,7 @@ function fromBase64(str) {
8
8
  if (Buffer) {
9
9
  return Buffer.from(str, 'base64').toString()
10
10
  } else {
11
- // istanbul ignore next
11
+ /* c8 ignore next 2 */
12
12
  return window.atob(str)
13
13
  }
14
14
  }
@@ -35,39 +35,6 @@ class PreviousMap {
35
35
  return this.consumerCache
36
36
  }
37
37
 
38
- withContent() {
39
- return !!(
40
- this.consumer().sourcesContent &&
41
- this.consumer().sourcesContent.length > 0
42
- )
43
- }
44
-
45
- startWith(string, start) {
46
- if (!string) return false
47
- return string.substr(0, start.length) === start
48
- }
49
-
50
- getAnnotationURL(sourceMapString) {
51
- return sourceMapString
52
- .match(/\/\*\s*# sourceMappingURL=((?:(?!sourceMappingURL=).)*)\*\//)[1]
53
- .trim()
54
- }
55
-
56
- loadAnnotation(css) {
57
- let annotations = css.match(
58
- /\/\*\s*# sourceMappingURL=(?:(?!sourceMappingURL=).)*\*\//gm
59
- )
60
-
61
- if (annotations && annotations.length > 0) {
62
- // Locate the last sourceMappingURL to avoid picking up
63
- // sourceMappingURLs from comments, strings, etc.
64
- let lastAnnotation = annotations[annotations.length - 1]
65
- if (lastAnnotation) {
66
- this.annotation = this.getAnnotationURL(lastAnnotation)
67
- }
68
- }
69
- }
70
-
71
38
  decodeInline(text) {
72
39
  let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/
73
40
  let baseUri = /^data:application\/json;base64,/
@@ -86,6 +53,33 @@ class PreviousMap {
86
53
  throw new Error('Unsupported source map encoding ' + encoding)
87
54
  }
88
55
 
56
+ getAnnotationURL(sourceMapString) {
57
+ return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, '').trim()
58
+ }
59
+
60
+ isMap(map) {
61
+ if (typeof map !== 'object') return false
62
+ return (
63
+ typeof map.mappings === 'string' ||
64
+ typeof map._mappings === 'string' ||
65
+ Array.isArray(map.sections)
66
+ )
67
+ }
68
+
69
+ loadAnnotation(css) {
70
+ let comments = css.match(/\/\*\s*# sourceMappingURL=/gm)
71
+ if (!comments) return
72
+
73
+ // sourceMappingURLs from comments, strings, etc.
74
+ let start = css.lastIndexOf(comments.pop())
75
+ let end = css.indexOf('*/', start)
76
+
77
+ if (start > -1 && end > -1) {
78
+ // Locate the last sourceMappingURL to avoid pickin
79
+ this.annotation = this.getAnnotationURL(css.substring(start, end))
80
+ }
81
+ }
82
+
89
83
  loadFile(path) {
90
84
  this.root = dirname(path)
91
85
  if (existsSync(path)) {
@@ -131,12 +125,15 @@ class PreviousMap {
131
125
  }
132
126
  }
133
127
 
134
- isMap(map) {
135
- if (typeof map !== 'object') return false
136
- return (
137
- typeof map.mappings === 'string' ||
138
- typeof map._mappings === 'string' ||
139
- Array.isArray(map.sections)
128
+ startWith(string, start) {
129
+ if (!string) return false
130
+ return string.substr(0, start.length) === start
131
+ }
132
+
133
+ withContent() {
134
+ return !!(
135
+ this.consumer().sourcesContent &&
136
+ this.consumer().sourcesContent.length > 0
140
137
  )
141
138
  }
142
139
  }
@@ -1,51 +1,85 @@
1
+ import Document from './document.js'
2
+ import LazyResult from './lazy-result.js'
3
+ import NoWorkResult from './no-work-result.js'
1
4
  import {
2
5
  AcceptedPlugin,
3
6
  Plugin,
4
7
  ProcessOptions,
5
- Transformer,
6
- TransformCallback
8
+ TransformCallback,
9
+ Transformer
7
10
  } from './postcss.js'
8
- import LazyResult from './lazy-result.js'
9
11
  import Result from './result.js'
10
12
  import Root from './root.js'
11
13
 
14
+ declare namespace Processor {
15
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
16
+ export { Processor_ as default }
17
+ }
18
+
12
19
  /**
13
20
  * Contains plugins to process CSS. Create one `Processor` instance,
14
21
  * initialize its plugins, and then use that instance on numerous CSS files.
15
22
  *
16
23
  * ```js
17
- * const processor = postcss([autoprefixer, precss])
24
+ * const processor = postcss([autoprefixer, postcssNested])
18
25
  * processor.process(css1).then(result => console.log(result.css))
19
26
  * processor.process(css2).then(result => console.log(result.css))
20
27
  * ```
21
28
  */
22
- export default class Processor {
29
+ declare class Processor_ {
23
30
  /**
24
- * Current PostCSS version.
31
+ * Plugins added to this processor.
25
32
  *
26
33
  * ```js
27
- * if (result.processor.version.split('.')[0] !== '6') {
28
- * throw new Error('This plugin works only with PostCSS 6')
29
- * }
34
+ * const processor = postcss([autoprefixer, postcssNested])
35
+ * processor.plugins.length //=> 2
30
36
  * ```
31
37
  */
32
- version: string
38
+ plugins: (Plugin | TransformCallback | Transformer)[]
33
39
 
34
40
  /**
35
- * Plugins added to this processor.
41
+ * Current PostCSS version.
36
42
  *
37
43
  * ```js
38
- * const processor = postcss([autoprefixer, precss])
39
- * processor.plugins.length //=> 2
44
+ * if (result.processor.version.split('.')[0] !== '6') {
45
+ * throw new Error('This plugin works only with PostCSS 6')
46
+ * }
40
47
  * ```
41
48
  */
42
- plugins: (Plugin | Transformer | TransformCallback)[]
49
+ version: string
43
50
 
44
51
  /**
45
52
  * @param plugins PostCSS plugins
46
53
  */
47
54
  constructor(plugins?: AcceptedPlugin[])
48
55
 
56
+ /**
57
+ * Parses source CSS and returns a `LazyResult` Promise proxy.
58
+ * Because some plugins can be asynchronous it doesn’t make
59
+ * any transformations. Transformations will be applied
60
+ * in the `LazyResult` methods.
61
+ *
62
+ * ```js
63
+ * processor.process(css, { from: 'a.css', to: 'a.out.css' })
64
+ * .then(result => {
65
+ * console.log(result.css)
66
+ * })
67
+ * ```
68
+ *
69
+ * @param css String with input CSS or any object with a `toString()` method,
70
+ * like a Buffer. Optionally, send a `Result` instance
71
+ * and the processor will take the `Root` from it.
72
+ * @param opts Options.
73
+ * @return Promise proxy.
74
+ */
75
+ process(
76
+ css: { toString(): string } | LazyResult | Result | Root | string
77
+ ): LazyResult | NoWorkResult
78
+ process<RootNode extends Document | Root = Root>(
79
+ css: { toString(): string } | LazyResult | Result | Root | string,
80
+ options: ProcessOptions<RootNode>
81
+ ): LazyResult<RootNode>
82
+
49
83
  /**
50
84
  * Adds a plugin to be used as a CSS processor.
51
85
  *
@@ -53,7 +87,7 @@ export default class Processor {
53
87
  * * A plugin in `Plugin` format.
54
88
  * * A plugin creator function with `pluginCreator.postcss = true`.
55
89
  * PostCSS will call this function without argument to get plugin.
56
- * * A function. PostCSS will pass the function a @{link Root}
90
+ * * A function. PostCSS will pass the function a {@link Root}
57
91
  * as the first argument and current `Result` instance
58
92
  * as the second.
59
93
  * * Another `Processor` instance. PostCSS will copy plugins
@@ -67,35 +101,15 @@ export default class Processor {
67
101
  * ```js
68
102
  * const processor = postcss()
69
103
  * .use(autoprefixer)
70
- * .use(precss)
104
+ * .use(postcssNested)
71
105
  * ```
72
106
  *
73
107
  * @param plugin PostCSS plugin or `Processor` with plugins.
74
- * @return {Processes} Current processor to make methods chain.
108
+ * @return Current processor to make methods chain.
75
109
  */
76
110
  use(plugin: AcceptedPlugin): this
77
-
78
- /**
79
- * Parses source CSS and returns a `LazyResult` Promise proxy.
80
- * Because some plugins can be asynchronous it doesn’t make
81
- * any transformations. Transformations will be applied
82
- * in the `LazyResult` methods.
83
- *
84
- * ```js
85
- * processor.process(css, { from: 'a.css', to: 'a.out.css' })
86
- * .then(result => {
87
- * console.log(result.css)
88
- * })
89
- * ```
90
- *
91
- * @param css String with input CSS or any object with a `toString()` method,
92
- * like a Buffer. Optionally, senda `Result` instance
93
- * and the processor will take the `Root` from it.
94
- * @param opts Options.
95
- * @return Promise proxy.
96
- */
97
- process(
98
- css: string | { toString(): string } | Result | LazyResult | Root,
99
- options?: ProcessOptions
100
- ): LazyResult
101
111
  }
112
+
113
+ declare class Processor extends Processor_ {}
114
+
115
+ export = Processor
package/lib/processor.js CHANGED
@@ -1,41 +1,16 @@
1
1
  'use strict'
2
2
 
3
+ let NoWorkResult = require('./no-work-result')
3
4
  let LazyResult = require('./lazy-result')
4
5
  let Document = require('./document')
5
6
  let Root = require('./root')
6
7
 
7
8
  class Processor {
8
9
  constructor(plugins = []) {
9
- this.version = '8.3.9'
10
+ this.version = '8.4.31'
10
11
  this.plugins = this.normalize(plugins)
11
12
  }
12
13
 
13
- use(plugin) {
14
- this.plugins = this.plugins.concat(this.normalize([plugin]))
15
- return this
16
- }
17
-
18
- process(css, opts = {}) {
19
- if (
20
- this.plugins.length === 0 &&
21
- typeof opts.parser === 'undefined' &&
22
- typeof opts.stringifier === 'undefined' &&
23
- typeof opts.syntax === 'undefined' &&
24
- !opts.hideNothingWarning
25
- ) {
26
- if (process.env.NODE_ENV !== 'production') {
27
- if (typeof console !== 'undefined' && console.warn) {
28
- console.warn(
29
- 'You did not set any plugins, parser, or stringifier. ' +
30
- 'Right now, PostCSS does nothing. Pick plugins for your case ' +
31
- 'on https://www.postcss.parts/ and use them in postcss.config.js.'
32
- )
33
- }
34
- }
35
- }
36
- return new LazyResult(this, css, opts)
37
- }
38
-
39
14
  normalize(plugins) {
40
15
  let normalized = []
41
16
  for (let i of plugins) {
@@ -65,6 +40,24 @@ class Processor {
65
40
  }
66
41
  return normalized
67
42
  }
43
+
44
+ process(css, opts = {}) {
45
+ if (
46
+ this.plugins.length === 0 &&
47
+ typeof opts.parser === 'undefined' &&
48
+ typeof opts.stringifier === 'undefined' &&
49
+ typeof opts.syntax === 'undefined'
50
+ ) {
51
+ return new NoWorkResult(this, css, opts)
52
+ } else {
53
+ return new LazyResult(this, css, opts)
54
+ }
55
+ }
56
+
57
+ use(plugin) {
58
+ this.plugins = this.plugins.concat(this.normalize([plugin]))
59
+ return this
60
+ }
68
61
  }
69
62
 
70
63
  module.exports = Processor
package/lib/result.d.ts CHANGED
@@ -1,40 +1,47 @@
1
1
  import {
2
- ProcessOptions,
2
+ Document,
3
+ Node,
3
4
  Plugin,
5
+ ProcessOptions,
6
+ Root,
4
7
  SourceMap,
5
8
  TransformCallback,
6
- Root,
7
- Node,
8
9
  Warning,
9
10
  WarningOptions
10
11
  } from './postcss.js'
11
12
  import Processor from './processor.js'
12
13
 
13
- export interface Message {
14
- /**
15
- * Message type.
16
- */
17
- type: string
18
-
19
- /**
20
- * Source PostCSS plugin name.
21
- */
22
- plugin?: string
23
-
24
- [others: string]: any
25
- }
26
-
27
- export interface ResultOptions extends ProcessOptions {
28
- /**
29
- * The CSS node that was the source of the warning.
30
- */
31
- node?: Node
32
-
33
- /**
34
- * Name of plugin that created this warning. `Result#warn` will fill it
35
- * automatically with `Plugin#postcssPlugin` value.
36
- */
37
- plugin?: string
14
+ declare namespace Result {
15
+ export interface Message {
16
+ [others: string]: any
17
+
18
+ /**
19
+ * Source PostCSS plugin name.
20
+ */
21
+ plugin?: string
22
+
23
+ /**
24
+ * Message type.
25
+ */
26
+ type: string
27
+ }
28
+
29
+ export interface ResultOptions extends ProcessOptions {
30
+ /**
31
+ * The CSS node that was the source of the warning.
32
+ */
33
+ node?: Node
34
+
35
+ /**
36
+ * Name of plugin that created this warning. `Result#warn` will fill it
37
+ * automatically with `Plugin#postcssPlugin` value.
38
+ */
39
+ plugin?: string
40
+ }
41
+
42
+
43
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
44
+ export { Result_ as default }
38
45
  }
39
46
 
40
47
  /**
@@ -53,19 +60,36 @@ export interface ResultOptions extends ProcessOptions {
53
60
  * const result2 = postcss.parse(css).toResult()
54
61
  * ```
55
62
  */
56
- export default class Result {
63
+ declare class Result_<RootNode = Document | Root> {
57
64
  /**
58
- * The Processor instance used for this transformation.
65
+ * A CSS string representing of `Result#root`.
59
66
  *
60
67
  * ```js
61
- * for (const plugin of result.processor.plugins) {
62
- * if (plugin.postcssPlugin === 'postcss-bad') {
63
- * throw 'postcss-good is incompatible with postcss-bad'
64
- * }
65
- * })
68
+ * postcss.parse('a{}').toResult().css //=> "a{}"
66
69
  * ```
67
70
  */
68
- processor: Processor
71
+ css: string
72
+
73
+ /**
74
+ * Last runned PostCSS plugin.
75
+ */
76
+ lastPlugin: Plugin | TransformCallback
77
+
78
+ /**
79
+ * An instance of `SourceMapGenerator` class from the `source-map` library,
80
+ * representing changes to the `Result#root` instance.
81
+ *
82
+ * ```js
83
+ * result.map.toJSON() //=> { version: 3, file: 'a.css', … }
84
+ * ```
85
+ *
86
+ * ```js
87
+ * if (result.map) {
88
+ * fs.writeFileSync(result.opts.to + '.map', result.map.toString())
89
+ * }
90
+ * ```
91
+ */
92
+ map: SourceMap
69
93
 
70
94
  /**
71
95
  * Contains messages from plugins (e.g., warnings or custom messages).
@@ -85,16 +109,7 @@ export default class Result {
85
109
  * }
86
110
  * ```
87
111
  */
88
- messages: Message[]
89
-
90
- /**
91
- * Root node after all transformations.
92
- *
93
- * ```js
94
- * root.toResult().root === root
95
- * ```
96
- */
97
- root: Root
112
+ messages: Result.Message[]
98
113
 
99
114
  /**
100
115
  * Options from the `Processor#process` or `Root#toResult` call
@@ -104,54 +119,36 @@ export default class Result {
104
119
  * root.toResult(opts).opts === opts
105
120
  * ```
106
121
  */
107
- opts: ResultOptions
122
+ opts: Result.ResultOptions
108
123
 
109
124
  /**
110
- * A CSS string representing of `Result#root`.
125
+ * The Processor instance used for this transformation.
111
126
  *
112
127
  * ```js
113
- * postcss.parse('a{}').toResult().css //=> "a{}"
128
+ * for (const plugin of result.processor.plugins) {
129
+ * if (plugin.postcssPlugin === 'postcss-bad') {
130
+ * throw 'postcss-good is incompatible with postcss-bad'
131
+ * }
132
+ * })
114
133
  * ```
115
134
  */
116
- css: string
135
+ processor: Processor
117
136
 
118
137
  /**
119
- * An instance of `SourceMapGenerator` class from the `source-map` library,
120
- * representing changes to the `Result#root` instance.
121
- *
122
- * ```js
123
- * result.map.toJSON() //=> { version: 3, file: 'a.css', … }
124
- * ```
138
+ * Root node after all transformations.
125
139
  *
126
140
  * ```js
127
- * if (result.map) {
128
- * fs.writeFileSync(result.opts.to + '.map', result.map.toString())
129
- * }
141
+ * root.toResult().root === root
130
142
  * ```
131
143
  */
132
- map: SourceMap
133
-
134
- /**
135
- * Last runned PostCSS plugin.
136
- */
137
- lastPlugin: Plugin | TransformCallback
144
+ root: RootNode
138
145
 
139
146
  /**
140
147
  * @param processor Processor used for this transformation.
141
148
  * @param root Root node after all transformations.
142
149
  * @param opts Options from the `Processor#process` or `Root#toResult`.
143
150
  */
144
- constructor(processor: Processor, root: Root, opts: ResultOptions)
145
-
146
- /**
147
- * An alias for the `Result#css` property.
148
- * Use it with syntaxes that generate non-CSS output.
149
- *
150
- * ```js
151
- * result.css === result.content
152
- * ```
153
- */
154
- get content(): string
151
+ constructor(processor: Processor, root: RootNode, opts: Result.ResultOptions)
155
152
 
156
153
  /**
157
154
  * Returns for `Result#css` content.
@@ -192,4 +189,18 @@ export default class Result {
192
189
  * @return Warnings from plugins.
193
190
  */
194
191
  warnings(): Warning[]
192
+
193
+ /**
194
+ * An alias for the `Result#css` property.
195
+ * Use it with syntaxes that generate non-CSS output.
196
+ *
197
+ * ```js
198
+ * result.css === result.content
199
+ * ```
200
+ */
201
+ get content(): string
195
202
  }
203
+
204
+ declare class Result<RootNode = Document | Root> extends Result_<RootNode> {}
205
+
206
+ export = Result