@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.
package/dist/index.esm.js
CHANGED
|
@@ -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
|
|
|
@@ -1268,11 +1273,14 @@ var Script = class {
|
|
|
1268
1273
|
}
|
|
1269
1274
|
// 转换脚本内容
|
|
1270
1275
|
transformCode(app) {
|
|
1276
|
+
const sourceMapUrl = this.url ? `//# sourceURL=${this.url}
|
|
1277
|
+
` : "";
|
|
1271
1278
|
if (app.sandBox) {
|
|
1272
1279
|
if (this.isModule) {
|
|
1273
1280
|
return ` with(window.${app.sandBox.windowSymbolKey}){
|
|
1274
1281
|
;${this.code}
|
|
1275
1282
|
|
|
1283
|
+
${sourceMapUrl}
|
|
1276
1284
|
}`;
|
|
1277
1285
|
}
|
|
1278
1286
|
if (app.showSourceCode) {
|
|
@@ -1282,6 +1290,7 @@ var Script = class {
|
|
|
1282
1290
|
|
|
1283
1291
|
${this.code}
|
|
1284
1292
|
|
|
1293
|
+
${sourceMapUrl}
|
|
1285
1294
|
}
|
|
1286
1295
|
}).call(window.${app.sandBox.windowSymbolKey},
|
|
1287
1296
|
window.${app.sandBox.windowSymbolKey}, window.${app.sandBox.windowSymbolKey}, window.${app.sandBox.windowSymbolKey});`;
|
|
@@ -1292,6 +1301,8 @@ var Script = class {
|
|
|
1292
1301
|
${getGlobalContextCode()}
|
|
1293
1302
|
|
|
1294
1303
|
${this.code}
|
|
1304
|
+
|
|
1305
|
+
${sourceMapUrl}
|
|
1295
1306
|
}
|
|
1296
1307
|
catch(e) {
|
|
1297
1308
|
console.error(e)
|
|
@@ -1419,8 +1430,8 @@ var MicroAppModel = class {
|
|
|
1419
1430
|
if (container && this.container) {
|
|
1420
1431
|
if (container instanceof Element) container.setAttribute(CSS_ATTRIBUTE_KEY, this.name);
|
|
1421
1432
|
const fragment = document.createDocumentFragment();
|
|
1422
|
-
const
|
|
1423
|
-
for (const node of
|
|
1433
|
+
const list2 = Array.from(this.container.childNodes);
|
|
1434
|
+
for (const node of list2) {
|
|
1424
1435
|
node.__BK_WEWEB_APP_KEY__ = this.appCacheKey;
|
|
1425
1436
|
Object.defineProperties(node, {
|
|
1426
1437
|
ownerDocument: {
|
|
@@ -1850,16 +1861,16 @@ var AppCache = class {
|
|
|
1850
1861
|
return this.baseSource.getStyle(urlOrCode);
|
|
1851
1862
|
}
|
|
1852
1863
|
getCacheHtml(url) {
|
|
1853
|
-
const
|
|
1854
|
-
const app =
|
|
1864
|
+
const list2 = Array.from(this.cache.values());
|
|
1865
|
+
const app = list2.find((item) => item.url === url);
|
|
1855
1866
|
if (app) return app.source?.rawHtml || "";
|
|
1856
1867
|
return "";
|
|
1857
1868
|
}
|
|
1858
1869
|
getCacheScript(url) {
|
|
1859
1870
|
let script = this.baseSource.getScript(url);
|
|
1860
1871
|
if (script) return;
|
|
1861
|
-
const
|
|
1862
|
-
|
|
1872
|
+
const list2 = Array.from(this.cache.values());
|
|
1873
|
+
list2.some((app) => {
|
|
1863
1874
|
script = app.source?.getScript(url);
|
|
1864
1875
|
return !!script;
|
|
1865
1876
|
});
|
|
@@ -1868,8 +1879,8 @@ var AppCache = class {
|
|
|
1868
1879
|
getCacheStyle(url) {
|
|
1869
1880
|
let style = this.baseSource.getStyle(url);
|
|
1870
1881
|
if (style) return;
|
|
1871
|
-
const
|
|
1872
|
-
|
|
1882
|
+
const list2 = Array.from(this.cache.values());
|
|
1883
|
+
list2.some((app) => {
|
|
1873
1884
|
style = app.source?.getStyle(url);
|
|
1874
1885
|
return !!style;
|
|
1875
1886
|
});
|