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 | * Run plugin in sync way and return `Result`.
|
86 | *
|
87 | * @return Result with output content.
|
88 | */
|
89 | sync(): Result<RootNode>
|
90 |
|
91 | /**
|
92 | * Alias for the `LazyResult#css` property.
|
93 | *
|
94 | * ```js
|
95 | * lazy + '' === lazy.css
|
96 | * ```
|
97 | *
|
98 | * @return Output CSS.
|
99 | */
|
100 | toString(): string
|
101 |
|
102 | /**
|
103 | * Processes input CSS through synchronous plugins
|
104 | * and calls `Result#warnings`.
|
105 | *
|
106 | * @return Warnings from plugins.
|
107 | */
|
108 | warnings(): Warning[]
|
109 |
|
110 | /**
|
111 | * An alias for the `css` property. Use it with syntaxes
|
112 | * that generate non-CSS output.
|
113 | *
|
114 | * This property will only work with synchronous plugins.
|
115 | * If the processor contains any asynchronous plugins
|
116 | * it will throw an error.
|
117 | *
|
118 | * PostCSS runners should always use `LazyResult#then`.
|
119 | */
|
120 | get content(): string
|
121 |
|
122 | /**
|
123 | * Processes input CSS through synchronous plugins, converts `Root`
|
124 | * to a CSS string and returns `Result#css`.
|
125 | *
|
126 | * This property will only work with synchronous plugins.
|
127 | * If the processor contains any asynchronous plugins
|
128 | * it will throw an error.
|
129 | *
|
130 | * PostCSS runners should always use `LazyResult#then`.
|
131 | */
|
132 | get css(): string
|
133 |
|
134 | /**
|
135 | * Processes input CSS through synchronous plugins
|
136 | * and returns `Result#map`.
|
137 | *
|
138 | * This property will only work with synchronous plugins.
|
139 | * If the processor contains any asynchronous plugins
|
140 | * it will throw an error.
|
141 | *
|
142 | * PostCSS runners should always use `LazyResult#then`.
|
143 | */
|
144 | get map(): SourceMap
|
145 |
|
146 | /**
|
147 | * Processes input CSS through synchronous plugins
|
148 | * and returns `Result#messages`.
|
149 | *
|
150 | * This property will only work with synchronous plugins. If the processor
|
151 | * contains any asynchronous plugins it will throw an error.
|
152 | *
|
153 | * PostCSS runners should always use `LazyResult#then`.
|
154 | */
|
155 | get messages(): Message[]
|
156 |
|
157 | /**
|
158 | * Options from the `Processor#process` call.
|
159 | */
|
160 | get opts(): ResultOptions
|
161 |
|
162 | /**
|
163 | * Returns a `Processor` instance, which will be used
|
164 | * for CSS transformations.
|
165 | */
|
166 | get processor(): Processor
|
167 |
|
168 | /**
|
169 | * Processes input CSS through synchronous plugins
|
170 | * and returns `Result#root`.
|
171 | *
|
172 | * This property will only work with synchronous plugins. If the processor
|
173 | * contains any asynchronous plugins it will throw an error.
|
174 | *
|
175 | * PostCSS runners should always use `LazyResult#then`.
|
176 | */
|
177 | get root(): RootNode
|
178 |
|
179 | /**
|
180 | * Returns the default string description of an object.
|
181 | * Required to implement the Promise interface.
|
182 | */
|
183 | get [Symbol.toStringTag](): string
|
184 | }
|
185 |
|
186 | declare class LazyResult<
|
187 | RootNode = Document | Root
|
188 | > extends LazyResult_<RootNode> {}
|
189 |
|
190 | export = LazyResult
|