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

View File

@@ -47,7 +47,8 @@ function ancestor(node, visitors, baseVisitor, state) {
// their child nodes (by calling their third argument on these
// nodes).
function recursive(node, state, funcs, baseVisitor, override) {
var visitor = funcs ? make(funcs, baseVisitor || undefined) : baseVisitor;(function c(node, st, override) {
var visitor = funcs ? make(funcs, baseVisitor || undefined) : baseVisitor
;(function c(node, st, override) {
visitor[override || node.type](node, st, c);
})(node, state, override);
}
@@ -77,7 +78,8 @@ function full(node, callback, baseVisitor, state, override) {
// the callback on each node
function fullAncestor(node, callback, baseVisitor, state) {
if (!baseVisitor) { baseVisitor = base; }
var ancestors = [];(function c(node, st, override) {
var ancestors = []
;(function c(node, st, override) {
var type = override || node.type;
var isNew = node !== ancestors[ancestors.length - 1];
if (isNew) { ancestors.push(node); }
@@ -149,7 +151,8 @@ function findNodeAfter(node, pos, test, baseVisitor, state) {
function findNodeBefore(node, pos, test, baseVisitor, state) {
test = makeTest(test);
if (!baseVisitor) { baseVisitor = base; }
var max;(function c(node, st, override) {
var max
;(function c(node, st, override) {
if (node.start > pos) { return }
var type = override || node.type;
if (node.end <= pos && (!max || max.node.end < node.end) && test(type, node))
@@ -206,13 +209,13 @@ base.WithStatement = function (node, st, c) {
};
base.SwitchStatement = function (node, st, c) {
c(node.discriminant, st, "Expression");
for (var i = 0, list = node.cases; i < list.length; i += 1) {
var cs = list[i];
for (var i$1 = 0, list$1 = node.cases; i$1 < list$1.length; i$1 += 1) {
var cs = list$1[i$1];
if (cs.test) { c(cs.test, st, "Expression"); }
for (var i$1 = 0, list$1 = cs.consequent; i$1 < list$1.length; i$1 += 1)
for (var i = 0, list = cs.consequent; i < list.length; i += 1)
{
var cons = list$1[i$1];
var cons = list[i];
c(cons, st, "Statement");
}
@@ -407,7 +410,7 @@ base.ImportDeclaration = function (node, st, c) {
}
c(node.source, st, "Expression");
};
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore;
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = base.Import = ignore;
base.TaggedTemplateExpression = function (node, st, c) {
c(node.tag, st, "Expression");
@@ -432,5 +435,4 @@ base.MethodDefinition = base.Property = function (node, st, c) {
c(node.value, st, "Expression");
};
export { simple, ancestor, recursive, full, fullAncestor, findNodeAt, findNodeAround, findNodeAfter, findNodeBefore, make, base };
//# sourceMappingURL=walk.mjs.map
export { ancestor, base, findNodeAfter, findNodeAround, findNodeAt, findNodeBefore, full, fullAncestor, make, recursive, simple };