UNPKG

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