postcss-reduce-transforms 8.0.2 → 8.0.4
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 -4
- package/src/index.js +8 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss-reduce-transforms",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.4",
|
|
4
4
|
"description": "Reduce transform functions with PostCSS.",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"repository": {
|
|
28
28
|
"type": "git",
|
|
29
|
-
"url": "cssnano/cssnano"
|
|
29
|
+
"url": "git+https://github.com/cssnano/cssnano.git"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"postcss-value-parser": "^4.2.0"
|
|
@@ -38,9 +38,12 @@
|
|
|
38
38
|
"node": "^22.11.0 || ^24.11.0 || >=26.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"postcss": "^8.5.
|
|
41
|
+
"postcss": "^8.5.26"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"postcss": "^8.5.
|
|
44
|
+
"postcss": "^8.5.26"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"test": "node --test"
|
|
45
48
|
}
|
|
46
49
|
}
|
package/src/index.js
CHANGED
|
@@ -11,7 +11,7 @@ const transformRegex = /transform$/i;
|
|
|
11
11
|
function getValues(list, node, index) {
|
|
12
12
|
if (index % 2 === 0) {
|
|
13
13
|
/** @type {number|string} */
|
|
14
|
-
let value = NaN;
|
|
14
|
+
let value = Number.NaN;
|
|
15
15
|
|
|
16
16
|
if (
|
|
17
17
|
node.type === 'function' &&
|
|
@@ -20,7 +20,7 @@ function getValues(list, node, index) {
|
|
|
20
20
|
) {
|
|
21
21
|
value = valueParser.stringify(node.nodes);
|
|
22
22
|
} else if (node.type === 'word') {
|
|
23
|
-
value = parseFloat(node.value);
|
|
23
|
+
value = Number.parseFloat(node.value);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
return [...list, value];
|
|
@@ -259,7 +259,12 @@ function reduce(node) {
|
|
|
259
259
|
const normalizedReducerName = normalizeReducerName(node.value);
|
|
260
260
|
const reducer = reducers.get(normalizedReducerName);
|
|
261
261
|
if (reducer !== undefined) {
|
|
262
|
-
|
|
262
|
+
/** @type {(number|string)[]} */
|
|
263
|
+
let values = [];
|
|
264
|
+
for (const [index, child] of node.nodes.entries()) {
|
|
265
|
+
values = getValues(values, child, index);
|
|
266
|
+
}
|
|
267
|
+
reducer(node, values);
|
|
263
268
|
}
|
|
264
269
|
}
|
|
265
270
|
return false;
|