2022-08-04 15:15:42 +00:00
|
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
import { defineNuxtModule, addPlugin, useNuxt } from '@nuxt/kit'
|
2022-02-15 09:50:11 +00:00
|
|
|
|
|
|
|
export default defineNuxtModule({
|
|
|
|
defaults: {
|
2023-01-21 16:55:44 +00:00
|
|
|
enabled: true,
|
|
|
|
typeTest: (value: boolean) => typeof value === 'boolean'
|
2022-02-15 09:50:11 +00:00
|
|
|
},
|
|
|
|
meta: {
|
|
|
|
name: 'my-module',
|
|
|
|
configKey: 'sampleModule'
|
2022-08-04 15:15:42 +00:00
|
|
|
},
|
|
|
|
setup () {
|
|
|
|
addPlugin(fileURLToPath(new URL('./runtime/plugin', import.meta.url)))
|
|
|
|
useNuxt().hook('app:resolve', (app) => {
|
|
|
|
app.middleware.push({
|
|
|
|
name: 'unctx-test',
|
|
|
|
path: fileURLToPath(new URL('./runtime/middleware', import.meta.url)),
|
|
|
|
global: true
|
|
|
|
})
|
|
|
|
})
|
2022-02-15 09:50:11 +00:00
|
|
|
}
|
|
|
|
})
|