1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
export = wdm ;
4
2
/** @typedef {import("schema-utils/declarations/validate").Schema } Schema */
5
3
/** @typedef {import("webpack").Compiler } Compiler */
@@ -154,8 +152,7 @@ export = wdm;
154
152
* @returns {API<RequestInternal, ResponseInternal> }
155
153
*/
156
154
declare function wdm <
157
- RequestInternal extends
158
- import ( "http" ) . IncomingMessage = import ( "http" ) . IncomingMessage ,
155
+ RequestInternal extends IncomingMessage = import ( "http" ) . IncomingMessage ,
159
156
ResponseInternal extends ServerResponse = ServerResponse ,
160
157
> (
161
158
compiler : Compiler | MultiCompiler ,
@@ -204,14 +201,6 @@ declare namespace wdm {
204
201
HapiOptions ,
205
202
} ;
206
203
}
207
- type Compiler = import ( "webpack" ) . Compiler ;
208
- type MultiCompiler = import ( "webpack" ) . MultiCompiler ;
209
- type API <
210
- RequestInternal extends
211
- import ( "http" ) . IncomingMessage = import ( "http" ) . IncomingMessage ,
212
- ResponseInternal extends ServerResponse = ServerResponse ,
213
- > = Middleware < RequestInternal , ResponseInternal > &
214
- AdditionalMethods < RequestInternal , ResponseInternal > ;
215
204
/**
216
205
* @template S
217
206
* @template O
@@ -243,28 +232,25 @@ declare function hapiWrapper<
243
232
* @returns {(ctx: any, next: Function) => Promise<void> | void }
244
233
*/
245
234
declare function koaWrapper <
246
- RequestInternal extends
247
- import ( "http" ) . IncomingMessage = import ( "http" ) . IncomingMessage ,
235
+ RequestInternal extends IncomingMessage = import ( "http" ) . IncomingMessage ,
248
236
ResponseInternal extends ServerResponse = ServerResponse ,
249
237
> (
250
238
compiler : Compiler | MultiCompiler ,
251
239
options ?: Options < RequestInternal , ResponseInternal > | undefined ,
252
240
) : ( ctx : any , next : Function ) => Promise < void > | void ;
253
241
type Schema = import ( "schema-utils/declarations/validate" ) . Schema ;
242
+ type Compiler = import ( "webpack" ) . Compiler ;
243
+ type MultiCompiler = import ( "webpack" ) . MultiCompiler ;
254
244
type Configuration = import ( "webpack" ) . Configuration ;
255
245
type Stats = import ( "webpack" ) . Stats ;
256
246
type MultiStats = import ( "webpack" ) . MultiStats ;
257
247
type ReadStream = import ( "fs" ) . ReadStream ;
258
248
type ExtendedServerResponse = {
259
249
locals ?:
260
250
| {
261
- webpack ?:
262
- | {
263
- devMiddleware ?:
264
- | Context < import ( "http" ) . IncomingMessage , ServerResponse >
265
- | undefined ;
266
- }
267
- | undefined ;
251
+ webpack ?: {
252
+ devMiddleware ?: Context < IncomingMessage , ServerResponse > ;
253
+ } ;
268
254
}
269
255
| undefined ;
270
256
} ;
@@ -289,8 +275,7 @@ type ResponseData = {
289
275
byteLength : number ;
290
276
} ;
291
277
type ModifyResponseData <
292
- RequestInternal extends
293
- import ( "http" ) . IncomingMessage = import ( "http" ) . IncomingMessage ,
278
+ RequestInternal extends IncomingMessage = import ( "http" ) . IncomingMessage ,
294
279
ResponseInternal extends ServerResponse = ServerResponse ,
295
280
> = (
296
281
req : RequestInternal ,
@@ -299,8 +284,7 @@ type ModifyResponseData<
299
284
byteLength : number ,
300
285
) => ResponseData ;
301
286
type Context <
302
- RequestInternal extends
303
- import ( "http" ) . IncomingMessage = import ( "http" ) . IncomingMessage ,
287
+ RequestInternal extends IncomingMessage = import ( "http" ) . IncomingMessage ,
304
288
ResponseInternal extends ServerResponse = ServerResponse ,
305
289
> = {
306
290
state : boolean ;
@@ -313,8 +297,7 @@ type Context<
313
297
outputFileSystem : OutputFileSystem ;
314
298
} ;
315
299
type FilledContext <
316
- RequestInternal extends
317
- import ( "http" ) . IncomingMessage = import ( "http" ) . IncomingMessage ,
300
+ RequestInternal extends IncomingMessage = import ( "http" ) . IncomingMessage ,
318
301
ResponseInternal extends ServerResponse = ServerResponse ,
319
302
> = WithoutUndefined < Context < RequestInternal , ResponseInternal > , "watching" > ;
320
303
type NormalizedHeaders =
@@ -324,8 +307,7 @@ type NormalizedHeaders =
324
307
value : number | string ;
325
308
} > ;
326
309
type Headers <
327
- RequestInternal extends
328
- import ( "http" ) . IncomingMessage = import ( "http" ) . IncomingMessage ,
310
+ RequestInternal extends IncomingMessage = import ( "http" ) . IncomingMessage ,
329
311
ResponseInternal extends ServerResponse = ServerResponse ,
330
312
> =
331
313
| NormalizedHeaders
@@ -336,8 +318,7 @@ type Headers<
336
318
) => void | undefined | NormalizedHeaders )
337
319
| undefined ;
338
320
type Options <
339
- RequestInternal extends
340
- import ( "http" ) . IncomingMessage = import ( "http" ) . IncomingMessage ,
321
+ RequestInternal extends IncomingMessage = import ( "http" ) . IncomingMessage ,
341
322
ResponseInternal extends ServerResponse = ServerResponse ,
342
323
> = {
343
324
mimeTypes ?:
@@ -361,8 +342,7 @@ type Options<
361
342
lastModified ?: boolean | undefined ;
362
343
} ;
363
344
type Middleware <
364
- RequestInternal extends
365
- import ( "http" ) . IncomingMessage = import ( "http" ) . IncomingMessage ,
345
+ RequestInternal extends IncomingMessage = import ( "http" ) . IncomingMessage ,
366
346
ResponseInternal extends ServerResponse = ServerResponse ,
367
347
> = (
368
348
req : RequestInternal ,
@@ -378,7 +358,7 @@ type WaitUntilValid = (callback: Callback) => any;
378
358
type Invalidate = ( callback : Callback ) => any ;
379
359
type Close = ( callback : ( err : Error | null | undefined ) => void ) => any ;
380
360
type AdditionalMethods <
381
- RequestInternal extends import ( "http" ) . IncomingMessage ,
361
+ RequestInternal extends IncomingMessage ,
382
362
ResponseInternal extends ServerResponse ,
383
363
> = {
384
364
getFilenameFromUrl : GetFilenameFromUrl ;
@@ -387,6 +367,11 @@ type AdditionalMethods<
387
367
close : Close ;
388
368
context : Context < RequestInternal , ResponseInternal > ;
389
369
} ;
370
+ type API <
371
+ RequestInternal extends IncomingMessage = import ( "http" ) . IncomingMessage ,
372
+ ResponseInternal extends ServerResponse = ServerResponse ,
373
+ > = Middleware < RequestInternal , ResponseInternal > &
374
+ AdditionalMethods < RequestInternal , ResponseInternal > ;
390
375
type WithOptional < T , K extends keyof T > = Omit < T , K > & Partial < T > ;
391
376
type WithoutUndefined < T , K extends keyof T > = T & {
392
377
[ P in K ] : NonNullable < T [ P ] > ;
0 commit comments