postcss 8.0.8 → 8.0.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.

package/CHANGELOG.md CHANGED
@@ -1,8 +1,12 @@
1
1
  # Change Log
2
2
  This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
+ ## 8.0.9
5
+ * Replace prototype in PostCSS 7 nodes instead of recreating them.
6
+ * Added missed `Transformer` to exported types (by Pierre-Marie Dartus).
7
+
4
8
  ## 8.0.8
5
- * Fix `8.0.7` regression on PostCSS 7 nodes converting.
9
+ * Fix `8.0.7` regression on PostCSS 7 nodes converting (by Adam Wathan).
6
10
 
7
11
  ## 8.0.7
8
12
  * Fixed compatibility issue with mixin AST with PostCSS 7 and 8 nodes.
package/lib/container.js CHANGED
@@ -26,29 +26,22 @@ function markDirtyUp (node) {
26
26
  }
27
27
 
28
28
  // istanbul ignore next
29
- function rebuild (node, parent) {
30
- let fix
29
+ function rebuild (node) {
31
30
  if (node.type === 'atrule') {
32
- fix = new AtRule()
31
+ Object.setPrototypeOf(node, AtRule.prototype)
33
32
  } else if (node.type === 'rule') {
34
- fix = new Rule()
33
+ Object.setPrototypeOf(node, Rule.prototype)
35
34
  } else if (node.type === 'decl') {
36
- fix = new Declaration()
35
+ Object.setPrototypeOf(node, Declaration.prototype)
37
36
  } else if (node.type === 'comment') {
38
- fix = new Comment()
37
+ Object.setPrototypeOf(node, Comment.prototype)
39
38
  }
40
39
 
41
- for (let i in node) {
42
- if (i === 'nodes') {
43
- fix.nodes = node.nodes.map(j => rebuild(j, fix))
44
- } else if (i === 'parent' && parent) {
45
- fix.parent = parent
46
- } else if (Object.prototype.hasOwnProperty.call(node, i)) {
47
- fix[i] = node[i]
48
- }
40
+ if (node.nodes) {
41
+ node.nodes.forEach(child => {
42
+ rebuild(child)
43
+ })
49
44
  }
50
-
51
- return fix
52
45
  }
53
46
 
54
47
  class Container extends Node {
@@ -344,7 +337,7 @@ class Container extends Node {
344
337
 
345
338
  let processed = nodes.map(i => {
346
339
  // istanbul ignore next
347
- if (typeof i.markDirty !== 'function') i = rebuild(i)
340
+ if (typeof i.markDirty !== 'function') rebuild(i)
348
341
  if (i.parent) i.parent.removeChild(i)
349
342
  if (i[isClean]) markDirtyUp(i)
350
343
  if (typeof i.raws.before === 'undefined') {
package/lib/postcss.d.ts CHANGED
@@ -94,7 +94,7 @@ export interface PluginCreator<PluginOptions> {
94
94
  postcss: true
95
95
  }
96
96
 
97
- interface Transformer extends TransformCallback {
97
+ export interface Transformer extends TransformCallback {
98
98
  postcssPlugin: string
99
99
  postcssVersion: string
100
100
  }
@@ -2,6 +2,7 @@ import {
2
2
  AcceptedPlugin,
3
3
  Plugin,
4
4
  ProcessOptions,
5
+ Transformer,
5
6
  TransformCallback
6
7
  } from './postcss.js'
7
8
  import LazyResult from './lazy-result.js'
package/lib/processor.js CHANGED
@@ -5,7 +5,7 @@ let Root = require('./root')
5
5
 
6
6
  class Processor {
7
7
  constructor (plugins = []) {
8
- this.version = '8.0.8'
8
+ this.version = '8.0.9'
9
9
  this.plugins = this.normalize(plugins)
10
10
  }
11
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postcss",
3
- "version": "8.0.8",
3
+ "version": "8.0.9",
4
4
  "description": "Tool for transforming styles with JS plugins",
5
5
  "engines": {
6
6
  "node": "^10 || ^12 || >=14"