Skip to content

Commit

Permalink
feat: make definePage() globally available
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Jun 18, 2024
1 parent a5d1546 commit 7a57597
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,9 @@ declare module 'vue-router/auto' {
// export { defineColadaLoader } from 'unplugin-vue-router/data-loaders/pinia-colada'
}

// Make the macros globally available
declare global {
const definePage: (typeof import('unplugin-vue-router/runtime'))['definePage']
}

export {}
1 change: 0 additions & 1 deletion playground/auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
export {}
declare global {
const defineBasicLoader: typeof import('unplugin-vue-router/data-loaders/basic')['defineBasicLoader']
const definePage: typeof import('unplugin-vue-router/runtime')['definePage']
const onBeforeRouteLeave: typeof import('vue-router/auto')['onBeforeRouteLeave']
const onBeforeRouteUpdate: typeof import('vue-router/auto')['onBeforeRouteUpdate']
const useRoute: typeof import('vue-router/auto')['useRoute']
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,5 +181,5 @@ export const VueRouterAutoImports: Record<
// NOTE: the typing seems broken locally, so instead we export it directly from unplugin-vue-router/runtime
// 'definePage',
],
'unplugin-vue-router/runtime': ['definePage'],
'unplugin-vue-router/runtime': [],
}
1 change: 1 addition & 0 deletions src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export * from './data-loaders'
* @deprecated - use `definePage` instead
*/
export const _definePage = (route: DefinePage) => route

/**
* Defines properties of the route for the current page component.
*
Expand Down

0 comments on commit 7a57597

Please sign in to comment.