From 8c4dbb13c7a670ff8af806e8bfd1ca1aa216073b Mon Sep 17 00:00:00 2001 From: Kabir Khandpur Date: Thu, 18 Jan 2024 17:21:50 +0000 Subject: [PATCH] Move toRebuild and toRemove inside rebuild func --- quartz/build.ts | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/quartz/build.ts b/quartz/build.ts index fb56879e2..3707e7177 100644 --- a/quartz/build.ts +++ b/quartz/build.ts @@ -24,8 +24,6 @@ type BuildData = { mut: Mutex initialSlugs: FullSlug[] contentMap: Map - toRebuild: Set - toRemove: Set trackedAssets: Set lastBuildMs: number } @@ -97,8 +95,6 @@ async function startServing( contentMap, ignored: await isGitIgnored(), initialSlugs: ctx.allSlugs, - toRebuild: new Set(), - toRemove: new Set(), trackedAssets: new Set(), lastBuildMs: 0, } @@ -125,20 +121,13 @@ async function rebuild( clientRefresh: () => void, buildData: BuildData, // note: this function mutates buildData ) { - const { - ctx, - ignored, - mut, - initialSlugs, - contentMap, - toRebuild, - toRemove, - trackedAssets, - lastBuildMs, - } = buildData + const { ctx, ignored, mut, initialSlugs, contentMap, trackedAssets, lastBuildMs } = buildData const { argv } = ctx + const toRebuild = new Set() + const toRemove = new Set() + // don't do anything for gitignored files if (ignored(fp)) { return @@ -210,8 +199,6 @@ async function rebuild( release() clientRefresh() - toRebuild.clear() - toRemove.clear() } export default async (argv: Argv, mut: Mutex, clientRefresh: () => void) => {