@modern-js/uni-builder 2.67.11 → 2.68.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/shared/devServer.js +11 -3
- package/dist/shared/parseCommonConfig.js +6 -1
- package/dist/shared/rsc/common.js +6 -2
- package/dist/shared/rsc/plugins/rsbuild-rsc-plugin.js +2 -2
- package/dist/types.d.ts +1 -0
- package/dist/webpack/index.js +2 -0
- package/dist/webpack/plugins/include.d.ts +2 -0
- package/dist/webpack/plugins/include.js +46 -0
- package/package.json +7 -7
package/dist/shared/devServer.js
CHANGED
|
@@ -25,14 +25,21 @@ var import_utils = require("@modern-js/utils");
|
|
|
25
25
|
var import_ts_deepmerge = require("ts-deepmerge");
|
|
26
26
|
const transformDevSetupMiddlewares = (seuptMiddlewares) => {
|
|
27
27
|
if (seuptMiddlewares) {
|
|
28
|
-
const newSetupMiddlewares = seuptMiddlewares.map((handler) => (_, server) => {
|
|
28
|
+
const newSetupMiddlewares = Array.isArray(seuptMiddlewares) ? seuptMiddlewares.map((handler) => (_, server) => {
|
|
29
29
|
handler({
|
|
30
30
|
unshift() {
|
|
31
31
|
},
|
|
32
32
|
push() {
|
|
33
33
|
}
|
|
34
34
|
}, server);
|
|
35
|
-
})
|
|
35
|
+
}) : (_, server) => {
|
|
36
|
+
seuptMiddlewares({
|
|
37
|
+
unshift() {
|
|
38
|
+
},
|
|
39
|
+
push() {
|
|
40
|
+
}
|
|
41
|
+
}, server);
|
|
42
|
+
};
|
|
36
43
|
return newSetupMiddlewares;
|
|
37
44
|
}
|
|
38
45
|
return void 0;
|
|
@@ -83,7 +90,8 @@ const transformToRsbuildServerOptions = (dev, devServer) => {
|
|
|
83
90
|
proxy: newDevServerConfig.proxy,
|
|
84
91
|
port,
|
|
85
92
|
host,
|
|
86
|
-
https: https ? https : void 0
|
|
93
|
+
https: https ? https : void 0,
|
|
94
|
+
middlewareMode: true
|
|
87
95
|
};
|
|
88
96
|
if (!(0, import_utils.isProd)() && startUrl) {
|
|
89
97
|
server.open = beforeStartUrl ? {
|
|
@@ -80,7 +80,7 @@ async function parseCommonConfig(uniBuilderConfig, options) {
|
|
|
80
80
|
var _uniBuilderConfig_output, _uniBuilderConfig_tools;
|
|
81
81
|
var _rsbuildConfig_tools, _output, _output_distPath, _output1, _extraConfig, _html, _extraConfig1;
|
|
82
82
|
const frameworkConfigPath = options === null || options === void 0 ? void 0 : options.frameworkConfigPath;
|
|
83
|
-
const { plugins: [...plugins] = [], performance: { ...performanceConfig } = {}, output: { disableFilenameHash, enableLatestDecorators, cssModuleLocalIdentName, enableInlineScripts, disableCssExtract, enableInlineStyles, enableCssModuleTSDeclaration, disableCssModuleExtension, disableTsChecker, disableSvgr, svgDefaultExport, assetsRetry, enableAssetFallback, enableAssetManifest, disableSourceMap, sourceMap, convertToRem, disableMinimize, polyfill, dataUriLimit = 1e4, distPath = {}, ...outputConfig } = {}, html: { disableHtmlFolder, metaByEntries, titleByEntries, faviconByEntries, injectByEntries, templateByEntries, templateParametersByEntries, tagsByEntries, outputStructure, appIcon, tags, ...htmlConfig } = {}, source: { alias, globalVars, resolveMainFields, resolveExtensionPrefix, transformImport, ...sourceConfig } = {}, dev, security: { checkSyntax, sri, ...securityConfig } = {}, tools: { devServer, tsChecker, minifyCss, less, sass, htmlPlugin, autoprefixer, ...toolsConfig } = {}, environments = {} } = uniBuilderConfig;
|
|
83
|
+
const { plugins: [...plugins] = [], performance: { ...performanceConfig } = {}, output: { disableFilenameHash, enableLatestDecorators, cssModuleLocalIdentName, enableInlineScripts, disableCssExtract, enableInlineStyles, enableCssModuleTSDeclaration, disableCssModuleExtension, disableTsChecker, disableSvgr, svgDefaultExport, assetsRetry, enableAssetFallback, enableAssetManifest, disableSourceMap, sourceMap, convertToRem, disableMinimize, polyfill, dataUriLimit = 1e4, distPath = {}, ...outputConfig } = {}, html: { disableHtmlFolder, metaByEntries, titleByEntries, faviconByEntries, injectByEntries, templateByEntries, templateParametersByEntries, tagsByEntries, outputStructure, appIcon, tags, ...htmlConfig } = {}, source: { alias, globalVars, resolveMainFields, resolveExtensionPrefix, transformImport, ...sourceConfig } = {}, dev, security: { checkSyntax, sri, ...securityConfig } = {}, tools: { devServer, tsChecker, minifyCss, less, sass, htmlPlugin, autoprefixer, ...toolsConfig } = {}, environments = {}, resolve = {} } = uniBuilderConfig;
|
|
84
84
|
const rsbuildConfig = {
|
|
85
85
|
plugins,
|
|
86
86
|
output: {
|
|
@@ -89,6 +89,7 @@ async function parseCommonConfig(uniBuilderConfig, options) {
|
|
|
89
89
|
sourceMap,
|
|
90
90
|
...outputConfig
|
|
91
91
|
},
|
|
92
|
+
resolve,
|
|
92
93
|
source: {
|
|
93
94
|
alias,
|
|
94
95
|
...sourceConfig
|
|
@@ -99,6 +100,10 @@ async function parseCommonConfig(uniBuilderConfig, options) {
|
|
|
99
100
|
security: securityConfig,
|
|
100
101
|
environments
|
|
101
102
|
};
|
|
103
|
+
if (typeof alias === "object" && Object.keys(alias).length === 0) {
|
|
104
|
+
var _rsbuildConfig_source;
|
|
105
|
+
(_rsbuildConfig_source = rsbuildConfig.source) === null || _rsbuildConfig_source === void 0 ? true : delete _rsbuildConfig_source.alias;
|
|
106
|
+
}
|
|
102
107
|
rsbuildConfig.tools.htmlPlugin = htmlPlugin;
|
|
103
108
|
var _lightningcssLoader;
|
|
104
109
|
(_lightningcssLoader = (_rsbuildConfig_tools = rsbuildConfig.tools).lightningcssLoader) !== null && _lightningcssLoader !== void 0 ? _lightningcssLoader : _rsbuildConfig_tools.lightningcssLoader = false;
|
|
@@ -50,11 +50,15 @@ const sharedData = {
|
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
function setBuildInfo(mod, property) {
|
|
53
|
-
|
|
53
|
+
if (!mod.buildInfo) {
|
|
54
|
+
mod.buildInfo = {};
|
|
55
|
+
}
|
|
54
56
|
Object.assign(mod.buildInfo, property);
|
|
55
57
|
}
|
|
56
58
|
function setRscBuildInfo(mod, property) {
|
|
57
|
-
|
|
59
|
+
if (!mod.buildInfo) {
|
|
60
|
+
mod.buildInfo = {};
|
|
61
|
+
}
|
|
58
62
|
const rscBuildInfo = mod.buildInfo[MODERN_RSC_INFO] || {};
|
|
59
63
|
Object.assign(rscBuildInfo, property);
|
|
60
64
|
setBuildInfo(mod, {
|
|
@@ -90,11 +90,11 @@ const rsbuildRscPlugin = ({ appDir, isRspack = true, rscClientRuntimePath, rscSe
|
|
|
90
90
|
const jsLoaderOptions = originalJsRule.use(JSRule).get("options");
|
|
91
91
|
const jsLoaderPath = originalJsRule.use(JSRule).get("loader");
|
|
92
92
|
originalJsRule.uses.delete(JSRule);
|
|
93
|
-
chain.module.rule(CHAIN_ID.RULE.JS).oneOf("rsc-server").issuerLayer(import_common.webpackRscLayerName).use("rsc-server-loader").loader(require.resolve("../rsc-server-loader")).options({
|
|
93
|
+
chain.module.rule(CHAIN_ID.RULE.JS).oneOf("rsc-server").issuerLayer(import_common.webpackRscLayerName).exclude.add(/universal[/\\]async_storage/).end().use("rsc-server-loader").loader(require.resolve("../rsc-server-loader")).options({
|
|
94
94
|
entryPath2Name,
|
|
95
95
|
appDir,
|
|
96
96
|
runtimePath: rscServerRuntimePath
|
|
97
|
-
}).end().use(JSRule).loader(jsLoaderPath).options(jsLoaderOptions).end().end().oneOf("rsc-ssr").use("rsc-ssr-loader").loader(require.resolve("../rsc-ssr-loader")).options({
|
|
97
|
+
}).end().use(JSRule).loader(jsLoaderPath).options(jsLoaderOptions).end().end().oneOf("rsc-ssr").exclude.add(/universal[/\\]async_storage/).end().use("rsc-ssr-loader").loader(require.resolve("../rsc-ssr-loader")).options({
|
|
98
98
|
entryPath2Name
|
|
99
99
|
}).end().use(JSRule).loader(jsLoaderPath).options(jsLoaderOptions).end().end();
|
|
100
100
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -384,6 +384,7 @@ export type UniBuilderConfig = {
|
|
|
384
384
|
performance?: RsbuildConfig['performance'];
|
|
385
385
|
security?: Omit<SecurityConfig, 'sri'>;
|
|
386
386
|
tools?: Omit<ToolsConfig, 'htmlPlugin'>;
|
|
387
|
+
resolve?: RsbuildConfig['resolve'];
|
|
387
388
|
source?: Omit<SourceConfig, 'alias' | 'transformImport'>;
|
|
388
389
|
plugins?: RsbuildPlugins;
|
|
389
390
|
environments?: {
|
package/dist/webpack/index.js
CHANGED
|
@@ -39,6 +39,7 @@ var import_postcss = require("../shared/plugins/postcss");
|
|
|
39
39
|
var import_rsbuild_rsc_plugin = require("../shared/rsc/plugins/rsbuild-rsc-plugin");
|
|
40
40
|
var import_utils = require("../shared/utils");
|
|
41
41
|
var import_babel = require("./plugins/babel");
|
|
42
|
+
var import_include = require("./plugins/include");
|
|
42
43
|
var import_moduleScopes = require("./plugins/moduleScopes");
|
|
43
44
|
var import_react = require("./plugins/react");
|
|
44
45
|
async function parseConfig(uniBuilderConfig, options) {
|
|
@@ -137,6 +138,7 @@ async function parseConfig(uniBuilderConfig, options) {
|
|
|
137
138
|
rsbuildPlugins.push(pluginStyledComponents(options2));
|
|
138
139
|
}
|
|
139
140
|
rsbuildPlugins.push((0, import_moduleScopes.pluginModuleScopes)((_uniBuilderConfig_source = uniBuilderConfig.source) === null || _uniBuilderConfig_source === void 0 ? void 0 : _uniBuilderConfig_source.moduleScopes));
|
|
141
|
+
rsbuildPlugins.push((0, import_include.pluginInclude)());
|
|
140
142
|
return {
|
|
141
143
|
rsbuildConfig,
|
|
142
144
|
rsbuildPlugins
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var include_exports = {};
|
|
20
|
+
__export(include_exports, {
|
|
21
|
+
pluginInclude: () => pluginInclude
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(include_exports);
|
|
24
|
+
const pluginInclude = () => ({
|
|
25
|
+
name: "uni-builder:babel-include",
|
|
26
|
+
setup(api) {
|
|
27
|
+
api.modifyWebpackChain((chain, { CHAIN_ID }) => {
|
|
28
|
+
const includes = chain.module.rule(CHAIN_ID.RULE.JS).include.values();
|
|
29
|
+
includes.forEach((include) => {
|
|
30
|
+
if (typeof include === "object" && !Array.isArray(include) && !(include instanceof RegExp) && include.not && include.not.toString() === /[\\/]node_modules[\\/]/.toString()) {
|
|
31
|
+
include.and = [
|
|
32
|
+
api.context.rootPath || process.cwd(),
|
|
33
|
+
{
|
|
34
|
+
not: include.not
|
|
35
|
+
}
|
|
36
|
+
];
|
|
37
|
+
delete include.not;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
pluginInclude
|
|
46
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modern-js/uni-builder",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.68.0",
|
|
4
4
|
"description": "Unified builder for Modern.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@babel/preset-react": "^7.22.15",
|
|
31
31
|
"@babel/types": "^7.26.0",
|
|
32
32
|
"@pmmmwh/react-refresh-webpack-plugin": "0.5.16",
|
|
33
|
-
"@rsbuild/core": "1.3
|
|
33
|
+
"@rsbuild/core": "1.4.3",
|
|
34
34
|
"@rsbuild/plugin-assets-retry": "1.3.0",
|
|
35
35
|
"@rsbuild/plugin-babel": "1.0.5",
|
|
36
36
|
"@rsbuild/plugin-check-syntax": "1.3.0",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@rsbuild/plugin-rem": "1.0.2",
|
|
42
42
|
"@rsbuild/plugin-sass": "1.3.2",
|
|
43
43
|
"@rsbuild/plugin-source-build": "1.0.2",
|
|
44
|
-
"@rsbuild/plugin-styled-components": "1.
|
|
44
|
+
"@rsbuild/plugin-styled-components": "1.4.0",
|
|
45
45
|
"@rsbuild/plugin-svgr": "1.2.0",
|
|
46
46
|
"@rsbuild/plugin-toml": "1.1.0",
|
|
47
47
|
"@rsbuild/plugin-type-check": "1.2.3",
|
|
@@ -80,9 +80,9 @@
|
|
|
80
80
|
"ts-loader": "9.4.4",
|
|
81
81
|
"webpack": "^5.99.8",
|
|
82
82
|
"webpack-subresource-integrity": "5.1.0",
|
|
83
|
-
"@modern-js/babel-preset": "2.
|
|
84
|
-
"@modern-js/flight-server-transform-plugin": "2.
|
|
85
|
-
"@modern-js/utils": "2.
|
|
83
|
+
"@modern-js/babel-preset": "2.68.0",
|
|
84
|
+
"@modern-js/flight-server-transform-plugin": "2.68.0",
|
|
85
|
+
"@modern-js/utils": "2.68.0"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@rsbuild/plugin-webpack-swc": "1.1.1",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"react-dom": "^18.2.0",
|
|
94
94
|
"terser": "^5.31.1",
|
|
95
95
|
"typescript": "^5.3.0",
|
|
96
|
-
"@modern-js/types": "2.
|
|
96
|
+
"@modern-js/types": "2.68.0",
|
|
97
97
|
"@scripts/build": "2.66.0",
|
|
98
98
|
"@scripts/vitest-config": "2.66.0"
|
|
99
99
|
},
|