Socket
Socket
Sign inDemoInstall

postcss

Package Overview
Dependencies
4
Maintainers
1
Versions
252
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.1.9 to 4.1.10

5

CHANGELOG.md

@@ -0,1 +1,6 @@

## 4.1.10
* Fix Promise behavior on sync plugin errors.
* Automatically fill `plugin` field in `CssSyntaxError`.
* Fix warning message (by Ben Briggs).
## 4.1.9

@@ -2,0 +7,0 @@ * Speed up `node.clone()`.

21

lib/css-syntax-error.js

@@ -22,15 +22,11 @@ 'use strict';

this.message = plugin ? plugin + ': ' : '';
this.message += file ? file : '<css input>';
if (file) this.file = file;
if (source) this.source = source;
if (plugin) this.plugin = plugin;
if (typeof line !== 'undefined' && typeof column !== 'undefined') {
this.line = line;
this.column = column;
this.message += ':' + line + ':' + column + ': ' + message;
} else {
this.message += ': ' + message;
}
if (file) this.file = file;
if (source) this.source = source;
if (plugin) this.plugin = plugin;
this.setMessage();

@@ -44,2 +40,11 @@ if (Error.captureStackTrace) {

CssSyntaxError.prototype.setMessage = function setMessage() {
this.message = this.plugin ? this.plugin + ': ' : '';
this.message += this.file ? this.file : '<css input>';
if (typeof this.line !== 'undefined') {
this.message += ':' + this.line + ':' + this.column;
}
this.message += ': ' + this.reason;
};
CssSyntaxError.prototype.showSourceCode = function showSourceCode(color) {

@@ -46,0 +51,0 @@ if (!this.source) return '';

@@ -56,3 +56,3 @@ 'use strict';

} catch (error) {
this.parseError = error;
this.error = error;
}

@@ -80,2 +80,20 @@ }

