postcss-normalize-timing-functions 8.0.0 → 8.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/LICENSE-MIT +1 -1
- package/README.md +1 -1
- package/package.json +18 -7
- package/src/index.js +18 -16
- package/types/index.d.ts +2 -9
- package/types/index.d.ts.map +1 -1
package/LICENSE-MIT
CHANGED
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss-normalize-timing-functions",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.2",
|
|
4
4
|
"description": "Normalize CSS animation/transition timing functions.",
|
|
5
|
-
"
|
|
6
|
-
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"types": "./types/index.d.ts",
|
|
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"
|
|
14
|
+
},
|
|
7
15
|
"files": [
|
|
8
16
|
"LICENSE-MIT",
|
|
9
17
|
"src",
|
|
@@ -16,9 +24,12 @@
|
|
|
16
24
|
"author": {
|
|
17
25
|
"name": "Ben Briggs",
|
|
18
26
|
"email": "beneb.info@gmail.com",
|
|
19
|
-
"url": "
|
|
27
|
+
"url": "https://beneb.info"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "cssnano/cssnano"
|
|
20
32
|
},
|
|
21
|
-
"repository": "cssnano/cssnano",
|
|
22
33
|
"bugs": {
|
|
23
34
|
"url": "https://github.com/cssnano/cssnano/issues"
|
|
24
35
|
},
|
|
@@ -27,9 +38,9 @@
|
|
|
27
38
|
"node": "^22.11.0 || ^24.11.0 || >=26.0"
|
|
28
39
|
},
|
|
29
40
|
"devDependencies": {
|
|
30
|
-
"postcss": "^8.5.
|
|
41
|
+
"postcss": "^8.5.25"
|
|
31
42
|
},
|
|
32
43
|
"peerDependencies": {
|
|
33
|
-
"postcss": "^8.5.
|
|
44
|
+
"postcss": "^8.5.25"
|
|
34
45
|
}
|
|
35
46
|
}
|
package/src/index.js
CHANGED
|
@@ -3,6 +3,8 @@ const valueParser = require('postcss-value-parser');
|
|
|
3
3
|
|
|
4
4
|
/** @type {(node: valueParser.Node) => number} */
|
|
5
5
|
const getValue = (node) => parseFloat(node.value);
|
|
6
|
+
const animationTransitionRegex =
|
|
7
|
+
/^(-\w+-)?(animation|transition)(-timing-function)?$/i;
|
|
6
8
|
|
|
7
9
|
/* Works because toString() normalizes the formatting,
|
|
8
10
|
so comparing the string forms behaves the same as number equality*/
|
|
@@ -111,36 +113,36 @@ function transform(value) {
|
|
|
111
113
|
}
|
|
112
114
|
|
|
113
115
|
/**
|
|
114
|
-
* @type {import('postcss').PluginCreator<void>}
|
|
115
116
|
* @return {import('postcss').Plugin}
|
|
116
117
|
*/
|
|
117
118
|
function pluginCreator() {
|
|
118
119
|
return {
|
|
119
120
|
postcssPlugin: 'postcss-normalize-timing-functions',
|
|
120
|
-
|
|
121
|
+
/**
|
|
122
|
+
* @param {import('postcss').Root} css
|
|
123
|
+
*/
|
|
121
124
|
OnceExit(css) {
|
|
122
125
|
const cache = new Map();
|
|
123
126
|
|
|
124
|
-
css.walkDecls(
|
|
125
|
-
|
|
126
|
-
(decl) => {
|
|
127
|
-
const value = decl.value;
|
|
127
|
+
css.walkDecls(animationTransitionRegex, (decl) => {
|
|
128
|
+
const value = decl.value;
|
|
128
129
|
|
|
129
|
-
|
|
130
|
-
|
|
130
|
+
if (cache.has(value)) {
|
|
131
|
+
decl.value = cache.get(value);
|
|
131
132
|
|
|
132
|
-
|
|
133
|
-
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
134
135
|
|
|
135
|
-
|
|
136
|
+
const result = transform(value);
|
|
136
137
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
);
|
|
138
|
+
decl.value = result;
|
|
139
|
+
cache.set(value, result);
|
|
140
|
+
});
|
|
141
141
|
},
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
pluginCreator.postcss = true;
|
|
146
|
-
module.exports =
|
|
146
|
+
module.exports = /** @type {import('postcss').PluginCreator<void>}*/ (
|
|
147
|
+
pluginCreator
|
|
148
|
+
);
|
package/types/index.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @type {import('postcss').PluginCreator<void>}
|
|
4
|
-
* @return {import('postcss').Plugin}
|
|
5
|
-
*/
|
|
6
|
-
declare function pluginCreator(): import("postcss").Plugin;
|
|
7
|
-
declare namespace pluginCreator {
|
|
8
|
-
let postcss: true;
|
|
9
|
-
}
|
|
1
|
+
declare const _exports: import("postcss").PluginCreator<void>;
|
|
2
|
+
export = _exports;
|
|
10
3
|
//# 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":""}
|