@blueking/bk-weweb 0.0.36-beta.21 → 0.0.36-beta.22

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 CHANGED
@@ -717,7 +717,6 @@ interface IInjectWindowAttrs {
717
717
  __BK_WEWEB_DATA__: Record<string, unknown>;
718
718
  /** 标识页面是否由BK WEWEB驱动 */
719
719
  __POWERED_BY_BK_WEWEB__: boolean;
720
- __BK_WEWEB_HAS_REWRITE__?: boolean;
721
720
  /** 原始 document 对象的引用 */
722
721
  rawDocument: Document;
723
722
  /** 原始 window 对象的引用 */
package/dist/index.esm.js CHANGED
@@ -1276,7 +1276,8 @@ function createElementWithAppKey(rawDocument, app) {
1276
1276
  tagName,
1277
1277
  options
1278
1278
  );
1279
- element[APP_KEY_PROPERTY] = app.appCacheKey;
1279
+ const runningApp = getCurrentRunningApp();
1280
+ element[APP_KEY_PROPERTY] = runningApp?.appCacheKey || app.appCacheKey;
1280
1281
  if (element instanceof HTMLImageElement) {
1281
1282
  Object.defineProperty(element, "src", {
1282
1283
  get() {
@@ -1545,11 +1546,12 @@ var SandBox = class {
1545
1546
  const windowDescriptorSet = /* @__PURE__ */ new Set();
1546
1547
  const rawWindow = window;
1547
1548
  this.rawWindow = rawWindow;
1548
- this.rawDocument = createProxyDocument(document, app);
1549
+ const rawDocument = window.rawDocument || document;
1550
+ this.rawDocument = createProxyDocument(rawDocument, app);
1549
1551
  const fakeWindow = /* @__PURE__ */ Object.create({});
1550
1552
  fakeWindow.__BK_WEWEB_APP_KEY__ = app.appCacheKey;
1551
1553
  fakeWindow.__POWERED_BY_BK_WEWEB__ = true;
1552
- fakeWindow.rawDocument = document;
1554
+ fakeWindow.rawDocument = rawDocument;
1553
1555
  fakeWindow.rawWindow = rawWindow;
1554
1556
  fakeWindow.__proto__ = Window;
1555
1557
  this.fakeWindow = fakeWindow;
@@ -2447,9 +2449,20 @@ var AppCache = class {
2447
2449
  */
2448
2450
  getApp(name) {
2449
2451
  if (!name) return void 0;
2450
- const app = this.cache.get(name);
2452
+ let app = this.cache.get(name);
2451
2453
  if (app) return app;
2452
- return Array.from(this.cache.values()).find((item) => item.name === name);
2454
+ for (const item of Array.from(this.cache.values())) {
2455
+ if (item.name === name) {
2456
+ app = item;
2457
+ break;
2458
+ }
2459
+ const childApp = item?.sandBox?.proxyWindow?.__getAppOrInstance__()?.getApp(name);
2460
+ if (childApp) {
2461
+ app = childApp;
2462
+ break;
2463
+ }
2464
+ }
2465
+ return app;
2453
2466
  }
2454
2467
  /**
2455
2468
  * 删除缓存的应用实例