Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
20a5623
commit a086770
Showing
3 changed files
with
33 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,38 @@ | ||
import { RequestHandler } from 'express'; | ||
// tslint:disable-next-line no-implicit-dependencies | ||
import { MultiCompiler, Stats } from 'webpack'; | ||
type Options<T = Record<string, any>> = Partial<{ | ||
import { Context, Next } from 'koa'; | ||
|
||
type CreateHandler< | ||
InnerHandler = RequestHandler, | ||
Handler = RequestHandler, | ||
> = (error: boolean, serverRenderer: InnerHandler) => Handler; | ||
|
||
type Options< | ||
ServerRendererOptions = Record<string, any>, | ||
InnerHandler = RequestHandler, | ||
Handler = RequestHandler, | ||
> = Partial<{ | ||
/** The name of the server entry point, defaults to 'main'. */ | ||
chunkName: string; | ||
|
||
/** object Mixed in with clientStats & serverStats and passed to the serverRenderer. */ | ||
serverRendererOptions: T; | ||
serverRendererOptions: ServerRendererOptions; | ||
|
||
createHandler(error: boolean, serverRenderer: RequestHandler): RequestHandler; | ||
createHandler: CreateHandler<InnerHandler, Handler>; | ||
}>; | ||
|
||
declare function webpackHotServerMiddleware<T>( | ||
export default function webpackHotServerMiddleware< | ||
ServerRendererOptions, | ||
InnerHandler = RequestHandler, | ||
Handler = RequestHandler, | ||
>( | ||
compiler: MultiCompiler, | ||
options?: Options<T>, | ||
): RequestHandler; | ||
options?: Options<ServerRendererOptions, InnerHandler, Handler>, | ||
): Handler; | ||
|
||
export const createConnectHandler: CreateHandler<RequestHandler, RequestHandler>; | ||
|
||
type KoaHandler = (ctx: Context, next: Next) => any; | ||
|
||
export = webpackHotServerMiddleware; | ||
export const createKoaHandler: CreateHandler<KoaHandler, KoaHandler>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters