From ab9da02c60c962128820e6874e6f07c98bc3dda7 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Tue, 04 Jul 2023 17:08:32 +0000
Subject: [PATCH] fix indexing causing main thread freeze, various polish

---
 quartz/processors/emit.ts |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/quartz/processors/emit.ts b/quartz/processors/emit.ts
index 7150f5e..59875f5 100644
--- a/quartz/processors/emit.ts
+++ b/quartz/processors/emit.ts
@@ -8,7 +8,6 @@
 import { QUARTZ, slugify } from "../path"
 import { globbyStream } from "globby"
 import chalk from "chalk"
-import { googleFontHref } from '../theme'
 
 // @ts-ignore
 import spaRouterScript from '../components/scripts/spa.inline'
@@ -18,9 +17,10 @@
 import popoverScript from '../components/scripts/popover.inline'
 import popoverStyle from '../components/styles/popover.scss'
 import { StaticResources } from "../resources"
+import { QuartzLogger } from "../log"
+import { googleFontHref } from "../theme"
 
 function addGlobalPageResources(cfg: GlobalConfiguration, staticResources: StaticResources, componentResources: ComponentResources) {
-  // font and other resources
   staticResources.css.push(googleFontHref(cfg.theme))
 
   // popovers
@@ -67,6 +67,9 @@
 
 export async function emitContent(contentFolder: string, output: string, cfg: QuartzConfig, content: ProcessedContent[], verbose: boolean) {
   const perf = new PerfTimer()
+  const log = new QuartzLogger(verbose)
+
+  log.start(`Emitting output files`)
   const emit: EmitCallback = async ({ slug, ext, content }) => {
     const pathToPage = path.join(output, slug + ext)
     const dir = path.dirname(pathToPage)
@@ -80,6 +83,7 @@
 
   // component specific scripts and styles
   const componentResources = getComponentResources(cfg.plugins)
+
   // important that this goes *after* component scripts 
   // as the "nav" event gets triggered here and we should make sure 
   // that everyone else had the chance to register a listener for it
@@ -136,5 +140,5 @@
     }
   }
 
-  console.log(`Emitted ${emittedFiles} files to \`${output}\` in ${perf.timeSince()}`)
+  log.success(`Emitted ${emittedFiles} files to \`${output}\` in ${perf.timeSince()}`)
 }

--
Gitblit v1.10.0