From f214ec7584007bc328bba7fb5041955a52e24fa5 Mon Sep 17 00:00:00 2001 From: Aaron Levy Date: Wed, 17 Sep 2025 15:03:26 -0700 Subject: [PATCH 1/3] Replacing unmaintained html-minifier with html-minifier-next --- package-lock.json | 268 ++++++------------ .../package.json | 4 +- .../src/index.ts | 4 +- .../src/lib/minify-html-literals.ts | 18 +- .../src/lib/strategy.ts | 8 +- .../src/test/minify-html-literals.spec.ts | 100 ++++--- ...rollup-plugin-minify-html-literals.spec.ts | 2 +- .../src/test/strategy.spec.ts | 12 +- 8 files changed, 161 insertions(+), 255 deletions(-) diff --git a/package-lock.json b/package-lock.json index 822047ab81..746f2eca4c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7714,16 +7714,16 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/html-minifier": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/@types/html-minifier/-/html-minifier-4.0.5.tgz", - "integrity": "sha512-LfE7f7MFd+YUfZnlBz8W43P4NgSObWiqyKapANsWCj63Aqeqli8/9gVsGP4CwC8jPpTTYlTopKCk9rJSuht/ew==", + "node_modules/@types/html-minifier-next": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@types/html-minifier-next/-/html-minifier-next-1.1.0.tgz", + "integrity": "sha512-YFQ9AaS14NBG4bKwkMRIpM/UWIK0Uxsy/IXvDoNzq0P1xFT8iecnFlFXcms5IvxU1GkYkLMu5aYFqjtePyCmvQ==", "dev": true, "license": "MIT", "dependencies": { "@types/clean-css": "*", "@types/relateurl": "*", - "@types/uglify-js": "*" + "terser": "*" } }, "node_modules/@types/http-assert": { @@ -8158,26 +8158,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/uglify-js": { - "version": "3.17.5", - "resolved": "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.17.5.tgz", - "integrity": "sha512-TU+fZFBTBcXj/GpDpDaBmgWk/gn96kMZ+uocaFUlV2f8a6WdMzzI44QBCmGcCiYR0Y6ZlNRiyUyKKt5nl/lbzQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "source-map": "^0.6.1" - } - }, - "node_modules/@types/uglify-js/node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/@types/vscode": { "version": "1.103.0", "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.103.0.tgz", @@ -9011,22 +8991,6 @@ "node": ">=10" } }, - "node_modules/@wdio/config/node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", - "dev": true, - "license": "Apache-2.0", - "optional": true, - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, "node_modules/@wdio/config/node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", @@ -9153,22 +9117,6 @@ } } }, - "node_modules/@wdio/utils/node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", - "dev": true, - "license": "Apache-2.0", - "optional": true, - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, "node_modules/@wdio/utils/node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", @@ -12516,16 +12464,6 @@ "node": ">=6" } }, - "node_modules/camel-case": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-3.0.0.tgz", - "integrity": "sha512-+MbKztAYHXPr1jNTSKQF52VpcFjwY5RkR7fxksV8Doo4KAYc5Fl4UJRgthBbTmEx8C54DqahhbLJkDwjI3PI/w==", - "license": "MIT", - "dependencies": { - "no-case": "^2.2.0", - "upper-case": "^1.1.1" - } - }, "node_modules/camelcase": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", @@ -12576,7 +12514,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/capital-case/-/capital-case-1.0.4.tgz", "integrity": "sha512-ds37W8CytHgwnhGGTi88pcPyR15qoNkOpYwmMMfnWqqWgESapLqvDx6huFjQ5vqWSn2Z06173XNA7LtMOeUh1A==", - "dev": true, "license": "MIT", "dependencies": { "no-case": "^3.0.4", @@ -12588,7 +12525,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", - "dev": true, "license": "MIT", "dependencies": { "tslib": "^2.0.3" @@ -12598,7 +12534,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", - "dev": true, "license": "MIT", "dependencies": { "lower-case": "^2.0.2", @@ -12704,7 +12639,6 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/change-case/-/change-case-4.1.2.tgz", "integrity": "sha512-bSxY2ws9OtviILG1EiY5K7NNxkqg/JnRnFxLtKQ96JaviiIxi7djMrSd0ECT9AC+lttClmYwKw53BWpOMblo7A==", - "dev": true, "license": "MIT", "dependencies": { "camel-case": "^4.1.2", @@ -12725,7 +12659,6 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-4.1.2.tgz", "integrity": "sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==", - "dev": true, "license": "MIT", "dependencies": { "pascal-case": "^3.1.2", @@ -12736,7 +12669,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", - "dev": true, "license": "MIT", "dependencies": { "tslib": "^2.0.3" @@ -12746,7 +12678,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", - "dev": true, "license": "MIT", "dependencies": { "lower-case": "^2.0.2", @@ -12757,7 +12688,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", "integrity": "sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==", - "dev": true, "license": "MIT", "dependencies": { "dot-case": "^3.0.4", @@ -13698,7 +13628,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/constant-case/-/constant-case-3.0.4.tgz", "integrity": "sha512-I2hSBi7Vvs7BEuJDr5dDHfzb/Ruj3FyvFyh7KLilAjNQw3Be+xgqUBA2W6scVEcL0hL1dwPRtIqEPVUCKkSsyQ==", - "dev": true, "license": "MIT", "dependencies": { "no-case": "^3.0.4", @@ -13710,7 +13639,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", - "dev": true, "license": "MIT", "dependencies": { "tslib": "^2.0.3" @@ -13720,7 +13648,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", - "dev": true, "license": "MIT", "dependencies": { "lower-case": "^2.0.2", @@ -13731,7 +13658,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-2.0.2.tgz", "integrity": "sha512-KgdgDGJt2TpuwBUIjgG6lzw2GWFRCW9Qkfkiv0DxqHHLYJHmtmdUIKcZd8rHgFSjopVTlw6ggzCm1b8MFQwikg==", - "dev": true, "license": "MIT", "dependencies": { "tslib": "^2.0.3" @@ -14726,22 +14652,6 @@ "dev": true, "license": "MIT" }, - "node_modules/devtools/node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", - "dev": true, - "license": "Apache-2.0", - "optional": true, - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, "node_modules/devtools/node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", @@ -14969,7 +14879,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", - "dev": true, "license": "MIT", "dependencies": { "no-case": "^3.0.4", @@ -14980,7 +14889,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", - "dev": true, "license": "MIT", "dependencies": { "tslib": "^2.0.3" @@ -14990,7 +14898,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", - "dev": true, "license": "MIT", "dependencies": { "lower-case": "^2.0.2", @@ -18830,6 +18737,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true, "license": "MIT", "bin": { "he": "bin/he" @@ -18839,7 +18747,6 @@ "version": "2.0.4", "resolved": "https://registry.npmjs.org/header-case/-/header-case-2.0.4.tgz", "integrity": "sha512-H/vuk5TEEVZwrR0lp2zed9OCo1uAILMlx0JEMgC26rzyJJ3N1v6XkwHHXJQdR2doSjcGPM6OKPYoJgf0plJ11Q==", - "dev": true, "license": "MIT", "dependencies": { "capital-case": "^1.0.4", @@ -18868,27 +18775,89 @@ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "license": "MIT" }, - "node_modules/html-minifier": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/html-minifier/-/html-minifier-4.0.0.tgz", - "integrity": "sha512-aoGxanpFPLg7MkIl/DDFYtb0iWz7jMFGqFhvEDZga6/4QTjneiD8I/NXL1x5aaoCp7FSIT6h/OhykDdPsbtMig==", + "node_modules/html-minifier-next": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/html-minifier-next/-/html-minifier-next-2.1.3.tgz", + "integrity": "sha512-CbMdqwoDyZs9km2v8agwAtiNVI0DQwldj07KIWQ6sbQtSS9ruDresTi9waOLweYGCwtIQL8lAqQXkdmoFE02yg==", "license": "MIT", "dependencies": { - "camel-case": "^3.0.0", - "clean-css": "^4.2.1", - "commander": "^2.19.0", - "he": "^1.2.0", - "param-case": "^2.1.1", + "change-case": "^4.1.2", + "clean-css": "~5.3.3", + "commander": "^14.0.0", + "entities": "^7.0.0", "relateurl": "^0.2.7", - "uglify-js": "^3.5.1" + "terser": "^5.44.0" }, "bin": { - "html-minifier": "cli.js" + "html-minifier-next": "cli.js" + } + }, + "node_modules/html-minifier-next/node_modules/clean-css": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.3.3.tgz", + "integrity": "sha512-D5J+kHaVb/wKSFcyyV75uCn8fiY4sV38XJoe4CUyGQ+mOU/fMVYUdH1hJC+CJQ5uY3EnW27SbJYS4X8BiLrAFg==", + "license": "MIT", + "dependencies": { + "source-map": "~0.6.0" }, "engines": { - "node": ">=6" + "node": ">= 10.0" + } + }, + "node_modules/html-minifier-next/node_modules/commander": { + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-14.0.1.tgz", + "integrity": "sha512-2JkV3gUZUVrbNA+1sjBOYLsMZ5cEEl8GTFP2a4AVz5hvasAMCQ1D2l2le/cX+pV4N6ZU17zjUahLpIXRrnWL8A==", + "license": "MIT", + "engines": { + "node": ">=20" + } + }, + "node_modules/html-minifier-next/node_modules/entities": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-7.0.0.tgz", + "integrity": "sha512-FDWG5cmEYf2Z00IkYRhbFrwIwvdFKH07uV8dvNy0omp/Qb1xcyCWp2UDtcwJF4QZZvk0sLudP6/hAu42TaqVhQ==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/html-minifier-next/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/html-minifier-next/node_modules/terser": { + "version": "5.44.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.44.0.tgz", + "integrity": "sha512-nIVck8DK+GM/0Frwd+nIhZ84pR/BX7rmXMfYwyg+Sri5oGVE99/E3KvXqpC2xHFxyqXyGHTKBSioxxplrO4I4w==", + "license": "BSD-2-Clause", + "dependencies": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.15.0", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" } }, + "node_modules/html-minifier-next/node_modules/terser/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "license": "MIT" + }, "node_modules/html-minifier-terser": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/html-minifier-terser/-/html-minifier-terser-5.1.1.tgz", @@ -23249,12 +23218,6 @@ "dev": true, "license": "MIT" }, - "node_modules/lower-case": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-1.1.4.tgz", - "integrity": "sha512-2Fgx1Ycm599x+WGpIYwJOvsjmXFzTSc34IwDWALRA/8AopUKAVPwfJ+h5+f85BCp0PWmmJcWzEpxOpoXycMpdA==", - "license": "MIT" - }, "node_modules/lowercase-keys": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", @@ -24523,15 +24486,6 @@ "isarray": "0.0.1" } }, - "node_modules/no-case": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/no-case/-/no-case-2.3.2.tgz", - "integrity": "sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==", - "license": "MIT", - "dependencies": { - "lower-case": "^1.1.1" - } - }, "node_modules/node-domexception": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", @@ -25489,15 +25443,6 @@ "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", "license": "(MIT AND Zlib)" }, - "node_modules/param-case": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/param-case/-/param-case-2.1.1.tgz", - "integrity": "sha512-eQE845L6ot89sk2N8liD8HAuH4ca6Vvr7VWAWwt7+kvvG5aBcPmmphQ68JsEG2qa9n1TykS2DLeMt363AAH8/w==", - "license": "MIT", - "dependencies": { - "no-case": "^2.2.0" - } - }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -25590,7 +25535,6 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.2.tgz", "integrity": "sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==", - "dev": true, "license": "MIT", "dependencies": { "no-case": "^3.0.4", @@ -25601,7 +25545,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", - "dev": true, "license": "MIT", "dependencies": { "tslib": "^2.0.3" @@ -25611,7 +25554,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", - "dev": true, "license": "MIT", "dependencies": { "lower-case": "^2.0.2", @@ -25632,7 +25574,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/path-case/-/path-case-3.0.4.tgz", "integrity": "sha512-qO4qCFjXqVTrcbPt/hQfhTQ+VhFsqNKOPtytgNKkKxSoEp3XPUQ8ObFuePylOIok5gjn69ry8XiULxCwot3Wfg==", - "dev": true, "license": "MIT", "dependencies": { "dot-case": "^3.0.4", @@ -28658,7 +28599,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/sentence-case/-/sentence-case-3.0.4.tgz", "integrity": "sha512-8LS0JInaQMCRoQ7YUytAo/xUu5W2XnQxV2HI/6uM6U7CITS1RqPElr30V6uIqyMKM9lJGRVFy5/4CuzcixNYSg==", - "dev": true, "license": "MIT", "dependencies": { "no-case": "^3.0.4", @@ -28670,7 +28610,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", - "dev": true, "license": "MIT", "dependencies": { "tslib": "^2.0.3" @@ -28680,7 +28619,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", - "dev": true, "license": "MIT", "dependencies": { "lower-case": "^2.0.2", @@ -29204,7 +29142,6 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz", "integrity": "sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==", - "dev": true, "license": "MIT", "dependencies": { "dot-case": "^3.0.4", @@ -31877,7 +31814,9 @@ "version": "3.19.3", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz", "integrity": "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==", + "dev": true, "license": "BSD-2-Clause", + "optional": true, "bin": { "uglifyjs": "bin/uglifyjs" }, @@ -32206,17 +32145,10 @@ "browserslist": ">= 4.21.0" } }, - "node_modules/upper-case": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-1.1.3.tgz", - "integrity": "sha512-WRbjgmYzgXkCV7zNVpy5YgrHgbBv126rMALQQMrmzOVC4GM2waQ9x7xtm8VU+1yF2kWyPzI9zbZ48n4vSxwfSA==", - "license": "MIT" - }, "node_modules/upper-case-first": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/upper-case-first/-/upper-case-first-2.0.2.tgz", "integrity": "sha512-514ppYHBaKwfJRK/pNC6c/OxfGa0obSnAl106u97Ed0I625Nin96KAjttZF6ZL3e1XLtphxnqrOi9iWgm+u+bg==", - "dev": true, "license": "MIT", "dependencies": { "tslib": "^2.0.3" @@ -32796,22 +32728,6 @@ } } }, - "node_modules/webdriver/node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", - "dev": true, - "license": "Apache-2.0", - "optional": true, - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, "node_modules/webdriver/node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", @@ -33007,22 +32923,6 @@ "dev": true, "license": "BSD-3-Clause" }, - "node_modules/webdriverio/node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", - "dev": true, - "license": "Apache-2.0", - "optional": true, - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" - } - }, "node_modules/webdriverio/node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", @@ -34632,14 +34532,14 @@ "license": "BSD-3-Clause", "dependencies": { "clean-css": "^4.2.1", - "html-minifier": "^4.0.0", + "html-minifier-next": "^2.1.3", "magic-string": "^0.30.11", "rollup-pluginutils": "^2.8.2", "typescript": "^2.9.2 || ^3.0.0 || ^4.0.0 || ^5.0.0" }, "devDependencies": { "@types/clean-css": "^4.2.0", - "@types/html-minifier": "^4.0.5", + "@types/html-minifier-next": "^1.1.0", "@types/node": "^22.17.0", "@types/sinon": "^5.0.1", "c8": "^10.1.2", diff --git a/packages/labs/rollup-plugin-minify-html-literals/package.json b/packages/labs/rollup-plugin-minify-html-literals/package.json index add7641265..a6d4d59305 100644 --- a/packages/labs/rollup-plugin-minify-html-literals/package.json +++ b/packages/labs/rollup-plugin-minify-html-literals/package.json @@ -63,7 +63,7 @@ "c8": {}, "dependencies": { "clean-css": "^4.2.1", - "html-minifier": "^4.0.0", + "html-minifier-next": "^2.1.3", "magic-string": "^0.30.11", "rollup-pluginutils": "^2.8.2", "typescript": "^2.9.2 || ^3.0.0 || ^4.0.0 || ^5.0.0" @@ -73,7 +73,7 @@ }, "devDependencies": { "@types/clean-css": "^4.2.0", - "@types/html-minifier": "^4.0.5", + "@types/html-minifier-next": "^1.1.0", "@types/node": "^22.17.0", "@types/sinon": "^5.0.1", "c8": "^10.1.2", diff --git a/packages/labs/rollup-plugin-minify-html-literals/src/index.ts b/packages/labs/rollup-plugin-minify-html-literals/src/index.ts index b8ba1d8ed9..d9327fde0a 100644 --- a/packages/labs/rollup-plugin-minify-html-literals/src/index.ts +++ b/packages/labs/rollup-plugin-minify-html-literals/src/index.ts @@ -49,10 +49,10 @@ export default function ( return { name: 'minify-html-literals', - transform(this: PluginContext, code: string, id: string) { + async transform(this: PluginContext, code: string, id: string) { if (options.filter!(id)) { try { - return options.minifyHTMLLiterals!(code, { + return await options.minifyHTMLLiterals!(code, { ...minifyOptions, fileName: id, }); diff --git a/packages/labs/rollup-plugin-minify-html-literals/src/lib/minify-html-literals.ts b/packages/labs/rollup-plugin-minify-html-literals/src/lib/minify-html-literals.ts index bf22d9e014..0c0ebae238 100644 --- a/packages/labs/rollup-plugin-minify-html-literals/src/lib/minify-html-literals.ts +++ b/packages/labs/rollup-plugin-minify-html-literals/src/lib/minify-html-literals.ts @@ -236,10 +236,10 @@ export const defaultValidation: Validation = { * @param options minification options * @returns the minified code, or null if no minification occurred. */ -export function minifyHTMLLiterals( +export async function minifyHTMLLiterals( source: string, options?: DefaultOptions -): Result | null; +): Promise; /** * Minifies all HTML template literals in the provided source string. * @@ -247,14 +247,14 @@ export function minifyHTMLLiterals( * @param options minification options * @returns the minified code, or null if no minification occurred. */ -export function minifyHTMLLiterals( +export async function minifyHTMLLiterals( source: string, options?: CustomOptions -): Result | null; -export function minifyHTMLLiterals( +): Promise; +export async function minifyHTMLLiterals( source: string, options: Options = {} -): Result | null { +): Promise { options.minifyOptions = { ...defaultMinifyOptions, ...(options.minifyOptions || {}), @@ -291,7 +291,7 @@ export function minifyHTMLLiterals( } const ms = new options.MagicString(source); - templates.forEach((template) => { + for (const template of templates) { const minifyHTML = shouldMinify(template); const minifyCSS = !!strategy.minifyCSS && shouldMinifyCSS(template); if (minifyHTML || minifyCSS) { @@ -316,7 +316,7 @@ export function minifyHTMLLiterals( min = strategy.minifyCSS!(combined, cssOptions); } } else { - min = strategy.minifyHTML(combined, options.minifyOptions); + min = await strategy.minifyHTML(combined, options.minifyOptions); } const minParts = strategy.splitHTMLByPlaceholder(min, placeholder); @@ -331,7 +331,7 @@ export function minifyHTMLLiterals( } }); } - }); + } const sourceMin = ms.toString(); if (source === sourceMin) { diff --git a/packages/labs/rollup-plugin-minify-html-literals/src/lib/strategy.ts b/packages/labs/rollup-plugin-minify-html-literals/src/lib/strategy.ts index bf9761d017..3b62fa488b 100644 --- a/packages/labs/rollup-plugin-minify-html-literals/src/lib/strategy.ts +++ b/packages/labs/rollup-plugin-minify-html-literals/src/lib/strategy.ts @@ -3,7 +3,7 @@ import { OptimizationLevel, optimizationLevelFrom, } from 'clean-css/lib/options/optimization-level.js'; -import {Options as HTMLOptions, minify} from 'html-minifier'; +import {MinifierOptions as HTMLOptions, minify} from 'html-minifier-next'; import {TemplatePart} from './models.js'; /** @@ -42,7 +42,7 @@ export interface Strategy { * @param options html minify options * @returns minified HTML string */ - minifyHTML(html: string, options?: O): string; + minifyHTML(html: string, options?: O): string | Promise; /** * Minifies the provided CSS string. * @@ -109,7 +109,7 @@ export const defaultStrategy: Strategy = { combineHTMLStrings(parts, placeholder) { return parts.map((part) => part.text).join(placeholder); }, - minifyHTML(html, options = {}) { + async minifyHTML(html, options = {}) { let minifyCSSOptions: HTMLOptions['minifyCSS']; if (options.minifyCSS) { if ( @@ -131,7 +131,7 @@ export const defaultStrategy: Strategy = { adjustedMinifyCSSOptions = adjustMinifyCSSOptions(minifyCSSOptions); } - let result = minify(html, { + let result = await minify(html, { ...options, minifyCSS: adjustedMinifyCSSOptions, }); diff --git a/packages/labs/rollup-plugin-minify-html-literals/src/test/minify-html-literals.spec.ts b/packages/labs/rollup-plugin-minify-html-literals/src/test/minify-html-literals.spec.ts index 74b8c76c0a..37cdb821b5 100644 --- a/packages/labs/rollup-plugin-minify-html-literals/src/test/minify-html-literals.spec.ts +++ b/packages/labs/rollup-plugin-minify-html-literals/src/test/minify-html-literals.spec.ts @@ -1,7 +1,7 @@ import * as assert from 'node:assert/strict'; import {test, describe as suite, afterEach, beforeEach} from 'node:test'; import MagicString, {SourceMapOptions} from 'magic-string'; -import {Options as HTMLOptions} from 'html-minifier'; +import {MinifierOptions as HTMLOptions} from 'html-minifier-next'; import {ParseLiteralsOptions, parseLiterals} from '../lib/parse-literals.js'; import {Template, TemplatePart} from '../lib/models.js'; import Sinon from 'sinon'; @@ -239,55 +239,55 @@ suite('minify-html-literals', () => { } `; - test('should minify "html" and "css" tagged templates', () => { - const result = minifyHTMLLiterals(SOURCE, {fileName: 'test.js'}); + test('should minify "html" and "css" tagged templates', async () => { + const result = await minifyHTMLLiterals(SOURCE, {fileName: 'test.js'}); assert.equal(typeof result, 'object'); assert.equal(result!.code, SOURCE_MIN); }); - test('should minify "svg" tagged templates', () => { - const result = minifyHTMLLiterals(SVG_SOURCE, {fileName: 'test.js'}); + test('should minify "svg" tagged templates', async () => { + const result = await minifyHTMLLiterals(SVG_SOURCE, {fileName: 'test.js'}); assert.equal(typeof result, 'object'); assert.equal(result!.code, SVG_SOURCE_MIN); }); - test('should minify html with attribute placeholders that have no quotes and JS comments', () => { - const result = minifyHTMLLiterals(COMMENT_SOURCE, {fileName: 'test.js'}); + test('should minify html with attribute placeholders that have no quotes and JS comments', async () => { + const result = await minifyHTMLLiterals(COMMENT_SOURCE, {fileName: 'test.js'}); assert.equal(typeof result, 'object'); assert.equal(result!.code, COMMENT_SOURCE_MIN); }); - test('should minify html tagged with a member expression ending in html', () => { - const result = minifyHTMLLiterals(MEMBER_EXPRESSION_LITERAL_SOURCE, { + test('should minify html tagged with a member expression ending in html', async () => { + const result = await minifyHTMLLiterals(MEMBER_EXPRESSION_LITERAL_SOURCE, { fileName: 'test.js', }); assert.equal(typeof result, 'object'); assert.equal(result!.code, MEMBER_EXPRESSION_LITERAL_SOURCE_MIN); }); - test('should minify multiline svg elements', () => { - const result = minifyHTMLLiterals(SVG_MULTILINE_SOURCE, { + test('should minify multiline svg elements', async () => { + const result = await minifyHTMLLiterals(SVG_MULTILINE_SOURCE, { fileName: 'test.js', }); assert.equal(typeof result, 'object'); assert.equal(result!.code, SVG_MULTILINE_SOURCE_MIN); }); - test('should not remove spaces in ::part()', () => { - const result = minifyHTMLLiterals(SHADOW_PARTS_SOURCE, { + test('should not remove spaces in ::part()', async () => { + const result = await minifyHTMLLiterals(SHADOW_PARTS_SOURCE, { fileName: 'test.js', }); assert.equal(typeof result, 'object'); assert.equal(result!.code, SHADOW_PARTS_SOURCE_MIN); }); - test('should return null if source is already minified', () => { - const result = minifyHTMLLiterals(SOURCE_MIN, {fileName: 'test.js'}); + test('should return null if source is already minified', async () => { + const result = await minifyHTMLLiterals(SOURCE_MIN, {fileName: 'test.js'}); assert.equal(result, null); }); - test('should return a v3 source map', () => { - const result = minifyHTMLLiterals(SOURCE, {fileName: 'test.js'}); + test('should return a v3 source map', async () => { + const result = await minifyHTMLLiterals(SOURCE, {fileName: 'test.js'}); assert.equal(typeof result, 'object'); assert.equal(typeof result!.map, 'object'); assert.equal(result!.map!.version, 3); @@ -295,9 +295,9 @@ suite('minify-html-literals', () => { }); // TODO: fix this case - test('fails to minify static html templates', () => { - assert.throws(() => - minifyHTMLLiterals(STATIC_SOURCE, {fileName: 'test.js'}) + test('fails to minify static html templates', async () => { + await assert.rejects(async () => + await minifyHTMLLiterals(STATIC_SOURCE, {fileName: 'test.js'}) ); }); @@ -312,37 +312,43 @@ suite('minify-html-literals', () => { minifyHTMLSpy.restore(); }); - test('should use defaultMinifyOptions', () => { - minifyHTMLLiterals(SOURCE, {fileName: 'test.js'}); + test('should use defaultMinifyOptions', async () => { + const result = await minifyHTMLLiterals(SOURCE, {fileName: 'test.js'}); + // Verify that minification actually happened + assert.notEqual(result, null); + assert.ok(minifyHTMLSpy.called); const parts = parseLiterals(SOURCE)[1].parts; const html = defaultStrategy.combineHTMLStrings( parts, defaultStrategy.getPlaceholder(parts) ); - assert.ok( - minifyHTMLSpy.lastCall.calledWithExactly(html, defaultMinifyOptions) - ); + // Check that the spy was called with the expected arguments + assert.ok(minifyHTMLSpy.calledWith(html, defaultMinifyOptions)); }); - test('should allow custom partial minifyOptions', () => { + test('should allow custom partial minifyOptions', async () => { const minifyOptions = {caseSensitive: false}; - minifyHTMLLiterals(SOURCE, {fileName: 'test.js', minifyOptions}); + const result = await minifyHTMLLiterals(SOURCE, {fileName: 'test.js', minifyOptions}); + // Verify that minification actually happened + assert.notEqual(result, null); + assert.ok(minifyHTMLSpy.called); const parts = parseLiterals(SOURCE)[1].parts; const html = defaultStrategy.combineHTMLStrings( parts, defaultStrategy.getPlaceholder(parts) ); + // Check that the spy was called with the expected arguments assert.ok( - minifyHTMLSpy.lastCall.calledWithExactly(html, { + minifyHTMLSpy.calledWith(html, { ...defaultMinifyOptions, ...minifyOptions, }) ); }); - test('should use MagicString constructor', () => { + test('should use MagicString constructor', async () => { let msUsed: unknown; - minifyHTMLLiterals(SOURCE, { + await minifyHTMLLiterals(SOURCE, { fileName: 'test.js', generateSourceMap(ms) { msUsed = ms; @@ -353,9 +359,9 @@ suite('minify-html-literals', () => { assert.ok(msUsed instanceof MagicString); }); - test('should allow custom MagicStringLike constructor', () => { + test('should allow custom MagicStringLike constructor', async () => { let msUsed: unknown; - minifyHTMLLiterals(SOURCE, { + await minifyHTMLLiterals(SOURCE, { fileName: 'test.js', MagicString: MagicStringLike, generateSourceMap(ms) { @@ -393,7 +399,7 @@ suite('minify-html-literals', () => { assert.ok(customShouldMinify.called); }); - test('should allow custom strategy', () => { + test('should allow custom strategy', async () => { const customStrategy = { getPlaceholder: Sinon.spy((parts: TemplatePart[]) => { return defaultStrategy.getPlaceholder(parts); @@ -403,8 +409,8 @@ suite('minify-html-literals', () => { return defaultStrategy.combineHTMLStrings(parts, placeholder); } ), - minifyHTML: Sinon.spy((html: string, options?: HTMLOptions) => { - return defaultStrategy.minifyHTML(html, options); + minifyHTML: Sinon.spy(async (html: string, options?: HTMLOptions) => { + return await defaultStrategy.minifyHTML(html, options); }), splitHTMLByPlaceholder: Sinon.spy( (html: string, placeholder: string) => { @@ -413,7 +419,7 @@ suite('minify-html-literals', () => { ), }; - minifyHTMLLiterals(SOURCE, { + await minifyHTMLLiterals(SOURCE, { fileName: 'test.js', strategy: customStrategy, }); @@ -423,9 +429,9 @@ suite('minify-html-literals', () => { assert.ok(customStrategy.splitHTMLByPlaceholder.called); }); - test('should use defaultValidation', () => { - assert.throws(() => { - minifyHTMLLiterals(SOURCE, { + test('should use defaultValidation', async () => { + await assert.rejects(async () => { + await minifyHTMLLiterals(SOURCE, { fileName: 'test.js', strategy: { getPlaceholder: () => { @@ -438,8 +444,8 @@ suite('minify-html-literals', () => { }); }); - assert.throws(() => { - minifyHTMLLiterals(SOURCE, { + await assert.rejects(async () => { + await minifyHTMLLiterals(SOURCE, { fileName: 'test.js', strategy: { getPlaceholder: defaultStrategy.getPlaceholder, @@ -470,7 +476,7 @@ suite('minify-html-literals', () => { }); }); - test('should allow custom validation', () => { + test('should allow custom validation', async () => { const customValidation = { ensurePlaceholderValid: Sinon.spy((placeholder: unknown) => { return defaultValidation.ensurePlaceholderValid(placeholder); @@ -482,7 +488,7 @@ suite('minify-html-literals', () => { ), }; - minifyHTMLLiterals(SOURCE, { + await minifyHTMLLiterals(SOURCE, { fileName: 'test.js', validate: customValidation, }); @@ -490,8 +496,8 @@ suite('minify-html-literals', () => { assert.ok(customValidation.ensureHTMLPartsValid.called); }); - test('should allow disabling generateSourceMap', () => { - const result = minifyHTMLLiterals(SOURCE, { + test('should allow disabling generateSourceMap', async () => { + const result = await minifyHTMLLiterals(SOURCE, { fileName: 'test.js', generateSourceMap: false, }); @@ -499,14 +505,14 @@ suite('minify-html-literals', () => { assert.equal(result!.map, undefined); }); - test('should allow custom generateSourceMap()', () => { + test('should allow custom generateSourceMap()', async () => { const customGenerateSourceMap = Sinon.spy( (ms: MagicStringLike, fileName: string) => { return defaultGenerateSourceMap(ms, fileName); } ); - minifyHTMLLiterals(SOURCE, { + await minifyHTMLLiterals(SOURCE, { fileName: 'test.js', generateSourceMap: customGenerateSourceMap, }); diff --git a/packages/labs/rollup-plugin-minify-html-literals/src/test/rollup-plugin-minify-html-literals.spec.ts b/packages/labs/rollup-plugin-minify-html-literals/src/test/rollup-plugin-minify-html-literals.spec.ts index 9c42bb1afa..6971047614 100644 --- a/packages/labs/rollup-plugin-minify-html-literals/src/test/rollup-plugin-minify-html-literals.spec.ts +++ b/packages/labs/rollup-plugin-minify-html-literals/src/test/rollup-plugin-minify-html-literals.spec.ts @@ -74,7 +74,7 @@ suite('rollup-plugin-minify-html-literals', () => { minifyHTMLLiterals: customMinify as ( source: string, options?: minify.DefaultOptions | undefined - ) => minify.Result, + ) => Promise, }); plugin.transform.apply(context as unknown as TransformPluginContext, [ diff --git a/packages/labs/rollup-plugin-minify-html-literals/src/test/strategy.spec.ts b/packages/labs/rollup-plugin-minify-html-literals/src/test/strategy.spec.ts index f7f91ef994..0c4c70ea4d 100644 --- a/packages/labs/rollup-plugin-minify-html-literals/src/test/strategy.spec.ts +++ b/packages/labs/rollup-plugin-minify-html-literals/src/test/strategy.spec.ts @@ -1,6 +1,6 @@ import {test, describe as suite} from 'node:test'; import * as assert from 'node:assert/strict'; -import {minify} from 'html-minifier'; +import {minify} from 'html-minifier-next'; import {defaultMinifyOptions, defaultStrategy} from '../lib/strategy.js'; import {TemplatePart} from '../lib/models.js'; @@ -57,9 +57,9 @@ suite('strategy', () => { assert.ok(twoUnderscores.includes('__')); }); - test('should return a value that is preserved by html-minifier when splitting', () => { + test('should return a value that is preserved by html-minifier when splitting', async () => { const placeholder = defaultStrategy.getPlaceholder(parts); - const minHtml = defaultStrategy.minifyHTML( + const minHtml = await defaultStrategy.minifyHTML( ` @@ -111,8 +111,8 @@ suite('strategy', () => { `; assert.equal( - defaultStrategy.minifyHTML(html, defaultMinifyOptions), - minify(html, defaultMinifyOptions) + await defaultStrategy.minifyHTML(html, defaultMinifyOptions), + await minify(html, defaultMinifyOptions) ); }); }); From f536b5e2b13dce34f0c4e6eafbe01973b5cac81e Mon Sep 17 00:00:00 2001 From: Aaron Levy Date: Wed, 17 Sep 2025 15:07:17 -0700 Subject: [PATCH 2/3] Create fifty-frogs-brake.md --- .changeset/fifty-frogs-brake.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/fifty-frogs-brake.md diff --git a/.changeset/fifty-frogs-brake.md b/.changeset/fifty-frogs-brake.md new file mode 100644 index 0000000000..0ea552aa40 --- /dev/null +++ b/.changeset/fifty-frogs-brake.md @@ -0,0 +1,5 @@ +--- +"@lit-labs/rollup-plugin-minify-html-literals": patch +--- + +Replacing unmaintained html-minifier with html-minifier-next From 443137f65f2bf21115851ef7a0199077c64fcee2 Mon Sep 17 00:00:00 2001 From: Justin Fagnani Date: Mon, 29 Sep 2025 12:55:43 -0700 Subject: [PATCH 3/3] Format --- .changeset/fifty-frogs-brake.md | 2 +- .../src/test/minify-html-literals.spec.ts | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.changeset/fifty-frogs-brake.md b/.changeset/fifty-frogs-brake.md index 0ea552aa40..db78373b29 100644 --- a/.changeset/fifty-frogs-brake.md +++ b/.changeset/fifty-frogs-brake.md @@ -1,5 +1,5 @@ --- -"@lit-labs/rollup-plugin-minify-html-literals": patch +'@lit-labs/rollup-plugin-minify-html-literals': patch --- Replacing unmaintained html-minifier with html-minifier-next diff --git a/packages/labs/rollup-plugin-minify-html-literals/src/test/minify-html-literals.spec.ts b/packages/labs/rollup-plugin-minify-html-literals/src/test/minify-html-literals.spec.ts index 37cdb821b5..2413317912 100644 --- a/packages/labs/rollup-plugin-minify-html-literals/src/test/minify-html-literals.spec.ts +++ b/packages/labs/rollup-plugin-minify-html-literals/src/test/minify-html-literals.spec.ts @@ -252,7 +252,9 @@ suite('minify-html-literals', () => { }); test('should minify html with attribute placeholders that have no quotes and JS comments', async () => { - const result = await minifyHTMLLiterals(COMMENT_SOURCE, {fileName: 'test.js'}); + const result = await minifyHTMLLiterals(COMMENT_SOURCE, { + fileName: 'test.js', + }); assert.equal(typeof result, 'object'); assert.equal(result!.code, COMMENT_SOURCE_MIN); }); @@ -296,8 +298,8 @@ suite('minify-html-literals', () => { // TODO: fix this case test('fails to minify static html templates', async () => { - await assert.rejects(async () => - await minifyHTMLLiterals(STATIC_SOURCE, {fileName: 'test.js'}) + await assert.rejects( + async () => await minifyHTMLLiterals(STATIC_SOURCE, {fileName: 'test.js'}) ); }); @@ -328,7 +330,10 @@ suite('minify-html-literals', () => { test('should allow custom partial minifyOptions', async () => { const minifyOptions = {caseSensitive: false}; - const result = await minifyHTMLLiterals(SOURCE, {fileName: 'test.js', minifyOptions}); + const result = await minifyHTMLLiterals(SOURCE, { + fileName: 'test.js', + minifyOptions, + }); // Verify that minification actually happened assert.notEqual(result, null); assert.ok(minifyHTMLSpy.called);