@umijs/plugins 4.0.33 → 4.0.34
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/libs/qiankun/slave/lifecycles.ts +26 -31
- package/package.json +3 -3
|
@@ -23,22 +23,22 @@ let hasMountedAtLeastOnce = false;
|
|
|
23
23
|
export default () => defer.promise;
|
|
24
24
|
export const contextOptsStack: any[] = [];
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
26
|
+
function normalizeHistory(
|
|
27
|
+
history?: 'string' | Record<string, any>,
|
|
28
|
+
base?: string,
|
|
29
|
+
) {
|
|
30
|
+
let normalizedHistory: Record<string, any> = {};
|
|
31
|
+
if (base) normalizedHistory.basename = base;
|
|
32
|
+
if (history) {
|
|
33
|
+
if (typeof history === 'string') {
|
|
34
|
+
normalizedHistory.type = history;
|
|
35
|
+
} else {
|
|
36
|
+
normalizedHistory = history;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return normalizedHistory;
|
|
41
|
+
}
|
|
42
42
|
|
|
43
43
|
async function getSlaveRuntime() {
|
|
44
44
|
const config = await getPluginManager().applyPlugins({
|
|
@@ -73,21 +73,24 @@ export function genMount(mountElementId: string) {
|
|
|
73
73
|
await slaveRuntime.mount(props);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
const { type, ...historyOpts } =
|
|
76
|
+
const { type, ...historyOpts } = normalizeHistory(
|
|
77
|
+
props?.history || {},
|
|
78
|
+
props?.base,
|
|
79
|
+
);
|
|
77
80
|
|
|
78
81
|
// 更新 clientRender 配置
|
|
79
82
|
const clientRenderOpts = {
|
|
80
|
-
// 默认开启
|
|
81
|
-
// 如果需要手动控制 loading,通过主应用配置 props.autoSetLoading false 可以关闭
|
|
82
83
|
callback: () => {
|
|
84
|
+
// 默认开启
|
|
85
|
+
// 如果需要手动控制 loading,通过主应用配置 props.autoSetLoading false 可以关闭
|
|
83
86
|
if (props.autoSetLoading && typeof props.setLoading === 'function') {
|
|
84
87
|
props.setLoading(false);
|
|
85
88
|
}
|
|
86
89
|
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
// 支持将子应用的 history 回传给父应用
|
|
91
|
+
if (typeof props?.onHistoryInit === 'function') {
|
|
92
|
+
props.onHistoryInit(history);
|
|
93
|
+
}
|
|
91
94
|
},
|
|
92
95
|
// 支持通过 props 注入 container 来限定子应用 mountElementId 的查找范围
|
|
93
96
|
// 避免多个子应用出现在同一主应用时出现 mount 冲突
|
|
@@ -125,14 +128,6 @@ export function genMount(mountElementId: string) {
|
|
|
125
128
|
defer.resolve();
|
|
126
129
|
}
|
|
127
130
|
|
|
128
|
-
// 如果需要手动控制 loading,通过主应用配置 props.autoSetLoading false 可以关闭
|
|
129
|
-
// 考虑到 react 18 之后 callback 不再准
|
|
130
|
-
// 所以在这里直接返回,而不使用 ReactDOM.render 的第三个参数
|
|
131
|
-
if (typeof props !== 'undefined') {
|
|
132
|
-
if (props.autoSetLoading && typeof props.setLoading === 'function') {
|
|
133
|
-
props.setLoading(false);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
131
|
hasMountedAtLeastOnce = true;
|
|
137
132
|
};
|
|
138
133
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugins",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.34",
|
|
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.34",
|
|
31
31
|
"@umijs/valtio": "^1.0.0",
|
|
32
32
|
"antd-dayjs-webpack-plugin": "^1.0.6",
|
|
33
33
|
"axios": "^0.27.2",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"antd": "^4.24.1",
|
|
52
|
-
"umi": "4.0.
|
|
52
|
+
"umi": "4.0.34"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|