Socket
Socket
Sign inDemoInstall

postcss-zindex

Package Overview
Dependencies
Maintainers
6
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-zindex - npm Package Compare versions

Comparing version 4.0.0-nightly.2020.1.9 to 4.0.0-nightly.2020.1.11

66

dist/index.js

@@ -8,4 +8,2 @@ "use strict";

var _postcss = require("postcss");
var _layerCache = _interopRequireDefault(require("./lib/layerCache"));

@@ -15,37 +13,49 @@

var _default = (0, _postcss.plugin)('postcss-zindex', (opts = {}) => {
return css => {
const cache = new _layerCache.default(opts);
const nodes = [];
let abort = false; // First pass; cache all z indexes
function pluginCreator(opts = {}) {
return {
postcssPlugin: 'postcss-zindex',
css.walkDecls(/z-index/i, decl => {
// Check that no negative values exist. Rebasing is only
// safe if all indices are positive numbers.
if (decl.value[0] === '-') {
abort = true; // Stop PostCSS iterating through the rest of the decls
prepare() {
const cache = new _layerCache.default(opts);
return {
OnceExit(css) {
const nodes = [];
let abort = false; // First pass; cache all z indexes
return false;
}
css.walkDecls(/z-index/i, decl => {
// Check that no negative values exist. Rebasing is only
// safe if all indices are positive numbers.
if (decl.value[0] === '-') {
abort = true; // Stop PostCSS iterating through the rest of the decls
nodes.push(decl);
cache.addValue(decl.value);
}); // Abort if we found any negative values
// or there are no z-index declarations
return false;
}
if (abort || !nodes.length) {
return;
nodes.push(decl);
cache.addValue(decl.value);
}); // Abort if we found any negative values
// or there are no z-index declarations
if (abort || !nodes.length) {
return;
}
cache.optimizeValues(); // Second pass; optimize
nodes.forEach(decl => {
// Need to coerce to string so that the
// AST is updated correctly
decl.value = cache.getValue(decl.value).toString();
});
}
};
}
cache.optimizeValues(); // Second pass; optimize
nodes.forEach(decl => {
// Need to coerce to string so that the
// AST is updated correctly
decl.value = cache.getValue(decl.value).toString();
});
};
});
}
pluginCreator.postcss = true;
var _default = pluginCreator;
exports.default = _default;
module.exports = exports.default;
{
"name": "postcss-zindex",
"version": "4.0.0-nightly.2020.1.9",
"version": "4.0.0-nightly.2020.1.11",
"description": "Reduce z-index values with PostCSS.",

@@ -27,3 +27,2 @@ "main": "dist/index.js",

"has": "^1.0.3",
"postcss": "^7.0.16",
"uniqs": "^2.0.0"

@@ -43,3 +42,9 @@ },

"node": ">=10.13.0"
},
"devDependencies": {
"postcss": "^8.2.1"
},
"peerDependencies": {
"postcss": "^8.2.1"
}
}
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