@node-minify/html-minifier 9.0.1 → 10.0.0-next.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/dist/index.cjs ADDED
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ default: () => src_default
34
+ });
35
+ module.exports = __toCommonJS(src_exports);
36
+ var import_utils = require("@node-minify/utils");
37
+ var import_html_minifier = __toESM(require("html-minifier"), 1);
38
+ var HTMLMinifier = import_html_minifier.default.minify;
39
+ var defaultOptions = {
40
+ collapseBooleanAttributes: true,
41
+ collapseInlineTagWhitespace: true,
42
+ collapseWhitespace: true,
43
+ minifyCSS: true,
44
+ minifyJS: true,
45
+ removeAttributeQuotes: true,
46
+ removeCDATASectionsFromCDATA: true,
47
+ removeComments: true,
48
+ removeCommentsFromCDATA: true,
49
+ removeEmptyAttributes: true,
50
+ removeOptionalTags: true,
51
+ removeRedundantAttributes: true,
52
+ removeScriptTypeAttributes: true,
53
+ removeStyleLinkTypeAttributes: true,
54
+ useShortDoctype: true
55
+ };
56
+ var minifyHTMLMinifier = ({
57
+ settings,
58
+ content,
59
+ callback,
60
+ index
61
+ }) => {
62
+ const options = Object.assign({}, defaultOptions, settings?.options);
63
+ const contentMinified = HTMLMinifier(content ?? "", options);
64
+ if (settings && !settings.content && settings.output) {
65
+ settings.output && import_utils.utils.writeFile({
66
+ file: settings.output,
67
+ content: contentMinified,
68
+ index
69
+ });
70
+ }
71
+ if (callback) {
72
+ return callback(null, contentMinified);
73
+ }
74
+ return contentMinified;
75
+ };
76
+ minifyHTMLMinifier.default = minifyHTMLMinifier;
77
+ var src_default = minifyHTMLMinifier;
78
+ /*!
79
+ * node-minify
80
+ * Copyright(c) 2011-2024 Rodolphe Stoclin
81
+ * MIT Licensed
82
+ */
83
+
84
+ // fix-cjs-exports
85
+ if (module.exports.default) {
86
+ Object.assign(module.exports.default, module.exports);
87
+ module.exports = module.exports.default;
88
+ delete module.exports.default;
89
+ }
@@ -12,3 +12,4 @@ declare const minifyHTMLMinifier: {
12
12
  };
13
13
 
14
14
  export { minifyHTMLMinifier as default };
15
+ export = minifyHTMLMinifier
package/dist/index.d.ts CHANGED
@@ -12,3 +12,4 @@ declare const minifyHTMLMinifier: {
12
12
  };
13
13
 
14
14
  export { minifyHTMLMinifier as default };
