@micro-zoe/micro-app 1.0.0-alpha.7 → 1.0.0-alpha.8
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/lib/index.d.ts +5 -3
- package/lib/index.esm.js +413 -166
- 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 +1 -1
- package/typings/global.d.ts +53 -21
package/package.json
CHANGED
package/typings/global.d.ts
CHANGED
|
@@ -13,8 +13,23 @@ declare module '@micro-app/types' {
|
|
|
13
13
|
|
|
14
14
|
type AttrsType = Map<string, string>
|
|
15
15
|
|
|
16
|
+
type RequestIdleCallbackOptions = {
|
|
17
|
+
timeout: number
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type RequestIdleCallbackInfo = {
|
|
21
|
+
readonly didTimeout: boolean
|
|
22
|
+
timeRemaining: () => number
|
|
23
|
+
}
|
|
24
|
+
|
|
16
25
|
type fiberTasks = Array<() => Promise<void>> | null
|
|
17
26
|
|
|
27
|
+
interface EffectController {
|
|
28
|
+
recordEffect(): void
|
|
29
|
+
rebuildEffect(): void
|
|
30
|
+
releaseEffect(): void
|
|
31
|
+
}
|
|
32
|
+
|
|
18
33
|
interface SandBoxStartParams {
|
|
19
34
|
umdMode: boolean
|
|
20
35
|
baseroute: string
|
|
@@ -35,12 +50,14 @@ declare module '@micro-app/types' {
|
|
|
35
50
|
microAppWindow: Window // Proxy target
|
|
36
51
|
start (startParams: SandBoxStartParams): void
|
|
37
52
|
stop (stopParams: SandBoxStopParams): void
|
|
53
|
+
releaseGlobalEffect (clearData?: boolean): void
|
|
38
54
|
// record umd snapshot before the first execution of umdHookMount
|
|
39
|
-
|
|
55
|
+
recordEffectSnapshot (): void
|
|
40
56
|
// rebuild umd snapshot before remount umd app
|
|
41
|
-
|
|
57
|
+
rebuildEffectSnapshot (): void
|
|
42
58
|
setRouteInfoForKeepAliveApp (): void
|
|
43
59
|
removeRouteInfoForKeepAliveApp (): void
|
|
60
|
+
setPreRenderState (state: boolean): void
|
|
44
61
|
}
|
|
45
62
|
|
|
46
63
|
interface SandBoxAdapter {
|
|
@@ -90,23 +107,22 @@ declare module '@micro-app/types' {
|
|
|
90
107
|
}
|
|
91
108
|
|
|
92
109
|
interface MountParam {
|
|
93
|
-
container: HTMLElement | ShadowRoot
|
|
94
|
-
inline: boolean
|
|
95
|
-
useMemoryRouter: boolean
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
esmodule: boolean
|
|
103
|
-
|
|
110
|
+
container: HTMLElement | ShadowRoot // app container
|
|
111
|
+
inline: boolean // run js in inline mode
|
|
112
|
+
useMemoryRouter: boolean // use virtual router
|
|
113
|
+
defaultPage: string // default page of virtual router
|
|
114
|
+
baseroute: string // route prefix, default is ''
|
|
115
|
+
disablePatchRequest: boolean // prevent rewrite request method of child app
|
|
116
|
+
fiber: boolean // run js in fiber mode
|
|
117
|
+
esmodule: boolean // support type='module' script
|
|
118
|
+
// hiddenRouter: boolean
|
|
104
119
|
}
|
|
105
120
|
|
|
106
121
|
interface UnmountParam {
|
|
107
|
-
destroy: boolean,
|
|
108
|
-
clearData: boolean
|
|
109
|
-
|
|
122
|
+
destroy: boolean, // completely destroy, delete cache resources
|
|
123
|
+
clearData: boolean // clear data of dateCenter
|
|
124
|
+
keepRouteState: boolean // keep route state when unmount, default is false
|
|
125
|
+
unmountcb?: CallableFunction // callback of unmount
|
|
110
126
|
}
|
|
111
127
|
|
|
112
128
|
// app instance
|
|
@@ -120,12 +136,13 @@ declare module '@micro-app/types' {
|
|
|
120
136
|
inline: boolean // whether js runs in inline script mode, default is false
|
|
121
137
|
esmodule: boolean // support esmodule in script
|
|
122
138
|
ssrUrl: string // html path in ssr mode
|
|
123
|
-
isPrefetch: boolean // whether prefetch app, default is false
|
|
124
139
|
container: HTMLElement | ShadowRoot | null // container maybe null, micro-app, shadowRoot, div(keep-alive)
|
|
125
|
-
keepRouteState: boolean // keep route state when unmount, default is false
|
|
126
140
|
umdMode: boolean // is umd mode
|
|
127
141
|
fiber: boolean // fiber mode
|
|
128
142
|
useMemoryRouter: boolean // use virtual router
|
|
143
|
+
isPrefetch: boolean // whether prefetch app, default is false
|
|
144
|
+
isPrerender: boolean
|
|
145
|
+
prefetchLevel?: number
|
|
129
146
|
// defaultPage: string // default page when mount
|
|
130
147
|
// baseroute: string // route prefix, default is ''
|
|
131
148
|
// hiddenRouter: boolean // hide router info of child from browser url
|
|
@@ -134,7 +151,7 @@ declare module '@micro-app/types' {
|
|
|
134
151
|
loadSourceCode (): void
|
|
135
152
|
|
|
136
153
|
// resource is loaded
|
|
137
|
-
onLoad (html: HTMLElement): void
|
|
154
|
+
onLoad (html: HTMLElement, defaultPage?: string, disablePatchRequest?: boolean): void
|
|
138
155
|
|
|
139
156
|
// Error loading HTML
|
|
140
157
|
onLoadError (e: Error): void
|
|
@@ -177,7 +194,7 @@ declare module '@micro-app/types' {
|
|
|
177
194
|
attributeChangedCallback (a: 'name' | 'url', o: string, n: string): void
|
|
178
195
|
}
|
|
179
196
|
|
|
180
|
-
|
|
197
|
+
interface prefetchParam {
|
|
181
198
|
name: string,
|
|
182
199
|
url: string,
|
|
183
200
|
// old config 👇
|
|
@@ -188,6 +205,9 @@ declare module '@micro-app/types' {
|
|
|
188
205
|
'disable-sandbox'?: boolean
|
|
189
206
|
inline?: boolean
|
|
190
207
|
esmodule?: boolean
|
|
208
|
+
level?: number
|
|
209
|
+
'default-page'?: string
|
|
210
|
+
'disable-patch-request'?: boolean
|
|
191
211
|
}
|
|
192
212
|
|
|
193
213
|
// prefetch params
|
|
@@ -247,6 +267,11 @@ declare module '@micro-app/types' {
|
|
|
247
267
|
}
|
|
248
268
|
}
|
|
249
269
|
|
|
270
|
+
type GetActiveAppsParam = {
|
|
271
|
+
excludeHiddenApp?: boolean,
|
|
272
|
+
excludePreRender?: boolean,
|
|
273
|
+
}
|
|
274
|
+
|
|
250
275
|
type fetchType = (url: string, options: Record<string, unknown>, appName: string | null) => Promise<string>
|
|
251
276
|
|
|
252
277
|
type globalAssetsType = {
|
|
@@ -274,6 +299,8 @@ declare module '@micro-app/types' {
|
|
|
274
299
|
esmodule?: boolean
|
|
275
300
|
ssr?: boolean
|
|
276
301
|
fiber?: boolean
|
|
302
|
+
prefetchLevel?: number
|
|
303
|
+
prefetchDelay?: number
|
|
277
304
|
}
|
|
278
305
|
|
|
279
306
|
interface OptionsType extends MicroAppConfig {
|
|
@@ -364,6 +391,11 @@ declare module '@micro-app/types' {
|
|
|
364
391
|
path: string,
|
|
365
392
|
}
|
|
366
393
|
|
|
394
|
+
type AttachAllToURLParam = {
|
|
395
|
+
includeHiddenApp?: boolean,
|
|
396
|
+
includePreRender?: boolean,
|
|
397
|
+
}
|
|
398
|
+
|
|
367
399
|
// Router API for developer
|
|
368
400
|
interface Router {
|
|
369
401
|
// current route of all apps
|
|
@@ -436,7 +468,7 @@ declare module '@micro-app/types' {
|
|
|
436
468
|
/**
|
|
437
469
|
* Attach all active app router info to browser url
|
|
438
470
|
*/
|
|
439
|
-
attachAllToURL(): void
|
|
471
|
+
attachAllToURL(options: AttachAllToURLParam): void
|
|
440
472
|
/**
|
|
441
473
|
* Record base app router, let child app control base app navigation
|
|
442
474
|
* It is global data
|