postcss 8.3.9 → 8.4.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -23
- package/lib/at-rule.d.ts +58 -49
- package/lib/comment.d.ts +43 -32
- package/lib/container.d.ts +233 -223
- package/lib/container.js +251 -244
- package/lib/css-syntax-error.d.ts +117 -61
- package/lib/css-syntax-error.js +10 -3
- package/lib/declaration.d.ts +85 -61
- package/lib/document.d.ts +27 -16
- package/lib/fromJSON.d.ts +6 -2
- package/lib/input.d.ts +118 -54
- package/lib/input.js +87 -55
- package/lib/lazy-result.d.ts +82 -67
- package/lib/lazy-result.js +234 -232
- package/lib/list.d.ts +53 -47
- package/lib/list.js +16 -14
- package/lib/map-generator.js +231 -172
- package/lib/no-work-result.d.ts +46 -0
- package/lib/no-work-result.js +135 -0
- package/lib/node.d.ts +345 -253
- package/lib/node.js +200 -139
- package/lib/parse.d.ts +6 -2
- package/lib/parser.js +354 -309
- package/lib/postcss.d.mts +72 -0
- package/lib/postcss.d.ts +288 -319
- package/lib/postcss.js +18 -12
- package/lib/postcss.mjs +1 -0
- package/lib/previous-map.d.ts +23 -14
- package/lib/previous-map.js +37 -40
- package/lib/processor.d.ts +55 -41
- package/lib/processor.js +20 -27
- package/lib/result.d.ts +87 -76
- package/lib/root.d.ts +49 -36
- package/lib/root.js +12 -10
- package/lib/rule.d.ts +54 -45
- package/lib/stringifier.d.ts +46 -0
- package/lib/stringifier.js +140 -138
- package/lib/stringify.d.ts +6 -2
- package/lib/terminal-highlight.js +11 -11
- package/lib/tokenize.js +2 -2
- package/lib/warn-once.js +1 -0
- package/lib/warning.d.ts +79 -36
- package/lib/warning.js +6 -4
- package/package.json +20 -10
package/lib/input.d.ts
CHANGED
@@ -1,31 +1,46 @@
|
|
1
|
-
import { ProcessOptions } from './postcss.js'
|
1
|
+
import { CssSyntaxError, ProcessOptions } from './postcss.js'
|
2
2
|
import PreviousMap from './previous-map.js'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
declare namespace Input {
|
5
|
+
export interface FilePosition {
|
6
|
+
/**
|
7
|
+
* Column of inclusive start position in source file.
|
8
|
+
*/
|
9
|
+
column: number
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
/**
|
12
|
+
* Column of exclusive end position in source file.
|
13
|
+
*/
|
14
|
+
endColumn?: number
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
/**
|
17
|
+
* Line of exclusive end position in source file.
|
18
|
+
*/
|
19
|
+
endLine?: number
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
/**
|
22
|
+
* Absolute path to the source file.
|
23
|
+
*/
|
24
|
+
file?: string
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
/**
|
27
|
+
* Line of inclusive start position in source file.
|
28
|
+
*/
|
29
|
+
line: number
|
30
|
+
|
31
|
+
/**
|
32
|
+
* Source code.
|
33
|
+
*/
|
34
|
+
source?: string
|
35
|
+
|
36
|
+
/**
|
37
|
+
* URL for the source file.
|
38
|
+
*/
|
39
|
+
url: string
|
40
|
+
}
|
41
|
+
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
43
|
+
export { Input_ as default }
|
29
44
|
}
|
30
45
|
|
31
46
|
/**
|
@@ -36,7 +51,7 @@ export interface FilePosition {
|
|
36
51
|
* const input = root.source.input
|
37
52
|
* ```
|
38
53
|
*/
|
39
|
-
|
54
|
+
declare class Input_ {
|
40
55
|
/**
|
41
56
|
* Input CSS source.
|
42
57
|
*
|
@@ -47,16 +62,6 @@ export default class Input {
|
|
47
62
|
*/
|
48
63
|
css: string
|
49
64
|
|
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
65
|
/**
|
61
66
|
* The absolute path to the CSS source file defined
|
62
67
|
* with the `from` option.
|
@@ -68,6 +73,11 @@ export default class Input {
|
|
68
73
|
*/
|
69
74
|
file?: string
|
70
75
|
|
76
|
+
/**
|
77
|
+
* The flag to indicate whether or not the source code has Unicode BOM.
|
78
|
+
*/
|
79
|
+
hasBOM: boolean
|
80
|
+
|
71
81
|
/**
|
72
82
|
* The unique ID of the CSS source. It will be created if `from` option
|
73
83
|
* is not provided (because PostCSS does not know the file path).
|
@@ -81,9 +91,14 @@ export default class Input {
|
|
81
91
|
id?: string
|
82
92
|
|
83
93
|
/**
|
84
|
-
* The
|
94
|
+
* The input source map passed from a compilation step before PostCSS
|
95
|
+
* (for example, from Sass compiler).
|
96
|
+
*
|
97
|
+
* ```js
|
98
|
+
* root.source.input.map.consumer().sources //=> ['a.sass']
|
99
|
+
* ```
|
85
100
|
*/
|
86
|
-
|
101
|
+
map: PreviousMap
|
87
102
|
|
88
103
|
/**
|
89
104
|
* @param css Input CSS source.
|
@@ -91,40 +106,89 @@ export default class Input {
|
|
91
106
|
*/
|
92
107
|
constructor(css: string, opts?: ProcessOptions)
|
93
108
|
|
109
|
+
error(
|
110
|
+
message: string,
|
111
|
+
start:
|
112
|
+
| {
|
113
|
+
column: number
|
114
|
+
line: number
|
115
|
+
}
|
116
|
+
| {
|
117
|
+
offset: number
|
118
|
+
},
|
119
|
+
end:
|
120
|
+
| {
|
121
|
+
column: number
|
122
|
+
line: number
|
123
|
+
}
|
124
|
+
| {
|
125
|
+
offset: number
|
126
|
+
},
|
127
|
+
opts?: { plugin?: CssSyntaxError['plugin'] }
|
128
|
+
): CssSyntaxError
|
129
|
+
|
94
130
|
/**
|
95
|
-
*
|
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
|
-
* ```
|
131
|
+
* Returns `CssSyntaxError` with information about the error and its position.
|
105
132
|
*/
|
106
|
-
|
133
|
+
error(
|
134
|
+
message: string,
|
135
|
+
line: number,
|
136
|
+
column: number,
|
137
|
+
opts?: { plugin?: CssSyntaxError['plugin'] }
|
138
|
+
): CssSyntaxError
|
139
|
+
|
140
|
+
error(
|
141
|
+
message: string,
|
142
|
+
offset: number,
|
143
|
+
opts?: { plugin?: CssSyntaxError['plugin'] }
|
144
|
+
): CssSyntaxError
|
107
145
|
|
146
|
+
/**
|
147
|
+
* Converts source offset to line and column.
|
148
|
+
*
|
149
|
+
* @param offset Source offset.
|
150
|
+
*/
|
151
|
+
fromOffset(offset: number): { col: number; line: number } | null
|
108
152
|
/**
|
109
153
|
* Reads the input source map and returns a symbol position
|
110
154
|
* in the input source (e.g., in a Sass file that was compiled
|
111
|
-
* to CSS before being passed to PostCSS).
|
155
|
+
* to CSS before being passed to PostCSS). Optionally takes an
|
156
|
+
* end position, exclusive.
|
112
157
|
*
|
113
158
|
* ```js
|
114
159
|
* root.source.input.origin(1, 1) //=> { file: 'a.css', line: 3, column: 1 }
|
160
|
+
* root.source.input.origin(1, 1, 1, 4)
|
161
|
+
* //=> { file: 'a.css', line: 3, column: 1, endLine: 3, endColumn: 4 }
|
115
162
|
* ```
|
116
163
|
*
|
117
|
-
* @param line
|
118
|
-
* @param column
|
164
|
+
* @param line Line for inclusive start position in input CSS.
|
165
|
+
* @param column Column for inclusive start position in input CSS.
|
166
|
+
* @param endLine Line for exclusive end position in input CSS.
|
167
|
+
* @param endColumn Column for exclusive end position in input CSS.
|
119
168
|
*
|
120
169
|
* @return Position in input source.
|
121
170
|
*/
|
122
|
-
origin(
|
123
|
-
|
171
|
+
origin(
|
172
|
+
line: number,
|
173
|
+
column: number,
|
174
|
+
endLine?: number,
|
175
|
+
endColumn?: number
|
176
|
+
): false | Input.FilePosition
|
124
177
|
/**
|
125
|
-
*
|
178
|
+
* The CSS source identifier. Contains `Input#file` if the user
|
179
|
+
* set the `from` option, or `Input#id` if they did not.
|
126
180
|
*
|
127
|
-
*
|
181
|
+
* ```js
|
182
|
+
* const root = postcss.parse(css, { from: 'a.css' })
|
183
|
+
* root.source.input.from //=> "/home/ai/a.css"
|
184
|
+
*
|
185
|
+
* const root = postcss.parse(css)
|
186
|
+
* root.source.input.from //=> "<input css 1>"
|
187
|
+
* ```
|
128
188
|
*/
|
129
|
-
|
189
|
+
get from(): string
|
130
190
|
}
|
191
|
+
|
192
|
+
declare class Input extends Input_ {}
|
193
|
+
|
194
|
+
export = Input
|
package/lib/input.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
let { SourceMapConsumer, SourceMapGenerator } = require('source-map-js')
|
4
4
|
let { fileURLToPath, pathToFileURL } = require('url')
|
5
|
-
let {
|
5
|
+
let { isAbsolute, resolve } = require('path')
|
6
6
|
let { nanoid } = require('nanoid/non-secure')
|
7
7
|
|
8
8
|
let terminalHighlight = require('./terminal-highlight')
|
@@ -60,6 +60,70 @@ class Input {
|
|
60
60
|
if (this.map) this.map.file = this.from
|
61
61
|
}
|
62
62
|
|
63
|
+
error(message, line, column, opts = {}) {
|
64
|
+
let result, endLine, endColumn
|
65
|
+
|
66
|
+
if (line && typeof line === 'object') {
|
67
|
+
let start = line
|
68
|
+
let end = column
|
69
|
+
if (typeof start.offset === 'number') {
|
70
|
+
let pos = this.fromOffset(start.offset)
|
71
|
+
line = pos.line
|
72
|
+
column = pos.col
|
73
|
+
} else {
|
74
|
+
line = start.line
|
75
|
+
column = start.column
|
76
|
+
}
|
77
|
+
if (typeof end.offset === 'number') {
|
78
|
+
let pos = this.fromOffset(end.offset)
|
79
|
+
endLine = pos.line
|
80
|
+
endColumn = pos.col
|
81
|
+
} else {
|
82
|
+
endLine = end.line
|
83
|
+
endColumn = end.column
|
84
|
+
}
|
85
|
+
} else if (!column) {
|
86
|
+
let pos = this.fromOffset(line)
|
87
|
+
line = pos.line
|
88
|
+
column = pos.col
|
89
|
+
}
|
90
|
+
|
91
|
+
let origin = this.origin(line, column, endLine, endColumn)
|
92
|
+
if (origin) {
|
93
|
+
result = new CssSyntaxError(
|
94
|
+
message,
|
95
|
+
origin.endLine === undefined
|
96
|
+
? origin.line
|
97
|
+
: { column: origin.column, line: origin.line },
|
98
|
+
origin.endLine === undefined
|
99
|
+
? origin.column
|
100
|
+
: { column: origin.endColumn, line: origin.endLine },
|
101
|
+
origin.source,
|
102
|
+
origin.file,
|
103
|
+
opts.plugin
|
104
|
+
)
|
105
|
+
} else {
|
106
|
+
result = new CssSyntaxError(
|
107
|
+
message,
|
108
|
+
endLine === undefined ? line : { column, line },
|
109
|
+
endLine === undefined ? column : { column: endColumn, line: endLine },
|
110
|
+
this.css,
|
111
|
+
this.file,
|
112
|
+
opts.plugin
|
113
|
+
)
|
114
|
+
}
|
115
|
+
|
116
|
+
result.input = { column, endColumn, endLine, line, source: this.css }
|
117
|
+
if (this.file) {
|
118
|
+
if (pathToFileURL) {
|
119
|
+
result.input.url = pathToFileURL(this.file).toString()
|
120
|
+
}
|
121
|
+
result.input.file = this.file
|
122
|
+
}
|
123
|
+
|
124
|
+
return result
|
125
|
+
}
|
126
|
+
|
63
127
|
fromOffset(offset) {
|
64
128
|
let lastLine, lineToIndex
|
65
129
|
if (!this[fromOffsetCache]) {
|
@@ -97,57 +161,30 @@ class Input {
|
|
97
161
|
}
|
98
162
|
}
|
99
163
|
return {
|
100
|
-
|
101
|
-
|
164
|
+
col: offset - lineToIndex[min] + 1,
|
165
|
+
line: min + 1
|
102
166
|
}
|
103
167
|
}
|
104
168
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
let pos = this.fromOffset(line)
|
109
|
-
line = pos.line
|
110
|
-
column = pos.col
|
111
|
-
}
|
112
|
-
let origin = this.origin(line, column)
|
113
|
-
if (origin) {
|
114
|
-
result = new CssSyntaxError(
|
115
|
-
message,
|
116
|
-
origin.line,
|
117
|
-
origin.column,
|
118
|
-
origin.source,
|
119
|
-
origin.file,
|
120
|
-
opts.plugin
|
121
|
-
)
|
122
|
-
} else {
|
123
|
-
result = new CssSyntaxError(
|
124
|
-
message,
|
125
|
-
line,
|
126
|
-
column,
|
127
|
-
this.css,
|
128
|
-
this.file,
|
129
|
-
opts.plugin
|
130
|
-
)
|
131
|
-
}
|
132
|
-
|
133
|
-
result.input = { line, column, source: this.css }
|
134
|
-
if (this.file) {
|
135
|
-
if (pathToFileURL) {
|
136
|
-
result.input.url = pathToFileURL(this.file).toString()
|
137
|
-
}
|
138
|
-
result.input.file = this.file
|
169
|
+
mapResolve(file) {
|
170
|
+
if (/^\w+:\/\//.test(file)) {
|
171
|
+
return file
|
139
172
|
}
|
140
|
-
|
141
|
-
return result
|
173
|
+
return resolve(this.map.consumer().sourceRoot || this.map.root || '.', file)
|
142
174
|
}
|
143
175
|
|
144
|
-
origin(line, column) {
|
176
|
+
origin(line, column, endLine, endColumn) {
|
145
177
|
if (!this.map) return false
|
146
178
|
let consumer = this.map.consumer()
|
147
179
|
|
148
|
-
let from = consumer.originalPositionFor({
|
180
|
+
let from = consumer.originalPositionFor({ column, line })
|
149
181
|
if (!from.source) return false
|
150
182
|
|
183
|
+
let to
|
184
|
+
if (typeof endLine === 'number') {
|
185
|
+
to = consumer.originalPositionFor({ column: endColumn, line: endLine })
|
186
|
+
}
|
187
|
+
|
151
188
|
let fromUrl
|
152
189
|
|
153
190
|
if (isAbsolute(from.source)) {
|
@@ -160,16 +197,18 @@ class Input {
|
|
160
197
|
}
|
161
198
|
|
162
199
|
let result = {
|
163
|
-
|
200
|
+
column: from.column,
|
201
|
+
endColumn: to && to.column,
|
202
|
+
endLine: to && to.line,
|
164
203
|
line: from.line,
|
165
|
-
|
204
|
+
url: fromUrl.toString()
|
166
205
|
}
|
167
206
|
|
168
207
|
if (fromUrl.protocol === 'file:') {
|
169
208
|
if (fileURLToPath) {
|
170
209
|
result.file = fileURLToPath(fromUrl)
|
171
210
|
} else {
|
172
|
-
|
211
|
+
/* c8 ignore next 2 */
|
173
212
|
throw new Error(`file: protocol is not available in this PostCSS build`)
|
174
213
|
}
|
175
214
|
}
|
@@ -180,17 +219,6 @@ class Input {
|
|
180
219
|
return result
|
181
220
|
}
|
182
221
|
|
183
|
-
mapResolve(file) {
|
184
|
-
if (/^\w+:\/\//.test(file)) {
|
185
|
-
return file
|
186
|
-
}
|
187
|
-
return resolve(this.map.consumer().sourceRoot || this.map.root || '.', file)
|
188
|
-
}
|
189
|
-
|
190
|
-
get from() {
|
191
|
-
return this.file || this.id
|
192
|
-
}
|
193
|
-
|
194
222
|
toJSON() {
|
195
223
|
let json = {}
|
196
224
|
for (let name of ['hasBOM', 'css', 'file', 'id']) {
|
@@ -206,6 +234,10 @@ class Input {
|
|
206
234
|
}
|
207
235
|
return json
|
208
236
|
}
|
237
|
+
|
238
|
+
get from() {
|
239
|
+
return this.file || this.id
|
240
|
+
}
|
209
241
|
}
|
210
242
|
|
211
243
|
module.exports = Input
|
package/lib/lazy-result.d.ts
CHANGED
@@ -1,8 +1,14 @@
|
|
1
|
-
import
|
1
|
+
import Document from './document.js'
|
2
2
|
import { SourceMap } from './postcss.js'
|
3
3
|
import Processor from './processor.js'
|
4
|
-
import
|
4
|
+
import Result, { Message, ResultOptions } from './result.js'
|
5
5
|
import Root from './root.js'
|
6
|
+
import Warning from './warning.js'
|
7
|
+
|
8
|
+
declare namespace LazyResult {
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
10
|
+
export { LazyResult_ as default }
|
11
|
+
}
|
6
12
|
|
7
13
|
/**
|
8
14
|
* A Promise proxy for the result of PostCSS transformations.
|
@@ -13,51 +19,53 @@ import Root from './root.js'
|
|
13
19
|
* const lazy = postcss([autoprefixer]).process(css)
|
14
20
|
* ```
|
15
21
|
*/
|
16
|
-
|
22
|
+
declare class LazyResult_<RootNode = Document | Root>
|
23
|
+
implements PromiseLike<Result<RootNode>>
|
24
|
+
{
|
17
25
|
/**
|
18
26
|
* Processes input CSS through synchronous and asynchronous plugins
|
19
|
-
* and calls
|
20
|
-
* an error, the `onRejected` callback will be executed.
|
27
|
+
* and calls onRejected for each error thrown in any plugin.
|
21
28
|
*
|
22
29
|
* It implements standard Promise API.
|
23
30
|
*
|
24
31
|
* ```js
|
25
|
-
* postcss([autoprefixer]).process(css
|
32
|
+
* postcss([autoprefixer]).process(css).then(result => {
|
26
33
|
* console.log(result.css)
|
34
|
+
* }).catch(error => {
|
35
|
+
* console.error(error)
|
27
36
|
* })
|
28
37
|
* ```
|
29
38
|
*/
|
30
|
-
|
39
|
+
catch: Promise<Result<RootNode>>['catch']
|
31
40
|
|
32
41
|
/**
|
33
42
|
* Processes input CSS through synchronous and asynchronous plugins
|
34
|
-
* and calls
|
43
|
+
* and calls onFinally on any error or when all plugins will finish work.
|
35
44
|
*
|
36
45
|
* It implements standard Promise API.
|
37
46
|
*
|
38
47
|
* ```js
|
39
|
-
* postcss([autoprefixer]).process(css).
|
40
|
-
* console.log(
|
41
|
-
* }).catch(error => {
|
42
|
-
* console.error(error)
|
48
|
+
* postcss([autoprefixer]).process(css).finally(() => {
|
49
|
+
* console.log('processing ended')
|
43
50
|
* })
|
44
51
|
* ```
|
45
52
|
*/
|
46
|
-
|
53
|
+
finally: Promise<Result<RootNode>>['finally']
|
47
54
|
|
48
55
|
/**
|
49
56
|
* Processes input CSS through synchronous and asynchronous plugins
|
50
|
-
* and calls
|
57
|
+
* and calls `onFulfilled` with a Result instance. If a plugin throws
|
58
|
+
* an error, the `onRejected` callback will be executed.
|
51
59
|
*
|
52
60
|
* It implements standard Promise API.
|
53
61
|
*
|
54
62
|
* ```js
|
55
|
-
* postcss([autoprefixer]).process(css).
|
56
|
-
* console.log(
|
63
|
+
* postcss([autoprefixer]).process(css, { from: cssPath }).then(result => {
|
64
|
+
* console.log(result.css)
|
57
65
|
* })
|
58
66
|
* ```
|
59
67
|
*/
|
60
|
-
|
68
|
+
then: Promise<Result<RootNode>>['then']
|
61
69
|
|
62
70
|
/**
|
63
71
|
* @param processor Processor used for this transformation.
|
@@ -67,32 +75,37 @@ export default class LazyResult implements PromiseLike<Result> {
|
|
67
75
|
constructor(processor: Processor, css: string, opts: ResultOptions)
|
68
76
|
|
69
77
|
/**
|
70
|
-
*
|
71
|
-
*
|
78
|
+
* Run plugin in async way and return `Result`.
|
79
|
+
*
|
80
|
+
* @return Result with output content.
|
72
81
|
*/
|
73
|
-
|
82
|
+
async(): Promise<Result<RootNode>>
|
74
83
|
|
75
84
|
/**
|
76
|
-
*
|
77
|
-
*
|
85
|
+
* Run plugin in sync way and return `Result`.
|
86
|
+
*
|
87
|
+
* @return Result with output content.
|
78
88
|
*/
|
79
|
-
|
89
|
+
sync(): Result<RootNode>
|
80
90
|
|
81
91
|
/**
|
82
|
-
*
|
92
|
+
* Alias for the `LazyResult#css` property.
|
93
|
+
*
|
94
|
+
* ```js
|
95
|
+
* lazy + '' === lazy.css
|
96
|
+
* ```
|
97
|
+
*
|
98
|
+
* @return Output CSS.
|
83
99
|
*/
|
84
|
-
|
100
|
+
toString(): string
|
85
101
|
|
86
102
|
/**
|
87
|
-
* Processes input CSS through synchronous plugins
|
88
|
-
*
|
103
|
+
* Processes input CSS through synchronous plugins
|
104
|
+
* and calls `Result#warnings`.
|
89
105
|
*
|
90
|
-
*
|
91
|
-
* If the processor contains any asynchronous plugins
|
92
|
-
* it will throw an error. This is why this method is only
|
93
|
-
* for debug purpose, you should always use `LazyResult#then`.
|
106
|
+
* @return Warnings from plugins.
|
94
107
|
*/
|
95
|
-
|
108
|
+
warnings(): Warning[]
|
96
109
|
|
97
110
|
/**
|
98
111
|
* An alias for the `css` property. Use it with syntaxes
|
@@ -100,33 +113,35 @@ export default class LazyResult implements PromiseLike<Result> {
|
|
100
113
|
*
|
101
114
|
* This property will only work with synchronous plugins.
|
102
115
|
* If the processor contains any asynchronous plugins
|
103
|
-
* it will throw an error.
|
104
|
-
*
|
116
|
+
* it will throw an error.
|
117
|
+
*
|
118
|
+
* PostCSS runners should always use `LazyResult#then`.
|
105
119
|
*/
|
106
120
|
get content(): string
|
107
121
|
|
108
122
|
/**
|
109
|
-
* Processes input CSS through synchronous plugins
|
110
|
-
* and returns `Result#
|
123
|
+
* Processes input CSS through synchronous plugins, converts `Root`
|
124
|
+
* to a CSS string and returns `Result#css`.
|
111
125
|
*
|
112
126
|
* This property will only work with synchronous plugins.
|
113
127
|
* If the processor contains any asynchronous plugins
|
114
|
-
* it will throw an error.
|
115
|
-
*
|
128
|
+
* it will throw an error.
|
129
|
+
*
|
130
|
+
* PostCSS runners should always use `LazyResult#then`.
|
116
131
|
*/
|
117
|
-
get
|
132
|
+
get css(): string
|
118
133
|
|
119
134
|
/**
|
120
135
|
* Processes input CSS through synchronous plugins
|
121
|
-
* and returns `Result#
|
136
|
+
* and returns `Result#map`.
|
122
137
|
*
|
123
|
-
* This property will only work with synchronous plugins.
|
124
|
-
* contains any asynchronous plugins
|
138
|
+
* This property will only work with synchronous plugins.
|
139
|
+
* If the processor contains any asynchronous plugins
|
140
|
+
* it will throw an error.
|
125
141
|
*
|
126
|
-
*
|
127
|
-
* you should always use `LazyResult#then`.
|
142
|
+
* PostCSS runners should always use `LazyResult#then`.
|
128
143
|
*/
|
129
|
-
get
|
144
|
+
get map(): SourceMap
|
130
145
|
|
131
146
|
/**
|
132
147
|
* Processes input CSS through synchronous plugins
|
@@ -135,41 +150,41 @@ export default class LazyResult implements PromiseLike<Result> {
|
|
135
150
|
* This property will only work with synchronous plugins. If the processor
|
136
151
|
* contains any asynchronous plugins it will throw an error.
|
137
152
|
*
|
138
|
-
*
|
139
|
-
* you should always use `LazyResult#then`.
|
153
|
+
* PostCSS runners should always use `LazyResult#then`.
|
140
154
|
*/
|
141
155
|
get messages(): Message[]
|
142
156
|
|
143
157
|
/**
|
144
|
-
*
|
145
|
-
* and calls `Result#warnings`.
|
146
|
-
*
|
147
|
-
* @return Warnings from plugins.
|
158
|
+
* Options from the `Processor#process` call.
|
148
159
|
*/
|
149
|
-
|
160
|
+
get opts(): ResultOptions
|
150
161
|
|
151
162
|
/**
|
152
|
-
*
|
153
|
-
*
|
154
|
-
* ```js
|
155
|
-
* lazy + '' === lazy.css
|
156
|
-
* ```
|
157
|
-
*
|
158
|
-
* @return Output CSS.
|
163
|
+
* Returns a `Processor` instance, which will be used
|
164
|
+
* for CSS transformations.
|
159
165
|
*/
|
160
|
-
|
166
|
+
get processor(): Processor
|
161
167
|
|
162
168
|
/**
|
163
|
-
*
|
169
|
+
* Processes input CSS through synchronous plugins
|
170
|
+
* and returns `Result#root`.
|
164
171
|
*
|
165
|
-
*
|
172
|
+
* This property will only work with synchronous plugins. If the processor
|
173
|
+
* contains any asynchronous plugins it will throw an error.
|
174
|
+
*
|
175
|
+
* PostCSS runners should always use `LazyResult#then`.
|
166
176
|
*/
|
167
|
-
|
177
|
+
get root(): RootNode
|
168
178
|
|
169
179
|
/**
|
170
|
-
*
|
171
|
-
*
|
172
|
-
* @return Result with output content.
|
180
|
+
* Returns the default string description of an object.
|
181
|
+
* Required to implement the Promise interface.
|
173
182
|
*/
|
174
|
-
|
183
|
+
get [Symbol.toStringTag](): string
|
175
184
|
}
|
185
|
+
|
186
|
+
declare class LazyResult<
|
187
|
+
RootNode = Document | Root
|
188
|
+
> extends LazyResult_<RootNode> {}
|
189
|
+
|
190
|
+
export = LazyResult
|