15
+ export = minifyHTMLMinifier
package/dist/index.js CHANGED
@@ -1,31 +1,7 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
-
25
1
  // src/index.ts
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;
2
+ import { utils } from "@node-minify/utils";
3
+ import minifier from "html-minifier";
4
+ var HTMLMinifier = minifier.minify;
29
5
  var defaultOptions = {
30
6
  collapseBooleanAttributes: true,
31
7
  collapseInlineTagWhitespace: true,
@@ -52,7 +28,7 @@ var minifyHTMLMinifier = ({
52
28
  const options = Object.assign({}, defaultOptions, settings?.options);
53
29
  const contentMinified = HTMLMinifier(content ?? "", options);
54
30
  if (settings && !settings.content && settings.output) {
55
- settings.output && import_utils.utils.writeFile({
31
+ settings.output && utils.writeFile({
56
32
  file: settings.output,
57
33
  content: contentMinified,
58
34
  index
@@ -64,10 +40,12 @@ var minifyHTMLMinifier = ({
64
40
  return contentMinified;
65
41
  };
66
42
  minifyHTMLMinifier.default = minifyHTMLMinifier;
67
- module.exports = minifyHTMLMinifier;
43
+ var src_default = minifyHTMLMinifier;
44
+ export {
45
+ src_default as default
46
+ };
68
47
  /*!
69
48
  * node-minify
70
49
  * Copyright(c) 2011-2024 Rodolphe Stoclin
71
50
  * MIT Licensed
72
51
  */
73
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-minify/html-minifier",
3
- "version": "9.0.1",
3
+ "version": "10.0.0-next.0",
4
4
  "description": "html-minifier plugin for @node-minify",
5
5
  "keywords": [
6
6
  "compressor",
@@ -9,23 +9,22 @@
9
9
  "html-minifier"
10
10
  ],
11
11
  "author": "Rodolphe Stoclin <srodolphe@gmail.com>",
12
- "homepage": "https://github.com/srod/node-minify/tree/master/packages/html-minifier#readme",
12
+ "homepage": "https://github.com/srod/node-minify/tree/main/packages/html-minifier#readme",
13
13
  "license": "MIT",
14
+ "type": "module",
14
15
  "engines": {
15
- "node": ">=18.0.0"
16
+ "node": ">=22.0.0"
16
17
  },
17
18
  "directories": {
18
19
  "lib": "dist",
19
20
  "test": "__tests__"
20
21
  },
21
- "main": "./dist/index.js",
22
- "module": "./dist/index.mjs",
23
- "types": "./dist/index.d.ts",
22
+ "main": "./dist/index.cjs",
24
23
  "exports": {
24
+ "./package.json": "./package.json",
25
25
  ".": {
26
- "types": "./dist/index.d.ts",
27
- "import": "./dist/index.mjs",
28
- "require": "./dist/index.js"
26
+ "import": "./dist/index.js",
27
+ "default": "./dist/index.cjs"
29
28
  }
30
29
  },
31
30
  "files": [
@@ -41,20 +40,22 @@
41
40
  "bugs": {
42
41
  "url": "https://github.com/srod/node-minify/issues"
43
42
  },
44
- "dependencies": {
45
- "html-minifier": "4.0.0",
46
- "@node-minify/utils": "9.0.1"
47
- },
48
- "devDependencies": {
49
- "@types/html-minifier": "^4.0.2",
50
- "@node-minify/types": "9.0.0"
51
- },
52
43
  "scripts": {
53
- "clean": "pnpm dlx rimraf dist",
54
- "build": "pnpm clean && tsup src/index.ts --format cjs,esm --dts --clean --sourcemap",
44
+ "build": "tsup src/index.ts --format cjs,esm --dts --clean && bunx fix-tsup-cjs",
45
+ "check-exports": "attw --pack .",
46
+ "format:check": "biome check .",
55
47
  "lint": "biome lint .",
48
+ "prepublishOnly": "bun run build",
56
49
  "test": "vitest run",
57
50
  "test:ci": "vitest run --coverage",
58
51
  "test:watch": "vitest"
52
+ },
53
+ "dependencies": {
54
+ "@node-minify/utils": "workspace:*",
55
+ "html-minifier": "4.0.0"
56
+ },
57
+ "devDependencies": {
58
+ "@node-minify/types": "workspace:*",
59
+ "@types/html-minifier": "^4.0.5"
59
60
  }
60
- }
61
+ }
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
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 DELETED
@@ -1,59 +0,0 @@
1
- var __getOwnPropNames = Object.getOwnPropertyNames;
2
- var __commonJS = (cb, mod) => function __require() {
3
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
4
- };
5
-
6
- // src/index.ts
7
- import { utils } from "@node-minify/utils";
8
- import minifier from "html-minifier";
9
- var require_src = __commonJS({
10
- "src/index.ts"(exports, module) {
11
- var HTMLMinifier = minifier.minify;
12
- var defaultOptions = {
13
- collapseBooleanAttributes: true,
14
- collapseInlineTagWhitespace: true,
15
- collapseWhitespace: true,
16
- minifyCSS: true,
17
- minifyJS: true,
18
- removeAttributeQuotes: true,
19
- removeCDATASectionsFromCDATA: true,
20
- removeComments: true,
21
- removeCommentsFromCDATA: true,
22
- removeEmptyAttributes: true,
23
- removeOptionalTags: true,
24
- removeRedundantAttributes: true,
25
- removeScriptTypeAttributes: true,
26
- removeStyleLinkTypeAttributes: true,
27
- useShortDoctype: true
28
- };
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);
37
- if (settings && !settings.content && settings.output) {
38
- settings.output && utils.writeFile({
39
- file: settings.output,
40
- content: contentMinified,
41
- index
42
- });
43
- }
44
- if (callback) {
45
- return callback(null, contentMinified);
46
- }
47
- return contentMinified;
48
- };
49
- minifyHTMLMinifier.default = minifyHTMLMinifier;
50
- module.exports = minifyHTMLMinifier;
51
- }
52
- });
53
- export default require_src();
54
- /*!
55
- * node-minify
56
- * Copyright(c) 2011-2024 Rodolphe Stoclin
57
- * MIT Licensed
58
- */
59
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
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":[]}