@blueking/bk-weweb 0.0.10 → 0.0.12
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/dist/collect-source.js +9 -3
- package/dist/collect-source.js.map +1 -1
- package/dist/index.esm.js +9 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/typings/base-app/base-element.d.ts +0 -6
- package/typings/context/memory.d.ts +0 -10
- package/typings/utils/element-event.d.ts +0 -2
package/dist/collect-source.js
CHANGED
|
@@ -94,7 +94,11 @@ function resetDocumentPrototypeMethods() {
|
|
|
94
94
|
|
|
95
95
|
const nextTask = cb => Promise.resolve().then(cb);
|
|
96
96
|
function addUrlProtocol(url) {
|
|
97
|
-
|
|
97
|
+
if (url.startsWith('//'))
|
|
98
|
+
return `${location.protocol}${url}`;
|
|
99
|
+
if (!url.startsWith('http'))
|
|
100
|
+
return `${location.protocol}//${url}`;
|
|
101
|
+
return url;
|
|
98
102
|
}
|
|
99
103
|
// 补齐url地址
|
|
100
104
|
function fillUpPath(path, baseURI) {
|
|
@@ -119,6 +123,8 @@ const random = (n, str = 'abcdefghijklmnopqrstuvwxyz0123456789') => {
|
|
|
119
123
|
const isJsonpUrl = (url) => {
|
|
120
124
|
if (!url)
|
|
121
125
|
return false;
|
|
126
|
+
if (url.match(/\.js$/))
|
|
127
|
+
return false;
|
|
122
128
|
const { pathname } = new URL(addUrlProtocol(url));
|
|
123
129
|
return !pathname.match(/\.js$/);
|
|
124
130
|
};
|
|
@@ -1751,7 +1757,7 @@ class MicroAppModel {
|
|
|
1751
1757
|
createIframe() {
|
|
1752
1758
|
return new Promise((resolve) => {
|
|
1753
1759
|
const iframe = document.createElement('iframe');
|
|
1754
|
-
const url = new URL(this.url);
|
|
1760
|
+
const url = new URL(addUrlProtocol(this.url));
|
|
1755
1761
|
const isChrome = navigator.userAgent.indexOf('Chrome') > -1;
|
|
1756
1762
|
iframe.setAttribute('src', `${isChrome ? BLANK_ORIGN : location.origin}${url.pathname || '/'}${url.search}${url.hash}`);
|
|
1757
1763
|
iframe.style.cssText = 'display: none;';
|
|
@@ -1809,7 +1815,7 @@ class EntrySource {
|
|
|
1809
1815
|
async importHtmlEntry(app) {
|
|
1810
1816
|
let htmlStr = appCache.getCacheHtml(this.url);
|
|
1811
1817
|
if (!htmlStr) {
|
|
1812
|
-
htmlStr = await fetchSource(this.url, { cache: 'no-cache' });
|
|
1818
|
+
htmlStr = await fetchSource(addUrlProtocol(this.url), { cache: 'no-cache' });
|
|
1813
1819
|
if (!htmlStr) {
|
|
1814
1820
|
console.error('load app entry error, pleace check');
|
|
1815
1821
|
return Promise.reject();
|