@umijs/plugins 4.0.24 → 4.0.26
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/antd.js
CHANGED
|
@@ -26,6 +26,7 @@ __export(antd_exports, {
|
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(antd_exports);
|
|
28
28
|
var import_path = require("path");
|
|
29
|
+
var import_assert = __toESM(require("assert"));
|
|
29
30
|
var import_plugin_utils = require("umi/plugin-utils");
|
|
30
31
|
var import_resolveProjectDep = require("./utils/resolveProjectDep");
|
|
31
32
|
var import_withTmpPath = require("./utils/withTmpPath");
|
|
@@ -49,7 +50,8 @@ var antd_default = (api) => {
|
|
|
49
50
|
dark: Joi.boolean(),
|
|
50
51
|
compact: Joi.boolean(),
|
|
51
52
|
import: Joi.boolean(),
|
|
52
|
-
style: Joi.string().allow("less", "css")
|
|
53
|
+
style: Joi.string().allow("less", "css"),
|
|
54
|
+
theme: Joi.object()
|
|
53
55
|
}), Joi.boolean().invalid(true));
|
|
54
56
|
}
|
|
55
57
|
},
|
|
@@ -76,7 +78,7 @@ var antd_default = (api) => {
|
|
|
76
78
|
let antd = memo.antd || {};
|
|
77
79
|
if (process.env.UMI_PLUGIN_ANTD_ENABLE) {
|
|
78
80
|
const { defaultConfig } = JSON.parse(process.env.UMI_PLUGIN_ANTD_ENABLE);
|
|
79
|
-
antd = Object.assign(defaultConfig, antd);
|
|
81
|
+
memo.antd = antd = Object.assign(defaultConfig, antd);
|
|
80
82
|
}
|
|
81
83
|
memo.alias.antd = pkgPath;
|
|
82
84
|
if (antd.dayjs) {
|
|
@@ -100,6 +102,11 @@ var antd_default = (api) => {
|
|
|
100
102
|
"root-entry-name": "default",
|
|
101
103
|
...memo.theme
|
|
102
104
|
};
|
|
105
|
+
if (antd.theme) {
|
|
106
|
+
(0, import_assert.default)(antdVersion.startsWith("5"), `antd.theme is only valid when antd is 5`);
|
|
107
|
+
antd.configProvider ?? (antd.configProvider = {});
|
|
108
|
+
antd.configProvider.theme = (0, import_plugin_utils.deepmerge)(antd.configProvider.theme || {}, antd.theme);
|
|
109
|
+
}
|
|
103
110
|
return memo;
|
|
104
111
|
});
|
|
105
112
|
api.addExtraBabelPlugins(() => {
|
package/dist/layout.js
CHANGED
|
@@ -131,6 +131,7 @@ const filterRoutes = (routes: IRoute[], filterFn: (route: IRoute) => boolean) =>
|
|
|
131
131
|
newRoutes.push(route);
|
|
132
132
|
if (Array.isArray(route.routes)) {
|
|
133
133
|
route.routes = filterRoutes(route.routes, filterFn);
|
|
134
|
+
route.children = route.routes;
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
}
|
package/libs/locale/runtime.tpl
CHANGED
|
@@ -16,6 +16,7 @@ export function patchRoutes({ routes }) {
|
|
|
16
16
|
Object.keys(routes).forEach((key) => {
|
|
17
17
|
const route = routes[key];
|
|
18
18
|
if (route.title) {
|
|
19
|
+
route.locale = route.title;
|
|
19
20
|
const newTitle = intl.messages[route.title] ? intl.formatMessage({ id: route.title }, {}) : route.title;
|
|
20
21
|
route.name = intl.messages[route.title] ? intl.formatMessage({ id: route.title }, {}) : route.name;
|
|
21
22
|
route.title = newTitle;
|
|
@@ -23,8 +24,8 @@ export function patchRoutes({ routes }) {
|
|
|
23
24
|
if (route.routes) {
|
|
24
25
|
traverseRoute(route.routes);
|
|
25
26
|
}
|
|
26
|
-
if (route.
|
|
27
|
-
traverseRoute(route.
|
|
27
|
+
if (route.children) {
|
|
28
|
+
traverseRoute(route.children);
|
|
28
29
|
}
|
|
29
30
|
})
|
|
30
31
|
}
|
|
@@ -74,6 +74,7 @@ export const MicroApp = forwardRef(
|
|
|
74
74
|
lifeCycles: globalLifeCycles,
|
|
75
75
|
prefetch = true,
|
|
76
76
|
appNameKeyAlias = 'name',
|
|
77
|
+
prefetchThreshold = 5,
|
|
77
78
|
...globalSettings
|
|
78
79
|
} = getMasterOptions() as MasterOptions;
|
|
79
80
|
|
|
@@ -184,9 +185,10 @@ export const MicroApp = forwardRef(
|
|
|
184
185
|
);
|
|
185
186
|
prefetchApps(specialPrefetchApps, configuration);
|
|
186
187
|
} else {
|
|
188
|
+
// 不能无脑全量 prefetch,需要有一个阈值
|
|
187
189
|
const otherNotMountedApps = apps.filter(
|
|
188
190
|
(app) => !isCurrentApp(app),
|
|
189
|
-
);
|
|
191
|
+
).slice(0, prefetchThreshold);
|
|
190
192
|
prefetchApps(otherNotMountedApps, configuration);
|
|
191
193
|
}
|
|
192
194
|
noneMounted = false;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useMatch } from 'umi';
|
|
2
3
|
import { MicroApp } from './MicroApp';
|
|
3
4
|
|
|
4
5
|
export function getMicroAppRouteComponent(opts: {
|
|
@@ -10,11 +11,13 @@ export function getMicroAppRouteComponent(opts: {
|
|
|
10
11
|
}) {
|
|
11
12
|
const { base, masterHistoryType, appName, routeProps, routePath } = opts;
|
|
12
13
|
const RouteComponent = () => {
|
|
14
|
+
const match = useMatch(routePath);
|
|
15
|
+
const url = match.pathnameBase;
|
|
13
16
|
// 默认取静态配置的 base
|
|
14
17
|
let umiConfigBase = base === '/' ? '' : base;
|
|
15
18
|
|
|
16
19
|
// 拼接子应用挂载路由
|
|
17
|
-
let runtimeMatchedBase = umiConfigBase +
|
|
20
|
+
let runtimeMatchedBase = umiConfigBase + (url.endsWith('/') ? url.substr(0, url.length - 1) : url);
|
|
18
21
|
|
|
19
22
|
{{#dynamicRoot}}
|
|
20
23
|
// @see https://github.com/umijs/umi/blob/master/packages/preset-built-in/src/plugins/commands/htmlUtils.ts#L102
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugins",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.26",
|
|
4
4
|
"description": "@umijs/plugins",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi/tree/master/packages/plugins#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi/issues",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"@ant-design/antd-theme-variable": "^1.0.0",
|
|
28
28
|
"@ant-design/icons": "^4.7.0",
|
|
29
29
|
"@ant-design/pro-components": "^2.0.1",
|
|
30
|
-
"@umijs/bundler-utils": "4.0.
|
|
30
|
+
"@umijs/bundler-utils": "4.0.26",
|
|
31
31
|
"@umijs/valtio": "^1.0.0",
|
|
32
32
|
"antd-dayjs-webpack-plugin": "^1.0.6",
|
|
33
33
|
"axios": "^0.27.2",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"warning": "^4.0.3"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"umi": "4.0.
|
|
50
|
+
"umi": "4.0.26"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|