postcss-merge-rules 5.1.4 → 6.0.1
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 +5 -4
- package/src/index.js +11 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss-merge-rules",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "Merge CSS rules with PostCSS.",
|
|
5
5
|
"types": "types/index.d.ts",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -27,18 +27,19 @@
|
|
|
27
27
|
"browserslist": "^4.21.4",
|
|
28
28
|
"caniuse-api": "^3.0.0",
|
|
29
29
|
"postcss-selector-parser": "^6.0.5",
|
|
30
|
-
"cssnano-utils": "^
|
|
30
|
+
"cssnano-utils": "^4.0.0"
|
|
31
31
|
},
|
|
32
32
|
"bugs": {
|
|
33
33
|
"url": "https://github.com/cssnano/cssnano/issues"
|
|
34
34
|
},
|
|
35
35
|
"engines": {
|
|
36
|
-
"node": "^
|
|
36
|
+
"node": "^14 || ^16 || >=18.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/caniuse-api": "^3.0.2",
|
|
40
40
|
"postcss": "^8.2.15",
|
|
41
|
-
"postcss-
|
|
41
|
+
"postcss-simple-vars": "^7.0.1",
|
|
42
|
+
"postcss-discard-comments": "^6.0.0"
|
|
42
43
|
},
|
|
43
44
|
"peerDependencies": {
|
|
44
45
|
"postcss": "^8.2.15"
|
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}
|
|
@@ -307,7 +317,7 @@ function partialMerge(first, second) {
|
|
|
307
317
|
|
|
308
318
|
/**
|
|
309
319
|
* @param {function(import('postcss').Declaration):void} callback
|
|
310
|
-
* @this
|
|
320
|
+
* @this void
|
|
311
321
|
* @return {function(import('postcss').Declaration)}
|
|
312
322
|
*/
|
|
313
323
|
function moveDecl(callback) {
|