1 | import Document from './document.js'
|
2 | import { SourceMap } from './postcss.js'
|
3 | import Processor from './processor.js'
|
4 | import Result, { Message, ResultOptions } from './result.js'
|
5 | import Root from './root.js'
|
6 | import Warning from './warning.js'
|
7 |
|
8 | declare namespace LazyResult {
|
9 |
|
10 | export { LazyResult_ as default }
|
11 | }
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | declare class LazyResult_<RootNode = Document | Root>
|
23 | implements PromiseLike<Result<RootNode>>
|
24 | {
|
25 | |
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 | catch: Promise<Result<RootNode>>['catch']
|
40 |
|
41 | |
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 | finally: Promise<Result<RootNode>>['finally']
|
54 |
|
55 | |
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 | then: Promise<Result<RootNode>>['then']
|
69 |
|
70 | |
71 |
|
72 |
|
73 |
|
74 |
|
75 | constructor(processor: Processor, css: string, opts: ResultOptions)
|
76 |
|
77 | /**
|
78 | * Run plugin in async way and return `Result`.
|
79 | *
|
80 | * @return Result with output content.
|
81 | */
|
82 | async(): Promise<Result<RootNode>>
|
83 |
|
84 | /**
|
85 | * An alias for the `css` property. Use it with syntaxes
|
86 | * that generate non-CSS output.
|
87 | *
|
88 | * This property will only work with synchronous plugins.
|
89 | * If the processor contains any asynchronous plugins
|
90 | * it will throw an error.
|
91 | *
|
92 | * PostCSS runners should always use `LazyResult#then`.
|
93 | */
|
94 | get content(): string
|
95 |
|
96 | /**
|
97 | * Processes input CSS through synchronous plugins, converts `Root`
|
98 | * to a CSS string and returns `Result#css`.
|
99 | *
|
100 | * This property will only work with synchronous plugins.
|
101 | * If the processor contains any asynchronous plugins
|
102 | * it will throw an error.
|
103 | *
|
104 | * PostCSS runners should always use `LazyResult#then`.
|
105 | */
|
106 | get css(): string
|
107 |
|
108 | /**
|
109 | * Processes input CSS through synchronous plugins
|
110 | * and returns `Result#map`.
|
111 | *
|
112 | * This property will only work with synchronous plugins.
|
113 | * If the processor contains any asynchronous plugins
|
114 | * it will throw an error.
|
115 | *
|
116 | * PostCSS runners should always use `LazyResult#then`.
|
117 | */
|
118 | get map(): SourceMap
|
119 |
|
120 | /**
|
121 | * Processes input CSS through synchronous plugins
|
122 | * and returns `Result#messages`.
|
123 | *
|
124 | * This property will only work with synchronous plugins. If the processor
|
125 | * contains any asynchronous plugins it will throw an error.
|
126 | *
|
127 | * PostCSS runners should always use `LazyResult#then`.
|
128 | */
|
129 | get messages(): Message[]
|
130 |
|
131 | /**
|
132 | * Options from the `Processor#process` call.
|
133 | */
|
134 | get opts(): ResultOptions
|
135 |
|
136 | /**
|
137 | * Returns a `Processor` instance, which will be used
|
138 | * for CSS transformations.
|
139 | */
|
140 | get processor(): Processor
|
141 |
|
142 | /**
|
143 | * Processes input CSS through synchronous plugins
|
144 | * and returns `Result#root`.
|
145 | *
|
146 | * This property will only work with synchronous plugins. If the processor
|
147 | * contains any asynchronous plugins it will throw an error.
|
148 | *
|
149 | * PostCSS runners should always use `LazyResult#then`.
|
150 | */
|
151 | get root(): RootNode
|
152 |
|
153 | /**
|
154 | * Returns the default string description of an object.
|
155 | * Required to implement the Promise interface.
|
156 | */
|
157 | get [Symbol.toStringTag](): string
|
158 |
|
159 | /**
|
160 | * Run plugin in sync way and return `Result`.
|
161 | *
|
162 | * @return Result with output content.
|
163 | */
|
164 | sync(): Result<RootNode>
|
165 |
|
166 | /**
|
167 | * Alias for the `LazyResult#css` property.
|
168 | *
|
169 | * ```js
|
170 | * lazy + '' === lazy.css
|
171 | * ```
|
172 | *
|
173 | * @return Output CSS.
|
174 | */
|
175 | toString(): string
|
176 |
|
177 | /**
|
178 | * Processes input CSS through synchronous plugins
|
179 | * and calls `Result#warnings`.
|
180 | *
|
181 | * @return Warnings from plugins.
|
182 | */
|
183 | warnings(): Warning[]
|
184 | }
|
185 |
|
186 | declare class LazyResult<
|
187 | RootNode = Document | Root
|
188 | > extends LazyResult_<RootNode> {}
|
189 |
|
190 | export = LazyResult
|