@micro-zoe/micro-app 1.0.0-beta.5 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micro-zoe/micro-app",
3
- "version": "1.0.0-beta.5",
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
  }
@@ -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
- useMemoryRouter: boolean // use virtual router
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
- useMemoryRouter: boolean // use virtual router
178
+ routerMode: string // virtual router mode
172
179
  isPrefetch: boolean // whether prefetch app, default is false
173
180
  isPrerender: boolean
174
181
  prefetchLevel?: number
@@ -216,20 +223,6 @@ declare module '@micro-app/types' {
216
223
  showKeepAliveApp (container: HTMLElement | ShadowRoot): void
217
224
  }
218
225
 
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
226
  interface prefetchParam {
234
227
  name: string,
235
228
  url: string,
@@ -244,6 +237,10 @@ declare module '@micro-app/types' {
244
237
  level?: number
245
238
  'default-page'?: string
246
239
  'disable-patch-request'?: boolean
240
+ // prerender only 👇
241
+ 'router-mode'?: string
242
+ baseroute?: string
243
+ // prerender only 👆
247
244
  }
248
245
 
249
246
  // prefetch params
@@ -332,6 +329,7 @@ declare module '@micro-app/types' {
332
329
  'hidden-router'?: boolean
333
330
  'keep-alive'?: boolean
334
331
  'clear-data'?: boolean
332
+ 'router-mode'?: string
335
333
  iframe?: boolean
336
334
  ssr?: boolean
337
335
  fiber?: boolean
@@ -359,6 +357,27 @@ declare module '@micro-app/types' {
359
357
  start(options?: OptionsType): void
360
358
  }
361
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
+
362
381
  // special CallableFunction for interact
363
382
  type CallableFunctionForInteract = CallableFunction & { __APP_NAME__?: string, __AUTO_TRIGGER__?: boolean }
364
383