///|
using @path {type SourcePath}
///|
let html_template =
$|
$|
$|
$|
$|
$| warren dev
$|\{html_patch}
$|
$|
$|
$|
$|
///|
let html_patch =
#|
#|
#|
///|
let dev_script =
#|const es = new EventSource("/__warren/events");
#|es.addEventListener("reload", () => location.reload());
///|
async fn main {
let cmd = @argparse.Command("warren", subcommands=[
@argparse.Command("dev"),
@argparse.Command("build"),
])
let cli = cmd.parse()
let cwd = @env.current_dir().unwrap()
guard cli.subcommand is Some((subcmd, _)) else { return }
match subcmd {
"dev" => {
guard @discover.discover(cwd) is Some(project) else {
abort("Moonbit project not found in: \{cwd}")
}
dev_server(SourcePath::new(cwd))
}
"build" => ...
_ => ()
}
}
///|
async fn inject_html(path : SourcePath, vfs : @vfs.VirtualFileSystem) -> Unit {
let html = @fs.read_file(path.to_string()).text()
let tag = match html.rev_find("") {
None => html.rev_find("