Build the page served for GET / : current version → preview HTML → live-reload injected. * Any failure becomes a valid error-overlay page (still hashable, still self-recovering).
(cwd: string, id: string, channelPath: string)
| 89 | /** Build the page served for GET / : current version → preview HTML → live-reload injected. |
| 90 | * Any failure becomes a valid error-overlay page (still hashable, still self-recovering). */ |
| 91 | async function renderCurrent(cwd: string, id: string, channelPath: string): Promise<string> { |
| 92 | try { |
| 93 | const { manifest, content } = await getArtifact(cwd, id); |
| 94 | return injectLiveReload(buildPreviewHtml(manifest.type, content), channelPath); |
| 95 | } catch (e: any) { |
| 96 | return renderErrorOverlay(e?.message ?? String(e), channelPath); |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | export async function createLiveServer(opts: CreateLiveServerOptions): Promise<LiveServerHandle> { |
| 101 | const { cwd, id } = opts; |
no test coverage detected