dsh-panel-control 0.3.15 → 0.4.0
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/README.md +18 -0
- package/client.js +1 -6
- package/index.js +726 -804
- package/package.json +1 -1
- package/scripts/host-smoke.mjs +13 -1
package/README.md
CHANGED
|
@@ -109,6 +109,24 @@ python -m http.server 8787 --bind 127.0.0.1 # 在仓库根目录
|
|
|
109
109
|
- 文案改成「刷新后仍然缺:重启 DSH 才会应用新的插件清单」——这才是真正有效的动作。
|
|
110
110
|
- 缺口修复后自动清除记忆,下次真出现新缺口还会提示。
|
|
111
111
|
|
|
112
|
+
## 0.4.0:不再有任何"等一会儿"的机制
|
|
113
|
+
|
|
114
|
+
前面几版为了对付"启动后入口不见了",加过看门狗、自愈改写、延时判断。这些都是**事后补偿**,代价是行为不可预测(改写自己的脚本会让加载器热替换,顺手把邻居插件的重复注册打挂)。0.4.0 把它们全部删掉了:
|
|
115
|
+
|
|
116
|
+
- 没有定时器、没有自查重试、不会改写任何文件。Host 半只做三件事:装路由、读一次插件图并记一行结论、做一次"我这个包的脚本取得到吗"的自检(都是**启动瞬间**完成的同步调用)。
|
|
117
|
+
- Client 半和别的插件一样:`dsh.client.immediately = true`,页面启动时随清单一起加载,立刻把入口挂到侧栏。
|
|
118
|
+
- 安装方式也建议和别的插件一致:用 **npm 安装**(`npm i dsh-panel-control`),而不是 `link:` 本地目录。`link:` 指向的是一个我随时在改的开发目录,任何一次编辑都会让页面手里的版本号作废;装成包之后文件是静止的,不存在这个窗口。
|
|
119
|
+
|
|
120
|
+
## 为什么重启后偶尔看不到入口(0.3.16)
|
|
121
|
+
|
|
122
|
+
DSH 给每个插件的脚本算一个**版本号**,来源是文件的 `mtime / ctime / 大小`,注册表只认它自己在组装那一刻读到的那个版本。页面拿到的是**启动时那份清单**,只要 `client.js` 在清单发出去之后被重写过(编辑器保存、`git` 换行归一化、或者早先那个"自愈"改写),页面手里的版本号就成了作废的号,请求回 404,而页面**不会报错**——入口就这么没了。
|
|
123
|
+
|
|
124
|
+
0.3.16 的处理:
|
|
125
|
+
|
|
126
|
+
- Host 半只对本插件包装注册表的资源查询:页面若拿旧版本号来要,先用**本进程发过的同一版本字节**回答(缓存最近 5 个版本),再退到"用当前版本回答",其余请求原样放行,卸载时撤掉包装。别家插件的行为一点不改。
|
|
127
|
+
- 早先的"自愈"(改写 `client.js` 强制热加载)**默认关闭**:它会重跑所有插件的注册,邻居不幂等就会丢入口——`dsh-workspace-control` 就是这么被弄掉的。需要时用 `DPC_NUDGE=on` 显式打开。
|
|
128
|
+
- `host.log` 每次 apply 打两行结论:`graph: lists|does not list <包名>` 和 `graph: own bundle at rev … answers 200|404`,一次就能分清是"没进清单"还是"清单有但取不到"。
|
|
129
|
+
|
|
112
130
|
## 代码审查后的加固(0.3.11)
|
|
113
131
|
|
|
114
132
|
一轮完整审查(正确性 / 安全 / 可维护性 / 性能)之后改掉的东西,按主题记在这里,免得以后又踩回去。
|
package/client.js
CHANGED
|
@@ -340,11 +340,6 @@ function build(require) {
|
|
|
340
340
|
return;
|
|
341
341
|
}
|
|
342
342
|
const missing = hostIds.filter((id) => !boot.ids.has(id));
|
|
343
|
-
// The Host can hand this very plugin to a page whose list predates it (see
|
|
344
|
-
// `recovery nudge` in the Host half). In that case the page is still missing
|
|
345
|
-
// an entry, but it is this one and it is already on screen: nagging the user
|
|
346
|
-
// to reload for it would be noise. Every other gap still counts.
|
|
347
|
-
const selfOnly = missing.length === 1 && missing[0] === PACKAGE && value.recovered === true;
|
|
348
343
|
// Only a real gap is worth a banner. A revision that merely differs proves
|
|
349
344
|
// nothing: the Host rebuilds that graph whenever any plugin file changes, so
|
|
350
345
|
// comparing revisions nagged people whose page was missing nothing at all.
|
|
@@ -353,7 +348,7 @@ function build(require) {
|
|
|
353
348
|
// Already said on an earlier load and a reload did not help: keep quiet, the
|
|
354
349
|
// diagnostics still list it.
|
|
355
350
|
const repeated = gap.length > 0 && readNagged() === gap;
|
|
356
|
-
const stale =
|
|
351
|
+
const stale = missing.length > 0 && !repeated;
|
|
357
352
|
if (stale) rememberNagged(gap);
|
|
358
353
|
else if (!missing.length) rememberNagged('');
|
|
359
354
|
if (!stale) forgetReloadMark();
|