mirror of https://github.com/nuxt/nuxt.git
chore: inline type literals
This commit is contained in:
parent
16217ad579
commit
9b396ac084
|
@ -1,7 +1,6 @@
|
||||||
import type { Nitro, NitroDevEventHandler, NitroEventHandler } from 'nitropack'
|
import type { Nitro, NitroDevEventHandler, NitroEventHandler } from 'nitropack'
|
||||||
import type { Import } from 'unimport'
|
import type { Import } from 'unimport'
|
||||||
import { normalize } from 'pathe'
|
import { normalize } from 'pathe'
|
||||||
import type { HTTPMethod } from 'h3'
|
|
||||||
import { useNuxt } from './context'
|
import { useNuxt } from './context'
|
||||||
import { toArray } from './utils'
|
import { toArray } from './utils'
|
||||||
|
|
||||||
|
@ -13,7 +12,7 @@ function normalizeHandlerMethod (handler: NitroEventHandler) {
|
||||||
// retrieve method from handler file name
|
// retrieve method from handler file name
|
||||||
const [, method = undefined] = handler.handler.match(/\.(get|head|patch|post|put|delete|connect|options|trace)(\.\w+)*$/) || []
|
const [, method = undefined] = handler.handler.match(/\.(get|head|patch|post|put|delete|connect|options|trace)(\.\w+)*$/) || []
|
||||||
return {
|
return {
|
||||||
method: method as HTTPMethod,
|
method: method as 'get' | 'head' | 'patch' | 'post' | 'put' | 'delete' | 'connect' | 'options' | 'trace',
|
||||||
...handler,
|
...handler,
|
||||||
handler: normalize(handler.handler),
|
handler: normalize(handler.handler),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue