no-work-result.d.ts 1.5 KB

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