Added QuartzParserPlugin typing

This commit is contained in:
Emile Bangma 2024-09-19 11:48:28 +00:00
parent 169a570ed5
commit c3f1695595

View File

@ -10,6 +10,7 @@ export interface PluginTypes {
transformers: QuartzTransformerPluginInstance[]
filters: QuartzFilterPluginInstance[]
emitters: QuartzEmitterPluginInstance[]
parsers: QuartzParserPluginInstance[]
}
type OptionType = object | undefined
@ -45,3 +46,14 @@ export type QuartzEmitterPluginInstance = {
resources: StaticResources,
): Promise<DepGraph<FilePath>>
}
export type QuartzParserPlugin<Options extends OptionType = undefined> = (
opts?: Options,
) => QuartzParserPluginInstance
export type QuartzParserPluginInstance = {
name: string
textTransform: (ctx: BuildCtx, src: string | Buffer) => string | Buffer
markdownPlugins: (ctx: BuildCtx) => PluggableList
htmlPlugins: (ctx: BuildCtx) => PluggableList
externalResources: (ctx: BuildCtx) => Partial<StaticResources>
}