2 Commits

View File

@@ -39,7 +39,7 @@ async function serveFile(filename: string) {
const newResponse = await new Response(compressed); const newResponse = await new Response(compressed);
// const newResponse = await new Response(file); // const newResponse = await new Response(file);
newResponse.headers.set('Cache-Control', 'no-cache, no-transform'); newResponse.headers.set('Cache-Control', 'no-transform');
newResponse.headers.set('Content-Encoding', 'br'); newResponse.headers.set('Content-Encoding', 'br');
@@ -293,15 +293,13 @@ function connectWebsocket(request: Request) {
} }
async function devServerWatchFiles() { async function devServerWatchFiles() {
const parentDir = Deno.cwd().replace(/\/[^/]+$/, '');
const watcher = Deno.watchFs(["../static/", "../src/"]); const watcher = Deno.watchFs(["../static/", "../src/"]);
for await (const event of watcher) { for await (const event of watcher) {
if (event.kind === "modify") { if (event.kind === "modify") {
for (const path of event.paths) { for (const path of event.paths) {
const cachedPath = path.replace(parentDir, ''); const cachedPath = path.replace(Deno.cwd() + '/..', '')
filepathResponseCache.delete(cachedPath); filepathResponseCache.delete(cachedPath);
console.log('Purging updated file:', cachedPath) console.log('Purging updated file:', cachedPath)
console.log(filepathResponseCache);
} }
} }