@umijs/plugins 4.0.0-canary.20220429.3 → 4.0.0-canary.20220506.2

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.
Files changed (75) hide show
  1. package/dist/access.d.ts +3 -0
  2. package/dist/access.d.ts.map +1 -0
  3. package/dist/access.js +139 -0
  4. package/dist/analytics.d.ts +3 -0
  5. package/dist/analytics.d.ts.map +1 -0
  6. package/dist/analytics.js +67 -0
  7. package/dist/antd.d.ts +3 -0
  8. package/dist/antd.d.ts.map +1 -0
  9. package/dist/antd.js +137 -0
  10. package/dist/dva.d.ts +6 -0
  11. package/dist/dva.d.ts.map +1 -0
  12. package/dist/dva.js +198 -0
  13. package/dist/icons.d.ts +3 -0
  14. package/dist/icons.d.ts.map +1 -0
  15. package/dist/icons.js +5 -0
  16. package/dist/initial-state.d.ts +3 -0
  17. package/dist/initial-state.d.ts.map +1 -0
  18. package/dist/initial-state.js +116 -0
  19. package/dist/layout.d.ts +3 -0
  20. package/dist/layout.d.ts.map +1 -0
  21. package/dist/layout.js +538 -0
  22. package/dist/locale.d.ts +4 -0
  23. package/dist/locale.d.ts.map +1 -0
  24. package/dist/locale.js +199 -0
  25. package/dist/model.d.ts +3 -0
  26. package/dist/model.d.ts.map +1 -0
  27. package/dist/model.js +101 -0
  28. package/dist/moment2dayjs.d.ts +3 -0
  29. package/dist/moment2dayjs.d.ts.map +1 -0
  30. package/dist/moment2dayjs.js +96 -0
  31. package/dist/qiankun/constants.d.ts +5 -0
  32. package/dist/qiankun/constants.d.ts.map +1 -0
  33. package/dist/qiankun/constants.js +8 -0
  34. package/dist/qiankun/master.d.ts +6 -0
  35. package/dist/qiankun/master.d.ts.map +1 -0
  36. package/dist/qiankun/master.js +134 -0
  37. package/dist/qiankun/slave.d.ts +3 -0
  38. package/dist/qiankun/slave.d.ts.map +1 -0
  39. package/dist/qiankun/slave.js +164 -0
  40. package/dist/qiankun.d.ts +3 -0
  41. package/dist/qiankun.d.ts.map +1 -0
  42. package/dist/qiankun.js +19 -0
  43. package/dist/request.d.ts +3 -0
  44. package/dist/request.d.ts.map +1 -0
  45. package/dist/request.js +311 -0
  46. package/dist/tailwindcss.d.ts +3 -0
  47. package/dist/tailwindcss.d.ts.map +1 -0
  48. package/dist/tailwindcss.js +40 -0
  49. package/dist/unocss.d.ts +3 -0
  50. package/dist/unocss.d.ts.map +1 -0
  51. package/dist/unocss.js +39 -0
  52. package/dist/utils/astUtils.d.ts +3 -0
  53. package/dist/utils/astUtils.d.ts.map +1 -0
  54. package/dist/utils/astUtils.js +38 -0
  55. package/dist/utils/localeUtils.d.ts +33 -0
  56. package/dist/utils/localeUtils.d.ts.map +1 -0
  57. package/dist/utils/localeUtils.js +126 -0
  58. package/dist/utils/modelUtils.d.ts +39 -0
  59. package/dist/utils/modelUtils.d.ts.map +1 -0
  60. package/dist/utils/modelUtils.js +231 -0
  61. package/dist/utils/resolveProjectDep.d.ts +5 -0
  62. package/dist/utils/resolveProjectDep.d.ts.map +1 -0
  63. package/dist/utils/resolveProjectDep.js +15 -0
  64. package/dist/utils/withTmpPath.d.ts +6 -0
  65. package/dist/utils/withTmpPath.d.ts.map +1 -0
  66. package/dist/utils/withTmpPath.js +11 -0
  67. package/libs/qiankun/master/MicroApp.tsx +7 -0
  68. package/libs/qiankun/master/common.ts +13 -10
  69. package/libs/qiankun/master/getMicroAppRouteComponent.tsx.tpl +5 -5
  70. package/libs/qiankun/master/masterRuntimePlugin.tsx +5 -5
  71. package/libs/qiankun/slave/connectMaster.tsx +0 -1
  72. package/libs/qiankun/slave/lifecycles.ts +6 -8
  73. package/libs/qiankun/slave/qiankunModel.ts +0 -1
  74. package/libs/qiankun/slave/slaveRuntimePlugin.ts +9 -15
  75. package/package.json +3 -3
@@ -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 clientRenderOptsStack: any[] = [];
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?.container?.querySelector(`#${mountElementId}`) ||
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
- clientRenderOptsStack.push(clientRenderOpts);
112
+ contextOptsStack.push(clientRenderOpts);
115
113
  }
116
114
 
117
115
  // 第一次 mount defer 被 resolve 后umi 会自动触发 render,非第一次 mount 则需手动触发
@@ -1,5 +1,4 @@
1
1
  // @ts-nocheck
2
- /* eslint-disable */
3
2
  import { useState } from 'react';
4
3
 
5
4
  let initState: any;
@@ -1,21 +1,15 @@
1
1
  // @ts-nocheck
2
- /* eslint-disable */
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
- // export function modifyClientRenderOpts(memo: any) {
10
- // // 每次应用 render 的时候会调 modifyClientRenderOpts,这时尝试从队列中取 render 的配置
11
- // const clientRenderOpts = clientRenderOptsStack.shift();
12
- // if (clientRenderOpts) {
13
- // const history = clientRenderOpts.getHistory();
14
- // delete clientRenderOpts.getHistory;
15
- // clientRenderOpts.history = history;
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-canary.20220429.3",
3
+ "version": "4.0.0-canary.20220506.2",
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",
@@ -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": "^6.35.1",
28
- "@umijs/bundler-utils": "4.0.0-canary.20220429.3",
28
+ "@umijs/bundler-utils": "4.0.0-canary.20220506.2",
29
29
  "antd-dayjs-webpack-plugin": "^1.0.6",
30
30
  "axios": "^0.26.1",
31
31
  "babel-plugin-import": "^1.13.3",
@@ -44,7 +44,7 @@
44
44
  "warning": "^4.0.3"
45
45
  },
46
46
  "devDependencies": {
47
- "umi": "4.0.0-canary.20220429.3"
47
+ "umi": "4.0.0-canary.20220506.2"
48
48
  },
49
49
  "publishConfig": {
50
50
  "access": "public"