Files
vue-tui/packages
Yunfei He a181462c37 refactor(vite): signal app-exit over the hot channel, not a process-global (#235)
Replace globalThis.__VUE_TUI_TEARDOWN__ with an in-process hot-channel event:
the runtime emits "vue-tui:exit" (notifyDevExit) when the app genuinely exits,
and the dev plugin closes the server via server.environments.ssr.hot.on(...).
Removes a cross-package process-global using public Vite APIs; the per-server
listener is GC'd with its server (no global slot for a sibling to clobber).

From the @vue-tui/vite "hack" adversarial review, this was the one item flagged
as a clean, avoidable improvement. The other reviewed mechanisms
(force-client-compile, the bindCLIShortcuts no-op, the entry-inject endsWith
match, and the bridge-hmr ws.send forward) are load-bearing and kept as-is. In
particular the bridge-hmr "file-changed -> hotUpdate" reduction was re-examined
adversarially and REJECTED: plugin-vue sends file-changed UNCONDITIONALLY as
metadata (rerender-vs-reload lives in the transformed module's _rerender_only); a
hand-rolled hotUpdate would have to re-derive normalizePath(filename) to match
the client's exact-string compare (any drift -> template edits silently fall back
to a state-resetting reload), and the error leg still needs the ws.send patch.
Net: more code + a platform-dependent regression risk for zero gain.

vp run ready green; the teardown change adversarially reviewed (ship-as-is).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-28 22:59:13 +08:00
..