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