postcss-reduce-transforms
Advanced tools
Comparing version 5.0.1 to 5.0.2
@@ -10,4 +10,2 @@ "use strict"; | ||
var _cssnanoUtils = require("cssnano-utils"); | ||
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); } | ||
@@ -59,7 +57,6 @@ | ||
const rotate3dMappings = [['rotateX', [1, 0, 0]], // rotate3d(1, 0, 0, a) => rotateX(a) | ||
['rotateY', [0, 1, 0]], // rotate3d(0, 1, 0, a) => rotateY(a) | ||
['rotate', [0, 0, 1]] // rotate3d(0, 0, 1, a) => rotate(a) | ||
]; | ||
const rotate3dMatch = (0, _cssnanoUtils.getMatch)(rotate3dMappings); | ||
const rotate3dMappings = new Map([[[1, 0, 0].toString(), 'rotateX'], // rotate3d(1, 0, 0, a) => rotateX(a) | ||
[[0, 1, 0].toString(), 'rotateY'], // rotate3d(0, 1, 0, a) => rotateY(a) | ||
[[0, 0, 1].toString(), 'rotate'] // rotate3d(0, 0, 1, a) => rotate(a) | ||
]); | ||
@@ -74,5 +71,5 @@ function rotate3d(node, values) { | ||
} = node; | ||
const match = rotate3dMatch(values.slice(0, 3)); | ||
const match = rotate3dMappings.get(values.slice(0, 3).toString()); | ||
if (match.length) { | ||
if (match) { | ||
node.value = match; | ||
@@ -230,3 +227,3 @@ node.nodes = [nodes[6]]; | ||
prepare() { | ||
const cache = {}; | ||
const cache = new Map(); | ||
return { | ||
@@ -241,4 +238,4 @@ OnceExit(css) { | ||
if (cache[value]) { | ||
decl.value = cache[value]; | ||
if (cache.has(value)) { | ||
decl.value = cache.get(value); | ||
return; | ||
@@ -249,3 +246,3 @@ } | ||
decl.value = result; | ||
cache[value] = result; | ||
cache.set(value, result); | ||
}); | ||
@@ -252,0 +249,0 @@ } |
{ | ||
"name": "postcss-reduce-transforms", | ||
"version": "5.0.1", | ||
"version": "5.0.2", | ||
"description": "Reduce transform functions with PostCSS.", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"prebuild": "del-cli dist", | ||
"build": "cross-env BABEL_ENV=publish babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"", | ||
"prepublish": "yarn build" | ||
}, | ||
"files": [ | ||
@@ -24,4 +19,3 @@ "LICENSE-MIT", | ||
"dependencies": { | ||
"cssnano-utils": "^2.0.1", | ||
"postcss-value-parser": "^4.1.0" | ||
"postcss-value-parser": "^4.2.0" | ||
}, | ||
@@ -40,3 +34,7 @@ "bugs": { | ||
}, | ||
"gitHead": "28c247175032fa03f04911cde56ad82d74d211cc" | ||
} | ||
"scripts": { | ||
"prebuild": "rimraf dist", | ||
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"" | ||
}, | ||
"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" | ||
} |
2
9813
4
201
- Removedcssnano-utils@^2.0.1
- Removedcssnano-utils@2.0.1(transitive)
Updatedpostcss-value-parser@^4.2.0