1
0
mirror of https://github.com/S2-/minifyfromhtml.git synced 2025-08-04 04:40:05 +02:00

update packages to latest version

This commit is contained in:
s2
2022-08-20 18:51:33 +02:00
parent 09663a35a5
commit 806ebf9a57
4513 changed files with 366205 additions and 92512 deletions

View File

@@ -4,9 +4,7 @@ var DEFAULTS = {
hexAlpha: false, // 4- and 8-character hex notation
opacity: true // rgba / hsla
},
customUnits: {
rpx: false
},
customUnits: { rpx: false },
properties: {
backgroundClipMerging: true, // background-clip to shorthand
backgroundOriginMerging: true, // background-origin to shorthand
@@ -79,17 +77,9 @@ var DEFAULTS = {
}
};
DEFAULTS.ie11 = merge(DEFAULTS['*'], {
properties: {
ieSuffixHack: true
}
});
DEFAULTS.ie11 = merge(DEFAULTS['*'], { properties: { ieSuffixHack: true } });
DEFAULTS.ie10 = merge(DEFAULTS['*'], {
properties: {
ieSuffixHack: true
}
});
DEFAULTS.ie10 = merge(DEFAULTS['*'], { properties: { ieSuffixHack: true } });
DEFAULTS.ie9 = merge(DEFAULTS['*'], {
properties: {
@@ -99,9 +89,7 @@ DEFAULTS.ie9 = merge(DEFAULTS['*'], {
});
DEFAULTS.ie8 = merge(DEFAULTS.ie9, {
colors: {
opacity: false
},
colors: { opacity: false },
properties: {
backgroundClipMerging: false,
backgroundOriginMerging: false,
@@ -133,9 +121,7 @@ DEFAULTS.ie8 = merge(DEFAULTS.ie9, {
});
DEFAULTS.ie7 = merge(DEFAULTS.ie8, {
properties: {
ieBangHack: true
},
properties: { ieBangHack: true },
selectors: {
ie7Hack: true,
mergeablePseudoClasses: [
@@ -144,7 +130,7 @@ DEFAULTS.ie7 = merge(DEFAULTS.ie8, {
':hover',
':visited'
]
},
}
});
function compatibilityFrom(source) {
@@ -153,12 +139,14 @@ function compatibilityFrom(source) {
function merge(source, target) {
for (var key in source) {
var value = source[key];
if (Object.prototype.hasOwnProperty.call(source, key)) {
var value = source[key];
if (typeof value === 'object' && !Array.isArray(value)) {
target[key] = merge(value, target[key] || {});
} else {
target[key] = key in target ? target[key] : 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;
}
}
}
@@ -166,20 +154,18 @@ 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 = {};
parts.forEach(function (part) {
parts.forEach(function(part) {
var isAdd = part[0] == '+';
var key = part.substring(1).split('.');
var group = key[0];

View File

@@ -136,7 +136,7 @@ function formatFrom(source) {
function toHash(string) {
return string
.split(OPTION_SEPARATOR)
.reduce(function (accumulator, directive) {
.reduce(function(accumulator, directive) {
var parts = directive.split(OPTION_NAME_VALUE_SEPARATOR);
var name = parts[0];
var value = parts[1];
@@ -158,7 +158,7 @@ function toHash(string) {
function hashValuesToHash(string) {
return string
.split(HASH_VALUES_OPTION_SEPARATOR)
.reduce(function (accumulator, directive) {
.reduce(function(accumulator, directive) {
var parts = directive.split(HASH_VALUES_NAME_VALUE_SEPARATOR);
var name = parts[0];
var value = parts[1];
@@ -169,43 +169,42 @@ function hashValuesToHash(string) {
}, {});
}
function normalizeValue(value) {
switch (value) {
case FALSE_KEYWORD_1:
case FALSE_KEYWORD_2:
return false;
case TRUE_KEYWORD_1:
case TRUE_KEYWORD_2:
return true;
default:
return value;
case FALSE_KEYWORD_1:
case FALSE_KEYWORD_2:
return false;
case TRUE_KEYWORD_1:
case TRUE_KEYWORD_2:
return true;
default:
return 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;
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':
return IndentWith.Space;
case 'tab':
return IndentWith.Tab;
default:
return value;
case 'space':
return IndentWith.Space;
case 'tab':
return IndentWith.Tab;
default:
return value;
}
}

View File

@@ -11,12 +11,12 @@ function inlineRequestFrom(option) {
}
function proxyOptionsFrom(httpProxy) {
return httpProxy ?
{
return httpProxy
? {
hostname: url.parse(httpProxy).hostname,
port: parseInt(url.parse(httpProxy).port)
} :
{};
}
: {};
}
module.exports = inlineRequestFrom;

View File

@@ -7,9 +7,9 @@ function inlineOptionsFrom(rules) {
return ['none'];
}
return undefined === rules ?
['local'] :
rules.split(',');
return undefined === rules
? ['local']
: rules.split(',');
}
module.exports = inlineOptionsFrom;

View File

@@ -31,7 +31,8 @@ DEFAULTS[OptimizationLevel.One] = {
specialComments: 'all',
tidyAtRules: true,
tidyBlockScopes: true,
tidySelectors: true
tidySelectors: true,
variableValueOptimizers: []
};
DEFAULTS[OptimizationLevel.Two] = {
mergeAdjacentRules: true,
@@ -99,7 +100,7 @@ function optimizationLevelFrom(source) {
source[One].roundingPrecision = roundingPrecisionFrom(source[One].roundingPrecision);
}
if (Two in source && 'skipProperties' in source[Two] && typeof(source[Two].skipProperties) == 'string') {
if (Two in source && 'skipProperties' in source[Two] && typeof (source[Two].skipProperties) == 'string') {
source[Two].skipProperties = source[Two].skipProperties.split(LIST_VALUE_SEPARATOR);
}
@@ -157,14 +158,14 @@ function defaults(level, value) {
function normalizeValue(value) {
switch (value) {
case FALSE_KEYWORD_1:
case FALSE_KEYWORD_2:
return false;
case TRUE_KEYWORD_1:
case TRUE_KEYWORD_2:
return true;
default:
return value;
case FALSE_KEYWORD_1:
case FALSE_KEYWORD_2:
return false;
case TRUE_KEYWORD_1:
case TRUE_KEYWORD_2:
return true;
default:
return value;
}
}
@@ -195,7 +196,7 @@ function covertValuesToHashes(source) {
function covertToHash(asString, level) {
return asString
.split(OPTION_SEPARATOR)
.reduce(function (accumulator, directive) {
.reduce(function(accumulator, directive) {
var parts = directive.split(OPTION_VALUE_SEPARATOR);
var name = parts[0];
var value = parts[1];
@@ -213,5 +214,5 @@ function covertToHash(asString, level) {
module.exports = {
OptimizationLevel: OptimizationLevel,
optimizationLevelFrom: optimizationLevelFrom,
optimizationLevelFrom: optimizationLevelFrom
};

View File

@@ -8,16 +8,16 @@ function pluginsFrom(plugins) {
plugins = plugins || [];
flatPlugins.level1Value = plugins
.map(function (plugin) { return plugin.level1 && plugin.level1.value; })
.filter(function (plugin) { return plugin != null; });
.map(function(plugin) { return plugin.level1 && plugin.level1.value; })
.filter(function(plugin) { return plugin != null; });
flatPlugins.level1Property = plugins
.map(function (plugin) { return plugin.level1 && plugin.level1.property; })
.filter(function (plugin) { return plugin != null; });
.map(function(plugin) { return plugin.level1 && plugin.level1.property; })
.filter(function(plugin) { return plugin != null; });
flatPlugins.level2Block = plugins
.map(function (plugin) { return plugin.level2 && plugin.level2.block; })
.filter(function (plugin) { return plugin != null; });
.map(function(plugin) { return plugin.level2 && plugin.level2.block; })
.filter(function(plugin) { return plugin != null; });
return flatPlugins;
}

View File

@@ -1,11 +1,10 @@
function rebaseFrom(rebaseOption, rebaseToOption) {
if (undefined !== rebaseToOption) {
return true;
} else if (undefined === rebaseOption) {
} if (undefined === rebaseOption) {
return false;
} else {
return !!rebaseOption;
}
return !!rebaseOption;
}
module.exports = rebaseFrom;

View File

@@ -13,21 +13,21 @@ 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,
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
};
}
@@ -63,12 +63,12 @@ function buildPrecisionFrom(source) {
return source
.split(DIRECTIVES_SEPARATOR)
.reduce(function (accumulator, directive) {
.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) {
if (Number.isNaN(value) || value == -1) {
value = DEFAULT_PRECISION;
}