postcss-custom-selectors
Advanced tools
Comparing version 6.0.0 to 6.0.1
# Changes to PostCSS Custom Selectors | ||
## 6.0.1 (June 3, 2022) | ||
- Fixed: invalid whitespace (https://github.com/csstools/postcss-custom-selectors/pull/55) | ||
### 6.0.0 (January 12, 2021) | ||
@@ -7,3 +11,3 @@ | ||
- Added: Support for Node v10+ | ||
- Fixed: importing from multiple sources ([#42](https://github.com/postcss/postcss-custom-selectors/pull/42)) | ||
- Fixed: importing from multiple sources (https://github.com/postcss/postcss-custom-selectors/pull/42) | ||
@@ -46,3 +50,3 @@ ### 5.1.2 (September 20, 2018) | ||
* Fixed: Nested/mixed selectors now works correctly | ||
([#19](https://github.com/postcss/postcss-custom-selectors/issues/19)) | ||
(https://github.com/postcss/postcss-custom-selectors/issues/19) | ||
* Added: `transformMatches` option to limit transformation to :matches() | ||
@@ -54,3 +58,3 @@ replacements. | ||
* Fixed: No more useless warnings for undefined non custom selectors | ||
([#22](https://github.com/postcss/postcss-custom-selectors/issues/22)) | ||
(https://github.com/postcss/postcss-custom-selectors/issues/22) | ||
* Changed: warnings now use PostCSS message API | ||
@@ -61,5 +65,5 @@ | ||
* Fixed: the lineBreak option keeping the selectors indent | ||
([#18](https://github.com/postcss/postcss-custom-selectors/issues/18)) | ||
(https://github.com/postcss/postcss-custom-selectors/issues/18) | ||
* Fixed: the tip of an undefined selector | ||
([#20](https://github.com/postcss/postcss-custom-selectors/issues/20)) | ||
(https://github.com/postcss/postcss-custom-selectors/issues/20) | ||
@@ -69,3 +73,3 @@ ### 2.1.0 (June 4, 2015) | ||
* Changed: use PostCSS 4.1 plugin API | ||
([#13](https://github.com/postcss/postcss-custom-selectors/issues/13)) | ||
(https://github.com/postcss/postcss-custom-selectors/issues/13) | ||
@@ -75,3 +79,2 @@ ### 2.0.1 (June 3, 2015) | ||
* Fixed: `(foo, bar)` conversion error exists in the selector | ||
(See also [:matches() test](test/fixtures/matches/input.css)) | ||
@@ -82,5 +85,5 @@ ### 2.0.0 (May 29, 2015) | ||
you must use the syntax `:--` to define it. | ||
([#6](https://github.com/postcss/postcss-custom-selectors/issues/6)) | ||
(https://github.com/postcss/postcss-custom-selectors/issues/6) | ||
* Fixed: two or more consecutive hyphens in selector don't output `undefined` | ||
([#14](https://github.com/postcss/postcss-custom-selectors/issues/14)) | ||
(https://github.com/postcss/postcss-custom-selectors/issues/14) | ||
@@ -87,0 +90,0 @@ |
164
package.json
{ | ||
"name": "postcss-custom-selectors", | ||
"version": "6.0.0", | ||
"description": "Use Custom Selectors in CSS", | ||
"author": "Jonathan Neal <jonathantneal@hotmail.com>", | ||
"contributors": [ | ||
"yisi", | ||
"Maxime Thirouin" | ||
], | ||
"license": "MIT", | ||
"repository": "postcss/postcss-custom-selectors", | ||
"homepage": "https://github.com/postcss/postcss-custom-selectors#readme", | ||
"bugs": "https://github.com/postcss/postcss-custom-selectors/issues", | ||
"main": "index.cjs.js", | ||
"module": "index.es.mjs", | ||
"files": [ | ||
"index.cjs.js", | ||
"index.cjs.js.map", | ||
"index.es.mjs", | ||
"index.es.mjs.map" | ||
], | ||
"scripts": { | ||
"prepublishOnly": "npm test", | ||
"pretest": "rollup -c .rollup.js --silent", | ||
"test": "echo 'Running tests...'; npm run test:js && npm run test:tape", | ||
"test:js": "eslint *.js lib/*.js --cache --ignore-path .gitignore --quiet", | ||
"test:tape": "postcss-tape" | ||
}, | ||
"engines": { | ||
"node": ">=10.0.0" | ||
}, | ||
"dependencies": { | ||
"postcss-selector-parser": "^6.0.4" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.1.0", | ||
"@babel/plugin-syntax-dynamic-import": "^7.0.0", | ||
"@babel/preset-env": "^7.1.0", | ||
"@rollup/plugin-babel": "^5.2.1", | ||
"babel-eslint": "^10.0.0", | ||
"eslint": "^7.0.0", | ||
"eslint-config-dev": "^2.0.0", | ||
"postcss": "^8.1.2", | ||
"postcss-tape": "^6.0.0", | ||
"pre-commit": "^1.2.2", | ||
"rollup": "^2.0.0" | ||
}, | ||
"peerDependencies": { | ||
"postcss": "^8.1.2" | ||
}, | ||
"eslintConfig": { | ||
"extends": "dev", | ||
"parser": "babel-eslint" | ||
}, | ||
"keywords": [ | ||
"postcss", | ||
"css", | ||
"postcss-plugin", | ||
"custom", | ||
"selectors", | ||
"w3c", | ||
"csswg", | ||
"extensions", | ||
"declarative", | ||
"rule", | ||
"atrule", | ||
"at-rule", | ||
"specification" | ||
] | ||
"name": "postcss-custom-selectors", | ||
"description": "Use Custom Selectors in CSS", | ||
"version": "6.0.1", | ||
"contributors": [ | ||
{ | ||
"name": "Antonio Laguna", | ||
"email": "antonio@laguna.es", | ||
"url": "https://antonio.laguna.es" | ||
}, | ||
{ | ||
"name": "Romain Menke", | ||
"email": "romainmenke@gmail.com" | ||
}, | ||
{ | ||
"name": "Jonathan Neal", | ||
"email": "jonathantneal@hotmail.com" | ||
}, | ||
{ | ||
"name": "Maxime Thirouin" | ||
}, | ||
{ | ||
"name": "yisi" | ||
} | ||
], | ||
"license": "MIT", | ||
"funding": { | ||
"type": "opencollective", | ||
"url": "https://opencollective.com/csstools" | ||
}, | ||
"engines": { | ||
"node": "^12 || ^14 || >=16" | ||
}, | ||
"main": "dist/index.cjs", | ||
"module": "dist/index.mjs", | ||
"exports": { | ||
".": { | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.cjs", | ||
"default": "./dist/index.mjs" | ||
} | ||
}, | ||
"files": [ | ||
"CHANGELOG.md", | ||
"LICENSE.md", | ||
"README.md", | ||
"dist" | ||
], | ||
"dependencies": { | ||
"postcss-selector-parser": "^6.0.4" | ||
}, | ||
"peerDependencies": { | ||
"postcss": "^8.3" | ||
}, | ||
"scripts": { | ||
"build": "rollup -c ../../rollup/default.js", | ||
"clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true });\"", | ||
"docs": "node ../../.github/bin/generate-docs/install.mjs && node ../../.github/bin/generate-docs/readme.mjs", | ||
"lint": "npm run lint:eslint && npm run lint:package-json", | ||
"lint:eslint": "eslint ./src --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern", | ||
"lint:package-json": "node ../../.github/bin/format-package-json.mjs", | ||
"prepublishOnly": "npm run clean && npm run build && npm run test", | ||
"test": "node .tape.cjs && node .tape.mjs && npm run test:exports", | ||
"test:exports": "node ./test/_import.mjs && node ./test/_require.cjs", | ||
"test:rewrite-expects": "REWRITE_EXPECTS=true node .tape.mjs && REWRITE_EXPECTS=true node .tape.cjs" | ||
}, | ||
"homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-custom-selectors#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/csstools/postcss-plugins.git", | ||
"directory": "plugins/postcss-custom-selectors" | ||
}, | ||
"bugs": "https://github.com/csstools/postcss-plugins/issues", | ||
"keywords": [ | ||
"at-rule", | ||
"atrule", | ||
"css", | ||
"csswg", | ||
"custom", | ||
"declarative", | ||
"extensions", | ||
"postcss", | ||
"postcss-plugin", | ||
"rule", | ||
"selectors", | ||
"specification", | ||
"w3c" | ||
], | ||
"csstools": { | ||
"cssdbId": "custom-selectors", | ||
"exportName": "postcssCustomSelectors", | ||
"humanReadableName": "PostCSS Custom Selectors", | ||
"specUrl": "https://drafts.csswg.org/css-extensions/#custom-selectors" | ||
}, | ||
"volta": { | ||
"extends": "../../package.json" | ||
} | ||
} |
118
README.md
@@ -1,10 +0,6 @@ | ||
# PostCSS Custom Selectors [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS" width="90" height="90" align="right">][postcss] | ||
# PostCSS Custom Selectors [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][postcss] | ||
[![NPM Version][npm-img]][npm-url] | ||
[![CSS Standard Status][css-img]][css-url] | ||
[![Build Status][cli-img]][cli-url] | ||
[![Support Chat][git-img]][git-url] | ||
[<img alt="npm version" src="https://img.shields.io/npm/v/postcss-custom-selectors.svg" height="20">][npm-url] [<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/custom-selectors.svg" height="20">][css-url] [<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/workflows/test/badge.svg" height="20">][cli-url] [<img alt="Discord" src="https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white">][discord] | ||
[PostCSS Custom Selectors] lets you use Custom Selectors in CSS, following the | ||
[CSS Extensions] specification. | ||
[PostCSS Custom Selectors] lets you define `@custom-selector` in CSS following the [Custom Selectors Specification]. | ||
@@ -15,3 +11,3 @@ ```pcss | ||
article :--heading + p { | ||
margin-top: 0; | ||
margin-top: 0; | ||
} | ||
@@ -21,3 +17,5 @@ | ||
article h1 + p, article h2 + p, article h3 + p {} | ||
article h1 + p,article h2 + p,article h3 + p { | ||
margin-top: 0; | ||
} | ||
``` | ||
@@ -30,16 +28,8 @@ | ||
```bash | ||
npm install postcss-custom-selectors --save-dev | ||
npm install postcss postcss-custom-selectors --save-dev | ||
``` | ||
Use [PostCSS Custom Selectors] to process your CSS: | ||
Use it as a [PostCSS] plugin: | ||
```js | ||
const postcssCustomSelectors = require('postcss-custom-selectors'); | ||
postcssCustomSelectors.process(YOUR_CSS /*, processOptions, pluginOptions */); | ||
``` | ||
Or use it as a [PostCSS] plugin: | ||
```js | ||
const postcss = require('postcss'); | ||
@@ -49,7 +39,8 @@ const postcssCustomSelectors = require('postcss-custom-selectors'); | ||
postcss([ | ||
postcssCustomSelectors(/* pluginOptions */) | ||
postcssCustomSelectors(/* pluginOptions */) | ||
]).process(YOUR_CSS /*, processOptions */); | ||
``` | ||
[PostCSS Custom Selectors] runs in all Node environments, with special instructions for: | ||
[PostCSS Custom Selectors] runs in all Node environments, with special | ||
instructions for: | ||
@@ -63,5 +54,9 @@ | [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) | | ||
The `preserve` option determines whether custom selectors and rules using | ||
custom selectors should be preserved in their original form. | ||
The `preserve` option determines whether the original notation | ||
is preserved. By default, it is not preserved. | ||
```js | ||
postcssCustomSelectors({ preserve: true }) | ||
``` | ||
```pcss | ||
@@ -71,3 +66,3 @@ @custom-selector :--heading h1, h2, h3; | ||
article :--heading + p { | ||
margin-top: 0; | ||
margin-top: 0; | ||
} | ||
@@ -77,5 +72,11 @@ | ||
article h1 + p, article h2 + p, article h3 + p {} | ||
@custom-selector :--heading h1, h2, h3; | ||
article :--heading + p {} | ||
article h1 + p,article h2 + p,article h3 + p { | ||
margin-top: 0; | ||
} | ||
article :--heading + p { | ||
margin-top: 0; | ||
} | ||
``` | ||
@@ -91,3 +92,3 @@ | ||
postcssCustomSelectors({ | ||
importFrom: 'path/to/file.css' // => @custom-selector :--heading h1, h2, h3; | ||
importFrom: 'path/to/file.css' // => @custom-selector :--heading h1, h2, h3; | ||
}); | ||
@@ -98,3 +99,3 @@ ``` | ||
article :--heading + p { | ||
margin-top: 0; | ||
margin-top: 0; | ||
} | ||
@@ -114,15 +115,15 @@ | ||
postcssCustomSelectors({ | ||
importFrom: [ | ||
'path/to/file.css', | ||
'and/then/this.js', | ||
'and/then/that.json', | ||
{ | ||
customSelectors: { ':--heading': 'h1, h2, h3' } | ||
}, | ||
() => { | ||
const customProperties = { ':--heading': 'h1, h2, h3' }; | ||
importFrom: [ | ||
'path/to/file.css', | ||
'and/then/this.js', | ||
'and/then/that.json', | ||
{ | ||
customSelectors: { ':--heading': 'h1, h2, h3' } | ||
}, | ||
() => { | ||
const customProperties = { ':--heading': 'h1, h2, h3' }; | ||
return { customProperties }; | ||
} | ||
] | ||
return { customProperties }; | ||
} | ||
] | ||
}); | ||
@@ -139,3 +140,3 @@ ``` | ||
postcssCustomSelectors({ | ||
exportTo: 'path/to/file.css' // @custom-selector :--heading h1, h2, h3; | ||
exportTo: 'path/to/file.css' // @custom-selector :--heading h1, h2, h3; | ||
}); | ||
@@ -153,26 +154,25 @@ ``` | ||
postcssCustomSelectors({ | ||
exportTo: [ | ||
'path/to/file.css', // @custom-selector :--heading h1, h2, h3; | ||
'and/then/this.js', // module.exports = { customSelectors: { ':--heading': 'h1, h2, h3' } } | ||
'and/then/this.mjs', // export const customSelectors = { ':--heading': 'h1, h2, h3' } } | ||
'and/then/that.json', // { "custom-selectors": { ":--heading": "h1, h2, h3" } } | ||
cachedObject, | ||
customProperties => { | ||
customProperties // { ':--heading': 'h1, h2, h3' } | ||
} | ||
] | ||
exportTo: [ | ||
'path/to/file.css', // @custom-selector :--heading h1, h2, h3; | ||
'and/then/this.js', // module.exports = { customSelectors: { ':--heading': 'h1, h2, h3' } } | ||
'and/then/this.mjs', // export const customSelectors = { ':--heading': 'h1, h2, h3' } } | ||
'and/then/that.json', // { "custom-selectors": { ":--heading": "h1, h2, h3" } } | ||
cachedObject, | ||
customProperties => { | ||
customProperties // { ':--heading': 'h1, h2, h3' } | ||
} | ||
] | ||
}); | ||
``` | ||
[cli-img]: https://img.shields.io/travis/postcss/postcss-custom-selectors.svg | ||
[cli-url]: https://travis-ci.org/postcss/postcss-custom-selectors | ||
[css-img]: https://cssdb.org/badge/custom-selectors.svg | ||
[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test | ||
[css-url]: https://cssdb.org/#custom-selectors | ||
[git-img]: https://img.shields.io/badge/support-chat-blue.svg | ||
[git-url]: https://gitter.im/postcss/postcss | ||
[npm-img]: https://img.shields.io/npm/v/postcss-custom-selectors.svg | ||
[discord]: https://discord.gg/bUadyRwkJS | ||
[npm-url]: https://www.npmjs.com/package/postcss-custom-selectors | ||
[CSS Extensions]: https://drafts.csswg.org/css-extensions/#custom-selectors | ||
[Gulp PostCSS]: https://github.com/postcss/gulp-postcss | ||
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss | ||
[PostCSS]: https://github.com/postcss/postcss | ||
[PostCSS Custom Selectors]: https://github.com/postcss/postcss-custom-selectors | ||
[PostCSS Loader]: https://github.com/postcss/postcss-loader | ||
[PostCSS Custom Selectors]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-custom-selectors | ||
[Custom Selectors Specification]: https://drafts.csswg.org/css-extensions/#custom-selectors |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
0
19911
6
34
1
2