postcss 8.2.6 → 8.2.10
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.
Potentially problematic release.
This version of postcss might be problematic. Click here for more details.
- package/README.md +5 -2
- package/lib/at-rule.d.ts +4 -4
- package/lib/at-rule.js +3 -3
- package/lib/comment.d.ts +4 -4
- package/lib/comment.js +1 -1
- package/lib/container.d.ts +24 -24
- package/lib/container.js +28 -28
- package/lib/css-syntax-error.d.ts +5 -3
- package/lib/css-syntax-error.js +4 -4
- package/lib/declaration.d.ts +4 -4
- package/lib/declaration.js +2 -2
- package/lib/fromJSON.js +1 -1
- package/lib/input.d.ts +4 -4
- package/lib/input.js +30 -15
- package/lib/lazy-result.d.ts +13 -13
- package/lib/lazy-result.js +29 -29
- package/lib/list.js +3 -3
- package/lib/map-generator.js +27 -20
- package/lib/node.d.ts +18 -18
- package/lib/node.js +27 -27
- package/lib/parse.js +1 -1
- package/lib/parser.js +28 -28
- package/lib/postcss.d.ts +2 -0
- package/lib/postcss.js +4 -4
- package/lib/previous-map.d.ts +3 -3
- package/lib/previous-map.js +13 -15
- package/lib/processor.d.ts +3 -3
- package/lib/processor.js +5 -5
- package/lib/result.d.ts +5 -5
- package/lib/result.js +5 -5
- package/lib/root.d.ts +2 -2
- package/lib/root.js +4 -4
- package/lib/rule.d.ts +4 -4
- package/lib/rule.js +3 -3
- package/lib/stringifier.js +22 -22
- package/lib/stringify.js +1 -1
- package/lib/terminal-highlight.js +3 -3
- package/lib/tokenize.js +6 -6
- package/lib/warn-once.js +1 -1
- package/lib/warning.d.ts +2 -2
- package/lib/warning.js +2 -2
- package/package.json +6 -4
- package/CHANGELOG.md +0 -806
package/README.md
CHANGED
@@ -47,7 +47,10 @@ PostCSS needs your support. We are accepting donations
|
|
47
47
|
|
48
48
|
<a href="https://tailwindcss.com/">
|
49
49
|
<img src="https://refactoringui.nyc3.cdn.digitaloceanspaces.com/tailwind-logo.svg"
|
50
|
-
alt="Sponsored by Tailwind CSS" width="
|
50
|
+
alt="Sponsored by Tailwind CSS" width="213" height="50">
|
51
|
+
</a> <a href="https://themeisle.com/">
|
52
|
+
<img src="https://mllj2j8xvfl0.i.optimole.com/d0cOXWA.3970~373ad/w:auto/h:auto/q:90/https://s30246.pcdn.co/wp-content/uploads/2019/03/logo.png"
|
53
|
+
alt="Sponsored by ThemeIsle" width="171" height="56">
|
51
54
|
</a>
|
52
55
|
|
53
56
|
|
@@ -377,7 +380,7 @@ PostCSS also supports [Deno]:
|
|
377
380
|
|
378
381
|
```js
|
379
382
|
import postcss from 'https://deno.land/x/postcss/mod.js'
|
380
|
-
import autoprefixer from 'https://
|
383
|
+
import autoprefixer from 'https://jspm.dev/autoprefixer'
|
381
384
|
|
382
385
|
const result = await postcss([autoprefixer]).process(css)
|
383
386
|
```
|
package/lib/at-rule.d.ts
CHANGED
@@ -94,8 +94,8 @@ export default class AtRule extends Container {
|
|
94
94
|
*/
|
95
95
|
params: string
|
96
96
|
|
97
|
-
constructor
|
98
|
-
clone
|
99
|
-
cloneBefore
|
100
|
-
cloneAfter
|
97
|
+
constructor(defaults?: AtRuleProps)
|
98
|
+
clone(overrides?: Partial<AtRuleProps>): this
|
99
|
+
cloneBefore(overrides?: Partial<AtRuleProps>): this
|
100
|
+
cloneAfter(overrides?: Partial<AtRuleProps>): this
|
101
101
|
}
|
package/lib/at-rule.js
CHANGED
@@ -3,17 +3,17 @@
|
|
3
3
|
let Container = require('./container')
|
4
4
|
|
5
5
|
class AtRule extends Container {
|
6
|
-
constructor
|
6
|
+
constructor(defaults) {
|
7
7
|
super(defaults)
|
8
8
|
this.type = 'atrule'
|
9
9
|
}
|
10
10
|
|
11
|
-
append
|
11
|
+
append(...children) {
|
12
12
|
if (!this.proxyOf.nodes) this.nodes = []
|
13
13
|
return super.append(...children)
|
14
14
|
}
|
15
15
|
|
16
|
-
prepend
|
16
|
+
prepend(...children) {
|
17
17
|
if (!this.proxyOf.nodes) this.nodes = []
|
18
18
|
return super.prepend(...children)
|
19
19
|
}
|
package/lib/comment.d.ts
CHANGED
@@ -44,8 +44,8 @@ export default class Comment extends Node {
|
|
44
44
|
*/
|
45
45
|
text: string
|
46
46
|
|
47
|
-
constructor
|
48
|
-
clone
|
49
|
-
cloneBefore
|
50
|
-
cloneAfter
|
47
|
+
constructor(defaults?: CommentProps)
|
48
|
+
clone(overrides?: Partial<CommentProps>): this
|
49
|
+
cloneBefore(overrides?: Partial<CommentProps>): this
|
50
|
+
cloneAfter(overrides?: Partial<CommentProps>): this
|
51
51
|
}
|
package/lib/comment.js
CHANGED
package/lib/container.d.ts
CHANGED
@@ -47,7 +47,7 @@ export default abstract class Container extends Node {
|
|
47
47
|
* rule.first === rules.nodes[0]
|
48
48
|
* ```
|
49
49
|
*/
|
50
|
-
get first
|
50
|
+
get first(): ChildNode | undefined
|
51
51
|
|
52
52
|
/**
|
53
53
|
* The container’s last child.
|
@@ -56,7 +56,7 @@ export default abstract class Container extends Node {
|
|
56
56
|
* rule.last === rule.nodes[rule.nodes.length - 1]
|
57
57
|
* ```
|
58
58
|
*/
|
59
|
-
get last
|
59
|
+
get last(): ChildNode | undefined
|
60
60
|
|
61
61
|
/**
|
62
62
|
* Iterates through the container’s immediate children,
|
@@ -91,7 +91,7 @@ export default abstract class Container extends Node {
|
|
91
91
|
* @param callback Iterator receives each node and index.
|
92
92
|
* @return Returns `false` if iteration was broke.
|
93
93
|
*/
|
94
|
-
each
|
94
|
+
each(
|
95
95
|
callback: (node: ChildNode, index: number) => false | void
|
96
96
|
): false | undefined
|
97
97
|
|
@@ -114,7 +114,7 @@ export default abstract class Container extends Node {
|
|
114
114
|
* @param callback Iterator receives each node and index.
|
115
115
|
* @return Returns `false` if iteration was broke.
|
116
116
|
*/
|
117
|
-
walk
|
117
|
+
walk(
|
118
118
|
callback: (node: ChildNode, index: number) => false | void
|
119
119
|
): false | undefined
|
120
120
|
|
@@ -147,11 +147,11 @@ export default abstract class Container extends Node {
|
|
147
147
|
* @param callback Iterator receives each node and index.
|
148
148
|
* @return Returns `false` if iteration was broke.
|
149
149
|
*/
|
150
|
-
walkDecls
|
150
|
+
walkDecls(
|
151
151
|
propFilter: string | RegExp,
|
152
152
|
callback: (decl: Declaration, index: number) => false | void
|
153
153
|
): false | undefined
|
154
|
-
walkDecls
|
154
|
+
walkDecls(
|
155
155
|
callback: (decl: Declaration, index: number) => false | void
|
156
156
|
): false | undefined
|
157
157
|
|
@@ -177,11 +177,11 @@ export default abstract class Container extends Node {
|
|
177
177
|
* @param callback Iterator receives each node and index.
|
178
178
|
* @return Returns `false` if iteration was broke.
|
179
179
|
*/
|
180
|
-
walkRules
|
180
|
+
walkRules(
|
181
181
|
selectorFilter: string | RegExp,
|
182
182
|
callback: (atRule: Rule, index: number) => false | void
|
183
183
|
): false | undefined
|
184
|
-
walkRules
|
184
|
+
walkRules(
|
185
185
|
callback: (atRule: Rule, index: number) => false | void
|
186
186
|
): false | undefined
|
187
187
|
|
@@ -214,11 +214,11 @@ export default abstract class Container extends Node {
|
|
214
214
|
* @param callback Iterator receives each node and index.
|
215
215
|
* @return Returns `false` if iteration was broke.
|
216
216
|
*/
|
217
|
-
walkAtRules
|
217
|
+
walkAtRules(
|
218
218
|
nameFilter: string | RegExp,
|
219
219
|
callback: (atRule: AtRule, index: number) => false | void
|
220
220
|
): false | undefined
|
221
|
-
walkAtRules
|
221
|
+
walkAtRules(
|
222
222
|
callback: (atRule: AtRule, index: number) => false | void
|
223
223
|
): false | undefined
|
224
224
|
|
@@ -239,10 +239,10 @@ export default abstract class Container extends Node {
|
|
239
239
|
* @return Returns `false` if iteration was broke.
|
240
240
|
*/
|
241
241
|
|
242
|
-
walkComments
|
242
|
+
walkComments(
|
243
243
|
callback: (comment: Comment, indexed: number) => false | void
|
244
244
|
): false | undefined
|
245
|
-
walkComments
|
245
|
+
walkComments(
|
246
246
|
callback: (comment: Comment, indexed: number) => false | void
|
247
247
|
): false | undefined
|
248
248
|
|
@@ -266,7 +266,7 @@ export default abstract class Container extends Node {
|
|
266
266
|
* @param nodes New nodes.
|
267
267
|
* @return This node for methods chain.
|
268
268
|
*/
|
269
|
-
append
|
269
|
+
append(
|
270
270
|
...nodes: (Node | Node[] | ChildProps | ChildProps[] | string | string[])[]
|
271
271
|
): this
|
272
272
|
|
@@ -290,7 +290,7 @@ export default abstract class Container extends Node {
|
|
290
290
|
* @param nodes New nodes.
|
291
291
|
* @return This node for methods chain.
|
292
292
|
*/
|
293
|
-
prepend
|
293
|
+
prepend(
|
294
294
|
...nodes: (Node | Node[] | ChildProps | ChildProps[] | string | string[])[]
|
295
295
|
): this
|
296
296
|
|
@@ -304,7 +304,7 @@ export default abstract class Container extends Node {
|
|
304
304
|
* @param child New node.
|
305
305
|
* @return This node for methods chain.
|
306
306
|
*/
|
307
|
-
push
|
307
|
+
push(child: ChildNode): this
|
308
308
|
|
309
309
|
/**
|
310
310
|
* Insert new node before old node within the container.
|
@@ -317,7 +317,7 @@ export default abstract class Container extends Node {
|
|
317
317
|
* @param newNode New node.
|
318
318
|
* @return This node for methods chain.
|
319
319
|
*/
|
320
|
-
insertBefore
|
320
|
+
insertBefore(
|
321
321
|
oldNode: ChildNode | number,
|
322
322
|
newNode:
|
323
323
|
| ChildNode
|
@@ -335,7 +335,7 @@ export default abstract class Container extends Node {
|
|
335
335
|
* @param newNode New node.
|
336
336
|
* @return This node for methods chain.
|
337
337
|
*/
|
338
|
-
insertAfter
|
338
|
+
insertAfter(
|
339
339
|
oldNode: ChildNode | number,
|
340
340
|
newNode:
|
341
341
|
| ChildNode
|
@@ -360,7 +360,7 @@ export default abstract class Container extends Node {
|
|
360
360
|
* @param child Child or child’s index.
|
361
361
|
* @return This node for methods chain.
|
362
362
|
*/
|
363
|
-
removeChild
|
363
|
+
removeChild(child: ChildNode | number): this
|
364
364
|
|
365
365
|
/**
|
366
366
|
* Removes all children from the container
|
@@ -373,7 +373,7 @@ export default abstract class Container extends Node {
|
|
373
373
|
*
|
374
374
|
* @return This node for methods chain.
|
375
375
|
*/
|
376
|
-
removeAll
|
376
|
+
removeAll(): this
|
377
377
|
|
378
378
|
/**
|
379
379
|
* Passes all declaration values within the container that match pattern
|
@@ -398,12 +398,12 @@ export default abstract class Container extends Node {
|
|
398
398
|
* of `String#replace`.
|
399
399
|
* @return This node for methods chain.
|
400
400
|
*/
|
401
|
-
replaceValues
|
401
|
+
replaceValues(
|
402
402
|
pattern: string | RegExp,
|
403
403
|
options: ValueOptions,
|
404
404
|
replaced: string | { (substring: string, ...args: any[]): string }
|
405
405
|
): this
|
406
|
-
replaceValues
|
406
|
+
replaceValues(
|
407
407
|
pattern: string | RegExp,
|
408
408
|
replaced: string | { (substring: string, ...args: any[]): string }
|
409
409
|
): this
|
@@ -419,7 +419,7 @@ export default abstract class Container extends Node {
|
|
419
419
|
* @param condition Iterator returns true or false.
|
420
420
|
* @return Is every child pass condition.
|
421
421
|
*/
|
422
|
-
every
|
422
|
+
every(
|
423
423
|
condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean
|
424
424
|
): boolean
|
425
425
|
|
@@ -434,7 +434,7 @@ export default abstract class Container extends Node {
|
|
434
434
|
* @param condition Iterator returns true or false.
|
435
435
|
* @return Is some child pass condition.
|
436
436
|
*/
|
437
|
-
some
|
437
|
+
some(
|
438
438
|
condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean
|
439
439
|
): boolean
|
440
440
|
|
@@ -448,5 +448,5 @@ export default abstract class Container extends Node {
|
|
448
448
|
* @param child Child of the current container.
|
449
449
|
* @return Child index.
|
450
450
|
*/
|
451
|
-
index
|
451
|
+
index(child: ChildNode | number): number
|
452
452
|
}
|
package/lib/container.js
CHANGED
@@ -7,7 +7,7 @@ let Node = require('./node')
|
|
7
7
|
|
8
8
|
let parse, Rule, AtRule
|
9
9
|
|
10
|
-
function cleanSource
|
10
|
+
function cleanSource(nodes) {
|
11
11
|
return nodes.map(i => {
|
12
12
|
if (i.nodes) i.nodes = cleanSource(i.nodes)
|
13
13
|
delete i.source
|
@@ -15,7 +15,7 @@ function cleanSource (nodes) {
|
|
15
15
|
})
|
16
16
|
}
|
17
17
|
|
18
|
-
function markDirtyUp
|
18
|
+
function markDirtyUp(node) {
|
19
19
|
node[isClean] = false
|
20
20
|
if (node.proxyOf.nodes) {
|
21
21
|
for (let i of node.proxyOf.nodes) {
|
@@ -25,7 +25,7 @@ function markDirtyUp (node) {
|
|
25
25
|
}
|
26
26
|
|
27
27
|
// istanbul ignore next
|
28
|
-
function rebuild
|
28
|
+
function rebuild(node) {
|
29
29
|
if (node.type === 'atrule') {
|
30
30
|
Object.setPrototypeOf(node, AtRule.prototype)
|
31
31
|
} else if (node.type === 'rule') {
|
@@ -44,13 +44,13 @@ function rebuild (node) {
|
|
44
44
|
}
|
45
45
|
|
46
46
|
class Container extends Node {
|
47
|
-
push
|
47
|
+
push(child) {
|
48
48
|
child.parent = this
|
49
49
|
this.proxyOf.nodes.push(child)
|
50
50
|
return this
|
51
51
|
}
|
52
52
|
|
53
|
-
each
|
53
|
+
each(callback) {
|
54
54
|
if (!this.proxyOf.nodes) return undefined
|
55
55
|
let iterator = this.getIterator()
|
56
56
|
|
@@ -67,7 +67,7 @@ class Container extends Node {
|
|
67
67
|
return result
|
68
68
|
}
|
69
69
|
|
70
|
-
walk
|
70
|
+
walk(callback) {
|
71
71
|
return this.each((child, i) => {
|
72
72
|
let result
|
73
73
|
try {
|
@@ -83,7 +83,7 @@ class Container extends Node {
|
|
83
83
|
})
|
84
84
|
}
|
85
85
|
|
86
|
-
walkDecls
|
86
|
+
walkDecls(prop, callback) {
|
87
87
|
if (!callback) {
|
88
88
|
callback = prop
|
89
89
|
return this.walk((child, i) => {
|
@@ -106,7 +106,7 @@ class Container extends Node {
|
|
106
106
|
})
|
107
107
|
}
|
108
108
|
|
109
|
-
walkRules
|
109
|
+
walkRules(selector, callback) {
|
110
110
|
if (!callback) {
|
111
111
|
callback = selector
|
112
112
|
|
@@ -130,7 +130,7 @@ class Container extends Node {
|
|
130
130
|
})
|
131
131
|
}
|
132
132
|
|
133
|
-
walkAtRules
|
133
|
+
walkAtRules(name, callback) {
|
134
134
|
if (!callback) {
|
135
135
|
callback = name
|
136
136
|
return this.walk((child, i) => {
|
@@ -153,7 +153,7 @@ class Container extends Node {
|
|
153
153
|
})
|
154
154
|
}
|
155
155
|
|
156
|
-
walkComments
|
156
|
+
walkComments(callback) {
|
157
157
|
return this.walk((child, i) => {
|
158
158
|
if (child.type === 'comment') {
|
159
159
|
return callback(child, i)
|
@@ -161,7 +161,7 @@ class Container extends Node {
|
|
161
161
|
})
|
162
162
|
}
|
163
163
|
|
164
|
-
append
|
164
|
+
append(...children) {
|
165
165
|
for (let child of children) {
|
166
166
|
let nodes = this.normalize(child, this.last)
|
167
167
|
for (let node of nodes) this.proxyOf.nodes.push(node)
|
@@ -172,7 +172,7 @@ class Container extends Node {
|
|
172
172
|
return this
|
173
173
|
}
|
174
174
|
|
175
|
-
prepend
|
175
|
+
prepend(...children) {
|
176
176
|
children = children.reverse()
|
177
177
|
for (let child of children) {
|
178
178
|
let nodes = this.normalize(child, this.first, 'prepend').reverse()
|
@@ -187,14 +187,14 @@ class Container extends Node {
|
|
187
187
|
return this
|
188
188
|
}
|
189
189
|
|
190
|
-
cleanRaws
|
190
|
+
cleanRaws(keepBetween) {
|
191
191
|
super.cleanRaws(keepBetween)
|
192
192
|
if (this.nodes) {
|
193
193
|
for (let node of this.nodes) node.cleanRaws(keepBetween)
|
194
194
|
}
|
195
195
|
}
|
196
196
|
|
197
|
-
insertBefore
|
197
|
+
insertBefore(exist, add) {
|
198
198
|
exist = this.index(exist)
|
199
199
|
|
200
200
|
let type = exist === 0 ? 'prepend' : false
|
@@ -214,7 +214,7 @@ class Container extends Node {
|
|
214
214
|
return this
|
215
215
|
}
|
216
216
|
|
217
|
-
insertAfter
|
217
|
+
insertAfter(exist, add) {
|
218
218
|
exist = this.index(exist)
|
219
219
|
|
220
220
|
let nodes = this.normalize(add, this.proxyOf.nodes[exist]).reverse()
|
@@ -233,7 +233,7 @@ class Container extends Node {
|
|
233
233
|
return this
|
234
234
|
}
|
235
235
|
|
236
|
-
removeChild
|
236
|
+
removeChild(child) {
|
237
237
|
child = this.index(child)
|
238
238
|
this.proxyOf.nodes[child].parent = undefined
|
239
239
|
this.proxyOf.nodes.splice(child, 1)
|
@@ -251,7 +251,7 @@ class Container extends Node {
|
|
251
251
|
return this
|
252
252
|
}
|
253
253
|
|
254
|
-
removeAll
|
254
|
+
removeAll() {
|
255
255
|
for (let node of this.proxyOf.nodes) node.parent = undefined
|
256
256
|
this.proxyOf.nodes = []
|
257
257
|
|
@@ -260,7 +260,7 @@ class Container extends Node {
|
|
260
260
|
return this
|
261
261
|
}
|
262
262
|
|
263
|
-
replaceValues
|
263
|
+
replaceValues(pattern, opts, callback) {
|
264
264
|
if (!callback) {
|
265
265
|
callback = opts
|
266
266
|
opts = {}
|
@@ -278,31 +278,31 @@ class Container extends Node {
|
|
278
278
|
return this
|
279
279
|
}
|
280
280
|
|
281
|
-
every
|
281
|
+
every(condition) {
|
282
282
|
return this.nodes.every(condition)
|
283
283
|
}
|
284
284
|
|
285
|
-
some
|
285
|
+
some(condition) {
|
286
286
|
return this.nodes.some(condition)
|
287
287
|
}
|
288
288
|
|
289
|
-
index
|
289
|
+
index(child) {
|
290
290
|
if (typeof child === 'number') return child
|
291
291
|
if (child.proxyOf) child = child.proxyOf
|
292
292
|
return this.proxyOf.nodes.indexOf(child)
|
293
293
|
}
|
294
294
|
|
295
|
-
get first
|
295
|
+
get first() {
|
296
296
|
if (!this.proxyOf.nodes) return undefined
|
297
297
|
return this.proxyOf.nodes[0]
|
298
298
|
}
|
299
299
|
|
300
|
-
get last
|
300
|
+
get last() {
|
301
301
|
if (!this.proxyOf.nodes) return undefined
|
302
302
|
return this.proxyOf.nodes[this.proxyOf.nodes.length - 1]
|
303
303
|
}
|
304
304
|
|
305
|
-
normalize
|
305
|
+
normalize(nodes, sample) {
|
306
306
|
if (typeof nodes === 'string') {
|
307
307
|
nodes = cleanSource(parse(nodes).nodes)
|
308
308
|
} else if (Array.isArray(nodes)) {
|
@@ -352,9 +352,9 @@ class Container extends Node {
|
|
352
352
|
return processed
|
353
353
|
}
|
354
354
|
|
355
|
-
getProxyProcessor
|
355
|
+
getProxyProcessor() {
|
356
356
|
return {
|
357
|
-
set
|
357
|
+
set(node, prop, value) {
|
358
358
|
if (node[prop] === value) return true
|
359
359
|
node[prop] = value
|
360
360
|
if (prop === 'name' || prop === 'params' || prop === 'selector') {
|
@@ -363,7 +363,7 @@ class Container extends Node {
|
|
363
363
|
return true
|
364
364
|
},
|
365
365
|
|
366
|
-
get
|
366
|
+
get(node, prop) {
|
367
367
|
if (prop === 'proxyOf') {
|
368
368
|
return node
|
369
369
|
} else if (!node[prop]) {
|
@@ -402,7 +402,7 @@ class Container extends Node {
|
|
402
402
|
}
|
403
403
|
}
|
404
404
|
|
405
|
-
getIterator
|
405
|
+
getIterator() {
|
406
406
|
if (!this.lastEach) this.lastEach = 0
|
407
407
|
if (!this.indexes) this.indexes = {}
|
408
408
|
|
@@ -38,7 +38,7 @@ export default class CssSyntaxError {
|
|
38
38
|
* @param file Absolute path to the broken file.
|
39
39
|
* @param plugin PostCSS plugin name, if error came from plugin.
|
40
40
|
*/
|
41
|
-
constructor
|
41
|
+
constructor(
|
42
42
|
message: string,
|
43
43
|
line?: number,
|
44
44
|
column?: number,
|
@@ -47,6 +47,8 @@ export default class CssSyntaxError {
|
|
47
47
|
plugin?: string
|
48
48
|
)
|
49
49
|
|
50
|
+
stack: string
|
51
|
+
|
50
52
|
/**
|
51
53
|
* Always equal to `'CssSyntaxError'`. You should always check error type
|
52
54
|
* by `error.name === 'CssSyntaxError'`
|
@@ -163,7 +165,7 @@ export default class CssSyntaxError {
|
|
163
165
|
*
|
164
166
|
* @return Error position, message and source code.
|
165
167
|
*/
|
166
|
-
toString
|
168
|
+
toString(): string
|
167
169
|
|
168
170
|
/**
|
169
171
|
* Returns a few lines of CSS source that caused the error.
|
@@ -186,5 +188,5 @@ export default class CssSyntaxError {
|
|
186
188
|
* and `process.env.NODE_DISABLE_COLORS`.
|
187
189
|
* @return Few lines of CSS source that caused the error.
|
188
190
|
*/
|
189
|
-
showSourceCode
|
191
|
+
showSourceCode(color?: boolean): string
|
190
192
|
}
|
package/lib/css-syntax-error.js
CHANGED
@@ -5,7 +5,7 @@ let { red, bold, gray, options: colorette } = require('colorette')
|
|
5
5
|
let terminalHighlight = require('./terminal-highlight')
|
6
6
|
|
7
7
|
class CssSyntaxError extends Error {
|
8
|
-
constructor
|
8
|
+
constructor(message, line, column, source, file, plugin) {
|
9
9
|
super(message)
|
10
10
|
this.name = 'CssSyntaxError'
|
11
11
|
this.reason = message
|
@@ -31,7 +31,7 @@ class CssSyntaxError extends Error {
|
|
31
31
|
}
|
32
32
|
}
|
33
33
|
|
34
|
-
setMessage
|
34
|
+
setMessage() {
|
35
35
|
this.message = this.plugin ? this.plugin + ': ' : ''
|
36
36
|
this.message += this.file ? this.file : '<css input>'
|
37
37
|
if (typeof this.line !== 'undefined') {
|
@@ -40,7 +40,7 @@ class CssSyntaxError extends Error {
|
|
40
40
|
this.message += ': ' + this.reason
|
41
41
|
}
|
42
42
|
|
43
|
-
showSourceCode
|
43
|
+
showSourceCode(color) {
|
44
44
|
if (!this.source) return ''
|
45
45
|
|
46
46
|
let css = this.source
|
@@ -79,7 +79,7 @@ class CssSyntaxError extends Error {
|
|
79
79
|
.join('\n')
|
80
80
|
}
|
81
81
|
|
82
|
-
toString
|
82
|
+
toString() {
|
83
83
|
let code = this.showSourceCode()
|
84
84
|
if (code) {
|
85
85
|
code = '\n\n' + code + '\n'
|
package/lib/declaration.d.ts
CHANGED
@@ -109,8 +109,8 @@ export default class Declaration extends Node {
|
|
109
109
|
*/
|
110
110
|
variable: boolean
|
111
111
|
|
112
|
-
constructor
|
113
|
-
clone
|
114
|
-
cloneBefore
|
115
|
-
cloneAfter
|
112
|
+
constructor(defaults?: DeclarationProps)
|
113
|
+
clone(overrides?: Partial<DeclarationProps>): this
|
114
|
+
cloneBefore(overrides?: Partial<DeclarationProps>): this
|
115
|
+
cloneAfter(overrides?: Partial<DeclarationProps>): this
|
116
116
|
}
|
package/lib/declaration.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
let Node = require('./node')
|
4
4
|
|
5
5
|
class Declaration extends Node {
|
6
|
-
constructor
|
6
|
+
constructor(defaults) {
|
7
7
|
if (
|
8
8
|
defaults &&
|
9
9
|
typeof defaults.value !== 'undefined' &&
|
@@ -15,7 +15,7 @@ class Declaration extends Node {
|
|
15
15
|
this.type = 'decl'
|
16
16
|
}
|
17
17
|
|
18
|
-
get variable
|
18
|
+
get variable() {
|
19
19
|
return this.prop.startsWith('--') || this.prop[0] === '$'
|
20
20
|
}
|
21
21
|
}
|
package/lib/fromJSON.js
CHANGED
@@ -8,7 +8,7 @@ let Input = require('./input')
|
|
8
8
|
let Root = require('./root')
|
9
9
|
let Rule = require('./rule')
|
10
10
|
|
11
|
-
function fromJSON
|
11
|
+
function fromJSON(json, inputs) {
|
12
12
|
if (Array.isArray(json)) return json.map(n => fromJSON(n))
|
13
13
|
|
14
14
|
let { inputs: ownInputs, ...defaults } = json
|
package/lib/input.d.ts
CHANGED
@@ -89,7 +89,7 @@ export default class Input {
|
|
89
89
|
* @param css Input CSS source.
|
90
90
|
* @param opts Process options.
|
91
91
|
*/
|
92
|
-
constructor
|
92
|
+
constructor(css: string, opts?: ProcessOptions)
|
93
93
|
|
94
94
|
/**
|
95
95
|
* The CSS source identifier. Contains `Input#file` if the user
|
@@ -103,7 +103,7 @@ export default class Input {
|
|
103
103
|
* root.source.input.from //=> "<input css 1>"
|
104
104
|
* ```
|
105
105
|
*/
|
106
|
-
get from
|
106
|
+
get from(): string
|
107
107
|
|
108
108
|
/**
|
109
109
|
* Reads the input source map and returns a symbol position
|
@@ -119,12 +119,12 @@ export default class Input {
|
|
119
119
|
*
|
120
120
|
* @return Position in input source.
|
121
121
|
*/
|
122
|
-
origin
|
122
|
+
origin(line: number, column: number): FilePosition | false
|
123
123
|
|
124
124
|
/**
|
125
125
|
* Converts source offset to line and column.
|
126
126
|
*
|
127
127
|
* @param offset Source offset.
|
128
128
|
*/
|
129
|
-
fromOffset
|
129
|
+
fromOffset(offset: number): { line: number; col: number } | null
|
130
130
|
}
|