fix(dev): proxy content registry to CLI server

Inline spark tables (role=spark-table) live in the content registry, but the
rsbuild dev proxy forwarded only /__COMPLETIONS.json and
/__CONTENT_INDEX.json. The registry fetch fell back to the SPA index.html,
so /roll resolved the inline CSV as HTML and csv-parse failed with an
invalid opening quote.

Load the registry before publishing the loaded completions state so a roll
cannot fire while inline content is still unresolvable.
This commit is contained in:
hyper
2026-09-12 20:30:57 +08:00
parent b5591f2a78
commit c7f3b3425b
4 changed files with 7 additions and 3 deletions
+4 -1
View File
@@ -138,8 +138,11 @@ const _initPromise: Promise<void> = (async () => {
// 1. Try server first (CLI mode)
const serverData = await tryServer();
if (serverData) {
setCompletionsState({ status: "loaded", data: serverData });
// Load the registry before publishing the loaded state: dispatching a
// command only becomes possible once completions are "loaded", and inline
// spark-table CSVs are resolved through this registry at roll time.
await tryServerRegistry();
setCompletionsState({ status: "loaded", data: serverData });
try {
initReactivity({
declarations: serverData.declarations,
+1 -1
View File
@@ -8,7 +8,7 @@
* Dev 工作流:运行 CLI 服务器并在 rsbuild 配置中设置代理
* > npm run tttk serve ./content
* > npm run dev
* rsbuild 会将 /__CONTENT_INDEX.json、/__COMPLETIONS.json、/content/ 代理到 CLI 服务器
* rsbuild 会将 /__CONTENT_INDEX.json、/__COMPLETIONS.json、/__CONTENT_REGISTRY.json、/content/ 代理到 CLI 服务器
*/
import {