Node-Red configuration
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

lazy-result.d.ts 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. import Document from './document.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 LazyResult {
  8. // eslint-disable-next-line @typescript-eslint/no-use-before-define
  9. export { LazyResult_ as default }
  10. }
  11. /**
  12. * A Promise proxy for the result of PostCSS transformations.
  13. *
  14. * A `LazyResult` instance is returned by `Processor#process`.
  15. *
  16. * ```js
  17. * const lazy = postcss([autoprefixer]).process(css)
  18. * ```
  19. */
  20. declare class LazyResult_<RootNode = Document | Root>
  21. implements PromiseLike<Result<RootNode>>
  22. {
  23. /**
  24. * Processes input CSS through synchronous and asynchronous plugins
  25. * and calls onRejected for each error thrown in any plugin.
  26. *
  27. * It implements standard Promise API.
  28. *
  29. * ```js
  30. * postcss([autoprefixer]).process(css).then(result => {
  31. * console.log(result.css)
  32. * }).catch(error => {
  33. * console.error(error)
  34. * })
  35. * ```
  36. */
  37. catch: Promise<Result<RootNode>>['catch']
  38. /**
  39. * Processes input CSS through synchronous and asynchronous plugins
  40. * and calls onFinally on any error or when all plugins will finish work.
  41. *
  42. * It implements standard Promise API.
  43. *
  44. * ```js
  45. * postcss([autoprefixer]).process(css).finally(() => {
  46. * console.log('processing ended')
  47. * })
  48. * ```
  49. */
  50. finally: Promise<Result<RootNode>>['finally']
  51. /**
  52. * Processes input CSS through synchronous and asynchronous plugins
  53. * and calls `onFulfilled` with a Result instance. If a plugin throws
  54. * an error, the `onRejected` callback will be executed.
  55. *
  56. * It implements standard Promise API.
  57. *
  58. * ```js
  59. * postcss([autoprefixer]).process(css, { from: cssPath }).then(result => {
  60. * console.log(result.css)
  61. * })
  62. * ```
  63. */
  64. then: Promise<Result<RootNode>>['then']
  65. /**
  66. * @param processor Processor used for this transformation.
  67. * @param css CSS to parse and transform.
  68. * @param opts Options from the `Processor#process` or `Root#toResult`.
  69. */
  70. constructor(processor: Processor, css: string, opts: ResultOptions)
  71. /**
  72. * Run plugin in async way and return `Result`.
  73. *
  74. * @return Result with output content.
  75. */
  76. async(): Promise<Result<RootNode>>
  77. /**
  78. * Run plugin in sync way and return `Result`.
  79. *
  80. * @return Result with output content.
  81. */
  82. sync(): Result<RootNode>
  83. /**
  84. * Alias for the `LazyResult#css` property.
  85. *
  86. * ```js
  87. * lazy + '' === lazy.css
  88. * ```
  89. *
  90. * @return Output CSS.
  91. */
  92. toString(): string
  93. /**
  94. * Processes input CSS through synchronous plugins
  95. * and calls `Result#warnings`.
  96. *
  97. * @return Warnings from plugins.
  98. */
  99. warnings(): Warning[]
  100. /**
  101. * An alias for the `css` property. Use it with syntaxes
  102. * that generate non-CSS output.
  103. *
  104. * This property will only work with synchronous plugins.
  105. * If the processor contains any asynchronous plugins
  106. * it will throw an error.
  107. *
  108. * PostCSS runners should always use `LazyResult#then`.
  109. */
  110. get content(): string
  111. /**
  112. * Processes input CSS through synchronous plugins, converts `Root`
  113. * to a CSS string and returns `Result#css`.
  114. *
  115. * This property will only work with synchronous plugins.
  116. * If the processor contains any asynchronous plugins
  117. * it will throw an error.
  118. *
  119. * PostCSS runners should always use `LazyResult#then`.
  120. */
  121. get css(): string
  122. /**
  123. * Processes input CSS through synchronous plugins
  124. * and returns `Result#map`.
  125. *
  126. * This property will only work with synchronous plugins.
  127. * If the processor contains any asynchronous plugins
  128. * it will throw an error.
  129. *
  130. * PostCSS runners should always use `LazyResult#then`.
  131. */
  132. get map(): SourceMap
  133. /**
  134. * Processes input CSS through synchronous plugins
  135. * and returns `Result#messages`.
  136. *
  137. * This property will only work with synchronous plugins. If the processor
  138. * contains any asynchronous plugins it will throw an error.
  139. *
  140. * PostCSS runners should always use `LazyResult#then`.
  141. */
  142. get messages(): Message[]
  143. /**
  144. * Options from the `Processor#process` call.
  145. */
  146. get opts(): ResultOptions
  147. /**
  148. * Returns a `Processor` instance, which will be used
  149. * for CSS transformations.
  150. */
  151. get processor(): Processor
  152. /**
  153. * Processes input CSS through synchronous plugins
  154. * and returns `Result#root`.
  155. *
  156. * This property will only work with synchronous plugins. If the processor
  157. * contains any asynchronous plugins it will throw an error.
  158. *
  159. * PostCSS runners should always use `LazyResult#then`.
  160. */
  161. get root(): RootNode
  162. /**
  163. * Returns the default string description of an object.
  164. * Required to implement the Promise interface.
  165. */
  166. get [Symbol.toStringTag](): string
  167. }
  168. declare class LazyResult<
  169. RootNode = Document | Root
  170. > extends LazyResult_<RootNode> {}
  171. export = LazyResult