/**
Any server would do as long as there is a path that sets a cookie named devtools
**/

//@ts-ignore
import { Bun } from 'bun';
import fs from "fs";

export default {
  port: 3000,
  async fetch(req) {
    const url = new URL(req.url);
    if(url.pathname == "/devtools"){
        const response = new Response(`{"version":3,"sources":[],"mappings":"","names":[],"sourcesContent":[],"sourceRoot":"","file":""}`);
        response.headers.set('Set-Cookie', 'devtools=1;');
        return response
    } else {
        const fileContent = fs.readFileSync("index.html");
        const response = new Response(fileContent);
        response.headers.set('Content-Type', 'text/html')
        return response;
    }
  }
};