@umijs/plugins 4.0.7 → 4.0.10
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/access.js +69 -53
- package/dist/analytics.js +62 -41
- package/dist/antd.js +139 -123
- package/dist/dva.js +155 -141
- package/dist/icons.js +28 -4
- package/dist/initial-state.js +80 -54
- package/dist/layout.js +219 -215
- package/dist/locale.js +214 -192
- package/dist/mf.d.ts +2 -0
- package/dist/mf.js +197 -0
- package/dist/model.js +79 -78
- package/dist/moment2dayjs.js +102 -81
- package/dist/qiankun/constants.js +41 -8
- package/dist/qiankun/master.js +163 -121
- package/dist/qiankun/slave.js +183 -148
- package/dist/qiankun.js +46 -19
- package/dist/request.js +91 -55
- package/dist/tailwindcss.js +74 -49
- package/dist/unocss.js +57 -37
- package/dist/utils/astUtils.js +38 -34
- package/dist/utils/localeUtils.js +125 -120
- package/dist/utils/modelUtils.js +216 -237
- package/dist/utils/resolveProjectDep.js +36 -13
- package/dist/utils/withTmpPath.js +31 -9
- package/libs/locale/localeExports.tpl +7 -3
- package/libs/qiankun/master/MicroApp.tsx +17 -12
- package/libs/qiankun/master/types.ts +1 -1
- package/libs/qiankun/slave/lifecycles.ts +15 -7
- package/package.json +6 -6
|
@@ -88,9 +88,16 @@ export const MicroApp = forwardRef(
|
|
|
88
88
|
...propsFromParams
|
|
89
89
|
} = componentProps;
|
|
90
90
|
|
|
91
|
-
//
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
// ref: https://github.com/umijs/plugins/pull/866
|
|
92
|
+
// name 跟 appNameKeyAlias 这两个 key 同时存在时,优先使用 name,避免对存量应用造成 breaking change。
|
|
93
|
+
// 比如 appNameKeyAlias 配置是 id,但之前 id 正好作为普通的 props 使用过,如 <MicroApp name="app" id="123" />
|
|
94
|
+
// 正常场景会优先匹配 appNameKeyAlias 对应的字段,fallback 到 name,避免对已经使用 <MicroApp name="app" /> 的应用造成影响
|
|
95
|
+
const name =
|
|
96
|
+
componentProps.name && componentProps[appNameKeyAlias]
|
|
97
|
+
? componentProps.name
|
|
98
|
+
: componentProps[appNameKeyAlias] || componentProps.name;
|
|
99
|
+
const isCurrentApp = (app: any) =>
|
|
100
|
+
app[appNameKeyAlias] === name || app.name === name;
|
|
94
101
|
|
|
95
102
|
const [loading, setLoading] = useState(true);
|
|
96
103
|
const [error, setError] = useState<any>(null);
|
|
@@ -143,13 +150,6 @@ export const MicroApp = forwardRef(
|
|
|
143
150
|
setComponentError(null);
|
|
144
151
|
setLoading(true);
|
|
145
152
|
const configuration = {
|
|
146
|
-
fetch(url) {
|
|
147
|
-
return window.fetch(url, {
|
|
148
|
-
headers: {
|
|
149
|
-
accept: 'text/html',
|
|
150
|
-
},
|
|
151
|
-
});
|
|
152
|
-
},
|
|
153
153
|
globalContext: window,
|
|
154
154
|
...globalSettings,
|
|
155
155
|
...settingsFromProps,
|
|
@@ -178,11 +178,16 @@ export const MicroApp = forwardRef(
|
|
|
178
178
|
if (noneMounted) {
|
|
179
179
|
if (Array.isArray(prefetch)) {
|
|
180
180
|
const specialPrefetchApps = apps.filter(
|
|
181
|
-
(app) =>
|
|
181
|
+
(app) =>
|
|
182
|
+
!isCurrentApp(app) &&
|
|
183
|
+
(prefetch.indexOf(app[appNameKeyAlias]) !== -1 ||
|
|
184
|
+
prefetch.indexOf(app.name) !== -1),
|
|
182
185
|
);
|
|
183
186
|
prefetchApps(specialPrefetchApps, configuration);
|
|
184
187
|
} else {
|
|
185
|
-
const otherNotMountedApps = apps.filter(
|
|
188
|
+
const otherNotMountedApps = apps.filter(
|
|
189
|
+
(app) => !isCurrentApp(app),
|
|
190
|
+
);
|
|
186
191
|
prefetchApps(otherNotMountedApps, configuration);
|
|
187
192
|
}
|
|
188
193
|
noneMounted = false;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import { getPluginManager } from '@@/core/plugin';
|
|
3
3
|
import ReactDOM from 'react-dom';
|
|
4
|
-
import { ApplyPluginsType } from 'umi';
|
|
4
|
+
import { ApplyPluginsType, __getRoot } from 'umi';
|
|
5
5
|
import { setModelState } from './qiankunModel';
|
|
6
6
|
|
|
7
7
|
const noop = () => {};
|
|
@@ -73,7 +73,7 @@ export function genMount(mountElementId: string) {
|
|
|
73
73
|
await slaveRuntime.mount(props);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
const { type, ...historyOpts } = props?.history;
|
|
76
|
+
const { type, ...historyOpts } = props?.history || {};
|
|
77
77
|
|
|
78
78
|
// 更新 clientRender 配置
|
|
79
79
|
const clientRenderOpts = {
|
|
@@ -149,12 +149,20 @@ export function genUpdate() {
|
|
|
149
149
|
|
|
150
150
|
export function genUnmount(mountElementId: string) {
|
|
151
151
|
return async (props: any) => {
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (
|
|
156
|
-
|
|
152
|
+
const root = __getRoot();
|
|
153
|
+
|
|
154
|
+
// support react 18 unmount
|
|
155
|
+
if (typeof root?.unmount === 'function') {
|
|
156
|
+
root.unmount();
|
|
157
|
+
} else {
|
|
158
|
+
const container = props?.container
|
|
159
|
+
? props.container.querySelector(`#${mountElementId}`)
|
|
160
|
+
: document.getElementById(mountElementId);
|
|
161
|
+
if (container) {
|
|
162
|
+
ReactDOM.unmountComponentAtNode(container);
|
|
163
|
+
}
|
|
157
164
|
}
|
|
165
|
+
|
|
158
166
|
const slaveRuntime = await getSlaveRuntime();
|
|
159
167
|
if (slaveRuntime.unmount) await slaveRuntime.unmount(props);
|
|
160
168
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugins",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.10",
|
|
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",
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
"libs"
|
|
17
17
|
],
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build": "
|
|
19
|
+
"build": "umi-scripts father build",
|
|
20
20
|
"build:deps": "umi-scripts bundleDeps",
|
|
21
|
-
"dev": "
|
|
21
|
+
"dev": "umi-scripts father dev",
|
|
22
22
|
"test": "umi-scripts jest-turbo"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@ahooksjs/use-request": "^2.0.0",
|
|
26
26
|
"@ant-design/icons": "^4.7.0",
|
|
27
|
-
"@ant-design/pro-layout": "^7.0.1-beta.
|
|
28
|
-
"@umijs/bundler-utils": "4.0.
|
|
27
|
+
"@ant-design/pro-layout": "^7.0.1-beta.28",
|
|
28
|
+
"@umijs/bundler-utils": "4.0.10",
|
|
29
29
|
"antd-dayjs-webpack-plugin": "^1.0.6",
|
|
30
30
|
"axios": "^0.27.2",
|
|
31
31
|
"babel-plugin-import": "^1.13.5",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"warning": "^4.0.3"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"umi": "4.0.
|
|
47
|
+
"umi": "4.0.10"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|