@modern-js/uni-builder 2.58.0 → 2.58.2
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/rspack/plugins/babel-post.d.ts +1 -1
- package/dist/shared/devServer.d.ts +1 -1
- package/dist/shared/parseCommonConfig.js +9 -1
- package/dist/shared/plugins/antd.d.ts +1 -1
- package/dist/shared/plugins/arco.d.ts +1 -1
- package/dist/shared/plugins/devtools.d.ts +1 -1
- package/dist/shared/plugins/emitRouteFile.d.ts +1 -1
- package/dist/shared/plugins/htmlMinify.js +6 -4
- package/dist/types.d.ts +4 -3
- package/dist/webpack/plugins/babel.d.ts +1 -1
- package/dist/webpack/plugins/minimize.d.ts +2 -2
- package/dist/webpack/plugins/tsLoader.d.ts +1 -1
- package/package.json +26 -26
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { DevConfig, ServerConfig } from '@rsbuild/core';
|
|
2
2
|
import type { UniBuilderConfig, ToolsDevServerConfig } from '../types';
|
|
3
3
|
export declare const transformToRsbuildServerOptions: (dev: NonNullable<UniBuilderConfig['dev']>, devServer: ToolsDevServerConfig) => {
|
|
4
4
|
dev: DevConfig;
|
|
@@ -82,7 +82,7 @@ async function parseCommonConfig(uniBuilderConfig, options) {
|
|
|
82
82
|
var _uniBuilderConfig_output, _uniBuilderConfig_tools;
|
|
83
83
|
var _rsbuildConfig_tools, _output_distPath, _output, _extraConfig, _html, _extraConfig1;
|
|
84
84
|
const { frameworkConfigPath } = options;
|
|
85
|
-
const { plugins: [...plugins] = [], performance: { ...performanceConfig } = {}, output: { disableFilenameHash, enableLatestDecorators, cssModuleLocalIdentName, enableInlineScripts, disableCssExtract, enableInlineStyles, enableCssModuleTSDeclaration, disableCssModuleExtension, disableTsChecker, disableSvgr, svgDefaultExport, assetsRetry, enableAssetFallback, enableAssetManifest, disableSourceMap, convertToRem, disableMinimize, polyfill, dataUriLimit = 1e4, distPath = {}, ...outputConfig } = {}, html: { disableHtmlFolder, metaByEntries, titleByEntries, faviconByEntries, injectByEntries, templateByEntries, templateParametersByEntries, tagsByEntries, tags, ...htmlConfig } = {}, source: { alias, globalVars, resolveMainFields, resolveExtensionPrefix, ...sourceConfig } = {}, dev, security: { checkSyntax, sri, ...securityConfig } = {}, tools: { devServer, tsChecker, minifyCss, less, sass, htmlPlugin, autoprefixer, ...toolsConfig } = {}, environments = {} } = uniBuilderConfig;
|
|
85
|
+
const { plugins: [...plugins] = [], performance: { ...performanceConfig } = {}, output: { disableFilenameHash, enableLatestDecorators, cssModuleLocalIdentName, enableInlineScripts, disableCssExtract, enableInlineStyles, enableCssModuleTSDeclaration, disableCssModuleExtension, disableTsChecker, disableSvgr, svgDefaultExport, assetsRetry, enableAssetFallback, enableAssetManifest, disableSourceMap, convertToRem, disableMinimize, polyfill, dataUriLimit = 1e4, distPath = {}, ...outputConfig } = {}, html: { disableHtmlFolder, metaByEntries, titleByEntries, faviconByEntries, injectByEntries, templateByEntries, templateParametersByEntries, tagsByEntries, appIcon, tags, ...htmlConfig } = {}, source: { alias, globalVars, resolveMainFields, resolveExtensionPrefix, ...sourceConfig } = {}, dev, security: { checkSyntax, sri, ...securityConfig } = {}, tools: { devServer, tsChecker, minifyCss, less, sass, htmlPlugin, autoprefixer, ...toolsConfig } = {}, environments = {} } = uniBuilderConfig;
|
|
86
86
|
const rsbuildConfig = {
|
|
87
87
|
plugins,
|
|
88
88
|
output: {
|
|
@@ -179,6 +179,14 @@ async function parseCommonConfig(uniBuilderConfig, options) {
|
|
|
179
179
|
...templateParametersByEntries[entryName] || {}
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
|
+
html.appIcon = typeof appIcon === "string" ? {
|
|
183
|
+
icons: [
|
|
184
|
+
{
|
|
185
|
+
src: appIcon,
|
|
186
|
+
size: 180
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
} : appIcon;
|
|
182
190
|
if (tags) {
|
|
183
191
|
html.tags = Array.isArray(tags) ? tags.filter((t) => typeof t !== "function").concat(tags.filter((t) => typeof t === "function")) : tags;
|
|
184
192
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { RsbuildPlugin } from '@rsbuild/core';
|
|
2
2
|
export declare const pluginAntd: () => RsbuildPlugin;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { RsbuildPlugin } from '@rsbuild/core';
|
|
2
2
|
export declare const pluginArco: () => RsbuildPlugin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
-
import { DisableSourceMapOption } from '../../types';
|
|
2
|
+
import type { DisableSourceMapOption } from '../../types';
|
|
3
3
|
export declare const pluginDevtool: (options: {
|
|
4
4
|
disableSourceMap?: DisableSourceMapOption;
|
|
5
5
|
}) => RsbuildPlugin;
|
|
@@ -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
|
-
|
|
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,
|
|
1
|
+
import type { ConfigChainWithContext, ConfigChain, DevConfig, HtmlConfig, 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:
|
|
51
|
+
env: string;
|
|
52
52
|
target: RsbuildTarget;
|
|
53
53
|
}>;
|
|
54
54
|
export type ModuleScopes = Array<string | RegExp>;
|
|
@@ -247,6 +247,7 @@ export type UniBuilderExtraConfig = {
|
|
|
247
247
|
disableCssExtract?: boolean;
|
|
248
248
|
};
|
|
249
249
|
html?: {
|
|
250
|
+
appIcon?: string | HtmlConfig['appIcon'];
|
|
250
251
|
/**
|
|
251
252
|
* Remove the folder of the HTML files.
|
|
252
253
|
* When this option is enabled, the generated HTML file path will change from `[name]/index.html` to `[name].html`.
|
|
@@ -366,7 +367,7 @@ export type DistPath = DistPathConfig & {
|
|
|
366
367
|
};
|
|
367
368
|
export type UniBuilderConfig = {
|
|
368
369
|
dev?: RsbuildConfig['dev'];
|
|
369
|
-
html?: RsbuildConfig['html']
|
|
370
|
+
html?: Omit<NonNullable<RsbuildConfig['html']>, 'appIcon'>;
|
|
370
371
|
output?: Omit<NonNullable<RsbuildConfig['output']>, 'polyfill' | 'distPath'> & {
|
|
371
372
|
polyfill?: Polyfill | 'ua';
|
|
372
373
|
distPath?: DistPath;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ToolsTerserConfig } from '../../types';
|
|
1
|
+
import type { RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
+
import type { ToolsTerserConfig } from '../../types';
|
|
3
3
|
export declare const pluginMinimize: (userTerserConfig?: ToolsTerserConfig) => RsbuildPlugin;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ConfigChainWithContext } from '@rsbuild/core';
|
|
2
2
|
import { type PluginBabelOptions } from '@rsbuild/plugin-babel';
|
|
3
3
|
import type { RsbuildPlugin } from '@rsbuild/core';
|
|
4
4
|
import type { Options as RawTSLoaderOptions } from 'ts-loader';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modern-js/uni-builder",
|
|
3
|
-
"version": "2.58.
|
|
3
|
+
"version": "2.58.2",
|
|
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.
|
|
30
|
-
"@rsbuild/plugin-
|
|
31
|
-
"@rsbuild/plugin-
|
|
32
|
-
"@rsbuild/plugin-
|
|
33
|
-
"@rsbuild/plugin-
|
|
34
|
-
"@rsbuild/plugin-
|
|
35
|
-
"@rsbuild/plugin-
|
|
36
|
-
"@rsbuild/plugin-
|
|
37
|
-
"@rsbuild/plugin-
|
|
38
|
-
"@rsbuild/plugin-
|
|
39
|
-
"@rsbuild/plugin-source-build": "1.0.1
|
|
40
|
-
"@rsbuild/plugin-styled-components": "1.0.1
|
|
41
|
-
"@rsbuild/plugin-svgr": "1.0.1-beta.
|
|
42
|
-
"@rsbuild/plugin-
|
|
43
|
-
"@rsbuild/plugin-
|
|
44
|
-
"@rsbuild/plugin-
|
|
45
|
-
"@rsbuild/plugin-yaml": "1.0.
|
|
46
|
-
"@rsbuild/webpack": "1.0.1-beta.
|
|
29
|
+
"@rsbuild/core": "1.0.1-beta.14",
|
|
30
|
+
"@rsbuild/plugin-assets-retry": "1.0.1-beta.14",
|
|
31
|
+
"@rsbuild/plugin-babel": "1.0.1-beta.14",
|
|
32
|
+
"@rsbuild/plugin-check-syntax": "1.0.1",
|
|
33
|
+
"@rsbuild/plugin-css-minimizer": "1.0.2",
|
|
34
|
+
"@rsbuild/plugin-less": "1.0.1-beta.14",
|
|
35
|
+
"@rsbuild/plugin-pug": "1.0.2",
|
|
36
|
+
"@rsbuild/plugin-react": "1.0.1-beta.14",
|
|
37
|
+
"@rsbuild/plugin-rem": "1.0.1",
|
|
38
|
+
"@rsbuild/plugin-sass": "1.0.1-beta.14",
|
|
39
|
+
"@rsbuild/plugin-source-build": "1.0.1",
|
|
40
|
+
"@rsbuild/plugin-styled-components": "1.0.1",
|
|
41
|
+
"@rsbuild/plugin-svgr": "1.0.1-beta.14",
|
|
42
|
+
"@rsbuild/plugin-toml": "1.0.1",
|
|
43
|
+
"@rsbuild/plugin-type-check": "1.0.1-beta.14",
|
|
44
|
+
"@rsbuild/plugin-typed-css-modules": "1.0.2",
|
|
45
|
+
"@rsbuild/plugin-yaml": "1.0.2",
|
|
46
|
+
"@rsbuild/webpack": "1.0.1-beta.14",
|
|
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/
|
|
76
|
-
"@modern-js/
|
|
75
|
+
"@modern-js/babel-preset": "2.58.2",
|
|
76
|
+
"@modern-js/utils": "2.58.2"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@rsbuild/plugin-swc": "1.0.1-beta.
|
|
79
|
+
"@rsbuild/plugin-swc": "1.0.1-beta.14",
|
|
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/
|
|
87
|
-
"@scripts/
|
|
86
|
+
"@scripts/vitest-config": "2.58.2",
|
|
87
|
+
"@scripts/build": "2.58.2"
|
|
88
88
|
},
|
|
89
89
|
"publishConfig": {
|
|
90
90
|
"access": "public",
|