@blueking/bk-weweb 0.0.36-beta.16 → 0.0.36-beta.17
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.d.mts +3 -0
- package/dist/index.esm.js +6 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -552,6 +552,8 @@ interface IBaseModelProps {
|
|
|
552
552
|
id?: string | null;
|
|
553
553
|
/** 是否预加载 */
|
|
554
554
|
isPreLoad?: boolean;
|
|
555
|
+
/** 获取资源的函数 */
|
|
556
|
+
fetchSource?: typeof fetchSource;
|
|
555
557
|
}
|
|
556
558
|
/** 微应用模式属性配置 */
|
|
557
559
|
interface IAppModelProps extends IBaseModelProps {
|
|
@@ -715,6 +717,7 @@ interface IInjectWindowAttrs {
|
|
|
715
717
|
__BK_WEWEB_DATA__: Record<string, unknown>;
|
|
716
718
|
/** 标识页面是否由BK WEWEB驱动 */
|
|
717
719
|
__POWERED_BY_BK_WEWEB__: boolean;
|
|
720
|
+
__BK_WEWEB_HAS_REWRITE__?: boolean;
|
|
718
721
|
/** 原始 document 对象的引用 */
|
|
719
722
|
rawDocument: Document;
|
|
720
723
|
/** 原始 window 对象的引用 */
|
package/dist/index.esm.js
CHANGED
|
@@ -2445,7 +2445,9 @@ var AppCache = class {
|
|
|
2445
2445
|
if (!name) return void 0;
|
|
2446
2446
|
const app = this.cache.get(name);
|
|
2447
2447
|
if (app) return app;
|
|
2448
|
-
|
|
2448
|
+
const item = Array.from(this.cache.values()).find((item2) => item2.name === name);
|
|
2449
|
+
if (item) return item;
|
|
2450
|
+
return window.__BK_WEWEB_APP_KEY__ ? window.__getAppOrInstance__()?.getApp(name) : void 0;
|
|
2449
2451
|
}
|
|
2450
2452
|
/**
|
|
2451
2453
|
* 删除缓存的应用实例
|
|
@@ -2774,7 +2776,7 @@ function createOverriddenRemoveChild() {
|
|
|
2774
2776
|
}
|
|
2775
2777
|
var insertAdjacentElement = createOverriddenInsertAdjacentElement();
|
|
2776
2778
|
function createOverriddenInsertAdjacentElement() {
|
|
2777
|
-
return function(
|
|
2779
|
+
return function(_where, element) {
|
|
2778
2780
|
const node = elementAppendHandler(this, element, headAppendChild);
|
|
2779
2781
|
if (node?.tagName === "STYLE") {
|
|
2780
2782
|
node.insertAdjacentElement = insertAdjacentElement;
|
|
@@ -2783,10 +2785,11 @@ function createOverriddenInsertAdjacentElement() {
|
|
|
2783
2785
|
};
|
|
2784
2786
|
}
|
|
2785
2787
|
function rewriteBodyAndHeaderMethods() {
|
|
2786
|
-
if (hasRewrite) {
|
|
2788
|
+
if (hasRewrite || window.__BK_WEWEB_HAS_REWRITE__) {
|
|
2787
2789
|
return;
|
|
2788
2790
|
}
|
|
2789
2791
|
hasRewrite = true;
|
|
2792
|
+
window.__BK_WEWEB_HAS_REWRITE__ = true;
|
|
2790
2793
|
Element.prototype.setAttribute = createOverriddenSetAttribute();
|
|
2791
2794
|
HTMLBodyElement.prototype.appendChild = createOverriddenAppendChild();
|
|
2792
2795
|
HTMLBodyElement.prototype.append = createOverriddenAppend();
|