format: prettify entire project
This commit is contained in:
54
node_modules/clean-css/lib/options/compatibility.js
generated
vendored
54
node_modules/clean-css/lib/options/compatibility.js
generated
vendored
@ -1,7 +1,7 @@
|
||||
var DEFAULTS = {
|
||||
'*': {
|
||||
colors: {
|
||||
opacity: true // rgba / hsla
|
||||
opacity: true, // rgba / hsla
|
||||
},
|
||||
properties: {
|
||||
backgroundClipMerging: true, // background-clip to shorthand
|
||||
@ -16,7 +16,7 @@ var DEFAULTS = {
|
||||
shorterLengthUnits: false, // optimize pixel units into `pt`, `pc` or `in` units
|
||||
spaceAfterClosingBrace: true, // 'url() no-repeat' to 'url()no-repeat'
|
||||
urlQuotes: false, // whether to wrap content of `url()` into quotes or not
|
||||
zeroUnits: true // 0[unit] -> 0
|
||||
zeroUnits: true, // 0[unit] -> 0
|
||||
},
|
||||
selectors: {
|
||||
adjacentSpace: false, // div+ nav Android stock browser hack
|
||||
@ -49,16 +49,16 @@ var DEFAULTS = {
|
||||
':only-of-type',
|
||||
':root',
|
||||
':target',
|
||||
':visited'
|
||||
':visited',
|
||||
], // selectors with these pseudo-classes can be merged as these are universally supported
|
||||
mergeablePseudoElements: [
|
||||
'::after',
|
||||
'::before',
|
||||
'::first-letter',
|
||||
'::first-line'
|
||||
'::first-line',
|
||||
], // selectors with these pseudo-elements can be merged as these are universally supported
|
||||
mergeLimit: 8191, // number of rules that can be safely merged together
|
||||
multiplePseudoMerging: true
|
||||
multiplePseudoMerging: true,
|
||||
},
|
||||
units: {
|
||||
ch: true,
|
||||
@ -70,9 +70,9 @@ var DEFAULTS = {
|
||||
vm: true, // vm is vmin on IE9+ see https://developer.mozilla.org/en-US/docs/Web/CSS/length
|
||||
vmax: true,
|
||||
vmin: true,
|
||||
vw: true
|
||||
}
|
||||
}
|
||||
vw: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
DEFAULTS.ie11 = DEFAULTS['*'];
|
||||
@ -82,20 +82,20 @@ DEFAULTS.ie10 = DEFAULTS['*'];
|
||||
DEFAULTS.ie9 = merge(DEFAULTS['*'], {
|
||||
properties: {
|
||||
ieFilters: true,
|
||||
ieSuffixHack: true
|
||||
}
|
||||
ieSuffixHack: true,
|
||||
},
|
||||
});
|
||||
|
||||
DEFAULTS.ie8 = merge(DEFAULTS.ie9, {
|
||||
colors: {
|
||||
opacity: false
|
||||
opacity: false,
|
||||
},
|
||||
properties: {
|
||||
backgroundClipMerging: false,
|
||||
backgroundOriginMerging: false,
|
||||
backgroundSizeMerging: false,
|
||||
iePrefixHack: true,
|
||||
merging: false
|
||||
merging: false,
|
||||
},
|
||||
selectors: {
|
||||
mergeablePseudoClasses: [
|
||||
@ -105,9 +105,9 @@ DEFAULTS.ie8 = merge(DEFAULTS.ie9, {
|
||||
':first-letter',
|
||||
':focus',
|
||||
':hover',
|
||||
':visited'
|
||||
':visited',
|
||||
],
|
||||
mergeablePseudoElements: []
|
||||
mergeablePseudoElements: [],
|
||||
},
|
||||
units: {
|
||||
ch: false,
|
||||
@ -116,13 +116,13 @@ DEFAULTS.ie8 = merge(DEFAULTS.ie9, {
|
||||
vm: false,
|
||||
vmax: false,
|
||||
vmin: false,
|
||||
vw: false
|
||||
}
|
||||
vw: false,
|
||||
},
|
||||
});
|
||||
|
||||
DEFAULTS.ie7 = merge(DEFAULTS.ie8, {
|
||||
properties: {
|
||||
ieBangHack: true
|
||||
ieBangHack: true,
|
||||
},
|
||||
selectors: {
|
||||
ie7Hack: true,
|
||||
@ -130,8 +130,8 @@ DEFAULTS.ie7 = merge(DEFAULTS.ie8, {
|
||||
':first-child',
|
||||
':first-letter',
|
||||
':hover',
|
||||
':visited'
|
||||
]
|
||||
':visited',
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
@ -144,7 +144,11 @@ function merge(source, target) {
|
||||
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
||||
var value = source[key];
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(target, key) && typeof value === 'object' && !Array.isArray(value)) {
|
||||
if (
|
||||
Object.prototype.hasOwnProperty.call(target, key) &&
|
||||
typeof value === 'object' &&
|
||||
!Array.isArray(value)
|
||||
) {
|
||||
target[key] = merge(value, target[key] || {});
|
||||
} else {
|
||||
target[key] = key in target ? target[key] : value;
|
||||
@ -156,16 +160,12 @@ function merge(source, target) {
|
||||
}
|
||||
|
||||
function calculateSource(source) {
|
||||
if (typeof source == 'object')
|
||||
return source;
|
||||
if (typeof source == 'object') return source;
|
||||
|
||||
if (!/[,\+\-]/.test(source))
|
||||
return DEFAULTS[source] || DEFAULTS['*'];
|
||||
if (!/[,\+\-]/.test(source)) return DEFAULTS[source] || DEFAULTS['*'];
|
||||
|
||||
var parts = source.split(',');
|
||||
var template = parts[0] in DEFAULTS ?
|
||||
DEFAULTS[parts.shift()] :
|
||||
DEFAULTS['*'];
|
||||
var template = parts[0] in DEFAULTS ? DEFAULTS[parts.shift()] : DEFAULTS['*'];
|
||||
|
||||
source = {};
|
||||
|
||||
|
73
node_modules/clean-css/lib/options/format.js
generated
vendored
73
node_modules/clean-css/lib/options/format.js
generated
vendored
@ -11,24 +11,24 @@ var Breaks = {
|
||||
AfterRuleBegins: 'afterRuleBegins',
|
||||
AfterRuleEnds: 'afterRuleEnds',
|
||||
BeforeBlockEnds: 'beforeBlockEnds',
|
||||
BetweenSelectors: 'betweenSelectors'
|
||||
BetweenSelectors: 'betweenSelectors',
|
||||
};
|
||||
|
||||
var BreakWith = {
|
||||
CarriageReturnLineFeed: '\r\n',
|
||||
LineFeed: '\n',
|
||||
System: systemLineBreak
|
||||
System: systemLineBreak,
|
||||
};
|
||||
|
||||
var IndentWith = {
|
||||
Space: ' ',
|
||||
Tab: '\t'
|
||||
Tab: '\t',
|
||||
};
|
||||
|
||||
var Spaces = {
|
||||
AroundSelectorRelation: 'aroundSelectorRelation',
|
||||
BeforeBlockBegins: 'beforeBlockBegins',
|
||||
BeforeValue: 'beforeValue'
|
||||
BeforeValue: 'beforeValue',
|
||||
};
|
||||
|
||||
var DEFAULTS = {
|
||||
@ -38,7 +38,7 @@ var DEFAULTS = {
|
||||
indentWith: IndentWith.Space,
|
||||
spaces: spaces(false),
|
||||
wrapAt: false,
|
||||
semicolonAfterLastProperty: false
|
||||
semicolonAfterLastProperty: false,
|
||||
};
|
||||
|
||||
var BEAUTIFY_ALIAS = 'beautify';
|
||||
@ -109,7 +109,7 @@ function formatFrom(source) {
|
||||
return override(DEFAULTS, {
|
||||
breaks: breaks(true),
|
||||
indentBy: 2,
|
||||
spaces: spaces(true)
|
||||
spaces: spaces(true),
|
||||
});
|
||||
}
|
||||
|
||||
@ -121,8 +121,8 @@ function formatFrom(source) {
|
||||
afterBlockEnds: true,
|
||||
afterComment: true,
|
||||
afterRuleEnds: true,
|
||||
beforeBlockEnds: true
|
||||
}
|
||||
beforeBlockEnds: true,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@ -134,42 +134,43 @@ function formatFrom(source) {
|
||||
}
|
||||
|
||||
function toHash(string) {
|
||||
return string
|
||||
.split(OPTION_SEPARATOR)
|
||||
.reduce(function (accumulator, directive) {
|
||||
var parts = directive.split(OPTION_NAME_VALUE_SEPARATOR);
|
||||
var name = parts[0];
|
||||
var value = parts[1];
|
||||
return string.split(OPTION_SEPARATOR).reduce(function (
|
||||
accumulator,
|
||||
directive
|
||||
) {
|
||||
var parts = directive.split(OPTION_NAME_VALUE_SEPARATOR);
|
||||
var name = parts[0];
|
||||
var value = parts[1];
|
||||
|
||||
if (name == 'breaks' || name == 'spaces') {
|
||||
accumulator[name] = hashValuesToHash(value);
|
||||
} else if (name == 'indentBy' || name == 'wrapAt') {
|
||||
accumulator[name] = parseInt(value);
|
||||
} else if (name == 'indentWith') {
|
||||
accumulator[name] = mapIndentWith(value);
|
||||
} else if (name == 'breakWith') {
|
||||
accumulator[name] = mapBreakWith(value);
|
||||
}
|
||||
if (name == 'breaks' || name == 'spaces') {
|
||||
accumulator[name] = hashValuesToHash(value);
|
||||
} else if (name == 'indentBy' || name == 'wrapAt') {
|
||||
accumulator[name] = parseInt(value);
|
||||
} else if (name == 'indentWith') {
|
||||
accumulator[name] = mapIndentWith(value);
|
||||
} else if (name == 'breakWith') {
|
||||
accumulator[name] = mapBreakWith(value);
|
||||
}
|
||||
|
||||
return accumulator;
|
||||
}, {});
|
||||
return accumulator;
|
||||
}, {});
|
||||
}
|
||||
|
||||
function hashValuesToHash(string) {
|
||||
return string
|
||||
.split(HASH_VALUES_OPTION_SEPARATOR)
|
||||
.reduce(function (accumulator, directive) {
|
||||
var parts = directive.split(HASH_VALUES_NAME_VALUE_SEPARATOR);
|
||||
var name = parts[0];
|
||||
var value = parts[1];
|
||||
return string.split(HASH_VALUES_OPTION_SEPARATOR).reduce(function (
|
||||
accumulator,
|
||||
directive
|
||||
) {
|
||||
var parts = directive.split(HASH_VALUES_NAME_VALUE_SEPARATOR);
|
||||
var name = parts[0];
|
||||
var value = parts[1];
|
||||
|
||||
accumulator[name] = normalizeValue(value);
|
||||
accumulator[name] = normalizeValue(value);
|
||||
|
||||
return accumulator;
|
||||
}, {});
|
||||
return accumulator;
|
||||
}, {});
|
||||
}
|
||||
|
||||
|
||||
function normalizeValue(value) {
|
||||
switch (value) {
|
||||
case FALSE_KEYWORD_1:
|
||||
@ -212,5 +213,5 @@ function mapIndentWith(value) {
|
||||
module.exports = {
|
||||
Breaks: Breaks,
|
||||
Spaces: Spaces,
|
||||
formatFrom: formatFrom
|
||||
formatFrom: formatFrom,
|
||||
};
|
||||
|
10
node_modules/clean-css/lib/options/inline-request.js
generated
vendored
10
node_modules/clean-css/lib/options/inline-request.js
generated
vendored
@ -12,11 +12,11 @@ function inlineRequestFrom(option) {
|
||||
|
||||
function proxyOptionsFrom(httpProxy) {
|
||||
return httpProxy ?
|
||||
{
|
||||
hostname: url.parse(httpProxy).hostname,
|
||||
port: parseInt(url.parse(httpProxy).port)
|
||||
} :
|
||||
{};
|
||||
{
|
||||
hostname: url.parse(httpProxy).hostname,
|
||||
port: parseInt(url.parse(httpProxy).port),
|
||||
}
|
||||
: {};
|
||||
}
|
||||
|
||||
module.exports = inlineRequestFrom;
|
||||
|
4
node_modules/clean-css/lib/options/inline.js
generated
vendored
4
node_modules/clean-css/lib/options/inline.js
generated
vendored
@ -7,9 +7,7 @@ function inlineOptionsFrom(rules) {
|
||||
return ['none'];
|
||||
}
|
||||
|
||||
return undefined === rules ?
|
||||
['local'] :
|
||||
rules.split(',');
|
||||
return undefined === rules ? ['local'] : rules.split(',');
|
||||
}
|
||||
|
||||
module.exports = inlineOptionsFrom;
|
||||
|
77
node_modules/clean-css/lib/options/optimization-level.js
generated
vendored
77
node_modules/clean-css/lib/options/optimization-level.js
generated
vendored
@ -1,11 +1,12 @@
|
||||
var roundingPrecisionFrom = require('./rounding-precision').roundingPrecisionFrom;
|
||||
var roundingPrecisionFrom =
|
||||
require('./rounding-precision').roundingPrecisionFrom;
|
||||
|
||||
var override = require('../utils/override');
|
||||
|
||||
var OptimizationLevel = {
|
||||
Zero: '0',
|
||||
One: '1',
|
||||
Two: '2'
|
||||
Two: '2',
|
||||
};
|
||||
|
||||
var DEFAULTS = {};
|
||||
@ -32,7 +33,7 @@ DEFAULTS[OptimizationLevel.One] = {
|
||||
tidyAtRules: true,
|
||||
tidyBlockScopes: true,
|
||||
tidySelectors: true,
|
||||
transform: noop
|
||||
transform: noop,
|
||||
};
|
||||
DEFAULTS[OptimizationLevel.Two] = {
|
||||
mergeAdjacentRules: true,
|
||||
@ -48,7 +49,7 @@ DEFAULTS[OptimizationLevel.Two] = {
|
||||
removeDuplicateRules: true,
|
||||
removeUnusedAtRules: false,
|
||||
restructureRules: false,
|
||||
skipProperties: []
|
||||
skipProperties: [],
|
||||
};
|
||||
|
||||
var ALL_KEYWORD_1 = '*';
|
||||
@ -70,7 +71,6 @@ function optimizationLevelFrom(source) {
|
||||
var One = OptimizationLevel.One;
|
||||
var Two = OptimizationLevel.Two;
|
||||
|
||||
|
||||
if (undefined === source) {
|
||||
delete level[Two];
|
||||
return level;
|
||||
@ -100,11 +100,18 @@ function optimizationLevelFrom(source) {
|
||||
}
|
||||
|
||||
if (One in source && 'roundingPrecision' in source[One]) {
|
||||
source[One].roundingPrecision = roundingPrecisionFrom(source[One].roundingPrecision);
|
||||
source[One].roundingPrecision = roundingPrecisionFrom(
|
||||
source[One].roundingPrecision
|
||||
);
|
||||
}
|
||||
|
||||
if (Two in source && 'skipProperties' in source[Two] && typeof(source[Two].skipProperties) == 'string') {
|
||||
source[Two].skipProperties = source[Two].skipProperties.split(LIST_VALUE_SEPARATOR);
|
||||
if (
|
||||
Two in source &&
|
||||
'skipProperties' in source[Two] &&
|
||||
typeof source[Two].skipProperties == 'string'
|
||||
) {
|
||||
source[Two].skipProperties =
|
||||
source[Two].skipProperties.split(LIST_VALUE_SEPARATOR);
|
||||
}
|
||||
|
||||
if (Zero in source || One in source || Two in source) {
|
||||
@ -112,12 +119,18 @@ function optimizationLevelFrom(source) {
|
||||
}
|
||||
|
||||
if (One in source && ALL_KEYWORD_1 in source[One]) {
|
||||
level[One] = override(level[One], defaults(One, normalizeValue(source[One][ALL_KEYWORD_1])));
|
||||
level[One] = override(
|
||||
level[One],
|
||||
defaults(One, normalizeValue(source[One][ALL_KEYWORD_1]))
|
||||
);
|
||||
delete source[One][ALL_KEYWORD_1];
|
||||
}
|
||||
|
||||
if (One in source && ALL_KEYWORD_2 in source[One]) {
|
||||
level[One] = override(level[One], defaults(One, normalizeValue(source[One][ALL_KEYWORD_2])));
|
||||
level[One] = override(
|
||||
level[One],
|
||||
defaults(One, normalizeValue(source[One][ALL_KEYWORD_2]))
|
||||
);
|
||||
delete source[One][ALL_KEYWORD_2];
|
||||
}
|
||||
|
||||
@ -128,12 +141,18 @@ function optimizationLevelFrom(source) {
|
||||
}
|
||||
|
||||
if (Two in source && ALL_KEYWORD_1 in source[Two]) {
|
||||
level[Two] = override(level[Two], defaults(Two, normalizeValue(source[Two][ALL_KEYWORD_1])));
|
||||
level[Two] = override(
|
||||
level[Two],
|
||||
defaults(Two, normalizeValue(source[Two][ALL_KEYWORD_1]))
|
||||
);
|
||||
delete source[Two][ALL_KEYWORD_1];
|
||||
}
|
||||
|
||||
if (Two in source && ALL_KEYWORD_2 in source[Two]) {
|
||||
level[Two] = override(level[Two], defaults(Two, normalizeValue(source[Two][ALL_KEYWORD_2])));
|
||||
level[Two] = override(
|
||||
level[Two],
|
||||
defaults(Two, normalizeValue(source[Two][ALL_KEYWORD_2]))
|
||||
);
|
||||
delete source[Two][ALL_KEYWORD_2];
|
||||
}
|
||||
|
||||
@ -180,7 +199,10 @@ function covertValuesToHashes(source) {
|
||||
for (i = 0; i <= 2; i++) {
|
||||
level = '' + i;
|
||||
|
||||
if (level in clonedSource && (clonedSource[level] === undefined || clonedSource[level] === false)) {
|
||||
if (
|
||||
level in clonedSource &&
|
||||
(clonedSource[level] === undefined || clonedSource[level] === false)
|
||||
) {
|
||||
delete clonedSource[level];
|
||||
}
|
||||
|
||||
@ -197,22 +219,23 @@ function covertValuesToHashes(source) {
|
||||
}
|
||||
|
||||
function covertToHash(asString, level) {
|
||||
return asString
|
||||
.split(OPTION_SEPARATOR)
|
||||
.reduce(function (accumulator, directive) {
|
||||
var parts = directive.split(OPTION_VALUE_SEPARATOR);
|
||||
var name = parts[0];
|
||||
var value = parts[1];
|
||||
var normalizedValue = normalizeValue(value);
|
||||
return asString.split(OPTION_SEPARATOR).reduce(function (
|
||||
accumulator,
|
||||
directive
|
||||
) {
|
||||
var parts = directive.split(OPTION_VALUE_SEPARATOR);
|
||||
var name = parts[0];
|
||||
var value = parts[1];
|
||||
var normalizedValue = normalizeValue(value);
|
||||
|
||||
if (ALL_KEYWORD_1 == name || ALL_KEYWORD_2 == name) {
|
||||
accumulator = override(accumulator, defaults(level, normalizedValue));
|
||||
} else {
|
||||
accumulator[name] = normalizedValue;
|
||||
}
|
||||
if (ALL_KEYWORD_1 == name || ALL_KEYWORD_2 == name) {
|
||||
accumulator = override(accumulator, defaults(level, normalizedValue));
|
||||
} else {
|
||||
accumulator[name] = normalizedValue;
|
||||
}
|
||||
|
||||
return accumulator;
|
||||
}, {});
|
||||
return accumulator;
|
||||
}, {});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
67
node_modules/clean-css/lib/options/rounding-precision.js
generated
vendored
67
node_modules/clean-css/lib/options/rounding-precision.js
generated
vendored
@ -13,22 +13,22 @@ function roundingPrecisionFrom(source) {
|
||||
|
||||
function defaults(value) {
|
||||
return {
|
||||
'ch': value,
|
||||
'cm': value,
|
||||
'em': value,
|
||||
'ex': value,
|
||||
'in': value,
|
||||
'mm': value,
|
||||
'pc': value,
|
||||
'pt': value,
|
||||
'px': value,
|
||||
'q': value,
|
||||
'rem': value,
|
||||
'vh': value,
|
||||
'vmax': value,
|
||||
'vmin': value,
|
||||
'vw': value,
|
||||
'%': value
|
||||
ch: value,
|
||||
cm: value,
|
||||
em: value,
|
||||
ex: value,
|
||||
in: value,
|
||||
mm: value,
|
||||
pc: value,
|
||||
pt: value,
|
||||
px: value,
|
||||
q: value,
|
||||
rem: value,
|
||||
vh: value,
|
||||
vmax: value,
|
||||
vmin: value,
|
||||
vw: value,
|
||||
'%': value,
|
||||
};
|
||||
}
|
||||
|
||||
@ -61,28 +61,29 @@ function buildPrecisionFrom(source) {
|
||||
return source;
|
||||
}
|
||||
|
||||
return source
|
||||
.split(DIRECTIVES_SEPARATOR)
|
||||
.reduce(function (accumulator, directive) {
|
||||
var directiveParts = directive.split(DIRECTIVE_VALUE_SEPARATOR);
|
||||
var name = directiveParts[0];
|
||||
var value = parseInt(directiveParts[1]);
|
||||
return source.split(DIRECTIVES_SEPARATOR).reduce(function (
|
||||
accumulator,
|
||||
directive
|
||||
) {
|
||||
var directiveParts = directive.split(DIRECTIVE_VALUE_SEPARATOR);
|
||||
var name = directiveParts[0];
|
||||
var value = parseInt(directiveParts[1]);
|
||||
|
||||
if (isNaN(value) || value == -1) {
|
||||
value = DEFAULT_PRECISION;
|
||||
}
|
||||
if (isNaN(value) || value == -1) {
|
||||
value = DEFAULT_PRECISION;
|
||||
}
|
||||
|
||||
if (ALL_UNITS.indexOf(name) > -1) {
|
||||
accumulator = override(accumulator, defaults(value));
|
||||
} else {
|
||||
accumulator[name] = value;
|
||||
}
|
||||
if (ALL_UNITS.indexOf(name) > -1) {
|
||||
accumulator = override(accumulator, defaults(value));
|
||||
} else {
|
||||
accumulator[name] = value;
|
||||
}
|
||||
|
||||
return accumulator;
|
||||
}, {});
|
||||
return accumulator;
|
||||
}, {});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
DEFAULT: DEFAULT_PRECISION,
|
||||
roundingPrecisionFrom: roundingPrecisionFrom
|
||||
roundingPrecisionFrom: roundingPrecisionFrom,
|
||||
};
|
||||
|
Reference in New Issue
Block a user