feat: add vite plugin (#3187)

Second attempt after we had to revert
https://github.com/denoland/fresh/pull/3185
This commit is contained in:
Marvin Hagemeister
2025-08-06 12:13:22 +02:00
committed by GitHub
parent a5205b2a8e
commit 36aa9b5639
55 changed files with 2303 additions and 285 deletions
+16 -2
View File
@@ -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);
}
}
}