html-minifier-next 1.4.0 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -33
- package/cli.js +27 -27
- package/dist/htmlminifier.cjs +66 -43
- package/dist/htmlminifier.esm.bundle.js +321 -89
- package/dist/htmlminifier.umd.bundle.js +321 -89
- package/dist/htmlminifier.umd.bundle.min.js +2 -2
- package/package.json +8 -7
- package/src/htmlparser.js +5 -5
package/package.json
CHANGED
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
"commander": "^14.0.0",
|
|
11
11
|
"entities": "^6.0.1",
|
|
12
12
|
"relateurl": "^0.2.7",
|
|
13
|
-
"terser": "^5.
|
|
13
|
+
"terser": "^5.44.0"
|
|
14
14
|
},
|
|
15
15
|
"description": "Highly configurable, well-tested, JavaScript-based HTML minifier.",
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@commitlint/cli": "^19.8.1",
|
|
18
|
-
"@jest/globals": "^30.
|
|
18
|
+
"@jest/globals": "^30.1.2",
|
|
19
19
|
"@rollup/plugin-commonjs": "^28.0.6",
|
|
20
20
|
"@rollup/plugin-json": "^6.1.0",
|
|
21
21
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"eslint": "^9.33.0",
|
|
26
26
|
"husky": "^9.1.7",
|
|
27
27
|
"is-ci": "^4.1.0",
|
|
28
|
-
"jest": "^30.
|
|
28
|
+
"jest": "^30.1.3",
|
|
29
29
|
"lint-staged": "^16.1.5",
|
|
30
|
-
"rollup": "^4.
|
|
30
|
+
"rollup": "^4.50.0",
|
|
31
31
|
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
32
|
-
"vite": "^7.1.
|
|
32
|
+
"vite": "^7.1.5"
|
|
33
33
|
},
|
|
34
34
|
"exports": {
|
|
35
35
|
".": {
|
|
@@ -82,11 +82,12 @@
|
|
|
82
82
|
"build:docs": "vite build --base /html-minifier-next/ --outDir build",
|
|
83
83
|
"deploy": "npm run build && npm run build:docs",
|
|
84
84
|
"lint": "eslint .",
|
|
85
|
+
"prepack": "npm run build",
|
|
85
86
|
"prepare": "husky",
|
|
86
87
|
"serve": "npm run build && vite",
|
|
87
88
|
"test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest",
|
|
88
89
|
"test:watch": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest --watch"
|
|
89
90
|
},
|
|
90
91
|
"type": "module",
|
|
91
|
-
"version": "1.4.
|
|
92
|
-
}
|
|
92
|
+
"version": "1.4.2"
|
|
93
|
+
}
|
package/src/htmlparser.js
CHANGED
|
@@ -36,7 +36,7 @@ class CaseInsensitiveSet extends Set {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
// Regular
|
|
39
|
+
// Regular expressions for parsing tags and attributes
|
|
40
40
|
const singleAttrIdentifier = /([^\s"'<>/=]+)/;
|
|
41
41
|
const singleAttrAssigns = [/=/];
|
|
42
42
|
const singleAttrValues = [
|
|
@@ -67,10 +67,10 @@ let IS_REGEX_CAPTURING_BROKEN = false;
|
|
|
67
67
|
IS_REGEX_CAPTURING_BROKEN = g === '';
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
-
// Empty
|
|
70
|
+
// Empty elements
|
|
71
71
|
const empty = new CaseInsensitiveSet(['area', 'base', 'basefont', 'br', 'col', 'embed', 'frame', 'hr', 'img', 'input', 'isindex', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']);
|
|
72
72
|
|
|
73
|
-
// Inline
|
|
73
|
+
// Inline elements
|
|
74
74
|
const inline = new CaseInsensitiveSet(['a', 'abbr', 'acronym', 'applet', 'b', 'basefont', 'bdo', 'big', 'br', 'button', 'cite', 'code', 'del', 'dfn', 'em', 'font', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'label', 'map', 'noscript', 'object', 'q', 's', 'samp', 'script', 'select', 'small', 'span', 'strike', 'strong', 'sub', 'sup', 'svg', 'textarea', 'tt', 'u', 'var']);
|
|
75
75
|
|
|
76
76
|
// Elements that you can, intentionally, leave open
|
|
@@ -80,10 +80,10 @@ const closeSelf = new CaseInsensitiveSet(['colgroup', 'dd', 'dt', 'li', 'option'
|
|
|
80
80
|
// Attributes that have their values filled in disabled='disabled'
|
|
81
81
|
const fillAttrs = new CaseInsensitiveSet(['checked', 'compact', 'declare', 'defer', 'disabled', 'ismap', 'multiple', 'nohref', 'noresize', 'noshade', 'nowrap', 'readonly', 'selected']);
|
|
82
82
|
|
|
83
|
-
// Special
|
|
83
|
+
// Special elements (can contain anything)
|
|
84
84
|
const special = new CaseInsensitiveSet(['script', 'style']);
|
|
85
85
|
|
|
86
|
-
// HTML5
|
|
86
|
+
// HTML5 elements https://html.spec.whatwg.org/multipage/indices.html#elements-3
|
|
87
87
|
// Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
|
|
88
88
|
const nonPhrasing = new CaseInsensitiveSet(['address', 'article', 'aside', 'base', 'blockquote', 'body', 'caption', 'col', 'colgroup', 'dd', 'details', 'dialog', 'div', 'dl', 'dt', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'legend', 'li', 'menuitem', 'meta', 'ol', 'optgroup', 'option', 'param', 'rp', 'rt', 'source', 'style', 'summary', 'tbody', 'td', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul']);
|
|
89
89
|
|