postcss-ordered-values
Advanced tools
Comparing version
@@ -0,1 +1,6 @@ | ||
# 4.0.0-rc.0 | ||
* Breaking: Drops support for Node 0.12, we now require at least Node 4. | ||
* Breaking: Update PostCSS to 6.0.0. | ||
# 2.2.3 | ||
@@ -2,0 +7,0 @@ |
'use strict'; | ||
exports.__esModule = true; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
@@ -55,3 +57,3 @@ var _postcss = require('postcss'); | ||
if (type === 'comment' || type === 'function' && value === 'var' || type === 'word' && ~value.indexOf('___CSS_LOADER_IMPORT___')) { | ||
if (type === 'comment' || type === 'function' && value === 'var' || type === 'word' && ~value.indexOf(`___CSS_LOADER_IMPORT___`)) { | ||
abort = true; | ||
@@ -58,0 +60,0 @@ return false; |
'use strict'; | ||
exports.__esModule = true; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = addSpace; | ||
@@ -5,0 +7,0 @@ function addSpace() { |
'use strict'; | ||
exports.__esModule = true; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = getArguments; | ||
@@ -14,3 +16,2 @@ function getArguments(node) { | ||
}, [[]]); | ||
} | ||
module.exports = exports['default']; | ||
} |
'use strict'; | ||
exports.__esModule = true; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = getParsed; | ||
@@ -5,0 +7,0 @@ |
'use strict'; | ||
exports.__esModule = true; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = getValue; | ||
@@ -18,8 +20,4 @@ | ||
if (index !== values.length - 1) { | ||
if (nodes[nodes.length - 1] && nodes[nodes.length - 1].type === 'space') { | ||
nodes[nodes.length - 1].type = 'div'; | ||
nodes[nodes.length - 1].value = ','; | ||
return nodes; | ||
} | ||
nodes.push({ type: 'div', value: ',' }); | ||
nodes[nodes.length - 1].type = 'div'; | ||
nodes[nodes.length - 1].value = ','; | ||
} | ||
@@ -26,0 +24,0 @@ return nodes; |
'use strict'; | ||
exports.__esModule = true; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = normalizeBorder; | ||
@@ -19,16 +21,19 @@ | ||
border.walk(function (node) { | ||
if (node.type === 'word') { | ||
if (~borderStyles.indexOf(node.value)) { | ||
order.style = node.value; | ||
var type = node.type, | ||
value = node.value; | ||
if (type === 'word') { | ||
if (~borderStyles.indexOf(value)) { | ||
order.style = value; | ||
return false; | ||
} | ||
if (~borderWidths.indexOf(node.value) || (0, _postcssValueParser.unit)(node.value)) { | ||
order.width = node.value; | ||
if (~borderWidths.indexOf(value) || (0, _postcssValueParser.unit)(value)) { | ||
order.width = value; | ||
return false; | ||
} | ||
order.color = node.value; | ||
order.color = value; | ||
return false; | ||
} | ||
if (node.type === 'function') { | ||
if (node.value === 'calc') { | ||
if (type === 'function') { | ||
if (value === 'calc') { | ||
order.width = (0, _postcssValueParser.stringify)(node); | ||
@@ -41,4 +46,4 @@ } else { | ||
}); | ||
decl.value = (order.width + ' ' + order.style + ' ' + order.color).trim(); | ||
decl.value = `${order.width} ${order.style} ${order.color}`.trim(); | ||
}; | ||
module.exports = exports['default']; |
'use strict'; | ||
exports.__esModule = true; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = normalizeBoxShadow; | ||
@@ -8,2 +10,6 @@ | ||
var _cssnanoUtilGetArguments = require('cssnano-util-get-arguments'); | ||
var _cssnanoUtilGetArguments2 = _interopRequireDefault(_cssnanoUtilGetArguments); | ||
var _addSpace = require('../lib/addSpace'); | ||
@@ -13,6 +19,2 @@ | ||
var _getArguments = require('../lib/getArguments'); | ||
var _getArguments2 = _interopRequireDefault(_getArguments); | ||
var _getValue = require('../lib/getValue'); | ||
@@ -24,6 +26,8 @@ | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
// box-shadow: inset? && <length>{2,4} && <color>? | ||
function normalizeBoxShadow(decl, parsed) { | ||
var args = (0, _getArguments2.default)(parsed); | ||
var args = (0, _cssnanoUtilGetArguments2.default)(parsed); | ||
var abort = false; | ||
@@ -38,18 +42,21 @@ | ||
arg.forEach(function (node) { | ||
if (node.type === 'function' && ~node.value.indexOf('calc')) { | ||
var type = node.type, | ||
value = node.value; | ||
if (type === 'function' && ~value.indexOf('calc')) { | ||
abort = true; | ||
return; | ||
} | ||
if (node.type === 'space') { | ||
if (type === 'space') { | ||
return; | ||
} | ||
if ((0, _postcssValueParser.unit)(node.value)) { | ||
val = [].concat(val, [node, (0, _addSpace2.default)()]); | ||
} else if (node.value === 'inset') { | ||
state.inset = [].concat(state.inset, [node, (0, _addSpace2.default)()]); | ||
if ((0, _postcssValueParser.unit)(value)) { | ||
val = [].concat(_toConsumableArray(val), [node, (0, _addSpace2.default)()]); | ||
} else if (value === 'inset') { | ||
state.inset = [].concat(_toConsumableArray(state.inset), [node, (0, _addSpace2.default)()]); | ||
} else { | ||
state.color = [].concat(state.color, [node, (0, _addSpace2.default)()]); | ||
state.color = [].concat(_toConsumableArray(state.color), [node, (0, _addSpace2.default)()]); | ||
} | ||
}); | ||
return [].concat(list, [[].concat(state.inset, val, state.color)]); | ||
return [].concat(_toConsumableArray(list), [[].concat(_toConsumableArray(state.inset), _toConsumableArray(val), _toConsumableArray(state.color))]); | ||
}, []); | ||
@@ -56,0 +63,0 @@ |
'use strict'; | ||
exports.__esModule = true; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = normalizeFlexFlow; | ||
@@ -16,14 +18,16 @@ // flex-flow: <flex-direction> || <flex-wrap> | ||
}; | ||
flexFlow.walk(function (node) { | ||
if (~flexDirection.indexOf(node.value)) { | ||
order.direction = node.value; | ||
flexFlow.walk(function (_ref) { | ||
var value = _ref.value; | ||
if (~flexDirection.indexOf(value)) { | ||
order.direction = value; | ||
return; | ||
} | ||
if (~flexWrap.indexOf(node.value)) { | ||
order.wrap = node.value; | ||
if (~flexWrap.indexOf(value)) { | ||
order.wrap = value; | ||
return; | ||
} | ||
}); | ||
decl.value = (order.direction + ' ' + order.wrap).trim(); | ||
decl.value = `${order.direction} ${order.wrap}`.trim(); | ||
}; | ||
module.exports = exports['default']; |
'use strict'; | ||
exports.__esModule = true; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = normalizeTransition; | ||
@@ -8,2 +10,6 @@ | ||
var _cssnanoUtilGetArguments = require('cssnano-util-get-arguments'); | ||
var _cssnanoUtilGetArguments2 = _interopRequireDefault(_cssnanoUtilGetArguments); | ||
var _addSpace = require('../lib/addSpace'); | ||
@@ -13,6 +19,2 @@ | ||
var _getArguments = require('../lib/getArguments'); | ||
var _getArguments2 = _interopRequireDefault(_getArguments); | ||
var _getValue = require('../lib/getValue'); | ||
@@ -24,2 +26,4 @@ | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
// transition: [ none | <single-transition-property> ] || <time> || <single-transition-timing-function> || <time> | ||
@@ -30,3 +34,3 @@ | ||
function normalizeTransition(decl, parsed) { | ||
var args = (0, _getArguments2.default)(parsed); | ||
var args = (0, _cssnanoUtilGetArguments2.default)(parsed); | ||
@@ -41,20 +45,23 @@ var values = args.reduce(function (list, arg) { | ||
arg.forEach(function (node) { | ||
if (node.type === 'space') { | ||
var type = node.type, | ||
value = node.value; | ||
if (type === 'space') { | ||
return; | ||
} | ||
if (node.type === 'function' && ~['steps', 'cubic-bezier'].indexOf(node.value)) { | ||
state.timingFunction = [].concat(state.timingFunction, [node, (0, _addSpace2.default)()]); | ||
} else if ((0, _postcssValueParser.unit)(node.value)) { | ||
if (type === 'function' && ~['steps', 'cubic-bezier'].indexOf(value)) { | ||
state.timingFunction = [].concat(_toConsumableArray(state.timingFunction), [node, (0, _addSpace2.default)()]); | ||
} else if ((0, _postcssValueParser.unit)(value)) { | ||
if (!state.time1.length) { | ||
state.time1 = [].concat(state.time1, [node, (0, _addSpace2.default)()]); | ||
state.time1 = [].concat(_toConsumableArray(state.time1), [node, (0, _addSpace2.default)()]); | ||
} else { | ||
state.time2 = [].concat(state.time2, [node, (0, _addSpace2.default)()]); | ||
state.time2 = [].concat(_toConsumableArray(state.time2), [node, (0, _addSpace2.default)()]); | ||
} | ||
} else if (~timingFunctions.indexOf(node.value)) { | ||
state.timingFunction = [].concat(state.timingFunction, [node, (0, _addSpace2.default)()]); | ||
} else if (~timingFunctions.indexOf(value)) { | ||
state.timingFunction = [].concat(_toConsumableArray(state.timingFunction), [node, (0, _addSpace2.default)()]); | ||
} else { | ||
state.property = [].concat(state.property, [node, (0, _addSpace2.default)()]); | ||
state.property = [].concat(_toConsumableArray(state.property), [node, (0, _addSpace2.default)()]); | ||
} | ||
}); | ||
return [].concat(list, [[].concat(state.property, state.time1, state.timingFunction, state.time2)]); | ||
return [].concat(_toConsumableArray(list), [[].concat(_toConsumableArray(state.property), _toConsumableArray(state.time1), _toConsumableArray(state.timingFunction), _toConsumableArray(state.time2))]); | ||
}, []); | ||
@@ -61,0 +68,0 @@ |
{ | ||
"name": "postcss-ordered-values", | ||
"version": "2.2.3", | ||
"version": "4.0.0-rc.0", | ||
"description": "Ensure values are ordered consistently in your CSS.", | ||
@@ -11,8 +11,3 @@ "main": "dist/index.js", | ||
"scripts": { | ||
"contributorAdd": "all-contributors add", | ||
"contributorGenerate": "all-contributors generate", | ||
"pretest": "eslint src", | ||
"prepublish": "del-cli dist && BABEL_ENV=publish babel src --out-dir dist --ignore /__tests__/", | ||
"test": "ava", | ||
"test-012": "ava" | ||
"prepublish": "cross-env BABEL_ENV=publish babel src --out-dir dist --ignore /__tests__/" | ||
}, | ||
@@ -26,18 +21,6 @@ "keywords": [ | ||
"devDependencies": { | ||
"all-contributors-cli": "^3.0.5", | ||
"ava": "^0.17.0", | ||
"babel-cli": "^6.3.17", | ||
"babel-core": "^6.3.26", | ||
"babel-plugin-add-module-exports": "^0.2.1", | ||
"babel-preset-es2015": "^6.3.13", | ||
"babel-preset-es2015-loose": "^7.0.0", | ||
"babel-preset-stage-0": "^6.3.13", | ||
"babel-register": "^6.9.0", | ||
"del-cli": "^0.2.0", | ||
"eslint": "^3.0.0", | ||
"eslint-config-cssnano": "^3.0.0", | ||
"eslint-plugin-babel": "^3.3.0", | ||
"eslint-plugin-import": "^2.0.1" | ||
"babel-cli": "^6.0.0", | ||
"cross-env": "^3.0.0" | ||
}, | ||
"homepage": "https://github.com/ben-eb/postcss-ordered-values", | ||
"homepage": "https://github.com/ben-eb/cssnano", | ||
"author": { | ||
@@ -48,13 +31,14 @@ "name": "Ben Briggs", | ||
}, | ||
"repository": "ben-eb/postcss-ordered-values", | ||
"repository": "ben-eb/cssnano", | ||
"dependencies": { | ||
"postcss": "^5.0.4", | ||
"postcss-value-parser": "^3.0.1" | ||
"cssnano-util-get-arguments": "^4.0.0-rc.0", | ||
"postcss": "^6.0.0", | ||
"postcss-value-parser": "^3.0.0" | ||
}, | ||
"ava": { | ||
"require": "babel-register" | ||
"bugs": { | ||
"url": "https://github.com/ben-eb/cssnano/issues" | ||
}, | ||
"eslintConfig": { | ||
"extends": "cssnano" | ||
"engines": { | ||
"node": ">=4" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# [postcss][postcss]-ordered-values [][ci] [][npm] [][deps] | ||
# [postcss][postcss]-ordered-values | ||
@@ -64,13 +64,5 @@ > Ensure values are ordered consistently in your CSS. | ||
Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)): | ||
See [CONTRIBUTORS.md](https://github.com/ben-eb/cssnano/blob/master/CONTRIBUTORS.md). | ||
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> | ||
| [<img src="https://avatars.githubusercontent.com/u/1282980?v=3" width="100px;"/><br /><sub>Ben Briggs</sub>](http://beneb.info)<br />[π»](https://github.com/ben-eb/postcss-ordered-values/commits?author=ben-eb) [π](https://github.com/ben-eb/postcss-ordered-values/commits?author=ben-eb) π [β οΈ](https://github.com/ben-eb/postcss-ordered-values/commits?author=ben-eb) | [<img src="https://avatars.githubusercontent.com/u/2784308?v=3" width="100px;"/><br /><sub>δΈδΈ</sub>](www.iyunlu.com/view)<br />[π»](https://github.com/ben-eb/postcss-ordered-values/commits?author=yisibl) [β οΈ](https://github.com/ben-eb/postcss-ordered-values/commits?author=yisibl) | [<img src="https://avatars.githubusercontent.com/u/5635476?v=3" width="100px;"/><br /><sub>Bogdan Chadkin</sub>](https://github.com/TrySound)<br />[π»](https://github.com/ben-eb/postcss-ordered-values/commits?author=TrySound) [β οΈ](https://github.com/ben-eb/postcss-ordered-values/commits?author=TrySound) | [<img src="https://avatars.githubusercontent.com/u/497260?v=3" width="100px;"/><br /><sub>Ambroos Vaes</sub>](https://github.com/Ambroos)<br />[π](https://github.com/ben-eb/postcss-ordered-values/issues?q=author%3AAmbroos) | | ||
| :---: | :---: | :---: | :---: | | ||
<!-- ALL-CONTRIBUTORS-LIST:END --> | ||
This project follows the [all-contributors] specification. Contributions of | ||
any kind welcome! | ||
## License | ||
@@ -80,7 +72,2 @@ | ||
[all-contributors]: https://github.com/kentcdodds/all-contributors | ||
[ci]: https://travis-ci.org/ben-eb/postcss-ordered-values | ||
[deps]: https://gemnasium.com/ben-eb/postcss-ordered-values | ||
[npm]: http://badge.fury.io/js/postcss-ordered-values | ||
[postcss]: https://github.com/postcss/postcss |
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
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
2
-85.71%283
8.43%0
-100%16242
-7.77%3
50%72
-15.29%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated