postcss-merge-rules 6.0.0 → 6.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "postcss-merge-rules",
3
- "version": "6.0.0",
3
+ "version": "6.0.2",
4
4
  "description": "Merge CSS rules with PostCSS.",
5
5
  "types": "types/index.d.ts",
6
6
  "main": "src/index.js",
@@ -27,7 +27,7 @@
27
27
  "browserslist": "^4.21.4",
28
28
  "caniuse-api": "^3.0.0",
29
29
  "postcss-selector-parser": "^6.0.5",
30
- "cssnano-utils": "^4.0.0"
30
+ "cssnano-utils": "^4.0.1"
31
31
  },
32
32
  "bugs": {
33
33
  "url": "https://github.com/cssnano/cssnano/issues"
@@ -37,11 +37,11 @@
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/caniuse-api": "^3.0.2",
40
- "postcss": "^8.2.15",
40
+ "postcss": "^8.4.32",
41
41
  "postcss-simple-vars": "^7.0.1",
42
- "postcss-discard-comments": "^6.0.0"
42
+ "postcss-discard-comments": "^6.0.1"
43
43
  },
44
44
  "peerDependencies": {
45
- "postcss": "^8.2.15"
45
+ "postcss": "^8.4.31"
46
46
  }
47
47
  }
package/src/index.js CHANGED
@@ -84,9 +84,19 @@ function canMerge(ruleA, ruleB, browsers, compatibilityCache) {
84
84
  ) {
85
85
  return false;
86
86
  }
87
+ if (ruleA.some(isRuleOrAtRule) || ruleB.some(isRuleOrAtRule)) {
88
+ return false;
89
+ }
87
90
  return parent && (selectors.every(noVendor) || sameVendor(a, b));
88
91
  }
89
92
 
93
+ /**
94
+ * @param {import('postcss').ChildNode} node
95
+ * @return {boolean}
96
+ */
97
+ function isRuleOrAtRule(node) {
98
+ return node.type === 'rule' || node.type === 'atrule';
99
+ }
90
100
  /**
91
101
  * @param {import('postcss').ChildNode} node
92
102
  * @return {node is import('postcss').Declaration}
package/types/index.d.ts CHANGED
@@ -5,5 +5,5 @@ export = pluginCreator;
5
5
  */
6
6
  declare function pluginCreator(): import('postcss').Plugin;
7
7
  declare namespace pluginCreator {
8
- const postcss: true;
8
+ let postcss: true;
9
9
  }