postcss-reduce-transforms 5.0.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.
- package/dist/index.js +10 -13
- package/package.json +8 -10
- package/CHANGELOG.md +0 -78
package/dist/index.js
CHANGED
|
@@ -7,8 +7,6 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _postcssValueParser = _interopRequireWildcard(require("postcss-value-parser"));
|
|
9
9
|
|
|
10
|
-
var _cssnanoUtils = require("cssnano-utils");
|
|
11
|
-
|
|
12
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
11
|
|
|
14
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -55,11 +53,10 @@ function matrix3d(node, values) {
|
|
|
55
53
|
}
|
|
56
54
|
}
|
|
57
55
|
|
|
58
|
-
const rotate3dMappings = [[
|
|
59
|
-
[
|
|
60
|
-
[
|
|
61
|
-
];
|
|
62
|
-
const rotate3dMatch = (0, _cssnanoUtils.getMatch)(rotate3dMappings);
|
|
56
|
+
const rotate3dMappings = new Map([[[1, 0, 0].toString(), 'rotateX'], // rotate3d(1, 0, 0, a) => rotateX(a)
|
|
57
|
+
[[0, 1, 0].toString(), 'rotateY'], // rotate3d(0, 1, 0, a) => rotateY(a)
|
|
58
|
+
[[0, 0, 1].toString(), 'rotate'] // rotate3d(0, 0, 1, a) => rotate(a)
|
|
59
|
+
]);
|
|
63
60
|
|
|
64
61
|
function rotate3d(node, values) {
|
|
65
62
|
if (values.length !== 4) {
|
|
@@ -69,9 +66,9 @@ function rotate3d(node, values) {
|
|
|
69
66
|
const {
|
|
70
67
|
nodes
|
|
71
68
|
} = node;
|
|
72
|
-
const match =
|
|
69
|
+
const match = rotate3dMappings.get(values.slice(0, 3).toString());
|
|
73
70
|
|
|
74
|
-
if (match
|
|
71
|
+
if (match) {
|
|
75
72
|
node.value = match;
|
|
76
73
|
node.nodes = [nodes[6]];
|
|
77
74
|
}
|
|
@@ -224,7 +221,7 @@ function pluginCreator() {
|
|
|
224
221
|
postcssPlugin: 'postcss-reduce-transforms',
|
|
225
222
|
|
|
226
223
|
prepare() {
|
|
227
|
-
const cache =
|
|
224
|
+
const cache = new Map();
|
|
228
225
|
return {
|
|
229
226
|
OnceExit(css) {
|
|
230
227
|
css.walkDecls(/transform$/i, decl => {
|
|
@@ -234,14 +231,14 @@ function pluginCreator() {
|
|
|
234
231
|
return;
|
|
235
232
|
}
|
|
236
233
|
|
|
237
|
-
if (cache
|
|
238
|
-
decl.value = cache
|
|
234
|
+
if (cache.has(value)) {
|
|
235
|
+
decl.value = cache.get(value);
|
|
239
236
|
return;
|
|
240
237
|
}
|
|
241
238
|
|
|
242
239
|
const result = (0, _postcssValueParser.default)(value).walk(reduce).toString();
|
|
243
240
|
decl.value = result;
|
|
244
|
-
cache
|
|
241
|
+
cache.set(value, result);
|
|
245
242
|
});
|
|
246
243
|
}
|
|
247
244
|
|
package/package.json
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss-reduce-transforms",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"description": "Reduce transform functions with PostCSS.",
|
|
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.json --out-dir dist --ignore \"**/__tests__/\"",
|
|
9
|
-
"prepublish": "yarn build"
|
|
10
|
-
},
|
|
11
6
|
"files": [
|
|
12
7
|
"LICENSE-MIT",
|
|
13
8
|
"dist"
|
|
@@ -21,8 +16,7 @@
|
|
|
21
16
|
},
|
|
22
17
|
"repository": "cssnano/cssnano",
|
|
23
18
|
"dependencies": {
|
|
24
|
-
"
|
|
25
|
-
"postcss-value-parser": "^4.1.0"
|
|
19
|
+
"postcss-value-parser": "^4.2.0"
|
|
26
20
|
},
|
|
27
21
|
"bugs": {
|
|
28
22
|
"url": "https://github.com/cssnano/cssnano/issues"
|
|
@@ -36,5 +30,9 @@
|
|
|
36
30
|
"peerDependencies": {
|
|
37
31
|
"postcss": "^8.2.15"
|
|
38
32
|
},
|
|
39
|
-
"
|
|
40
|
-
|
|
33
|
+
"scripts": {
|
|
34
|
+
"prebuild": "rimraf dist",
|
|
35
|
+
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\""
|
|
36
|
+
},
|
|
37
|
+
"readme": "# [postcss][postcss]-reduce-transforms\n\n> Reduce transform functions with PostCSS.\n\n## Install\n\nWith [npm](https://npmjs.org/package/postcss-reduce-transforms) do:\n\n```\nnpm install postcss-reduce-transforms --save\n```\n\n## Example\n\nThis module will reduce transform functions where possible. For more examples,\nsee the [tests](src/__tests__/index.js).\n\n### Input\n\n```css\nh1 {\n transform: rotate3d(0, 0, 1, 20deg);\n}\n```\n\n### Output\n\n```css\nh1 {\n transform: rotate(20deg);\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,78 +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.1](https://github.com/cssnano/cssnano/compare/postcss-reduce-transforms@5.0.0...postcss-reduce-transforms@5.0.1) (2021-05-19)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package postcss-reduce-transforms
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# [5.0.0](https://github.com/cssnano/cssnano/compare/postcss-reduce-transforms@5.0.0-rc.2...postcss-reduce-transforms@5.0.0) (2021-04-06)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package postcss-reduce-transforms
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# [5.0.0-rc.2](https://github.com/cssnano/cssnano/compare/postcss-reduce-transforms@5.0.0-rc.1...postcss-reduce-transforms@5.0.0-rc.2) (2021-03-15)
|
|
23
|
-
|
|
24
|
-
**Note:** Version bump only for package postcss-reduce-transforms
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
# [5.0.0-rc.1](https://github.com/cssnano/cssnano/compare/postcss-reduce-transforms@5.0.0-rc.0...postcss-reduce-transforms@5.0.0-rc.1) (2021-03-04)
|
|
31
|
-
|
|
32
|
-
**Note:** Version bump only for package postcss-reduce-transforms
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
# 5.0.0-rc.0 (2021-02-19)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
### chore
|
|
42
|
-
|
|
43
|
-
* minimum require version of node is 10.13 ([#871](https://github.com/cssnano/cssnano/issues/871)) ([28bda24](https://github.com/cssnano/cssnano/commit/28bda243e32ce3ba89b3c358a5f78727b3732f11))
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
### Features
|
|
47
|
-
|
|
48
|
-
* migarete to PostCSS 8 ([#975](https://github.com/cssnano/cssnano/issues/975)) ([40b82dc](https://github.com/cssnano/cssnano/commit/40b82dca7f53ac02cd4fe62846dec79b898ccb49))
|
|
49
|
-
* **postcss-reduce-transforms:** improve optimizations ([#745](https://github.com/cssnano/cssnano/issues/745)) ([b0f0d89](https://github.com/cssnano/cssnano/commit/b0f0d892316d7b77e8033a6dc8d67745043a5072))
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
### BREAKING CHANGES
|
|
53
|
-
|
|
54
|
-
* minimum supported `postcss` version is `8.2.1`
|
|
55
|
-
* minimum require version of node is 10.13
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
## 4.1.9 (2019-02-12)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
### Bug Fixes
|
|
63
|
-
|
|
64
|
-
* **fix-postcss-reduce-transforms:** cache ([#691](https://github.com/cssnano/cssnano/issues/691)) ([e07309f](https://github.com/cssnano/cssnano/commit/e07309ff0c07fb36ef2340bbed6b3aee3dad18be))
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
### Performance Improvements
|
|
68
|
-
|
|
69
|
-
* **postcss-reduce-transforms:** increase perf ([#688](https://github.com/cssnano/cssnano/issues/688)) ([84ccba0](https://github.com/cssnano/cssnano/commit/84ccba00cead30e80510525cbcd27ba259c26065))
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
## 4.1.1 (2018-09-24)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
### Bug Fixes
|
|
77
|
-
|
|
78
|
-
* **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)
|