postcss-merge-idents 8.0.3 → 9.0.0
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 +7 -10
- package/src/index.js +12 -17
- package/types/index.d.ts +9 -2
- package/types/index.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss-merge-idents",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"description": "Merge keyframe and counter style identifiers.",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./types/index.d.ts",
|
|
8
8
|
"default": "./src/index.js"
|
|
9
|
-
}
|
|
10
|
-
"./src": "./src/index.js",
|
|
11
|
-
"./src/index": "./src/index.js",
|
|
12
|
-
"./src/index.js": "./src/index.js",
|
|
13
|
-
"./package.json": "./package.json"
|
|
9
|
+
}
|
|
14
10
|
},
|
|
15
11
|
"files": [
|
|
16
12
|
"src",
|
|
@@ -32,17 +28,17 @@
|
|
|
32
28
|
},
|
|
33
29
|
"repository": {
|
|
34
30
|
"type": "git",
|
|
35
|
-
"url": "cssnano/cssnano"
|
|
31
|
+
"url": "git+https://github.com/cssnano/cssnano.git"
|
|
36
32
|
},
|
|
37
33
|
"dependencies": {
|
|
38
|
-
"
|
|
39
|
-
"
|
|
34
|
+
"cssnano-utils": "^7.0.0",
|
|
35
|
+
"postcss-value-parser": "^4.2.0"
|
|
40
36
|
},
|
|
41
37
|
"bugs": {
|
|
42
38
|
"url": "https://github.com/cssnano/cssnano/issues"
|
|
43
39
|
},
|
|
44
40
|
"engines": {
|
|
45
|
-
"node": "^22.
|
|
41
|
+
"node": "^22.22.3 || ^24.15.0 || >=26.0"
|
|
46
42
|
},
|
|
47
43
|
"devDependencies": {
|
|
48
44
|
"postcss": "^8.5.26"
|
|
@@ -50,6 +46,7 @@
|
|
|
50
46
|
"peerDependencies": {
|
|
51
47
|
"postcss": "^8.5.26"
|
|
52
48
|
},
|
|
49
|
+
"type": "module",
|
|
53
50
|
"scripts": {
|
|
54
51
|
"test": "node --test"
|
|
55
52
|
}
|
package/src/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const { sameParent } = require('cssnano-utils');
|
|
1
|
+
import valueParser from 'postcss-value-parser';
|
|
2
|
+
import cssnanoUtils from 'cssnano-utils';
|
|
4
3
|
|
|
4
|
+
const { sameParent } = cssnanoUtils;
|
|
5
5
|
const keyframesRegex = /keyframes/i;
|
|
6
6
|
const animationRegex = /animation/i;
|
|
7
7
|
const counterStyleRegex = /counter-style/i;
|
|
@@ -59,15 +59,15 @@ function mergeAtRules(css) {
|
|
|
59
59
|
];
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
* @type {{atrule: RegExp, decl: RegExp, replacements: Record<string, string>, removals: import('postcss').AtRule[], cache: import('postcss').AtRule[], decls: import('postcss').Declaration[]}}
|
|
62
|
+
* @type {{atrule: RegExp, decl: RegExp, replacements: Record<string, string>, removals: import('postcss').AtRule[], cache: import('postcss').AtRule[], decls: import('postcss').Declaration[]} | undefined}
|
|
63
63
|
*/
|
|
64
64
|
let relevant;
|
|
65
65
|
|
|
66
66
|
css.walk((node) => {
|
|
67
67
|
if (node.type === 'atrule') {
|
|
68
|
-
relevant = pairs.
|
|
68
|
+
relevant = pairs.find((pair) =>
|
|
69
69
|
pair.atrule.test(node.name.toLowerCase())
|
|
70
|
-
)
|
|
70
|
+
);
|
|
71
71
|
|
|
72
72
|
if (!relevant) {
|
|
73
73
|
return;
|
|
@@ -85,10 +85,7 @@ function mergeAtRules(css) {
|
|
|
85
85
|
: '';
|
|
86
86
|
if (
|
|
87
87
|
cached.name.toLowerCase() === node.name.toLowerCase() &&
|
|
88
|
-
sameParent(
|
|
89
|
-
/** @type {any} */ (cached),
|
|
90
|
-
/** @type {any} */ (node)
|
|
91
|
-
) &&
|
|
88
|
+
sameParent(cached, node) &&
|
|
92
89
|
cachedStringContent === toString
|
|
93
90
|
) {
|
|
94
91
|
relevant.removals.push(cached);
|
|
@@ -103,9 +100,7 @@ function mergeAtRules(css) {
|
|
|
103
100
|
}
|
|
104
101
|
|
|
105
102
|
if (node.type === 'decl') {
|
|
106
|
-
relevant = pairs.
|
|
107
|
-
pair.decl.test(node.prop.toLowerCase())
|
|
108
|
-
)[0];
|
|
103
|
+
relevant = pairs.find((pair) => pair.decl.test(node.prop.toLowerCase()));
|
|
109
104
|
|
|
110
105
|
if (!relevant) {
|
|
111
106
|
return;
|
|
@@ -147,8 +142,8 @@ function pluginCreator() {
|
|
|
147
142
|
},
|
|
148
143
|
};
|
|
149
144
|
}
|
|
150
|
-
|
|
145
|
+
/** @type {true} */
|
|
151
146
|
pluginCreator.postcss = true;
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
147
|
+
const moduleExports = pluginCreator;
|
|
148
|
+
|
|
149
|
+
export { moduleExports as default, moduleExports as 'module.exports' };
|
package/types/index.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @return {import('postcss').Plugin}
|
|
3
|
+
*/
|
|
4
|
+
declare function pluginCreator(): import('postcss').Plugin;
|
|
5
|
+
declare namespace pluginCreator {
|
|
6
|
+
var postcss: true;
|
|
7
|
+
}
|
|
8
|
+
declare const moduleExports: typeof pluginCreator;
|
|
9
|
+
export { moduleExports as default, moduleExports as 'module.exports' };
|
|
3
10
|
//# sourceMappingURL=index.d.ts.map
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AAkIA;;GAEG;AACH,iBAAS,aAAa,IAFV,OAAO,SAAS,EAAE,MAAM,CAYnC;kBAVQ,aAAa;iBAWX,IAAI;;AAEf,QAAA,MAAM,aAAa,sBAAgB,CAAC;AAEpC,OAAO,EAAE,aAAa,IAAI,OAAO,EAAE,aAAa,IAAI,gBAAgB,EAAE,CAAC"}
|