@modern-js/uni-builder 2.53.0 → 2.54.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/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/shared/compatLegacyPlugin.d.ts +1 -1
- package/dist/shared/compatLegacyPlugin.js +3 -3
- package/dist/shared/devServer.d.ts +3 -3
- package/dist/shared/devServer.js +10 -7
- package/dist/shared/manifest.d.ts +2 -2
- package/dist/shared/plugins/antd.js +2 -2
- package/dist/shared/plugins/arco.js +2 -2
- package/dist/shared/plugins/fallback.js +12 -8
- package/dist/shared/plugins/runtimeChunk.js +3 -3
- package/dist/shared/plugins/splitChunk.js +0 -1
- package/dist/shared/utils.d.ts +5 -0
- package/dist/shared/{constants.js → utils.js} +27 -5
- package/dist/webpack/ModuleScopePlugin.js +3 -2
- package/dist/webpack/plugins/moduleScopes.js +2 -2
- package/dist/webpack/plugins/styledComponents.js +2 -2
- package/dist/webpack/plugins/tsLoader.js +2 -1
- package/package.json +28 -28
- package/dist/shared/constants.d.ts +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,10 +4,10 @@ import type { CreateUniBuilderOptions } from './types';
|
|
|
4
4
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
5
5
|
export { HtmlWebpackPlugin };
|
|
6
6
|
export type { CreateUniBuilderOptions, UniBuilderInstance, UniBuilderWebpackInstance, };
|
|
7
|
-
export type {
|
|
7
|
+
export type { RspackChain, RsbuildPlugin, ConfigChain, CopyPluginOptions, ChainIdentifier, NormalizedConfig, RspackConfig, CacheGroup, } from '@rsbuild/shared';
|
|
8
8
|
export type { UniBuilderConfig, UniBuilderPlugin } from './types';
|
|
9
9
|
export type { StartDevServerOptions } from './shared/devServer';
|
|
10
10
|
export declare function createUniBuilder(options: CreateUniBuilderOptions): Promise<UniBuilderInstance>;
|
|
11
11
|
export { logger, type Rspack, type RsbuildContext, type RsbuildConfig, } from '@rsbuild/core';
|
|
12
|
-
export type { webpack,
|
|
13
|
-
export { RUNTIME_CHUNK_NAME } from './shared/
|
|
12
|
+
export type { webpack, WebpackConfig } from '@rsbuild/webpack';
|
|
13
|
+
export { RUNTIME_CHUNK_NAME } from './shared/utils';
|
package/dist/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
var src_exports = {};
|
|
30
30
|
__export(src_exports, {
|
|
31
31
|
HtmlWebpackPlugin: () => import_html_webpack_plugin.default,
|
|
32
|
-
RUNTIME_CHUNK_NAME: () =>
|
|
32
|
+
RUNTIME_CHUNK_NAME: () => import_utils.RUNTIME_CHUNK_NAME,
|
|
33
33
|
createUniBuilder: () => createUniBuilder,
|
|
34
34
|
logger: () => import_core.logger
|
|
35
35
|
});
|
|
@@ -38,7 +38,7 @@ var import_rspack = require("./rspack");
|
|
|
38
38
|
var import_webpack = require("./webpack");
|
|
39
39
|
var import_html_webpack_plugin = __toESM(require("html-webpack-plugin"));
|
|
40
40
|
var import_core = require("@rsbuild/core");
|
|
41
|
-
var
|
|
41
|
+
var import_utils = require("./shared/utils");
|
|
42
42
|
async function createUniBuilder(options) {
|
|
43
43
|
return options.bundlerType === "rspack" ? (0, import_rspack.createRspackBuilder)(options) : (0, import_webpack.createWebpackBuilder)(options);
|
|
44
44
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { UniBuilderPlugin } from '../types';
|
|
2
|
-
import type
|
|
2
|
+
import { type RsbuildPlugin } from '@rsbuild/core';
|
|
3
3
|
export declare function compatLegacyPlugin(plugin: UniBuilderPlugin, extraInfo: {
|
|
4
4
|
cwd: string;
|
|
5
5
|
}): RsbuildPlugin;
|
|
@@ -21,10 +21,10 @@ __export(compatLegacyPlugin_exports, {
|
|
|
21
21
|
compatLegacyPlugin: () => compatLegacyPlugin
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(compatLegacyPlugin_exports);
|
|
24
|
-
var
|
|
24
|
+
var import_core = require("@rsbuild/core");
|
|
25
25
|
var import_path = require("path");
|
|
26
26
|
function addDeprecatedWarning(pluginName, name, newName) {
|
|
27
|
-
|
|
27
|
+
import_core.logger.warn(`Plugin(${pluginName})'s api '${name}' is deprecated${newName ? `, please use '${newName}' instead.` : "."}`);
|
|
28
28
|
}
|
|
29
29
|
function compatLegacyPlugin(plugin, extraInfo) {
|
|
30
30
|
return {
|
|
@@ -52,7 +52,7 @@ function compatLegacyPlugin(plugin, extraInfo) {
|
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
set(_target, prop) {
|
|
55
|
-
|
|
55
|
+
import_core.logger.error(`Context is readonly, you can not assign to the "context.${prop}" prop.`);
|
|
56
56
|
return true;
|
|
57
57
|
}
|
|
58
58
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { StartDevServerOptions as RsbuildStartDevServerOptions, DevConfig, ServerConfig } from '@rsbuild/shared';
|
|
3
|
-
import type
|
|
3
|
+
import { type RsbuildInstance } from '@rsbuild/core';
|
|
4
4
|
import type { ModernDevServerOptions } from '@modern-js/server';
|
|
5
5
|
import type { Server } from 'node:http';
|
|
6
|
-
import { type
|
|
6
|
+
import { type ApplyPlugins } from '@modern-js/prod-server';
|
|
7
7
|
import type { UniBuilderConfig, ToolsDevServerConfig } from '../types';
|
|
8
8
|
type ServerOptions = Partial<Omit<ModernDevServerOptions, 'config'>> & {
|
|
9
9
|
config?: Partial<ModernDevServerOptions['config']>;
|
|
@@ -15,7 +15,7 @@ export declare const transformToRsbuildServerOptions: (dev: NonNullable<UniBuild
|
|
|
15
15
|
export type StartDevServerOptions = RsbuildStartDevServerOptions & {
|
|
16
16
|
apiOnly?: boolean;
|
|
17
17
|
serverOptions?: ServerOptions;
|
|
18
|
-
|
|
18
|
+
applyPlugins?: ApplyPlugins;
|
|
19
19
|
};
|
|
20
20
|
export type UniBuilderStartServerResult = {
|
|
21
21
|
server: Server;
|
package/dist/shared/devServer.js
CHANGED
|
@@ -34,6 +34,7 @@ __export(devServer_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(devServer_exports);
|
|
35
35
|
var import_shared = require("@rsbuild/shared");
|
|
36
36
|
var import_utils = require("@modern-js/utils");
|
|
37
|
+
var import_core = require("@rsbuild/core");
|
|
37
38
|
var import_prod_server = require("@modern-js/prod-server");
|
|
38
39
|
const getServerOptions = (builderConfig) => {
|
|
39
40
|
var _builderConfig_output_distPath, _builderConfig_output, _builderConfig_output1, _builderConfig_output2;
|
|
@@ -52,7 +53,9 @@ const getServerOptions = (builderConfig) => {
|
|
|
52
53
|
},
|
|
53
54
|
server: {},
|
|
54
55
|
runtime: {},
|
|
55
|
-
bff: {}
|
|
56
|
+
bff: {},
|
|
57
|
+
dev: {},
|
|
58
|
+
security: {}
|
|
56
59
|
};
|
|
57
60
|
};
|
|
58
61
|
const transformToRsbuildServerOptions = (dev, devServer) => {
|
|
@@ -122,9 +125,9 @@ const getDevServerOptions = async ({ builderConfig, serverOptions }) => {
|
|
|
122
125
|
};
|
|
123
126
|
async function startDevServer(rsbuild, options = {}, builderConfig) {
|
|
124
127
|
var _serverOptions_dev, _serverOptions_dev1;
|
|
125
|
-
|
|
126
|
-
if (!options.
|
|
127
|
-
options.
|
|
128
|
+
import_core.logger.debug("create dev server");
|
|
129
|
+
if (!options.applyPlugins) {
|
|
130
|
+
options.applyPlugins = import_prod_server.applyPlugins;
|
|
128
131
|
}
|
|
129
132
|
const { createDevServer } = await Promise.resolve().then(() => __toESM(require("@modern-js/server")));
|
|
130
133
|
const rsbuildServer = await rsbuild.createDevServer({
|
|
@@ -158,8 +161,8 @@ async function startDevServer(rsbuild, options = {}, builderConfig) {
|
|
|
158
161
|
writeToDisk
|
|
159
162
|
},
|
|
160
163
|
config
|
|
161
|
-
}, options.
|
|
162
|
-
|
|
164
|
+
}, options.applyPlugins);
|
|
165
|
+
import_core.logger.debug("listen dev server");
|
|
163
166
|
return new Promise((resolve) => {
|
|
164
167
|
server.listen({
|
|
165
168
|
host,
|
|
@@ -168,7 +171,7 @@ async function startDevServer(rsbuild, options = {}, builderConfig) {
|
|
|
168
171
|
if (err) {
|
|
169
172
|
throw err;
|
|
170
173
|
}
|
|
171
|
-
|
|
174
|
+
import_core.logger.debug("listen dev server done");
|
|
172
175
|
await rsbuildServer.afterListen();
|
|
173
176
|
resolve({
|
|
174
177
|
port,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Rspack } from '@rsbuild/shared';
|
|
2
2
|
export declare const generateManifest: (seed: Record<string, any>, files: Array<{
|
|
3
|
-
chunk?: Chunk;
|
|
3
|
+
chunk?: Rspack.Chunk;
|
|
4
4
|
name: string;
|
|
5
5
|
path: string;
|
|
6
6
|
}>, entries: Record<string, string[]>) => {
|
|
@@ -21,7 +21,7 @@ __export(antd_exports, {
|
|
|
21
21
|
pluginAntd: () => pluginAntd
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(antd_exports);
|
|
24
|
-
var
|
|
24
|
+
var import_utils = require("../utils");
|
|
25
25
|
const getAntdMajorVersion = (appDirectory) => {
|
|
26
26
|
try {
|
|
27
27
|
const pkgJsonPath = require.resolve("antd/package.json", {
|
|
@@ -55,7 +55,7 @@ const pluginAntd = () => ({
|
|
|
55
55
|
...rsbuildConfig.source.transformImport || [],
|
|
56
56
|
{
|
|
57
57
|
libraryName: "antd",
|
|
58
|
-
libraryDirectory: (0,
|
|
58
|
+
libraryDirectory: (0, import_utils.isServerTarget)(api.context.targets) ? "lib" : "es",
|
|
59
59
|
style: true
|
|
60
60
|
}
|
|
61
61
|
];
|
|
@@ -21,8 +21,8 @@ __export(arco_exports, {
|
|
|
21
21
|
pluginArco: () => pluginArco
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(arco_exports);
|
|
24
|
-
var import_shared = require("@rsbuild/shared");
|
|
25
24
|
var import_utils = require("@modern-js/utils");
|
|
25
|
+
var import_utils2 = require("../../shared/utils");
|
|
26
26
|
const pluginArco = () => ({
|
|
27
27
|
name: "uni-builder:arco",
|
|
28
28
|
setup(api) {
|
|
@@ -34,7 +34,7 @@ const pluginArco = () => ({
|
|
|
34
34
|
if (transformImport === false || !(0, import_utils.isPackageInstalled)(ARCO_NAME, api.context.rootPath)) {
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
const isUseSSR = (0,
|
|
37
|
+
const isUseSSR = (0, import_utils2.isServerTarget)(api.context.targets);
|
|
38
38
|
if (!(transformImport === null || transformImport === void 0 ? void 0 : transformImport.some((item) => item.libraryName === ARCO_NAME))) {
|
|
39
39
|
transformImport.push({
|
|
40
40
|
libraryName: ARCO_NAME,
|
|
@@ -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
|
+
var import_utils = require("../../shared/utils");
|
|
26
27
|
const HTML_REGEX = /\.html$/;
|
|
27
28
|
const resourceRuleFallback = (rules = []) => {
|
|
28
29
|
const innerRules = [];
|
|
@@ -50,7 +51,7 @@ const resourceRuleFallback = (rules = []) => {
|
|
|
50
51
|
const fileLoader = {
|
|
51
52
|
exclude: [
|
|
52
53
|
import_shared.JS_REGEX,
|
|
53
|
-
|
|
54
|
+
import_utils.TS_REGEX,
|
|
54
55
|
// exclude `html` and `json`, they get processed by webpack internal loaders.
|
|
55
56
|
HTML_REGEX,
|
|
56
57
|
/\.json$/
|
|
@@ -71,12 +72,14 @@ const pluginFallback = () => ({
|
|
|
71
72
|
name: "uni-builder:fallback",
|
|
72
73
|
setup(api) {
|
|
73
74
|
if (api.context.bundlerType === "webpack") {
|
|
74
|
-
api.modifyBundlerChain((chain
|
|
75
|
+
api.modifyBundlerChain((chain) => {
|
|
75
76
|
const rsbuildConfig = api.getNormalizedConfig();
|
|
76
|
-
const
|
|
77
|
-
const
|
|
77
|
+
const { distPath, filename } = rsbuildConfig.output;
|
|
78
|
+
const distDir = distPath.media;
|
|
79
|
+
var _filename_media;
|
|
80
|
+
const mediaFilename = (_filename_media = filename.media) !== null && _filename_media !== void 0 ? _filename_media : `[name]${(0, import_utils.getHash)(rsbuildConfig)}[ext]`;
|
|
78
81
|
chain.output.merge({
|
|
79
|
-
assetModuleFilename: (0, import_path.join)(distDir,
|
|
82
|
+
assetModuleFilename: (0, import_path.join)(distDir, mediaFilename)
|
|
80
83
|
});
|
|
81
84
|
});
|
|
82
85
|
api.modifyWebpackConfig((config) => {
|
|
@@ -86,12 +89,13 @@ const pluginFallback = () => ({
|
|
|
86
89
|
config.module.rules = resourceRuleFallback(config.module.rules);
|
|
87
90
|
});
|
|
88
91
|
} else {
|
|
89
|
-
api.modifyRspackConfig((config
|
|
92
|
+
api.modifyRspackConfig((config) => {
|
|
90
93
|
var _config_module;
|
|
91
94
|
var _config, _config1;
|
|
92
95
|
const rsbuildConfig = api.getNormalizedConfig();
|
|
93
|
-
const distDir =
|
|
94
|
-
|
|
96
|
+
const distDir = rsbuildConfig.output.distPath.media;
|
|
97
|
+
var _rsbuildConfig_output_filename_media;
|
|
98
|
+
const filename = (_rsbuildConfig_output_filename_media = rsbuildConfig.output.filename.media) !== null && _rsbuildConfig_output_filename_media !== void 0 ? _rsbuildConfig_output_filename_media : `[name]${(0, import_utils.getHash)(rsbuildConfig)}[ext]`;
|
|
95
99
|
(_config = config).output || (_config.output = {});
|
|
96
100
|
config.output.assetModuleFilename = (0, import_path.join)(distDir, filename);
|
|
97
101
|
if (!config.module) {
|
|
@@ -21,7 +21,7 @@ __export(runtimeChunk_exports, {
|
|
|
21
21
|
pluginRuntimeChunk: () => pluginRuntimeChunk
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(runtimeChunk_exports);
|
|
24
|
-
var
|
|
24
|
+
var import_utils = require("../utils");
|
|
25
25
|
const pluginRuntimeChunk = (disableInlineRuntimeChunk) => ({
|
|
26
26
|
name: "uni-builder:runtime-chunk",
|
|
27
27
|
setup(api) {
|
|
@@ -33,7 +33,7 @@ const pluginRuntimeChunk = (disableInlineRuntimeChunk) => ({
|
|
|
33
33
|
const { chunkSplit } = config.performance;
|
|
34
34
|
if (chunkSplit.strategy !== "all-in-one") {
|
|
35
35
|
chain.optimization.runtimeChunk({
|
|
36
|
-
name:
|
|
36
|
+
name: import_utils.RUNTIME_CHUNK_NAME
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
});
|
|
@@ -43,7 +43,7 @@ const pluginRuntimeChunk = (disableInlineRuntimeChunk) => ({
|
|
|
43
43
|
if (disableInlineRuntimeChunk) {
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
const regexp = new RegExp(`${
|
|
46
|
+
const regexp = new RegExp(`${import_utils.RUNTIME_CHUNK_NAME}([.].+)?\\.js$`);
|
|
47
47
|
if (!config.output.inlineScripts) {
|
|
48
48
|
config.output.inlineScripts = regexp;
|
|
49
49
|
}
|
|
@@ -59,7 +59,6 @@ const pluginSplitChunks = () => ({
|
|
|
59
59
|
chain.optimization.splitChunks({
|
|
60
60
|
...currentConfig,
|
|
61
61
|
// rspack chunks type mismatch with webpack
|
|
62
|
-
// @ts-expect-error
|
|
63
62
|
cacheGroups: {
|
|
64
63
|
...(0, import_shared.createCacheGroups)(groups),
|
|
65
64
|
...currentConfig.cacheGroups
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { RsbuildTarget, NormalizedConfig } from '@rsbuild/core';
|
|
2
|
+
export declare const RUNTIME_CHUNK_NAME = "builder-runtime";
|
|
3
|
+
export declare const TS_REGEX: RegExp;
|
|
4
|
+
export declare function isServerTarget(target: RsbuildTarget[]): boolean;
|
|
5
|
+
export declare const getHash: (config: NormalizedConfig) => string;
|
|
@@ -16,13 +16,35 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
RUNTIME_CHUNK_NAME: () => RUNTIME_CHUNK_NAME
|
|
19
|
+
var utils_exports = {};
|
|
20
|
+
__export(utils_exports, {
|
|
21
|
+
RUNTIME_CHUNK_NAME: () => RUNTIME_CHUNK_NAME,
|
|
22
|
+
TS_REGEX: () => TS_REGEX,
|
|
23
|
+
getHash: () => getHash,
|
|
24
|
+
isServerTarget: () => isServerTarget
|
|
22
25
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
26
|
+
module.exports = __toCommonJS(utils_exports);
|
|
24
27
|
const RUNTIME_CHUNK_NAME = "builder-runtime";
|
|
28
|
+
const TS_REGEX = /\.(?:ts|mts|cts|tsx)$/;
|
|
29
|
+
function isServerTarget(target) {
|
|
30
|
+
return (Array.isArray(target) ? target : [
|
|
31
|
+
target
|
|
32
|
+
]).some((item) => [
|
|
33
|
+
"node",
|
|
34
|
+
"service-worker"
|
|
35
|
+
].includes(item));
|
|
36
|
+
}
|
|
37
|
+
const getHash = (config) => {
|
|
38
|
+
const { filenameHash } = config.output;
|
|
39
|
+
if (typeof filenameHash === "string") {
|
|
40
|
+
return filenameHash ? `.[${filenameHash}]` : "";
|
|
41
|
+
}
|
|
42
|
+
return filenameHash ? ".[contenthash:8]" : "";
|
|
43
|
+
};
|
|
25
44
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26
45
|
0 && (module.exports = {
|
|
27
|
-
RUNTIME_CHUNK_NAME
|
|
46
|
+
RUNTIME_CHUNK_NAME,
|
|
47
|
+
TS_REGEX,
|
|
48
|
+
getHash,
|
|
49
|
+
isServerTarget
|
|
28
50
|
});
|
|
@@ -23,6 +23,7 @@ __export(ModuleScopePlugin_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(ModuleScopePlugin_exports);
|
|
24
24
|
var import_path = require("path");
|
|
25
25
|
var import_shared = require("@rsbuild/shared");
|
|
26
|
+
var import_utils = require("@modern-js/utils");
|
|
26
27
|
class ModuleScopePlugin {
|
|
27
28
|
apply(resolver) {
|
|
28
29
|
const { allowedFiles, allowedDirs, allowedPatterns, relativeAllowedDirs } = this;
|
|
@@ -79,8 +80,8 @@ class ModuleScopePlugin {
|
|
|
79
80
|
constructor({ scopes, allowedFiles = [] }) {
|
|
80
81
|
this.scopes = scopes;
|
|
81
82
|
this.allowedFiles = new Set(allowedFiles);
|
|
82
|
-
this.allowedDirs = scopes.filter(
|
|
83
|
-
this.allowedPatterns = scopes.filter(
|
|
83
|
+
this.allowedDirs = scopes.filter(import_utils.isString);
|
|
84
|
+
this.allowedPatterns = scopes.filter(import_utils.isRegExp);
|
|
84
85
|
this.relativeAllowedDirs = this.allowedDirs.map((allowedDir) => `${(0, import_path.relative)((0, import_path.dirname)(allowedDir), allowedDir)}/`);
|
|
85
86
|
this.cache = /* @__PURE__ */ new Map();
|
|
86
87
|
}
|
|
@@ -48,7 +48,7 @@ const applyScopeChain = (defaults, options) => {
|
|
|
48
48
|
const pluginModuleScopes = (moduleScopes) => ({
|
|
49
49
|
name: "uni-builder:module-scopes",
|
|
50
50
|
setup(api) {
|
|
51
|
-
api.modifyBundlerChain(async (chain
|
|
51
|
+
api.modifyBundlerChain(async (chain) => {
|
|
52
52
|
if (!moduleScopes) {
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
@@ -61,7 +61,7 @@ const pluginModuleScopes = (moduleScopes) => ({
|
|
|
61
61
|
}
|
|
62
62
|
return scope;
|
|
63
63
|
});
|
|
64
|
-
chain.resolve.plugin(
|
|
64
|
+
chain.resolve.plugin("module-scope").use(ModuleScopePlugin, [
|
|
65
65
|
{
|
|
66
66
|
scopes: formattedScopes,
|
|
67
67
|
allowedFiles: [
|
|
@@ -32,8 +32,8 @@ __export(styledComponents_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(styledComponents_exports);
|
|
34
34
|
var import_core = require("@rsbuild/core");
|
|
35
|
-
var import_shared = require("@rsbuild/shared");
|
|
36
35
|
var import_utils = require("@modern-js/utils");
|
|
36
|
+
var import_utils2 = require("../../shared/utils");
|
|
37
37
|
const getDefaultStyledComponentsConfig = (isProd, ssr) => {
|
|
38
38
|
return {
|
|
39
39
|
ssr,
|
|
@@ -52,7 +52,7 @@ const pluginStyledComponents = (userConfig = {}) => ({
|
|
|
52
52
|
],
|
|
53
53
|
setup(api) {
|
|
54
54
|
api.modifyBundlerChain(async (chain, { CHAIN_ID, isProd }) => {
|
|
55
|
-
const isSSR = (0,
|
|
55
|
+
const isSSR = (0, import_utils2.isServerTarget)(api.context.targets);
|
|
56
56
|
const styledComponentsOptions = (0, import_utils.applyOptionsChain)(getDefaultStyledComponentsConfig(isProd, isSSR), userConfig);
|
|
57
57
|
if (!styledComponentsOptions) {
|
|
58
58
|
return;
|
|
@@ -36,6 +36,7 @@ var import_utils = require("@modern-js/utils");
|
|
|
36
36
|
var import_plugin_babel = require("@rsbuild/plugin-babel");
|
|
37
37
|
var import_web = require("@rsbuild/babel-preset/web");
|
|
38
38
|
var import_babel = require("./babel");
|
|
39
|
+
var import_utils2 = require("../../shared/utils");
|
|
39
40
|
const pluginTsLoader = (options, babelOptions) => {
|
|
40
41
|
return {
|
|
41
42
|
name: "uni-builder:ts-loader",
|
|
@@ -93,7 +94,7 @@ const pluginTsLoader = (options, babelOptions) => {
|
|
|
93
94
|
excludes
|
|
94
95
|
});
|
|
95
96
|
chain.module.rule(CHAIN_ID.RULE.JS).test(import_shared.JS_REGEX);
|
|
96
|
-
rule.test(
|
|
97
|
+
rule.test(import_utils2.TS_REGEX).use(CHAIN_ID.USE.BABEL).loader(require.resolve("babel-loader")).options({
|
|
97
98
|
...babelLoaderOptions,
|
|
98
99
|
// fix repeatedly insert babel plugin in some boundary cases
|
|
99
100
|
plugins: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modern-js/uni-builder",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.54.0",
|
|
4
4
|
"description": "Unified builder for Modern.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,26 +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.7.
|
|
30
|
-
"@rsbuild/core": "0.7.
|
|
31
|
-
"@rsbuild/plugin-sass": "0.7.
|
|
32
|
-
"@rsbuild/plugin-less": "0.7.
|
|
33
|
-
"@rsbuild/plugin-assets-retry": "0.7.
|
|
34
|
-
"@rsbuild/plugin-babel": "0.7.
|
|
35
|
-
"@rsbuild/plugin-check-syntax": "0.7.
|
|
36
|
-
"@rsbuild/plugin-css-minimizer": "0.7.
|
|
37
|
-
"@rsbuild/plugin-pug": "0.7.
|
|
38
|
-
"@rsbuild/plugin-react": "0.7.
|
|
39
|
-
"@rsbuild/plugin-rem": "0.7.
|
|
40
|
-
"@rsbuild/plugin-source-build": "0.7.
|
|
41
|
-
"@rsbuild/plugin-styled-components": "0.7.
|
|
42
|
-
"@rsbuild/plugin-svgr": "0.7.
|
|
43
|
-
"@rsbuild/plugin-type-check": "0.7.
|
|
44
|
-
"@rsbuild/plugin-typed-css-modules": "0.7.
|
|
45
|
-
"@rsbuild/plugin-toml": "0.7.
|
|
46
|
-
"@rsbuild/plugin-yaml": "0.7.
|
|
47
|
-
"@rsbuild/shared": "0.7.
|
|
48
|
-
"@rsbuild/webpack": "0.7.
|
|
29
|
+
"@rsbuild/babel-preset": "0.7.9",
|
|
30
|
+
"@rsbuild/core": "0.7.9",
|
|
31
|
+
"@rsbuild/plugin-sass": "0.7.9",
|
|
32
|
+
"@rsbuild/plugin-less": "0.7.9",
|
|
33
|
+
"@rsbuild/plugin-assets-retry": "0.7.9",
|
|
34
|
+
"@rsbuild/plugin-babel": "0.7.9",
|
|
35
|
+
"@rsbuild/plugin-check-syntax": "0.7.9",
|
|
36
|
+
"@rsbuild/plugin-css-minimizer": "0.7.9",
|
|
37
|
+
"@rsbuild/plugin-pug": "0.7.9",
|
|
38
|
+
"@rsbuild/plugin-react": "0.7.9",
|
|
39
|
+
"@rsbuild/plugin-rem": "0.7.9",
|
|
40
|
+
"@rsbuild/plugin-source-build": "0.7.9",
|
|
41
|
+
"@rsbuild/plugin-styled-components": "0.7.9",
|
|
42
|
+
"@rsbuild/plugin-svgr": "0.7.9",
|
|
43
|
+
"@rsbuild/plugin-type-check": "0.7.9",
|
|
44
|
+
"@rsbuild/plugin-typed-css-modules": "0.7.9",
|
|
45
|
+
"@rsbuild/plugin-toml": "0.7.9",
|
|
46
|
+
"@rsbuild/plugin-yaml": "0.7.9",
|
|
47
|
+
"@rsbuild/shared": "0.7.9",
|
|
48
|
+
"@rsbuild/webpack": "0.7.9",
|
|
49
49
|
"@swc/helpers": "0.5.3",
|
|
50
50
|
"babel-loader": "9.1.3",
|
|
51
51
|
"babel-plugin-import": "1.13.5",
|
|
@@ -67,20 +67,20 @@
|
|
|
67
67
|
"rspack-manifest-plugin": "5.0.0",
|
|
68
68
|
"terser-webpack-plugin": "5.3.10",
|
|
69
69
|
"ts-loader": "9.4.4",
|
|
70
|
-
"webpack": "^5.
|
|
70
|
+
"webpack": "^5.92.0",
|
|
71
71
|
"webpack-subresource-integrity": "5.1.0",
|
|
72
|
-
"@modern-js/
|
|
73
|
-
"@modern-js/
|
|
74
|
-
"@modern-js/
|
|
72
|
+
"@modern-js/utils": "2.54.0",
|
|
73
|
+
"@modern-js/prod-server": "2.54.0",
|
|
74
|
+
"@modern-js/server": "2.54.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@rsbuild/plugin-swc": "0.7.
|
|
77
|
+
"@rsbuild/plugin-swc": "0.7.9",
|
|
78
78
|
"@types/lodash": "^4.14.202",
|
|
79
79
|
"react": "^18.2.0",
|
|
80
80
|
"react-dom": "^18.2.0",
|
|
81
81
|
"typescript": "^5.3.0",
|
|
82
|
-
"@scripts/build": "2.
|
|
83
|
-
"@scripts/vitest-config": "2.
|
|
82
|
+
"@scripts/build": "2.54.0",
|
|
83
|
+
"@scripts/vitest-config": "2.54.0"
|
|
84
84
|
},
|
|
85
85
|
"publishConfig": {
|
|
86
86
|
"access": "public",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const RUNTIME_CHUNK_NAME = "builder-runtime";
|