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

postcss-apply

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-apply - npm Package Compare versions

Comparing version 0.6.1 to 0.7.0

10

CHANGELOG.md

@@ -11,2 +11,9 @@ # postcss-apply change Log

## [0.7.0] - 2017-05-08
### Changed
* PostCSS 6 upgrade.
### Fixed
* Polyfill `Object.entries` for node versions lower than 7.
## [0.6.1] - 2017-03-10

@@ -49,3 +56,4 @@ ### Fixed

[Unreleased]: https://github.com/pascalduez/postcss-apply/compare/0.6.1...HEAD
[Unreleased]: https://github.com/pascalduez/postcss-apply/compare/0.7.0...HEAD
[0.7.0]: https://github.com/pascalduez/postcss-apply/compare/0.6.1...0.7.0
[0.6.1]: https://github.com/pascalduez/postcss-apply/compare/0.6.0...0.6.1

@@ -52,0 +60,0 @@ [0.6.0]: https://github.com/pascalduez/postcss-apply/compare/0.5.0...0.6.0

@@ -7,2 +7,6 @@ 'use strict';

var _entries = require('babel-runtime/core-js/object/entries');
var _entries2 = _interopRequireDefault(_entries);
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

@@ -27,2 +31,3 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/* eslint-disable no-param-reassign */

@@ -52,3 +57,3 @@ var RE_PROP_SET = /^(--)([\w-]+)(\s*)([:]?)$/;

// $FlowFixMe
Object.entries(sets[setName]).forEach(function (_ref) {
(0, _entries2.default)(sets[setName]).forEach(function (_ref) {
var _ref2 = _slicedToArray(_ref, 2),

@@ -92,3 +97,3 @@ prop = _ref2[0],

if (!_this.options.preserve) {
rule.remove();
safeRemoveRule(rule);
}

@@ -105,2 +110,4 @@

_this.resolve(atRule);
// @TODO honor `preserve` option.
atRule.remove();

@@ -139,4 +146,7 @@ });

var newRule = _this.cache[setName].clone();
cleanIndent(newRule);
if (_this.options.preserve) {
parent.insertBefore(atRule, _this.cache[setName].nodes);
parent.insertBefore(atRule, newRule.nodes);

@@ -146,3 +156,3 @@ return;

atRule.replaceWith(_this.cache[setName].nodes);
atRule.replaceWith(newRule.nodes);
};

@@ -185,3 +195,3 @@

/**
* Helper: allow parens usage in `@apply` rule declaration.
* Helper: allow parens usage in `@apply` AtRule declaration.
* This is for Polymer integration.

@@ -192,2 +202,25 @@ */

);
}
/**
* Helper: remove excessive declarations indentation.
*/
function cleanIndent(rule) {
rule.walkDecls(function (decl) {
if (typeof decl.raws.before === 'string') {
decl.raws.before = decl.raws.before.replace(/[^\S\x0a\x0d]{2,}/, ' ');
}
});
}
/**
* Helper: correctly handle property sets removal and semi-colons.
* @See: postcss/postcss#1014
*/
function safeRemoveRule(rule) {
if (rule === rule.parent.last && rule.raws.ownSemicolon) {
rule.parent.raws.semicolon = true;
}
rule.remove();
}

26

package.json
{
"name": "postcss-apply",
"version": "0.6.1",
"version": "0.7.0",
"description": "PostCSS plugin enabling custom properties sets references",

@@ -51,21 +51,23 @@ "keywords": [

"dependencies": {
"babel-runtime": "^6.23.0",
"balanced-match": "^0.4.2",
"postcss": "^5.2.15"
"postcss": "^6.0.0"
},
"devDependencies": {
"babel-cli": "^6.23.0",
"babel-eslint": "^7.1.1",
"babel-plugin-transform-class-properties": "^6.23.0",
"babel-cli": "^6.24.1",
"babel-eslint": "^7.2.3",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-entries": "^1.0.0",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-preset-env": "^1.2.1",
"babel-preset-env": "^1.4.0",
"babel-preset-flow": "^6.23.0",
"common-tags": "^1.4.0",
"eslint": "^3.17.1",
"eslint-config-airbnb-base": "^11.1.1",
"eslint-plugin-flowtype": "^2.30.2",
"eslint": "^3.19.0",
"eslint-config-airbnb-base": "^11.1.3",
"eslint-plugin-flowtype": "^2.32.1",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jest": "^19.0.1",
"flow-bin": "^0.41.0",
"eslint-plugin-jest": "^20.0.0",
"flow-bin": "^0.45.0",
"flow-coverage-report": "^0.3.0",
"jest-cli": "^19.0.2",
"jest-cli": "^20.0.0",
"npm-run-all": "^4.0.2",

@@ -72,0 +74,0 @@ "opn-cli": "^3.1.0",

@@ -8,3 +8,3 @@ # postcss-apply

> [PostCSS] plugin enabling custom properties sets references
> [PostCSS] plugin enabling custom property sets references

@@ -16,2 +16,7 @@ Aka `@apply rule`.

#### /!\ Heads up
The `@apply` rule and custom property sets most likely won't get any real support from browser vendors and the spec is yet considered deprecated.
See:
* https://discourse.wicg.io/t/needed-new-champion-for-css-apply-rule/2012
* https://github.com/w3c/webcomponents/issues/300#issuecomment-276210974

@@ -18,0 +23,0 @@ ## Installation

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