postcss-normalize-timing-functions 5.0.0-rc.1 → 5.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.
Files changed (3) hide show
  1. package/dist/index.js +10 -7
  2. package/package.json +10 -12
  3. package/CHANGELOG.md +0 -59
package/dist/index.js CHANGED
@@ -7,11 +7,14 @@ exports.default = void 0;
7
7
 
8
8
  var _postcssValueParser = _interopRequireDefault(require("postcss-value-parser"));
9
9
 
10
- var _cssnanoUtils = require("cssnano-utils");
11
-
12
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
11
 
14
12
  const getValue = node => parseFloat(node.value);
13
+ /* Works because toString() normalizes the formatting,
14
+ so comparing the string forms behaves the same as number equality*/
15
+
16
+
17
+ const conversions = new Map([[[0.25, 0.1, 0.25, 1].toString(), 'ease'], [[0, 0, 1, 1].toString(), 'linear'], [[0.42, 0, 1, 1].toString(), 'ease-in'], [[0, 0, 0.58, 1].toString(), 'ease-out'], [[0.42, 0, 0.58, 1].toString(), 'ease-in-out']]);
15
18
 
16
19
  function reduce(node) {
17
20
  if (node.type !== 'function') {
@@ -59,7 +62,7 @@ function reduce(node) {
59
62
  return;
60
63
  }
61
64
 
62
- const match = (0, _cssnanoUtils.getMatch)([['ease', [0.25, 0.1, 0.25, 1]], ['linear', [0, 0, 1, 1]], ['ease-in', [0.42, 0, 1, 1]], ['ease-out', [0, 0, 0.58, 1]], ['ease-in-out', [0.42, 0, 0.58, 1]]])(values);
65
+ const match = conversions.get(values.toString());
63
66
 
64
67
  if (match) {
65
68
  node.type = 'word';
@@ -79,18 +82,18 @@ function pluginCreator() {
79
82
  postcssPlugin: 'postcss-normalize-timing-functions',
80
83
 
81
84
  OnceExit(css) {
82
- const cache = {};
85
+ const cache = new Map();
83
86
  css.walkDecls(/^(-\w+-)?(animation|transition)(-timing-function)?$/i, decl => {
84
87
  const value = decl.value;
85
88
 
86
- if (cache[value]) {
87
- decl.value = cache[value];
89
+ if (cache.has(value)) {
90
+ decl.value = cache.get(value);
88
91
  return;
89
92
  }
90
93
 
91
94
  const result = transform(value);
92
95
  decl.value = result;
93
- cache[value] = result;
96
+ cache.set(value, result);
94
97
  });
95
98
  }
96
99
 
package/package.json CHANGED
@@ -1,21 +1,15 @@
1
1
  {
2
2
  "name": "postcss-normalize-timing-functions",
3
- "version": "5.0.0-rc.1",
3
+ "version": "5.0.2",
4
4
  "description": "Normalize CSS animation/transition timing functions.",
5
5
  "main": "dist/index.js",
6
- "scripts": {
7
- "prebuild": "del-cli dist",
8
- "build": "cross-env BABEL_ENV=publish babel src --config-file ../../babel.config.js --out-dir dist --ignore \"**/__tests__/\"",
9
- "prepublish": "yarn build"
10
- },
11
6
  "files": [
12
7
  "LICENSE-MIT",
13
8
  "dist"
14
9
  ],
15
10
  "license": "MIT",
16
11
  "dependencies": {
17
- "cssnano-utils": "^2.0.0-rc.1",
18
- "postcss-value-parser": "^4.1.0"
12
+ "postcss-value-parser": "^4.2.0"
19
13
  },
20
14
  "author": {
21
15
  "name": "Ben Briggs",
@@ -31,10 +25,14 @@
31
25
  "node": "^10 || ^12 || >=14.0"
32
26
  },
33
27
  "devDependencies": {
34
- "postcss": "^8.2.1"
28
+ "postcss": "^8.2.15"
35
29
  },
36
30
  "peerDependencies": {
37
- "postcss": "^8.2.1"
31
+ "postcss": "^8.2.15"
32
+ },
33
+ "scripts": {
34
+ "prebuild": "rimraf dist",
35
+ "build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\""
38
36
  },
39
- "gitHead": "114efb0092fff944dd4c8a28d184add24d8fde3e"
40
- }
37
+ "readme": "# [postcss][postcss]-normalize-timing-functions\n\n> Normalize timing functions with PostCSS.\n\n## Install\n\nWith [npm](https://npmjs.org/package/postcss-normalize-timing-functions) do:\n\n```\nnpm install postcss-normalize-timing-functions --save\n```\n\n## Example\n\n### Input\n\n```css\ndiv {\n animate: fade 3s cubic-bezier(0.42, 0, 1, 1)\n}\n```\n\n### Output\n\n```css\ndiv {\n animate: fade 3s ease-in\n}\n``` \n\n## Usage\n\nSee the [PostCSS documentation](https://github.com/postcss/postcss#usage) for\nexamples for your environment.\n\n## Contributors\n\nSee [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).\n\n## License\n\nMIT © [Ben Briggs](http://beneb.info)\n\n[postcss]: https://github.com/postcss/postcss\n"
38
+ }
package/CHANGELOG.md DELETED
@@ -1,59 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- # [5.0.0-rc.1](https://github.com/cssnano/cssnano/compare/postcss-normalize-timing-functions@5.0.0-rc.0...postcss-normalize-timing-functions@5.0.0-rc.1) (2021-03-04)
7
-
8
- **Note:** Version bump only for package postcss-normalize-timing-functions
9
-
10
-
11
-
12
-
13
-
14
- # 5.0.0-rc.0 (2021-02-19)
15
-
16
-
17
- ### Bug Fixes
18
-
19
- * **postcss-normalize-timing-functions:** do not break invalid syntax ([#748](https://github.com/cssnano/cssnano/issues/748)) ([efd2077](https://github.com/cssnano/cssnano/commit/efd20775be85f9845cb343c69b5dc1bb25672a42))
20
-
21
-
22
- ### chore
23
-
24
- * minimum require version of node is 10.13 ([#871](https://github.com/cssnano/cssnano/issues/871)) ([28bda24](https://github.com/cssnano/cssnano/commit/28bda243e32ce3ba89b3c358a5f78727b3732f11))
25
-
26
-
27
- ### Features
28
-
29
- * migarete to PostCSS 8 ([#975](https://github.com/cssnano/cssnano/issues/975)) ([40b82dc](https://github.com/cssnano/cssnano/commit/40b82dca7f53ac02cd4fe62846dec79b898ccb49))
30
-
31
-
32
- ### BREAKING CHANGES
33
-
34
- * minimum supported `postcss` version is `8.2.1`
35
- * minimum require version of node is 10.13
36
-
37
-
38
-
39
- ## 4.1.9 (2019-02-12)
40
-
41
-
42
- ### Bug Fixes
43
-
44
- * **postcss-normalize-timing-functions:** cache ([#693](https://github.com/cssnano/cssnano/issues/693)) ([7e6e481](https://github.com/cssnano/cssnano/commit/7e6e481244964bf77a1085d8db3f516597b264e9))
45
-
46
-
47
- ### Performance Improvements
48
-
49
- * **postcss-normalize-timing-functions:** increase perf ([#687](https://github.com/cssnano/cssnano/issues/687)) ([2bef7d1](https://github.com/cssnano/cssnano/commit/2bef7d1f4f9f6dc33d0a4fb120926a85b08403e7))
50
-
51
-
52
-
53
- ## 4.1.1 (2018-09-24)
54
-
55
-
56
- ### Bug Fixes
57
-
58
- * do not lowercased property ([#606](https://github.com/cssnano/cssnano/issues/606)) ([d40c657](https://github.com/cssnano/cssnano/commit/d40c6577f1d942d00aade671f5e7ab422870c517))
59
- * **postcss-merge-longhand:** not mangle border output ([#555](https://github.com/cssnano/cssnano/issues/555)) ([9a70605](https://github.com/cssnano/cssnano/commit/9a706050b621e7795a9bf74eb7110b5c81804ffe)), closes [#553](https://github.com/cssnano/cssnano/issues/553) [#554](https://github.com/cssnano/cssnano/issues/554)