UNPKG

1.57 kBTypeScriptView Raw
1import LazyResult from './lazy-result.js'
2import { SourceMap } from './postcss.js'
3import Processor from './processor.js'
4import Result, { Message, ResultOptions } from './result.js'
5import Root from './root.js'
6import Warning from './warning.js'
7
8declare namespace NoWorkResult {
9 // eslint-disable-next-line @typescript-eslint/no-use-before-define
10 export { NoWorkResult_ as default }
11}
12
13/**
14 * A Promise proxy for the result of PostCSS transformations.
15 * This lazy result instance doesn't parse css unless `NoWorkResult#root` or `Result#root`
16 * are accessed. See the example below for details.
17 * A `NoWork` instance is returned by `Processor#process` ONLY when no plugins defined.
18 *
19 * ```js
20 * const noWorkResult = postcss().process(css) // No plugins are defined.
21 * // CSS is not parsed
22 * let root = noWorkResult.root // now css is parsed because we accessed the root
23 * ```
24 */
25declare class NoWorkResult_ implements LazyResult<Root> {
26 catch: Promise<Result<Root>>['catch']
27 finally: Promise<Result<Root>>['finally']
28 then: Promise<Result<Root>>['then']
29 constructor(processor: Processor, css: string, opts: ResultOptions)
30 async(): Promise<Result<Root>>
31 sync(): Result<Root>
32 toString(): string
33 warnings(): Warning[]
34 get content(): string
35 get css(): string
36 get map(): SourceMap
37 get messages(): Message[]
38 get opts(): ResultOptions
39 get processor(): Processor
40 get root(): Root
41 get [Symbol.toStringTag](): string
42}
43
44declare class NoWorkResult extends NoWorkResult_ {}
45
46export = NoWorkResult