feat: add vite plugin (#3187)
Second attempt after we had to revert https://github.com/denoland/fresh/pull/3185
This commit is contained in:
+16
-2
@@ -129,7 +129,8 @@ export async function withChildProcessServer(
|
||||
let address = "";
|
||||
let found = false;
|
||||
// @ts-ignore yes it does
|
||||
for await (const line of lines.values({ preventCancel: true })) {
|
||||
for await (const raw of lines.values({ preventCancel: true })) {
|
||||
const line = colors.stripAnsiCode(raw);
|
||||
output.push(line);
|
||||
const match = line.match(
|
||||
/https?:\/\/[^:]+:\d+(\/\w+[-\w]*)*/g,
|
||||
@@ -147,12 +148,25 @@ export async function withChildProcessServer(
|
||||
throw new Error(`Could not find server address`);
|
||||
}
|
||||
|
||||
let failed = false;
|
||||
try {
|
||||
await fn(address);
|
||||
} catch (err) {
|
||||
// deno-lint-ignore no-console
|
||||
console.log(output);
|
||||
failed = true;
|
||||
throw err;
|
||||
} finally {
|
||||
aborter.abort();
|
||||
await cp.status;
|
||||
for await (const _ of lines) { /* noop */ }
|
||||
for await (const line of lines) {
|
||||
output.push(line);
|
||||
}
|
||||
|
||||
if (failed) {
|
||||
// deno-lint-ignore no-console
|
||||
console.log(output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user