From bbff7403fbf46f9ad92240ac213df8d30ef31b64 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 20 Sep 2018 02:56:13 +0200 Subject: update packages --- node_modules/clean-css/lib/options/format.js | 33 +++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'node_modules/clean-css/lib/options') diff --git a/node_modules/clean-css/lib/options/format.js b/node_modules/clean-css/lib/options/format.js index afcf5c967..48c7efa8e 100644 --- a/node_modules/clean-css/lib/options/format.js +++ b/node_modules/clean-css/lib/options/format.js @@ -1,3 +1,5 @@ +var systemLineBreak = require('os').EOL; + var override = require('../utils/override'); var Breaks = { @@ -12,6 +14,12 @@ var Breaks = { BetweenSelectors: 'betweenSelectors' }; +var BreakWith = { + CarriageReturnLineFeed: '\r\n', + LineFeed: '\n', + System: systemLineBreak +}; + var IndentWith = { Space: ' ', Tab: '\t' @@ -25,10 +33,12 @@ var Spaces = { var DEFAULTS = { breaks: breaks(false), + breakWith: BreakWith.System, indentBy: 0, indentWith: IndentWith.Space, spaces: spaces(false), - wrapAt: false + wrapAt: false, + semicolonAfterLastProperty: false }; var BEAUTIFY_ALIAS = 'beautify'; @@ -75,6 +85,10 @@ function formatFrom(source) { return false; } + if (typeof source == 'object' && 'breakWith' in source) { + source = override(source, { breakWith: mapBreakWith(source.breakWith) }); + } + if (typeof source == 'object' && 'indentBy' in source) { source = override(source, { indentBy: parseInt(source.indentBy) }); } @@ -133,6 +147,8 @@ function toHash(string) { accumulator[name] = parseInt(value); } else if (name == 'indentWith') { accumulator[name] = mapIndentWith(value); + } else if (name == 'breakWith') { + accumulator[name] = mapBreakWith(value); } return accumulator; @@ -167,6 +183,21 @@ function normalizeValue(value) { } } +function mapBreakWith(value) { + switch (value) { + case 'windows': + case 'crlf': + case BreakWith.CarriageReturnLineFeed: + return BreakWith.CarriageReturnLineFeed; + case 'unix': + case 'lf': + case BreakWith.LineFeed: + return BreakWith.LineFeed; + default: + return systemLineBreak; + } +} + function mapIndentWith(value) { switch (value) { case 'space': -- cgit v1.2.3