MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / renderCurrent

Function renderCurrent

src/artifacts/live-server.ts:91–98  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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). */
91async 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
100export async function createLiveServer(opts: CreateLiveServerOptions): Promise<LiveServerHandle> {
101 const { cwd, id } = opts;

Callers 2

flushFunction · 0.85
createLiveServerFunction · 0.85

Calls 4

getArtifactFunction · 0.85
injectLiveReloadFunction · 0.85
buildPreviewHtmlFunction · 0.85
renderErrorOverlayFunction · 0.85

Tested by

no test coverage detected