@umijs/plugins 4.0.0-canary.20220628.2 → 4.0.0-canary.20220718.1
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.d.ts +1 -0
- package/dist/access.d.ts.map +1 -0
- package/dist/access.js +1 -1
- package/dist/analytics.d.ts +1 -0
- package/dist/analytics.d.ts.map +1 -0
- package/dist/antd.d.ts +1 -0
- package/dist/antd.d.ts.map +1 -0
- package/dist/dva.d.ts +1 -0
- package/dist/dva.d.ts.map +1 -0
- package/dist/icons.d.ts +1 -0
- package/dist/icons.d.ts.map +1 -0
- package/dist/initial-state.d.ts +1 -0
- package/dist/initial-state.d.ts.map +1 -0
- package/dist/layout.d.ts +1 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +22 -2
- package/dist/locale.d.ts +1 -0
- package/dist/locale.d.ts.map +1 -0
- package/dist/locale.js +1 -1
- package/dist/model.d.ts +1 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/moment2dayjs.d.ts +1 -0
- package/dist/moment2dayjs.d.ts.map +1 -0
- package/dist/qiankun/constants.d.ts +1 -0
- package/dist/qiankun/constants.d.ts.map +1 -0
- package/dist/qiankun/master.d.ts +1 -0
- package/dist/qiankun/master.d.ts.map +1 -0
- package/dist/qiankun/slave.d.ts +1 -0
- package/dist/qiankun/slave.d.ts.map +1 -0
- package/dist/qiankun.d.ts +1 -0
- package/dist/qiankun.d.ts.map +1 -0
- package/dist/request.d.ts +1 -0
- package/dist/request.d.ts.map +1 -0
- package/dist/request.js +9 -2
- package/dist/tailwindcss.d.ts +1 -0
- package/dist/tailwindcss.d.ts.map +1 -0
- package/dist/unocss.d.ts +1 -0
- package/dist/unocss.d.ts.map +1 -0
- package/dist/utils/astUtils.d.ts +1 -0
- package/dist/utils/astUtils.d.ts.map +1 -0
- package/dist/utils/localeUtils.d.ts +1 -0
- package/dist/utils/localeUtils.d.ts.map +1 -0
- package/dist/utils/modelUtils.d.ts +1 -0
- package/dist/utils/modelUtils.d.ts.map +1 -0
- package/dist/utils/modelUtils.js +1 -1
- package/dist/utils/resolveProjectDep.d.ts +1 -0
- package/dist/utils/resolveProjectDep.d.ts.map +1 -0
- package/dist/utils/withTmpPath.d.ts +1 -0
- package/dist/utils/withTmpPath.d.ts.map +1 -0
- package/libs/locale/SelectLang.tpl +1 -1
- package/libs/qiankun/master/MicroApp.tsx +9 -3
- package/libs/qiankun/slave/lifecycles.ts +6 -0
- package/package.json +3 -3
package/dist/access.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../src/access.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;8BAGN,IAAI;AAAzB,wBA8IE"}
|
package/dist/access.js
CHANGED
package/dist/analytics.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../src/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;8BAEN,IAAI;AAAzB,wBAqEE"}
|
package/dist/antd.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"antd.d.ts","sourceRoot":"","sources":["../src/antd.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;8BAKN,IAAI;AAAzB,wBA0JE"}
|
package/dist/dva.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dva.d.ts","sourceRoot":"","sources":["../src/dva.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3B,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;8BAGlC,IAAI;AAAzB,wBA6JE;AAEF,wBAAgB,YAAY,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,cAmB5C;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,IAAI,WAIrC"}
|
package/dist/icons.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../src/icons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;8BAEN,IAAI;AAAzB,wBAEE"}
|
package/dist/initial-state.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initial-state.d.ts","sourceRoot":"","sources":["../src/initial-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;8BAGN,IAAI;AAAzB,wBA+HE"}
|
package/dist/layout.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;8BAIN,IAAI;AAAzB,wBAgoBE"}
|
package/dist/layout.js
CHANGED
|
@@ -137,6 +137,26 @@ const filterRoutes = (routes: IRoute[], filterFn: (route: IRoute) => boolean) =>
|
|
|
137
137
|
return newRoutes;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
// 格式化路由 处理因 wrapper 导致的 菜单 path 不一致
|
|
141
|
+
const mapRoutes = (routes: IRoute[]) => {
|
|
142
|
+
if (routes.length === 0) {
|
|
143
|
+
return []
|
|
144
|
+
}
|
|
145
|
+
return routes.map(route => {
|
|
146
|
+
// 需要 copy 一份, 否则会污染原始数据
|
|
147
|
+
const newRoute = {...route}
|
|
148
|
+
if (route.originPath) {
|
|
149
|
+
newRoute.path = route.originPath
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (Array.isArray(route.routes)) {
|
|
153
|
+
newRoute.routes = mapRoutes(route.routes);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return newRoute
|
|
157
|
+
})
|
|
158
|
+
}
|
|
159
|
+
|
|
140
160
|
export default (props: any) => {
|
|
141
161
|
const location = useLocation();
|
|
142
162
|
const navigate = useNavigate();
|
|
@@ -163,9 +183,9 @@ const { formatMessage } = useIntl();
|
|
|
163
183
|
|
|
164
184
|
const matchedRoute = useMemo(() => matchRoutes(clientRoutes, location.pathname).pop()?.route, [location.pathname]);
|
|
165
185
|
const newRoutes = filterRoutes(clientRoutes.filter(route => route.id === 'ant-design-pro-layout'), (route) => {
|
|
166
|
-
return !!route.isLayout && route.id !== 'ant-design-pro-layout';
|
|
186
|
+
return (!!route.isLayout && route.id !== 'ant-design-pro-layout') || !!route.isWrapper;
|
|
167
187
|
})
|
|
168
|
-
const [route] = useAccessMarkedRoutes(newRoutes);
|
|
188
|
+
const [route] = useAccessMarkedRoutes(mapRoutes(newRoutes));
|
|
169
189
|
|
|
170
190
|
return (
|
|
171
191
|
<ProLayout
|
package/dist/locale.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../src/locale.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAuB3B,eAAO,MAAM,gBAAgB,gBAAiB,MAAM,WACb,CAAC;8BAGnB,IAAI;AAAzB,wBAkOE"}
|
package/dist/locale.js
CHANGED
|
@@ -182,7 +182,7 @@ exports.default = (api) => {
|
|
|
182
182
|
api.writeTmpFile({
|
|
183
183
|
path: 'index.ts',
|
|
184
184
|
content: `
|
|
185
|
-
export { setLocale, getLocale, getIntl, useIntl, injectIntl, formatMessage, FormattedMessage } from './localeExports.ts';
|
|
185
|
+
export { addLocale, setLocale, getLocale, getIntl, useIntl, injectIntl, formatMessage, FormattedMessage, getAllLocales } from './localeExports.ts';
|
|
186
186
|
export { SelectLang } from './SelectLang.tsx';
|
|
187
187
|
`,
|
|
188
188
|
});
|
package/dist/model.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;8BAKN,IAAI;AAAzB,wBA+DE"}
|
package/dist/moment2dayjs.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moment2dayjs.d.ts","sourceRoot":"","sources":["../src/moment2dayjs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;8BAQN,IAAI;AAAzB,wBAgGE"}
|
|
@@ -3,3 +3,4 @@ export declare const defaultHistoryType = "browser";
|
|
|
3
3
|
export declare const qiankunStateForSlaveModelNamespace = "@@qiankunStateForSlave";
|
|
4
4
|
export declare const qiankunStateFromMasterModelNamespace = "@@qiankunStateFromMaster";
|
|
5
5
|
export declare const MODEL_EXPORT_NAME = "useQiankunStateForSlave";
|
|
6
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/qiankun/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,gBAAgB,CAAC;AACjD,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAC5C,eAAO,MAAM,kCAAkC,2BAA2B,CAAC;AAC3E,eAAO,MAAM,oCAAoC,6BAA6B,CAAC;AAC/E,eAAO,MAAM,iBAAiB,4BAA4B,CAAC"}
|
package/dist/qiankun/master.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"master.d.ts","sourceRoot":"","sources":["../../src/qiankun/master.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAU3B,wBAAgB,cAAc,CAAC,IAAI,EAAE;IAAE,UAAU,EAAE,GAAG,CAAA;CAAE,WAMvD;8BAEoB,IAAI;AAAzB,wBA8IE"}
|
package/dist/qiankun/slave.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slave.d.ts","sourceRoot":"","sources":["../../src/qiankun/slave.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;8BAgBN,IAAI;AAAzB,wBAmLE"}
|
package/dist/qiankun.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qiankun.d.ts","sourceRoot":"","sources":["../src/qiankun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;8BAEN,IAAI;AAAzB,wBAmBE"}
|
package/dist/request.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../src/request.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;8BAGN,IAAI;AAAzB,wBAqUE"}
|
package/dist/request.js
CHANGED
|
@@ -23,6 +23,7 @@ import axios, {
|
|
|
23
23
|
type AxiosInstance,
|
|
24
24
|
type AxiosRequestConfig,
|
|
25
25
|
type AxiosResponse,
|
|
26
|
+
type AxiosError,
|
|
26
27
|
} from '{{{axiosPath}}}';
|
|
27
28
|
import useUmiRequest, { UseRequestProvider } from '{{{umiRequestPath}}}';
|
|
28
29
|
import { ApplyPluginsType } from 'umi';
|
|
@@ -123,6 +124,8 @@ interface IRequest{
|
|
|
123
124
|
<T = any>(url: string): Promise<T>; // 不提供 opts 时,默认使用 'GET' method,并且默认返回 data
|
|
124
125
|
}
|
|
125
126
|
|
|
127
|
+
type RequestError = AxiosError | Error
|
|
128
|
+
|
|
126
129
|
interface IErrorHandler {
|
|
127
130
|
(error: RequestError, opts: IRequestOptions): void;
|
|
128
131
|
}
|
|
@@ -134,10 +137,10 @@ type IResponseInterceptor = <T = any>(response : AxiosResponse<T>) => AxiosRespo
|
|
|
134
137
|
type IRequestInterceptorTuple = [IRequestInterceptor , IErrorInterceptor] | [ IRequestInterceptor ] | IRequestInterceptor
|
|
135
138
|
type IResponseInterceptorTuple = [IResponseInterceptor, IErrorInterceptor] | [IResponseInterceptor] | IResponseInterceptor
|
|
136
139
|
|
|
137
|
-
export interface RequestConfig extends AxiosRequestConfig {
|
|
140
|
+
export interface RequestConfig<T = any> extends AxiosRequestConfig {
|
|
138
141
|
errorConfig?: {
|
|
139
142
|
errorHandler?: IErrorHandler;
|
|
140
|
-
errorThrower?:
|
|
143
|
+
errorThrower?: ( res: T ) => void
|
|
141
144
|
};
|
|
142
145
|
requestInterceptors?: IRequestInterceptorTuple[];
|
|
143
146
|
responseInterceptors?: IResponseInterceptorTuple[];
|
|
@@ -272,6 +275,8 @@ export type {
|
|
|
272
275
|
AxiosInstance,
|
|
273
276
|
AxiosRequestConfig,
|
|
274
277
|
AxiosResponse,
|
|
278
|
+
AxiosError,
|
|
279
|
+
RequestError,
|
|
275
280
|
IResponseInterceptor as ResponseInterceptor,
|
|
276
281
|
IRequestOptions as RequestOptions,
|
|
277
282
|
IRequest as Request,
|
|
@@ -302,6 +307,8 @@ export type {
|
|
|
302
307
|
AxiosInstance,
|
|
303
308
|
AxiosRequestConfig,
|
|
304
309
|
AxiosResponse,
|
|
310
|
+
AxiosError,
|
|
311
|
+
RequestError,
|
|
305
312
|
ResponseInterceptor } from './request';
|
|
306
313
|
`,
|
|
307
314
|
});
|
package/dist/tailwindcss.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailwindcss.d.ts","sourceRoot":"","sources":["../src/tailwindcss.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;8BAGN,IAAI;AAAzB,wBAsDE"}
|
package/dist/unocss.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unocss.d.ts","sourceRoot":"","sources":["../src/unocss.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;8BAGN,IAAI;AAAzB,wBA6CE"}
|
package/dist/utils/astUtils.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import * as Babel from '@umijs/bundler-utils/compiled/babel/core';
|
|
2
2
|
import * as t from '@umijs/bundler-utils/compiled/babel/types';
|
|
3
3
|
export declare function getIdentifierDeclaration(node: t.Node, path: Babel.NodePath): Babel.types.Node;
|
|
4
|
+
//# sourceMappingURL=astUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"astUtils.d.ts","sourceRoot":"","sources":["../../src/utils/astUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,0CAA0C,CAAC;AAClE,OAAO,KAAK,CAAC,MAAM,2CAA2C,CAAC;AAE/D,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,QAAQ,oBAS1E"}
|
|
@@ -31,3 +31,4 @@ export interface IGetLocaleFileListResult {
|
|
|
31
31
|
export declare const getLocaleList: (opts: IGetLocaleFileListOpts) => Promise<IGetLocaleFileListResult[]>;
|
|
32
32
|
export declare const exactLocalePaths: (data: IGetLocaleFileListResult[]) => string[];
|
|
33
33
|
export declare function isNeedPolyfill(targets?: {}): boolean;
|
|
34
|
+
//# sourceMappingURL=localeUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localeUtils.d.ts","sourceRoot":"","sources":["../../src/utils/localeUtils.ts"],"names":[],"mappings":"AAIA,oBAAY,eAAe,GAAG,CAAC,IAAI,EAAE;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;AAExB,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,eAAe,CAAC;IAChC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,SACpB,MAAM,WACH,MAAM,cACH,MAAM,KACjB;IAAE,YAAY,EAAE,MAAM,CAAA;CAqBxB,CAAC;AAEF,eAAO,MAAM,aAAa,SAAU,MAAM,WAAW,MAAM,KAAG,MACV,CAAC;AAErD,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB;AAiBD,eAAO,MAAM,aAAa,SAClB,sBAAsB,KAC3B,QAAQ,wBAAwB,EAAE,CA4DpC,CAAC;AAEF,eAAO,MAAM,gBAAgB,SACrB,wBAAwB,EAAE,KAC/B,MAAM,EAER,CAAC;AAEF,wBAAgB,cAAc,CAAC,OAAO,KAAK,WA4B1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modelUtils.d.ts","sourceRoot":"","sources":["../../src/utils/modelUtils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,CAAC,MAAM,2CAA2C,CAAC;AAI/D,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAI3B,UAAU,KAAK;IACb,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;IAC3C,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC;CAChE;AAED,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAgBnE;AAED,qBAAa,KAAK;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;gBAEb,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,EAAE,GAAG,SAAS,EACpB,EAAE,EAAE,MAAM;IAiBZ,QAAQ,CAAC,IAAI,EAAE,MAAM;CAiCtB;AAED,qBAAa,UAAU;IACrB,GAAG,EAAE,IAAI,CAAC;IACV,IAAI,EAAE,KAAK,CAAM;IACjB,KAAK,EAAE,MAAM,CAAK;gBACN,GAAG,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,EAAE,KAAK;IAKzC,YAAY,CAAC,IAAI,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,EAAE,CAAA;KAAE;IA2C3D,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAE;IA6CnC,SAAS,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;IAelD,YAAY,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE;IAsCpD,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE;CA4BxC"}
|
package/dist/utils/modelUtils.js
CHANGED
|
@@ -128,7 +128,7 @@ class ModelUtils {
|
|
|
128
128
|
// check duplicate
|
|
129
129
|
const namespaces = models.map((model) => model.namespace);
|
|
130
130
|
if (new Set(namespaces).size !== namespaces.length) {
|
|
131
|
-
throw new Error(`Duplicate namespace in models: ${namespaces.join(', ')}`);
|
|
131
|
+
throw new Error(`Duplicate namespace in models: ${namespaces.sort().join(', ')}`);
|
|
132
132
|
}
|
|
133
133
|
// sort models by deps
|
|
134
134
|
if (opts.sort) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveProjectDep.d.ts","sourceRoot":"","sources":["../../src/utils/resolveProjectDep.ts"],"names":[],"mappings":"AAGA,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,GAAG,EAAE,GAAG,CAAC;IACT,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb,sBAWA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withTmpPath.d.ts","sourceRoot":"","sources":["../../src/utils/withTmpPath.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAG3B,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAChC,GAAG,EAAE,IAAI,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,UAUA"}
|
|
@@ -90,7 +90,8 @@ export const MicroApp = forwardRef(
|
|
|
90
90
|
|
|
91
91
|
// 优先使用 alias 名匹配,fallback 到 name 匹配
|
|
92
92
|
const name = componentProps[appNameKeyAlias] || componentProps.name;
|
|
93
|
-
const isCurrentApp = (app: any) =>
|
|
93
|
+
const isCurrentApp = (app: any) =>
|
|
94
|
+
app[appNameKeyAlias] === name || app.name === name;
|
|
94
95
|
|
|
95
96
|
const [loading, setLoading] = useState(true);
|
|
96
97
|
const [error, setError] = useState<any>(null);
|
|
@@ -178,11 +179,16 @@ export const MicroApp = forwardRef(
|
|
|
178
179
|
if (noneMounted) {
|
|
179
180
|
if (Array.isArray(prefetch)) {
|
|
180
181
|
const specialPrefetchApps = apps.filter(
|
|
181
|
-
(app) =>
|
|
182
|
+
(app) =>
|
|
183
|
+
!isCurrentApp(app) &&
|
|
184
|
+
(prefetch.indexOf(app[appNameKeyAlias]) !== -1 ||
|
|
185
|
+
prefetch.indexOf(app.name) !== -1),
|
|
182
186
|
);
|
|
183
187
|
prefetchApps(specialPrefetchApps, configuration);
|
|
184
188
|
} else {
|
|
185
|
-
const otherNotMountedApps = apps.filter(
|
|
189
|
+
const otherNotMountedApps = apps.filter(
|
|
190
|
+
(app) => !isCurrentApp(app),
|
|
191
|
+
);
|
|
186
192
|
prefetchApps(otherNotMountedApps, configuration);
|
|
187
193
|
}
|
|
188
194
|
noneMounted = false;
|
|
@@ -73,6 +73,8 @@ export function genMount(mountElementId: string) {
|
|
|
73
73
|
await slaveRuntime.mount(props);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
const { type, ...historyOpts } = props?.history;
|
|
77
|
+
|
|
76
78
|
// 更新 clientRender 配置
|
|
77
79
|
const clientRenderOpts = {
|
|
78
80
|
// 默认开启
|
|
@@ -95,6 +97,10 @@ export function genMount(mountElementId: string) {
|
|
|
95
97
|
|
|
96
98
|
basename: props.base,
|
|
97
99
|
|
|
100
|
+
// 支持 MicroAppWithMemoHistory 需要
|
|
101
|
+
historyType: type,
|
|
102
|
+
historyOpts: historyOpts,
|
|
103
|
+
|
|
98
104
|
// 当存在同一个 umi 子应用在同一个页面被多实例渲染的场景时(比如一个页面里,同时展示了这个子应用的多个路由页面)
|
|
99
105
|
// mount 钩子会被调用多次,但是具体什么时候对应的实例开始 render 则是不定的,即它调用 applyPlugins('modifyClientRenderOpts') 的时机是不确定的
|
|
100
106
|
// 为了保证每次 applyPlugins('modifyClientRenderOpts') 调用是生成正确的 history,我们需要这里通过闭包上下文维持 mount 调用时的一些配置信息
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugins",
|
|
3
|
-
"version": "4.0.0-canary.
|
|
3
|
+
"version": "4.0.0-canary.20220718.1",
|
|
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",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@ahooksjs/use-request": "^2.0.0",
|
|
26
26
|
"@ant-design/icons": "^4.7.0",
|
|
27
27
|
"@ant-design/pro-layout": "^7.0.1-beta.20",
|
|
28
|
-
"@umijs/bundler-utils": "4.0.0-canary.
|
|
28
|
+
"@umijs/bundler-utils": "4.0.0-canary.20220718.1",
|
|
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.0-canary.
|
|
47
|
+
"umi": "4.0.0-canary.20220718.1"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|