postcss 8.2.8 → 8.2.9

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.

@@ -64,24 +64,24 @@ export default class LazyResult implements PromiseLike<Result> {
64
64
  * @param css CSS to parse and transform.
65
65
  * @param opts Options from the `Processor#process` or `Root#toResult`.
66
66
  */
67
- constructor (processor: Processor, css: string, opts: ResultOptions)
67
+ constructor(processor: Processor, css: string, opts: ResultOptions)
68
68
 
69
69
  /**
70
70
  * Returns the default string description of an object.
71
71
  * Required to implement the Promise interface.
72
72
  */
73
- get [Symbol.toStringTag] (): string
73
+ get [Symbol.toStringTag](): string
74
74
 
75
75
  /**
76
76
  * Returns a `Processor` instance, which will be used
77
77
  * for CSS transformations.
78
78
  */
79
- get processor (): Processor
79
+ get processor(): Processor
80
80
 
81
81
  /**
82
82
  * Options from the `Processor#process` call.
83
83
  */
84
- get opts (): ResultOptions
84
+ get opts(): ResultOptions
85
85
 
86
86
  /**
87
87
  * Processes input CSS through synchronous plugins, converts `Root`
@@ -92,7 +92,7 @@ export default class LazyResult implements PromiseLike<Result> {
92
92
  * it will throw an error. This is why this method is only
93
93
  * for debug purpose, you should always use `LazyResult#then`.
94
94
  */
95
- get css (): string
95
+ get css(): string
96
96
 
97
97
  /**
98
98
  * An alias for the `css` property. Use it with syntaxes
@@ -103,7 +103,7 @@ export default class LazyResult implements PromiseLike<Result> {
103
103
  * it will throw an error. This is why this method is only
104
104
  * for debug purpose, you should always use `LazyResult#then`.
105
105
  */
106
- get content (): string
106
+ get content(): string
107
107
 
108
108
  /**
109
109
  * Processes input CSS through synchronous plugins
@@ -114,7 +114,7 @@ export default class LazyResult implements PromiseLike<Result> {
114
114
  * it will throw an error. This is why this method is only
115
115
  * for debug purpose, you should always use `LazyResult#then`.
116
116
  */
117
- get map (): SourceMap
117
+ get map(): SourceMap
118
118
 
119
119
  /**
120
120
  * Processes input CSS through synchronous plugins
@@ -126,7 +126,7 @@ export default class LazyResult implements PromiseLike<Result> {
126
126
  * This is why this method is only for debug purpose,
127
127
  * you should always use `LazyResult#then`.
128
128
  */
129
- get root (): Root
129
+ get root(): Root
130
130
 
131
131
  /**
132
132
  * Processes input CSS through synchronous plugins
@@ -138,7 +138,7 @@ export default class LazyResult implements PromiseLike<Result> {
138
138
  * This is why this method is only for debug purpose,
139
139
  * you should always use `LazyResult#then`.
140
140
  */
141
- get messages (): Message[]
141
+ get messages(): Message[]
142
142
 
143
143
  /**
144
144
  * Processes input CSS through synchronous plugins
@@ -146,7 +146,7 @@ export default class LazyResult implements PromiseLike<Result> {
146
146
  *
147
147
  * @return Warnings from plugins.
148
148
  */
149
- warnings (): Warning[]
149
+ warnings(): Warning[]
150
150
 
151
151
  /**
152
152
  * Alias for the `LazyResult#css` property.
@@ -157,19 +157,19 @@ export default class LazyResult implements PromiseLike<Result> {
157
157
  *
158
158
  * @return Output CSS.
159
159
  */
160
- toString (): string
160
+ toString(): string
161
161
 
162
162
  /**
163
163
  * Run plugin in sync way and return `Result`.
164
164
  *
165
165
  * @return Result with output content.
166
166
  */
167
- sync (): Result
167
+ sync(): Result
168
168
 
169
169
  /**
170
170
  * Run plugin in async way and return `Result`.
171
171
  *
172
172
  * @return Result with output content.
173
173
  */
174
- async (): Promise<Result>
174
+ async(): Promise<Result>
175
175
  }
