postcss-discard-overridden
Advanced tools
Comparing version 5.0.1 to 5.0.2
@@ -42,3 +42,3 @@ "use strict"; | ||
prepare() { | ||
const cache = {}; | ||
const cache = new Map(); | ||
const rules = []; | ||
@@ -50,3 +50,3 @@ return { | ||
const scope = getScope(node); | ||
cache[scope] = node; | ||
cache.set(scope, node); | ||
rules.push({ | ||
@@ -59,3 +59,3 @@ node, | ||
rules.forEach(rule => { | ||
if (cache[rule.scope] !== rule.node) { | ||
if (cache.get(rule.scope) !== rule.node) { | ||
rule.node.remove(); | ||
@@ -62,0 +62,0 @@ } |
{ | ||
"name": "postcss-discard-overridden", | ||
"version": "5.0.1", | ||
"version": "5.0.2", | ||
"description": "PostCSS plugin to discard overridden @keyframes or @counter-style.", | ||
@@ -25,7 +25,2 @@ "main": "dist/index.js", | ||
"homepage": "https://github.com/cssnano/cssnano", | ||
"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" | ||
}, | ||
"engines": { | ||
@@ -40,3 +35,7 @@ "node": "^10 || ^12 || >=14.0" | ||
}, | ||
"gitHead": "28c247175032fa03f04911cde56ad82d74d211cc" | ||
} | ||
"scripts": { | ||
"prebuild": "rimraf dist", | ||
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"" | ||
}, | ||
"readme": "# PostCSS Discard Overridden\n\n[PostCSS] plugin to discard overridden `@keyframes` or `@counter-style`.\n\n`@keyframes` or `@counter-style` will be overridden by those who share the same identifiers and appear later in stylesheets. So we can discard all of them except the last one. When defined inside a `@media` or `@supports` rule, `@keyframes` and `@counter-style` rules only override global rules in some of the client browsers so they need handled separately. This plugin has taken care of this and transforms the PostCss AST **safely**.\n\n[PostCSS]: https://github.com/postcss/postcss\n\n```css\n@-webkit-keyframes fade-in {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 0.8;\n }\n}\n@keyframes fade-in {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 0.8;\n }\n}\n@media (max-width: 500px) {\n @-webkit-keyframes fade-in {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n @keyframes fade-in {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n @-webkit-keyframes fade-in {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 0.8;\n }\n }\n @keyframes fade-in {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 0.8;\n }\n }\n @supports (display: flex) {\n @-webkit-keyframes fade-in {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n @keyframes fade-in {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n }\n}\n@-webkit-keyframes fade-in {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes fade-in {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n```\n\n```css\n@media (max-width: 500px) {\n @-webkit-keyframes fade-in {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 0.8;\n }\n }\n @keyframes fade-in {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 0.8;\n }\n }\n @supports (display: flex) {\n @-webkit-keyframes fade-in {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n @keyframes fade-in {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n }\n}\n@-webkit-keyframes fade-in {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes fade-in {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\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" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8815
4