@modern-js/uni-builder 2.58.0 → 2.58.1

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.
@@ -87,9 +87,7 @@ const pluginHtmlMinifierTerser = () => ({
87
87
  setup(api) {
88
88
  api.modifyBundlerChain(async (chain, { isProd, environment }) => {
89
89
  const { output, tools: { htmlPlugin } } = environment.config;
90
- if (!isProd || output.minify === false || htmlPlugin === false) {
91
- return;
92
- }
90
+ const disableHtmlMinify = !isProd || output.minify === false || htmlPlugin === false;
93
91
  const { minify } = await Promise.resolve().then(() => __toESM(require("html-minifier-terser")));
94
92
  const pluginRecord = chain.plugins.entries();
95
93
  const minifyOptions = getMinifyOptions(environment.config);
@@ -103,7 +101,7 @@ const pluginHtmlMinifierTerser = () => ({
103
101
  const name = (item === null || item === void 0 ? void 0 : item.name) || ((_item_constructor = item.constructor) === null || _item_constructor === void 0 ? void 0 : _item_constructor.name);
104
102
  return name === "HtmlRspackPlugin";
105
103
  });
106
- if (isHtmlRspackPlugin) {
104
+ if (isHtmlRspackPlugin && !disableHtmlMinify) {
107
105
  chain.plugin(id).tap((options) => {
108
106
  if (!options.length) {
109
107
  return options;
@@ -125,6 +123,10 @@ const pluginHtmlMinifierTerser = () => ({
125
123
  if (!options.length || options[0].minify) {
126
124
  return options;
127
125
  }
126
+ if (disableHtmlMinify) {
127
+ options[0].minify = false;
128
+ return options;
129
+ }
128
130
  const userMinifyOption = options[0].minify;
129
131
  options[0].minify = userMinifyOption ? (0, import_ts_deepmerge.merge)(minifyOptions, userMinifyOption) : minifyOptions;
130
132
  return options;
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ConfigChainWithContext, ConfigChain, DevConfig, RsbuildConfig, RsbuildTarget, Polyfill, ScriptInject, ServerConfig, RsbuildPluginAPI, OutputConfig, DistPathConfig, Rspack, RequestHandler, NodeEnv, HtmlTagDescriptor, RsbuildPlugin } from '@rsbuild/core';
1
+ import type { ConfigChainWithContext, ConfigChain, DevConfig, RsbuildConfig, RsbuildTarget, Polyfill, ScriptInject, ServerConfig, RsbuildPluginAPI, OutputConfig, DistPathConfig, Rspack, RequestHandler, HtmlTagDescriptor, RsbuildPlugin } from '@rsbuild/core';
2
2
  import type { PluginAssetsRetryOptions } from '@rsbuild/plugin-assets-retry';
3
3
  import type { PluginStyledComponentsOptions } from '@rsbuild/plugin-styled-components';
4
4
  import type { PluginRemOptions } from '@rsbuild/plugin-rem';
@@ -48,7 +48,7 @@ export type CreateUniBuilderOptions = {
48
48
  } & Partial<CreateBuilderCommonOptions>;
49
49
  export type GlobalVars = Record<string, any>;
50
50
  export type ChainedGlobalVars = ConfigChainWithContext<GlobalVars, {
51
- env: NodeEnv;
51
+ env: string;
52
52
  target: RsbuildTarget;
53
53
  }>;
54
54
  export type ModuleScopes = Array<string | RegExp>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modern-js/uni-builder",
3
- "version": "2.58.0",
3
+ "version": "2.58.1",
4
4
  "description": "Unified builder for Modern.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,24 +26,24 @@
26
26
  "@babel/preset-react": "^7.22.15",
27
27
  "@babel/types": "^7.24.7",
28
28
  "@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
29
- "@rsbuild/core": "1.0.1-beta.9",
30
- "@rsbuild/plugin-sass": "1.0.1-beta.9",
31
- "@rsbuild/plugin-less": "1.0.1-beta.9",
32
- "@rsbuild/plugin-assets-retry": "1.0.1-beta.9",
33
- "@rsbuild/plugin-babel": "1.0.1-beta.9",
34
- "@rsbuild/plugin-check-syntax": "1.0.1-beta.9",
35
- "@rsbuild/plugin-css-minimizer": "1.0.1",
36
- "@rsbuild/plugin-pug": "1.0.1",
37
- "@rsbuild/plugin-react": "1.0.1-beta.9",
38
- "@rsbuild/plugin-rem": "1.0.1-beta.9",
39
- "@rsbuild/plugin-source-build": "1.0.1-beta.9",
40
- "@rsbuild/plugin-styled-components": "1.0.1-beta.9",
41
- "@rsbuild/plugin-svgr": "1.0.1-beta.9",
42
- "@rsbuild/plugin-type-check": "1.0.1-beta.9",
43
- "@rsbuild/plugin-typed-css-modules": "1.0.1",
44
- "@rsbuild/plugin-toml": "1.0.0",
45
- "@rsbuild/plugin-yaml": "1.0.1",
46
- "@rsbuild/webpack": "1.0.1-beta.9",
29
+ "@rsbuild/core": "1.0.1-beta.13",
30
+ "@rsbuild/plugin-assets-retry": "1.0.1-beta.13",
31
+ "@rsbuild/plugin-babel": "1.0.1-beta.13",
32
+ "@rsbuild/plugin-check-syntax": "1.0.1",
33
+ "@rsbuild/plugin-css-minimizer": "1.0.2",
34
+ "@rsbuild/plugin-less": "1.0.1-beta.13",
35
+ "@rsbuild/plugin-pug": "1.0.2",
36
+ "@rsbuild/plugin-react": "1.0.1-beta.13",
37
+ "@rsbuild/plugin-rem": "1.0.1",
38
+ "@rsbuild/plugin-sass": "1.0.1-beta.13",
39
+ "@rsbuild/plugin-source-build": "1.0.1",
40
+ "@rsbuild/plugin-styled-components": "1.0.1",
41
+ "@rsbuild/plugin-svgr": "1.0.1-beta.13",
42
+ "@rsbuild/plugin-toml": "1.0.1",
43
+ "@rsbuild/plugin-type-check": "1.0.1-beta.13",
44
+ "@rsbuild/plugin-typed-css-modules": "1.0.2",
45
+ "@rsbuild/plugin-yaml": "1.0.2",
46
+ "@rsbuild/webpack": "1.0.1-beta.13",
47
47
  "@swc/helpers": "0.5.3",
48
48
  "autoprefixer": "10.4.19",
49
49
  "babel-loader": "9.1.3",
@@ -53,9 +53,10 @@
53
53
  "browserslist": "4.23.1",
54
54
  "cssnano": "6.0.1",
55
55
  "glob": "^9.3.5",
56
- "html-webpack-plugin": "5.5.3",
57
56
  "html-minifier-terser": "^7.2.0",
57
+ "html-webpack-plugin": "5.5.3",
58
58
  "lodash": "^4.17.21",
59
+ "picocolors": "^1.0.1",
59
60
  "postcss": "^8.4.35",
60
61
  "postcss-custom-properties": "13.1.5",
61
62
  "postcss-flexbugs-fixes": "5.0.2",
@@ -64,7 +65,6 @@
64
65
  "postcss-media-minmax": "5.0.0",
65
66
  "postcss-nesting": "12.0.1",
66
67
  "postcss-page-break": "3.0.4",
67
- "picocolors": "^1.0.1",
68
68
  "react-refresh": "^0.14.0",
69
69
  "rspack-manifest-plugin": "5.0.0",
70
70
  "terser-webpack-plugin": "5.3.10",
@@ -72,19 +72,19 @@
72
72
  "ts-loader": "9.4.4",
73
73
  "webpack": "^5.93.0",
74
74
  "webpack-subresource-integrity": "5.1.0",
75
- "@modern-js/utils": "2.58.0",
76
- "@modern-js/babel-preset": "2.58.0"
75
+ "@modern-js/babel-preset": "2.58.1",
76
+ "@modern-js/utils": "2.58.1"
77
77
  },
78
78
  "devDependencies": {
79
- "@rsbuild/plugin-swc": "1.0.1-beta.9",
79
+ "@rsbuild/plugin-swc": "1.0.1-beta.13",
80
80
  "@types/html-minifier-terser": "^7.0.2",
81
81
  "@types/lodash": "^4.14.202",
82
82
  "react": "^18.2.0",
83
83
  "react-dom": "^18.2.0",
84
84
  "terser": "^5.31.1",
85
85
  "typescript": "^5.3.0",
86
- "@scripts/build": "2.58.0",
87
- "@scripts/vitest-config": "2.58.0"
86
+ "@scripts/build": "2.58.1",
87
+ "@scripts/vitest-config": "2.58.1"
88
88
  },
89
89
  "publishConfig": {
90
90
  "access": "public",