@blueking/bk-weweb 0.0.29-beta.1 → 0.0.29-beta.2
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.
|
@@ -7,7 +7,7 @@ function setCurrentRunningApp(appInstance) {
|
|
|
7
7
|
currentRunningApp = appInstance;
|
|
8
8
|
}
|
|
9
9
|
var windowNativeFuncMap = /* @__PURE__ */ new Map();
|
|
10
|
-
var
|
|
10
|
+
var list = [
|
|
11
11
|
"Array",
|
|
12
12
|
"ArrayBuffer",
|
|
13
13
|
"Boolean",
|
|
@@ -65,7 +65,8 @@ var globalContextCode = `const { ${[
|
|
|
65
65
|
"valueOf",
|
|
66
66
|
"WeakMap",
|
|
67
67
|
"WeakSet"
|
|
68
|
-
]
|
|
68
|
+
];
|
|
69
|
+
var globalContextCode = list.join(",");
|
|
69
70
|
var getGlobalContextCode = () => {
|
|
70
71
|
return globalContextCode;
|
|
71
72
|
};
|
|
@@ -74,8 +75,12 @@ var collectNativeWindowFunc = () => {
|
|
|
74
75
|
for (const key of keyList) {
|
|
75
76
|
if (!windowNativeFuncMap.has(key) && key.match(/^[A-Z]/) && typeof window[key] === "function" && window[key].toString().includes("[native code]")) {
|
|
76
77
|
windowNativeFuncMap.set(key, true);
|
|
78
|
+
if (!list.includes(key)) {
|
|
79
|
+
globalContextCode += `,${key}`;
|
|
80
|
+
}
|
|
77
81
|
}
|
|
78
82
|
}
|
|
83
|
+
globalContextCode = `const { ${globalContextCode} }= window.rawWindow;`;
|
|
79
84
|
};
|
|
80
85
|
collectNativeWindowFunc();
|
|
81
86
|
|
|
@@ -1578,11 +1583,14 @@ var Script = class {
|
|
|
1578
1583
|
}
|
|
1579
1584
|
// 转换脚本内容
|
|
1580
1585
|
transformCode(app) {
|
|
1586
|
+
const sourceMapUrl = this.url ? `//# sourceURL=${this.url}
|
|
1587
|
+
` : "";
|
|
1581
1588
|
if (app.sandBox) {
|
|
1582
1589
|
if (this.isModule) {
|
|
1583
1590
|
return ` with(window.${app.sandBox.windowSymbolKey}){
|
|
1584
1591
|
;${this.code}
|
|
1585
1592
|
|
|
1593
|
+
${sourceMapUrl}
|
|
1586
1594
|
}`;
|
|
1587
1595
|
}
|
|
1588
1596
|
if (app.showSourceCode) {
|
|
@@ -1592,6 +1600,7 @@ var Script = class {
|
|
|
1592
1600
|
|
|
1593
1601
|
${this.code}
|
|
1594
1602
|
|
|
1603
|
+
${sourceMapUrl}
|
|
1595
1604
|
}
|
|
1596
1605
|
}).call(window.${app.sandBox.windowSymbolKey},
|
|
1597
1606
|
window.${app.sandBox.windowSymbolKey}, window.${app.sandBox.windowSymbolKey}, window.${app.sandBox.windowSymbolKey});`;
|
|
@@ -1602,6 +1611,8 @@ var Script = class {
|
|
|
1602
1611
|
${getGlobalContextCode()}
|
|
1603
1612
|
|
|
1604
1613
|
${this.code}
|
|
1614
|
+
|
|
1615
|
+
${sourceMapUrl}
|
|
1605
1616
|
}
|
|
1606
1617
|
catch(e) {
|
|
1607
1618
|
console.error(e)
|
|
@@ -1729,8 +1740,8 @@ var MicroAppModel = class {
|
|
|
1729
1740
|
if (container && this.container) {
|
|
1730
1741
|
if (container instanceof Element) container.setAttribute(CSS_ATTRIBUTE_KEY, this.name);
|
|
1731
1742
|
const fragment = document.createDocumentFragment();
|
|
1732
|
-
const
|
|
1733
|
-
for (const node of
|
|
1743
|
+
const list2 = Array.from(this.container.childNodes);
|
|
1744
|
+
for (const node of list2) {
|
|
1734
1745
|
node.__BK_WEWEB_APP_KEY__ = this.appCacheKey;
|
|
1735
1746
|
Object.defineProperties(node, {
|
|
1736
1747
|
ownerDocument: {
|
|
@@ -2093,16 +2104,16 @@ var AppCache = class {
|
|
|
2093
2104
|
return this.baseSource.getStyle(urlOrCode);
|
|
2094
2105
|
}
|
|
2095
2106
|
getCacheHtml(url) {
|
|
2096
|
-
const
|
|
2097
|
-
const app =
|
|
2107
|
+
const list2 = Array.from(this.cache.values());
|
|
2108
|
+
const app = list2.find((item) => item.url === url);
|
|
2098
2109
|
if (app) return app.source?.rawHtml || "";
|
|
2099
2110
|
return "";
|
|
2100
2111
|
}
|
|
2101
2112
|
getCacheScript(url) {
|
|
2102
2113
|
let script = this.baseSource.getScript(url);
|
|
2103
2114
|
if (script) return;
|
|
2104
|
-
const
|
|
2105
|
-
|
|
2115
|
+
const list2 = Array.from(this.cache.values());
|
|
2116
|
+
list2.some((app) => {
|
|
2106
2117
|
script = app.source?.getScript(url);
|
|
2107
2118
|
return !!script;
|
|
2108
2119
|
});
|
|
@@ -2111,8 +2122,8 @@ var AppCache = class {
|
|
|
2111
2122
|
getCacheStyle(url) {
|
|
2112
2123
|
let style = this.baseSource.getStyle(url);
|
|
2113
2124
|
if (style) return;
|
|
2114
|
-
const
|
|
2115
|
-
|
|
2125
|
+
const list2 = Array.from(this.cache.values());
|
|
2126
|
+
list2.some((app) => {
|
|
2116
2127
|
style = app.source?.getStyle(url);
|
|
2117
2128
|
return !!style;
|
|
2118
2129
|
});
|