previous-map.d.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import { SourceMapConsumer } from 'source-map-js'
  2. import { ProcessOptions } from './postcss.js'
  3. declare namespace PreviousMap {
  4. export { PreviousMap_ as default }
  5. }
  6. /**
  7. * Source map information from input CSS.
  8. * For example, source map after Sass compiler.
  9. *
  10. * This class will automatically find source map in input CSS or in file system
  11. * near input file (according `from` option).
  12. *
  13. * ```js
  14. * const root = parse(css, { from: 'a.sass.css' })
  15. * root.input.map //=> PreviousMap
  16. * ```
  17. */
  18. declare class PreviousMap_ {
  19. /**
  20. * `sourceMappingURL` content.
  21. */
  22. annotation?: string
  23. /**
  24. * The CSS source identifier. Contains `Input#file` if the user
  25. * set the `from` option, or `Input#id` if they did not.
  26. */
  27. file?: string
  28. /**
  29. * Was source map inlined by data-uri to input CSS.
  30. */
  31. inline: boolean
  32. /**
  33. * Path to source map file.
  34. */
  35. mapFile?: string
  36. /**
  37. * The directory with source map file, if source map is in separated file.
  38. */
  39. root?: string
  40. /**
  41. * Source map file content.
  42. */
  43. text?: string
  44. /**
  45. * @param css Input CSS source.
  46. * @param opts Process options.
  47. */
  48. constructor(css: string, opts?: ProcessOptions)
  49. /**
  50. * Create a instance of `SourceMapGenerator` class
  51. * from the `source-map` library to work with source map information.
  52. *
  53. * It is lazy method, so it will create object only on first call
  54. * and then it will use cache.
  55. *
  56. * @return Object with source map information.
  57. */
  58. consumer(): SourceMapConsumer
  59. /**
  60. * Does source map contains `sourcesContent` with input source text.
  61. *
  62. * @return Is `sourcesContent` present.
  63. */
  64. withContent(): boolean
  65. }
  66. declare class PreviousMap extends PreviousMap_ {}
  67. export = PreviousMap