MCPcopy Create free account
hub / github.com/stackblitz/bolt.new / start

Function start

app/entry.server.tsx:25–58  ·  view source on GitHub ↗
(controller)

Source from the content-addressed store, hash-verified

23
24 const body = new ReadableStream({
25 start(controller) {
26 const head = renderHeadToString({ request, remixContext, Head });
27
28 controller.enqueue(
29 new Uint8Array(
30 new TextEncoder().encode(
31 `<!DOCTYPE html><html lang="en" data-theme="${themeStore.value}"><head>${head}</head><body><div id="root" class="w-full h-full">`,
32 ),
33 ),
34 );
35
36 const reader = readable.getReader();
37
38 function read() {
39 reader
40 .read()
41 .then(({ done, value }) => {
42 if (done) {
43 controller.enqueue(new Uint8Array(new TextEncoder().encode(`</div></body></html>`)));
44 controller.close();
45
46 return;
47 }
48
49 controller.enqueue(value);
50 read();
51 })
52 .catch((error) => {
53 controller.error(error);
54 readable.cancel();
55 });
56 }
57 read();
58 },
59
60 cancel() {
61 readable.cancel();

Callers

nothing calls this directly

Calls 1

readFunction · 0.85

Tested by

no test coverage detected