@micro-zoe/micro-app 1.0.0-alpha.3 → 1.0.0-alpha.6
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 +0 -4
- package/README.zh-cn.md +1 -1
- package/lib/index.d.ts +26 -15
- package/lib/index.esm.js +1103 -482
- package/lib/index.esm.js.map +1 -1
- package/lib/index.min.js +1 -1
- package/lib/index.min.js.map +1 -1
- package/lib/index.umd.js +1 -1
- package/lib/index.umd.js.map +1 -1
- package/package.json +3 -1
- package/typings/global.d.ts +117 -67
package/README.md
CHANGED
|
@@ -35,10 +35,6 @@ It is the lowest cost framework for accessing micro front-end, and provides a se
|
|
|
35
35
|
micro-app has no restrictions on the front-end framework, and any framework can be used as a base application to embed any type of micro application of the framework.
|
|
36
36
|
|
|
37
37
|
# How to use
|
|
38
|
-
The micro front end is divided into a base application (also called main application) and a micro application.
|
|
39
|
-
|
|
40
|
-
Here is a common example: the base application uses the Vue framework, uses history routing, the micro application uses the react framework, and uses hash routing. We list the modifications that need to be made by the base application and the micro application, and introduce the use of micro-app in detail.
|
|
41
|
-
|
|
42
38
|
## base application
|
|
43
39
|
**1、Install**
|
|
44
40
|
```bash
|
package/README.zh-cn.md
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
[English](https://github.com/micro-zoe/micro-app)|简体中文|[官网文档](https://micro-zoe.github.io/micro-app/)|[讨论组](https://github.com/micro-zoe/micro-app/discussions)|[聊天室](https://gitter.im/microzoe/micro-app)
|
|
29
29
|
|
|
30
30
|
# 📖简介
|
|
31
|
-
micro-app是京东零售推出的一款微前端框架,它基于类WebComponent进行渲染,从组件化的思维实现微前端,旨在降低上手难度、提升工作效率。它是目前接入微前端成本最低的框架,并且提供了JS
|
|
31
|
+
micro-app是京东零售推出的一款微前端框架,它基于类WebComponent进行渲染,从组件化的思维实现微前端,旨在降低上手难度、提升工作效率。它是目前接入微前端成本最低的框架,并且提供了JS沙箱、样式隔离、元素隔离、预加载、虚拟路由系统、插件系统、数据通信等一系列完善的功能。
|
|
32
32
|
|
|
33
33
|
micro-app与技术栈无关,对前端框架没有限制,任何框架都可以作为基座应用嵌入任何类型的子应用。
|
|
34
34
|
|
package/lib/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ declare module '@micro-zoe/micro-app' {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
declare module '@micro-zoe/micro-app/micro_app' {
|
|
14
|
-
import type { OptionsType, MicroAppConfigType,
|
|
14
|
+
import type { OptionsType, MicroAppConfigType, Router, appName } from '@micro-app/types';
|
|
15
15
|
import preFetch from '@micro-zoe/micro-app/prefetch';
|
|
16
16
|
import { EventCenterForBaseApp } from '@micro-zoe/micro-app/interact';
|
|
17
17
|
/**
|
|
@@ -35,19 +35,7 @@ declare module '@micro-zoe/micro-app/micro_app' {
|
|
|
35
35
|
export function unmountAllApps(options?: unmountAppOptions): Promise<void>;
|
|
36
36
|
export class MicroApp extends EventCenterForBaseApp implements MicroAppConfigType {
|
|
37
37
|
tagName: string;
|
|
38
|
-
|
|
39
|
-
destroy?: boolean;
|
|
40
|
-
inline?: boolean;
|
|
41
|
-
'disable-scopecss'?: boolean;
|
|
42
|
-
'disable-sandbox'?: boolean;
|
|
43
|
-
'disable-memory-router'?: boolean;
|
|
44
|
-
'keep-router-state'?: boolean;
|
|
45
|
-
'hidden-router'?: boolean;
|
|
46
|
-
esmodule?: boolean;
|
|
47
|
-
ssr?: boolean;
|
|
48
|
-
lifeCycles?: lifeCyclesType;
|
|
49
|
-
plugins?: plugins;
|
|
50
|
-
fetch?: fetchType;
|
|
38
|
+
options: OptionsType;
|
|
51
39
|
preFetch: typeof preFetch;
|
|
52
40
|
router: Router;
|
|
53
41
|
start(options?: OptionsType): void;
|
|
@@ -83,7 +71,7 @@ declare module '@micro-zoe/micro-app/prefetch' {
|
|
|
83
71
|
}
|
|
84
72
|
|
|
85
73
|
declare module '@micro-zoe/micro-app/libs/utils' {
|
|
86
|
-
import type { Func, LocationQueryObject, MicroLocation } from '@micro-app/types';
|
|
74
|
+
import type { Func, LocationQueryObject, MicroLocation, AttrsType, fiberTasks } from '@micro-app/types';
|
|
87
75
|
export const version = "__MICRO_APP_VERSION__";
|
|
88
76
|
export const isBrowser: boolean;
|
|
89
77
|
export const globalThis: any;
|
|
@@ -186,6 +174,11 @@ declare module '@micro-zoe/micro-app/libs/utils' {
|
|
|
186
174
|
export function createNonceSrc(): string;
|
|
187
175
|
export function unique(array: any[]): any[];
|
|
188
176
|
export const requestIdleCallback: any;
|
|
177
|
+
/**
|
|
178
|
+
* Wrap requestIdleCallback with promise
|
|
179
|
+
* Exec callback when browser idle
|
|
180
|
+
*/
|
|
181
|
+
export function promiseRequestIdle(callback: CallableFunction): Promise<void>;
|
|
189
182
|
export function setCurrentAppName(appName: string | null): void;
|
|
190
183
|
export function throttleDeferForSetAppName(appName: string): void;
|
|
191
184
|
export function getCurrentAppName(): string | null;
|
|
@@ -241,6 +234,24 @@ declare module '@micro-zoe/micro-app/libs/utils' {
|
|
|
241
234
|
get: (key: PropertyKey) => T | undefined;
|
|
242
235
|
delete: (key: PropertyKey) => boolean;
|
|
243
236
|
};
|
|
237
|
+
export function getAttributes(element: Element): AttrsType;
|
|
238
|
+
/**
|
|
239
|
+
* if fiberTasks exist, wrap callback with promiseRequestIdle
|
|
240
|
+
* if not, execute callback
|
|
241
|
+
* @param fiberTasks fiber task list
|
|
242
|
+
* @param callback action callback
|
|
243
|
+
*/
|
|
244
|
+
export function injectFiberTask(fiberTasks: fiberTasks, callback: CallableFunction): void;
|
|
245
|
+
/**
|
|
246
|
+
* serial exec fiber task of link, style, script
|
|
247
|
+
* @param tasks task array or null
|
|
248
|
+
*/
|
|
249
|
+
export function serialExecFiberTasks(tasks: fiberTasks): Promise<void> | null;
|
|
250
|
+
/**
|
|
251
|
+
* inline script start with inline-xxx
|
|
252
|
+
* @param address source address
|
|
253
|
+
*/
|
|
254
|
+
export function isInlineScript(address: string): boolean;
|
|
244
255
|
}
|
|
245
256
|
|
|
246
257
|
declare module '@micro-zoe/micro-app/interact' {
|