LazyResult.prototype.handleError = function handleError(error, plugin) {
this.error = error;
if (error.name === 'CssSyntaxError' && !error.plugin) {
error.plugin = plugin.postcssPlugin;
error.setMessage();
} else if (plugin.postcssVersion) {
var pluginName = plugin.postcssPlugin;
var pluginVersion = plugin.postcssVersion;
var runtimeVersion = this.result.processor.version;
var a = pluginVersion.split('.');
var b = runtimeVersion.split('.');
if (a[0] !== b[0] || parseInt(a[1]) > parseInt(b[1])) {
_warnOnce2['default']('Your current PostCSS version is ' + runtimeVersion + ', ' + ('but ' + pluginName + ' uses ' + pluginVersion + '. Perhaps ') + 'this is the source of the error below.');
}
}
};
LazyResult.prototype.asyncTick = function asyncTick(plugins, resolve, reject) {

@@ -86,11 +104,22 @@ var _this = this;

var promise = this.run(plugins.shift());
if (isPromise(promise)) {
promise.then(function () {
_this.asyncTick(plugins, resolve, reject);
})['catch'](function (error) {
reject(error);
});
} else {
this.asyncTick(plugins, resolve, reject);
try {
(function () {
var plugin = plugins.shift();
var promise = _this.run(plugin);
if (isPromise(promise)) {
promise.then(function () {
_this.asyncTick(plugins, resolve, reject);
})['catch'](function (error) {
_this.handleError(error, plugin);
_this.processed = true;
reject(error);
});
} else {
_this.asyncTick(plugins, resolve, reject);
}
})();
} catch (error) {
this.processed = true;
reject(error);
}

@@ -104,4 +133,4 @@ };

return new Promise(function (resolve, reject) {
if (_this2.parseError) {
reject(_this2.parseError);
if (_this2.error) {
reject(_this2.error);
} else {

@@ -118,3 +147,3 @@ resolve(_this2.stringify());

this.processing = new Promise(function (resolve, reject) {
if (_this2.parseError) return reject(_this2.parseError);
if (_this2.error) return reject(_this2.error);
_this2.asyncTick(plugins, resolve, reject);

@@ -137,3 +166,3 @@ }).then(function () {

if (this.parseError) throw this.parseError;
if (this.error) throw this.error;

@@ -170,13 +199,3 @@ for (var _iterator = this.result.processor.plugins, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {

} catch (error) {
if (plugin.postcssVersion) {
var pluginName = plugin.postcssPlugin;
var pluginVersion = plugin.postcssVersion;
var runtimeVersion = this.result.processor.version;
var a = pluginVersion.split('.');
var b = runtimeVersion.split('.');
if (a[0] !== b[0] || parseInt(a[1]) > parseInt(b[1])) {
_warnOnce2['default']('' + pluginName + ' is based on ' + ('PostCSS ' + pluginVersion + ' but you use it ') + ('with PostCSS ' + runtimeVersion + '. ') + 'Maybe this is a source of error below.');
}
}
this.handleError(error, plugin);
throw error;

@@ -183,0 +202,0 @@ }

{
"name": "postcss",
"version": "4.1.9",
"version": "4.1.10",
"description": "Tool for transforming CSS with JS plugins",

@@ -29,9 +29,9 @@ "keywords": [

"gulp-json-editor": "2.2.1",
"gulp-eslint": "0.11.1",
"gulp-eslint": "0.12.0",
"gulp-babel": "5.1.0",
"gulp-mocha": "2.0.1",
"yaspeller": "2.1.0",
"yaspeller": "2.2.0",
"gulp-util": "3.0.4",
"gulp-run": "1.6.8",
"fs-extra": "0.18.2",
"fs-extra": "0.18.3",
"through2": "0.6.5",

@@ -43,17 +43,17 @@ "request": "2.55.0",

"chai": "2.3.0",
"babel-core": "5.2.13"
"babel-core": "5.2.17"
},
"benchmarkDependencies": {
"postcss-simple-vars": "0.2.4",
"postcss-simple-vars": "0.3.0",
"gulp-bench-summary": "0.1.0",
"stylecow-parser": "2.1.0",
"postcss-nested": "0.2.2",
"postcss-mixins": "0.1.1",
"stylecow-parser": "2.2.2",
"postcss-nested": "0.3.1",
"postcss-mixins": "0.2.0",
"postcss-calc": "4.0.1",
"gonzales-pe": "3.0.0-26",
"gulp-bench": "1.1.0",
"node-sass": "2.1.1",
"node-sass": "3.0.0",
"gonzales": "1.0.7",
"mensch": "0.3.1",
"stylus": "0.51.0",
"stylus": "0.51.1",
"rework": "1.0.1",

@@ -60,0 +60,0 @@ "cssom": "0.3.0",

@@ -84,3 +84,3 @@ # PostCSS [![Build Status][ci-img]][ci] [![Gitter][chat-img]][chat]

[cssnext]: https://github.com/cssnext/cssnext
[cssnext]: https://cssnext.github.io/

@@ -102,4 +102,4 @@ ## Features

* **New abilities:** PostCSS plugins can read and change every part of CSS.
It makes many new classes of tools possible. [Autoprefixer], [`doiuse`]
or [`postcss-colorblind`] are good examples.
It makes many new classes of tools possible. [Autoprefixer], [`rtlcss`],
[`doiuse`] or [`postcss-colorblind`] are good examples.

@@ -155,2 +155,13 @@ [3 times faster]: https://github.com/postcss/postcss/blob/master/benchmark/general.js

```css
.css-example.is-test-for-css4-browsers {
color: gray(255, 50%);
}
@context cssnext {
.css-example.is-fallback-for-all-browsers {
color: gray(255, 50%);
}
}
```
[`postcss-plugin-context`]: https://github.com/postcss/postcss-plugin-context

@@ -166,3 +177,3 @@

[`cssnano`]: https://github.com/ben-eb/cssnano
[`cssnext`]: https://github.com/putaindecode/cssnext
[`cssnext`]: https://cssnext.github.io/
[`atcss`]: https://github.com/morishitter/atcss

@@ -210,2 +221,3 @@

* [`postcss-for`] adds `@for` loops.
* [`postcss-conditionals`] adds `@if` statements.
* [`postcss-mixins`] enables mixins more powerful than Sass’s,

@@ -239,2 +251,3 @@ defined within stylesheets or in JS.

* [`postcss-import`] inlines the stylesheets referred to by `@import` rules.
* [`postcss-merge-idents`] merges duplicated `@keyframes` with different names.
* [`postcss-merge-rules`] merges adjacent rules when

@@ -255,2 +268,4 @@ selectors/properties overlap.

that support WebP.
* [`postcss-single-charset`] ensures that there is one
and only one `@charset` rule at the top of file.

@@ -263,2 +278,3 @@ ### Shortcuts

* [`postcss-focus`] adds `:focus` selector to every `:hover`.
* [`postcss-generate-preset`] allows quick generation of rules. Useful for creating repetitive utilities.
* [`postcss-size`] adds a `size` shortcut that sets width and height

@@ -268,3 +284,2 @@ with one declaration.

### Others
* [`postcss-brand-colors`] inserts company brand colors

@@ -280,5 +295,3 @@ in the `brand-colors` module.

right in your browser.
* [`postcss-single-charset`] ensures that there is one
and only one `@charset` rule at the top of file.
* [`postcss-spiffing`] lets you use British English in your CSS
* [`postcss-pxtorem`] convert pixel units to `rem`.
* [`rtlcss`] mirrors styles for right-to-left locales.

@@ -289,2 +302,3 @@

* [`postcss-bem-linter`] lints CSS for conformance to SUIT CSS methodology.
* [`postcss-cssstats`] returns an object with CSS statistics.
* [`css2modernizr`] creates a Modernizr config file

@@ -296,78 +310,91 @@ that requires only the tests that your CSS uses.

[`postcss-color-rgba-fallback`]: https://github.com/postcss/postcss-color-rgba-fallback
[`postcss-color-rebeccapurple`]: https://github.com/postcss/postcss-color-rebeccapurple
[`postcss-discard-duplicates`]: https://github.com/ben-eb/postcss-discard-duplicates
[`postcss-minify-font-weight`]: https://github.com/ben-eb/postcss-minify-font-weight
[`postcss-discard-font-face`]: https://github.com/ben-eb/postcss-discard-font-face
[`postcss-custom-properties`]: https://github.com/postcss/postcss-custom-properties
[`postcss-custom-selectors`]: https://github.com/postcss/postcss-custom-selectors
[`postcss-discard-comments`]: https://github.com/ben-eb/postcss-discard-comments
[`postcss-minify-selectors`]: https://github.com/ben-eb/postcss-minify-selectors
[`postcss-quantity-queries`]: https://github.com/pascalduez/postcss-quantity-queries
[`postcss-color-hex-alpha`]: https://github.com/postcss/postcss-color-hex-alpha
[`postcss-color-function`]: https://github.com/postcss/postcss-color-function
[`postcss-convert-values`]: https://github.com/ben-eb/postcss-convert-values
[`postcss-pseudoelements`]: https://github.com/axa-ch/postcss-pseudoelements
[`postcss-single-charset`]: https://github.com/hail2u/postcss-single-charset
[`postcss-normalize-url`]: https://github.com/ben-eb/postcss-normalize-url
[`postcss-color-palette`]: https://github.com/zaim/postcss-color-palette
[`postcss-discard-empty`]: https://github.com/ben-eb/postcss-discard-empty
[`postcss-reduce-idents`]: https://github.com/ben-eb/postcss-reduce-idents
[`postcss-simple-extend`]: https://github.com/davidtheclark/postcss-simple-extend
[`postcss-css-variables`]: https://github.com/MadLittleMods/postcss-css-variables
[`postcss-selector-not`]: https://github.com/postcss/postcss-selector-not
[`postcss-default-unit`]: https://github.com/antyakushev/postcss-default-unit
[`postcss-media-minmax`]: https://github.com/postcss/postcss-media-minmax
[`postcss-custom-media`]: https://github.com/postcss/postcss-custom-media
[`postcss-log-warnings`]: https://github.com/davidtheclark/postcss-log-warnings
[`postcss-brand-colors`]: https://github.com/postcss/postcss-brand-colors
[`postcss-font-variant`]: https://github.com/postcss/postcss-font-variant
[`postcss-will-change`]: https://github.com/postcss/postcss-will-change
[`postcss-merge-rules`]: https://github.com/ben-eb/postcss-merge-rules
[`postcss-simple-vars`]: https://github.com/postcss/postcss-simple-vars
[`postcss-data-packer`]: https://github.com/Ser-Gen/postcss-data-packer
[`postcss-font-family`]: https://github.com/ben-eb/postcss-font-family
[`postcss-color-alpha`]: https://github.com/avanes/postcss-color-alpha
[`postcss-bem-linter`]: https://github.com/necolas/postcss-bem-linter
[`postcss-color-gray`]: https://github.com/postcss/postcss-color-gray
[`postcss-colorblind`]: https://github.com/btholt/postcss-colorblind
[`postcss-color-hwb`]: https://github.com/postcss/postcss-color-hwb
[`postcss-image-set`]: https://github.com/alex499/postcss-image-set
[`postcss-colormin`]: https://github.com/ben-eb/colormin
[`pleeease-filters`]: https://github.com/iamvdo/pleeease-filters
[`postcss-messages`]: https://github.com/postcss/postcss-messages
[`postcss-spiffing`]: https://github.com/HashanP/postcss-spiffing
[`postcss-easings`]: https://github.com/postcss/postcss-easings
[`postcss-opacity`]: https://github.com/iamvdo/postcss-opacity
[`postcss-assets`]: https://github.com/borodean/postcss-assets
[`postcss-import`]: https://github.com/postcss/postcss-import
[`postcss-nested`]: https://github.com/postcss/postcss-nested
[`postcss-zindex`]: https://github.com/ben-eb/postcss-zindex
[`postcss-mixins`]: https://github.com/postcss/postcss-mixins
[`mq4-hover-shim`]: https://github.com/twbs/mq4-hover-shim
[`list-selectors`]: https://github.com/davidtheclark/list-selectors
[`css2modernizr`]: https://github.com/vovanbo/css2modernizr
[`postcss-focus`]: https://github.com/postcss/postcss-focus
[`postcss-at2x`]: https://github.com/simonsmith/postcss-at2x
[`postcss-neat`]: https://github.com/jo-asakura/postcss-neat
[`autoprefixer`]: https://github.com/postcss/autoprefixer
[`css-mqpacker`]: https://github.com/hail2u/node-css-mqpacker
[`postcss-epub`]: https://github.com/Rycochet/postcss-epub
[`postcss-calc`]: https://github.com/postcss/postcss-calc
[`postcss-size`]: https://github.com/postcss/postcss-size
[`postcss-host`]: https://github.com/vitkarpov/postcss-host
[`postcss-vmin`]: https://github.com/iamvdo/postcss-vmin
[`postcss-url`]: https://github.com/postcss/postcss-url
[`postcss-map`]: https://github.com/pascalduez/postcss-map
[`postcss-for`]: https://github.com/antyakushev/postcss-for
[`css-byebye`]: https://github.com/AoDev/css-byebye
[`cssgrace`]: https://github.com/cssdream/cssgrace
[`csswring`]: https://github.com/hail2u/node-csswring
[`csstyle`]: https://github.com/geddski/csstyle
[`webpcss`]: https://github.com/lexich/webpcss
[`rtlcss`]: https://github.com/MohammadYounes/rtlcss
[`pixrem`]: https://github.com/robwierzbowski/node-pixrem
[`doiuse`]: https://github.com/anandthakker/doiuse
[`lost`]: https://github.com/corysimmons/lost
### Fun
* [`postcss-australian-stylesheets`] Australian Style Sheets.
* [`postcss-canadian-stylesheets`] Canadian Style Sheets.
* [`postcss-spiffing`] lets you use British English in your CSS.
[`postcss-australian-stylesheets`]: https://github.com/dp-lewis/postcss-australian-stylesheets
[`postcss-canadian-stylesheets`]: https://github.com/chancancode/postcss-canadian-stylesheets
[`postcss-color-rgba-fallback`]: https://github.com/postcss/postcss-color-rgba-fallback
[`postcss-color-rebeccapurple`]: https://github.com/postcss/postcss-color-rebeccapurple
[`postcss-discard-duplicates`]: https://github.com/ben-eb/postcss-discard-duplicates
[`postcss-minify-font-weight`]: https://github.com/ben-eb/postcss-minify-font-weight
[`postcss-discard-font-face`]: https://github.com/ben-eb/postcss-discard-font-face
[`postcss-custom-properties`]: https://github.com/postcss/postcss-custom-properties
[`postcss-custom-selectors`]: https://github.com/postcss/postcss-custom-selectors
[`postcss-discard-comments`]: https://github.com/ben-eb/postcss-discard-comments
[`postcss-minify-selectors`]: https://github.com/ben-eb/postcss-minify-selectors
[`postcss-quantity-queries`]: https://github.com/pascalduez/postcss-quantity-queries
[`postcss-generate-preset`]: https://github.com/simonsmith/postcss-generate-preset
[`postcss-color-hex-alpha`]: https://github.com/postcss/postcss-color-hex-alpha
[`postcss-color-function`]: https://github.com/postcss/postcss-color-function
[`postcss-convert-values`]: https://github.com/ben-eb/postcss-convert-values
[`postcss-pseudoelements`]: https://github.com/axa-ch/postcss-pseudoelements
[`postcss-single-charset`]: https://github.com/hail2u/postcss-single-charset
[`postcss-normalize-url`]: https://github.com/ben-eb/postcss-normalize-url
[`postcss-color-palette`]: https://github.com/zaim/postcss-color-palette
[`postcss-discard-empty`]: https://github.com/ben-eb/postcss-discard-empty
[`postcss-reduce-idents`]: https://github.com/ben-eb/postcss-reduce-idents
[`postcss-simple-extend`]: https://github.com/davidtheclark/postcss-simple-extend
[`postcss-css-variables`]: https://github.com/MadLittleMods/postcss-css-variables
[`postcss-conditionals`]: https://github.com/andyjansson/postcss-conditionals
[`postcss-selector-not`]: https://github.com/postcss/postcss-selector-not
[`postcss-default-unit`]: https://github.com/antyakushev/postcss-default-unit
[`postcss-media-minmax`]: https://github.com/postcss/postcss-media-minmax
[`postcss-merge-idents`]: https://github.com/ben-eb/postcss-merge-idents
[`postcss-custom-media`]: https://github.com/postcss/postcss-custom-media
[`postcss-log-warnings`]: https://github.com/davidtheclark/postcss-log-warnings
[`postcss-brand-colors`]: https://github.com/postcss/postcss-brand-colors
[`postcss-font-variant`]: https://github.com/postcss/postcss-font-variant
[`postcss-will-change`]: https://github.com/postcss/postcss-will-change
[`postcss-merge-rules`]: https://github.com/ben-eb/postcss-merge-rules
[`postcss-simple-vars`]: https://github.com/postcss/postcss-simple-vars
[`postcss-data-packer`]: https://github.com/Ser-Gen/postcss-data-packer
[`postcss-font-family`]: https://github.com/ben-eb/postcss-font-family
[`postcss-color-alpha`]: https://github.com/avanes/postcss-color-alpha
[`postcss-bem-linter`]: https://github.com/necolas/postcss-bem-linter
[`postcss-color-gray`]: https://github.com/postcss/postcss-color-gray
[`postcss-colorblind`]: https://github.com/btholt/postcss-colorblind
[`postcss-color-hwb`]: https://github.com/postcss/postcss-color-hwb
[`postcss-image-set`]: https://github.com/alex499/postcss-image-set
[`postcss-colormin`]: https://github.com/ben-eb/colormin
[`pleeease-filters`]: https://github.com/iamvdo/pleeease-filters
[`postcss-messages`]: https://github.com/postcss/postcss-messages
[`postcss-spiffing`]: https://github.com/HashanP/postcss-spiffing
[`postcss-cssstats`]: https://github.com/cssstats/postcss-cssstats
[`postcss-easings`]: https://github.com/postcss/postcss-easings
[`postcss-opacity`]: https://github.com/iamvdo/postcss-opacity
[`postcss-pxtorem`]: https://github.com/cuth/postcss-pxtorem
[`postcss-assets`]: https://github.com/borodean/postcss-assets
[`postcss-import`]: https://github.com/postcss/postcss-import
[`postcss-nested`]: https://github.com/postcss/postcss-nested
[`postcss-zindex`]: https://github.com/ben-eb/postcss-zindex
[`postcss-mixins`]: https://github.com/postcss/postcss-mixins
[`mq4-hover-shim`]: https://github.com/twbs/mq4-hover-shim
[`list-selectors`]: https://github.com/davidtheclark/list-selectors
[`css2modernizr`]: https://github.com/vovanbo/css2modernizr
[`postcss-focus`]: https://github.com/postcss/postcss-focus
[`postcss-at2x`]: https://github.com/simonsmith/postcss-at2x
[`postcss-neat`]: https://github.com/jo-asakura/postcss-neat
[`autoprefixer`]: https://github.com/postcss/autoprefixer
[`css-mqpacker`]: https://github.com/hail2u/node-css-mqpacker
[`postcss-epub`]: https://github.com/Rycochet/postcss-epub
[`postcss-calc`]: https://github.com/postcss/postcss-calc
[`postcss-size`]: https://github.com/postcss/postcss-size
[`postcss-host`]: https://github.com/vitkarpov/postcss-host
[`postcss-vmin`]: https://github.com/iamvdo/postcss-vmin
[`postcss-url`]: https://github.com/postcss/postcss-url
[`postcss-map`]: https://github.com/pascalduez/postcss-map
[`postcss-for`]: https://github.com/antyakushev/postcss-for
[`css-byebye`]: https://github.com/AoDev/css-byebye
[`cssgrace`]: https://github.com/cssdream/cssgrace
[`csswring`]: https://github.com/hail2u/node-csswring
[`csstyle`]: https://github.com/geddski/csstyle
[`webpcss`]: https://github.com/lexich/webpcss
[`rtlcss`]: https://github.com/MohammadYounes/rtlcss
[`pixrem`]: https://github.com/robwierzbowski/node-pixrem
[`doiuse`]: https://github.com/anandthakker/doiuse
[`lost`]: https://github.com/corysimmons/lost
## How to Develop PostCSS Plugin

@@ -374,0 +401,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc