You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.6 KiB

2 years ago
  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. }