chore: format

This commit is contained in:
saberzero1 2026-03-08 11:07:01 +01:00
parent 472b337d92
commit 8f58a5a599
No known key found for this signature in database
3 changed files with 31 additions and 6 deletions

View File

@ -286,8 +286,7 @@ export async function loadQuartzConfig(
} }
} else { } else {
const gitSpec = parsePluginSource(entry.source) const gitSpec = parsePluginSource(entry.source)
const isComponentOnly = const isComponentOnly = categories.length > 0 && categories.every((c) => c === "component")
categories.length > 0 && categories.every((c) => c === "component")
if (isComponentOnly) { if (isComponentOnly) {
// Always import the main entry point for component-only plugins. // Always import the main entry point for component-only plugins.

View File

@ -207,7 +207,16 @@ export const PageTypeDispatcher: QuartzEmitterPlugin<Partial<DispatcherOptions>>
for (const pt of pageTypes) { for (const pt of pageTypes) {
if (pt.match({ slug, fileData, cfg })) { if (pt.match({ slug, fileData, cfg })) {
const layout = resolveLayout(pt, defaults, byPageType) const layout = resolveLayout(pt, defaults, byPageType)
yield emitPage(ctx, slug, tree, fileData, allFilesWithVirtual, layout, resources, treeTransforms) yield emitPage(
ctx,
slug,
tree,
fileData,
allFilesWithVirtual,
layout,
resources,
treeTransforms,
)
break break
} }
} }
@ -290,7 +299,16 @@ export const PageTypeDispatcher: QuartzEmitterPlugin<Partial<DispatcherOptions>>
for (const pt of pageTypes) { for (const pt of pageTypes) {
if (pt.match({ slug, fileData, cfg })) { if (pt.match({ slug, fileData, cfg })) {
const layout = resolveLayout(pt, defaults, byPageType) const layout = resolveLayout(pt, defaults, byPageType)
yield emitPage(ctx, slug, tree, fileData, allFilesWithVirtual, layout, resources, treeTransforms) yield emitPage(
ctx,
slug,
tree,
fileData,
allFilesWithVirtual,
layout,
resources,
treeTransforms,
)
break break
} }
} }

View File

@ -1,7 +1,11 @@
import { PluggableList } from "unified" import { PluggableList } from "unified"
import { StaticResources } from "../util/resources" import { StaticResources } from "../util/resources"
import { ProcessedContent, QuartzPluginData } from "./vfile" import { ProcessedContent, QuartzPluginData } from "./vfile"
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "../components/types" import {
QuartzComponent,
QuartzComponentConstructor,
QuartzComponentProps,
} from "../components/types"
import { FilePath, FullSlug } from "../util/path" import { FilePath, FullSlug } from "../util/path"
import { BuildCtx } from "../util/ctx" import { BuildCtx } from "../util/ctx"
import { GlobalConfiguration } from "../cfg" import { GlobalConfiguration } from "../cfg"
@ -92,7 +96,11 @@ export type PageGenerator = (args: {
}) => VirtualPage[] }) => VirtualPage[]
/** A function that mutates a HAST tree at render time, when allFiles is available. */ /** A function that mutates a HAST tree at render time, when allFiles is available. */
export type TreeTransform = (root: Root, slug: FullSlug, componentData: QuartzComponentProps) => void export type TreeTransform = (
root: Root,
slug: FullSlug,
componentData: QuartzComponentProps,
) => void
export type QuartzPageTypePlugin<Options extends OptionType = undefined> = ( export type QuartzPageTypePlugin<Options extends OptionType = undefined> = (
opts?: Options, opts?: Options,