previous-map.d.ts 1.6 KB

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