Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-discard-overridden

Package Overview
Dependencies
Maintainers
5
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-discard-overridden - npm Package Compare versions

Comparing version 4.0.0-rc.2 to 4.0.0

26

dist/index.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc