@micro-zoe/micro-app 1.0.0-rc.17 → 1.0.0-rc.18
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 +16 -16
- package/README.zh-cn.md +17 -17
- package/lib/index.esm.js +15 -15
- 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/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<a href="https://
|
|
3
|
-
<img src="https://
|
|
2
|
+
<a href="https://jd-opensource.github.io/micro-app/">
|
|
3
|
+
<img src="https://jd-opensource.github.io/micro-app/home/assets/logo.png" alt="logo" width="200"/>
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
@@ -11,21 +11,21 @@
|
|
|
11
11
|
<a href="https://www.npmjs.com/package/@micro-zoe/micro-app">
|
|
12
12
|
<img src="https://img.shields.io/npm/dt/@micro-zoe/micro-app.svg" alt="downloads"/>
|
|
13
13
|
</a>
|
|
14
|
-
<a href="https://github.com/
|
|
14
|
+
<a href="https://github.com/jd-opensource/micro-app/blob/master/LICENSE">
|
|
15
15
|
<img src="https://img.shields.io/npm/l/@micro-zoe/micro-app.svg" alt="license"/>
|
|
16
16
|
</a>
|
|
17
|
-
<a href="https://github.com/
|
|
17
|
+
<a href="https://github.com/jd-opensource/micro-app/blob/dev/Contact.md">
|
|
18
18
|
<img src="https://img.shields.io/badge/chat-wechat-blue" alt="WeChat">
|
|
19
19
|
</a>
|
|
20
|
-
<a href="https://travis-ci.com/github/
|
|
21
|
-
<img src="https://api.travis-ci.com/
|
|
20
|
+
<a href="https://travis-ci.com/github/jd-opensource/micro-app">
|
|
21
|
+
<img src="https://api.travis-ci.com/jd-opensource/micro-app.svg?branch=master" alt="travis"/>
|
|
22
22
|
</a>
|
|
23
|
-
<a href="https://coveralls.io/github/
|
|
24
|
-
<img src="https://coveralls.io/repos/github/
|
|
23
|
+
<a href="https://coveralls.io/github/jd-opensource/micro-app?branch=master">
|
|
24
|
+
<img src="https://coveralls.io/repos/github/jd-opensource/micro-app/badge.svg?branch=master" alt="coveralls"/>
|
|
25
25
|
</a>
|
|
26
26
|
</p>
|
|
27
27
|
|
|
28
|
-
English|[简体中文](./README.zh-cn.md)|[Documentation](https://
|
|
28
|
+
English|[简体中文](./README.zh-cn.md)|[Documentation](https://jd-opensource.github.io/micro-app/)|[Discussions](https://github.com/jd-opensource/micro-app/discussions)|[WeChat](./Contact.md)
|
|
29
29
|
|
|
30
30
|
# 📖Introduction
|
|
31
31
|
micro-app is a micro front-end framework launched by JD Retail. It renders based on webcomponent-like and realizes the micro front-end from component thinking, it aiming to reduce the difficulty of getting started and improve work efficiency.
|
|
@@ -72,7 +72,7 @@ The above micro front-end rendering is completed, and the effect is as follows:
|
|
|
72
72
|
|
|
73
73
|

|
|
74
74
|
|
|
75
|
-
More detailed configuration can be viewed [Documentation](https://
|
|
75
|
+
More detailed configuration can be viewed [Documentation](https://jd-opensource.github.io/micro-app/docs.html#/zh-cn/start).
|
|
76
76
|
|
|
77
77
|
# 🤝 Contribution
|
|
78
78
|
If you're interested in this project, you're welcome to mention pull request, and also welcome your "Star" ^_^
|
|
@@ -80,7 +80,7 @@ If you're interested in this project, you're welcome to mention pull request, an
|
|
|
80
80
|
### development
|
|
81
81
|
1、Clone
|
|
82
82
|
```
|
|
83
|
-
git clone https://github.com/
|
|
83
|
+
git clone https://github.com/jd-opensource/micro-app.git
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
2、Install dependencies
|
|
@@ -93,7 +93,7 @@ yarn bootstrap
|
|
|
93
93
|
yarn start
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
For more commands, see [DEVELOP](https://github.com/
|
|
96
|
+
For more commands, see [DEVELOP](https://github.com/jd-opensource/micro-app/blob/master/DEVELOP.md)
|
|
97
97
|
|
|
98
98
|
# FAQ
|
|
99
99
|
<details>
|
|
@@ -138,19 +138,19 @@ For more commands, see [DEVELOP](https://github.com/micro-zoe/micro-app/blob/mas
|
|
|
138
138
|
<details>
|
|
139
139
|
<summary>Does it support vite?</summary>
|
|
140
140
|
|
|
141
|
-
Yes, please see [adapt vite](https://
|
|
141
|
+
Yes, please see [adapt vite](https://jd-opensource.github.io/micro-app/docs.html#/zh-cn/framework/vite) for details.
|
|
142
142
|
</details>
|
|
143
143
|
|
|
144
144
|
<details>
|
|
145
145
|
<summary>Does it support ssr?</summary>
|
|
146
146
|
|
|
147
|
-
Yes, please see [nextjs](https://
|
|
147
|
+
Yes, please see [nextjs](https://jd-opensource.github.io/micro-app/docs.html#/zh-cn/framework/nextjs), [nuxtjs](https://jd-opensource.github.io/micro-app/docs.html#/zh-cn/framework/nuxtjs) for details.
|
|
148
148
|
</details>
|
|
149
149
|
|
|
150
150
|
# Contributors
|
|
151
|
-
<a href="https://github.com/
|
|
151
|
+
<a href="https://github.com/jd-opensource/micro-app/graphs/contributors">
|
|
152
152
|
<img src="https://contrib.rocks/image?repo=micro-zoe/micro-app" />
|
|
153
153
|
</a>
|
|
154
154
|
|
|
155
155
|
# License
|
|
156
|
-
[MIT License](https://github.com/
|
|
156
|
+
[MIT License](https://github.com/jd-opensource/micro-app/blob/master/LICENSE)
|
package/README.zh-cn.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<a href="https://
|
|
2
|
+
<a href="https://jd-opensource.github.io/micro-app/">
|
|
3
3
|
<img src="https://zeroing.jd.com/micro-app/media/logo.png" alt="logo" width="200"/>
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
@@ -11,21 +11,21 @@
|
|
|
11
11
|
<a href="https://www.npmjs.com/package/@micro-zoe/micro-app">
|
|
12
12
|
<img src="https://img.shields.io/npm/dt/@micro-zoe/micro-app.svg" alt="downloads"/>
|
|
13
13
|
</a>
|
|
14
|
-
<a href="https://github.com/
|
|
14
|
+
<a href="https://github.com/jd-opensource/micro-app/blob/master/LICENSE">
|
|
15
15
|
<img src="https://img.shields.io/npm/l/@micro-zoe/micro-app.svg" alt="license"/>
|
|
16
16
|
</a>
|
|
17
|
-
<a href="https://github.com/
|
|
17
|
+
<a href="https://github.com/jd-opensource/micro-app/blob/dev/Contact.md">
|
|
18
18
|
<img src="https://img.shields.io/badge/chat-wechat-blue" alt="WeChat">
|
|
19
19
|
</a>
|
|
20
|
-
<a href="https://travis-ci.com/github/
|
|
21
|
-
<img src="https://api.travis-ci.com/
|
|
20
|
+
<a href="https://travis-ci.com/github/jd-opensource/micro-app">
|
|
21
|
+
<img src="https://api.travis-ci.com/jd-opensource/micro-app.svg?branch=master" alt="travis"/>
|
|
22
22
|
</a>
|
|
23
|
-
<a href="https://coveralls.io/github/
|
|
24
|
-
<img src="https://coveralls.io/repos/github/
|
|
23
|
+
<a href="https://coveralls.io/github/jd-opensource/micro-app?branch=master">
|
|
24
|
+
<img src="https://coveralls.io/repos/github/jd-opensource/micro-app/badge.svg?branch=master" alt="coveralls"/>
|
|
25
25
|
</a>
|
|
26
26
|
</p>
|
|
27
27
|
|
|
28
|
-
[English](https://github.com/
|
|
28
|
+
[English](https://github.com/jd-opensource/micro-app)|简体中文|[官网文档](https://jd-opensource.github.io/micro-app/)|[讨论组](https://github.com/jd-opensource/micro-app/discussions)|[微信群](./Contact.md)
|
|
29
29
|
|
|
30
30
|
# 📖简介
|
|
31
31
|
micro-app是京东零售推出的一款微前端框架,它基于类WebComponent进行渲染,从组件化的思维实现微前端,旨在降低上手难度、提升工作效率。它是目前接入微前端成本最低的框架,并且提供了JS沙箱、样式隔离、元素隔离、预加载、虚拟路由系统、插件系统、数据通信等一系列完善的功能。
|
|
@@ -69,7 +69,7 @@ devServer: {
|
|
|
69
69
|
|
|
70
70
|
<img src="https://img12.360buyimg.com/imagetools/jfs/t1/196940/34/1541/38365/610a14fcE46c21374/c321b9f8fa50a8fc.png" alt="result" width='900'/>
|
|
71
71
|
|
|
72
|
-
更多详细配置可以查看[官网文档](https://
|
|
72
|
+
更多详细配置可以查看[官网文档](https://jd-opensource.github.io/micro-app/docs.html#/zh-cn/start)
|
|
73
73
|
|
|
74
74
|
# 🤝 参与共建
|
|
75
75
|
如果您对这个项目感兴趣,欢迎参与贡献,也欢迎 "Star" 支持一下 ^_^
|
|
@@ -77,7 +77,7 @@ devServer: {
|
|
|
77
77
|
### 本地运行
|
|
78
78
|
1、克隆项目
|
|
79
79
|
```
|
|
80
|
-
git clone https://github.com/
|
|
80
|
+
git clone https://github.com/jd-opensource/micro-app.git
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
2、安装依赖
|
|
@@ -90,16 +90,16 @@ yarn bootstrap
|
|
|
90
90
|
yarn start # 访问 http://localhost:3000
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
更多命令请查看[DEVELP](https://github.com/
|
|
93
|
+
更多命令请查看[DEVELP](https://github.com/jd-opensource/micro-app/blob/master/DEVELOP.zh-cn.md)
|
|
94
94
|
|
|
95
95
|
# FAQ
|
|
96
|
-
[问题汇总](https://
|
|
96
|
+
[问题汇总](https://jd-opensource.github.io/micro-app/docs.html#/zh-cn/questions)
|
|
97
97
|
<details>
|
|
98
98
|
|
|
99
99
|
<summary>micro-app的优势在哪里?</summary>
|
|
100
100
|
上手简单、侵入性低,只需改动少量的代码即可接入微前端,同时提供丰富的功能。
|
|
101
101
|
|
|
102
|
-
具体细节请参考文章:[micro-app介绍](https://github.com/
|
|
102
|
+
具体细节请参考文章:[micro-app介绍](https://github.com/jd-opensource/micro-app/issues/8)
|
|
103
103
|
|
|
104
104
|
</details>
|
|
105
105
|
<details>
|
|
@@ -136,21 +136,21 @@ yarn start # 访问 http://localhost:3000
|
|
|
136
136
|
<details>
|
|
137
137
|
<summary>支持vite吗?</summary>
|
|
138
138
|
|
|
139
|
-
支持,详情请查看[适配vite](https://
|
|
139
|
+
支持,详情请查看[适配vite](https://jd-opensource.github.io/micro-app/docs.html#/zh-cn/framework/vite)
|
|
140
140
|
</details>
|
|
141
141
|
|
|
142
142
|
<details>
|
|
143
143
|
<summary>支持ssr吗?</summary>
|
|
144
144
|
|
|
145
|
-
支持,详情请查看[nextjs](https://
|
|
145
|
+
支持,详情请查看[nextjs](https://jd-opensource.github.io/micro-app/docs.html#/zh-cn/framework/nextjs)、[nuxtjs](https://jd-opensource.github.io/micro-app/docs.html#/zh-cn/framework/nuxtjs)
|
|
146
146
|
</details>
|
|
147
147
|
|
|
148
148
|
|
|
149
149
|
# 贡献者们
|
|
150
|
-
<a href="https://github.com/
|
|
150
|
+
<a href="https://github.com/jd-opensource/micro-app/graphs/contributors">
|
|
151
151
|
<img src="https://contrib.rocks/image?repo=micro-zoe/micro-app" />
|
|
152
152
|
</a>
|
|
153
153
|
|
|
154
154
|
|
|
155
155
|
# License
|
|
156
|
-
[MIT License](https://github.com/
|
|
156
|
+
[MIT License](https://github.com/jd-opensource/micro-app/blob/master/LICENSE)
|
package/lib/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const version = '1.0.0-rc.
|
|
1
|
+
const version = '1.0.0-rc.18';
|
|
2
2
|
// do not use isUndefined
|
|
3
3
|
const isBrowser = typeof window !== 'undefined';
|
|
4
4
|
// do not use isUndefined
|
|
@@ -245,7 +245,7 @@ function formatAppURL(url, appName = null) {
|
|
|
245
245
|
const { origin, pathname, search } = createURL(addProtocol(url), (window.rawWindow || window).location.href);
|
|
246
246
|
/**
|
|
247
247
|
* keep the original url unchanged, such as .html .node .php .net .etc, search, except hash
|
|
248
|
-
* BUG FIX: Never using '/' to complete url, refer to https://github.com/
|
|
248
|
+
* BUG FIX: Never using '/' to complete url, refer to https://github.com/jd-opensource/micro-app/issues/1147
|
|
249
249
|
*/
|
|
250
250
|
const fullPath = `${origin}${pathname}${search}`;
|
|
251
251
|
return /^https?:\/\//.test(fullPath) ? fullPath : '';
|
|
@@ -648,7 +648,7 @@ function instanceOf(instance, constructor) {
|
|
|
648
648
|
/**
|
|
649
649
|
* Format event name
|
|
650
650
|
* In with sandbox, child event and lifeCycles bind to microAppElement, there are two events with same name - mounted unmount, it should be handled specifically to prevent conflicts
|
|
651
|
-
* Issue: https://github.com/
|
|
651
|
+
* Issue: https://github.com/jd-opensource/micro-app/issues/1161
|
|
652
652
|
* @param type event name
|
|
653
653
|
* @param appName app name
|
|
654
654
|
*/
|
|
@@ -919,7 +919,7 @@ class CSSParser {
|
|
|
919
919
|
});
|
|
920
920
|
return matchRes.replace(/(^|,[\n\s]*)([^,]+)/g, (_, separator, selector) => {
|
|
921
921
|
selector = trim(selector);
|
|
922
|
-
selector = selector.replace(/\[
|
|
922
|
+
selector = selector.replace(/\[[^\]=]+(?:=([^\]]+))?\]/g, (match, p1) => {
|
|
923
923
|
if (attributeValues[p1]) {
|
|
924
924
|
return match.replace(p1, attributeValues[p1]);
|
|
925
925
|
}
|
|
@@ -1186,7 +1186,7 @@ class CSSParser {
|
|
|
1186
1186
|
}
|
|
1187
1187
|
// splice string
|
|
1188
1188
|
recordResult(strFragment) {
|
|
1189
|
-
// Firefox performance degradation when string contain special characters, see https://github.com/
|
|
1189
|
+
// Firefox performance degradation when string contain special characters, see https://github.com/jd-opensource/micro-app/issues/256
|
|
1190
1190
|
if (isFireFox()) {
|
|
1191
1191
|
this.result += encodeURIComponent(strFragment);
|
|
1192
1192
|
}
|
|
@@ -2216,7 +2216,7 @@ function runCode2InlineScript(address, code, module, scriptElement, attrs, callb
|
|
|
2216
2216
|
if (isInlineScript(address)) {
|
|
2217
2217
|
/**
|
|
2218
2218
|
* inline module script cannot convert to blob mode
|
|
2219
|
-
* Issue: https://github.com/
|
|
2219
|
+
* Issue: https://github.com/jd-opensource/micro-app/issues/805
|
|
2220
2220
|
*/
|
|
2221
2221
|
scriptElement.textContent = code;
|
|
2222
2222
|
}
|
|
@@ -2960,7 +2960,7 @@ function fixBabelPolyfill6() {
|
|
|
2960
2960
|
}
|
|
2961
2961
|
/**
|
|
2962
2962
|
* Fix error of hot reload when parent&child created by create-react-app in development environment
|
|
2963
|
-
* Issue: https://github.com/
|
|
2963
|
+
* Issue: https://github.com/jd-opensource/micro-app/issues/382
|
|
2964
2964
|
*/
|
|
2965
2965
|
function fixReactHMRConflict(app) {
|
|
2966
2966
|
var _a;
|
|
@@ -3458,7 +3458,7 @@ function createProxyWindow(appName, microAppWindow, sandbox) {
|
|
|
3458
3458
|
* Some keywords, such as Vue, need to meet two conditions at the same time:
|
|
3459
3459
|
* 1. window.Vue --> undefined
|
|
3460
3460
|
* 2. 'Vue' in window --> false
|
|
3461
|
-
* Issue https://github.com/
|
|
3461
|
+
* Issue https://github.com/jd-opensource/micro-app/issues/686
|
|
3462
3462
|
*/
|
|
3463
3463
|
if (includes(sandbox.scopeProperties, key)) {
|
|
3464
3464
|
if (sandbox.injectedKeys.has(key)) {
|
|
@@ -5506,7 +5506,7 @@ const UN_PROXY_INSTANCEOF_KEYS = [
|
|
|
5506
5506
|
];
|
|
5507
5507
|
const escape2RawWindowKeys = [
|
|
5508
5508
|
'getComputedStyle',
|
|
5509
|
-
// FIX ISSUE: https://github.com/
|
|
5509
|
+
// FIX ISSUE: https://github.com/jd-opensource/micro-app/issues/1292
|
|
5510
5510
|
'DOMParser',
|
|
5511
5511
|
'visualViewport',
|
|
5512
5512
|
'matchMedia',
|
|
@@ -6001,7 +6001,7 @@ function patchDocumentPrototype(appName, microAppWindow) {
|
|
|
6001
6001
|
* const baseEl = document.querySelector('base')
|
|
6002
6002
|
* base = (baseEl && baseEl.getAttribute('href')) || '/'
|
|
6003
6003
|
*
|
|
6004
|
-
* Issue: https://github.com/
|
|
6004
|
+
* Issue: https://github.com/jd-opensource/micro-app/issues/1335
|
|
6005
6005
|
*/
|
|
6006
6006
|
const result = (_a = appInstanceMap.get(appName)) === null || _a === void 0 ? void 0 : _a.querySelector(selectors);
|
|
6007
6007
|
return result || selectors === 'base' ? result : rawMicroQuerySelector.call(microDocument, selectors);
|
|
@@ -7382,7 +7382,7 @@ class CreateApp {
|
|
|
7382
7382
|
/**
|
|
7383
7383
|
* NOTE:
|
|
7384
7384
|
* 1. this.container must set to container(micro-app element) before exec rebuildEffectSnapshot
|
|
7385
|
-
* ISSUE: https://github.com/
|
|
7385
|
+
* ISSUE: https://github.com/jd-opensource/micro-app/issues/1115
|
|
7386
7386
|
* 2. rebuildEffectSnapshot must exec before dispatch beforeshow event
|
|
7387
7387
|
*/
|
|
7388
7388
|
const oldContainer = this.container;
|
|
@@ -7609,7 +7609,7 @@ function invokePrototypeMethod(app, rawMethod, parent, targetNode, passiveNode)
|
|
|
7609
7609
|
* 1. When operate child from parentNode async, may have been unmount
|
|
7610
7610
|
* e.g. target.parentNode.remove(target)
|
|
7611
7611
|
* ISSUE:
|
|
7612
|
-
* 1. https://github.com/
|
|
7612
|
+
* 1. https://github.com/jd-opensource/micro-app/issues/739
|
|
7613
7613
|
* Solution: Return the true value when node not in document
|
|
7614
7614
|
*/
|
|
7615
7615
|
if (!isIframeSandbox(app.name) &&
|
|
@@ -7650,7 +7650,7 @@ function invokePrototypeMethod(app, rawMethod, parent, targetNode, passiveNode)
|
|
|
7650
7650
|
* E.g: document.head.replaceChild(targetNode, document.scripts[0])
|
|
7651
7651
|
* 2. If passiveNode not in hijackParent but in parent and method is insertBefore, try insert it into the position corresponding to hijackParent
|
|
7652
7652
|
* E.g: document.head.insertBefore(targetNode, document.head.childNodes[0])
|
|
7653
|
-
* ISSUE: https://github.com/
|
|
7653
|
+
* ISSUE: https://github.com/jd-opensource/micro-app/issues/1071
|
|
7654
7654
|
*/
|
|
7655
7655
|
if (passiveNode && !hijackParent.contains(passiveNode)) {
|
|
7656
7656
|
if (rawMethod === globalEnv.rawInsertBefore && parent.contains(passiveNode)) {
|
|
@@ -8063,7 +8063,7 @@ function patchDocument$2() {
|
|
|
8063
8063
|
if (!currentAppName ||
|
|
8064
8064
|
!selectors ||
|
|
8065
8065
|
isUniqueElement(selectors) ||
|
|
8066
|
-
// ISSUE: https://github.com/
|
|
8066
|
+
// ISSUE: https://github.com/jd-opensource/micro-app/issues/56
|
|
8067
8067
|
rawDocument !== _this) {
|
|
8068
8068
|
return globalEnv.rawQuerySelector.call(_this, selectors);
|
|
8069
8069
|
}
|
|
@@ -8632,7 +8632,7 @@ function defineElement(tagName) {
|
|
|
8632
8632
|
app.isPrefetch = false;
|
|
8633
8633
|
/**
|
|
8634
8634
|
* Fix error when navigate before app.mount by microApp.router.push(...)
|
|
8635
|
-
* Issue: https://github.com/
|
|
8635
|
+
* Issue: https://github.com/jd-opensource/micro-app/issues/908
|
|
8636
8636
|
*/
|
|
8637
8637
|
app.setAppState(appStates.BEFORE_MOUNT);
|
|
8638
8638
|
// exec mount async, simulate the first render scene
|