@umijs/plugins 4.0.0-beta.8 → 4.0.0-canary-20240513.3
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/LICENSE +21 -0
- package/README.md +4 -1
- package/dist/access.d.ts +1 -1
- package/dist/access.js +194 -4
- package/dist/{sass.d.ts → analytics.d.ts} +1 -1
- package/dist/analytics.js +118 -0
- package/dist/antd.d.ts +1 -1
- package/dist/antd.js +345 -157
- package/dist/{icons.d.ts → confetti.d.ts} +1 -1
- package/dist/confetti.js +64 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +30 -0
- package/dist/dva.d.ts +4 -1
- package/dist/dva.js +302 -8
- package/dist/initial-state.d.ts +1 -1
- package/dist/initial-state.js +147 -4
- package/dist/layout.d.ts +1 -1
- package/dist/layout.js +754 -4
- package/dist/locale.d.ts +2 -1
- package/dist/locale.js +257 -4
- package/dist/mf.d.ts +2 -0
- package/dist/mf.js +358 -0
- package/dist/model.d.ts +1 -1
- package/dist/model.js +109 -4
- package/dist/moment2dayjs.d.ts +3 -0
- package/dist/moment2dayjs.js +125 -0
- package/dist/qiankun/constants.d.ts +5 -0
- package/dist/qiankun/constants.js +41 -0
- package/dist/qiankun/master.d.ts +6 -0
- package/dist/qiankun/master.js +236 -0
- package/dist/qiankun/slave.d.ts +3 -0
- package/dist/qiankun/slave.js +345 -0
- package/dist/qiankun.d.ts +1 -1
- package/dist/qiankun.js +51 -4
- package/dist/react-query.d.ts +3 -0
- package/dist/react-query.js +193 -0
- package/dist/request.d.ts +1 -1
- package/dist/request.js +384 -4
- package/dist/styled-components.d.ts +3 -0
- package/dist/styled-components.js +150 -0
- package/dist/tailwindcss.d.ts +3 -0
- package/dist/tailwindcss.js +106 -0
- package/dist/unocss.d.ts +3 -0
- package/dist/unocss.js +71 -0
- package/dist/utils/astUtils.d.ts +3 -0
- package/dist/utils/astUtils.js +49 -0
- package/dist/utils/localeUtils.d.ts +33 -0
- package/dist/utils/localeUtils.js +139 -0
- package/dist/utils/mfUtils.d.ts +14 -0
- package/dist/utils/mfUtils.js +56 -0
- package/dist/utils/modelUtils.d.ts +40 -0
- package/dist/utils/modelUtils.js +286 -0
- package/dist/utils/resolveProjectDep.d.ts +5 -0
- package/dist/utils/resolveProjectDep.js +40 -0
- package/dist/utils/withTmpPath.d.ts +6 -0
- package/dist/utils/withTmpPath.js +39 -0
- package/dist/valtio.d.ts +3 -0
- package/dist/valtio.js +81 -0
- package/libs/dva.tsx +45 -0
- package/libs/model.tsx +180 -0
- package/libs/qiankun/master/AntdErrorBoundary.tsx +34 -0
- package/libs/qiankun/master/AntdLoader.tsx +15 -0
- package/libs/qiankun/master/ErrorBoundary.tsx +7 -0
- package/libs/qiankun/master/MicroApp.tsx +327 -0
- package/libs/qiankun/master/MicroAppWithMemoHistory.tsx +43 -0
- package/libs/qiankun/master/common.ts +172 -0
- package/libs/qiankun/master/constants.ts +19 -0
- package/libs/qiankun/master/getMicroAppRouteComponent.tsx.tpl +45 -0
- package/libs/qiankun/master/masterRuntimePlugin.tsx +161 -0
- package/libs/qiankun/master/routeUtils.ts +26 -0
- package/libs/qiankun/master/types.ts +54 -0
- package/libs/qiankun/slave/MicroAppLink.tsx +122 -0
- package/libs/qiankun/slave/connectMaster.tsx +14 -0
- package/libs/qiankun/slave/constants.ts +5 -0
- package/libs/qiankun/slave/lifecycles.ts +164 -0
- package/libs/qiankun/slave/qiankunModel.ts +18 -0
- package/libs/qiankun/slave/slaveRuntimePlugin.ts +36 -0
- package/package.json +54 -24
- package/templates/antd/runtime.ts.tpl +170 -0
- package/templates/antd/types.d.ts.tpl +17 -0
- package/templates/locale/SelectLang.tpl +502 -0
- package/templates/locale/locale.tpl +82 -0
- package/templates/locale/localeExports.tpl +307 -0
- package/templates/locale/runtime.tpl +34 -0
- package/templates/mf/runtime.ts.tpl +149 -0
- package/dist/access.d.ts.map +0 -1
- package/dist/antd.d.ts.map +0 -1
- package/dist/dva.d.ts.map +0 -1
- package/dist/icons.d.ts.map +0 -1
- package/dist/icons.js +0 -5
- package/dist/initial-state.d.ts.map +0 -1
- package/dist/layout.d.ts.map +0 -1
- package/dist/locale.d.ts.map +0 -1
- package/dist/model.d.ts.map +0 -1
- package/dist/qiankun.d.ts.map +0 -1
- package/dist/request.d.ts.map +0 -1
- package/dist/sass.d.ts.map +0 -1
- package/dist/sass.js +0 -5
package/package.json
CHANGED
|
@@ -1,37 +1,67 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugins",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-canary-20240513.3",
|
|
4
4
|
"description": "@umijs/plugins",
|
|
5
|
+
"homepage": "https://github.com/umijs/umi/tree/master/packages/plugins#readme",
|
|
6
|
+
"bugs": "https://github.com/umijs/umi/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/umijs/umi"
|
|
10
|
+
},
|
|
11
|
+
"license": "MIT",
|
|
5
12
|
"main": "dist/index.js",
|
|
6
13
|
"types": "dist/index.d.ts",
|
|
7
14
|
"files": [
|
|
8
|
-
"dist"
|
|
15
|
+
"dist",
|
|
16
|
+
"libs",
|
|
17
|
+
"templates"
|
|
9
18
|
],
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@ahooksjs/use-request": "^2.0.0",
|
|
21
|
+
"@ant-design/antd-theme-variable": "^1.0.0",
|
|
22
|
+
"@ant-design/cssinjs": "^1.9.1",
|
|
23
|
+
"@ant-design/icons": "^4.7.0",
|
|
24
|
+
"@ant-design/moment-webpack-plugin": "^0.0.3",
|
|
25
|
+
"@ant-design/pro-components": "^2.0.1",
|
|
26
|
+
"@tanstack/react-query": "^4.24.10",
|
|
27
|
+
"@tanstack/react-query-devtools": "^4.24.10",
|
|
28
|
+
"antd-dayjs-webpack-plugin": "^1.0.6",
|
|
29
|
+
"axios": "^0.27.2",
|
|
30
|
+
"babel-plugin-import": "^1.13.8",
|
|
31
|
+
"babel-plugin-styled-components": "2.1.4",
|
|
32
|
+
"dayjs": "^1.11.7",
|
|
33
|
+
"dva-core": "^2.0.4",
|
|
34
|
+
"dva-immer": "^1.0.0",
|
|
35
|
+
"dva-loading": "^3.0.22",
|
|
36
|
+
"event-emitter": "~0.3.5",
|
|
37
|
+
"fast-deep-equal": "3.1.3",
|
|
38
|
+
"intl": "1.2.5",
|
|
39
|
+
"lodash": "^4.17.21",
|
|
40
|
+
"moment": "^2.29.4",
|
|
41
|
+
"qiankun": "^2.10.1",
|
|
42
|
+
"react-intl": "3.12.1",
|
|
43
|
+
"react-redux": "^8.0.5",
|
|
44
|
+
"redux": "^4.2.1",
|
|
45
|
+
"styled-components": "6.1.1",
|
|
46
|
+
"tslib": "^2",
|
|
47
|
+
"warning": "^4.0.3",
|
|
48
|
+
"@umijs/bundler-utils": "4.0.0-canary-20240513.3",
|
|
49
|
+
"@umijs/valtio": "1.0.4"
|
|
14
50
|
},
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"antd": "^4.24.1",
|
|
53
|
+
"umi": "4.0.0-canary-20240513.3"
|
|
18
54
|
},
|
|
19
|
-
"authors": [
|
|
20
|
-
"chencheng <sorrycc@gmail.com> (https://github.com/sorrycc)"
|
|
21
|
-
],
|
|
22
|
-
"license": "MIT",
|
|
23
|
-
"bugs": "https://github.com/umijs/umi-next/issues",
|
|
24
|
-
"homepage": "https://github.com/umijs/umi-next/tree/master/packages/plugins#readme",
|
|
25
55
|
"publishConfig": {
|
|
26
56
|
"access": "public"
|
|
27
57
|
},
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
58
|
+
"authors": [
|
|
59
|
+
"chencheng <sorrycc@gmail.com> (https://github.com/sorrycc)"
|
|
60
|
+
],
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "umi-scripts father build",
|
|
63
|
+
"build:deps": "umi-scripts bundleDeps",
|
|
64
|
+
"dev": "umi-scripts father dev",
|
|
65
|
+
"test": "umi-scripts jest-turbo"
|
|
36
66
|
}
|
|
37
|
-
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
ConfigProvider,
|
|
4
|
+
{{#appConfig}}
|
|
5
|
+
App,
|
|
6
|
+
{{/appConfig}}
|
|
7
|
+
{{^disableInternalStatic}}
|
|
8
|
+
Modal,
|
|
9
|
+
message,
|
|
10
|
+
notification,
|
|
11
|
+
{{/disableInternalStatic}}
|
|
12
|
+
{{#enableV5ThemeAlgorithm}}
|
|
13
|
+
theme,
|
|
14
|
+
{{/enableV5ThemeAlgorithm}}
|
|
15
|
+
} from 'antd';
|
|
16
|
+
import { ApplyPluginsType } from 'umi';
|
|
17
|
+
{{#styleProvider}}
|
|
18
|
+
import {
|
|
19
|
+
StyleProvider,
|
|
20
|
+
{{#styleProvider.legacyTransformer}}
|
|
21
|
+
legacyLogicalPropertiesTransformer
|
|
22
|
+
{{/styleProvider.legacyTransformer}}
|
|
23
|
+
} from '{{{styleProvider.cssinjs}}}';
|
|
24
|
+
{{/styleProvider}}
|
|
25
|
+
import { getPluginManager } from '../core/plugin';
|
|
26
|
+
{{#antdConfigSetter}}
|
|
27
|
+
import { AntdConfigContext, AntdConfigContextSetter } from './context';
|
|
28
|
+
import merge from '{{{lodashPath.merge}}}'
|
|
29
|
+
{{/antdConfigSetter}}
|
|
30
|
+
|
|
31
|
+
let cacheAntdConfig = null;
|
|
32
|
+
|
|
33
|
+
const getAntdConfig = () => {
|
|
34
|
+
if(!cacheAntdConfig){
|
|
35
|
+
cacheAntdConfig = getPluginManager().applyPlugins({
|
|
36
|
+
key: 'antd',
|
|
37
|
+
type: ApplyPluginsType.modify,
|
|
38
|
+
initialValue: {
|
|
39
|
+
{{#configProvider}}
|
|
40
|
+
...{{{configProvider}}},
|
|
41
|
+
{{/configProvider}}
|
|
42
|
+
{{#appConfig}}
|
|
43
|
+
appConfig: {{{appConfig}}},
|
|
44
|
+
{{/appConfig}}
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return cacheAntdConfig;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function AntdProvider({ children }) {
|
|
52
|
+
let container = children;
|
|
53
|
+
|
|
54
|
+
const [antdConfig, _setAntdConfig] = React.useState(() => {
|
|
55
|
+
const {
|
|
56
|
+
appConfig: _,
|
|
57
|
+
...finalConfigProvider
|
|
58
|
+
} = getAntdConfig();
|
|
59
|
+
{{#enableV5ThemeAlgorithm}}
|
|
60
|
+
finalConfigProvider.theme ??= {};
|
|
61
|
+
finalConfigProvider.theme.algorithm ??= [];
|
|
62
|
+
if (!Array.isArray(finalConfigProvider.theme.algorithm)) {
|
|
63
|
+
finalConfigProvider.theme.algorithm = [finalConfigProvider.theme.algorithm];
|
|
64
|
+
}
|
|
65
|
+
const algorithm = finalConfigProvider.theme.algorithm;
|
|
66
|
+
{{#enableV5ThemeAlgorithm.compact}}
|
|
67
|
+
if (!algorithm.includes(theme.compactAlgorithm)) {
|
|
68
|
+
algorithm.push(theme.compactAlgorithm);
|
|
69
|
+
}
|
|
70
|
+
{{/enableV5ThemeAlgorithm.compact}}
|
|
71
|
+
{{#enableV5ThemeAlgorithm.dark}}
|
|
72
|
+
if (!algorithm.includes(theme.darkAlgorithm)) {
|
|
73
|
+
algorithm.push(theme.darkAlgorithm);
|
|
74
|
+
}
|
|
75
|
+
{{/enableV5ThemeAlgorithm.dark}}
|
|
76
|
+
{{/enableV5ThemeAlgorithm}}
|
|
77
|
+
return finalConfigProvider
|
|
78
|
+
});
|
|
79
|
+
const setAntdConfig: typeof _setAntdConfig = (newConfig) => {
|
|
80
|
+
_setAntdConfig(prev => {
|
|
81
|
+
return merge({}, prev, typeof newConfig === 'function' ? newConfig(prev) : newConfig)
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
{{#configProvider}}
|
|
86
|
+
{{^disableInternalStatic}}
|
|
87
|
+
if (antdConfig.prefixCls) {
|
|
88
|
+
Modal.config({
|
|
89
|
+
rootPrefixCls: antdConfig.prefixCls
|
|
90
|
+
});
|
|
91
|
+
message.config({
|
|
92
|
+
prefixCls: `${antdConfig.prefixCls}-message`
|
|
93
|
+
});
|
|
94
|
+
notification.config({
|
|
95
|
+
prefixCls: `${antdConfig.prefixCls}-notification`
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
{{/disableInternalStatic}}
|
|
99
|
+
|
|
100
|
+
{{#disableInternalStatic}}
|
|
101
|
+
if (antdConfig.prefixCls) {
|
|
102
|
+
ConfigProvider.config({
|
|
103
|
+
prefixCls: antdConfig.prefixCls,
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
{{/disableInternalStatic}}
|
|
107
|
+
|
|
108
|
+
if (antdConfig.iconPrefixCls) {
|
|
109
|
+
// Icons in message need to set iconPrefixCls via ConfigProvider.config()
|
|
110
|
+
ConfigProvider.config({
|
|
111
|
+
iconPrefixCls: antdConfig.iconPrefixCls,
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
if (antdConfig.theme) {
|
|
116
|
+
// Pass config theme to static method
|
|
117
|
+
ConfigProvider.config({
|
|
118
|
+
theme: antdConfig.theme,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
container = <ConfigProvider {...antdConfig}>{container}</ConfigProvider>;
|
|
123
|
+
{{/configProvider}}
|
|
124
|
+
|
|
125
|
+
{{#styleProvider}}
|
|
126
|
+
container = (
|
|
127
|
+
<StyleProvider
|
|
128
|
+
{{#styleProvider.hashPriority}}
|
|
129
|
+
hashPriority="{{{styleProvider.hashPriority}}}"
|
|
130
|
+
{{/styleProvider.hashPriority}}
|
|
131
|
+
{{#styleProvider.legacyTransformer}}
|
|
132
|
+
transformers={[legacyLogicalPropertiesTransformer]}
|
|
133
|
+
{{/styleProvider.legacyTransformer}}
|
|
134
|
+
>
|
|
135
|
+
{container}
|
|
136
|
+
</StyleProvider>
|
|
137
|
+
);
|
|
138
|
+
{{/styleProvider}}
|
|
139
|
+
|
|
140
|
+
{{#antdConfigSetter}}
|
|
141
|
+
container = (
|
|
142
|
+
<AntdConfigContextSetter.Provider value={setAntdConfig}>
|
|
143
|
+
<AntdConfigContext.Provider value={antdConfig}>
|
|
144
|
+
{container}
|
|
145
|
+
</AntdConfigContext.Provider>
|
|
146
|
+
</AntdConfigContextSetter.Provider>
|
|
147
|
+
)
|
|
148
|
+
{{/antdConfigSetter}}
|
|
149
|
+
|
|
150
|
+
return container;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function rootContainer(children) {
|
|
154
|
+
return (
|
|
155
|
+
<AntdProvider>
|
|
156
|
+
{children}
|
|
157
|
+
</AntdProvider>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
{{#appConfig}}
|
|
162
|
+
// The App component should be under ConfigProvider
|
|
163
|
+
// plugin-locale has other ConfigProvider
|
|
164
|
+
export function innerProvider(container: any) {
|
|
165
|
+
const {
|
|
166
|
+
appConfig: finalAppConfig = {},
|
|
167
|
+
} = getAntdConfig();
|
|
168
|
+
return <App {...finalAppConfig}>{container}</App>;
|
|
169
|
+
}
|
|
170
|
+
{{/appConfig}}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{{#withConfigProvider}}
|
|
2
|
+
import type { ConfigProviderProps } from 'antd/es/config-provider';
|
|
3
|
+
{{/withConfigProvider}}
|
|
4
|
+
{{#withAppConfig}}
|
|
5
|
+
import type { AppConfig } from 'antd/es/app/context';
|
|
6
|
+
{{/withAppConfig}}
|
|
7
|
+
|
|
8
|
+
type Prettify<T> = {
|
|
9
|
+
[K in keyof T]: T[K];
|
|
10
|
+
} & {};
|
|
11
|
+
|
|
12
|
+
type AntdConfig = Prettify<{}
|
|
13
|
+
{{#withConfigProvider}} & ConfigProviderProps{{/withConfigProvider}}
|
|
14
|
+
{{#withAppConfig}} & { appConfig: AppConfig }{{/withAppConfig}}
|
|
15
|
+
>;
|
|
16
|
+
|
|
17
|
+
export type RuntimeAntdConfig = (memo: AntdConfig) => AntdConfig;
|