🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

postcss-ordered-values

Package Overview
Dependencies
Maintainers
4
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-ordered-values - npm Package Compare versions

Comparing version

to
4.0.0

21

dist/index.js

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

// rules
var rules = {
const rules = {
'border': _border2.default,

@@ -53,8 +53,5 @@ 'border-top': _border2.default,

function shouldAbort(parsed) {
var abort = false;
parsed.walk(function (_ref) {
var type = _ref.type,
value = _ref.value;
if (type === 'comment' || type === 'function' && value === 'var' || type === 'word' && ~value.indexOf(`___CSS_LOADER_IMPORT___`)) {
let abort = false;
parsed.walk(({ type, value }) => {
if (type === 'comment' || type === 'function' && value.toLowerCase() === 'var' || type === 'word' && ~value.indexOf(`___CSS_LOADER_IMPORT___`)) {
abort = true;

@@ -67,10 +64,10 @@ return false;

exports.default = _postcss2.default.plugin('postcss-ordered-values', function () {
return function (css) {
css.walkDecls(function (decl) {
var processor = rules[decl.prop];
exports.default = _postcss2.default.plugin('postcss-ordered-values', () => {
return css => {
css.walkDecls(decl => {
const processor = rules[decl.prop.toLowerCase()];
if (!processor) {
return;
}
var parsed = (0, _getParsed2.default)(decl);
const parsed = (0, _getParsed2.default)(decl);
if (parsed.nodes.length < 2 || shouldAbort(parsed)) {

@@ -77,0 +74,0 @@ return;

@@ -15,5 +15,3 @@ 'use strict';

function getParsed(decl) {
var value = decl.value,
raws = decl.raws;
let { value, raws } = decl;
if (raws && raws.value && raws.value.raw) {

@@ -20,0 +18,0 @@ value = raws.value.raw;

@@ -12,4 +12,4 @@ 'use strict';

return (0, _postcssValueParser.stringify)({
nodes: values.reduce(function (nodes, arg, index) {
arg.forEach(function (val, idx) {
nodes: values.reduce((nodes, arg, index) => {
arg.forEach((val, idx) => {
if (idx === arg.length - 1 && index === values.length - 1 && val.type === 'space') {

@@ -16,0 +16,0 @@ return;

@@ -13,19 +13,21 @@ 'use strict';

var borderWidths = ['thin', 'medium', 'thick'];
const borderWidths = ['thin', 'medium', 'thick'];
var borderStyles = ['none', 'auto', // only in outline-style
const borderStyles = ['none', 'auto', // only in outline-style
'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset'];
function normalizeBorder(decl, border) {
var order = { width: '', style: '', color: '' };
border.walk(function (node) {
var type = node.type,
value = node.value;
const order = { width: '', style: '', color: '' };
border.walk(node => {
const { type, value } = node;
if (type === 'word') {
if (~borderStyles.indexOf(value)) {
if (~borderStyles.indexOf(value.toLowerCase())) {
order.style = value;
return false;
}
if (~borderWidths.indexOf(value) || (0, _postcssValueParser.unit)(value)) {
if (~borderWidths.indexOf(value.toLowerCase()) || (0, _postcssValueParser.unit)(value.toLowerCase())) {
if (order.width !== '') {
order.width = `${order.width} ${value}`;
return false;
}
order.width = value;

@@ -38,3 +40,3 @@ return false;

if (type === 'function') {
if (value === 'calc') {
if (value.toLowerCase() === 'calc') {
order.width = (0, _postcssValueParser.stringify)(node);

@@ -41,0 +43,0 @@ } else {

@@ -24,21 +24,17 @@ 'use strict';

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, _cssnanoUtilGetArguments2.default)(parsed);
var abort = false;
let args = (0, _cssnanoUtilGetArguments2.default)(parsed);
let abort = false;
var values = args.reduce(function (list, arg) {
var val = [];
var state = {
let values = args.reduce((list, arg) => {
let val = [];
let state = {
inset: [],
color: []
};
arg.forEach(function (node) {
var type = node.type,
value = node.value;
if (type === 'function' && ~value.indexOf('calc')) {
arg.forEach(node => {
const { type, value } = node;
if (type === 'function' && ~value.toLowerCase().indexOf('calc')) {
abort = true;

@@ -51,10 +47,10 @@ return;

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)()]);
val = [...val, node, (0, _addSpace2.default)()];
} else if (value.toLowerCase() === 'inset') {
state.inset = [...state.inset, node, (0, _addSpace2.default)()];
} else {
state.color = [].concat(_toConsumableArray(state.color), [node, (0, _addSpace2.default)()]);
state.color = [...state.color, node, (0, _addSpace2.default)()];
}
});
return [].concat(_toConsumableArray(list), [[].concat(_toConsumableArray(state.inset), _toConsumableArray(val), _toConsumableArray(state.color))]);
return [...list, [...state.inset, ...val, ...state.color]];
}, []);

@@ -61,0 +57,0 @@

@@ -9,19 +9,17 @@ 'use strict';

var flexDirection = ['row', 'row-reverse', 'column', 'column-reverse'];
const flexDirection = ['row', 'row-reverse', 'column', 'column-reverse'];
var flexWrap = ['nowrap', 'wrap', 'wrap-reverse'];
const flexWrap = ['nowrap', 'wrap', 'wrap-reverse'];
function normalizeFlexFlow(decl, flexFlow) {
var order = {
let order = {
direction: '',
wrap: ''
};
flexFlow.walk(function (_ref) {
var value = _ref.value;
if (~flexDirection.indexOf(value)) {
flexFlow.walk(({ value }) => {
if (~flexDirection.indexOf(value.toLowerCase())) {
order.direction = value;
return;
}
if (~flexWrap.indexOf(value)) {
if (~flexWrap.indexOf(value.toLowerCase())) {
order.wrap = value;

@@ -28,0 +26,0 @@ return;

@@ -24,13 +24,11 @@ 'use strict';

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>
var timingFunctions = ['ease', 'linear', 'ease-in', 'ease-out', 'ease-in-out', 'step-start', 'step-end'];
const timingFunctions = ['ease', 'linear', 'ease-in', 'ease-out', 'ease-in-out', 'step-start', 'step-end'];
function normalizeTransition(decl, parsed) {
var args = (0, _cssnanoUtilGetArguments2.default)(parsed);
let args = (0, _cssnanoUtilGetArguments2.default)(parsed);
var values = args.reduce(function (list, arg) {
var state = {
let values = args.reduce((list, arg) => {
let state = {
timingFunction: [],

@@ -41,24 +39,22 @@ property: [],

};
arg.forEach(function (node) {
var type = node.type,
value = node.value;
arg.forEach(node => {
const { type, value } = node;
if (type === 'space') {
return;
}
if (type === 'function' && ~['steps', 'cubic-bezier'].indexOf(value)) {
state.timingFunction = [].concat(_toConsumableArray(state.timingFunction), [node, (0, _addSpace2.default)()]);
if (type === 'function' && ~['steps', 'cubic-bezier'].indexOf(value.toLowerCase())) {
state.timingFunction = [...state.timingFunction, node, (0, _addSpace2.default)()];
} else if ((0, _postcssValueParser.unit)(value)) {
if (!state.time1.length) {
state.time1 = [].concat(_toConsumableArray(state.time1), [node, (0, _addSpace2.default)()]);
state.time1 = [...state.time1, node, (0, _addSpace2.default)()];
} else {
state.time2 = [].concat(_toConsumableArray(state.time2), [node, (0, _addSpace2.default)()]);
state.time2 = [...state.time2, node, (0, _addSpace2.default)()];
}
} else if (~timingFunctions.indexOf(value)) {
state.timingFunction = [].concat(_toConsumableArray(state.timingFunction), [node, (0, _addSpace2.default)()]);
} else if (~timingFunctions.indexOf(value.toLowerCase())) {
state.timingFunction = [...state.timingFunction, node, (0, _addSpace2.default)()];
} else {
state.property = [].concat(_toConsumableArray(state.property), [node, (0, _addSpace2.default)()]);
state.property = [...state.property, node, (0, _addSpace2.default)()];
}
});
return [].concat(_toConsumableArray(list), [[].concat(_toConsumableArray(state.property), _toConsumableArray(state.time1), _toConsumableArray(state.timingFunction), _toConsumableArray(state.time2))]);
return [...list, [...state.property, ...state.time1, ...state.timingFunction, ...state.time2]];
}, []);

@@ -65,0 +61,0 @@

{
"name": "postcss-ordered-values",
"version": "4.0.0-rc.2",
"version": "4.0.0",
"description": "Ensure values are ordered consistently in your CSS.",

@@ -21,5 +21,5 @@ "main": "dist/index.js",

"babel-cli": "^6.0.0",
"cross-env": "^3.0.0"
"cross-env": "^5.0.0"
},
"homepage": "https://github.com/ben-eb/cssnano",
"homepage": "https://github.com/cssnano/cssnano",
"author": {

@@ -30,5 +30,5 @@ "name": "Ben Briggs",

},
"repository": "ben-eb/cssnano",
"repository": "cssnano/cssnano",
"dependencies": {
"cssnano-util-get-arguments": "^4.0.0-rc.2",
"cssnano-util-get-arguments": "^4.0.0",
"postcss": "^6.0.0",

@@ -38,7 +38,7 @@ "postcss-value-parser": "^3.0.0"

"bugs": {
"url": "https://github.com/ben-eb/cssnano/issues"
"url": "https://github.com/cssnano/cssnano/issues"
},
"engines": {
"node": ">=4"
"node": ">=6.9.0"
}
}

@@ -64,3 +64,3 @@ # [postcss][postcss]-ordered-values

See [CONTRIBUTORS.md](https://github.com/ben-eb/cssnano/blob/master/CONTRIBUTORS.md).
See [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).

@@ -67,0 +67,0 @@