@umijs/plugins 4.0.8 → 4.0.9
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 +2 -2
- package/dist/analytics.js +2 -2
- package/dist/antd.js +4 -4
- package/dist/dva.js +2 -2
- package/dist/initial-state.js +2 -2
- package/dist/layout.js +4 -4
- package/dist/locale.js +9 -9
- package/dist/model.js +2 -2
- package/dist/moment2dayjs.js +5 -5
- package/dist/qiankun.js +6 -6
- package/dist/request.js +7 -7
- package/dist/tailwindcss.js +1 -1
- package/dist/unocss.js +2 -2
- package/libs/locale/localeExports.tpl +4 -3
- package/libs/qiankun/master/MicroApp.tsx +8 -2
- package/libs/qiankun/slave/lifecycles.ts +14 -6
- package/package.json +6 -6
package/dist/access.js
CHANGED
|
@@ -31,8 +31,8 @@ var import_withTmpPath = require("./utils/withTmpPath");
|
|
|
31
31
|
var access_default = (api) => {
|
|
32
32
|
api.describe({
|
|
33
33
|
config: {
|
|
34
|
-
schema(
|
|
35
|
-
return
|
|
34
|
+
schema(Joi) {
|
|
35
|
+
return Joi.alternatives().try(Joi.object(), Joi.boolean().invalid(true));
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
enableBy: api.EnableBy.config
|
package/dist/analytics.js
CHANGED
|
@@ -30,8 +30,8 @@ var analytics_default = (api) => {
|
|
|
30
30
|
api.describe({
|
|
31
31
|
key: "analytics",
|
|
32
32
|
config: {
|
|
33
|
-
schema(
|
|
34
|
-
return
|
|
33
|
+
schema(Joi) {
|
|
34
|
+
return Joi.alternatives().try(Joi.object(), Joi.boolean().invalid(true));
|
|
35
35
|
},
|
|
36
36
|
onChange: api.ConfigChangeType.reload
|
|
37
37
|
},
|
package/dist/antd.js
CHANGED
|
@@ -56,13 +56,13 @@ var antd_default = (api) => {
|
|
|
56
56
|
api.describe({
|
|
57
57
|
config: {
|
|
58
58
|
schema(Joi) {
|
|
59
|
-
return Joi.object({
|
|
59
|
+
return Joi.alternatives().try(Joi.object({
|
|
60
60
|
configProvider: Joi.object(),
|
|
61
61
|
dark: Joi.boolean(),
|
|
62
62
|
compact: Joi.boolean(),
|
|
63
63
|
import: Joi.boolean(),
|
|
64
64
|
style: Joi.string().allow("less", "css")
|
|
65
|
-
});
|
|
65
|
+
}), Joi.boolean().invalid(true));
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
68
|
enableBy({ userConfig }) {
|
|
@@ -85,10 +85,10 @@ var antd_default = (api) => {
|
|
|
85
85
|
});
|
|
86
86
|
api.modifyConfig((memo) => {
|
|
87
87
|
checkPkgPath();
|
|
88
|
-
|
|
88
|
+
let antd = memo.antd || {};
|
|
89
89
|
if (process.env.UMI_PLUGIN_ANTD_ENABLE) {
|
|
90
90
|
const { defaultConfig } = JSON.parse(process.env.UMI_PLUGIN_ANTD_ENABLE);
|
|
91
|
-
Object.assign(
|
|
91
|
+
antd = Object.assign(defaultConfig, antd);
|
|
92
92
|
}
|
|
93
93
|
memo.alias.antd = pkgPath;
|
|
94
94
|
if (antd.dayjs) {
|
package/dist/dva.js
CHANGED
|
@@ -38,10 +38,10 @@ var dva_default = (api) => {
|
|
|
38
38
|
api.describe({
|
|
39
39
|
config: {
|
|
40
40
|
schema(Joi) {
|
|
41
|
-
return Joi.object({
|
|
41
|
+
return Joi.alternatives().try(Joi.object({
|
|
42
42
|
extraModels: Joi.array().items(Joi.string()),
|
|
43
43
|
immer: Joi.object()
|
|
44
|
-
});
|
|
44
|
+
}), Joi.boolean().invalid(true));
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
enableBy: api.EnableBy.config
|
package/dist/initial-state.js
CHANGED
|
@@ -27,9 +27,9 @@ var initial_state_default = (api) => {
|
|
|
27
27
|
api.describe({
|
|
28
28
|
config: {
|
|
29
29
|
schema(Joi) {
|
|
30
|
-
return Joi.object({
|
|
30
|
+
return Joi.alternatives().try(Joi.object({
|
|
31
31
|
loading: Joi.string()
|
|
32
|
-
});
|
|
32
|
+
}), Joi.boolean().invalid(true));
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
enableBy: api.EnableBy.config
|
package/dist/layout.js
CHANGED
|
@@ -34,8 +34,8 @@ var layout_default = (api) => {
|
|
|
34
34
|
api.describe({
|
|
35
35
|
key: "layout",
|
|
36
36
|
config: {
|
|
37
|
-
schema(
|
|
38
|
-
return
|
|
37
|
+
schema(Joi) {
|
|
38
|
+
return Joi.alternatives().try(Joi.object(), Joi.boolean().invalid(true));
|
|
39
39
|
},
|
|
40
40
|
onChange: api.ConfigChangeType.regenerateTmpFiles
|
|
41
41
|
},
|
|
@@ -256,8 +256,8 @@ const { formatMessage } = useIntl();
|
|
|
256
256
|
initData: InitDataType,
|
|
257
257
|
) => ProLayoutProps & {
|
|
258
258
|
childrenRender?: (dom: JSX.Element, props: ProLayoutProps) => React.ReactNode,
|
|
259
|
-
|
|
260
|
-
|
|
259
|
+
noAccessible?: JSX.Element,
|
|
260
|
+
notFound?: JSX.Element,
|
|
261
261
|
};
|
|
262
262
|
`
|
|
263
263
|
});
|
package/dist/locale.js
CHANGED
|
@@ -65,15 +65,15 @@ var locale_default = (api) => {
|
|
|
65
65
|
api.describe({
|
|
66
66
|
key: "locale",
|
|
67
67
|
config: {
|
|
68
|
-
schema(
|
|
69
|
-
return
|
|
70
|
-
default:
|
|
71
|
-
useLocalStorage:
|
|
72
|
-
baseNavigator:
|
|
73
|
-
title:
|
|
74
|
-
antd:
|
|
75
|
-
baseSeparator:
|
|
76
|
-
});
|
|
68
|
+
schema(Joi) {
|
|
69
|
+
return Joi.alternatives().try(Joi.object({
|
|
70
|
+
default: Joi.string(),
|
|
71
|
+
useLocalStorage: Joi.boolean(),
|
|
72
|
+
baseNavigator: Joi.boolean(),
|
|
73
|
+
title: Joi.boolean(),
|
|
74
|
+
antd: Joi.boolean(),
|
|
75
|
+
baseSeparator: Joi.string()
|
|
76
|
+
}), Joi.boolean().invalid(true));
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
79
|
enableBy: api.EnableBy.config
|
package/dist/model.js
CHANGED
|
@@ -35,9 +35,9 @@ var model_default = (api) => {
|
|
|
35
35
|
api.describe({
|
|
36
36
|
config: {
|
|
37
37
|
schema(Joi) {
|
|
38
|
-
return Joi.object({
|
|
38
|
+
return Joi.alternatives().try(Joi.object({
|
|
39
39
|
extraModels: Joi.array().items(Joi.string())
|
|
40
|
-
});
|
|
40
|
+
}), Joi.boolean().invalid(true));
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
enableBy: api.EnableBy.config
|
package/dist/moment2dayjs.js
CHANGED
|
@@ -31,11 +31,11 @@ var moment2dayjs_default = (api) => {
|
|
|
31
31
|
api.describe({
|
|
32
32
|
key: "moment2dayjs",
|
|
33
33
|
config: {
|
|
34
|
-
schema(
|
|
35
|
-
return
|
|
36
|
-
preset:
|
|
37
|
-
plugins:
|
|
38
|
-
});
|
|
34
|
+
schema(Joi) {
|
|
35
|
+
return Joi.alternatives().try(Joi.object({
|
|
36
|
+
preset: Joi.string(),
|
|
37
|
+
plugins: Joi.array()
|
|
38
|
+
}), Joi.boolean().invalid(true));
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
enableBy: api.EnableBy.config
|
package/dist/qiankun.js
CHANGED
|
@@ -28,12 +28,12 @@ module.exports = __toCommonJS(qiankun_exports);
|
|
|
28
28
|
var qiankun_default = (api) => {
|
|
29
29
|
api.describe({
|
|
30
30
|
config: {
|
|
31
|
-
schema(
|
|
32
|
-
return
|
|
33
|
-
slave:
|
|
34
|
-
master:
|
|
35
|
-
externalQiankun:
|
|
36
|
-
});
|
|
31
|
+
schema(Joi) {
|
|
32
|
+
return Joi.alternatives().try(Joi.object().keys({
|
|
33
|
+
slave: Joi.object(),
|
|
34
|
+
master: Joi.object(),
|
|
35
|
+
externalQiankun: Joi.boolean()
|
|
36
|
+
}), Joi.boolean().invalid(true));
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
});
|
package/dist/request.js
CHANGED
|
@@ -31,10 +31,10 @@ var request_default = (api) => {
|
|
|
31
31
|
api.describe({
|
|
32
32
|
key: "request",
|
|
33
33
|
config: {
|
|
34
|
-
schema: (
|
|
35
|
-
return
|
|
36
|
-
dataField:
|
|
37
|
-
});
|
|
34
|
+
schema: (Joi) => {
|
|
35
|
+
return Joi.alternatives().try(Joi.object({
|
|
36
|
+
dataField: Joi.string().pattern(/^[a-zA-Z]*$/).allow("")
|
|
37
|
+
}), Joi.boolean().invalid(true));
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
enableBy: api.EnableBy.config
|
|
@@ -324,11 +324,11 @@ export type {
|
|
|
324
324
|
api.writeTmpFile({
|
|
325
325
|
path: "types.d.ts",
|
|
326
326
|
content: `
|
|
327
|
-
export type {
|
|
328
|
-
RequestConfig,
|
|
327
|
+
export type {
|
|
328
|
+
RequestConfig,
|
|
329
329
|
AxiosInstance,
|
|
330
330
|
AxiosRequestConfig,
|
|
331
|
-
AxiosResponse,
|
|
331
|
+
AxiosResponse,
|
|
332
332
|
AxiosError,
|
|
333
333
|
RequestError,
|
|
334
334
|
ResponseInterceptor } from './request';
|
package/dist/tailwindcss.js
CHANGED
package/dist/unocss.js
CHANGED
|
@@ -31,9 +31,9 @@ var unocss_default = (api) => {
|
|
|
31
31
|
key: "unocss",
|
|
32
32
|
config: {
|
|
33
33
|
schema(Joi) {
|
|
34
|
-
return Joi.object({
|
|
34
|
+
return Joi.alternatives().try(Joi.object({
|
|
35
35
|
watch: Joi.array()
|
|
36
|
-
});
|
|
36
|
+
}), Joi.boolean().invalid(true));
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
enableBy: api.EnableBy.config
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
IntlShape,
|
|
4
4
|
MessageDescriptor,
|
|
5
5
|
} from '{{{ reactIntlPkgPath }}}';
|
|
6
|
-
import { ApplyPluginsType } from 'umi';
|
|
7
6
|
import { getPluginManager } from '../core/plugin';
|
|
8
7
|
import EventEmitter from '{{{EventEmitterPkg}}}';
|
|
9
8
|
// @ts-ignore
|
|
@@ -153,7 +152,8 @@ export const setIntl = (locale: string) => {
|
|
|
153
152
|
export const getLocale = () => {
|
|
154
153
|
const runtimeLocale = getPluginManager().applyPlugins({
|
|
155
154
|
key: 'locale',
|
|
156
|
-
|
|
155
|
+
// workaround: 不使用 ApplyPluginsType.modify 是为了避免循环依赖,与 fast-refresh 一起用时会有问题
|
|
156
|
+
type: 'modify',
|
|
157
157
|
initialValue: {},
|
|
158
158
|
});
|
|
159
159
|
// runtime getLocale for user define
|
|
@@ -201,7 +201,8 @@ export const setLocale = (lang: string, realReload: boolean = true) => {
|
|
|
201
201
|
//const { pluginManager } = useAppContext();
|
|
202
202
|
//const runtimeLocale = pluginManagerapplyPlugins({
|
|
203
203
|
// key: 'locale',
|
|
204
|
-
//
|
|
204
|
+
// workaround: 不使用 ApplyPluginsType.modify 是为了避免循环依赖,与 fast-refresh 一起用时会有问题
|
|
205
|
+
// type: 'modify',
|
|
205
206
|
// initialValue: {},
|
|
206
207
|
//});
|
|
207
208
|
|
|
@@ -88,8 +88,14 @@ export const MicroApp = forwardRef(
|
|
|
88
88
|
...propsFromParams
|
|
89
89
|
} = componentProps;
|
|
90
90
|
|
|
91
|
-
//
|
|
92
|
-
|
|
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;
|
|
93
99
|
const isCurrentApp = (app: any) =>
|
|
94
100
|
app[appNameKeyAlias] === name || app.name === name;
|
|
95
101
|
|
|
@@ -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 = () => {};
|
|
@@ -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.9",
|
|
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.9",
|
|
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.9"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|