import { defineNuxtModule, createResolver, addComponentsDir } from '@nuxt/kit'
import type { Nuxt } from '@nuxt/schema'

export interface ModuleOptions {}

export default defineNuxtModule<ModuleOptions>({
  meta: {
    name: '@enesis/editor',
    configKey: 'enesis',
    compatibility: {
      nuxt: '^4.0.0'
    }
  },
  setup(_options: ModuleOptions, _nuxt: Nuxt) {
    const resolver = createResolver(import.meta.url)

    addComponentsDir({
      path: resolver.resolve('./components'),
      global: true,
      watch: true,
    })
  }
})
