GeneratorPluginHost #

Plugins set up on a resolved site, ready to run their remaining hooks.

Fields #

siteResolvedSiteConfig

The resolved site config the plugins were set up with.

checkFrontmatter(frontmatter: Record<string, unknown>): Promise<{ issues: FrontmatterIssue[]; typos: FrontmatterTypo[] }>

Checks one page's frontmatter against the rules of KawaPress, the plugins and the site config, the way the build does.

runMarkdown(markdown: MarkdownExit): Promise<void>

Runs the markdown() handlers on a Markdown renderer.

getPageRegistrations(): readonly PageRegistration[]

Every pages() call, in plugin order and then call order.

getFrontmatterSchemas(): readonly FrontmatterSchemaEntry[]

Every frontmatter() call, in plugin order.

runPageData(pageData: PageData, context: Readonly<PageDataContext>): Promise<void>

Runs the pageData() handlers on the data of one page.

runPageArtifact(artifact: Readonly<PageBuildArtifact>): Promise<void>

Runs the pageArtifact() handlers on one built page.

runVite(config: UserConfig): Promise<void>

Runs the vite() handlers on a Vite config.

runBuildArtifacts(context: Omit<BuildArtifactsContext, 'pages'>): Promise<void>

Runs the buildArtifacts() handlers; every page that went through runPageArtifact() is added to the context.

getPageArtifacts(): readonly PageBuildArtifact[]

The pages that went through runPageArtifact() so far.

Full type signature
TypeScript
interface GeneratorPluginHost extends Omit<GeneratorPluginRunner, 'runConfig' | 'runConfigResolved'> {
  site: ResolvedSiteConfig
  checkFrontmatter: (frontmatter: Record<string, unknown>) => Promise<{ issues: FrontmatterIssue[]; typos: FrontmatterTypo[] }>
  runMarkdown: (markdown: MarkdownExit) => Promise<void>
  getPageRegistrations: () => readonly PageRegistration[]
  getFrontmatterSchemas: () => readonly FrontmatterSchemaEntry[]
  runPageData: (pageData: PageData, context: Readonly<PageDataContext>) => Promise<void>
  runPageArtifact: (artifact: Readonly<PageBuildArtifact>) => Promise<void>
  runVite: (config: UserConfig) => Promise<void>
  runBuildArtifacts: (context: Omit<BuildArtifactsContext, 'pages'>) => Promise<void>
  getPageArtifacts: () => readonly PageBuildArtifact[]
}

Edit this page

Comments