@node-minify/html-minifier 9.0.0 → 9.0.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/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -5
package/dist/index.d.mts
CHANGED
|
@@ -7,7 +7,7 @@ import { MinifierOptions } from '@node-minify/types';
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
declare const minifyHTMLMinifier: {
|
|
10
|
-
({ settings, content, callback, index, }: MinifierOptions): string | void
|
|
10
|
+
({ settings, content, callback, index, }: MinifierOptions): Promise<string | void>;
|
|
11
11
|
default: any;
|
|
12
12
|
};
|
|
13
13
|
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { MinifierOptions } from '@node-minify/types';
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
declare const minifyHTMLMinifier: {
|
|
10
|
-
({ settings, content, callback, index, }: MinifierOptions): string | void
|
|
10
|
+
({ settings, content, callback, index, }: MinifierOptions): Promise<string | void>;
|
|
11
11
|
default: any;
|
|
12
12
|
};
|
|
13
13
|
|
package/dist/index.js
CHANGED
|
@@ -24,8 +24,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
|
|
25
25
|
// src/index.ts
|
|
26
26
|
var import_utils = require("@node-minify/utils");
|
|
27
|
-
var import_html_minifier = __toESM(require("html-minifier"));
|
|
28
|
-
var HTMLMinifier = import_html_minifier.default.minify;
|
|
29
27
|
var defaultOptions = {
|
|
30
28
|
collapseBooleanAttributes: true,
|
|
31
29
|
collapseInlineTagWhitespace: true,
|
|
@@ -33,9 +31,7 @@ var defaultOptions = {
|
|
|
33
31
|
minifyCSS: true,
|
|
34
32
|
minifyJS: true,
|
|
35
33
|
removeAttributeQuotes: true,
|
|
36
|
-
removeCDATASectionsFromCDATA: true,
|
|
37
34
|
removeComments: true,
|
|
38
|
-
removeCommentsFromCDATA: true,
|
|
39
35
|
removeEmptyAttributes: true,
|
|
40
36
|
removeOptionalTags: true,
|
|
41
37
|
removeRedundantAttributes: true,
|
|
@@ -43,14 +39,15 @@ var defaultOptions = {
|
|
|
43
39
|
removeStyleLinkTypeAttributes: true,
|
|
44
40
|
useShortDoctype: true
|
|
45
41
|
};
|
|
46
|
-
var minifyHTMLMinifier = ({
|
|
42
|
+
var minifyHTMLMinifier = async ({
|
|
47
43
|
settings,
|
|
48
44
|
content,
|
|
49
45
|
callback,
|
|
50
46
|
index
|
|
51
47
|
}) => {
|
|
48
|
+
const { minify } = await import("html-minifier-next");
|
|
52
49
|
const options = Object.assign({}, defaultOptions, settings?.options);
|
|
53
|
-
const contentMinified =
|
|
50
|
+
const contentMinified = await minify(content ?? "", options);
|
|
54
51
|
if (settings && !settings.content && settings.output) {
|
|
55
52
|
settings.output && import_utils.utils.writeFile({
|
|
56
53
|
file: settings.output,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-2024 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\nimport type { MinifierOptions } from \"@node-minify/types\";\nimport { utils } from \"@node-minify/utils\";\
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-2024 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\nimport type { MinifierOptions } from \"@node-minify/types\";\nimport { utils } from \"@node-minify/utils\";\n\n/**\n * Module variables.\n */\nconst defaultOptions = {\n collapseBooleanAttributes: true,\n collapseInlineTagWhitespace: true,\n collapseWhitespace: true,\n minifyCSS: true,\n minifyJS: true,\n removeAttributeQuotes: true,\n removeComments: true,\n removeEmptyAttributes: true,\n removeOptionalTags: true,\n removeRedundantAttributes: true,\n removeScriptTypeAttributes: true,\n removeStyleLinkTypeAttributes: true,\n useShortDoctype: true,\n};\n\n/**\n * Run html-minifier-next.\n * @param settings HTMLMinifier options\n * @param content Content to minify\n * @param callback Callback\n * @param index Index of current file in array\n * @returns Minified content\n */\nconst minifyHTMLMinifier = async ({\n settings,\n content,\n callback,\n index,\n}: MinifierOptions) => {\n const { minify } = await import(\"html-minifier-next\");\n const options = Object.assign({}, defaultOptions, settings?.options);\n const contentMinified = await minify(content ?? \"\", options);\n if (settings && !settings.content && settings.output) {\n settings.output &&\n utils.writeFile({\n file: settings.output,\n content: contentMinified,\n index,\n });\n }\n if (callback) {\n return callback(null, contentMinified);\n }\n return contentMinified;\n};\n\n/**\n * Expose `minifyHTMLMinifier()`.\n */\nminifyHTMLMinifier.default = minifyHTMLMinifier;\nexport = minifyHTMLMinifier;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAUA,mBAAsB;AAKtB,IAAM,iBAAiB;AAAA,EACnB,2BAA2B;AAAA,EAC3B,6BAA6B;AAAA,EAC7B,oBAAoB;AAAA,EACpB,WAAW;AAAA,EACX,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,gBAAgB;AAAA,EAChB,uBAAuB;AAAA,EACvB,oBAAoB;AAAA,EACpB,2BAA2B;AAAA,EAC3B,4BAA4B;AAAA,EAC5B,+BAA+B;AAAA,EAC/B,iBAAiB;AACrB;AAUA,IAAM,qBAAqB,OAAO;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ,MAAuB;AACnB,QAAM,EAAE,OAAO,IAAI,MAAM,OAAO,oBAAoB;AACpD,QAAM,UAAU,OAAO,OAAO,CAAC,GAAG,gBAAgB,UAAU,OAAO;AACnE,QAAM,kBAAkB,MAAM,OAAO,WAAW,IAAI,OAAO;AAC3D,MAAI,YAAY,CAAC,SAAS,WAAW,SAAS,QAAQ;AAClD,aAAS,UACL,mBAAM,UAAU;AAAA,MACZ,MAAM,SAAS;AAAA,MACf,SAAS;AAAA,MACT;AAAA,IACJ,CAAC;AAAA,EACT;AACA,MAAI,UAAU;AACV,WAAO,SAAS,MAAM,eAAe;AAAA,EACzC;AACA,SAAO;AACX;AAKA,mBAAmB,UAAU;AAC7B,iBAAS;","names":[]}
|
package/dist/index.mjs
CHANGED
|
@@ -5,10 +5,8 @@ var __commonJS = (cb, mod) => function __require() {
|
|
|
5
5
|
|
|
6
6
|
// src/index.ts
|
|
7
7
|
import { utils } from "@node-minify/utils";
|
|
8
|
-
import minifier from "html-minifier";
|
|
9
8
|
var require_src = __commonJS({
|
|
10
9
|
"src/index.ts"(exports, module) {
|
|
11
|
-
var HTMLMinifier = minifier.minify;
|
|
12
10
|
var defaultOptions = {
|
|
13
11
|
collapseBooleanAttributes: true,
|
|
14
12
|
collapseInlineTagWhitespace: true,
|
|
@@ -16,9 +14,7 @@ var require_src = __commonJS({
|
|
|
16
14
|
minifyCSS: true,
|
|
17
15
|
minifyJS: true,
|
|
18
16
|
removeAttributeQuotes: true,
|
|
19
|
-
removeCDATASectionsFromCDATA: true,
|
|
20
17
|
removeComments: true,
|
|
21
|
-
removeCommentsFromCDATA: true,
|
|
22
18
|
removeEmptyAttributes: true,
|
|
23
19
|
removeOptionalTags: true,
|
|
24
20
|
removeRedundantAttributes: true,
|
|
@@ -26,14 +22,15 @@ var require_src = __commonJS({
|
|
|
26
22
|
removeStyleLinkTypeAttributes: true,
|
|
27
23
|
useShortDoctype: true
|
|
28
24
|
};
|
|
29
|
-
var minifyHTMLMinifier = ({
|
|
25
|
+
var minifyHTMLMinifier = async ({
|
|
30
26
|
settings,
|
|
31
27
|
content,
|
|
32
28
|
callback,
|
|
33
29
|
index
|
|
34
30
|
}) => {
|
|
31
|
+
const { minify } = await import("html-minifier-next");
|
|
35
32
|
const options = Object.assign({}, defaultOptions, settings?.options);
|
|
36
|
-
const contentMinified =
|
|
33
|
+
const contentMinified = await minify(content ?? "", options);
|
|
37
34
|
if (settings && !settings.content && settings.output) {
|
|
38
35
|
settings.output && utils.writeFile({
|
|
39
36
|
file: settings.output,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-2024 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\nimport type { MinifierOptions } from \"@node-minify/types\";\nimport { utils } from \"@node-minify/utils\";\
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-2024 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * Module dependencies.\n */\nimport type { MinifierOptions } from \"@node-minify/types\";\nimport { utils } from \"@node-minify/utils\";\n\n/**\n * Module variables.\n */\nconst defaultOptions = {\n collapseBooleanAttributes: true,\n collapseInlineTagWhitespace: true,\n collapseWhitespace: true,\n minifyCSS: true,\n minifyJS: true,\n removeAttributeQuotes: true,\n removeComments: true,\n removeEmptyAttributes: true,\n removeOptionalTags: true,\n removeRedundantAttributes: true,\n removeScriptTypeAttributes: true,\n removeStyleLinkTypeAttributes: true,\n useShortDoctype: true,\n};\n\n/**\n * Run html-minifier-next.\n * @param settings HTMLMinifier options\n * @param content Content to minify\n * @param callback Callback\n * @param index Index of current file in array\n * @returns Minified content\n */\nconst minifyHTMLMinifier = async ({\n settings,\n content,\n callback,\n index,\n}: MinifierOptions) => {\n const { minify } = await import(\"html-minifier-next\");\n const options = Object.assign({}, defaultOptions, settings?.options);\n const contentMinified = await minify(content ?? \"\", options);\n if (settings && !settings.content && settings.output) {\n settings.output &&\n utils.writeFile({\n file: settings.output,\n content: contentMinified,\n index,\n });\n }\n if (callback) {\n return callback(null, contentMinified);\n }\n return contentMinified;\n};\n\n/**\n * Expose `minifyHTMLMinifier()`.\n */\nminifyHTMLMinifier.default = minifyHTMLMinifier;\nexport = minifyHTMLMinifier;\n"],"mappings":";;;;;;AAUA,SAAS,aAAa;AAVtB;AAAA;AAeA,QAAM,iBAAiB;AAAA,MACnB,2BAA2B;AAAA,MAC3B,6BAA6B;AAAA,MAC7B,oBAAoB;AAAA,MACpB,WAAW;AAAA,MACX,UAAU;AAAA,MACV,uBAAuB;AAAA,MACvB,gBAAgB;AAAA,MAChB,uBAAuB;AAAA,MACvB,oBAAoB;AAAA,MACpB,2BAA2B;AAAA,MAC3B,4BAA4B;AAAA,MAC5B,+BAA+B;AAAA,MAC/B,iBAAiB;AAAA,IACrB;AAUA,QAAM,qBAAqB,OAAO;AAAA,MAC9B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ,MAAuB;AACnB,YAAM,EAAE,OAAO,IAAI,MAAM,OAAO,oBAAoB;AACpD,YAAM,UAAU,OAAO,OAAO,CAAC,GAAG,gBAAgB,UAAU,OAAO;AACnE,YAAM,kBAAkB,MAAM,OAAO,WAAW,IAAI,OAAO;AAC3D,UAAI,YAAY,CAAC,SAAS,WAAW,SAAS,QAAQ;AAClD,iBAAS,UACL,MAAM,UAAU;AAAA,UACZ,MAAM,SAAS;AAAA,UACf,SAAS;AAAA,UACT;AAAA,QACJ,CAAC;AAAA,MACT;AACA,UAAI,UAAU;AACV,eAAO,SAAS,MAAM,eAAe;AAAA,MACzC;AACA,aAAO;AAAA,IACX;AAKA,uBAAmB,UAAU;AAC7B,qBAAS;AAAA;AAAA;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-minify/html-minifier",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.2",
|
|
4
4
|
"description": "html-minifier plugin for @node-minify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compressor",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
".": {
|
|
26
26
|
"types": "./dist/index.d.ts",
|
|
27
27
|
"import": "./dist/index.mjs",
|
|
28
|
-
"require": "./dist/index.
|
|
28
|
+
"require": "./dist/index.js"
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
@@ -42,11 +42,10 @@
|
|
|
42
42
|
"url": "https://github.com/srod/node-minify/issues"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"html-minifier": "4.
|
|
46
|
-
"@node-minify/utils": "9.0.
|
|
45
|
+
"html-minifier-next": "^4.14.3",
|
|
46
|
+
"@node-minify/utils": "9.0.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@types/html-minifier": "^4.0.2",
|
|
50
49
|
"@node-minify/types": "9.0.0"
|
|
51
50
|
},
|
|
52
51
|
"scripts": {
|