dsh-light-guard 0.7.1 → 0.7.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/CHANGELOG.md +8 -0
- package/lib/client.js +20 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
+
## v0.7.2 (2026-11-27)
|
|
10
|
+
- **发现的问题**:在 DSH 桌面端的 combo bundle 启动机制中,同一批次内任一插件如果在顶层注册或激活阶段同步抛错(例如重复执行触发 `duplicate factory registration`),会阻断同批排在后面的其他插件注册并引发 `web-boot` 致命弹窗。
|
|
11
|
+
- **改了什么**:
|
|
12
|
+
- 为 `lib/client.js` 顶层 `window.__ModuleLoader__.load(...)` 增加双层守卫:`duplicate factory registration` 静默幂等跳过,其他非重复错误通过 `queueMicrotask` 异步重抛(既保留真实报错可观测性,又绝不阻断同批后续插件注册);
|
|
13
|
+
- 为 `apply(ctx)` 出口补齐 `try/catch` 兜底;
|
|
14
|
+
- 软刷新前端前增加优雅收尾(先停 LoAF 采样器、清理本插件样式节点,再延迟 60ms 触发 `location.reload()`,让其他插件的 `beforeunload`/`pagehide` 钩子体面退场);
|
|
15
|
+
- 新增 `client.js` 契约单测(`new Function` 经典脚本解析门 + 假 loader 重复注册不抛错验证)。
|
|
16
|
+
|
|
9
17
|
## v0.7.1 (2026-11-27)
|
|
10
18
|
- **发现的问题**:在 DSH 桌面端(`dsh-app:`)装有多个第三方插件时,直接点击「软刷新前端界面」可能触发某些不兼容前端重载的第三方插件(例如 `dsh-notify-say`)在 `web-boot` 阶段报 `import failed` 弹窗,容易让不了解情况的用户误以为数据损坏而紧张。
|
|
11
19
|
- **改了什么**:
|
package/lib/client.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* 3. "Performance Cockpit" settings section ("性能护航") with SVG health gauge, 2x2 preset cards,
|
|
9
9
|
* 3 segmented tabs, visual storage bars, before/after delta snapshots, and reversible cold archiver.
|
|
10
10
|
*/
|
|
11
|
+
try {
|
|
11
12
|
window.__ModuleLoader__.load({
|
|
12
13
|
id: "dsh-light-guard",
|
|
13
14
|
factory: (require) => {
|
|
@@ -19,7 +20,7 @@ window.__ModuleLoader__.load({
|
|
|
19
20
|
var h = React.createElement;
|
|
20
21
|
|
|
21
22
|
var PLUGIN_NAME = "dsh-light-guard";
|
|
22
|
-
var VERSION = "0.7.
|
|
23
|
+
var VERSION = "0.7.2";
|
|
23
24
|
var API_PREFIX = "dsh-light-guard";
|
|
24
25
|
var LOCAL_CACHE_KEY = "dsh.lightGuard.config.v1";
|
|
25
26
|
var SOFT_RELOAD_KEY = "dsh.lightGuard.softReload.v1";
|
|
@@ -938,8 +939,11 @@ window.__ModuleLoader__.load({
|
|
|
938
939
|
};
|
|
939
940
|
writeSoftReloadState(next);
|
|
940
941
|
setSrState(next);
|
|
942
|
+
// Clean teardown of our own resources before triggering reload
|
|
943
|
+
try { if (loafController && typeof loafController.stop === "function") loafController.stop(); } catch {}
|
|
944
|
+
try { var stEl = typeof document !== "undefined" && document.getElementById(STYLE_ELEMENT_ID); if (stEl && stEl.parentNode) stEl.parentNode.removeChild(stEl); } catch {}
|
|
941
945
|
if (typeof window !== "undefined" && window.location) {
|
|
942
|
-
window.location.reload();
|
|
946
|
+
setTimeout(function () { window.location.reload(); }, 60);
|
|
943
947
|
}
|
|
944
948
|
}
|
|
945
949
|
|
|
@@ -1699,9 +1703,14 @@ window.__ModuleLoader__.load({
|
|
|
1699
1703
|
}
|
|
1700
1704
|
|
|
1701
1705
|
function apply(ctx) {
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1706
|
+
var disposeSection = null;
|
|
1707
|
+
try {
|
|
1708
|
+
installStreamGuard();
|
|
1709
|
+
applyCssOptimization(runtimeConfig);
|
|
1710
|
+
disposeSection = registerSettingsSection(ctx);
|
|
1711
|
+
} catch (err) {
|
|
1712
|
+
try { console.error("[dsh-light-guard] apply failed:", err); } catch {}
|
|
1713
|
+
}
|
|
1705
1714
|
return function () {
|
|
1706
1715
|
try { if (typeof disposeSection === "function") disposeSection(); } catch {}
|
|
1707
1716
|
};
|
|
@@ -1713,3 +1722,9 @@ window.__ModuleLoader__.load({
|
|
|
1713
1722
|
return module.exports;
|
|
1714
1723
|
}
|
|
1715
1724
|
});
|
|
1725
|
+
} catch (err) {
|
|
1726
|
+
if (!/duplicate factory registration/i.test(String(err && err.message || err))) {
|
|
1727
|
+
if (typeof queueMicrotask === "function") queueMicrotask(function () { throw err; });
|
|
1728
|
+
else setTimeout(function () { throw err; }, 0);
|
|
1729
|
+
}
|
|
1730
|
+
}
|