@micro-zoe/micro-app 1.0.0-beta.4 → 1.0.0-beta.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 +2 -2
- package/lib/index.d.ts +4 -4
- package/lib/index.esm.js +2964 -2839
- 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 -3
- package/typings/global.d.ts +55 -32
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micro-zoe/micro-app",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.6",
|
|
4
4
|
"description": "A lightweight, efficient and powerful micro front-end framework",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "lib/index.min.js",
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
"fs-extra": "~10.0.0",
|
|
118
118
|
"gzip-size": "~6.0.0",
|
|
119
119
|
"husky": "~4.3.6",
|
|
120
|
-
"jest": "26.6.0",
|
|
120
|
+
"jest": "~26.6.0",
|
|
121
121
|
"lint-staged": "~10.5.3",
|
|
122
122
|
"live-server": "~1.2.1",
|
|
123
123
|
"node-fetch": "~2.6.1",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"react": "~17.0.2",
|
|
127
127
|
"rollup": "~2.35.1",
|
|
128
128
|
"rollup-plugin-terser": "~7.0.2",
|
|
129
|
-
"ts-jest": "26.5.6",
|
|
129
|
+
"ts-jest": "~26.5.6",
|
|
130
130
|
"typescript": "~4.1.3"
|
|
131
131
|
}
|
|
132
132
|
}
|
package/typings/global.d.ts
CHANGED
|
@@ -32,6 +32,10 @@ declare module '@micro-app/types' {
|
|
|
32
32
|
args: any[],
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
interface MicroAppElementTagNameMap extends HTMLElementTagNameMap {
|
|
36
|
+
'micro-app': any,
|
|
37
|
+
}
|
|
38
|
+
|
|
35
39
|
interface CommonEffectHook {
|
|
36
40
|
reset(): void
|
|
37
41
|
record(): void
|
|
@@ -42,7 +46,6 @@ declare module '@micro-app/types' {
|
|
|
42
46
|
interface SandBoxStartParams {
|
|
43
47
|
umdMode: boolean
|
|
44
48
|
baseroute: string
|
|
45
|
-
useMemoryRouter: boolean
|
|
46
49
|
defaultPage: string
|
|
47
50
|
disablePatchRequest: boolean
|
|
48
51
|
}
|
|
@@ -52,7 +55,6 @@ declare module '@micro-app/types' {
|
|
|
52
55
|
keepRouteState: boolean
|
|
53
56
|
destroy: boolean
|
|
54
57
|
clearData: boolean
|
|
55
|
-
useMemoryRouter: boolean
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
interface releaseGlobalEffectParams {
|
|
@@ -63,8 +65,31 @@ declare module '@micro-app/types' {
|
|
|
63
65
|
destroy?: boolean,
|
|
64
66
|
}
|
|
65
67
|
|
|
68
|
+
interface SandBoxAdapter {
|
|
69
|
+
// Variables that can only assigned to rawWindow
|
|
70
|
+
escapeSetterKeyList: PropertyKey[]
|
|
71
|
+
|
|
72
|
+
// Variables that can escape to rawWindow
|
|
73
|
+
staticEscapeProperties: PropertyKey[]
|
|
74
|
+
|
|
75
|
+
// Variables that scoped in child app
|
|
76
|
+
staticScopeProperties: PropertyKey[]
|
|
77
|
+
}
|
|
78
|
+
|
|
66
79
|
interface WithSandBoxInterface {
|
|
80
|
+
// adapter for sandbox
|
|
81
|
+
adapter: SandBoxAdapter
|
|
82
|
+
// Scoped global Properties(Properties that can only get and set in microAppWindow, will not escape to rawWindow)
|
|
83
|
+
scopeProperties: PropertyKey[]
|
|
84
|
+
// Properties that can be escape to rawWindow
|
|
85
|
+
escapeProperties: PropertyKey[]
|
|
86
|
+
// Properties escape to rawWindow, cleared when unmount
|
|
87
|
+
escapeKeys: Set<PropertyKey>
|
|
88
|
+
// Properties newly added to microAppWindow
|
|
89
|
+
injectedKeys: Set<PropertyKey>
|
|
90
|
+
// proxy(microWindow)
|
|
67
91
|
proxyWindow: WindowProxy
|
|
92
|
+
// child window
|
|
68
93
|
microAppWindow: Window // Proxy target
|
|
69
94
|
start (startParams: SandBoxStartParams): void
|
|
70
95
|
stop (stopParams: SandBoxStopParams): void
|
|
@@ -85,20 +110,6 @@ declare module '@micro-app/types' {
|
|
|
85
110
|
deleteIframeElement? (): void
|
|
86
111
|
}
|
|
87
112
|
|
|
88
|
-
interface SandBoxAdapter {
|
|
89
|
-
// Variables that can only assigned to rawWindow
|
|
90
|
-
escapeSetterKeyList: PropertyKey[]
|
|
91
|
-
|
|
92
|
-
// Variables that can escape to rawWindow
|
|
93
|
-
staticEscapeProperties: PropertyKey[]
|
|
94
|
-
|
|
95
|
-
// Variables that scoped in child app
|
|
96
|
-
staticScopeProperties: PropertyKey[]
|
|
97
|
-
|
|
98
|
-
// adapter for react
|
|
99
|
-
// injectReactHMRProperty (): void
|
|
100
|
-
}
|
|
101
|
-
|
|
102
113
|
type LinkSourceInfo = {
|
|
103
114
|
code: string, // source code
|
|
104
115
|
appSpace: Record<string, {
|
|
@@ -134,7 +145,7 @@ declare module '@micro-app/types' {
|
|
|
134
145
|
interface MountParam {
|
|
135
146
|
container: HTMLElement | ShadowRoot // app container
|
|
136
147
|
inline: boolean // run js in inline mode
|
|
137
|
-
|
|
148
|
+
routerMode: string // virtual router mode
|
|
138
149
|
defaultPage: string // default page of virtual router
|
|
139
150
|
baseroute: string // route prefix, default is ''
|
|
140
151
|
disablePatchRequest: boolean // prevent rewrite request method of child app
|
|
@@ -164,7 +175,7 @@ declare module '@micro-app/types' {
|
|
|
164
175
|
container: HTMLElement | ShadowRoot | null // container maybe null, micro-app, shadowRoot, div(keep-alive)
|
|
165
176
|
umdMode: boolean // is umd mode
|
|
166
177
|
fiber: boolean // fiber mode
|
|
167
|
-
|
|
178
|
+
routerMode: string // virtual router mode
|
|
168
179
|
isPrefetch: boolean // whether prefetch app, default is false
|
|
169
180
|
isPrerender: boolean
|
|
170
181
|
prefetchLevel?: number
|
|
@@ -212,20 +223,6 @@ declare module '@micro-app/types' {
|
|
|
212
223
|
showKeepAliveApp (container: HTMLElement | ShadowRoot): void
|
|
213
224
|
}
|
|
214
225
|
|
|
215
|
-
interface MicroAppElementType {
|
|
216
|
-
appName: AttrType // app name
|
|
217
|
-
appUrl: AttrType // app url
|
|
218
|
-
|
|
219
|
-
// Hooks for element append to documents
|
|
220
|
-
connectedCallback (): void
|
|
221
|
-
|
|
222
|
-
// Hooks for element delete from documents
|
|
223
|
-
disconnectedCallback (): void
|
|
224
|
-
|
|
225
|
-
// Hooks for element attributes change
|
|
226
|
-
attributeChangedCallback (a: 'name' | 'url', o: string, n: string): void
|
|
227
|
-
}
|
|
228
|
-
|
|
229
226
|
interface prefetchParam {
|
|
230
227
|
name: string,
|
|
231
228
|
url: string,
|
|
@@ -240,6 +237,10 @@ declare module '@micro-app/types' {
|
|
|
240
237
|
level?: number
|
|
241
238
|
'default-page'?: string
|
|
242
239
|
'disable-patch-request'?: boolean
|
|
240
|
+
// prerender only 👇
|
|
241
|
+
'router-mode'?: string
|
|
242
|
+
baseroute?: string
|
|
243
|
+
// prerender only 👆
|
|
243
244
|
}
|
|
244
245
|
|
|
245
246
|
// prefetch params
|
|
@@ -328,6 +329,7 @@ declare module '@micro-app/types' {
|
|
|
328
329
|
'hidden-router'?: boolean
|
|
329
330
|
'keep-alive'?: boolean
|
|
330
331
|
'clear-data'?: boolean
|
|
332
|
+
'router-mode'?: string
|
|
331
333
|
iframe?: boolean
|
|
332
334
|
ssr?: boolean
|
|
333
335
|
fiber?: boolean
|
|
@@ -355,6 +357,27 @@ declare module '@micro-app/types' {
|
|
|
355
357
|
start(options?: OptionsType): void
|
|
356
358
|
}
|
|
357
359
|
|
|
360
|
+
interface MicroAppElementType {
|
|
361
|
+
appName: AttrType // app name
|
|
362
|
+
appUrl: AttrType // app url
|
|
363
|
+
|
|
364
|
+
// Hooks for element append to documents
|
|
365
|
+
connectedCallback (): void
|
|
366
|
+
|
|
367
|
+
// Hooks for element delete from documents
|
|
368
|
+
disconnectedCallback (): void
|
|
369
|
+
|
|
370
|
+
// Hooks for element attributes change
|
|
371
|
+
attributeChangedCallback (a: 'name' | 'url', o: string, n: string): void
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Get configuration
|
|
375
|
+
* Global setting is lowest priority
|
|
376
|
+
* @param name Configuration item name
|
|
377
|
+
*/
|
|
378
|
+
getDisposeResult <T extends keyof OptionsType> (name: T): boolean
|
|
379
|
+
}
|
|
380
|
+
|
|
358
381
|
// special CallableFunction for interact
|
|
359
382
|
type CallableFunctionForInteract = CallableFunction & { __APP_NAME__?: string, __AUTO_TRIGGER__?: boolean }
|
|
360
383
|
|