@umijs/plugins 4.0.78 → 4.0.80
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 +2 -4
- package/dist/layout.js +7 -6
- package/dist/qiankun/master.js +26 -9
- package/dist/tailwindcss.js +0 -2
- package/libs/qiankun/master/MicroApp.tsx +18 -5
- package/libs/qiankun/master/types.ts +4 -1
- package/libs/qiankun/slave/lifecycles.ts +1 -1
- package/package.json +3 -3
- package/templates/antd/runtime.ts.tpl +1 -1
package/dist/antd.js
CHANGED
|
@@ -202,7 +202,7 @@ var antd_default = (api) => {
|
|
|
202
202
|
}) || (0, import_path.dirname)(require.resolve("@ant-design/cssinjs/package.json"));
|
|
203
203
|
if (cssinjs) {
|
|
204
204
|
styleProviderConfig = {
|
|
205
|
-
cssinjs
|
|
205
|
+
cssinjs: (0, import_plugin_utils.winPath)(cssinjs)
|
|
206
206
|
};
|
|
207
207
|
if (ieTarget) {
|
|
208
208
|
styleProviderConfig.hashPriority = "high";
|
|
@@ -264,7 +264,7 @@ export type IRuntimeConfig = {
|
|
|
264
264
|
});
|
|
265
265
|
});
|
|
266
266
|
api.addRuntimePlugin(() => {
|
|
267
|
-
if (api.config.antd.configProvider || appComponentAvailable && api.config.antd.appConfig) {
|
|
267
|
+
if (api.config.antd.styleProvider || api.config.antd.configProvider || appComponentAvailable && api.config.antd.appConfig) {
|
|
268
268
|
return [(0, import_withTmpPath.withTmpPath)({ api, path: "runtime.tsx" })];
|
|
269
269
|
}
|
|
270
270
|
return [];
|
|
@@ -282,5 +282,3 @@ export type IRuntimeConfig = {
|
|
|
282
282
|
return imports;
|
|
283
283
|
});
|
|
284
284
|
};
|
|
285
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
286
|
-
0 && (module.exports = {});
|
package/dist/layout.js
CHANGED
|
@@ -116,11 +116,14 @@ var layout_default = (api) => {
|
|
|
116
116
|
}
|
|
117
117
|
return memo;
|
|
118
118
|
});
|
|
119
|
-
const isFlattedDepsDir = [import_plugin_utils.NpmClientEnum.npm, import_plugin_utils.NpmClientEnum.yarn].includes(
|
|
120
|
-
api.appData.npmClient
|
|
121
|
-
);
|
|
122
119
|
api.onGenerateFiles(() => {
|
|
123
|
-
const
|
|
120
|
+
const isFlattedDepsDir = [import_plugin_utils.NpmClientEnum.npm, import_plugin_utils.NpmClientEnum.yarn].includes(
|
|
121
|
+
api.appData.npmClient
|
|
122
|
+
);
|
|
123
|
+
const PKG_TYPE_REFERENCE = `
|
|
124
|
+
/// <reference types="${isFlattedDepsDir ? ANT_PRO_COMPONENT : resolvedPkgPath}" />
|
|
125
|
+
${isFlattedDepsDir ? '/// <reference types="antd" />' : ""}
|
|
126
|
+
`.trimStart();
|
|
124
127
|
const hasInitialStatePlugin = api.config.initialState;
|
|
125
128
|
api.writeTmpFile({
|
|
126
129
|
path: "Layout.tsx",
|
|
@@ -726,5 +729,3 @@ export default Exception;
|
|
|
726
729
|
return [(0, import_withTmpPath.withTmpPath)({ api, path: "runtime.tsx" })];
|
|
727
730
|
});
|
|
728
731
|
};
|
|
729
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
730
|
-
0 && (module.exports = {});
|
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/tailwindcss.js
CHANGED
|
@@ -104,5 +104,3 @@ function getTailwindBinPath(opts) {
|
|
|
104
104
|
const tailwindPath = require(pkgPath).bin["tailwind"];
|
|
105
105
|
return (0, import_path.join)((0, import_path.dirname)(pkgPath), tailwindPath);
|
|
106
106
|
}
|
|
107
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
108
|
-
0 && (module.exports = {});
|
|
@@ -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.80",
|
|
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.80",
|
|
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.80"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
@@ -103,7 +103,7 @@ export function rootContainer(rawContainer) {
|
|
|
103
103
|
container = (
|
|
104
104
|
<StyleProvider
|
|
105
105
|
{{#styleProvider.hashPriority}}
|
|
106
|
-
hashPriority="{{{
|
|
106
|
+
hashPriority="{{{styleProvider.hashPriority}}}"
|
|
107
107
|
{{/styleProvider.hashPriority}}
|
|
108
108
|
{{#styleProvider.legacyTransformer}}
|
|
109
109
|
transformers={[legacyLogicalPropertiesTransformer]}
|