@@ -3,42 +3,52 @@ import type {
33 IncomingMessage ,
44 ServerResponse ,
55} from 'node:http' ;
6- export type { HTTPServer , IncomingMessage } ;
7- export type { Socket } from 'node:net' ;
8- export type { AddressInfo } from 'node:net' ;
9- export type { NetworkInterfaceInfo } from 'node:os' ;
10- export type {
11- Compiler ,
12- DevServer ,
13- MultiCompiler ,
14- MultiStats ,
15- Stats ,
16- StatsCompilation ,
17- StatsOptions ,
18- } from '@rspack/core' ;
6+ import type { ServerOptions } from 'node:https' ;
197import type { FSWatcher , WatchOptions } from 'chokidar' ;
20- export type { FSWatcher , WatchOptions } ;
8+ import type { Options as ConnectHistoryApiFallbackOptions } from 'connect-history-api-fallback' ;
219import type {
2210 Server as ConnectApplication ,
2311 IncomingMessage as ConnectIncomingMessage ,
2412} from 'connect-next' ;
25- export type { ConnectApplication } ;
26- import type { Options as ConnectHistoryApiFallbackOptions } from 'connect-history-api-fallback' ;
27- export type { ConnectHistoryApiFallbackOptions } ;
2813import type {
2914 Options as HttpProxyMiddlewareOptions ,
3015 Filter as HttpProxyMiddlewareOptionsFilter ,
3116 RequestHandler ,
3217} from 'http-proxy-middleware' ;
33- export type { RequestHandler } ;
34- export type { IPv6 } from 'ipaddr.js' ;
3518import type { Options as ServeIndexOptions } from 'serve-index' ;
36- export type { ServeIndexOptions } ;
3719import type { ServeStaticOptions } from 'serve-static' ;
3820
21+ export type {
22+ FSWatcher ,
23+ WatchOptions ,
24+ RequestHandler ,
25+ ServeIndexOptions ,
26+ BasicServer ,
27+ HTTPServer ,
28+ ServerOptions ,
29+ IncomingMessage ,
30+ ConnectApplication ,
31+ ConnectHistoryApiFallbackOptions ,
32+ } ;
33+ export type { IPv6 } from 'ipaddr.js' ;
34+ export type { Socket } from 'node:net' ;
35+ export type { AddressInfo } from 'node:net' ;
36+ export type { NetworkInterfaceInfo } from 'node:os' ;
37+ export type {
38+ Compiler ,
39+ DevServer ,
40+ MultiCompiler ,
41+ MultiStats ,
42+ Stats ,
43+ StatsCompilation ,
44+ StatsOptions ,
45+ } from '@rspack/core' ;
46+
3947// biome-ignore lint/suspicious/noExplicitAny: expected any
4048export type EXPECTED_ANY = any ;
4149
50+ type BasicServer = import ( 'node:net' ) . Server | import ( 'node:tls' ) . Server ;
51+
4252/** https://github.com/microsoft/TypeScript/issues/29729 */
4353export type LiteralUnion < T extends U , U > = T | ( U & Record < never , never > ) ;
4454
@@ -63,8 +73,6 @@ export type HandleFunction =
6373 | NextHandleFunction
6474 | ErrorHandleFunction ;
6575
66- export type ServerOptions = import ( 'https' ) . ServerOptions ;
67-
6876// type-level helpers, inferred as util types
6977export type Request < T extends BasicApplication = ConnectApplication > =
7078 T extends ConnectApplication ? ConnectIncomingMessage : IncomingMessage ;
@@ -116,16 +124,13 @@ export interface NormalizedStatic {
116124 watch : false | WatchOptions ;
117125}
118126
119- export type ServerType <
120- A extends BasicApplication = ConnectApplication ,
121- S extends import ( 'http' ) . Server = import ( 'http' ) . Server ,
122- > =
127+ export type ServerType < A extends BasicApplication , S extends BasicServer > =
123128 | LiteralUnion < 'http' | 'https' | 'http2' , string >
124129 | ( ( serverOptions : ServerOptions , application : A ) => S ) ;
125130
126131export interface ServerConfiguration <
127132 A extends BasicApplication = ConnectApplication ,
128- S extends import ( 'http' ) . Server = import ( 'http' ) . Server ,
133+ S extends BasicServer = HTTPServer ,
129134> {
130135 type ?: ServerType < A , S > ;
131136 options ?: ServerOptions ;
@@ -215,8 +220,6 @@ export interface MiddlewareObject {
215220
216221export type Middleware = MiddlewareObject | MiddlewareHandler ;
217222
218- export type BasicServer = import ( 'net' ) . Server | import ( 'tls' ) . Server ;
219-
220223export type OverlayMessageOptions = boolean | ( ( error : Error ) => void ) ;
221224
222225// TypeScript overloads for connect-like use
0 commit comments