forked from Mirrors/elk
refactor: use server auto-imports (#1675)
This commit is contained in:
parent
7da49afde5
commit
f04b09a40d
6 changed files with 12 additions and 13 deletions
|
@ -1,5 +1,5 @@
|
|||
import { rm } from 'fs/promises'
|
||||
import { addImports, addPlugin, createResolver, defineNuxtModule, useNuxt } from '@nuxt/kit'
|
||||
import { addImports, addImportsSources, addPlugin, createResolver, defineNuxtModule, useNuxt } from '@nuxt/kit'
|
||||
|
||||
export default defineNuxtModule({
|
||||
meta: {
|
||||
|
@ -38,6 +38,14 @@ export default defineNuxtModule({
|
|||
config.scanDirs = []
|
||||
})
|
||||
|
||||
addImportsSources({
|
||||
from: 'h3',
|
||||
imports: ['defineEventHandler', 'getQuery', 'getRouterParams', 'readBody', 'sendRedirect'] as Array<keyof typeof import('h3')>,
|
||||
})
|
||||
|
||||
nuxt.options.imports.dirs = nuxt.options.imports.dirs || []
|
||||
nuxt.options.imports.dirs.push(resolve('../../server/utils'))
|
||||
|
||||
addImports({ name: 'useStorage', from: resolve('./runtime/storage') })
|
||||
|
||||
addPlugin(resolve('./runtime/logging.client'))
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import { deleteApp } from '~~/server/shared'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const { server } = getRouterParams(event)
|
||||
const { key } = getQuery(event)
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import { stringifyQuery } from 'ufo'
|
||||
import { createError, defineEventHandler, getRouterParams, readBody } from 'h3'
|
||||
import { getApp, getRedirectURI } from '~/server/shared'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
let { server } = getRouterParams(event)
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import { stringifyQuery } from 'vue-router'
|
||||
import { createError, defineEventHandler, getQuery, getRouterParams, sendRedirect } from 'h3'
|
||||
import { getApp, getRedirectURI } from '~/server/shared'
|
||||
import { stringifyQuery } from 'ufo'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const { origin } = getQuery(event) as { origin: string }
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
import { defineEventHandler } from 'h3'
|
||||
import { listServers } from '~/server/shared'
|
||||
|
||||
let servers: string[]
|
||||
|
||||
export default defineEventHandler(async () => {
|
||||
|
|
|
@ -8,8 +8,8 @@ import { stringifyQuery } from 'ufo'
|
|||
import { $fetch } from 'ofetch'
|
||||
import type { Storage } from 'unstorage'
|
||||
|
||||
import cached from './cache-driver'
|
||||
import kv from './cloudflare-driver'
|
||||
import cached from '../cache-driver'
|
||||
import kv from '../cloudflare-driver'
|
||||
|
||||
// @ts-expect-error virtual import
|
||||
import { env } from '#build-info'
|
Loading…
Reference in a new issue