@micro-zoe/micro-app 0.5.2 → 0.5.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/README.md CHANGED
@@ -57,11 +57,8 @@ microApp.start()
57
57
  ```html
58
58
  <!-- my-page.vue -->
59
59
  <template>
60
- <div>
61
- <h1>micro application</h1>
62
- <!-- 👇 name is the application name, url is the html address -->
63
- <micro-app name='app1' url='http://localhost:3000/'></micro-app>
64
- </div>
60
+ <!-- 👇 name is the app name, url is the app address -->
61
+ <micro-app name='my-app' url='http://localhost:3000/'></micro-app>
65
62
  </template>
66
63
  ```
67
64
 
@@ -145,7 +142,13 @@ For more commands, see [DEVELP](https://github.com/micro-zoe/micro-app/blob/mast
145
142
  <details>
146
143
  <summary>Does it support vite?</summary>
147
144
 
148
- Yes, please see [adapt vite](https://micro-zoe.github.io/micro-app/docs.html#/zh-cn/advanced?id=_2%e3%80%81%e9%80%82%e9%85%8dvite) for details.
145
+ Yes, please see [adapt vite](https://micro-zoe.github.io/micro-app/docs.html#/zh-cn/framework/vite) for details.
146
+ </details>
147
+
148
+ <details>
149
+ <summary>Does it support ssr?</summary>
150
+
151
+ Yes, please see [nextjs](https://micro-zoe.github.io/micro-app/docs.html#/zh-cn/framework/nextjs), [nuxtjs](https://micro-zoe.github.io/micro-app/docs.html#/zh-cn/framework/nuxtjs) for details.
149
152
  </details>
150
153
 
151
154
  # Contributors
package/README.zh-cn.md CHANGED
@@ -44,7 +44,7 @@ micro-app与技术栈无关,对前端框架没有限制,任何框架都可
44
44
  yarn add @micro-zoe/micro-app
45
45
  ```
46
46
 
47
- **2、在入口处引入依赖**
47
+ **2、在入口处引入**
48
48
  ```js
49
49
  // main.js
50
50
  import microApp from '@micro-zoe/micro-app'
@@ -56,11 +56,8 @@ microApp.start()
56
56
  ```html
57
57
  <!-- my-page.vue -->
58
58
  <template>
59
- <div>
60
- <h1>子应用</h1>
61
- <!-- 👇 name为应用名称,url为html地址 -->
62
- <micro-app name='app1' url='http://localhost:3000/'></micro-app>
63
- </div>
59
+ <!-- 👇 name为应用名称,url为应用地址 -->
60
+ <micro-app name='my-app' url='http://localhost:3000/'></micro-app>
64
61
  </template>
65
62
  ```
66
63
 
@@ -146,7 +143,13 @@ yarn start # 访问 http://localhost:3000
146
143
  <details>
147
144
  <summary>支持vite吗?</summary>
148
145
 
149
- 支持,详情请查看[适配vite](https://micro-zoe.github.io/micro-app/docs.html#/zh-cn/advanced?id=_2%e3%80%81%e9%80%82%e9%85%8dvite)
146
+ 支持,详情请查看[适配vite](https://micro-zoe.github.io/micro-app/docs.html#/zh-cn/framework/vite)
147
+ </details>
148
+
149
+ <details>
150
+ <summary>支持ssr吗?</summary>
151
+
152
+ 支持,详情请查看[nextjs](https://micro-zoe.github.io/micro-app/docs.html#/zh-cn/framework/nextjs)、[nuxtjs](https://micro-zoe.github.io/micro-app/docs.html#/zh-cn/framework/nuxtjs)
150
153
  </details>
151
154
 
152
155
  # 贡献者们
package/lib/index.d.ts CHANGED
@@ -23,6 +23,7 @@ declare module '@micro-zoe/micro-app/micro_app' {
23
23
  disableScopecss?: boolean;
24
24
  disableSandbox?: boolean;
25
25
  macro?: boolean;
26
+ ssr?: boolean;
26
27
  lifeCycles?: lifeCyclesType;
27
28
  plugins?: plugins;
28
29
  fetch?: fetchType;
package/lib/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- const version = '0.5.2';
1
+ const version = '0.5.3';
2
2
  // do not use isUndefined
3
3
  const isBrowser = typeof window !== 'undefined';
4
4
  // do not use isUndefined
@@ -1888,12 +1888,15 @@ class SandBox {
1888
1888
  return key in target;
1889
1889
  return key in unscopables || key in target || key in rawWindow;
1890
1890
  },
1891
+ // Object.getOwnPropertyDescriptor(window, key)
1892
+ // TODO: use set
1891
1893
  getOwnPropertyDescriptor: (target, key) => {
1892
1894
  if (target.hasOwnProperty(key)) {
1893
1895
  descriptorTargetMap.set(key, 'target');
1894
1896
  return Object.getOwnPropertyDescriptor(target, key);
1895
1897
  }
1896
1898
  if (rawWindow.hasOwnProperty(key)) {
1899
+ // like console, alert ...
1897
1900
  descriptorTargetMap.set(key, 'rawWindow');
1898
1901
  const descriptor = Object.getOwnPropertyDescriptor(rawWindow, key);
1899
1902
  if (descriptor && !descriptor.configurable) {
@@ -1903,6 +1906,7 @@ class SandBox {
1903
1906
  }
1904
1907
  return undefined;
1905
1908
  },
1909
+ // Object.defineProperty(window, key, Descriptor)
1906
1910
  defineProperty: (target, key, value) => {
1907
1911
  const from = descriptorTargetMap.get(key);
1908
1912
  if (from === 'rawWindow') {
@@ -1910,11 +1914,13 @@ class SandBox {
1910
1914
  }
1911
1915
  return Reflect.defineProperty(target, key, value);
1912
1916
  },
1917
+ // Object.getOwnPropertyNames(window)
1913
1918
  ownKeys: (target) => {
1914
1919
  return unique(Reflect.ownKeys(rawWindow).concat(Reflect.ownKeys(target)));
1915
1920
  },
1916
1921
  deleteProperty: (target, key) => {
1917
1922
  if (target.hasOwnProperty(key)) {
1923
+ this.injectedKeys.has(key) && this.injectedKeys.delete(key);
1918
1924
  this.escapeKeys.has(key) && Reflect.deleteProperty(rawWindow, key);
1919
1925
  return Reflect.deleteProperty(target, key);
1920
1926
  }
@@ -3141,6 +3147,7 @@ class MicroApp extends EventCenterForBaseApp {
3141
3147
  this.disableScopecss = options.disableScopecss;
3142
3148
  this.disableSandbox = options.disableSandbox;
3143
3149
  this.macro = options.macro;
3150
+ this.ssr = options.ssr;
3144
3151
  isFunction(options.fetch) && (this.fetch = options.fetch);
3145
3152
  isPlainObject(options.lifeCycles) && (this.lifeCycles = options.lifeCycles);
3146
3153
  // load app assets when browser is idle