postcss 8.4.12 → 8.4.15

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/lib/container.js CHANGED
@@ -5,7 +5,7 @@ let Declaration = require('./declaration')
5
5
  let Comment = require('./comment')
6
6
  let Node = require('./node')
7
7
 
8
- let parse, Rule, AtRule
8
+ let parse, Rule, AtRule, Root
9
9
 
10
10
  function cleanSource(nodes) {
11
11
  return nodes.map(i => {
@@ -326,7 +326,7 @@ class Container extends Node {
326
326
  i.raws.before = sample.raws.before.replace(/\S/g, '')
327
327
  }
328
328
  }
329
- i.parent = this
329
+ i.parent = this.proxyOf
330
330
  return i
331
331
  })
332
332
 
@@ -407,6 +407,10 @@ Container.registerAtRule = dependant => {
407
407
  AtRule = dependant
408
408
  }
409
409
 
410
+ Container.registerRoot = dependant => {
411
+ Rule = dependant
412
+ }
413
+
410
414
  module.exports = Container
411
415
  Container.default = Container
412
416
 
@@ -420,6 +424,8 @@ Container.rebuild = node => {
420
424
  Object.setPrototypeOf(node, Declaration.prototype)
421
425
  } else if (node.type === 'comment') {
422
426
  Object.setPrototypeOf(node, Comment.prototype)
427
+ } else if (node.type === 'root') {
428
+ Object.setPrototypeOf(node, Root.prototype)
423
429
  }
424
430
 
425
431
  node[my] = true
package/lib/list.js CHANGED
@@ -7,7 +7,8 @@ let list = {
7
7
  let split = false
8
8
 
9
9
  let func = 0
10
- let quote = false
10
+ let inQuote = false
11
+ let prevQuote = ''
11
12
  let escape = false
12
13
 
13
14
  for (let letter of string) {
@@ -15,12 +16,13 @@ let list = {
15
16
  escape = false
16
17
  } else if (letter === '\\') {
17
18
  escape = true
18
- } else if (quote) {
19
- if (letter === quote) {
20
- quote = false
19
+ } else if (inQuote) {
20
+ if (letter === prevQuote) {
21
+ inQuote = false
21
22
  }
22
23
  } else if (letter === '"' || letter === "'") {
23
- quote = letter
24
+ inQuote = true
25
+ prevQuote = letter
24
26
  } else if (letter === '(') {
25
27
  func += 1
26
28
  } else if (letter === ')') {
package/lib/postcss.js CHANGED
@@ -27,25 +27,27 @@ function postcss(...plugins) {
27
27
  }
28
28
 
29
29
  postcss.plugin = function plugin(name, initializer) {
30
- // eslint-disable-next-line no-console
31
- if (console && console.warn) {
30
+ let warningPrinted = false
31
+ function creator(...args) {
32
32
  // eslint-disable-next-line no-console
33
- console.warn(
34
- name +
35
- ': postcss.plugin was deprecated. Migration guide:\n' +
36
- 'https://evilmartians.com/chronicles/postcss-8-plugin-migration'
37
- )
38
- if (process.env.LANG && process.env.LANG.startsWith('cn')) {
39
- /* c8 ignore next 7 */
33
+ if (console && console.warn && !warningPrinted) {
34
+ warningPrinted = true
40
35
  // eslint-disable-next-line no-console
41
36
  console.warn(
42
37
  name +
43
- ': 里面 postcss.plugin 被弃用. 迁移指南:\n' +
44
- 'https://www.w3ctech.com/topic/2226'
38
+ ': postcss.plugin was deprecated. Migration guide:\n' +
39
+ 'https://evilmartians.com/chronicles/postcss-8-plugin-migration'
45
40
  )
41
+ if (process.env.LANG && process.env.LANG.startsWith('cn')) {
42
+ /* c8 ignore next 7 */
43
+ // eslint-disable-next-line no-console
44
+ console.warn(
45
+ name +
46
+ ': 里面 postcss.plugin 被弃用. 迁移指南:\n' +
47
+ 'https://www.w3ctech.com/topic/2226'
48
+ )
49
+ }
46
50
  }
47
- }
48
- function creator(...args) {
49
51
  let transformer = initializer(...args)
50
52
  transformer.postcssPlugin = name
51
53
  transformer.postcssVersion = new Processor().version
@@ -72,7 +72,7 @@ export default class Processor {
72
72
  * ```
73
73
  *
74
74
  * @param plugin PostCSS plugin or `Processor` with plugins.
75
- * @return {Processes} Current processor to make methods chain.
75
+ * @return Current processor to make methods chain.
76
76
  */
77
77
  use(plugin: AcceptedPlugin): this
78
78
 
package/lib/processor.js CHANGED
@@ -7,7 +7,7 @@ let Root = require('./root')
7
7
 
8
8
  class Processor {
9
9
  constructor(plugins = []) {
10
- this.version = '8.4.12'
10
+ this.version = '8.4.15'
11
11
  this.plugins = this.normalize(plugins)
12
12
  }
13
13
 
package/lib/root.js CHANGED
@@ -57,3 +57,5 @@ Root.registerProcessor = dependant => {
57
57
 
58
58
  module.exports = Root
59
59
  Root.default = Root
60
+
61
+ Container.registerRoot(Root)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postcss",
3
- "version": "8.4.12",
3
+ "version": "8.4.15",
4
4
  "description": "Tool for transforming styles with JS plugins",
5
5
  "engines": {
6
6
  "node": "^10 || ^12 || >=14"
@@ -71,7 +71,7 @@
71
71
  "url": "https://github.com/postcss/postcss/issues"
72
72
  },
73
73
  "dependencies": {
74
- "nanoid": "^3.3.1",
74
+ "nanoid": "^3.3.4",
75
75
  "picocolors": "^1.0.0",
76
76
  "source-map-js": "^1.0.2"
77
77
  },