postcss-discard-overridden
Advanced tools
Comparing version 4.0.0-rc.2 to 4.0.0
@@ -13,16 +13,16 @@ 'use strict'; | ||
var OVERRIDABLE_RULES = ['keyframes', 'counter-style']; | ||
var SCOPE_RULES = ['media', 'supports']; | ||
const OVERRIDABLE_RULES = ['keyframes', 'counter-style']; | ||
const SCOPE_RULES = ['media', 'supports']; | ||
function isOverridable(name) { | ||
return ~OVERRIDABLE_RULES.indexOf(_postcss2.default.vendor.unprefixed(name)); | ||
return ~OVERRIDABLE_RULES.indexOf(_postcss2.default.vendor.unprefixed(name.toLowerCase())); | ||
} | ||
function isScope(name) { | ||
return ~SCOPE_RULES.indexOf(_postcss2.default.vendor.unprefixed(name)); | ||
return ~SCOPE_RULES.indexOf(_postcss2.default.vendor.unprefixed(name.toLowerCase())); | ||
} | ||
function getScope(node) { | ||
var current = node.parent; | ||
var chain = [node.name, node.params]; | ||
let current = node.parent; | ||
const chain = [node.name.toLowerCase(), node.params]; | ||
do { | ||
@@ -37,9 +37,9 @@ if (current.type === 'atrule' && isScope(current.name)) { | ||
exports.default = _postcss2.default.plugin('postcss-discard-overridden', function () { | ||
return function (css) { | ||
var cache = {}; | ||
var rules = []; | ||
css.walkAtRules(function (node) { | ||
exports.default = _postcss2.default.plugin('postcss-discard-overridden', () => { | ||
return css => { | ||
const cache = {}; | ||
const rules = []; | ||
css.walkAtRules(node => { | ||
if (isOverridable(node.name)) { | ||
var scope = getScope(node); | ||
const scope = getScope(node); | ||
cache[scope] = node; | ||
@@ -52,3 +52,3 @@ rules.push({ | ||
}); | ||
rules.forEach(function (rule) { | ||
rules.forEach(rule => { | ||
if (cache[rule.scope] !== rule.node) { | ||
@@ -55,0 +55,0 @@ rule.node.remove(); |
{ | ||
"name": "postcss-discard-overridden", | ||
"version": "4.0.0-rc.2", | ||
"version": "4.0.0", | ||
"description": "PostCSS plugin to discard overridden @keyframes or @counter-style.", | ||
@@ -16,7 +16,7 @@ "main": "dist/index.js", | ||
"license": "MIT", | ||
"repository": "ben-eb/cssnano", | ||
"repository": "cssnano/cssnano", | ||
"bugs": { | ||
"url": "https://github.com/ben-eb/cssnano/issues" | ||
"url": "https://github.com/cssnano/cssnano/issues" | ||
}, | ||
"homepage": "https://github.com/ben-eb/cssnano", | ||
"homepage": "https://github.com/cssnano/cssnano", | ||
"dependencies": { | ||
@@ -27,5 +27,5 @@ "postcss": "^6.0.0" | ||
"babel-cli": "^6.0.0", | ||
"chalk": "^1.0.0", | ||
"cross-env": "^3.0.0", | ||
"diff": "^2.0.0" | ||
"chalk": "^2.0.0", | ||
"cross-env": "^5.0.0", | ||
"diff": "^3.0.0" | ||
}, | ||
@@ -36,4 +36,4 @@ "scripts": { | ||
"engines": { | ||
"node": ">=4" | ||
"node": ">=6.9.0" | ||
} | ||
} |
@@ -158,2 +158,2 @@ # PostCSS Discard Overridden | ||
See [CONTRIBUTORS.md](https://github.com/ben-eb/cssnano/blob/master/CONTRIBUTORS.md). | ||
See [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md). |
@@ -7,7 +7,7 @@ import postcss from 'postcss'; | ||
function isOverridable (name) { | ||
return ~OVERRIDABLE_RULES.indexOf(postcss.vendor.unprefixed(name)); | ||
return ~OVERRIDABLE_RULES.indexOf(postcss.vendor.unprefixed(name.toLowerCase())); | ||
} | ||
function isScope (name) { | ||
return ~SCOPE_RULES.indexOf(postcss.vendor.unprefixed(name)); | ||
return ~SCOPE_RULES.indexOf(postcss.vendor.unprefixed(name.toLowerCase())); | ||
} | ||
@@ -17,3 +17,3 @@ | ||
let current = node.parent; | ||
const chain = [node.name, node.params]; | ||
const chain = [node.name.toLowerCase(), node.params]; | ||
do { | ||
@@ -20,0 +20,0 @@ if (current.type === 'atrule' && isScope(current.name)) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
350
0
12873
12
1