@@ -41,11 +41,11 @@ const NOT_VISITORS = {
41
41
 
42
42
  const CHILDREN = 0
43
43
 
44
- function isPromise (obj) {
44
+ function isPromise(obj) {
45
45
  return typeof obj === 'object' && typeof obj.then === 'function'
46
46
  }
47
47
 
48
- function getEvents (node) {
48
+ function getEvents(node) {
49
49
  let key = false
50
50
  let type = TYPE_TO_CLASS_NAME[node.type]
51
51
  if (node.type === 'decl') {
@@ -71,7 +71,7 @@ function getEvents (node) {
71
71
  }
72
72
  }
73
73
 
74
- function toStack (node) {
74
+ function toStack(node) {
75
75
  let events
76
76
  if (node.type === 'root') {
77
77
  events = ['Root', CHILDREN, 'RootExit']
@@ -89,7 +89,7 @@ function toStack (node) {
89
89
  }
90
90
  }
91
91
 
92
- function cleanMarks (node) {
92
+ function cleanMarks(node) {
93
93
  node[isClean] = false
94
94
  if (node.nodes) node.nodes.forEach(i => cleanMarks(i))
95
95
  return node
@@ -98,7 +98,7 @@ function cleanMarks (node) {
98
98
  let postcss = {}
99
99
 
100
100
  class LazyResult {
101
- constructor (processor, css, opts) {
101
+ constructor(processor, css, opts) {
102
102
  this.stringified = false
103
103
  this.processed = false
104
104
 
@@ -137,47 +137,47 @@ class LazyResult {
137
137
  })
138
138
  }
139
139
 
140
- get [Symbol.toStringTag] () {
140
+ get [Symbol.toStringTag]() {
141
141
  return 'LazyResult'
142
142
  }
143
143
 
144
- get processor () {
144
+ get processor() {
145
145
  return this.result.processor
146
146
  }
147
147
 
148
- get opts () {
148
+ get opts() {
149
149
  return this.result.opts
150
150
  }
151
151
 
152
- get css () {
152
+ get css() {
153
153
  return this.stringify().css
154
154
  }
155
155
 
156
- get content () {
156
+ get content() {
157
157
  return this.stringify().content
158
158
  }
159
159
 
160
- get map () {
160
+ get map() {
161
161
  return this.stringify().map
162
162
  }
163
163
 
164
- get root () {
164
+ get root() {
165
165
  return this.sync().root
166
166
  }
167
167
 
168
- get messages () {
168
+ get messages() {
169
169
  return this.sync().messages
170
170
  }
171
171
 
172
- warnings () {
172
+ warnings() {
173
173
  return this.sync().warnings()
174
174
  }
175
175
 
176
- toString () {
176
+ toString() {
177
177
  return this.css
178
178
  }
179
179
 
180
- then (onFulfilled, onRejected) {
180
+ then(onFulfilled, onRejected) {
181
181
  if (process.env.NODE_ENV !== 'production') {
182
182
  if (!('from' in this.opts)) {
183
183
  warnOnce(
@@ -190,15 +190,15 @@ class LazyResult {
190
190
  return this.async().then(onFulfilled, onRejected)
191
191
  }
192
192
 
193
- catch (onRejected) {
193
+ catch(onRejected) {
194
194
  return this.async().catch(onRejected)
195
195
  }
196
196
 
197
- finally (onFinally) {
197
+ finally(onFinally) {
198
198
  return this.async().then(onFinally, onFinally)
199
199
  }
200
200
 
201
- async () {
201
+ async() {
202
202
  if (this.error) return Promise.reject(this.error)
203
203
  if (this.processed) return Promise.resolve(this.result)
204
204
  if (!this.processing) {
@@ -207,7 +207,7 @@ class LazyResult {
207
207
  return this.processing
208
208
  }
209
209
 
210
- sync () {
210
+ sync() {
211
211
  if (this.error) throw this.error
212
212
  if (this.processed) return this.result
213
213
  this.processed = true
@@ -238,7 +238,7 @@ class LazyResult {
238
238
  return this.result
239
239
  }
240
240
 
241
- stringify () {
241
+ stringify() {
242
242
  if (this.error) throw this.error
243
243
  if (this.stringified) return this.result
244
244
  this.stringified = true
@@ -259,7 +259,7 @@ class LazyResult {
259
259
  return this.result
260
260
  }
261
261
 
262
- walkSync (node) {
262
+ walkSync(node) {
263
263
  node[isClean] = true
264
264
  let events = getEvents(node)
265
265
  for (let event of events) {
@@ -278,7 +278,7 @@ class LazyResult {
278
278
  }
279
279
  }
280
280
 
281
- visitSync (visitors, node) {
281
+ visitSync(visitors, node) {
282
282
  for (let [plugin, visitor] of visitors) {
283
283
  this.result.lastPlugin = plugin
284
284
  let promise
@@ -294,7 +294,7 @@ class LazyResult {
294
294
  }
295
295
  }
296
296
 
297
- runOnRoot (plugin) {
297
+ runOnRoot(plugin) {
298
298
  this.result.lastPlugin = plugin
299
299
  try {
300
300
  if (typeof plugin === 'object' && plugin.Once) {
@@ -307,11 +307,11 @@ class LazyResult {
307
307
  }
308
308
  }
309
309
 
310
- getAsyncError () {
310
+ getAsyncError() {
311
311
  throw new Error('Use process(css).then(cb) to work with async plugins')
312
312
  }
313
313
 
314
- handleError (error, node) {
314
+ handleError(error, node) {
315
315
  let plugin = this.result.lastPlugin
316
316
  try {
317
317
  if (node) node.addToError(error)
@@ -348,7 +348,7 @@ class LazyResult {
348
348
  return error
349
349
  }
350
350
 
351
- async runAsync () {
351
+ async runAsync() {
352
352
  this.plugin = 0
353
353
  for (let i = 0; i < this.plugins.length; i++) {
354
354
  let plugin = this.plugins[i]
@@ -397,7 +397,7 @@ class LazyResult {
397
397
  return this.stringify()
398
398
  }
399
399
 
400
- prepareVisitors () {
400
+ prepareVisitors() {
401
401
  this.listeners = {}
402
402
  let add = (plugin, type, cb) => {
403
403
  if (!this.listeners[type]) this.listeners[type] = []
@@ -435,7 +435,7 @@ class LazyResult {
435
435
  this.hasListener = Object.keys(this.listeners).length > 0
436
436
  }
437
437
 
438
- visitTick (stack) {
438
+ visitTick(stack) {
439
439
  let visit = stack[stack.length - 1]
440
440
  let { node, visitors } = visit
441
441
 
package/lib/list.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  let list = {
4
- split (string, separators, last) {
4
+ split(string, separators, last) {
5
5
  let array = []
6
6
  let current = ''
7
7
  let split = false
@@ -42,12 +42,12 @@ let list = {
42
42
  return array
43
43
  },
44
44
 
45
- space (string) {
45
+ space(string) {
46
46
  let spaces = [' ', '\n', '\t']
47
47
  return list.split(string, spaces)
48
48
  },
49
49
 
50
- comma (string) {
50
+ comma(string) {
51
51
  return list.split(string, [','], true)
52
52
  }
53
53
  }
@@ -7,21 +7,21 @@ let mozilla = require('source-map')
7
7
  let pathAvailable = Boolean(dirname, resolve, relative, sep)
8
8
 
9
9
  class MapGenerator {
10
- constructor (stringify, root, opts) {
10
+ constructor(stringify, root, opts) {
11
11
  this.stringify = stringify
12
12
  this.mapOpts = opts.map || {}
13
13
  this.root = root
14
14
  this.opts = opts
15
15
  }
16
16
 
17
- isMap () {
17
+ isMap() {
18
18
  if (typeof this.opts.map !== 'undefined') {
19
19
  return !!this.opts.map
20
20
  }
21
21
  return this.previous().length > 0
22
22
  }
23
23
 
24
- previous () {
24
+ previous() {
25
25
  if (!this.previousMaps) {
26
26
  this.previousMaps = []
27
27
  this.root.walk(node => {
@@ -37,7 +37,7 @@ class MapGenerator {
37
37
  return this.previousMaps
38
38
  }
39
39
 
40
- isInline () {
40
+ isInline() {
41
41
  if (typeof this.mapOpts.inline !== 'undefined') {
42
42
  return this.mapOpts.inline
43
43
  }
@@ -53,7 +53,7 @@ class MapGenerator {
53
53
  return true
54
54
  }
55
55
 
56
- isSourcesContent () {
56
+ isSourcesContent() {
57
57
  if (typeof this.mapOpts.sourcesContent !== 'undefined') {
58
58
  return this.mapOpts.sourcesContent
59
59
  }
@@ -63,7 +63,7 @@ class MapGenerator {
63
63
  return true
64
64
  }
65
65
 
66
- clearAnnotation () {
66
+ clearAnnotation() {
67
67
  if (this.mapOpts.annotation === false) return
68
68
 
69
69
  let node
@@ -76,7 +76,7 @@ class MapGenerator {
76
76
  }
77
77
  }
78
78
 
79
- setSourcesContent () {
79
+ setSourcesContent() {
80
80
  let already = {}
81
81
  this.root.walk(node => {
82
82
  if (node.source) {
@@ -92,7 +92,7 @@ class MapGenerator {
92
92
  })
93
93
  }
94
94
 
95
- applyPrevMaps () {
95
+ applyPrevMaps() {
96
96
  for (let prev of this.previous()) {
97
97
  let from = this.toUrl(this.path(prev.file))
98
98
  let root = prev.root || dirname(prev.file)
@@ -111,7 +111,7 @@ class MapGenerator {
111
111
  }
112
112
  }
113
113
 
114
- isAnnotation () {
114
+ isAnnotation() {
115
115
  if (this.isInline()) {
116
116
  return true
117
117
  }
@@ -124,7 +124,7 @@ class MapGenerator {
124
124
  return true
125
125
  }
126
126
 
127
- toBase64 (str) {
127
+ toBase64(str) {
128
128
  if (Buffer) {
129
129
  return Buffer.from(str).toString('base64')
130
130
  } else {
@@ -133,7 +133,7 @@ class MapGenerator {
133
133
  }
134
134
  }
135
135
 
136
- addAnnotation () {
136
+ addAnnotation() {
137
137
  let content
138
138
 
139
139
  if (this.isInline()) {
@@ -153,7 +153,7 @@ class MapGenerator {
153
153
  this.css += eol + '/*# sourceMappingURL=' + content + ' */'
154
154
  }
155
155
 
156
- outputFile () {
156
+ outputFile() {
157
157
  if (this.opts.to) {
158
158
  return this.path(this.opts.to)
159
159
  }
@@ -163,7 +163,7 @@ class MapGenerator {
163
163
  return 'to.css'
164
164
  }
165
165
 
166
- generateMap () {
166
+ generateMap() {
167
167
  this.generateString()
168
168
  if (this.isSourcesContent()) this.setSourcesContent()
169
169
  if (this.previous().length > 0) this.applyPrevMaps()
@@ -175,7 +175,7 @@ class MapGenerator {
175
175
  return [this.css, this.map]
176
176
  }
177
177
 
178
- path (file) {
178
+ path(file) {
179
179
  if (file.indexOf('<') === 0) return file
180
180
  if (/^\w+:\/\//.test(file)) return file
181
181
  if (this.mapOpts.absolute) return file
@@ -190,7 +190,7 @@ class MapGenerator {
190
190
  return file
191
191
  }
192
192
 
193
- toUrl (path) {
193
+ toUrl(path) {
194
194
  if (sep === '\\') {
195
195
  // istanbul ignore next
196
196
  path = path.replace(/\\/g, '/')
@@ -198,7 +198,7 @@ class MapGenerator {
198
198
  return encodeURI(path).replace(/[#?]/g, encodeURIComponent)
199
199
  }
200
200
 
201
- sourcePath (node) {
201
+ sourcePath(node) {
202
202
  if (this.mapOpts.from) {
203
203
  return this.toUrl(this.mapOpts.from)
204
204
  } else if (this.mapOpts.absolute) {
@@ -208,7 +208,7 @@ class MapGenerator {
208
208
  }
209
209
  }
210
210
 
211
- generateString () {
211
+ generateString() {
212
212
  this.css = ''
213
213
  this.map = new mozilla.SourceMapGenerator({ file: this.outputFile() })
214
214
 
@@ -274,7 +274,7 @@ class MapGenerator {
274
274
  })
275
275
  }
276
276
 
277
- generate () {
277
+ generate() {
278
278
  this.clearAnnotation()
279
279
 
280
280
  if (pathAvailable && this.isMap()) {
package/lib/node.d.ts CHANGED
@@ -175,7 +175,7 @@ export default abstract class Node {
175
175
  /**
176
176
  * @param defaults Value for node properties.
177
177
  */
178
- constructor (defaults?: object)
178
+ constructor(defaults?: object)
179
179
 
180
180
  /**
181
181
  * Returns a `CssSyntaxError` instance containing the original position
@@ -204,7 +204,7 @@ export default abstract class Node {
204
204
  *
205
205
  * @return Error object to throw it.
206
206
  */
207
- error (message: string, options?: NodeErrorOptions): CssSyntaxError
207
+ error(message: string, options?: NodeErrorOptions): CssSyntaxError
208
208
 
209
209
  /**
210
210
  * This method is provided as a convenience wrapper for `Result#warn`.
@@ -223,7 +223,7 @@ export default abstract class Node {
223
223
  *
224
224
  * @return Created warning object.
225
225
  */
226
- warn (result: Result, text: string, opts?: WarningOptions): void
226
+ warn(result: Result, text: string, opts?: WarningOptions): void
227
227
 
228
228
  /**
229
229
  * Removes the node from its parent and cleans the parent properties
@@ -237,7 +237,7 @@ export default abstract class Node {
237
237
  *
238
238
  * @return Node to make calls chain.
239
239
  */
240
- remove (): this
240
+ remove(): this
241
241
 
242
242
  /**
243
243
  * Returns a CSS string representing the node.
@@ -249,7 +249,7 @@ export default abstract class Node {
249
249
  * @param stringifier A syntax to use in string generation.
250
250
  * @return CSS string of this node.
251
251
  */
252
- toString (stringifier?: Stringifier | Syntax): string
252
+ toString(stringifier?: Stringifier | Syntax): string
253
253
 
254
254
  /**
255
255
  * Returns an exact clone of the node.
@@ -267,7 +267,7 @@ export default abstract class Node {
267
267
  * @param overrides New properties to override in the clone.
268
268
  * @return Clone of the node.
269
269
  */
270
- clone (overrides?: object): this
270
+ clone(overrides?: object): this
271
271
 
272
272
  /**
273
273
  * Shortcut to clone the node and insert the resulting cloned node
@@ -281,7 +281,7 @@ export default abstract class Node {
281
281
  *
282
282
  * @return New node
283
283
  */
284
- cloneBefore (overrides?: object): this
284
+ cloneBefore(overrides?: object): this
285
285
 
286
286
  /**
287
287
  * Shortcut to clone the node and insert the resulting cloned node
@@ -290,7 +290,7 @@ export default abstract class Node {
290
290
  * @param overrides New properties to override in the clone.
291
291
  * @return New node.
292
292
  */
293
- cloneAfter (overrides?: object): this
293
+ cloneAfter(overrides?: object): this
294
294
 
295
295
  /**
296
296
  * Inserts node(s) before the current node and removes the current node.
@@ -306,7 +306,7 @@ export default abstract class Node {
306
306
  * @param nodes Mode(s) to replace current one.
307
307
  * @return Current node to methods chain.
308
308
  */
309
- replaceWith (
309
+ replaceWith(
310
310
  ...nodes: (ChildNode | ChildProps | ChildNode[] | ChildProps[])[]
311
311
  ): this
312
312
 
@@ -325,7 +325,7 @@ export default abstract class Node {
325
325
  *
326
326
  * @return Next node.
327
327
  */
328
- next (): ChildNode | undefined
328
+ next(): ChildNode | undefined
329
329
 
330
330
  /**
331
331
  * Returns the previous child of the node’s parent.
@@ -340,7 +340,7 @@ export default abstract class Node {
340
340
  *
341
341
  * @return Previous node.
342
342
  */
343
- prev (): ChildNode | undefined
343
+ prev(): ChildNode | undefined
344
344
 
345
345
  /**
346
346
  * Insert new node before current node to current node’s parent.
@@ -354,7 +354,7 @@ export default abstract class Node {
354
354
  * @param newNode New node.
355
355
  * @return This node for methods chain.
356
356
  */
357
- before (newNode: Node | ChildProps | string | Node[]): this
357
+ before(newNode: Node | ChildProps | string | Node[]): this
358
358
 
359
359
  /**
360
360
  * Insert new node after current node to current node’s parent.
@@ -368,7 +368,7 @@ export default abstract class Node {
368
368
  * @param newNode New node.
369
369
  * @return This node for methods chain.
370
370
  */
371
- after (newNode: Node | ChildProps | string | Node[]): this
371
+ after(newNode: Node | ChildProps | string | Node[]): this
372
372
 
373
373
  /**
374
374
  * Finds the Root instance of the node’s tree.
@@ -379,7 +379,7 @@ export default abstract class Node {
379
379
  *
380
380
  * @return Root parent.
381
381
  */
382
- root (): Root
382
+ root(): Root
383
383
 
384
384
  /**
385
385
  * Returns a `Node#raws` value. If the node is missing
@@ -399,7 +399,7 @@ export default abstract class Node {
399
399
  * if the value is the same as prop.
400
400
  * @return {string} Code style value.
401
401
  */
402
- raw (prop: string, defaultType?: string): string
402
+ raw(prop: string, defaultType?: string): string
403
403
 
404
404
  /**
405
405
  * Clear the code style properties for the node and its children.
@@ -412,14 +412,14 @@ export default abstract class Node {
412
412
  *
413
413
  * @param keepBetween Keep the `raws.between` symbols.
414
414
  */
415
- cleanRaws (keepBetween?: boolean): void
415
+ cleanRaws(keepBetween?: boolean): void
416
416
 
417
417
  /**
418
418
  * Fix circular links on `JSON.stringify()`.
419
419
  *
420
420
  * @return Cleaned object.
421
421
  */
422
- toJSON (): object
422
+ toJSON(): object
423
423
 
424
424
  /**
425
425
  * Convert string index to line/column.
@@ -427,5 +427,5 @@ export default abstract class Node {
427
427
  * @param index The symbol number in the node’s string.
428
428
  * @return Symbol position in file.
429
429
  */
430
- positionInside (index: number): Position
430
+ positionInside(index: number): Position
431
431
  }