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

use terser and clean-css directly

create a sourcemap as well by default
This commit is contained in:
s2
2020-02-13 15:39:37 +01:00
parent db9b32db65
commit a4b62da0ba
535 changed files with 33708 additions and 63052 deletions

4
node_modules/nwsapi/LICENSE generated vendored
View File

@@ -4,8 +4,8 @@ Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

23
node_modules/nwsapi/package.json generated vendored
View File

@@ -1,26 +1,26 @@
{
"_from": "nwsapi@^2.0.9",
"_id": "nwsapi@2.1.3",
"_from": "nwsapi@^2.1.3",
"_id": "nwsapi@2.2.0",
"_inBundle": false,
"_integrity": "sha512-RowAaJGEgYXEZfQ7tvvdtAQUKPyTR6T6wNu0fwlNsGQYr/h3yQc6oI8WnVZh3Y/Sylwc+dtAlvPqfFZjhTyk3A==",
"_integrity": "sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ==",
"_location": "/nwsapi",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "nwsapi@^2.0.9",
"raw": "nwsapi@^2.1.3",
"name": "nwsapi",
"escapedName": "nwsapi",
"rawSpec": "^2.0.9",
"rawSpec": "^2.1.3",
"saveSpec": null,
"fetchSpec": "^2.0.9"
"fetchSpec": "^2.1.3"
},
"_requiredBy": [
"/jsdom"
],
"_resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.1.3.tgz",
"_shasum": "25f3a5cec26c654f7376df6659cdf84b99df9558",
"_spec": "nwsapi@^2.0.9",
"_resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz",
"_shasum": "204879a9e3d068ff2a55139c2c772780681a38b7",
"_spec": "nwsapi@^2.1.3",
"_where": "F:\\projects\\p\\minifyfromhtml\\node_modules\\jsdom",
"author": {
"name": "Diego Perini",
@@ -33,6 +33,9 @@
"bundleDependencies": false,
"deprecated": false,
"description": "Fast CSS Selectors API Engine",
"directories": {
"test": "test"
},
"homepage": "http://javascript.nwbox.com/nwsapi/",
"keywords": [
"css",
@@ -64,5 +67,5 @@
"scripts": {
"lint": "eslint ./src/nwsapi.js"
},
"version": "2.1.3"
"version": "2.2.0"
}

147
node_modules/nwsapi/src/nwsapi.js generated vendored
View File

@@ -5,9 +5,9 @@
* nwsapi.js - Fast CSS Selectors API Engine
*
* Author: Diego Perini <diego.perini at gmail com>
* Version: 2.1.3
* Version: 2.2.0
* Created: 20070722
* Release: 20190330
* Release: 20191102
*
* License:
* http://javascript.nwbox.com/nwsapi/MIT-LICENSE
@@ -30,10 +30,11 @@
})(this, function Factory(global, Export) {
var version = 'nwsapi-2.1.3',
var version = 'nwsapi-2.2.0',
doc = global.document,
root = doc.documentElement,
slice = Array.prototype.slice,
WSP = '[\\x20\\t\\r\\n\\f]',
@@ -83,8 +84,10 @@
structural: '(root|empty|(?:(?:first|last|only)(?:-child|-of-type)))\\b',
inputstate: '(enabled|disabled|read-only|read-write|placeholder-shown|default)\\b',
inputvalue: '(checked|indeterminate|required|optional|valid|invalid|in-range|out-of-range)\\b',
pseudo_dbl: '(after|before|first-letter|first-line|-webkit-[-a-zA-Z0-9]{2,})\\b',
pseudo_sng: ':(after|before|first-letter|first-line|selection|placeholder)\\b'
// pseudo-elements starting with single colon (:)
pseudo_sng: '(after|before|first-letter|first-line)\\b',
// pseudo-elements starting with double colon (::)
pseudo_dbl: ':(after|before|first-letter|first-line|selection|placeholder|-webkit-[-a-zA-Z0-9]{2,})\\b'
},
Patterns = {
@@ -99,7 +102,7 @@
logicalsel: RegExp('^:(?:' + GROUPS.logicalsel + ')(.*)', 'i'),
pseudo_dbl: RegExp('^:(?:' + GROUPS.pseudo_dbl + ')(.*)', 'i'),
pseudo_sng: RegExp('^:(?:' + GROUPS.pseudo_sng + ')(.*)', 'i'),
// combinators symbols
// combinator symbols
children: RegExp('^' + WSP + '?\\>' + WSP + '?(.*)'),
adjacent: RegExp('^' + WSP + '?\\+' + WSP + '?(.*)'),
relative: RegExp('^' + WSP + '?\\~' + WSP + '?(.*)'),
@@ -127,7 +130,6 @@
// special handling configuration flags
Config = {
IDS_DUPES: true,
LIVECACHE: false,
MIXEDCASE: true,
LOGERRORS: true,
VERBOSITY: true
@@ -381,13 +383,13 @@
var e, nodes, api = method['*'];
// DOCUMENT_NODE (9) & ELEMENT_NODE (1)
if (api in context) {
return context[api](tag);
return slice.call(context[api](tag));
} else {
// DOCUMENT_FRAGMENT_NODE (11)
if ((e = context.firstElementChild)) {
tag = tag.toLowerCase();
if (!(e.nextElementSibling || tag == '*' || e.nodeName.toLowerCase() == tag)) {
return e[api](tag);
return slice.call(e[api](tag));
} else {
nodes = [ ];
do {
@@ -406,13 +408,13 @@
var e, nodes, api = method['.'], reCls;
// DOCUMENT_NODE (9) & ELEMENT_NODE (1)
if (api in context) {
return context[api](cls);
return slice.call(context[api](cls));
} else {
// DOCUMENT_FRAGMENT_NODE (11)
if ((e = context.firstElementChild)) {
reCls = RegExp('(^|\\s)' + cls + '(\\s|$)', QUIRKS_MODE ? 'i' : '');
if (!(e.nextElementSibling || reCls.test(e.className))) {
return e[api](cls);
return slice.call(e[api](cls));
} else {
nodes = [ ];
do {
@@ -430,9 +432,9 @@
hasAttributeNS =
function(e, name) {
var i, l, attr = e.getAttributeNames();
HTML_DOCUMENT && (name = name.toLowerCase());
name = RegExp(':?' + name + '$', HTML_DOCUMENT ? 'i' : '');
for (i = 0, l = attr.length; l > i; ++i) {
if (name == attr[i].toLowerCase()) return true;
if (name.test(attr[i])) return true;
}
return false;
},
@@ -863,7 +865,7 @@
} else if (match[4]) {
match[4] = convertEscapes(match[4]).replace(REX.RegExpChar, '\\$&');
}
type = HTML_DOCUMENT && HTML_TABLE[expr.toLowerCase()] ? 'i' : '';
type = match[5] == 'i' || (HTML_DOCUMENT && HTML_TABLE[expr.toLowerCase()]) ? 'i' : '';
source = 'if(' + N + '(' +
(!match[2] ? (NS ? 's.hasAttributeNS(e,"' + name + '")' : 'e.hasAttribute("' + name + '")') :
!match[4] && ATTR_STD_OPS[match[2]] && match[2] != '~=' ? 'e.getAttribute("' + name + '")==""' :
@@ -1007,7 +1009,7 @@
match[1] = match[1].toLowerCase();
switch (match[1]) {
case 'matches':
if (not == true || nested == true) {
if (not === true || nested === true) {
emit(':matches() pseudo-class cannot be nested');
}
nested = true;
@@ -1020,7 +1022,7 @@
}
break;
case 'not':
if (not == true || nested == true) {
if (not === true || nested === true) {
emit(':not() pseudo-class cannot be nested');
}
expr = match[2].replace(REX.CommaGroup, ',').replace(REX.TrimSpaces, '');
@@ -1247,15 +1249,15 @@
}
// allow pseudo-elements starting with single colon (:)
// :after, :before, :first-letter, :first-line, :placeholder-shown, :-webkit-<foo-bar>
// :after, :before, :first-letter, :first-line
else if ((match = selector.match(Patterns.pseudo_sng))) {
source = 'if(' + D + '(/1|11/).test(e.nodeType)){' + source + '}';
source = 'if(' + D + '(e.nodeType==1)){' + source + '}';
}
// allow pseudo-elements starting with double colon (::)
// ::after, ::before, ::marker, ::placeholder, ::inactive-selection, ::selection
// ::after, ::before, ::marker, ::placeholder, ::inactive-selection, ::selection, ::-webkit-<foo-bar>
else if ((match = selector.match(Patterns.pseudo_dbl))) {
source = 'if(' + D + '(/1|11/).test(e.nodeType)){' + source + '}';
source = 'if(' + D + '(e.nodeType==1)){' + source + '}';
}
else {
@@ -1442,8 +1444,27 @@
if (selectors) {
if ((resolver = selectResolvers[selectors])) {
if (resolver.context === context && resolver.callback === callback) {
nodes = results_from(resolver, context, callback);
Config.LIVECACHE && !(/\[[^\]]*\]/).test(selectors) && (resolver.results = nodes);
var f = resolver.factory, h = resolver.htmlset, n = resolver.nodeset, nodes = [ ];
if (n.length > 1) {
for (var i = 0, l = n.length, list; l > i; ++i) {
list = compat[n[i][0]](context, n[i].slice(1))();
if (f[i] !== null) {
f[i](list, callback, context, nodes);
} else {
nodes = nodes.concat(list);
}
}
if (l > 1 && nodes.length > 1) {
nodes.sort(documentOrder);
hasDupes && (nodes = unique(nodes));
}
} else {
if (f[0]) {
nodes = f[0](h[0](), callback, context, nodes);
} else {
nodes = h[0]();
}
}
return typeof callback == 'function' ?
concatCall(nodes, callback) : nodes;
}
@@ -1496,7 +1517,7 @@
// save/reuse factory and closure collection
selectResolvers[selectors] = collect(expressions, context, callback);
nodes = results_from(selectResolvers[selectors], context, callback);
nodes = selectResolvers[selectors].results;
return typeof callback == 'function' ?
concatCall(nodes, callback) : nodes;
@@ -1513,83 +1534,45 @@
'*' : '') : '') + selector.slice(index + length - (token[1] == '*' ? 1 : 0));
},
results_from =
function(resolver, context, callback) {
var i, k, l, list, nodes = [ ],
f = resolver.factory, h = resolver.htmlset,
n = resolver.nodeset, r = resolver.results;
for (i = 0, k = 0, l = n.length; l > i; ++i) {
list = r && h[i] ? h[i]() : compat[n[i][0]](context, n[i].slice(1))();
if (f[i] !== null) {
if (r && h[i]) {
if (list.item || validate(resolver, n[i], list)) {
++k;
} else {
f[i](list, callback, context, nodes);
}
} else {
f[i](list, callback, context, nodes);
}
} else {
if (list.length !== 0) {
list.length == 1 ?
nodes[nodes.length] = list[0] :
concatList(nodes, list);
}
}
if (r && h[i]) {
if (k == l) { nodes = r; }
} else {
if (l > 1 && nodes.length > 1) {
nodes.sort(documentOrder);
hasDupes && (nodes = unique(nodes));
}
}
}
return nodes;
},
// validate memoized HTMLCollection
validate =
function(resolver, n, s) {
var c = 0, i = 0, l = s.length, m;
if (l === 0) { return false; }
m = compat[n[0]](resolver.context, n.slice(1))();
if (m.item && s.item) {
while (l > i) { if (m.item(i) === s.item(c)) { ++i; ++c; } else return false; }
} else {
while (l > i) { if (m[i] === s[c]) { ++i; ++c;} else return false; }
}
return m.length == c;
},
// prepare factory resolvers and closure collections
collect =
function(selectors, context, callback) {
var i, l, token, seen = { }, factory = [ ], htmlset = [ ], nodeset = [ ];
var i, l, token, seen = { }, factory = [ ], htmlset = [ ], nodeset = [ ], results = [ ];
for (i = 0, l = selectors.length; l > i; ++i) {
if (!seen[selectors[i]] && (seen[selectors[i]] = true)) {
if ((token = selectors[i].match(reOptimizer)) && token[1] != ':') {
Config.LIVECACHE && !(/\[[^\]]*\]/).test(selectors[i]) && (htmlset[i] = compat[token[1] || '*'](context, token[2]));
nodeset[i] = (token[1] || '*') + token[2];
token[1] || (token[1] = '*');
selectors[i] = optimize(selectors[i], token);
} else if (token && token[1] != ':') {
Config.LIVECACHE && !(/\[[^\]]*\]/).test(selectors[i]) && (htmlset[i] = compat['*'](context, '*'));
nodeset[i] = '**';
} else {
nodeset[i] = '**';
token = ['', '*', '*'];
}
factory[i] = selectors[i] == '*' ? null : compile(selectors[i], true, null);
nodeset[i] = token[1] + token[2];
htmlset[i] = compat[token[1]](context, token[2]);
factory[i] = compile(selectors[i], true, null);
if (factory[i]) {
factory[i](htmlset[i](), callback, context, results);
} else {
results = results.concat(htmlset[i]());
}
}
}
if (l > 1) {
results.sort(documentOrder);
hasDupes && (results = unique(results));
}
return {
callback: callback,
context: context,
factory: factory,
htmlset: htmlset,
nodeset: nodeset,
results: null
results: results
};
},