feat: prebundle code + restore from snapshot (#1604)

This commit is contained in:
Marvin Hagemeister
2023-08-16 16:47:51 +02:00
committed by GitHub
parent f67ec8520f
commit 477364c567
29 changed files with 500 additions and 28 deletions
+5 -3
View File
@@ -15,13 +15,13 @@ export function parseHtml(input: string) {
}
export async function startFreshServer(options: Deno.CommandOptions) {
const { serverProcess, lines, address } = await spawnServer(options);
const { serverProcess, lines, address, output } = await spawnServer(options);
if (!address) {
throw new Error("Server didn't start up");
}
return { serverProcess, lines, address };
return { serverProcess, lines, address, output };
}
export async function fetchHtml(url: string) {
@@ -259,8 +259,10 @@ async function spawnServer(
preventCancel: true,
});
const output: string[] = [];
let address = "";
for await (const line of lines) {
output.push(line);
const match = line.match(/https?:\/\/localhost:\d+/g);
if (match) {
address = match[0];
@@ -268,5 +270,5 @@ async function spawnServer(
}
}
return { serverProcess, lines, address };
return { serverProcess, lines, address, output };
}