Skip to content

Commit

Permalink
refactor(chore): use new nuxt kit tools isNuxtMajorVersion and define…
Browse files Browse the repository at this point in the history
…NuxtModule().with()
  • Loading branch information
xibman committed Sep 16, 2024
1 parent 012e4bd commit d236b1d
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
addPlugin,
createResolver,
defineNuxtModule,
isNuxt3,
isNuxtMajorVersion,
useLogger,
} from '@nuxt/kit'
import type { NuxtI18nOptions, LocaleObject } from '@nuxtjs/i18n'
Expand All @@ -17,7 +17,7 @@ export interface ModuleOptions {
localeCodesMapping?: Record<string, string>
}

export default defineNuxtModule<ModuleOptions>({
export default defineNuxtModule<ModuleOptions>().with({
meta: {
compatibility: {
nuxt: '>=3.0.0',
Expand Down Expand Up @@ -67,7 +67,7 @@ export default defineNuxtModule<ModuleOptions>({
logger.fatal('Nuxt I18n required')
}

if (!isNuxt3()) {
if (!isNuxtMajorVersion(3, nuxt)) {
logger.error('Nuxt 3 required')
}

Expand Down Expand Up @@ -111,11 +111,3 @@ export default defineNuxtModule<ModuleOptions>({
addPlugin(resolve('./runtime/plugin'))
},
})

export interface ModulePublicRuntimeConfig {
zodI18n: ModuleOptions
}

declare module '@nuxt/schema' {
interface PublicRuntimeConfig extends ModulePublicRuntimeConfig { }
}

0 comments on commit d236b1d

Please sign in to comment.