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

postcss-unique-selectors

Package Overview
Dependencies
Maintainers
5
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-unique-selectors - npm Package Compare versions

Comparing version 2.0.2 to 4.0.0-nightly.2020.7.24

50

dist/index.js

@@ -1,26 +0,48 @@

'use strict';
"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _postcss = require('postcss');
var _postcss = require("postcss");
var _alphanumSort = require('alphanum-sort');
var _alphanumSort = _interopRequireDefault(require("alphanum-sort"));
var _alphanumSort2 = _interopRequireDefault(_alphanumSort);
var _uniqs = _interopRequireDefault(require("uniqs"));
var _uniqs = require('uniqs');
var _postcssSelectorParser = _interopRequireDefault(require("postcss-selector-parser"));
var _uniqs2 = _interopRequireDefault(_uniqs);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function parseSelectors(selectors, callback) {
return (0, _postcssSelectorParser.default)(callback).processSync(selectors);
}
function unique(rule) {
rule.selector = (0, _alphanumSort2.default)((0, _uniqs2.default)(rule.selectors), { insensitive: true }).join();
rule.selector = (0, _alphanumSort.default)((0, _uniqs.default)(rule.selectors), {
insensitive: true
}).join();
}
exports.default = (0, _postcss.plugin)('postcss-unique-selectors', function () {
return function (css) {
return css.walkRules(unique);
};
var _default = (0, _postcss.plugin)('postcss-unique-selectors', () => {
return css => css.walkRules(nodes => {
let comments = [];
nodes.selector = parseSelectors(nodes.selector, selNode => {
selNode.walk(sel => {
if (sel.type === 'comment') {
comments.push(sel.value);
sel.remove();
return;
} else {
return sel;
}
});
});
unique(nodes);
nodes.selectors = nodes.selectors.concat(comments);
});
});
module.exports = exports['default'];
exports.default = _default;
module.exports = exports.default;
{
"name": "postcss-unique-selectors",
"version": "2.0.2",
"version": "4.0.0-nightly.2020.7.24",
"description": "Ensure CSS selectors are unique.",
"main": "dist/index.js",
"scripts": {
"pretest": "eslint src",
"prepublish": "de dist && BABEL_ENV=publish babel src --out-dir dist --ignore /__tests__/",
"test": "ava src/__tests__"
"prebuild": "",
"build": "cross-env BABEL_ENV=publish babel src --config-file ../../babel.config.js --out-dir dist --ignore \"**/__tests__/\"",
"prepublish": ""
},

@@ -21,15 +21,3 @@ "files": [

"license": "MIT",
"devDependencies": {
"ava": "^0.11.0",
"babel-cli": "^6.4.0",
"babel-core": "^6.4.0",
"babel-plugin-add-module-exports": "^0.1.2",
"babel-preset-es2015": "^6.3.13",
"babel-preset-es2015-loose": "^7.0.0",
"babel-preset-stage-0": "^6.3.13",
"del-cli": "^0.1.2",
"eslint": "^1.10.3",
"eslint-config-cssnano": "^1.0.0"
},
"homepage": "https://github.com/ben-eb/postcss-unique-selectors",
"homepage": "https://github.com/cssnano/cssnano",
"author": {

@@ -40,14 +28,15 @@ "name": "Ben Briggs",

},
"repository": "ben-eb/postcss-unique-selectors",
"repository": "cssnano/cssnano",
"dependencies": {
"alphanum-sort": "^1.0.1",
"postcss": "^5.0.4",
"alphanum-sort": "^1.0.2",
"postcss": "^7.0.16",
"postcss-selector-parser": "^6.0.2",
"uniqs": "^2.0.0"
},
"ava": {
"require": "babel-core/register"
"bugs": {
"url": "https://github.com/cssnano/cssnano/issues"
},
"eslintConfig": {
"extends": "cssnano"
"engines": {
"node": ">=6.9.0"
}
}
}

@@ -1,2 +0,2 @@

# [postcss][postcss]-unique-selectors [![Build Status](https://travis-ci.org/ben-eb/postcss-unique-selectors.svg?branch=master)][ci] [![NPM version](https://badge.fury.io/js/postcss-unique-selectors.svg)][npm] [![Dependency Status](https://gemnasium.com/ben-eb/postcss-unique-selectors.svg)][deps]
# [postcss][postcss]-unique-selectors

@@ -38,6 +38,5 @@ > Ensure CSS selectors are unique.

## Contributing
## Contributors
Pull requests are welcome. If you add functionality, then please add unit tests
to cover it.
See [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).

@@ -48,5 +47,2 @@ ## License

[ci]: https://travis-ci.org/ben-eb/postcss-unique-selectors
[deps]: https://gemnasium.com/ben-eb/postcss-unique-selectors
[npm]: http://badge.fury.io/js/postcss-unique-selectors
[postcss]: https://github.com/postcss/postcss
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