UNPKG

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