mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
feat: pages:resolved
hook
This commit is contained in:
parent
181d043eaf
commit
9d387f722c
@ -64,17 +64,14 @@ export async function resolvePagesRoutes (): Promise<NuxtPage[]> {
|
||||
shouldUseServerComponents: !!nuxt.options.experimental.componentIslands,
|
||||
})
|
||||
|
||||
const pages = uniqueBy(allRoutes, 'path')
|
||||
|
||||
const shouldAugment = nuxt.options.experimental.scanPageMeta || nuxt.options.experimental.typedPages
|
||||
|
||||
const pages = uniqueBy(allRoutes, 'path')
|
||||
|
||||
await nuxt.callHook('pages:extend', pages)
|
||||
if (shouldAugment) {
|
||||
const augmentedPages = await augmentPages(pages, nuxt.vfs)
|
||||
await nuxt.callHook('pages:extend', pages)
|
||||
await augmentPages(pages, nuxt.vfs, augmentedPages)
|
||||
augmentedPages.clear()
|
||||
} else {
|
||||
await nuxt.callHook('pages:extend', pages)
|
||||
await augmentPages(pages, nuxt.vfs)
|
||||
await nuxt.callHook('pages:resolved', pages)
|
||||
}
|
||||
|
||||
return pages
|
||||
|
@ -189,6 +189,13 @@ export interface NuxtHooks {
|
||||
*/
|
||||
'pages:extend': (pages: NuxtPage[]) => HookResult
|
||||
|
||||
/**
|
||||
* Called after pages routes are resolved.
|
||||
* @param pages Array containing resolved pages
|
||||
* @returns Promise
|
||||
*/
|
||||
'pages:resolved': (pages: NuxtPage[]) => HookResult
|
||||
|
||||
/**
|
||||
* Called when resolving `app/router.options` files. It allows modifying the detected router options files
|
||||
* and adding new ones.
|
||||
|
Loading…
Reference in New Issue
Block a user