@micro-zoe/micro-app 1.0.0-beta.5 → 1.0.0-beta.7
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 +3 -3
- package/lib/index.esm.js +3016 -2885
- 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 +62 -40
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.7",
|
|
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
|
@@ -46,7 +46,6 @@ declare module '@micro-app/types' {
|
|
|
46
46
|
interface SandBoxStartParams {
|
|
47
47
|
umdMode: boolean
|
|
48
48
|
baseroute: string
|
|
49
|
-
useMemoryRouter: boolean
|
|
50
49
|
defaultPage: string
|
|
51
50
|
disablePatchRequest: boolean
|
|
52
51
|
}
|
|
@@ -56,7 +55,6 @@ declare module '@micro-app/types' {
|
|
|
56
55
|
keepRouteState: boolean
|
|
57
56
|
destroy: boolean
|
|
58
57
|
clearData: boolean
|
|
59
|
-
useMemoryRouter: boolean
|
|
60
58
|
}
|
|
61
59
|
|
|
62
60
|
interface releaseGlobalEffectParams {
|
|
@@ -67,8 +65,31 @@ declare module '@micro-app/types' {
|
|
|
67
65
|
destroy?: boolean,
|
|
68
66
|
}
|
|
69
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
|
+
|
|
70
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)
|
|
71
91
|
proxyWindow: WindowProxy
|
|
92
|
+
// child window
|
|
72
93
|
microAppWindow: Window // Proxy target
|
|
73
94
|
start (startParams: SandBoxStartParams): void
|
|
74
95
|
stop (stopParams: SandBoxStopParams): void
|
|
@@ -89,20 +110,6 @@ declare module '@micro-app/types' {
|
|
|
89
110
|
deleteIframeElement? (): void
|
|
90
111
|
}
|
|
91
112
|
|
|
92
|
-
interface SandBoxAdapter {
|
|
93
|
-
// Variables that can only assigned to rawWindow
|
|
94
|
-
escapeSetterKeyList: PropertyKey[]
|
|
95
|
-
|
|
96
|
-
// Variables that can escape to rawWindow
|
|
97
|
-
staticEscapeProperties: PropertyKey[]
|
|
98
|
-
|
|
99
|
-
// Variables that scoped in child app
|
|
100
|
-
staticScopeProperties: PropertyKey[]
|
|
101
|
-
|
|
102
|
-
// adapter for react
|
|
103
|
-
// injectReactHMRProperty (): void
|
|
104
|
-
}
|
|
105
|
-
|
|
106
113
|
type LinkSourceInfo = {
|
|
107
114
|
code: string, // source code
|
|
108
115
|
appSpace: Record<string, {
|
|
@@ -138,7 +145,7 @@ declare module '@micro-app/types' {
|
|
|
138
145
|
interface MountParam {
|
|
139
146
|
container: HTMLElement | ShadowRoot // app container
|
|
140
147
|
inline: boolean // run js in inline mode
|
|
141
|
-
|
|
148
|
+
routerMode: string // virtual router mode
|
|
142
149
|
defaultPage: string // default page of virtual router
|
|
143
150
|
baseroute: string // route prefix, default is ''
|
|
144
151
|
disablePatchRequest: boolean // prevent rewrite request method of child app
|
|
@@ -168,7 +175,7 @@ declare module '@micro-app/types' {
|
|
|
168
175
|
container: HTMLElement | ShadowRoot | null // container maybe null, micro-app, shadowRoot, div(keep-alive)
|
|
169
176
|
umdMode: boolean // is umd mode
|
|
170
177
|
fiber: boolean // fiber mode
|
|
171
|
-
|
|
178
|
+
routerMode: string // virtual router mode
|
|
172
179
|
isPrefetch: boolean // whether prefetch app, default is false
|
|
173
180
|
isPrerender: boolean
|
|
174
181
|
prefetchLevel?: number
|
|
@@ -194,6 +201,9 @@ declare module '@micro-app/types' {
|
|
|
194
201
|
// app rendering error
|
|
195
202
|
onerror (e: Error): void
|
|
196
203
|
|
|
204
|
+
// set app state
|
|
205
|
+
setAppState (state: string): void
|
|
206
|
+
|
|
197
207
|
// get app state
|
|
198
208
|
getAppState (): string
|
|
199
209
|
|
|
@@ -216,20 +226,6 @@ declare module '@micro-app/types' {
|
|
|
216
226
|
showKeepAliveApp (container: HTMLElement | ShadowRoot): void
|
|
217
227
|
}
|
|
218
228
|
|
|
219
|
-
interface MicroAppElementType {
|
|
220
|
-
appName: AttrType // app name
|
|
221
|
-
appUrl: AttrType // app url
|
|
222
|
-
|
|
223
|
-
// Hooks for element append to documents
|
|
224
|
-
connectedCallback (): void
|
|
225
|
-
|
|
226
|
-
// Hooks for element delete from documents
|
|
227
|
-
disconnectedCallback (): void
|
|
228
|
-
|
|
229
|
-
// Hooks for element attributes change
|
|
230
|
-
attributeChangedCallback (a: 'name' | 'url', o: string, n: string): void
|
|
231
|
-
}
|
|
232
|
-
|
|
233
229
|
interface prefetchParam {
|
|
234
230
|
name: string,
|
|
235
231
|
url: string,
|
|
@@ -244,6 +240,10 @@ declare module '@micro-app/types' {
|
|
|
244
240
|
level?: number
|
|
245
241
|
'default-page'?: string
|
|
246
242
|
'disable-patch-request'?: boolean
|
|
243
|
+
// prerender only 👇
|
|
244
|
+
'router-mode'?: string
|
|
245
|
+
baseroute?: string
|
|
246
|
+
// prerender only 👆
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
// prefetch params
|
|
@@ -251,14 +251,14 @@ declare module '@micro-app/types' {
|
|
|
251
251
|
|
|
252
252
|
// lifeCycles
|
|
253
253
|
interface lifeCyclesType {
|
|
254
|
-
created(e: CustomEvent): void
|
|
255
|
-
beforemount(e: CustomEvent): void
|
|
256
|
-
mounted(e: CustomEvent): void
|
|
257
|
-
unmount(e: CustomEvent): void
|
|
258
|
-
error(e: CustomEvent): void
|
|
259
|
-
beforeshow(e: CustomEvent): void
|
|
260
|
-
aftershow(e: CustomEvent): void
|
|
261
|
-
afterhidden(e: CustomEvent): void
|
|
254
|
+
created?(e: CustomEvent): void
|
|
255
|
+
beforemount?(e: CustomEvent): void
|
|
256
|
+
mounted?(e: CustomEvent): void
|
|
257
|
+
unmount?(e: CustomEvent): void
|
|
258
|
+
error?(e: CustomEvent): void
|
|
259
|
+
beforeshow?(e: CustomEvent): void
|
|
260
|
+
aftershow?(e: CustomEvent): void
|
|
261
|
+
afterhidden?(e: CustomEvent): void
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
type AssetsChecker = (url: string) => boolean;
|
|
@@ -332,6 +332,7 @@ declare module '@micro-app/types' {
|
|
|
332
332
|
'hidden-router'?: boolean
|
|
333
333
|
'keep-alive'?: boolean
|
|
334
334
|
'clear-data'?: boolean
|
|
335
|
+
'router-mode'?: string
|
|
335
336
|
iframe?: boolean
|
|
336
337
|
ssr?: boolean
|
|
337
338
|
fiber?: boolean
|
|
@@ -359,6 +360,27 @@ declare module '@micro-app/types' {
|
|
|
359
360
|
start(options?: OptionsType): void
|
|
360
361
|
}
|
|
361
362
|
|
|
363
|
+
interface MicroAppElementType {
|
|
364
|
+
appName: AttrType // app name
|
|
365
|
+
appUrl: AttrType // app url
|
|
366
|
+
|
|
367
|
+
// Hooks for element append to documents
|
|
368
|
+
connectedCallback (): void
|
|
369
|
+
|
|
370
|
+
// Hooks for element delete from documents
|
|
371
|
+
disconnectedCallback (): void
|
|
372
|
+
|
|
373
|
+
// Hooks for element attributes change
|
|
374
|
+
attributeChangedCallback (a: 'name' | 'url', o: string, n: string): void
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Get configuration
|
|
378
|
+
* Global setting is lowest priority
|
|
379
|
+
* @param name Configuration item name
|
|
380
|
+
*/
|
|
381
|
+
getDisposeResult <T extends keyof OptionsType> (name: T): boolean
|
|
382
|
+
}
|
|
383
|
+
|
|
362
384
|
// special CallableFunction for interact
|
|
363
385
|
type CallableFunctionForInteract = CallableFunction & { __APP_NAME__?: string, __AUTO_TRIGGER__?: boolean }
|
|
364
386
|
|