feat(nuxi): call nuxt listen hook for dev (#2772)

This commit is contained in:
Harlan Wilton 2022-01-19 03:36:01 +11:00 committed by GitHub
parent 21b664cc74
commit 4bd7adae4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -93,5 +93,8 @@ export default defineNuxtCommand({
})
await load(false)
if (currentNuxt) {
await currentNuxt.hooks.callHook('listen', listener.server, listener)
}
}
})

View File

@ -1,4 +1,5 @@
import type { IncomingMessage, ServerResponse } from 'http'
import type { Server as HttpServer, IncomingMessage, ServerResponse } from 'http'
import type { Server as HttpsServer } from 'https'
import type { Compiler, Configuration, Stats } from 'webpack'
import type { TSConfig } from 'pkg-types'
import type { ModuleContainer } from './module'
@ -101,7 +102,7 @@ export interface NuxtHooks {
'render:setupMiddleware': (app: any) => HookResult
'render:errorMiddleware': (app: any) => HookResult
'render:done': (server: Server) => HookResult
'listen': (listenerServer: any, listener: any) => HookResult
'listen': (listenerServer: HttpServer | HttpsServer, listener: any) => HookResult
'server:nuxt:renderLoading': (req: IncomingMessage, res: ServerResponse) => HookResult
'render:route': (url: string, result: RenderResult, context: any) => HookResult
'render:routeDone': (url: string, result: RenderResult, context: any) => HookResult