result.d.ts 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import Processor from './processor';
  2. import * as postcss from './postcss';
  3. import Root from './root';
  4. export default class Result implements postcss.Result {
  5. /**
  6. * The Processor instance used for this transformation.
  7. */
  8. processor: Processor;
  9. /**
  10. * Contains the Root node after all transformations.
  11. */
  12. root: Root;
  13. /**
  14. * Options from the Processor#process(css, opts) or Root#toResult(opts) call
  15. * that produced this Result instance.
  16. */
  17. opts: postcss.ResultOptions;
  18. /**
  19. * A CSS string representing this Result's Root instance.
  20. */
  21. css: string;
  22. /**
  23. * An instance of the SourceMapGenerator class from the source-map library,
  24. * representing changes to the Result's Root instance.
  25. * This property will have a value only if the user does not want an inline
  26. * source map. By default, PostCSS generates inline source maps, written
  27. * directly into the processed CSS. The map property will be empty by default.
  28. * An external source map will be generated — and assigned to map — only if
  29. * the user has set the map.inline option to false, or if PostCSS was passed
  30. * an external input source map.
  31. */
  32. map: postcss.ResultMap;
  33. /**
  34. * Contains messages from plugins (e.g., warnings or custom messages).
  35. * Add a warning using Result#warn() and get all warnings
  36. * using the Result#warnings() method.
  37. */
  38. messages: postcss.ResultMessage[];
  39. lastPlugin: postcss.Transformer;
  40. /**
  41. * Provides the result of the PostCSS transformations.
  42. */
  43. constructor(
  44. /**
  45. * The Processor instance used for this transformation.
  46. */
  47. processor?: Processor,
  48. /**
  49. * Contains the Root node after all transformations.
  50. */
  51. root?: Root,
  52. /**
  53. * Options from the Processor#process(css, opts) or Root#toResult(opts) call
  54. * that produced this Result instance.
  55. */
  56. opts?: postcss.ResultOptions);
  57. /**
  58. * Alias for css property.
  59. */
  60. toString(): string;
  61. /**
  62. * Creates an instance of Warning and adds it to messages.
  63. * @param message Used in the text property of the message object.
  64. * @param options Properties for Message object.
  65. */
  66. warn(message: string, options?: postcss.WarningOptions): void;
  67. /**
  68. * @returns Warnings from plugins, filtered from messages.
  69. */
  70. warnings(): postcss.ResultMessage[];
  71. /**
  72. * Alias for css property to use with syntaxes that generate non-CSS output.
  73. */
  74. content: string;
  75. }