From fa608f60b1948e6f647017bd73cdf8952606d861 Mon Sep 17 00:00:00 2001 From: manchenkoff Date: Sat, 1 Jun 2024 17:41:05 +0200 Subject: [PATCH] fix: updated exporting nuxt schemas --- src/index.d.ts | 30 ------------------------------ src/module.ts | 29 ++++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 31 deletions(-) delete mode 100644 src/index.d.ts diff --git a/src/index.d.ts b/src/index.d.ts deleted file mode 100644 index 39b32e7..0000000 --- a/src/index.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type { - SanctumModuleOptions, - SanctumGlobalMiddlewarePageMeta, - SanctumAppConfig, -} from './runtime/types'; - -declare module 'nuxt/schema' { - interface PublicRuntimeConfig { - sanctum: Partial; - } - - interface AppConfig { - sanctum?: SanctumAppConfig; - } -} - -declare module '#app' { - interface PageMeta { - /** - * @deprecated Use `sanctum.excluded` instead. - */ - excludeFromSanctum?: boolean; - /** - * Sanctum global middleware page configuration. - */ - sanctum?: Partial; - } -} - -export {}; diff --git a/src/module.ts b/src/module.ts index f80e149..14ce858 100644 --- a/src/module.ts +++ b/src/module.ts @@ -7,13 +7,40 @@ import { useLogger, } from '@nuxt/kit'; import { defu } from 'defu'; -import type { SanctumModuleOptions } from './runtime/types'; +import type { + SanctumAppConfig, + SanctumGlobalMiddlewarePageMeta, + SanctumModuleOptions, +} from './runtime/types'; import { defaultModuleOptions } from './config'; type DeepPartial = { [P in keyof T]?: T[P] extends object ? DeepPartial : T[P]; }; +declare module '@nuxt/schema' { + interface PublicRuntimeConfig { + sanctum: Partial; + } + + interface AppConfig { + sanctum?: SanctumAppConfig; + } +} + +declare module '#app' { + interface PageMeta { + /** + * @deprecated Use `sanctum.excluded` instead. + */ + excludeFromSanctum?: boolean; + /** + * Sanctum global middleware page configuration. + */ + sanctum?: Partial; + } +} + const MODULE_NAME = 'nuxt-auth-sanctum'; export type ModuleOptions = DeepPartial;