|
|
@ -23,9 +23,9 @@ export type RawConfigExports<ThemeConfig = any> =
|
|
|
|
| Awaitable<UserConfig<ThemeConfig>>
|
|
|
|
| Awaitable<UserConfig<ThemeConfig>>
|
|
|
|
| (() => Awaitable<UserConfig<ThemeConfig>>)
|
|
|
|
| (() => Awaitable<UserConfig<ThemeConfig>>)
|
|
|
|
|
|
|
|
|
|
|
|
export interface TransformContext {
|
|
|
|
export interface TransformContext<ThemeConfig = any> {
|
|
|
|
page: string
|
|
|
|
page: string
|
|
|
|
siteConfig: SiteConfig
|
|
|
|
siteConfig: SiteConfig<ThemeConfig>
|
|
|
|
siteData: SiteData
|
|
|
|
siteData: SiteData
|
|
|
|
pageData: PageData
|
|
|
|
pageData: PageData
|
|
|
|
title: string
|
|
|
|
title: string
|
|
|
@ -35,8 +35,8 @@ export interface TransformContext {
|
|
|
|
assets: string[]
|
|
|
|
assets: string[]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export interface TransformPageContext {
|
|
|
|
export interface TransformPageContext<ThemeConfig = any> {
|
|
|
|
siteConfig: SiteConfig
|
|
|
|
siteConfig: SiteConfig<ThemeConfig>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export interface UserConfig<ThemeConfig = any>
|
|
|
|
export interface UserConfig<ThemeConfig = any>
|
|
|
@ -161,7 +161,7 @@ export interface UserConfig<ThemeConfig = any>
|
|
|
|
* Build end hook: called when SSG finish.
|
|
|
|
* Build end hook: called when SSG finish.
|
|
|
|
* @param siteConfig The resolved configuration.
|
|
|
|
* @param siteConfig The resolved configuration.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
buildEnd?: (siteConfig: SiteConfig) => Awaitable<void>
|
|
|
|
buildEnd?: (siteConfig: SiteConfig<ThemeConfig>) => Awaitable<void>
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Render end hook: called when SSR rendering is done.
|
|
|
|
* Render end hook: called when SSR rendering is done.
|
|
|
@ -173,7 +173,9 @@ export interface UserConfig<ThemeConfig = any>
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* This build hook will allow you to modify the head adding new entries that cannot be statically added.
|
|
|
|
* This build hook will allow you to modify the head adding new entries that cannot be statically added.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
transformHead?: (context: TransformContext) => Awaitable<HeadConfig[] | void>
|
|
|
|
transformHead?: (
|
|
|
|
|
|
|
|
ctx: TransformContext<ThemeConfig>
|
|
|
|
|
|
|
|
) => Awaitable<HeadConfig[] | void>
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* HTML transform hook: runs before writing HTML to dist.
|
|
|
|
* HTML transform hook: runs before writing HTML to dist.
|
|
|
@ -181,7 +183,7 @@ export interface UserConfig<ThemeConfig = any>
|
|
|
|
transformHtml?: (
|
|
|
|
transformHtml?: (
|
|
|
|
code: string,
|
|
|
|
code: string,
|
|
|
|
id: string,
|
|
|
|
id: string,
|
|
|
|
ctx: TransformContext
|
|
|
|
ctx: TransformContext<ThemeConfig>
|
|
|
|
) => Awaitable<string | void>
|
|
|
|
) => Awaitable<string | void>
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -189,7 +191,7 @@ export interface UserConfig<ThemeConfig = any>
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
transformPageData?: (
|
|
|
|
transformPageData?: (
|
|
|
|
pageData: PageData,
|
|
|
|
pageData: PageData,
|
|
|
|
ctx: TransformPageContext
|
|
|
|
ctx: TransformPageContext<ThemeConfig>
|
|
|
|
) => Awaitable<Partial<PageData> | { [key: string]: any } | void>
|
|
|
|
) => Awaitable<Partial<PageData> | { [key: string]: any } | void>
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -207,7 +209,7 @@ export interface UserConfig<ThemeConfig = any>
|
|
|
|
|
|
|
|
|
|
|
|
export interface SiteConfig<ThemeConfig = any>
|
|
|
|
export interface SiteConfig<ThemeConfig = any>
|
|
|
|
extends Pick<
|
|
|
|
extends Pick<
|
|
|
|
UserConfig,
|
|
|
|
UserConfig<ThemeConfig>,
|
|
|
|
| 'markdown'
|
|
|
|
| 'markdown'
|
|
|
|
| 'vue'
|
|
|
|
| 'vue'
|
|
|
|
| 'vite'
|
|
|
|
| 'vite'
|
|
|
@ -243,6 +245,6 @@ export interface SiteConfig<ThemeConfig = any>
|
|
|
|
inv: Record<string, string | undefined>
|
|
|
|
inv: Record<string, string | undefined>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger: Logger
|
|
|
|
logger: Logger
|
|
|
|
userConfig: UserConfig
|
|
|
|
userConfig: UserConfig<ThemeConfig>
|
|
|
|
buildConcurrency: number
|
|
|
|
buildConcurrency: number
|
|
|
|
}
|
|
|
|
}
|
|
|
|