@node-minify/html-minifier 8.0.5 → 9.0.0
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/LICENSE +1 -1
- package/dist/index.d.mts +14 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +15 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -16
package/LICENSE
CHANGED
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MinifierOptions } from '@node-minify/types';
|
|
2
|
+
|
|
3
|
+
/*!
|
|
4
|
+
* node-minify
|
|
5
|
+
* Copyright(c) 2011-2024 Rodolphe Stoclin
|
|
6
|
+
* MIT Licensed
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
declare const minifyHTMLMinifier: {
|
|
10
|
+
({ settings, content, callback, index, }: MinifierOptions): string | void;
|
|
11
|
+
default: any;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { minifyHTMLMinifier as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ import { MinifierOptions } from '@node-minify/types';
|
|
|
2
2
|
|
|
3
3
|
/*!
|
|
4
4
|
* node-minify
|
|
5
|
-
* Copyright(c) 2011-
|
|
5
|
+
* Copyright(c) 2011-2024 Rodolphe Stoclin
|
|
6
6
|
* MIT Licensed
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
declare const minifyHTMLMinifier: {
|
|
10
|
-
({ settings, content, callback, index }: MinifierOptions): string | void;
|
|
10
|
+
({ settings, content, callback, index, }: MinifierOptions): string | void;
|
|
11
11
|
default: any;
|
|
12
12
|
};
|
|
13
13
|
|
package/dist/index.js
CHANGED
|
@@ -23,8 +23,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
));
|
|
24
24
|
|
|
25
25
|
// src/index.ts
|
|
26
|
-
var import_html_minifier = __toESM(require("html-minifier"));
|
|
27
26
|
var import_utils = require("@node-minify/utils");
|
|
27
|
+
var import_html_minifier = __toESM(require("html-minifier"));
|
|
28
28
|
var HTMLMinifier = import_html_minifier.default.minify;
|
|
29
29
|
var defaultOptions = {
|
|
30
30
|
collapseBooleanAttributes: true,
|
|
@@ -43,11 +43,20 @@ var defaultOptions = {
|
|
|
43
43
|
removeStyleLinkTypeAttributes: true,
|
|
44
44
|
useShortDoctype: true
|
|
45
45
|
};
|
|
46
|
-
var minifyHTMLMinifier = ({
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
var minifyHTMLMinifier = ({
|
|
47
|
+
settings,
|
|
48
|
+
content,
|
|
49
|
+
callback,
|
|
50
|
+
index
|
|
51
|
+
}) => {
|
|
52
|
+
const options = Object.assign({}, defaultOptions, settings?.options);
|
|
53
|
+
const contentMinified = HTMLMinifier(content ?? "", options);
|
|
49
54
|
if (settings && !settings.content && settings.output) {
|
|
50
|
-
settings.output && import_utils.utils.writeFile({
|
|
55
|
+
settings.output && import_utils.utils.writeFile({
|
|
56
|
+
file: settings.output,
|
|
57
|
+
content: contentMinified,
|
|
58
|
+
index
|
|
59
|
+
});
|
|
51
60
|
}
|
|
52
61
|
if (callback) {
|
|
53
62
|
return callback(null, contentMinified);
|
|
@@ -58,7 +67,7 @@ minifyHTMLMinifier.default = minifyHTMLMinifier;
|
|
|
58
67
|
module.exports = minifyHTMLMinifier;
|
|
59
68
|
/*!
|
|
60
69
|
* node-minify
|
|
61
|
-
* Copyright(c) 2011-
|
|
70
|
+
* Copyright(c) 2011-2024 Rodolphe Stoclin
|
|
62
71
|
* MIT Licensed
|
|
63
72
|
*/
|
|
64
73
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-
|
|
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\";\nimport minifier from \"html-minifier\";\n\n/**\n * Module variables.\n */\nconst HTMLMinifier = minifier.minify;\nconst defaultOptions = {\n collapseBooleanAttributes: true,\n collapseInlineTagWhitespace: true,\n collapseWhitespace: true,\n minifyCSS: true,\n minifyJS: true,\n removeAttributeQuotes: true,\n removeCDATASectionsFromCDATA: true,\n removeComments: true,\n removeCommentsFromCDATA: 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.\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 = ({\n settings,\n content,\n callback,\n index,\n}: MinifierOptions) => {\n const options = Object.assign({}, defaultOptions, settings?.options);\n const contentMinified = HTMLMinifier(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;AACtB,2BAAqB;AAKrB,IAAM,eAAe,qBAAAA,QAAS;AAC9B,IAAM,iBAAiB;AAAA,EACnB,2BAA2B;AAAA,EAC3B,6BAA6B;AAAA,EAC7B,oBAAoB;AAAA,EACpB,WAAW;AAAA,EACX,UAAU;AAAA,EACV,uBAAuB;AAAA,EACvB,8BAA8B;AAAA,EAC9B,gBAAgB;AAAA,EAChB,yBAAyB;AAAA,EACzB,uBAAuB;AAAA,EACvB,oBAAoB;AAAA,EACpB,2BAA2B;AAAA,EAC3B,4BAA4B;AAAA,EAC5B,+BAA+B;AAAA,EAC/B,iBAAiB;AACrB;AAUA,IAAM,qBAAqB,CAAC;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ,MAAuB;AACnB,QAAM,UAAU,OAAO,OAAO,CAAC,GAAG,gBAAgB,UAAU,OAAO;AACnE,QAAM,kBAAkB,aAAa,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":["minifier"]}
|
package/dist/index.mjs
CHANGED
|
@@ -4,8 +4,8 @@ var __commonJS = (cb, mod) => function __require() {
|
|
|
4
4
|
};
|
|
5
5
|
|
|
6
6
|
// src/index.ts
|
|
7
|
-
import minifier from "html-minifier";
|
|
8
7
|
import { utils } from "@node-minify/utils";
|
|
8
|
+
import minifier from "html-minifier";
|
|
9
9
|
var require_src = __commonJS({
|
|
10
10
|
"src/index.ts"(exports, module) {
|
|
11
11
|
var HTMLMinifier = minifier.minify;
|
|
@@ -26,11 +26,20 @@ var require_src = __commonJS({
|
|
|
26
26
|
removeStyleLinkTypeAttributes: true,
|
|
27
27
|
useShortDoctype: true
|
|
28
28
|
};
|
|
29
|
-
var minifyHTMLMinifier = ({
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
var minifyHTMLMinifier = ({
|
|
30
|
+
settings,
|
|
31
|
+
content,
|
|
32
|
+
callback,
|
|
33
|
+
index
|
|
34
|
+
}) => {
|
|
35
|
+
const options = Object.assign({}, defaultOptions, settings?.options);
|
|
36
|
+
const contentMinified = HTMLMinifier(content ?? "", options);
|
|
32
37
|
if (settings && !settings.content && settings.output) {
|
|
33
|
-
settings.output && utils.writeFile({
|
|
38
|
+
settings.output && utils.writeFile({
|
|
39
|
+
file: settings.output,
|
|
40
|
+
content: contentMinified,
|
|
41
|
+
index
|
|
42
|
+
});
|
|
34
43
|
}
|
|
35
44
|
if (callback) {
|
|
36
45
|
return callback(null, contentMinified);
|
|
@@ -44,7 +53,7 @@ var require_src = __commonJS({
|
|
|
44
53
|
export default require_src();
|
|
45
54
|
/*!
|
|
46
55
|
* node-minify
|
|
47
|
-
* Copyright(c) 2011-
|
|
56
|
+
* Copyright(c) 2011-2024 Rodolphe Stoclin
|
|
48
57
|
* MIT Licensed
|
|
49
58
|
*/
|
|
50
59
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-
|
|
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\";\nimport minifier from \"html-minifier\";\n\n/**\n * Module variables.\n */\nconst HTMLMinifier = minifier.minify;\nconst defaultOptions = {\n collapseBooleanAttributes: true,\n collapseInlineTagWhitespace: true,\n collapseWhitespace: true,\n minifyCSS: true,\n minifyJS: true,\n removeAttributeQuotes: true,\n removeCDATASectionsFromCDATA: true,\n removeComments: true,\n removeCommentsFromCDATA: 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.\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 = ({\n settings,\n content,\n callback,\n index,\n}: MinifierOptions) => {\n const options = Object.assign({}, defaultOptions, settings?.options);\n const contentMinified = HTMLMinifier(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;AACtB,OAAO,cAAc;AAXrB;AAAA;AAgBA,QAAM,eAAe,SAAS;AAC9B,QAAM,iBAAiB;AAAA,MACnB,2BAA2B;AAAA,MAC3B,6BAA6B;AAAA,MAC7B,oBAAoB;AAAA,MACpB,WAAW;AAAA,MACX,UAAU;AAAA,MACV,uBAAuB;AAAA,MACvB,8BAA8B;AAAA,MAC9B,gBAAgB;AAAA,MAChB,yBAAyB;AAAA,MACzB,uBAAuB;AAAA,MACvB,oBAAoB;AAAA,MACpB,2BAA2B;AAAA,MAC3B,4BAA4B;AAAA,MAC5B,+BAA+B;AAAA,MAC/B,iBAAiB;AAAA,IACrB;AAUA,QAAM,qBAAqB,CAAC;AAAA,MACxB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ,MAAuB;AACnB,YAAM,UAAU,OAAO,OAAO,CAAC,GAAG,gBAAgB,UAAU,OAAO;AACnE,YAAM,kBAAkB,aAAa,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": "
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"description": "html-minifier plugin for @node-minify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compressor",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"homepage": "https://github.com/srod/node-minify/tree/master/packages/html-minifier#readme",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"engines": {
|
|
15
|
-
"node": ">=
|
|
15
|
+
"node": ">=18.0.0"
|
|
16
16
|
},
|
|
17
17
|
"directories": {
|
|
18
18
|
"lib": "dist",
|
|
@@ -22,9 +22,11 @@
|
|
|
22
22
|
"module": "./dist/index.mjs",
|
|
23
23
|
"types": "./dist/index.d.ts",
|
|
24
24
|
"exports": {
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"import": "./dist/index.mjs",
|
|
28
|
+
"require": "./dist/index.cjs"
|
|
29
|
+
}
|
|
28
30
|
},
|
|
29
31
|
"files": [
|
|
30
32
|
"dist/**/*"
|
|
@@ -39,18 +41,20 @@
|
|
|
39
41
|
"bugs": {
|
|
40
42
|
"url": "https://github.com/srod/node-minify/issues"
|
|
41
43
|
},
|
|
42
|
-
"scripts": {
|
|
43
|
-
"clean": "pnpm dlx rimraf dist",
|
|
44
|
-
"build": "pnpm clean && tsup src/index.ts --format cjs,esm --dts --clean --sourcemap",
|
|
45
|
-
"prepublishOnly": "pnpm build"
|
|
46
|
-
},
|
|
47
44
|
"dependencies": {
|
|
48
|
-
"
|
|
49
|
-
"
|
|
45
|
+
"html-minifier": "4.0.0",
|
|
46
|
+
"@node-minify/utils": "9.0.0"
|
|
50
47
|
},
|
|
51
48
|
"devDependencies": {
|
|
52
|
-
"@
|
|
53
|
-
"@types
|
|
49
|
+
"@types/html-minifier": "^4.0.2",
|
|
50
|
+
"@node-minify/types": "9.0.0"
|
|
54
51
|
},
|
|
55
|
-
"
|
|
56
|
-
|
|
52
|
+
"scripts": {
|
|
53
|
+
"clean": "pnpm dlx rimraf dist",
|
|
54
|
+
"build": "pnpm clean && tsup src/index.ts --format cjs,esm --dts --clean --sourcemap",
|
|
55
|
+
"lint": "biome lint .",
|
|
56
|
+
"test": "vitest run",
|
|
57
|
+
"test:ci": "vitest run --coverage",
|
|
58
|
+
"test:watch": "vitest"
|
|
59
|
+
}
|
|
60
|
+
}
|