no-work-result.d.ts 1.3 KB

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