@micro-zoe/micro-app 0.3.3 → 0.4.0

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <p align="center">
2
2
  <a href="https://micro-zoe.github.io/micro-app/">
3
- <img src="https://cangdu.org/micro-app/_media/logo.png" alt="logo" width="200"/>
3
+ <img src="https://zeroing.jd.com/micro-app/media/logo.png" alt="logo" width="200"/>
4
4
  </a>
5
5
  </p>
6
6
 
@@ -129,8 +129,6 @@ More detailed configuration can be viewed [Documentation](https://micro-zoe.gith
129
129
  # 🤝 Contribution
130
130
  If you're interested in this project, you're welcome to mention pull request, and also welcome your "Star" ^_^
131
131
 
132
- If you are using it, please [tell us](https://github.com/micro-zoe/micro-app/issues/35)
133
-
134
132
  ### development
135
133
  1、Clone
136
134
  ```
package/README.zh-cn.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <p align="center">
2
2
  <a href="https://micro-zoe.github.io/micro-app/">
3
- <img src="https://cangdu.org/micro-app/_media/logo.png" alt="logo" width="180"/>
3
+ <img src="https://zeroing.jd.com/micro-app/media/logo.png" alt="logo" width="200"/>
4
4
  </a>
5
5
  </p>
6
6
 
@@ -62,7 +62,7 @@ Vue.use(VueRouter)
62
62
 
63
63
  const routes = [
64
64
  {
65
- // 👇 非严格匹配,/my-page/xxx 都将匹配到 MyPage 组件
65
+ // 👇 非严格匹配,/my-page/xxx 都将匹配到 MyPage 页面
66
66
  path: '/my-page/*',
67
67
  name: 'my-page',
68
68
  component: MyPage,
@@ -72,7 +72,7 @@ const routes = [
72
72
  export default routes
73
73
  ```
74
74
 
75
- 4、在`my-page`页面中使用组件
75
+ 4、在`MyPage`页面中嵌入微前端应用
76
76
  ```html
77
77
  <!-- my-page.vue -->
78
78
  <template>
@@ -89,7 +89,7 @@ export default routes
89
89
  ## 子应用
90
90
  > 子应用以react框架为例
91
91
 
92
- 1、添加路由前缀(如果基座应用是history路由,子应用是hash路由,不需要设置路由前缀,这一步可以省略)
92
+ 1、设置基础路由(如果基座应用是history路由,子应用是hash路由,不需要设置基础路由,这一步可以省略)
93
93
 
94
94
  ```js
95
95
  // router.js
@@ -97,7 +97,7 @@ import { BrowserRouter, Switch, Route } from 'react-router-dom'
97
97
 
98
98
  export default function AppRoute () {
99
99
  return (
100
- // 👇 添加路由前缀,子应用可以通过window.__MICRO_APP_BASE_ROUTE__获取基座应用下发的baseroute
100
+ // 👇 设置基础路由,子应用可以通过window.__MICRO_APP_BASE_ROUTE__获取基座应用下发的baseroute
101
101
  <BrowserRouter basename={window.__MICRO_APP_BASE_ROUTE__ || '/'}>
102
102
  <Switch>
103
103
  ...
@@ -127,8 +127,6 @@ devServer: {
127
127
  # 🤝 参与共建
128
128
  如果您对这个项目感兴趣,欢迎提 pull request,也欢迎 "Star" 支持一下 ^_^
129
129
 
130
- 如果您正在使用,请务必[告诉我们](https://github.com/micro-zoe/micro-app/issues/35)
131
-
132
130
  ### 本地运行
133
131
  1、克隆项目
134
132
  ```
package/lib/index.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  declare module '@micro-zoe/micro-app' {
7
7
  export { default as preFetch } from '@micro-zoe/micro-app/prefetch';
8
8
  export { default } from '@micro-zoe/micro-app/micro_app';
9
- export { removeDomScope, pureCreateElement, version } from '@micro-zoe/micro-app/libs/utils';
9
+ export { removeDomScope, pureCreateElement, version, setCurrentAppName } from '@micro-zoe/micro-app/libs/utils';
10
10
  }
11
11
 
12
12
  declare module '@micro-zoe/micro-app/prefetch' {
@@ -59,24 +59,9 @@ declare module '@micro-zoe/micro-app/micro_app' {
59
59
 
60
60
  declare module '@micro-zoe/micro-app/libs/utils' {
61
61
  import type { Func } from '@micro-app/types';
62
- type RequestIdleCallbackOptions = {
63
- timeout: number;
64
- };
65
- type RequestIdleCallbackInfo = {
66
- readonly didTimeout: boolean;
67
- timeRemaining: () => number;
68
- };
69
- global {
70
- interface Window {
71
- requestIdleCallback(callback: (info: RequestIdleCallbackInfo) => void, opts?: RequestIdleCallbackOptions): number;
72
- _babelPolyfill: boolean;
73
- proxyWindow: WindowProxy;
74
- __MICRO_APP_ENVIRONMENT__: boolean;
75
- }
76
- }
77
- export const rawWindow: any;
78
- export const rawDocument: any;
79
62
  export const version = "__VERSION__";
63
+ export const isBrowser: boolean;
64
+ export const globalThis: Window;
80
65
  /**
81
66
  * format error log
82
67
  * @param msg message
@@ -131,7 +116,12 @@ declare module '@micro-zoe/micro-app/libs/utils' {
131
116
  export function isSupportModuleScript(): boolean;
132
117
  export function createNonceStr(): string;
133
118
  export function unique(array: any[]): any[];
134
- export const requestIdleCallback: (callback: (info: RequestIdleCallbackInfo) => void, opts?: RequestIdleCallbackOptions | undefined) => number;
119
+ export const requestIdleCallback: (callback: (info: {
120
+ readonly didTimeout: boolean;
121
+ timeRemaining: () => number;
122
+ }) => void, opts?: {
123
+ timeout: number;
124
+ } | undefined) => number;
135
125
  export function setCurrentAppName(appName: string | null): void;
136
126
  export function getCurrentAppName(): string | null;
137
127
  export function removeDomScope(): void;
@@ -147,7 +137,6 @@ declare module '@micro-zoe/micro-app/libs/utils' {
147
137
  * @param target Accept cloned elements
148
138
  */
149
139
  export function cloneNode<T extends Element, Q extends Element>(origin: T, target: Q): void;
150
- export {};
151
140
  }
152
141
 
153
142
  declare module '@micro-zoe/micro-app/interact' {