feat: add plugin buildStart and buildEnd hooks (#1770)

This commit is contained in:
Marvin Hagemeister
2023-09-18 17:46:34 +02:00
committed by GitHub
parent d94d3db4aa
commit c76f15479f
11 changed files with 161 additions and 15 deletions
+7 -1
View File
@@ -46,7 +46,13 @@ export async function dev(
if (isBuild) {
// Ensure that build dir is empty
await fs.emptyDir(outDir);
await build(join(dir, "fresh.gen.ts"), options ?? {});
options = options ?? {};
const plugins = options.plugins ?? [];
await Promise.all(plugins.map((plugin) => plugin.buildStart?.()));
await build(join(dir, "fresh.gen.ts"), options);
await Promise.all(plugins.map((plugin) => plugin.buildEnd?.()));
} else if (options) {
const ctx = await ServerContext.fromManifest(manifest, {
...options,