UNPKG

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