@blueking/bk-weweb 0.0.35-beta.8 → 0.0.35-beta.9
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 +8 -4
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1538,7 +1538,7 @@ var Script = class {
|
|
|
1538
1538
|
scoped;
|
|
1539
1539
|
url;
|
|
1540
1540
|
constructor({ async, code, defer, fromHtml, initial, isModule, url }) {
|
|
1541
|
-
this.code = code;
|
|
1541
|
+
this.code = code?.replace(STRICT_MODE_REGEX, "");
|
|
1542
1542
|
this.async = async;
|
|
1543
1543
|
this.defer = defer;
|
|
1544
1544
|
this.isModule = isModule;
|
|
@@ -1574,11 +1574,15 @@ var Script = class {
|
|
|
1574
1574
|
}
|
|
1575
1575
|
if (app instanceof MicroInstanceModel) {
|
|
1576
1576
|
const globalWindow = app.scopeJs ? app.sandBox?.proxyWindow || window : window;
|
|
1577
|
-
const
|
|
1577
|
+
const isIifeVar = !!this.code.replace(/\/\*[\s\S]*?\*\//g, "").match(/^\s*var\s/);
|
|
1578
|
+
const exportProp = getGlobalProp(globalWindow, isIifeVar);
|
|
1578
1579
|
if (exportProp) {
|
|
1579
1580
|
this.exportInstance = globalWindow[exportProp];
|
|
1580
1581
|
if (!app.scopeJs) {
|
|
1581
|
-
|
|
1582
|
+
const descriptor = Object.getOwnPropertyDescriptor(globalWindow, exportProp);
|
|
1583
|
+
if (descriptor?.configurable) {
|
|
1584
|
+
delete globalWindow[exportProp];
|
|
1585
|
+
}
|
|
1582
1586
|
}
|
|
1583
1587
|
}
|
|
1584
1588
|
}
|
|
@@ -1593,7 +1597,7 @@ var Script = class {
|
|
|
1593
1597
|
const isScopedLocation = app instanceof MicroAppModel && app.scopeLocation;
|
|
1594
1598
|
app.registerRunningApp();
|
|
1595
1599
|
new Function("window", "location", "history", scopedCode)(
|
|
1596
|
-
app.sandBox.proxyWindow,
|
|
1600
|
+
app.sandBox.proxyWindow || window,
|
|
1597
1601
|
isScopedLocation ? app.iframe.contentWindow.location : window.location,
|
|
1598
1602
|
isScopedLocation ? app.iframe.contentWindow.history : window.history
|
|
1599
1603
|
);
|