feat: 二级页面、孤儿路由防护、iframe 全屏与 DS Bot 侧栏隐藏 (v0.5.3-local.5)

借鉴同线分支 dsh-worktable 0.5.2-local.9 的四项改造,逐项评估后移植:

- 二级页面:LayoutSpec.parentId + layoutTree 树形侧栏 + 折叠/展开。
  仅一级嵌套;删父项目不级联删子页面(提升为顶级,避免误删用户内容)。
  管理面板加「+新增二级页面」,继承父项目文件夹。
- 孤儿路由防护:register 遇 duplicate 路由只 warn 不抛,避免热重载时
  旧 fiber 未释放导致新 fiber 激活失败、侧边栏抽屉整体消失。
- iframe allowFullScreen:项目窗格里的 HTML 看板可全屏。
- DS Bot 侧栏隐藏:由本插件注入 CSS,替代改 ds-bot/client.js 的做法
  (ds-bot 随应用升级,改源码必丢)。nav.bt-home-nav 带标签选择器避免误伤。

未移植对方的状态防清空(stateStore.serverKeys):本仓 hostState.ts 已有
hydrated 守卫(读完宿主前禁写、读不到整场不写)与更细的 6 段退避重试,
覆盖面更强。

顺带修三个 Windows 兼容缺陷,否则 pack 门禁过不去:
- release-prep.mjs:tar 加 --force-local(GNU tar 把 C: 当 rsh 主机)
- preview-files.test.mjs:rmSync 删 junction 失败,加 unlinkSync 兜底
- widget-mount.test.mjs:提取段缺 normalizeProjects 依赖,起点前移

验证:npm run pack 全绿(139 项兼容回归 + 工厂门禁 10/10 + 结构 7 文件 +
独立安装 import + 锚点 14 场景 + Chromium 分栏 5 场景 + 服务端 3 场景)。
双资产同源 sha256 cf633ad7…。
This commit is contained in:
wangheng
2026-12-02 16:37:29 +08:00
parent 2d25e4ec39
commit b567701fa1
16 changed files with 610 additions and 201 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ test('Preview reads only its canonical root, including directory indexes',async(
for(const parts of [['..','outside','outside.txt'],['..\\outside\\outside.txt'],['/outside'],['bad\0']]) assert.equal(await store.file(token,parts),null)
symlinkSync(outside,join(root,'escape'),process.platform==='win32'?'junction':'dir')
assert.equal(await store.file(token,['escape','outside.txt']),null)
rmSync(join(root,'escape'))
try { rmSync(join(root,'escape')) } catch { try { unlinkSync(join(root,'escape')) } catch {} }
})
test('Capabilities expire after idle time; revocation and disposal remove them',async()=>{
let now=0;const store=createPreviewFiles(()=>now),a=await store.mount(root)