postcss-unique-selectors
Advanced tools
Comparing version 2.0.2 to 4.0.0-nightly.2020.7.24
@@ -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 |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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 bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
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 website
QualityPackage does not have a website.
Found 1 instance in 1 package
0
37
0
4031
4
4
47
1
+ Addedcssesc@3.0.0(transitive)
+ Addedpicocolors@0.2.1(transitive)
+ Addedpostcss@7.0.39(transitive)
+ Addedpostcss-selector-parser@6.1.2(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
- Removedansi-regex@2.1.1(transitive)
- Removedansi-styles@2.2.1(transitive)
- Removedchalk@1.1.3(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedhas-ansi@2.0.0(transitive)
- Removedhas-flag@1.0.0(transitive)
- Removedjs-base64@2.6.4(transitive)
- Removedpostcss@5.2.18(transitive)
- Removedsource-map@0.5.7(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedsupports-color@2.0.03.2.3(transitive)
Updatedalphanum-sort@^1.0.2
Updatedpostcss@^7.0.16