@umijs/plugins 4.0.79 → 4.0.81
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
|
@@ -141,6 +141,10 @@ var antd_default = (api) => {
|
|
|
141
141
|
antd.configProvider.theme || {},
|
|
142
142
|
antd.theme
|
|
143
143
|
);
|
|
144
|
+
(0, import_assert.default)(
|
|
145
|
+
!antd.configProvider.theme.algorithm,
|
|
146
|
+
`The 'algorithm' option only available for runtime config, please move it to the runtime plugin, see: https://umijs.org/docs/max/antd#运行时配置`
|
|
147
|
+
);
|
|
144
148
|
}
|
|
145
149
|
if (antd.appConfig) {
|
|
146
150
|
if (!appComponentAvailable) {
|
package/dist/qiankun/master.js
CHANGED
|
@@ -48,14 +48,14 @@ function isMasterEnable(opts) {
|
|
|
48
48
|
}
|
|
49
49
|
return !!process.env.INITIAL_QIANKUN_MASTER_OPTIONS;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function getDefaultMicroAppProps(api, key) {
|
|
52
52
|
var _a, _b, _c;
|
|
53
|
-
const
|
|
53
|
+
const microAppProps = (_b = (_a = api.config.qiankun) == null ? void 0 : _a.master) == null ? void 0 : _b[key];
|
|
54
54
|
(0, import_assert.default)(
|
|
55
|
-
!
|
|
56
|
-
|
|
55
|
+
!microAppProps || ((_c = microAppProps.startsWith) == null ? void 0 : _c.call(microAppProps, "@/")),
|
|
56
|
+
`[@umijs/plugin-qiankun]: ${key} only support src path, eg: @/${key}`
|
|
57
57
|
);
|
|
58
|
-
return
|
|
58
|
+
return microAppProps;
|
|
59
59
|
}
|
|
60
60
|
var master_default = (api) => {
|
|
61
61
|
api.describe({
|
|
@@ -144,14 +144,31 @@ export const setMasterOptions = (newOpts) => options = ({ ...options, ...newOpts
|
|
|
144
144
|
});
|
|
145
145
|
api.writeTmpFile({
|
|
146
146
|
path: "MicroAppLoader.tsx",
|
|
147
|
-
content:
|
|
148
|
-
// 用户自定义的 loading 优先级最高
|
|
149
|
-
`export { default } from '${getCustomLoader(api)}';`
|
|
150
|
-
) : api.isPluginEnable("antd") ? getFileContent("AntdLoader.tsx") : (
|
|
147
|
+
content: api.isPluginEnable("antd") ? getFileContent("AntdLoader.tsx") : (
|
|
151
148
|
// 开启了 antd 插件的时候,使用 antd 的 loader 组件,否则提示用户必须设置一个自定义的 loader 组件
|
|
152
149
|
`export default function Loader() { console.warn(\`[plugins/qiankun]: Seems like you'r not using @umijs/plugin-antd, you need to provide a custom loader or set autoSetLoading false to shut down this warning!\`); return null; }`
|
|
153
150
|
)
|
|
154
151
|
});
|
|
152
|
+
api.writeTmpFile({
|
|
153
|
+
path: "defaultErrorBoundary.tsx",
|
|
154
|
+
content: getDefaultMicroAppProps(api, "defaultErrorBoundary") ? `export { default } from '${getDefaultMicroAppProps(
|
|
155
|
+
api,
|
|
156
|
+
"defaultErrorBoundary"
|
|
157
|
+
)}';` : (
|
|
158
|
+
// 返回 null
|
|
159
|
+
`export default null;`
|
|
160
|
+
)
|
|
161
|
+
});
|
|
162
|
+
api.writeTmpFile({
|
|
163
|
+
path: "defaultLoader.tsx",
|
|
164
|
+
content: getDefaultMicroAppProps(api, "defaultLoader") ? `export { default } from '${getDefaultMicroAppProps(
|
|
165
|
+
api,
|
|
166
|
+
"defaultLoader"
|
|
167
|
+
)}';` : (
|
|
168
|
+
// 返回 null
|
|
169
|
+
`export default null;`
|
|
170
|
+
)
|
|
171
|
+
});
|
|
155
172
|
[
|
|
156
173
|
"common.ts",
|
|
157
174
|
"constants.ts",
|
package/dist/qiankun/slave.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
__USE_MODEL__;
|
|
4
4
|
import concat from 'lodash/concat';
|
|
5
|
-
import mergeWith from 'lodash/mergeWith';
|
|
6
5
|
import isEqual from 'lodash/isEqual';
|
|
6
|
+
import mergeWith from 'lodash/mergeWith';
|
|
7
7
|
import noop from 'lodash/noop';
|
|
8
8
|
import {
|
|
9
9
|
FrameworkConfiguration,
|
|
@@ -20,6 +20,8 @@ import React, {
|
|
|
20
20
|
useState,
|
|
21
21
|
} from 'react';
|
|
22
22
|
import { qiankunStateForSlaveModelNamespace } from './constants';
|
|
23
|
+
import defaultErrorBoundary from './defaultErrorBoundary';
|
|
24
|
+
import defaultLoader from './defaultLoader';
|
|
23
25
|
import { ErrorBoundary } from './ErrorBoundary';
|
|
24
26
|
import { getMasterOptions } from './masterOptions';
|
|
25
27
|
import MicroAppLoader from './MicroAppLoader';
|
|
@@ -117,6 +119,7 @@ export const MicroApp = forwardRef(
|
|
|
117
119
|
// 未配置自定义 errorBoundary 且开启了 autoCaptureError 场景下,使用插件默认的 errorBoundary,否则使用自定义 errorBoundary
|
|
118
120
|
const microAppErrorBoundary =
|
|
119
121
|
errorBoundary ||
|
|
122
|
+
defaultErrorBoundary ||
|
|
120
123
|
(propsFromParams.autoCaptureError
|
|
121
124
|
? (e) => <ErrorBoundary error={e} />
|
|
122
125
|
: null);
|
|
@@ -144,8 +147,12 @@ export const MicroApp = forwardRef(
|
|
|
144
147
|
if (!appConfig) {
|
|
145
148
|
setComponentError(
|
|
146
149
|
new Error(
|
|
147
|
-
`[@umijs/plugin-qiankun]: Can not find the configuration of ${name} app! Currently, only the following apps are configured:\n${JSON.stringify(
|
|
148
|
-
|
|
150
|
+
`[@umijs/plugin-qiankun]: Can not find the configuration of ${name} app! Currently, only the following apps are configured:\n${JSON.stringify(
|
|
151
|
+
apps,
|
|
152
|
+
null,
|
|
153
|
+
2,
|
|
154
|
+
)}`,
|
|
155
|
+
),
|
|
149
156
|
);
|
|
150
157
|
}
|
|
151
158
|
return noop;
|
|
@@ -155,7 +162,10 @@ export const MicroApp = forwardRef(
|
|
|
155
162
|
const stateForSlave = (useModel || noop)(
|
|
156
163
|
qiankunStateForSlaveModelNamespace,
|
|
157
164
|
);
|
|
158
|
-
const {
|
|
165
|
+
const {
|
|
166
|
+
entry,
|
|
167
|
+
props: { settings: settingsFromConfig = {}, ...propsFromConfig } = {},
|
|
168
|
+
} = appConfig || {};
|
|
159
169
|
|
|
160
170
|
useEffect(() => {
|
|
161
171
|
setComponentError(null);
|
|
@@ -245,7 +255,9 @@ export const MicroApp = forwardRef(
|
|
|
245
255
|
// 确保 microApp.update 调用是跟组件状态变更顺序一致的,且后一个微应用更新必须等待前一个更新完成
|
|
246
256
|
microApp._updatingPromise = microApp._updatingPromise.then(() => {
|
|
247
257
|
const canUpdate = (microApp?: MicroAppType) =>
|
|
248
|
-
microApp?.update &&
|
|
258
|
+
microApp?.update &&
|
|
259
|
+
microApp.getStatus() === 'MOUNTED' &&
|
|
260
|
+
!microApp._unmounting;
|
|
249
261
|
if (canUpdate(microApp)) {
|
|
250
262
|
const props = {
|
|
251
263
|
...propsFromConfig,
|
|
@@ -285,6 +297,7 @@ export const MicroApp = forwardRef(
|
|
|
285
297
|
// 未配置自定义 loader 且开启了 autoSetLoading 场景下,使用插件默认的 loader,否则使用自定义 loader
|
|
286
298
|
const microAppLoader =
|
|
287
299
|
loader ||
|
|
300
|
+
defaultLoader ||
|
|
288
301
|
(propsFromParams.autoSetLoading
|
|
289
302
|
? (loading) => <MicroAppLoader loading={loading} />
|
|
290
303
|
: null);
|
|
@@ -24,7 +24,6 @@ export type MicroAppRoute = {
|
|
|
24
24
|
|
|
25
25
|
export type MasterOptions = {
|
|
26
26
|
enable?: boolean;
|
|
27
|
-
loader?: string;
|
|
28
27
|
apps?: App[];
|
|
29
28
|
routes?: MicroAppRoute[];
|
|
30
29
|
lifeCycles?: FrameworkLifeCycles<object>;
|
|
@@ -38,6 +37,10 @@ export type MasterOptions = {
|
|
|
38
37
|
appNameKeyAlias?: string;
|
|
39
38
|
// 预加载应用阈值
|
|
40
39
|
prefetchThreshold?: number;
|
|
40
|
+
// 子应用默认的错误捕获组件,值为文件路径
|
|
41
|
+
defaultErrorBoundary?: string;
|
|
42
|
+
// 子应用默认的加载动画,值为文件路径
|
|
43
|
+
defaultLoader?: string;
|
|
41
44
|
} & FrameworkConfiguration;
|
|
42
45
|
|
|
43
46
|
export type SlaveOptions = {
|
|
@@ -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,
|
|
4
|
+
import { ApplyPluginsType, history, __getRoot } from 'umi';
|
|
5
5
|
import { setModelState } from './qiankunModel';
|
|
6
6
|
|
|
7
7
|
const noop = () => {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugins",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.81",
|
|
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",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"styled-components": "6.0.0-rc.0",
|
|
45
45
|
"tslib": "^2",
|
|
46
46
|
"warning": "^4.0.3",
|
|
47
|
-
"@umijs/bundler-utils": "4.0.
|
|
47
|
+
"@umijs/bundler-utils": "4.0.81",
|
|
48
48
|
"@umijs/valtio": "1.0.3"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"antd": "^4.24.1",
|
|
52
|
-
"umi": "4.0.
|
|
52
|
+
"umi": "4.0.81"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|