diff --git a/.changeset/eleven-singers-pay.md b/.changeset/eleven-singers-pay.md new file mode 100644 index 000000000000..94096ab81510 --- /dev/null +++ b/.changeset/eleven-singers-pay.md @@ -0,0 +1,5 @@ +--- +'@modern-js/uni-builder': patch +--- + +feat(deps): bump html-webpack-plugin to support getCompilationHooks diff --git a/packages/cli/uni-builder/package.json b/packages/cli/uni-builder/package.json index 1e35200af8ad..fc309fa8046d 100644 --- a/packages/cli/uni-builder/package.json +++ b/packages/cli/uni-builder/package.json @@ -62,7 +62,7 @@ "cssnano": "6.0.1", "glob": "^9.3.5", "html-minifier-terser": "^7.2.0", - "html-webpack-plugin": "5.5.3", + "html-webpack-plugin": "5.6.2", "lodash": "^4.17.21", "picocolors": "^1.0.1", "postcss": "^8.4.35", diff --git a/packages/cli/uni-builder/tests/__snapshots__/default.test.ts.snap b/packages/cli/uni-builder/tests/__snapshots__/default.test.ts.snap index 3d6cb15ff818..719b8871df07 100644 --- a/packages/cli/uni-builder/tests/__snapshots__/default.test.ts.snap +++ b/packages/cli/uni-builder/tests/__snapshots__/default.test.ts.snap @@ -4626,6 +4626,36 @@ exports[`uni-builder webpack > should generator webpack config correctly 1`] = ` }, }, HtmlWebpackPlugin { + "options": { + "base": false, + "cache": true, + "chunks": [ + "index", + ], + "chunksSortMode": "auto", + "compile": true, + "entryName": "index", + "excludeChunks": [], + "favicon": false, + "filename": "html/index/index.html", + "hash": false, + "inject": "head", + "meta": { + "charset": { + "charset": "UTF-8", + }, + "viewport": "width=device-width, initial-scale=1.0", + }, + "minify": false, + "publicPath": "auto", + "scriptLoading": "defer", + "showErrors": true, + "template": "", + "templateContent": "
", + "templateParameters": [Function], + "title": "", + "xhtml": false, + }, "userOptions": { "chunks": [ "index", @@ -5896,6 +5926,55 @@ exports[`uni-builder webpack > should generator webpack config correctly when pr }, }, HtmlWebpackPlugin { + "options": { + "base": false, + "cache": true, + "chunks": [ + "index", + ], + "chunksSortMode": "auto", + "compile": true, + "entryName": "index", + "excludeChunks": [], + "favicon": false, + "filename": "html/index/index.html", + "hash": false, + "inject": "head", + "meta": { + "charset": { + "charset": "UTF-8", + }, + "viewport": "width=device-width, initial-scale=1.0", + }, + "minify": { + "collapseWhitespace": true, + "keepClosingSlash": true, + "minifyCSS": true, + "minifyJS": { + "format": { + "ascii_only": true, + }, + "mangle": { + "safari10": true, + }, + }, + "minifyURLs": true, + "removeComments": false, + "removeEmptyAttributes": true, + "removeRedundantAttributes": true, + "removeScriptTypeAttributes": true, + "removeStyleLinkTypeAttributes": true, + "useShortDoctype": true, + }, + "publicPath": "auto", + "scriptLoading": "defer", + "showErrors": true, + "template": "", + "templateContent": "
", + "templateParameters": [Function], + "title": "", + "xhtml": false, + }, "userOptions": { "chunks": [ "index", diff --git a/packages/cli/uni-builder/tests/__snapshots__/minimize.test.ts.snap b/packages/cli/uni-builder/tests/__snapshots__/minimize.test.ts.snap index c64e495c1269..0f8889cb0c3d 100644 --- a/packages/cli/uni-builder/tests/__snapshots__/minimize.test.ts.snap +++ b/packages/cli/uni-builder/tests/__snapshots__/minimize.test.ts.snap @@ -19,6 +19,36 @@ exports[`html minify > should not apply html minify in production when disableMi }, }, HtmlWebpackPlugin { + "options": { + "base": false, + "cache": true, + "chunks": [ + "index", + ], + "chunksSortMode": "auto", + "compile": true, + "entryName": "index", + "excludeChunks": [], + "favicon": false, + "filename": "html/index/index.html", + "hash": false, + "inject": "head", + "meta": { + "charset": { + "charset": "UTF-8", + }, + "viewport": "width=device-width, initial-scale=1.0", + }, + "minify": false, + "publicPath": "auto", + "scriptLoading": "defer", + "showErrors": true, + "template": "", + "templateContent": "
", + "templateParameters": [Function], + "title": "", + "xhtml": false, + }, "userOptions": { "chunks": [ "index", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 10bba0613b1b..74df7536601c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -719,8 +719,8 @@ importers: specifier: ^7.2.0 version: 7.2.0 html-webpack-plugin: - specifier: 5.5.3 - version: 5.5.3(webpack@5.95.0(esbuild@0.17.19)) + specifier: 5.6.2 + version: 5.6.2(@rspack/core@1.0.13(@swc/helpers@0.5.13))(webpack@5.95.0(esbuild@0.17.19)) lodash: specifier: ^4.17.21 version: 4.17.21 @@ -771,7 +771,7 @@ importers: version: 5.95.0(esbuild@0.17.19) webpack-subresource-integrity: specifier: 5.1.0 - version: 5.1.0(html-webpack-plugin@5.5.3(webpack@5.95.0(esbuild@0.17.19)))(webpack@5.95.0(esbuild@0.17.19)) + version: 5.1.0(html-webpack-plugin@5.6.2(@rspack/core@1.0.13(@swc/helpers@0.5.13))(webpack@5.95.0(esbuild@0.17.19)))(webpack@5.95.0(esbuild@0.17.19)) devDependencies: '@rsbuild/plugin-webpack-swc': specifier: ~1.0.3 @@ -6614,18 +6614,6 @@ importers: specifier: ^5 version: 5.3.3 - tests/integration/plugins: - devDependencies: - '@modern-js/app-tools': - specifier: workspace:* - version: link:../../../packages/solutions/app-tools - '@types/jest': - specifier: ^29 - version: 29.5.13 - '@types/node': - specifier: ^14 - version: 14.18.35 - tests/integration/pure-esm-project: dependencies: '@modern-js/plugin-bff': @@ -13994,10 +13982,6 @@ packages: classnames@2.3.2: resolution: {integrity: sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==} - clean-css@5.2.2: - resolution: {integrity: sha512-/eR8ru5zyxKzpBLv9YZvMXgTSSQn7AdkMItMYynsFgGwTveCRVam9IUPFloE85B4vAIj05IuKmmEoV7/AQjT0w==} - engines: {node: '>= 10.0'} - clean-css@5.3.3: resolution: {integrity: sha512-D5J+kHaVb/wKSFcyyV75uCn8fiY4sV38XJoe4CUyGQ+mOU/fMVYUdH1hJC+CJQ5uY3EnW27SbJYS4X8BiLrAFg==} engines: {node: '>= 10.0'} @@ -16183,11 +16167,17 @@ packages: html-void-elements@2.0.1: resolution: {integrity: sha512-0quDb7s97CfemeJAnW9wC0hw78MtW7NU3hqtCD75g2vFlDLt36llsYD7uB7SUzojLMP24N5IatXf7ylGXiGG9A==} - html-webpack-plugin@5.5.3: - resolution: {integrity: sha512-6YrDKTuqaP/TquFH7h4srYWsZx+x6k6+FbsTm0ziCwGHDP78Unr1r9F/H4+sGmMbX08GQcJ+K64x55b+7VM/jg==} + html-webpack-plugin@5.6.2: + resolution: {integrity: sha512-q7xp/FO9RGBVoTKNItkdX1jKLscLFkgn/dLVFNYbHVbfHLBk6DYW5nsQ8kCzIWcgKP/kUBocetjvav6lD8YfCQ==} engines: {node: '>=10.13.0'} peerDependencies: + '@rspack/core': 0.x || 1.x webpack: ^5.20.0 + peerDependenciesMeta: + '@rspack/core': + optional: true + webpack: + optional: true html5shiv@3.7.3: resolution: {integrity: sha512-SZwGvLGNtgp8GbgFX7oXEp8OR1aBt5LliX6dG0kdD1kl3KhMonN0QcSa/A3TsTgFewaGCbIryQunjayWDXzxmw==} @@ -31385,10 +31375,6 @@ snapshots: classnames@2.3.2: {} - clean-css@5.2.2: - dependencies: - source-map: 0.6.1 - clean-css@5.3.3: dependencies: source-map: 0.6.1 @@ -33988,7 +33974,7 @@ snapshots: html-minifier-terser@6.1.0: dependencies: camel-case: 4.1.2 - clean-css: 5.2.2 + clean-css: 5.3.3 commander: 8.3.0 he: 1.2.0 param-case: 3.0.4 @@ -34019,13 +34005,15 @@ snapshots: html-void-elements@2.0.1: {} - html-webpack-plugin@5.5.3(webpack@5.95.0(esbuild@0.17.19)): + html-webpack-plugin@5.6.2(@rspack/core@1.0.13(@swc/helpers@0.5.13))(webpack@5.95.0(esbuild@0.17.19)): dependencies: '@types/html-minifier-terser': 6.1.0 html-minifier-terser: 6.1.0 lodash: 4.17.21 pretty-error: 4.0.0 tapable: 2.2.1 + optionalDependencies: + '@rspack/core': 1.0.13(@swc/helpers@0.5.13) webpack: 5.95.0(esbuild@0.17.19) html5shiv@3.7.3: {} @@ -41646,12 +41634,12 @@ snapshots: webpack-sources@3.2.3: {} - webpack-subresource-integrity@5.1.0(html-webpack-plugin@5.5.3(webpack@5.95.0(esbuild@0.17.19)))(webpack@5.95.0(esbuild@0.17.19)): + webpack-subresource-integrity@5.1.0(html-webpack-plugin@5.6.2(@rspack/core@1.0.13(@swc/helpers@0.5.13))(webpack@5.95.0(esbuild@0.17.19)))(webpack@5.95.0(esbuild@0.17.19)): dependencies: typed-assert: 1.0.9 webpack: 5.95.0(esbuild@0.17.19) optionalDependencies: - html-webpack-plugin: 5.5.3(webpack@5.95.0(esbuild@0.17.19)) + html-webpack-plugin: 5.6.2(@rspack/core@1.0.13(@swc/helpers@0.5.13))(webpack@5.95.0(esbuild@0.17.19)) webpack-virtual-modules@0.6.2: {}