@modern-js/uni-builder 2.49.4 → 2.51.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/rspack/index.js +4 -1
- package/dist/shared/devServer.d.ts +4 -2
- package/dist/shared/devServer.js +0 -7
- package/dist/shared/parseCommonConfig.js +17 -3
- package/dist/shared/plugins/emitRouteFile.d.ts +1 -0
- package/dist/shared/plugins/emitRouteFile.js +6 -1
- package/dist/shared/plugins/fallback.js +2 -1
- package/dist/shared/plugins/postcssLegacy.js +2 -1
- package/dist/types.d.ts +15 -5
- package/dist/webpack/index.d.ts +1 -2
- package/dist/webpack/index.js +1 -1
- package/dist/webpack/plugins/lazyCompilation.d.ts +3 -4
- package/dist/webpack/plugins/minimize.js +5 -1
- package/dist/webpack/plugins/moduleScopes.js +2 -2
- package/dist/webpack/plugins/styledComponents.js +11 -1
- package/package.json +27 -24
package/dist/rspack/index.js
CHANGED
|
@@ -36,8 +36,11 @@ var import_core = require("@rsbuild/core");
|
|
|
36
36
|
var import_parseCommonConfig = require("../shared/parseCommonConfig");
|
|
37
37
|
var import_compatLegacyPlugin = require("../shared/compatLegacyPlugin");
|
|
38
38
|
async function parseConfig(uniBuilderConfig, options) {
|
|
39
|
-
var _uniBuilderConfig_tools, _uniBuilderConfig_tools1;
|
|
39
|
+
var _uniBuilderConfig_experiments, _uniBuilderConfig_tools, _uniBuilderConfig_tools1;
|
|
40
40
|
const { rsbuildConfig, rsbuildPlugins } = await (0, import_parseCommonConfig.parseCommonConfig)(uniBuilderConfig, options);
|
|
41
|
+
if ((_uniBuilderConfig_experiments = uniBuilderConfig.experiments) === null || _uniBuilderConfig_experiments === void 0 ? void 0 : _uniBuilderConfig_experiments.lazyCompilation) {
|
|
42
|
+
rsbuildConfig.dev.lazyCompilation = uniBuilderConfig.experiments.lazyCompilation;
|
|
43
|
+
}
|
|
41
44
|
if ((_uniBuilderConfig_tools = uniBuilderConfig.tools) === null || _uniBuilderConfig_tools === void 0 ? void 0 : _uniBuilderConfig_tools.babel) {
|
|
42
45
|
var _uniBuilderConfig_tools2;
|
|
43
46
|
const { pluginBabel } = await Promise.resolve().then(() => __toESM(require("@rsbuild/plugin-babel")));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { StartDevServerOptions as RsbuildStartDevServerOptions,
|
|
2
|
+
import { StartDevServerOptions as RsbuildStartDevServerOptions, DevConfig, ServerConfig } from '@rsbuild/shared';
|
|
3
|
+
import { RsbuildInstance } from '@rsbuild/core';
|
|
3
4
|
import type { ModernDevServerOptions } from '@modern-js/server';
|
|
4
5
|
import type { Server } from 'node:http';
|
|
5
6
|
import { type InitProdMiddlewares } from '@modern-js/prod-server';
|
|
@@ -16,8 +17,9 @@ export type StartDevServerOptions = RsbuildStartDevServerOptions & {
|
|
|
16
17
|
serverOptions?: ServerOptions;
|
|
17
18
|
initProdMiddlewares?: InitProdMiddlewares;
|
|
18
19
|
};
|
|
19
|
-
export type UniBuilderStartServerResult =
|
|
20
|
+
export type UniBuilderStartServerResult = {
|
|
20
21
|
server: Server;
|
|
22
|
+
port: number;
|
|
21
23
|
};
|
|
22
24
|
export declare function startDevServer(rsbuild: RsbuildInstance, options: StartDevServerOptions | undefined, builderConfig: UniBuilderConfig): Promise<UniBuilderStartServerResult>;
|
|
23
25
|
export {};
|
package/dist/shared/devServer.js
CHANGED
|
@@ -162,12 +162,6 @@ async function startDevServer(rsbuild, options = {}, builderConfig) {
|
|
|
162
162
|
},
|
|
163
163
|
config
|
|
164
164
|
}, options.initProdMiddlewares);
|
|
165
|
-
const protocol = https ? "https" : "http";
|
|
166
|
-
const urls = (0, import_shared.getAddressUrls)({
|
|
167
|
-
protocol,
|
|
168
|
-
port,
|
|
169
|
-
host
|
|
170
|
-
});
|
|
171
165
|
(0, import_shared.debug)("listen dev server");
|
|
172
166
|
return new Promise((resolve) => {
|
|
173
167
|
server.listen({
|
|
@@ -181,7 +175,6 @@ async function startDevServer(rsbuild, options = {}, builderConfig) {
|
|
|
181
175
|
await rsbuildServer.afterListen();
|
|
182
176
|
resolve({
|
|
183
177
|
port,
|
|
184
|
-
urls: urls.map((item) => item.url),
|
|
185
178
|
server
|
|
186
179
|
});
|
|
187
180
|
});
|
|
@@ -47,11 +47,14 @@ var import_devtools = require("./plugins/devtools");
|
|
|
47
47
|
var import_emitRouteFile = require("./plugins/emitRouteFile");
|
|
48
48
|
var import_antd = require("./plugins/antd");
|
|
49
49
|
var import_arco = require("./plugins/arco");
|
|
50
|
+
var import_plugin_sass = require("@rsbuild/plugin-sass");
|
|
51
|
+
var import_plugin_less = require("@rsbuild/plugin-less");
|
|
50
52
|
var import_devServer = require("./devServer");
|
|
53
|
+
const CSS_MODULES_REGEX = /\.modules?\.\w+$/i;
|
|
51
54
|
const GLOBAL_CSS_REGEX = /\.global\.\w+$/;
|
|
52
55
|
const isLooseCssModules = (path) => {
|
|
53
56
|
if (import_shared.NODE_MODULES_REGEX.test(path)) {
|
|
54
|
-
return
|
|
57
|
+
return CSS_MODULES_REGEX.test(path);
|
|
55
58
|
}
|
|
56
59
|
return !GLOBAL_CSS_REGEX.test(path);
|
|
57
60
|
};
|
|
@@ -108,11 +111,12 @@ async function parseCommonConfig(uniBuilderConfig, options) {
|
|
|
108
111
|
var _uniBuilderConfig_output, _uniBuilderConfig_tools;
|
|
109
112
|
var _output, _output_distPath, _output_distPath1, _output1, _extraConfig, _html, _extraConfig1;
|
|
110
113
|
const { cwd, frameworkConfigPath, entry, target } = options;
|
|
111
|
-
const { plugins: [...plugins] = [], performance: { ...performanceConfig } = {}, output: { disableFilenameHash, enableLatestDecorators, cssModuleLocalIdentName, enableInlineScripts, disableCssExtract, enableInlineStyles, disableCssModuleExtension, disableTsChecker, disableSvgr, svgDefaultExport, assetsRetry, enableAssetFallback, enableAssetManifest, disableSourceMap, convertToRem, disableMinimize, polyfill, ...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, ...toolsConfig } = {} } = uniBuilderConfig;
|
|
114
|
+
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, ...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, ...toolsConfig } = {} } = uniBuilderConfig;
|
|
112
115
|
const rsbuildConfig = {
|
|
113
116
|
plugins,
|
|
114
117
|
output: {
|
|
115
118
|
polyfill: polyfill === "ua" ? "off" : polyfill,
|
|
119
|
+
dataUriLimit,
|
|
116
120
|
...outputConfig
|
|
117
121
|
},
|
|
118
122
|
source: {
|
|
@@ -260,7 +264,13 @@ async function parseCommonConfig(uniBuilderConfig, options) {
|
|
|
260
264
|
(0, import_plugin_toml.pluginToml)(),
|
|
261
265
|
(0, import_plugin_yaml.pluginYaml)(),
|
|
262
266
|
(0, import_antd.pluginAntd)(),
|
|
263
|
-
(0, import_arco.pluginArco)()
|
|
267
|
+
(0, import_arco.pluginArco)(),
|
|
268
|
+
(0, import_plugin_sass.pluginSass)({
|
|
269
|
+
sassLoaderOptions: sass
|
|
270
|
+
}),
|
|
271
|
+
(0, import_plugin_less.pluginLess)({
|
|
272
|
+
lessLoaderOptions: less
|
|
273
|
+
})
|
|
264
274
|
];
|
|
265
275
|
if (checkSyntax) {
|
|
266
276
|
const { pluginCheckSyntax } = await Promise.resolve().then(() => __toESM(require("@rsbuild/plugin-check-syntax")));
|
|
@@ -284,6 +294,10 @@ async function parseCommonConfig(uniBuilderConfig, options) {
|
|
|
284
294
|
const { pluginRem } = await Promise.resolve().then(() => __toESM(require("@rsbuild/plugin-rem")));
|
|
285
295
|
rsbuildPlugins.push(pluginRem(typeof convertToRem === "boolean" ? {} : convertToRem));
|
|
286
296
|
}
|
|
297
|
+
if (enableCssModuleTSDeclaration) {
|
|
298
|
+
const { pluginTypedCSSModules } = await Promise.resolve().then(() => __toESM(require("@rsbuild/plugin-typed-css-modules")));
|
|
299
|
+
rsbuildPlugins.push(pluginTypedCSSModules());
|
|
300
|
+
}
|
|
287
301
|
rsbuildPlugins.push((0, import_runtimeChunk.pluginRuntimeChunk)((_uniBuilderConfig_output = uniBuilderConfig.output) === null || _uniBuilderConfig_output === void 0 ? void 0 : _uniBuilderConfig_output.disableInlineRuntimeChunk));
|
|
288
302
|
const { sourceBuild } = uniBuilderConfig.experiments || {};
|
|
289
303
|
if (sourceBuild) {
|
|
@@ -28,11 +28,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var emitRouteFile_exports = {};
|
|
30
30
|
__export(emitRouteFile_exports, {
|
|
31
|
+
isFileExists: () => isFileExists,
|
|
31
32
|
pluginEmitRouteFile: () => pluginEmitRouteFile
|
|
32
33
|
});
|
|
33
34
|
module.exports = __toCommonJS(emitRouteFile_exports);
|
|
34
35
|
var import_path = require("path");
|
|
35
36
|
var import_shared = require("@rsbuild/shared");
|
|
37
|
+
async function isFileExists(file) {
|
|
38
|
+
return import_shared.fse.promises.access(file, import_shared.fse.constants.F_OK).then(() => true).catch(() => false);
|
|
39
|
+
}
|
|
36
40
|
const pluginEmitRouteFile = () => ({
|
|
37
41
|
name: "uni-builder:emit-route-file",
|
|
38
42
|
setup(api) {
|
|
@@ -46,7 +50,7 @@ const pluginEmitRouteFile = () => ({
|
|
|
46
50
|
entryPath: filename,
|
|
47
51
|
isSPA: true
|
|
48
52
|
}));
|
|
49
|
-
if (!await
|
|
53
|
+
if (!await isFileExists(routeFilePath) && routesInfo.length) {
|
|
50
54
|
await fs.outputFile(routeFilePath, JSON.stringify({
|
|
51
55
|
routes: routesInfo
|
|
52
56
|
}, null, 2));
|
|
@@ -56,5 +60,6 @@ const pluginEmitRouteFile = () => ({
|
|
|
56
60
|
});
|
|
57
61
|
// Annotate the CommonJS export names for ESM import in node:
|
|
58
62
|
0 && (module.exports = {
|
|
63
|
+
isFileExists,
|
|
59
64
|
pluginEmitRouteFile
|
|
60
65
|
});
|
|
@@ -23,6 +23,7 @@ __export(fallback_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(fallback_exports);
|
|
24
24
|
var import_path = require("path");
|
|
25
25
|
var import_shared = require("@rsbuild/shared");
|
|
26
|
+
const HTML_REGEX = /\.html$/;
|
|
26
27
|
const resourceRuleFallback = (rules = []) => {
|
|
27
28
|
const innerRules = [];
|
|
28
29
|
const outerRules = [];
|
|
@@ -51,7 +52,7 @@ const resourceRuleFallback = (rules = []) => {
|
|
|
51
52
|
import_shared.JS_REGEX,
|
|
52
53
|
import_shared.TS_REGEX,
|
|
53
54
|
// exclude `html` and `json`, they get processed by webpack internal loaders.
|
|
54
|
-
|
|
55
|
+
HTML_REGEX,
|
|
55
56
|
/\.json$/
|
|
56
57
|
],
|
|
57
58
|
type: "asset/resource"
|
|
@@ -27,8 +27,9 @@ const pluginPostcssLegacy = (webBrowserslist) => ({
|
|
|
27
27
|
name: "uni-builder:postcss-plugins",
|
|
28
28
|
setup(api) {
|
|
29
29
|
api.modifyRsbuildConfig((config, { mergeRsbuildConfig }) => {
|
|
30
|
+
var _config_output;
|
|
30
31
|
const cssSupport = (0, import_getCssSupport.getCssSupport)(webBrowserslist);
|
|
31
|
-
const enableExtractCSS = (
|
|
32
|
+
const enableExtractCSS = !((_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.injectStyles);
|
|
32
33
|
const enableCssMinify = !enableExtractCSS && import_shared.isProd;
|
|
33
34
|
const plugins = [
|
|
34
35
|
require("postcss-flexbugs-fixes"),
|
package/dist/types.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type { NodeEnv, MetaOptions, ServerConfig, ScriptInject, RsbuildTarget, C
|
|
|
2
2
|
import type { RsbuildConfig } from '@rsbuild/core';
|
|
3
3
|
import type { PluginAssetsRetryOptions } from '@rsbuild/plugin-assets-retry';
|
|
4
4
|
import type { PluginStyledComponentsOptions } from '@rsbuild/plugin-styled-components';
|
|
5
|
-
import type { LazyCompilationOptions } from './webpack/plugins/lazyCompilation';
|
|
6
5
|
import type { PluginRemOptions } from '@rsbuild/plugin-rem';
|
|
7
6
|
import type { PluginTsLoaderOptions } from './webpack/plugins/tsLoader';
|
|
8
7
|
import type { SvgDefaultExport } from '@rsbuild/plugin-svgr';
|
|
@@ -11,6 +10,8 @@ import type { PluginTypeCheckerOptions } from '@rsbuild/plugin-type-check';
|
|
|
11
10
|
import type { PluginCheckSyntaxOptions } from '@rsbuild/plugin-check-syntax';
|
|
12
11
|
import type { PluginPugOptions } from '@rsbuild/plugin-pug';
|
|
13
12
|
import type { PluginBabelOptions } from '@rsbuild/plugin-babel';
|
|
13
|
+
import type { PluginSassOptions } from '@rsbuild/plugin-sass';
|
|
14
|
+
import type { PluginLessOptions } from '@rsbuild/plugin-less';
|
|
14
15
|
import type { AliasOption } from '@modern-js/utils';
|
|
15
16
|
import type { StartDevServerOptions, UniBuilderStartServerResult } from './shared/devServer';
|
|
16
17
|
import type { PluginSourceBuildOptions } from '@rsbuild/plugin-source-build';
|
|
@@ -94,6 +95,14 @@ export type UniBuilderExtraConfig = {
|
|
|
94
95
|
* @requires webpack
|
|
95
96
|
*/
|
|
96
97
|
terser?: ToolsTerserConfig;
|
|
98
|
+
/**
|
|
99
|
+
* Modify the config of [less-loader](https://github.com/webpack-contrib/less-loader).
|
|
100
|
+
*/
|
|
101
|
+
less?: PluginLessOptions['lessLoaderOptions'];
|
|
102
|
+
/**
|
|
103
|
+
* Modify the config of [sass-loader](https://github.com/webpack-contrib/sass-loader).
|
|
104
|
+
*/
|
|
105
|
+
sass?: PluginSassOptions['sassLoaderOptions'];
|
|
97
106
|
};
|
|
98
107
|
dev?: {
|
|
99
108
|
/**
|
|
@@ -139,6 +148,10 @@ export type UniBuilderExtraConfig = {
|
|
|
139
148
|
* @deprecated use `output.filenameHash` instead
|
|
140
149
|
*/
|
|
141
150
|
disableFilenameHash?: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Whether to generate a TypeScript declaration file for CSS Modules.
|
|
153
|
+
*/
|
|
154
|
+
enableCssModuleTSDeclaration?: boolean;
|
|
142
155
|
/**
|
|
143
156
|
* @deprecated use `source.decorators` instead
|
|
144
157
|
*/
|
|
@@ -260,10 +273,7 @@ export type UniBuilderExtraConfig = {
|
|
|
260
273
|
checkSyntax?: boolean | PluginCheckSyntaxOptions;
|
|
261
274
|
};
|
|
262
275
|
experiments?: {
|
|
263
|
-
|
|
264
|
-
* Tips: this configuration is not yet supported in rspack
|
|
265
|
-
*/
|
|
266
|
-
lazyCompilation?: LazyCompilationOptions;
|
|
276
|
+
lazyCompilation?: DevConfig['lazyCompilation'];
|
|
267
277
|
/**
|
|
268
278
|
* Enable the ability for source code building
|
|
269
279
|
*/
|
package/dist/webpack/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { type RsbuildConfig, type RsbuildPlugin, type RsbuildInstance } from '@rsbuild/core';
|
|
2
|
-
import type { RsbuildProvider } from '@rsbuild/shared';
|
|
3
2
|
import type { UniBuilderConfig, CreateUniBuilderOptions, CreateBuilderCommonOptions, OverridesUniBuilderInstance } from '../types';
|
|
4
3
|
export declare function parseConfig(uniBuilderConfig: UniBuilderConfig, options: CreateBuilderCommonOptions): Promise<{
|
|
5
4
|
rsbuildConfig: RsbuildConfig;
|
|
6
5
|
rsbuildPlugins: RsbuildPlugin[];
|
|
7
6
|
}>;
|
|
8
|
-
export type UniBuilderWebpackInstance = Omit<RsbuildInstance
|
|
7
|
+
export type UniBuilderWebpackInstance = Omit<RsbuildInstance, keyof OverridesUniBuilderInstance> & OverridesUniBuilderInstance;
|
|
9
8
|
export declare function createWebpackBuilder(options: CreateUniBuilderOptions): Promise<UniBuilderWebpackInstance>;
|
package/dist/webpack/index.js
CHANGED
|
@@ -85,7 +85,7 @@ async function createWebpackBuilder(options) {
|
|
|
85
85
|
cwd
|
|
86
86
|
});
|
|
87
87
|
const { webpackProvider } = await Promise.resolve().then(() => __toESM(require("@rsbuild/webpack")));
|
|
88
|
-
const { setHTMLPlugin } = await Promise.resolve().then(() => __toESM(require("@rsbuild/core
|
|
88
|
+
const { __internalHelper: { setHTMLPlugin } } = await Promise.resolve().then(() => __toESM(require("@rsbuild/core")));
|
|
89
89
|
const { default: HtmlWebpackPlugin } = await Promise.resolve().then(() => __toESM(require("html-webpack-plugin")));
|
|
90
90
|
setHTMLPlugin(HtmlWebpackPlugin);
|
|
91
91
|
rsbuildConfig.provider = webpackProvider;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
imports?: boolean;
|
|
5
|
-
};
|
|
2
|
+
import type { DevConfig } from '@rsbuild/shared';
|
|
3
|
+
type LazyCompilationOptions = DevConfig['lazyCompilation'];
|
|
6
4
|
export declare const pluginLazyCompilation: (options: LazyCompilationOptions) => RsbuildPlugin;
|
|
5
|
+
export {};
|
|
@@ -91,7 +91,11 @@ const pluginMinimize = (userTerserConfig) => ({
|
|
|
91
91
|
setup(api) {
|
|
92
92
|
api.modifyBundlerChain(async (chain, { isProd }) => {
|
|
93
93
|
const config = api.getNormalizedConfig();
|
|
94
|
-
|
|
94
|
+
const { minify } = config.output;
|
|
95
|
+
if (minify === false || !isProd) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (minify === true || (minify === null || minify === void 0 ? void 0 : minify.js) !== false) {
|
|
95
99
|
await applyJSMinimizer(chain, config, userTerserConfig);
|
|
96
100
|
}
|
|
97
101
|
});
|
|
@@ -34,7 +34,7 @@ __export(moduleScopes_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(moduleScopes_exports);
|
|
36
36
|
var import_path = __toESM(require("path"));
|
|
37
|
-
|
|
37
|
+
const ensureAbsolutePath = (base, filePath) => import_path.default.isAbsolute(filePath) ? filePath : import_path.default.resolve(base, filePath);
|
|
38
38
|
const isPrimitiveScope = (items) => items.every((item) => typeof item === "string" || Object.prototype.toString.call(item) === "[object RegExp]");
|
|
39
39
|
const applyScopeChain = (defaults, options) => {
|
|
40
40
|
if (Array.isArray(options)) {
|
|
@@ -57,7 +57,7 @@ const pluginModuleScopes = (moduleScopes) => ({
|
|
|
57
57
|
const rootPackageJson = import_path.default.resolve(api.context.rootPath, "./package.json");
|
|
58
58
|
const formattedScopes = scopes.map((scope) => {
|
|
59
59
|
if (typeof scope === "string") {
|
|
60
|
-
return
|
|
60
|
+
return ensureAbsolutePath(api.context.rootPath, scope);
|
|
61
61
|
}
|
|
62
62
|
return scope;
|
|
63
63
|
});
|
|
@@ -33,6 +33,16 @@ __export(styledComponents_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(styledComponents_exports);
|
|
34
34
|
var import_core = require("@rsbuild/core");
|
|
35
35
|
var import_shared = require("@rsbuild/shared");
|
|
36
|
+
const getDefaultStyledComponentsConfig = (isProd, ssr) => {
|
|
37
|
+
return {
|
|
38
|
+
ssr,
|
|
39
|
+
// "pure" is used to improve dead code elimination in production.
|
|
40
|
+
// we don't need to enable it in development because it will slow down the build process.
|
|
41
|
+
pure: isProd,
|
|
42
|
+
displayName: true,
|
|
43
|
+
transpileTemplateLiterals: true
|
|
44
|
+
};
|
|
45
|
+
};
|
|
36
46
|
const pluginStyledComponents = (userConfig = {}) => ({
|
|
37
47
|
name: "uni-builder:styled-components",
|
|
38
48
|
pre: [
|
|
@@ -43,7 +53,7 @@ const pluginStyledComponents = (userConfig = {}) => ({
|
|
|
43
53
|
api.modifyBundlerChain(async (chain, { CHAIN_ID, isProd }) => {
|
|
44
54
|
const isSSR = (0, import_shared.isServerTarget)(api.context.targets);
|
|
45
55
|
const styledComponentsOptions = (0, import_shared.mergeChainedOptions)({
|
|
46
|
-
defaults:
|
|
56
|
+
defaults: getDefaultStyledComponentsConfig(isProd, isSSR),
|
|
47
57
|
options: userConfig
|
|
48
58
|
});
|
|
49
59
|
if (!styledComponentsOptions) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modern-js/uni-builder",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.51.0",
|
|
4
4
|
"description": "Unified builder for Modern.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,23 +26,26 @@
|
|
|
26
26
|
"@babel/preset-react": "^7.22.15",
|
|
27
27
|
"@babel/types": "^7.23.0",
|
|
28
28
|
"@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
|
|
29
|
-
"@rsbuild/babel-preset": "0.
|
|
30
|
-
"@rsbuild/core": "0.
|
|
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-
|
|
40
|
-
"@rsbuild/plugin-
|
|
41
|
-
"@rsbuild/plugin-
|
|
42
|
-
"@rsbuild/plugin-
|
|
43
|
-
"@rsbuild/plugin-
|
|
44
|
-
"@rsbuild/
|
|
45
|
-
"@rsbuild/
|
|
29
|
+
"@rsbuild/babel-preset": "0.7.1",
|
|
30
|
+
"@rsbuild/core": "0.7.1",
|
|
31
|
+
"@rsbuild/plugin-sass": "0.7.1",
|
|
32
|
+
"@rsbuild/plugin-less": "0.7.1",
|
|
33
|
+
"@rsbuild/plugin-assets-retry": "0.7.1",
|
|
34
|
+
"@rsbuild/plugin-babel": "0.7.1",
|
|
35
|
+
"@rsbuild/plugin-check-syntax": "0.7.1",
|
|
36
|
+
"@rsbuild/plugin-css-minimizer": "0.7.1",
|
|
37
|
+
"@rsbuild/plugin-pug": "0.7.1",
|
|
38
|
+
"@rsbuild/plugin-react": "0.7.1",
|
|
39
|
+
"@rsbuild/plugin-rem": "0.7.1",
|
|
40
|
+
"@rsbuild/plugin-source-build": "0.7.1",
|
|
41
|
+
"@rsbuild/plugin-styled-components": "0.7.1",
|
|
42
|
+
"@rsbuild/plugin-svgr": "0.7.1",
|
|
43
|
+
"@rsbuild/plugin-type-check": "0.7.1",
|
|
44
|
+
"@rsbuild/plugin-typed-css-modules": "0.7.1",
|
|
45
|
+
"@rsbuild/plugin-toml": "0.7.1",
|
|
46
|
+
"@rsbuild/plugin-yaml": "0.7.1",
|
|
47
|
+
"@rsbuild/shared": "0.7.1",
|
|
48
|
+
"@rsbuild/webpack": "0.7.1",
|
|
46
49
|
"@swc/helpers": "0.5.3",
|
|
47
50
|
"babel-loader": "9.1.3",
|
|
48
51
|
"babel-plugin-import": "1.13.5",
|
|
@@ -66,18 +69,18 @@
|
|
|
66
69
|
"ts-loader": "9.4.4",
|
|
67
70
|
"webpack": "^5.91.0",
|
|
68
71
|
"webpack-subresource-integrity": "5.1.0",
|
|
69
|
-
"@modern-js/server": "2.
|
|
70
|
-
"@modern-js/
|
|
71
|
-
"@modern-js/
|
|
72
|
+
"@modern-js/prod-server": "2.51.0",
|
|
73
|
+
"@modern-js/utils": "2.51.0",
|
|
74
|
+
"@modern-js/server": "2.51.0"
|
|
72
75
|
},
|
|
73
76
|
"devDependencies": {
|
|
74
|
-
"@rsbuild/plugin-swc": "0.
|
|
77
|
+
"@rsbuild/plugin-swc": "0.7.1",
|
|
75
78
|
"@types/lodash": "^4.14.202",
|
|
76
79
|
"react": "^18.2.0",
|
|
77
80
|
"react-dom": "^18.2.0",
|
|
78
81
|
"typescript": "^5.3.0",
|
|
79
|
-
"@scripts/
|
|
80
|
-
"@scripts/
|
|
82
|
+
"@scripts/build": "2.51.0",
|
|
83
|
+
"@scripts/vitest-config": "2.51.0"
|
|
81
84
|
},
|
|
82
85
|
"publishConfig": {
|
|
83
86
|
"access": "public",
|