@micro-zoe/micro-app 1.0.0-alpha.0 → 1.0.0-alpha.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micro-zoe/micro-app",
3
- "version": "1.0.0-alpha.0",
3
+ "version": "1.0.0-alpha.3",
4
4
  "description": "A lightweight, efficient and powerful micro front-end framework",
5
5
  "private": false,
6
6
  "main": "lib/index.min.js",
@@ -7,6 +7,8 @@ declare module '@micro-app/types' {
7
7
 
8
8
  type microAppWindowType = Window & any
9
9
 
10
+ type appName = string
11
+
10
12
  interface SandBoxInterface {
11
13
  proxyWindow: WindowProxy
12
14
  microAppWindow: Window // Proxy target
@@ -15,7 +17,7 @@ declare module '@micro-app/types' {
15
17
  useMemoryRouter: boolean,
16
18
  defaultPage: string,
17
19
  ): void
18
- stop (keepRouteState: boolean): void
20
+ stop (keepRouteState: boolean, clearEventSource: boolean): void
19
21
  // record umd snapshot before the first execution of umdHookMount
20
22
  recordUmdSnapshot (): void
21
23
  // rebuild umd snapshot before remount umd app
@@ -24,6 +26,20 @@ declare module '@micro-app/types' {
24
26
  removeRouteInfoForKeepAliveApp (): void
25
27
  }
26
28
 
29
+ interface SandBoxAdapter {
30
+ // Variables that can only assigned to rawWindow
31
+ escapeSetterKeyList: PropertyKey[]
32
+
33
+ // Variables that can escape to rawWindow
34
+ staticEscapeProperties: PropertyKey[]
35
+
36
+ // Variables that scoped in child app
37
+ staticScopeProperties: PropertyKey[]
38
+
39
+ // adapter for react
40
+ // injectReactHRMProperty (): void
41
+ }
42
+
27
43
  type sourceLinkInfo = {
28
44
  code: string // code
29
45
  placeholder?: Comment | null // placeholder comment
@@ -61,6 +77,7 @@ declare module '@micro-app/types' {
61
77
  useMemoryRouter: boolean // whether use memoryRouter, default is true
62
78
  baseroute: string // route prefix, default is ''
63
79
  keepRouteState: boolean // keep route state when unmount, default is false
80
+ hiddenRouter: boolean // hide router info of child from browser url
64
81
  source: sourceType // sources of css, js, html
65
82
  sandBox: SandBoxInterface | null // sandbox
66
83
  umdMode: boolean // is umd mode
@@ -82,6 +99,7 @@ declare module '@micro-app/types' {
82
99
  baseroute?: string,
83
100
  keepRouteState?: boolean,
84
101
  defaultPage?: string,
102
+ hiddenRouter?: boolean
85
103
  ): void
86
104
 
87
105
  // unmount app
@@ -122,10 +140,13 @@ declare module '@micro-app/types' {
122
140
  type prefetchParam = {
123
141
  name: string,
124
142
  url: string,
143
+ // old config 👇
125
144
  disableScopecss?: boolean
126
145
  disableSandbox?: boolean
127
- disableMemoryRouter?: boolean
128
- shadowDOM?: boolean
146
+ // old config 👆
147
+ 'disable-scopecss'?: boolean
148
+ 'disable-sandbox'?: boolean
149
+ 'disable-memory-router'?: boolean
129
150
  }
130
151
 
131
152
  // prefetch params
@@ -177,13 +198,20 @@ declare module '@micro-app/types' {
177
198
 
178
199
  type OptionsType = {
179
200
  tagName?: string
180
- shadowDOM?: boolean
181
- destroy?: boolean
182
- inline?: boolean
201
+ 'shadowDOM'?: boolean
202
+ 'destroy'?: boolean
203
+ 'inline'?: boolean
204
+ // old config 👇
183
205
  disableScopecss?: boolean
184
206
  disableSandbox?: boolean
185
- disableMemoryRouter?: boolean
186
- ssr?: boolean
207
+ // old config 👆
208
+ 'disable-scopecss'?: boolean
209
+ 'disable-sandbox'?: boolean
210
+ 'disable-memory-router'?: boolean
211
+ 'keep-router-state'?: boolean
212
+ 'hidden-router'?: boolean
213
+ 'esmodule'?: boolean
214
+ 'ssr'?: boolean
187
215
  lifeCycles?: lifeCyclesType
188
216
  preFetchApps?: prefetchParamList
189
217
  plugins?: plugins
@@ -325,10 +353,38 @@ declare module '@micro-app/types' {
325
353
  * @param guard global hook for
326
354
  */
327
355
  afterEach(guard: RouterGuard): () => boolean
328
-
356
+ /**
357
+ * Add defaultPage to control the first rendered page
358
+ * @param appName app name
359
+ * @param path default page path
360
+ */
329
361
  setDefaultPage(appName: string, path: string): () => boolean
362
+ /**
363
+ * Clear data of defaultPage that set by setDefaultPage
364
+ */
330
365
  removeDefaultPage(appName: string): boolean
366
+ /**
367
+ * Get defaultPage that set by setDefaultPage
368
+ */
331
369
  getDefaultPage(key: PropertyKey): string | undefined
370
+ /**
371
+ * Attach specified active app router info to browser url
372
+ */
373
+ attachToURL(appName: string): void
374
+ /**
375
+ * Attach all active app router info to browser url
376
+ */
377
+ attachAllToURL(): void
378
+ /**
379
+ * Record base app router, let child app control base app navigation
380
+ * It is global data
381
+ * @param baseRouter router instance of base app
382
+ */
383
+ setBaseAppRouter(baseRouter: unknown): void
384
+ /**
385
+ * get baseRouter from cache
386
+ */
387
+ getBaseAppRouter(): unknown
332
388
  }
333
389
 
334
390
  // result of add/remove microApp path on browser url