import chokidar from "chokidar"; import { debug, info } from "../lib/log.ts"; const watch = (glob: string | string[], task: string) => chokidar.watch(glob).on("change", (path: string) => { debug("File changed", { path, task }); return new Promise((resolve) => { const worker = new Worker(import.meta.resolve("../lib/watch-worker.ts"), { type: "module" }); worker.addEventListener("message", () => { worker.terminate(); resolve(); }); worker.postMessage({ task }); }); }); watch(["lib/views/*.tsx", "articles/**/*.asciidoc"], "articles"); watch("src/*.css", "css"); watch("src/*.avif", "images"); watch("src/*.svg", "svg"); watch("dist/_assets/fonts.manifest", "css"); watch("dist/_assets/css.manifest", "articles"); info("Started");