feat: prebundle code + restore from snapshot (#1604)

This commit is contained in:
Marvin Hagemeister
2023-08-16 16:47:51 +02:00
committed by GitHub
parent f67ec8520f
commit 477364c567
29 changed files with 500 additions and 28 deletions
+12 -2
View File
@@ -11,6 +11,8 @@ import {
WalkEntry,
} from "./deps.ts";
import { error } from "./error.ts";
import { FreshOptions } from "../server/mod.ts";
import { build } from "./build.ts";
const MIN_DENO_VERSION = "1.31.0";
@@ -183,7 +185,11 @@ export default manifest;
);
}
export async function dev(base: string, entrypoint: string) {
export async function dev(
base: string,
entrypoint: string,
options: FreshOptions = {},
) {
ensureMinDenoVersion();
// Run update check in background
@@ -209,7 +215,11 @@ export async function dev(base: string, entrypoint: string) {
if (manifestChanged) await generate(dir, newManifest);
await import(entrypoint);
if (Deno.args.includes("build")) {
await build(join(dir, "fresh.gen.ts"), options);
} else {
await import(entrypoint);
}
}
function arraysEqual<T>(a: T[], b: T[]): boolean {