@umijs/plugins 4.0.0-rc.2 → 4.0.0-rc.20
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 +78 -16
- package/dist/antd.js +45 -12
- package/dist/dva.js +27 -2
- package/dist/initial-state.js +3 -3
- package/dist/layout.js +99 -28
- package/dist/locale.js +46 -50
- package/dist/model.js +21 -36
- package/dist/moment2dayjs.js +4 -4
- package/dist/qiankun/master.js +33 -12
- package/dist/qiankun/slave.js +67 -44
- package/dist/qiankun.js +1 -0
- package/dist/request.js +134 -127
- package/dist/tailwindcss.js +31 -29
- package/dist/unocss.js +15 -33
- package/dist/utils/astUtils.js +5 -1
- package/dist/utils/localeUtils.js +15 -24
- package/dist/utils/modelUtils.d.ts +5 -1
- package/dist/utils/modelUtils.js +93 -7
- package/dist/utils/withTmpPath.js +2 -2
- package/libs/locale/localeExports.tpl +6 -6
- package/libs/qiankun/master/MicroApp.tsx +7 -0
- package/libs/qiankun/master/common.ts +15 -10
- package/libs/qiankun/master/getMicroAppRouteComponent.tsx.tpl +5 -16
- package/libs/qiankun/master/masterRuntimePlugin.tsx +6 -5
- package/libs/qiankun/slave/connectMaster.tsx +0 -1
- package/libs/qiankun/slave/lifecycles.ts +14 -8
- package/libs/qiankun/slave/qiankunModel.ts +0 -1
- package/libs/qiankun/slave/slaveRuntimePlugin.ts +9 -15
- package/package.json +15 -13
package/dist/utils/modelUtils.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -25,13 +29,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
25
29
|
exports.ModelUtils = exports.Model = void 0;
|
|
26
30
|
const parser = __importStar(require("@umijs/bundler-utils/compiled/babel/parser"));
|
|
27
31
|
const traverse_1 = __importDefault(require("@umijs/bundler-utils/compiled/babel/traverse"));
|
|
32
|
+
const t = __importStar(require("@umijs/bundler-utils/compiled/babel/types"));
|
|
28
33
|
const esbuild_1 = require("@umijs/bundler-utils/compiled/esbuild");
|
|
29
|
-
const utils_1 = require("@umijs/utils");
|
|
30
34
|
const fs_1 = require("fs");
|
|
31
35
|
const path_1 = require("path");
|
|
36
|
+
const plugin_utils_1 = require("umi/plugin-utils");
|
|
32
37
|
const astUtils_1 = require("./astUtils");
|
|
33
38
|
class Model {
|
|
34
|
-
constructor(file, id) {
|
|
39
|
+
constructor(file, sort, id) {
|
|
35
40
|
let namespace;
|
|
36
41
|
let exportName;
|
|
37
42
|
const [_file, meta] = file.split('#');
|
|
@@ -44,6 +49,36 @@ class Model {
|
|
|
44
49
|
this.id = `model_${id}`;
|
|
45
50
|
this.namespace = namespace || (0, path_1.basename)(file, (0, path_1.extname)(file));
|
|
46
51
|
this.exportName = exportName || 'default';
|
|
52
|
+
this.deps = sort ? this.findDeps(sort) : [];
|
|
53
|
+
}
|
|
54
|
+
findDeps(sort) {
|
|
55
|
+
const content = (0, fs_1.readFileSync)(this.file, 'utf-8');
|
|
56
|
+
// transform with esbuild first
|
|
57
|
+
// to reduce unexpected ast problem
|
|
58
|
+
const loader = (0, path_1.extname)(this.file).slice(1);
|
|
59
|
+
const result = (0, esbuild_1.transformSync)(content, {
|
|
60
|
+
loader,
|
|
61
|
+
sourcemap: false,
|
|
62
|
+
minify: false,
|
|
63
|
+
});
|
|
64
|
+
// transform with babel
|
|
65
|
+
const deps = new Set();
|
|
66
|
+
const ast = parser.parse(result.code, {
|
|
67
|
+
sourceType: 'module',
|
|
68
|
+
sourceFilename: this.file,
|
|
69
|
+
plugins: [],
|
|
70
|
+
});
|
|
71
|
+
// TODO: use sort
|
|
72
|
+
sort;
|
|
73
|
+
(0, traverse_1.default)(ast, {
|
|
74
|
+
CallExpression: (path) => {
|
|
75
|
+
if (t.isIdentifier(path.node.callee, { name: 'useModel' }) &&
|
|
76
|
+
t.isStringLiteral(path.node.arguments[0])) {
|
|
77
|
+
deps.add(path.node.arguments[0].value);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
return [...deps];
|
|
47
82
|
}
|
|
48
83
|
}
|
|
49
84
|
exports.Model = Model;
|
|
@@ -57,7 +92,7 @@ class ModelUtils {
|
|
|
57
92
|
getAllModels(opts) {
|
|
58
93
|
// reset count
|
|
59
94
|
this.count = 1;
|
|
60
|
-
|
|
95
|
+
const models = [
|
|
61
96
|
...this.getModels({
|
|
62
97
|
base: (0, path_1.join)(this.api.paths.absSrcPath, 'models'),
|
|
63
98
|
pattern: '**/*.{ts,tsx,js,jsx}',
|
|
@@ -72,16 +107,67 @@ class ModelUtils {
|
|
|
72
107
|
}),
|
|
73
108
|
...opts.extraModels,
|
|
74
109
|
].map((file) => {
|
|
75
|
-
return new Model(file, this.count++);
|
|
110
|
+
return new Model(file, opts.sort, this.count++);
|
|
111
|
+
});
|
|
112
|
+
// check duplicate
|
|
113
|
+
const namespaces = models.map((model) => model.namespace);
|
|
114
|
+
if (new Set(namespaces).size !== namespaces.length) {
|
|
115
|
+
throw new Error(`Duplicate namespace in models: ${namespaces.join(', ')}`);
|
|
116
|
+
}
|
|
117
|
+
// sort models by deps
|
|
118
|
+
if (opts.sort) {
|
|
119
|
+
const namespaces = this.getSortedNamespaces(models);
|
|
120
|
+
models.sort((a, b) => namespaces.indexOf(a.namespace) - namespaces.indexOf(b.namespace));
|
|
121
|
+
}
|
|
122
|
+
return models;
|
|
123
|
+
}
|
|
124
|
+
getSortedNamespaces(models) {
|
|
125
|
+
let final = [];
|
|
126
|
+
models.forEach((model, index) => {
|
|
127
|
+
const { deps, namespace } = model;
|
|
128
|
+
if (deps && deps.length) {
|
|
129
|
+
const itemGroup = [...deps, namespace];
|
|
130
|
+
const cannotUse = [namespace];
|
|
131
|
+
for (let i = 0; i <= index; i += 1) {
|
|
132
|
+
if (models[i].deps.filter((v) => cannotUse.includes(v)).length) {
|
|
133
|
+
if (!cannotUse.includes(models[i].namespace)) {
|
|
134
|
+
cannotUse.push(models[i].namespace);
|
|
135
|
+
i = -1;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const errorList = deps.filter((v) => cannotUse.includes(v));
|
|
140
|
+
if (errorList.length) {
|
|
141
|
+
throw Error(`Circular dependencies: ${namespace} can't use ${errorList.join(', ')}`);
|
|
142
|
+
}
|
|
143
|
+
const intersection = final.filter((v) => itemGroup.includes(v));
|
|
144
|
+
if (intersection.length) {
|
|
145
|
+
// first intersection
|
|
146
|
+
const finalIndex = final.indexOf(intersection[0]);
|
|
147
|
+
// replace with groupItem
|
|
148
|
+
final = final
|
|
149
|
+
.slice(0, finalIndex)
|
|
150
|
+
.concat(itemGroup)
|
|
151
|
+
.concat(final.slice(finalIndex + 1));
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
final.push(...itemGroup);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (!final.includes(namespace)) {
|
|
158
|
+
// first occurrence append to the end
|
|
159
|
+
final.push(namespace);
|
|
160
|
+
}
|
|
76
161
|
});
|
|
162
|
+
return [...new Set(final)];
|
|
77
163
|
}
|
|
78
164
|
getModels(opts) {
|
|
79
|
-
return
|
|
165
|
+
return plugin_utils_1.glob
|
|
80
166
|
.sync(opts.pattern || '**/*.{ts,js}', {
|
|
81
167
|
cwd: opts.base,
|
|
82
168
|
absolute: true,
|
|
83
169
|
})
|
|
84
|
-
.map(
|
|
170
|
+
.map(plugin_utils_1.winPath)
|
|
85
171
|
.filter((file) => {
|
|
86
172
|
if (/\.d.ts$/.test(file))
|
|
87
173
|
return false;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.withTmpPath = void 0;
|
|
4
|
-
const utils_1 = require("@umijs/utils");
|
|
5
4
|
const path_1 = require("path");
|
|
5
|
+
const plugin_utils_1 = require("umi/plugin-utils");
|
|
6
6
|
function withTmpPath(opts) {
|
|
7
|
-
return (0,
|
|
7
|
+
return (0, plugin_utils_1.winPath)((0, path_1.join)(opts.api.paths.absTmpPath, opts.api.plugin.key && !opts.noPluginDir
|
|
8
8
|
? `plugin-${opts.api.plugin.key}`
|
|
9
9
|
: '', opts.path));
|
|
10
10
|
}
|
|
@@ -163,9 +163,9 @@ export const getLocale = () => {
|
|
|
163
163
|
// please clear localStorage if you change the baseSeparator config
|
|
164
164
|
// because changing will break the app
|
|
165
165
|
const lang =
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
166
|
+
navigator.cookieEnabled && typeof localStorage !== 'undefined' && useLocalStorage
|
|
167
|
+
? window.localStorage.getItem('umi_locale')
|
|
168
|
+
: '';
|
|
169
169
|
// support baseNavigator, default true
|
|
170
170
|
let browserLang;
|
|
171
171
|
{{#BaseNavigator}}
|
|
@@ -207,9 +207,9 @@ export const setLocale = (lang: string, realReload: boolean = true) => {
|
|
|
207
207
|
|
|
208
208
|
const updater = () => {
|
|
209
209
|
if (getLocale() !== lang) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
if (navigator.cookieEnabled && typeof window.localStorage !== 'undefined' && useLocalStorage) {
|
|
211
|
+
window.localStorage.setItem('umi_locale', lang || '');
|
|
212
|
+
}
|
|
213
213
|
setIntl(lang);
|
|
214
214
|
if (realReload) {
|
|
215
215
|
window.location.reload();
|
|
@@ -139,6 +139,13 @@ export const MicroApp = forwardRef(
|
|
|
139
139
|
setComponentError(null);
|
|
140
140
|
setLoading(true);
|
|
141
141
|
const configuration = {
|
|
142
|
+
fetch(url) {
|
|
143
|
+
return window.fetch(url, {
|
|
144
|
+
headers: {
|
|
145
|
+
accept: 'text/html',
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
},
|
|
142
149
|
globalContext: window,
|
|
143
150
|
...globalSettings,
|
|
144
151
|
...settingsFromProps,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @since 2019-06-20
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { ReactComponentElement } from 'react';
|
|
8
|
+
import React, { ReactComponentElement } from 'react';
|
|
9
9
|
import type { IRouteProps } from 'umi';
|
|
10
10
|
|
|
11
11
|
export const defaultMountContainerId = 'root-subapp';
|
|
@@ -48,6 +48,7 @@ export function patchMicroAppRoute(
|
|
|
48
48
|
getMicroAppRouteComponent: (opts: {
|
|
49
49
|
appName: string;
|
|
50
50
|
base: string;
|
|
51
|
+
routePath: string;
|
|
51
52
|
masterHistoryType: string;
|
|
52
53
|
routeProps?: any;
|
|
53
54
|
}) => string | ReactComponentElement<any>,
|
|
@@ -63,9 +64,9 @@ export function patchMicroAppRoute(
|
|
|
63
64
|
const microAppProps =
|
|
64
65
|
route[`${routeBindingAlias}Props`] || route.microAppProps || {};
|
|
65
66
|
if (microAppName) {
|
|
66
|
-
if (route.
|
|
67
|
-
const childrenRouteHasComponent = route.
|
|
68
|
-
(r: any) => r.
|
|
67
|
+
if (route.children?.length) {
|
|
68
|
+
const childrenRouteHasComponent = route.children.some(
|
|
69
|
+
(r: any) => r.element,
|
|
69
70
|
);
|
|
70
71
|
if (childrenRouteHasComponent) {
|
|
71
72
|
throw new Error(
|
|
@@ -74,7 +75,10 @@ export function patchMicroAppRoute(
|
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
|
|
78
|
+
// 自动追加通配符,匹配子应用的路由
|
|
79
|
+
if (!route.path.endsWith('/*')) {
|
|
80
|
+
route.path = route.path.replace(/\/?$/, '/*');
|
|
81
|
+
}
|
|
78
82
|
|
|
79
83
|
const { settings = {}, ...componentProps } = microAppProps;
|
|
80
84
|
const routeProps = {
|
|
@@ -85,10 +89,11 @@ export function patchMicroAppRoute(
|
|
|
85
89
|
const opts = {
|
|
86
90
|
appName: microAppName,
|
|
87
91
|
base,
|
|
92
|
+
routePath: route.path,
|
|
88
93
|
masterHistoryType,
|
|
89
94
|
routeProps,
|
|
90
95
|
};
|
|
91
|
-
route.
|
|
96
|
+
route.element = React.createElement(getMicroAppRouteComponent(opts), null);
|
|
92
97
|
}
|
|
93
98
|
}
|
|
94
99
|
|
|
@@ -100,8 +105,8 @@ const recursiveSearch = (
|
|
|
100
105
|
if (routes[i].path === path) {
|
|
101
106
|
return routes[i];
|
|
102
107
|
}
|
|
103
|
-
if (routes[i].
|
|
104
|
-
const found = recursiveSearch(routes[i].
|
|
108
|
+
if (routes[i].children && routes[i].children?.length) {
|
|
109
|
+
const found = recursiveSearch(routes[i].children || [], path);
|
|
105
110
|
if (found) {
|
|
106
111
|
return found;
|
|
107
112
|
}
|
|
@@ -123,8 +128,8 @@ export function insertRoute(routes: IRouteProps[], microAppRoute: IRouteProps) {
|
|
|
123
128
|
);
|
|
124
129
|
}
|
|
125
130
|
found.exact = false;
|
|
126
|
-
found.
|
|
127
|
-
found.
|
|
131
|
+
found.children = found.children || [];
|
|
132
|
+
found.children.push(microAppRoute);
|
|
128
133
|
} else {
|
|
129
134
|
throw new Error(
|
|
130
135
|
`[plugin-qiankun]: path "${microAppRoute.insert}" not found`,
|
|
@@ -1,31 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { MicroApp } from './MicroApp';
|
|
3
|
-
{{#runtimeHistory}}
|
|
4
|
-
import { getCreateHistoryOptions } from 'umi';
|
|
5
|
-
{{/runtimeHistory}}
|
|
6
|
-
import { useLocation } from 'umi';
|
|
7
3
|
|
|
8
4
|
export function getMicroAppRouteComponent(opts: {
|
|
9
5
|
appName: string;
|
|
10
6
|
base: string;
|
|
7
|
+
routePath: string;
|
|
11
8
|
masterHistoryType: string;
|
|
12
9
|
routeProps?: any;
|
|
13
10
|
}) {
|
|
14
|
-
const { base, masterHistoryType, appName, routeProps } = opts;
|
|
15
|
-
const RouteComponent = (
|
|
16
|
-
const url = useLocation().pathname;
|
|
17
|
-
|
|
11
|
+
const { base, masterHistoryType, appName, routeProps, routePath } = opts;
|
|
12
|
+
const RouteComponent = () => {
|
|
18
13
|
// 默认取静态配置的 base
|
|
19
14
|
let umiConfigBase = base === '/' ? '' : base;
|
|
20
15
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const { basename = '/' } = getCreateHistoryOptions();
|
|
24
|
-
umiConfigBase = basename === '/' ? '' : basename;
|
|
25
|
-
{{/runtimeHistory}}
|
|
26
|
-
|
|
27
|
-
let runtimeMatchedBase =
|
|
28
|
-
umiConfigBase + (url.endsWith('/') ? url.substr(0, url.length - 1) : url);
|
|
16
|
+
// 拼接子应用挂载路由
|
|
17
|
+
let runtimeMatchedBase = umiConfigBase + routePath.replace('/*', '');
|
|
29
18
|
|
|
30
19
|
{{#dynamicRoot}}
|
|
31
20
|
// @see https://github.com/umijs/umi/blob/master/packages/preset-built-in/src/plugins/commands/htmlUtils.ts#L102
|
|
@@ -34,10 +34,10 @@ function patchMicroAppRouteComponent(routes: any[]) {
|
|
|
34
34
|
const rootRoute = routes.find((route) => route.path === '/');
|
|
35
35
|
if (rootRoute) {
|
|
36
36
|
// 如果根路由是叶子节点,则直接返回其父节点
|
|
37
|
-
if (!rootRoute.
|
|
37
|
+
if (!rootRoute.children) {
|
|
38
38
|
return routes;
|
|
39
39
|
}
|
|
40
|
-
return getRootRoutes(rootRoute.
|
|
40
|
+
return getRootRoutes(rootRoute.children);
|
|
41
41
|
}
|
|
42
42
|
return routes;
|
|
43
43
|
};
|
|
@@ -50,11 +50,12 @@ function patchMicroAppRouteComponent(routes: any[]) {
|
|
|
50
50
|
const patchRoute = (route: any) => {
|
|
51
51
|
patchMicroAppRoute(route, getMicroAppRouteComponent, {
|
|
52
52
|
base,
|
|
53
|
+
routePath: route.path,
|
|
53
54
|
masterHistoryType,
|
|
54
55
|
routeBindingAlias,
|
|
55
56
|
});
|
|
56
|
-
if (route.
|
|
57
|
-
route.
|
|
57
|
+
if (route.children?.length) {
|
|
58
|
+
route.children.forEach(patchRoute);
|
|
58
59
|
}
|
|
59
60
|
};
|
|
60
61
|
|
|
@@ -123,7 +124,7 @@ export async function render(oldRender: typeof noop) {
|
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
|
|
126
|
-
export function
|
|
127
|
+
export function patchClientRoutes({ routes }: { routes: any[] }) {
|
|
127
128
|
if (microAppRuntimeRoutes) {
|
|
128
129
|
patchMicroAppRouteComponent(routes);
|
|
129
130
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
/* eslint-disable */
|
|
3
2
|
import { getPluginManager } from '@@/core/plugin';
|
|
4
3
|
import ReactDOM from 'react-dom';
|
|
5
4
|
import { ApplyPluginsType } from 'umi';
|
|
@@ -22,7 +21,7 @@ let render = noop;
|
|
|
22
21
|
let hasMountedAtLeastOnce = false;
|
|
23
22
|
|
|
24
23
|
export default () => defer.promise;
|
|
25
|
-
export const
|
|
24
|
+
export const contextOptsStack: any[] = [];
|
|
26
25
|
|
|
27
26
|
// function normalizeHistory(
|
|
28
27
|
// history?: 'string' | Record<string, any>,
|
|
@@ -79,10 +78,7 @@ export function genMount(mountElementId: string) {
|
|
|
79
78
|
// 默认开启
|
|
80
79
|
// 如果需要手动控制 loading,通过主应用配置 props.autoSetLoading false 可以关闭
|
|
81
80
|
callback: () => {
|
|
82
|
-
if (
|
|
83
|
-
props?.autoSetLoading &&
|
|
84
|
-
typeof props?.setLoading === 'function'
|
|
85
|
-
) {
|
|
81
|
+
if (props.autoSetLoading && typeof props.setLoading === 'function') {
|
|
86
82
|
props.setLoading(false);
|
|
87
83
|
}
|
|
88
84
|
|
|
@@ -94,9 +90,11 @@ export function genMount(mountElementId: string) {
|
|
|
94
90
|
// 支持通过 props 注入 container 来限定子应用 mountElementId 的查找范围
|
|
95
91
|
// 避免多个子应用出现在同一主应用时出现 mount 冲突
|
|
96
92
|
rootElement:
|
|
97
|
-
props
|
|
93
|
+
props.container?.querySelector(`#${mountElementId}`) ||
|
|
98
94
|
mountElementId,
|
|
99
95
|
|
|
96
|
+
basename: props.base,
|
|
97
|
+
|
|
100
98
|
// 当存在同一个 umi 子应用在同一个页面被多实例渲染的场景时(比如一个页面里,同时展示了这个子应用的多个路由页面)
|
|
101
99
|
// mount 钩子会被调用多次,但是具体什么时候对应的实例开始 render 则是不定的,即它调用 applyPlugins('modifyClientRenderOpts') 的时机是不确定的
|
|
102
100
|
// 为了保证每次 applyPlugins('modifyClientRenderOpts') 调用是生成正确的 history,我们需要这里通过闭包上下文维持 mount 调用时的一些配置信息
|
|
@@ -111,7 +109,7 @@ export function genMount(mountElementId: string) {
|
|
|
111
109
|
// },
|
|
112
110
|
};
|
|
113
111
|
|
|
114
|
-
|
|
112
|
+
contextOptsStack.push(clientRenderOpts);
|
|
115
113
|
}
|
|
116
114
|
|
|
117
115
|
// 第一次 mount defer 被 resolve 后umi 会自动触发 render,非第一次 mount 则需手动触发
|
|
@@ -121,6 +119,14 @@ export function genMount(mountElementId: string) {
|
|
|
121
119
|
defer.resolve();
|
|
122
120
|
}
|
|
123
121
|
|
|
122
|
+
// 如果需要手动控制 loading,通过主应用配置 props.autoSetLoading false 可以关闭
|
|
123
|
+
// 考虑到 react 18 之后 callback 不再准
|
|
124
|
+
// 所以在这里直接返回,而不使用 ReactDOM.render 的第三个参数
|
|
125
|
+
if (typeof props !== 'undefined') {
|
|
126
|
+
if (props.autoSetLoading && typeof props.setLoading === 'function') {
|
|
127
|
+
props.setLoading(false);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
124
130
|
hasMountedAtLeastOnce = true;
|
|
125
131
|
};
|
|
126
132
|
}
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
|
|
3
|
-
import qiankunRender from './lifecycles';
|
|
2
|
+
import qiankunRender, { contextOptsStack } from './lifecycles';
|
|
4
3
|
|
|
5
4
|
export function render(oldRender: any) {
|
|
6
5
|
return qiankunRender().then(oldRender);
|
|
7
6
|
}
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// return {
|
|
18
|
-
// ...memo,
|
|
19
|
-
// ...clientRenderOpts,
|
|
20
|
-
// };
|
|
21
|
-
// }
|
|
8
|
+
export function modifyContextOpts(memo: any) {
|
|
9
|
+
// 每次应用 render 的时候会调 modifyClientRenderOpts,这时尝试从队列中取 render 的配置
|
|
10
|
+
const clientRenderOpts = contextOptsStack.shift();
|
|
11
|
+
return {
|
|
12
|
+
...memo,
|
|
13
|
+
...clientRenderOpts,
|
|
14
|
+
};
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugins",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.20",
|
|
4
4
|
"description": "@umijs/plugins",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi-next/tree/master/packages/plugins#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi-next/issues",
|
|
@@ -17,32 +17,34 @@
|
|
|
17
17
|
],
|
|
18
18
|
"scripts": {
|
|
19
19
|
"build": "pnpm tsc",
|
|
20
|
-
"build:deps": "
|
|
21
|
-
"dev": "pnpm build -- --watch"
|
|
20
|
+
"build:deps": "umi-scripts bundleDeps",
|
|
21
|
+
"dev": "pnpm build -- --watch",
|
|
22
|
+
"test": "umi-scripts jest-turbo"
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
24
25
|
"@ahooksjs/use-request": "^2.0.0",
|
|
25
26
|
"@ant-design/icons": "^4.7.0",
|
|
26
|
-
"@ant-design/pro-layout": "^6.
|
|
27
|
-
"@umijs/bundler-utils": "4.0.0-rc.
|
|
28
|
-
"antd": "^4.18.7",
|
|
27
|
+
"@ant-design/pro-layout": "^6.38.0",
|
|
28
|
+
"@umijs/bundler-utils": "4.0.0-rc.20",
|
|
29
29
|
"antd-dayjs-webpack-plugin": "^1.0.6",
|
|
30
|
-
"axios": "^0.
|
|
30
|
+
"axios": "^0.27.2",
|
|
31
31
|
"babel-plugin-import": "^1.13.3",
|
|
32
|
-
"dayjs": "^1.
|
|
32
|
+
"dayjs": "^1.11.2",
|
|
33
33
|
"dva-core": "^2.0.4",
|
|
34
|
+
"dva-immer": "^1.0.0",
|
|
35
|
+
"dva-loading": "^3.0.22",
|
|
34
36
|
"event-emitter": "~0.3.5",
|
|
35
37
|
"fast-deep-equal": "3.1.3",
|
|
36
38
|
"lodash": "^4.17.21",
|
|
37
|
-
"moment": "^2.29.
|
|
38
|
-
"qiankun": "^2.
|
|
39
|
+
"moment": "^2.29.3",
|
|
40
|
+
"qiankun": "^2.7.0",
|
|
39
41
|
"react-intl": "3.12.1",
|
|
40
|
-
"react-redux": "^
|
|
41
|
-
"redux": "^4.
|
|
42
|
+
"react-redux": "^8.0.1",
|
|
43
|
+
"redux": "^4.2.0",
|
|
42
44
|
"warning": "^4.0.3"
|
|
43
45
|
},
|
|
44
46
|
"devDependencies": {
|
|
45
|
-
"umi": "4.0.0-rc.
|
|
47
|
+
"umi": "4.0.0-rc.20"
|
|
46
48
|
},
|
|
47
49
|
"publishConfig": {
|
|
48
50
|
"access": "public"
|