source: trip-planner-front/node_modules/postcss/lib/input.d.ts@ b738035

Last change on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.7 KB
RevLine 
[6a3a178]1import { ProcessOptions } from './postcss.js'
2import PreviousMap from './previous-map.js'
3
4export interface FilePosition {
5 /**
6 * URL for the source file.
7 */
8 url: string
9
10 /**
11 * Absolute path to the source file.
12 */
13 file?: string
14
15 /**
16 * Line in source file.
17 */
18 line: number
19
20 /**
21 * Column in source file.
22 */
23 column: number
24
25 /**
26 * Source code.
27 */
28 source?: string
29}
30
31/**
32 * Represents the source CSS.
33 *
34 * ```js
35 * const root = postcss.parse(css, { from: file })
36 * const input = root.source.input
37 * ```
38 */
39export default class Input {
40 /**
41 * Input CSS source.
42 *
43 * ```js
44 * const input = postcss.parse('a{}', { from: file }).input
45 * input.css //=> "a{}"
46 * ```
47 */
48 css: string
49
50 /**
51 * The input source map passed from a compilation step before PostCSS
52 * (for example, from Sass compiler).
53 *
54 * ```js
55 * root.source.input.map.consumer().sources //=> ['a.sass']
56 * ```
57 */
58 map: PreviousMap
59
60 /**
61 * The absolute path to the CSS source file defined
62 * with the `from` option.
63 *
64 * ```js
65 * const root = postcss.parse(css, { from: 'a.css' })
66 * root.source.input.file //=> '/home/ai/a.css'
67 * ```
68 */
69 file?: string
70
71 /**
72 * The unique ID of the CSS source. It will be created if `from` option
73 * is not provided (because PostCSS does not know the file path).
74 *
75 * ```js
76 * const root = postcss.parse(css)
77 * root.source.input.file //=> undefined
78 * root.source.input.id //=> "<input css 8LZeVF>"
79 * ```
80 */
81 id?: string
82
83 /**
84 * The flag to indicate whether or not the source code has Unicode BOM.
85 */
86 hasBOM: boolean
87
88 /**
89 * @param css Input CSS source.
90 * @param opts Process options.
91 */
92 constructor(css: string, opts?: ProcessOptions)
93
94 /**
95 * The CSS source identifier. Contains `Input#file` if the user
96 * set the `from` option, or `Input#id` if they did not.
97 *
98 * ```js
99 * const root = postcss.parse(css, { from: 'a.css' })
100 * root.source.input.from //=> "/home/ai/a.css"
101 *
102 * const root = postcss.parse(css)
103 * root.source.input.from //=> "<input css 1>"
104 * ```
105 */
106 get from(): string
107
108 /**
109 * Reads the input source map and returns a symbol position
110 * in the input source (e.g., in a Sass file that was compiled
111 * to CSS before being passed to PostCSS).
112 *
113 * ```js
114 * root.source.input.origin(1, 1) //=> { file: 'a.css', line: 3, column: 1 }
115 * ```
116 *
117 * @param line Line in input CSS.
118 * @param column Column in input CSS.
119 *
120 * @return Position in input source.
121 */
122 origin(line: number, column: number): FilePosition | false
123
124 /**
125 * Converts source offset to line and column.
126 *
127 * @param offset Source offset.
128 */
129 fromOffset(offset: number): { line: number; col: number } | null
130}
Note: See TracBrowser for help on using the repository browser.