postcss 8.4.29 → 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 +5 -16
- package/lib/container.d.ts +32 -32
- package/lib/container.js +10 -10
- package/lib/input.d.ts +13 -13
- package/lib/input.js +4 -4
- package/lib/lazy-result.d.ts +26 -26
- package/lib/lazy-result.js +32 -32
- package/lib/map-generator.js +27 -6
- package/lib/no-work-result.d.ts +3 -3
- package/lib/no-work-result.js +31 -31
- package/lib/node.js +4 -4
- package/lib/processor.js +1 -1
- package/lib/result.d.ts +10 -10
- package/lib/result.js +4 -4
- package/lib/tokenize.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -9,31 +9,20 @@ These plugins can lint your CSS, support variables and mixins,
|
|
9
9
|
transpile future CSS syntax, inline images, and more.
|
10
10
|
|
11
11
|
PostCSS is used by industry leaders including Wikipedia, Twitter, Alibaba,
|
12
|
-
and JetBrains. The [Autoprefixer] PostCSS
|
13
|
-
CSS processors.
|
12
|
+
and JetBrains. The [Autoprefixer] and [Stylelint] PostCSS plugins is one of the most popular CSS tools.
|
14
13
|
|
15
|
-
|
16
|
-
(by transforming them into an [Abstract Syntax Tree]).
|
17
|
-
This API can then be used by [plugins] to do a lot of useful things,
|
18
|
-
e.g., to find errors automatically, or to insert vendor prefixes.
|
14
|
+
---
|
19
15
|
|
20
|
-
|
21
|
-
**中文翻译**: [`docs/README-cn.md`](./docs/README-cn.md)
|
16
|
+
<img src="https://cdn.evilmartians.com/badges/logo-no-label.svg" alt="" width="22" height="16" /> Made in <b><a href="https://evilmartians.com/?utm_source=postcss&utm_campaign=devtools-button&utm_medium=github">Evil Martians</a></b>, product consulting for <b>developer tools</b>.
|
22
17
|
|
23
|
-
|
24
|
-
of your company, PostCSS plugins), contact [Evil Martians]
|
25
|
-
at <postcss@evilmartians.com>.
|
18
|
+
---
|
26
19
|
|
27
20
|
[Abstract Syntax Tree]: https://en.wikipedia.org/wiki/Abstract_syntax_tree
|
28
21
|
[Evil Martians]: https://evilmartians.com/?utm_source=postcss
|
29
22
|
[Autoprefixer]: https://github.com/postcss/autoprefixer
|
23
|
+
[Stylelint]: https://stylelint.io/
|
30
24
|
[plugins]: https://github.com/postcss/postcss#plugins
|
31
25
|
|
32
|
-
<a href="https://evilmartians.com/?utm_source=postcss">
|
33
|
-
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg"
|
34
|
-
alt="Sponsored by Evil Martians" width="236" height="54">
|
35
|
-
</a>
|
36
|
-
|
37
26
|
|
38
27
|
## Docs
|
39
28
|
Read full docs **[here](https://postcss.org/)**.
|
package/lib/container.d.ts
CHANGED
@@ -125,15 +125,6 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
125
125
|
every(
|
126
126
|
condition: (node: Child, index: number, nodes: Child[]) => boolean
|
127
127
|
): boolean
|
128
|
-
/**
|
129
|
-
* The container’s first child.
|
130
|
-
*
|
131
|
-
* ```js
|
132
|
-
* rule.first === rules.nodes[0]
|
133
|
-
* ```
|
134
|
-
*/
|
135
|
-
get first(): Child | undefined
|
136
|
-
|
137
128
|
/**
|
138
129
|
* Returns a `child`’s index within the `Container#nodes` array.
|
139
130
|
*
|
@@ -145,6 +136,7 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
145
136
|
* @return Child index.
|
146
137
|
*/
|
147
138
|
index(child: Child | number): number
|
139
|
+
|
148
140
|
/**
|
149
141
|
* Insert new node after old node within the container.
|
150
142
|
*
|
@@ -156,24 +148,6 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
156
148
|
oldNode: Child | number,
|
157
149
|
newNode: Child | Child[] | ChildProps | ChildProps[] | string | string[]
|
158
150
|
): this
|
159
|
-
|
160
|
-
/**
|
161
|
-
* Traverses the container’s descendant nodes, calling callback
|
162
|
-
* for each comment node.
|
163
|
-
*
|
164
|
-
* Like `Container#each`, this method is safe
|
165
|
-
* to use if you are mutating arrays during iteration.
|
166
|
-
*
|
167
|
-
* ```js
|
168
|
-
* root.walkComments(comment => {
|
169
|
-
* comment.remove()
|
170
|
-
* })
|
171
|
-
* ```
|
172
|
-
*
|
173
|
-
* @param callback Iterator receives each node and index.
|
174
|
-
* @return Returns `false` if iteration was broke.
|
175
|
-
*/
|
176
|
-
|
177
151
|
/**
|
178
152
|
* Insert new node before old node within the container.
|
179
153
|
*
|
@@ -189,14 +163,23 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
189
163
|
oldNode: Child | number,
|
190
164
|
newNode: Child | Child[] | ChildProps | ChildProps[] | string | string[]
|
191
165
|
): this
|
166
|
+
|
192
167
|
/**
|
193
|
-
*
|
168
|
+
* Traverses the container’s descendant nodes, calling callback
|
169
|
+
* for each comment node.
|
170
|
+
*
|
171
|
+
* Like `Container#each`, this method is safe
|
172
|
+
* to use if you are mutating arrays during iteration.
|
194
173
|
*
|
195
174
|
* ```js
|
196
|
-
*
|
175
|
+
* root.walkComments(comment => {
|
176
|
+
* comment.remove()
|
177
|
+
* })
|
197
178
|
* ```
|
179
|
+
*
|
180
|
+
* @param callback Iterator receives each node and index.
|
181
|
+
* @return Returns `false` if iteration was broke.
|
198
182
|
*/
|
199
|
-
get last(): Child | undefined
|
200
183
|
|
201
184
|
/**
|
202
185
|
* Inserts new nodes to the start of the container.
|
@@ -221,7 +204,6 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
221
204
|
prepend(
|
222
205
|
...nodes: (ChildProps | ChildProps[] | Node | Node[] | string | string[])[]
|
223
206
|
): this
|
224
|
-
|
225
207
|
/**
|
226
208
|
* Add child to the end of the node.
|
227
209
|
*
|
@@ -334,6 +316,7 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
334
316
|
walk(
|
335
317
|
callback: (node: ChildNode, index: number) => false | void
|
336
318
|
): false | undefined
|
319
|
+
|
337
320
|
/**
|
338
321
|
* Traverses the container’s descendant nodes, calling callback
|
339
322
|
* for each at-rule node.
|
@@ -371,7 +354,6 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
371
354
|
walkAtRules(
|
372
355
|
callback: (atRule: AtRule, index: number) => false | void
|
373
356
|
): false | undefined
|
374
|
-
|
375
357
|
walkComments(
|
376
358
|
callback: (comment: Comment, indexed: number) => false | void
|
377
359
|
): false | undefined
|
@@ -413,9 +395,11 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
413
395
|
propFilter: RegExp | string,
|
414
396
|
callback: (decl: Declaration, index: number) => false | void
|
415
397
|
): false | undefined
|
398
|
+
|
416
399
|
walkDecls(
|
417
400
|
callback: (decl: Declaration, index: number) => false | void
|
418
401
|
): false | undefined
|
402
|
+
|
419
403
|
/**
|
420
404
|
* Traverses the container’s descendant nodes, calling callback
|
421
405
|
* for each rule node.
|
@@ -445,6 +429,22 @@ declare abstract class Container_<Child extends Node = ChildNode> extends Node {
|
|
445
429
|
walkRules(
|
446
430
|
callback: (rule: Rule, index: number) => false | void
|
447
431
|
): false | undefined
|
432
|
+
/**
|
433
|
+
* The container’s first child.
|
434
|
+
*
|
435
|
+
* ```js
|
436
|
+
* rule.first === rules.nodes[0]
|
437
|
+
* ```
|
438
|
+
*/
|
439
|
+
get first(): Child | undefined
|
440
|
+
/**
|
441
|
+
* The container’s last child.
|
442
|
+
*
|
443
|
+
* ```js
|
444
|
+
* rule.last === rule.nodes[rule.nodes.length - 1]
|
445
|
+
* ```
|
446
|
+
*/
|
447
|
+
get last(): Child | undefined
|
448
448
|
}
|
449
449
|
|
450
450
|
declare class Container<Child extends Node = ChildNode> extends Container_<Child> {}
|
package/lib/container.js
CHANGED
@@ -64,11 +64,6 @@ class Container extends Node {
|
|
64
64
|
return this.nodes.every(condition)
|
65
65
|
}
|
66
66
|
|
67
|
-
get first() {
|
68
|
-
if (!this.proxyOf.nodes) return undefined
|
69
|
-
return this.proxyOf.nodes[0]
|
70
|
-
}
|
71
|
-
|
72
67
|
getIterator() {
|
73
68
|
if (!this.lastEach) this.lastEach = 0
|
74
69
|
if (!this.indexes) this.indexes = {}
|
@@ -175,11 +170,6 @@ class Container extends Node {
|
|
175
170
|
return this
|
176
171
|
}
|
177
172
|
|
178
|
-
get last() {
|
179
|
-
if (!this.proxyOf.nodes) return undefined
|
180
|
-
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1]
|
181
|
-
}
|
182
|
-
|
183
173
|
normalize(nodes, sample) {
|
184
174
|
if (typeof nodes === 'string') {
|
185
175
|
nodes = cleanSource(parse(nodes).nodes)
|
@@ -393,6 +383,16 @@ class Container extends Node {
|
|
393
383
|
}
|
394
384
|
})
|
395
385
|
}
|
386
|
+
|
387
|
+
get first() {
|
388
|
+
if (!this.proxyOf.nodes) return undefined
|
389
|
+
return this.proxyOf.nodes[0]
|
390
|
+
}
|
391
|
+
|
392
|
+
get last() {
|
393
|
+
if (!this.proxyOf.nodes) return undefined
|
394
|
+
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1]
|
395
|
+
}
|
396
396
|
}
|
397
397
|
|
398
398
|
Container.registerParse = dependant => {
|
package/lib/input.d.ts
CHANGED
@@ -143,19 +143,6 @@ declare class Input_ {
|
|
143
143
|
opts?: { plugin?: CssSyntaxError['plugin'] }
|
144
144
|
): CssSyntaxError
|
145
145
|
|
146
|
-
/**
|
147
|
-
* The CSS source identifier. Contains `Input#file` if the user
|
148
|
-
* set the `from` option, or `Input#id` if they did not.
|
149
|
-
*
|
150
|
-
* ```js
|
151
|
-
* const root = postcss.parse(css, { from: 'a.css' })
|
152
|
-
* root.source.input.from //=> "/home/ai/a.css"
|
153
|
-
*
|
154
|
-
* const root = postcss.parse(css)
|
155
|
-
* root.source.input.from //=> "<input css 1>"
|
156
|
-
* ```
|
157
|
-
*/
|
158
|
-
get from(): string
|
159
146
|
/**
|
160
147
|
* Converts source offset to line and column.
|
161
148
|
*
|
@@ -187,6 +174,19 @@ declare class Input_ {
|
|
187
174
|
endLine?: number,
|
188
175
|
endColumn?: number
|
189
176
|
): false | Input.FilePosition
|
177
|
+
/**
|
178
|
+
* The CSS source identifier. Contains `Input#file` if the user
|
179
|
+
* set the `from` option, or `Input#id` if they did not.
|
180
|
+
*
|
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
|
+
* ```
|
188
|
+
*/
|
189
|
+
get from(): string
|
190
190
|
}
|
191
191
|
|
192
192
|
declare class Input extends Input_ {}
|
package/lib/input.js
CHANGED
@@ -124,10 +124,6 @@ class Input {
|
|
124
124
|
return result
|
125
125
|
}
|
126
126
|
|
127
|
-
get from() {
|
128
|
-
return this.file || this.id
|
129
|
-
}
|
130
|
-
|
131
127
|
fromOffset(offset) {
|
132
128
|
let lastLine, lineToIndex
|
133
129
|
if (!this[fromOffsetCache]) {
|
@@ -238,6 +234,10 @@ class Input {
|
|
238
234
|
}
|
239
235
|
return json
|
240
236
|
}
|
237
|
+
|
238
|
+
get from() {
|
239
|
+
return this.file || this.id
|
240
|
+
}
|
241
241
|
}
|
242
242
|
|
243
243
|
module.exports = Input
|
package/lib/lazy-result.d.ts
CHANGED
@@ -81,6 +81,32 @@ declare class LazyResult_<RootNode = Document | Root>
|
|
81
81
|
*/
|
82
82
|
async(): Promise<Result<RootNode>>
|
83
83
|
|
84
|
+
/**
|
85
|
+
* Run plugin in sync way and return `Result`.
|
86
|
+
*
|
87
|
+
* @return Result with output content.
|
88
|
+
*/
|
89
|
+
sync(): Result<RootNode>
|
90
|
+
|
91
|
+
/**
|
92
|
+
* Alias for the `LazyResult#css` property.
|
93
|
+
*
|
94
|
+
* ```js
|
95
|
+
* lazy + '' === lazy.css
|
96
|
+
* ```
|
97
|
+
*
|
98
|
+
* @return Output CSS.
|
99
|
+
*/
|
100
|
+
toString(): string
|
101
|
+
|
102
|
+
/**
|
103
|
+
* Processes input CSS through synchronous plugins
|
104
|
+
* and calls `Result#warnings`.
|
105
|
+
*
|
106
|
+
* @return Warnings from plugins.
|
107
|
+
*/
|
108
|
+
warnings(): Warning[]
|
109
|
+
|
84
110
|
/**
|
85
111
|
* An alias for the `css` property. Use it with syntaxes
|
86
112
|
* that generate non-CSS output.
|
@@ -155,32 +181,6 @@ declare class LazyResult_<RootNode = Document | Root>
|
|
155
181
|
* Required to implement the Promise interface.
|
156
182
|
*/
|
157
183
|
get [Symbol.toStringTag](): string
|
158
|
-
|
159
|
-
/**
|
160
|
-
* Run plugin in sync way and return `Result`.
|
161
|
-
*
|
162
|
-
* @return Result with output content.
|
163
|
-
*/
|
164
|
-
sync(): Result<RootNode>
|
165
|
-
|
166
|
-
/**
|
167
|
-
* Alias for the `LazyResult#css` property.
|
168
|
-
*
|
169
|
-
* ```js
|
170
|
-
* lazy + '' === lazy.css
|
171
|
-
* ```
|
172
|
-
*
|
173
|
-
* @return Output CSS.
|
174
|
-
*/
|
175
|
-
toString(): string
|
176
|
-
|
177
|
-
/**
|
178
|
-
* Processes input CSS through synchronous plugins
|
179
|
-
* and calls `Result#warnings`.
|
180
|
-
*
|
181
|
-
* @return Warnings from plugins.
|
182
|
-
*/
|
183
|
-
warnings(): Warning[]
|
184
184
|
}
|
185
185
|
|
186
186
|
declare class LazyResult<
|
package/lib/lazy-result.js
CHANGED
@@ -166,14 +166,6 @@ class LazyResult {
|
|
166
166
|
return this.async().catch(onRejected)
|
167
167
|
}
|
168
168
|
|
169
|
-
get content() {
|
170
|
-
return this.stringify().content
|
171
|
-
}
|
172
|
-
|
173
|
-
get css() {
|
174
|
-
return this.stringify().css
|
175
|
-
}
|
176
|
-
|
177
169
|
finally(onFinally) {
|
178
170
|
return this.async().then(onFinally, onFinally)
|
179
171
|
}
|
@@ -221,18 +213,6 @@ class LazyResult {
|
|
221
213
|
return error
|
222
214
|
}
|
223
215
|
|
224
|
-
get map() {
|
225
|
-
return this.stringify().map
|
226
|
-
}
|
227
|
-
|
228
|
-
get messages() {
|
229
|
-
return this.sync().messages
|
230
|
-
}
|
231
|
-
|
232
|
-
get opts() {
|
233
|
-
return this.result.opts
|
234
|
-
}
|
235
|
-
|
236
216
|
prepareVisitors() {
|
237
217
|
this.listeners = {}
|
238
218
|
let add = (plugin, type, cb) => {
|
@@ -271,14 +251,6 @@ class LazyResult {
|
|
271
251
|
this.hasListener = Object.keys(this.listeners).length > 0
|
272
252
|
}
|
273
253
|
|
274
|
-
get processor() {
|
275
|
-
return this.result.processor
|
276
|
-
}
|
277
|
-
|
278
|
-
get root() {
|
279
|
-
return this.sync().root
|
280
|
-
}
|
281
|
-
|
282
254
|
async runAsync() {
|
283
255
|
this.plugin = 0
|
284
256
|
for (let i = 0; i < this.plugins.length; i++) {
|
@@ -382,10 +354,6 @@ class LazyResult {
|
|
382
354
|
return this.result
|
383
355
|
}
|
384
356
|
|
385
|
-
get [Symbol.toStringTag]() {
|
386
|
-
return 'LazyResult'
|
387
|
-
}
|
388
|
-
|
389
357
|
sync() {
|
390
358
|
if (this.error) throw this.error
|
391
359
|
if (this.processed) return this.result
|
@@ -537,6 +505,38 @@ class LazyResult {
|
|
537
505
|
warnings() {
|
538
506
|
return this.sync().warnings()
|
539
507
|
}
|
508
|
+
|
509
|
+
get content() {
|
510
|
+
return this.stringify().content
|
511
|
+
}
|
512
|
+
|
513
|
+
get css() {
|
514
|
+
return this.stringify().css
|
515
|
+
}
|
516
|
+
|
517
|
+
get map() {
|
518
|
+
return this.stringify().map
|
519
|
+
}
|
520
|
+
|
521
|
+
get messages() {
|
522
|
+
return this.sync().messages
|
523
|
+
}
|
524
|
+
|
525
|
+
get opts() {
|
526
|
+
return this.result.opts
|
527
|
+
}
|
528
|
+
|
529
|
+
get processor() {
|
530
|
+
return this.result.processor
|
531
|
+
}
|
532
|
+
|
533
|
+
get root() {
|
534
|
+
return this.sync().root
|
535
|
+
}
|
536
|
+
|
537
|
+
get [Symbol.toStringTag]() {
|
538
|
+
return 'LazyResult'
|
539
|
+
}
|
540
540
|
}
|
541
541
|
|
542
542
|
LazyResult.registerPostcss = dependant => {
|
package/lib/map-generator.js
CHANGED
@@ -17,6 +17,10 @@ class MapGenerator {
|
|
17
17
|
this.opts = opts
|
18
18
|
this.css = cssString
|
19
19
|
this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute
|
20
|
+
|
21
|
+
this.memoizedFileURLs = new Map()
|
22
|
+
this.memoizedPaths = new Map()
|
23
|
+
this.memoizedURLs = new Map()
|
20
24
|
}
|
21
25
|
|
22
26
|
addAnnotation() {
|
@@ -241,9 +245,11 @@ class MapGenerator {
|
|
241
245
|
}
|
242
246
|
|
243
247
|
path(file) {
|
244
|
-
if (file.indexOf('<') === 0) return file
|
245
|
-
if (/^\w+:\/\//.test(file)) return file
|
246
248
|
if (this.mapOpts.absolute) return file
|
249
|
+
if (file.charCodeAt(0) === 60 /* `<` */) return file
|
250
|
+
if (/^\w+:\/\//.test(file)) return file
|
251
|
+
let cached = this.memoizedPaths.get(file)
|
252
|
+
if (cached) return cached
|
247
253
|
|
248
254
|
let from = this.opts.to ? dirname(this.opts.to) : '.'
|
249
255
|
|
@@ -251,8 +257,10 @@ class MapGenerator {
|
|
251
257
|
from = dirname(resolve(from, this.mapOpts.annotation))
|
252
258
|
}
|
253
259
|
|
254
|
-
|
255
|
-
|
260
|
+
let path = relative(from, file)
|
261
|
+
this.memoizedPaths.set(file, path)
|
262
|
+
|
263
|
+
return path
|
256
264
|
}
|
257
265
|
|
258
266
|
previous() {
|
@@ -318,8 +326,14 @@ class MapGenerator {
|
|
318
326
|
}
|
319
327
|
|
320
328
|
toFileUrl(path) {
|
329
|
+
let cached = this.memoizedFileURLs.get(path)
|
330
|
+
if (cached) return cached
|
331
|
+
|
321
332
|
if (pathToFileURL) {
|
322
|
-
|
333
|
+
let fileURL = pathToFileURL(path).toString()
|
334
|
+
this.memoizedFileURLs.set(path, fileURL)
|
335
|
+
|
336
|
+
return fileURL
|
323
337
|
} else {
|
324
338
|
throw new Error(
|
325
339
|
'`map.absolute` option is not available in this PostCSS build'
|
@@ -328,10 +342,17 @@ class MapGenerator {
|
|
328
342
|
}
|
329
343
|
|
330
344
|
toUrl(path) {
|
345
|
+
let cached = this.memoizedURLs.get(path)
|
346
|
+
if (cached) return cached
|
347
|
+
|
331
348
|
if (sep === '\\') {
|
332
349
|
path = path.replace(/\\/g, '/')
|
333
350
|
}
|
334
|
-
|
351
|
+
|
352
|
+
let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent)
|
353
|
+
this.memoizedURLs.set(path, url)
|
354
|
+
|
355
|
+
return url
|
335
356
|
}
|
336
357
|
}
|
337
358
|
|
package/lib/no-work-result.d.ts
CHANGED
@@ -28,6 +28,9 @@ declare class NoWorkResult_ implements LazyResult<Root> {
|
|
28
28
|
then: Promise<Result<Root>>['then']
|
29
29
|
constructor(processor: Processor, css: string, opts: ResultOptions)
|
30
30
|
async(): Promise<Result<Root>>
|
31
|
+
sync(): Result<Root>
|
32
|
+
toString(): string
|
33
|
+
warnings(): Warning[]
|
31
34
|
get content(): string
|
32
35
|
get css(): string
|
33
36
|
get map(): SourceMap
|
@@ -36,9 +39,6 @@ declare class NoWorkResult_ implements LazyResult<Root> {
|
|
36
39
|
get processor(): Processor
|
37
40
|
get root(): Root
|
38
41
|
get [Symbol.toStringTag](): string
|
39
|
-
sync(): Result<Root>
|
40
|
-
toString(): string
|
41
|
-
warnings(): Warning[]
|
42
42
|
}
|
43
43
|
|
44
44
|
declare class NoWorkResult extends NoWorkResult_ {}
|
package/lib/no-work-result.js
CHANGED
@@ -49,6 +49,37 @@ class NoWorkResult {
|
|
49
49
|
return this.async().catch(onRejected)
|
50
50
|
}
|
51
51
|
|
52
|
+
finally(onFinally) {
|
53
|
+
return this.async().then(onFinally, onFinally)
|
54
|
+
}
|
55
|
+
|
56
|
+
sync() {
|
57
|
+
if (this.error) throw this.error
|
58
|
+
return this.result
|
59
|
+
}
|
60
|
+
|
61
|
+
then(onFulfilled, onRejected) {
|
62
|
+
if (process.env.NODE_ENV !== 'production') {
|
63
|
+
if (!('from' in this._opts)) {
|
64
|
+
warnOnce(
|
65
|
+
'Without `from` option PostCSS could generate wrong source map ' +
|
66
|
+
'and will not find Browserslist config. Set it to CSS file path ' +
|
67
|
+
'or to `undefined` to prevent this warning.'
|
68
|
+
)
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
return this.async().then(onFulfilled, onRejected)
|
73
|
+
}
|
74
|
+
|
75
|
+
toString() {
|
76
|
+
return this._css
|
77
|
+
}
|
78
|
+
|
79
|
+
warnings() {
|
80
|
+
return []
|
81
|
+
}
|
82
|
+
|
52
83
|
get content() {
|
53
84
|
return this.result.css
|
54
85
|
}
|
@@ -57,10 +88,6 @@ class NoWorkResult {
|
|
57
88
|
return this.result.css
|
58
89
|
}
|
59
90
|
|
60
|
-
finally(onFinally) {
|
61
|
-
return this.async().then(onFinally, onFinally)
|
62
|
-
}
|
63
|
-
|
64
91
|
get map() {
|
65
92
|
return this.result.map
|
66
93
|
}
|
@@ -102,33 +129,6 @@ class NoWorkResult {
|
|
102
129
|
get [Symbol.toStringTag]() {
|
103
130
|
return 'NoWorkResult'
|
104
131
|
}
|
105
|
-
|
106
|
-
sync() {
|
107
|
-
if (this.error) throw this.error
|
108
|
-
return this.result
|
109
|
-
}
|
110
|
-
|
111
|
-
then(onFulfilled, onRejected) {
|
112
|
-
if (process.env.NODE_ENV !== 'production') {
|
113
|
-
if (!('from' in this._opts)) {
|
114
|
-
warnOnce(
|
115
|
-
'Without `from` option PostCSS could generate wrong source map ' +
|
116
|
-
'and will not find Browserslist config. Set it to CSS file path ' +
|
117
|
-
'or to `undefined` to prevent this warning.'
|
118
|
-
)
|
119
|
-
}
|
120
|
-
}
|
121
|
-
|
122
|
-
return this.async().then(onFulfilled, onRejected)
|
123
|
-
}
|
124
|
-
|
125
|
-
toString() {
|
126
|
-
return this._css
|
127
|
-
}
|
128
|
-
|
129
|
-
warnings() {
|
130
|
-
return []
|
131
|
-
}
|
132
132
|
}
|
133
133
|
|
134
134
|
module.exports = NoWorkResult
|
package/lib/node.js
CHANGED
@@ -204,10 +204,6 @@ class Node {
|
|
204
204
|
return this.parent.nodes[index - 1]
|
205
205
|
}
|
206
206
|
|
207
|
-
get proxyOf() {
|
208
|
-
return this
|
209
|
-
}
|
210
|
-
|
211
207
|
rangeBy(opts) {
|
212
208
|
let start = {
|
213
209
|
column: this.source.start.column,
|
@@ -375,6 +371,10 @@ class Node {
|
|
375
371
|
for (let i in opts) data[i] = opts[i]
|
376
372
|
return result.warn(text, data)
|
377
373
|
}
|
374
|
+
|
375
|
+
get proxyOf() {
|
376
|
+
return this
|
377
|
+
}
|
378
378
|
}
|
379
379
|
|
380
380
|
module.exports = Node
|
package/lib/processor.js
CHANGED
package/lib/result.d.ts
CHANGED
@@ -150,16 +150,6 @@ declare class Result_<RootNode = Document | Root> {
|
|
150
150
|
*/
|
151
151
|
constructor(processor: Processor, root: RootNode, opts: Result.ResultOptions)
|
152
152
|
|
153
|
-
/**
|
154
|
-
* An alias for the `Result#css` property.
|
155
|
-
* Use it with syntaxes that generate non-CSS output.
|
156
|
-
*
|
157
|
-
* ```js
|
158
|
-
* result.css === result.content
|
159
|
-
* ```
|
160
|
-
*/
|
161
|
-
get content(): string
|
162
|
-
|
163
153
|
/**
|
164
154
|
* Returns for `Result#css` content.
|
165
155
|
*
|
@@ -199,6 +189,16 @@ declare class Result_<RootNode = Document | Root> {
|
|
199
189
|
* @return Warnings from plugins.
|
200
190
|
*/
|
201
191
|
warnings(): Warning[]
|
192
|
+
|
193
|
+
/**
|
194
|
+
* An alias for the `Result#css` property.
|
195
|
+
* Use it with syntaxes that generate non-CSS output.
|
196
|
+
*
|
197
|
+
* ```js
|
198
|
+
* result.css === result.content
|
199
|
+
* ```
|
200
|
+
*/
|
201
|
+
get content(): string
|
202
202
|
}
|
203
203
|
|
204
204
|
declare class Result<RootNode = Document | Root> extends Result_<RootNode> {}
|
package/lib/result.js
CHANGED
@@ -12,10 +12,6 @@ class Result {
|
|
12
12
|
this.map = undefined
|
13
13
|
}
|
14
14
|
|
15
|
-
get content() {
|
16
|
-
return this.css
|
17
|
-
}
|
18
|
-
|
19
15
|
toString() {
|
20
16
|
return this.css
|
21
17
|
}
|
@@ -36,6 +32,10 @@ class Result {
|
|
36
32
|
warnings() {
|
37
33
|
return this.messages.filter(i => i.type === 'warning')
|
38
34
|
}
|
35
|
+
|
36
|
+
get content() {
|
37
|
+
return this.css
|
38
|
+
}
|
39
39
|
}
|
40
40
|
|
41
41
|
module.exports = Result
|
package/lib/tokenize.js
CHANGED
@@ -22,7 +22,7 @@ const AT = '@'.charCodeAt(0)
|
|
22
22
|
|
23
23
|
const RE_AT_END = /[\t\n\f\r "#'()/;[\\\]{}]/g
|
24
24
|
const RE_WORD_END = /[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g
|
25
|
-
const RE_BAD_BRACKET = /.[\n"'(/\\]/
|
25
|
+
const RE_BAD_BRACKET = /.[\r\n"'(/\\]/
|
26
26
|
const RE_HEX_ESCAPE = /[\da-f]/i
|
27
27
|
|
28
28
|
module.exports = function tokenizer(input, options = {}) {
|