@@ -28,7 +28,7 @@ export = wdm;
28
28
* @typedef {ReturnType<Compiler["watch"]> } MultiWatching
29
29
*/
30
30
/**
31
- * @typedef {Compiler["outputFileSystem"] & { createReadStream?: import("fs").createReadStream, statSync?: import("fs").statSync, lstat?: import("fs").lstat, readFileSync?: import("fs").readFileSync } } OutputFileSystem
31
+ * @typedef {Compiler["outputFileSystem"] & { createReadStream?: import("fs").createReadStream, statSync?: import("fs").statSync, lstat?: import("fs").lstat, existsSync?: import("fs").existsSync, readFileSync?: import("fs").readFileSync } } OutputFileSystem
32
32
*/
33
33
/** @typedef {ReturnType<Compiler["getInfrastructureLogger"]> } Logger */
34
34
/**
@@ -116,150 +116,128 @@ export = wdm;
116
116
* @param {Options<RequestInternal, ResponseInternal> } [options]
117
117
* @returns {API<RequestInternal, ResponseInternal> }
118
118
*/
119
- declare function wdm <
120
- RequestInternal extends import ( "http" ) . IncomingMessage ,
121
- ResponseInternal extends ServerResponse
122
- > (
123
- compiler : Compiler | MultiCompiler ,
124
- options ?: Options < RequestInternal , ResponseInternal > | undefined
119
+ declare function wdm < RequestInternal extends import ( 'http' ) . IncomingMessage , ResponseInternal extends ServerResponse > (
120
+ compiler : Compiler | MultiCompiler ,
121
+ options ?: Options < RequestInternal , ResponseInternal > | undefined
125
122
) : API < RequestInternal , ResponseInternal > ;
126
123
declare namespace wdm {
127
- export {
128
- Schema ,
129
- Compiler ,
130
- MultiCompiler ,
131
- Configuration ,
132
- Stats ,
133
- MultiStats ,
134
- ExtendedServerResponse ,
135
- IncomingMessage ,
136
- ServerResponse ,
137
- NextFunction ,
138
- WatchOptions ,
139
- Watching ,
140
- MultiWatching ,
141
- OutputFileSystem ,
142
- Logger ,
143
- Callback ,
144
- Context ,
145
- Headers ,
146
- Options ,
147
- Middleware ,
148
- GetFilenameFromUrl ,
149
- WaitUntilValid ,
150
- Invalidate ,
151
- Close ,
152
- AdditionalMethods ,
153
- API ,
154
- } ;
124
+ export {
125
+ Schema ,
126
+ Compiler ,
127
+ MultiCompiler ,
128
+ Configuration ,
129
+ Stats ,
130
+ MultiStats ,
131
+ ExtendedServerResponse ,
132
+ IncomingMessage ,
133
+ ServerResponse ,
134
+ NextFunction ,
135
+ WatchOptions ,
136
+ Watching ,
137
+ MultiWatching ,
138
+ OutputFileSystem ,
139
+ Logger ,
140
+ Callback ,
141
+ Context ,
142
+ Headers ,
143
+ Options ,
144
+ Middleware ,
145
+ GetFilenameFromUrl ,
146
+ WaitUntilValid ,
147
+ Invalidate ,
148
+ Close ,
149
+ AdditionalMethods ,
150
+ API ,
151
+ } ;
155
152
}
156
- type ServerResponse = import ( "http" ) . ServerResponse & ExtendedServerResponse ;
157
- type Compiler = import ( "webpack" ) . Compiler ;
158
- type MultiCompiler = import ( "webpack" ) . MultiCompiler ;
159
- type Options <
160
- RequestInternal extends import ( "http" ) . IncomingMessage ,
161
- ResponseInternal extends ServerResponse
162
- > = {
163
- mimeTypes ?:
164
- | {
165
- [ key : string ] : string ;
166
- }
167
- | undefined ;
168
- writeToDisk ?: boolean | ( ( targetPath : string ) => boolean ) | undefined ;
169
- methods ?: string | undefined ;
170
- headers ?: Headers < RequestInternal , ResponseInternal > ;
171
- publicPath ?: NonNullable < Configuration [ "output" ] > [ "publicPath" ] ;
172
- stats ?: Configuration [ "stats" ] ;
173
- serverSideRender ?: boolean | undefined ;
174
- outputFileSystem ?: OutputFileSystem | undefined ;
175
- index ?: string | boolean | undefined ;
176
- historyApiFallback ?: boolean ;
153
+ type ServerResponse = import ( 'http' ) . ServerResponse & ExtendedServerResponse ;
154
+ type Compiler = import ( 'webpack' ) . Compiler ;
155
+ type MultiCompiler = import ( 'webpack' ) . MultiCompiler ;
156
+ type Options < RequestInternal extends import ( 'http' ) . IncomingMessage , ResponseInternal extends ServerResponse > = {
157
+ mimeTypes ?:
158
+ | {
159
+ [ key : string ] : string ;
160
+ }
161
+ | undefined ;
162
+ writeToDisk ?: boolean | ( ( targetPath : string ) => boolean ) | undefined ;
163
+ methods ?: string | undefined ;
164
+ headers ?: Headers < RequestInternal , ResponseInternal > ;
165
+ publicPath ?: NonNullable < Configuration [ 'output' ] > [ 'publicPath' ] ;
166
+ stats ?: Configuration [ 'stats' ] ;
167
+ serverSideRender ?: boolean | undefined ;
168
+ outputFileSystem ?: OutputFileSystem | undefined ;
169
+ index ?: string | boolean | undefined ;
170
+ historyApiFallback ?: boolean | undefined ;
177
171
} ;
178
- type API <
179
- RequestInternal extends import ( "http" ) . IncomingMessage ,
180
- ResponseInternal extends ServerResponse
181
- > = Middleware < RequestInternal , ResponseInternal > &
182
- AdditionalMethods < RequestInternal , ResponseInternal > ;
183
- type Schema = import ( " schema-utils/declarations/validate" ) . Schema ;
184
- type Configuration = import ( " webpack" ) . Configuration ;
185
- type Stats = import ( " webpack" ) . Stats ;
186
- type MultiStats = import ( " webpack" ) . MultiStats ;
172
+ type API < RequestInternal extends import ( 'http' ) . IncomingMessage , ResponseInternal extends ServerResponse > = Middleware <
173
+ RequestInternal ,
174
+ ResponseInternal
175
+ > &
176
+ AdditionalMethods < RequestInternal , ResponseInternal > ;
177
+ type Schema = import ( ' schema-utils/declarations/validate' ) . Schema ;
178
+ type Configuration = import ( ' webpack' ) . Configuration ;
179
+ type Stats = import ( ' webpack' ) . Stats ;
180
+ type MultiStats = import ( ' webpack' ) . MultiStats ;
187
181
type ExtendedServerResponse = {
188
- locals ?:
189
- | {
190
- webpack ?:
191
- | {
192
- devMiddleware ?:
193
- | Context < import ( "http" ) . IncomingMessage , ServerResponse >
194
- | undefined ;
195
- }
196
- | undefined ;
197
- }
198
- | undefined ;
182
+ locals ?:
183
+ | {
184
+ webpack ?:
185
+ | {
186
+ devMiddleware ?: Context < import ( 'http' ) . IncomingMessage , ServerResponse > | undefined ;
187
+ }
188
+ | undefined ;
189
+ }
190
+ | undefined ;
199
191
} ;
200
- type IncomingMessage = import ( " http" ) . IncomingMessage ;
192
+ type IncomingMessage = import ( ' http' ) . IncomingMessage ;
201
193
type NextFunction = ( err ?: any ) => void ;
202
- type WatchOptions = NonNullable < Configuration [ " watchOptions" ] > ;
203
- type Watching = Compiler [ " watching" ] ;
204
- type MultiWatching = ReturnType < Compiler [ " watch" ] > ;
205
- type OutputFileSystem = Compiler [ " outputFileSystem" ] & {
206
- createReadStream ?: typeof import ( "fs" ) . createReadStream ;
207
- statSync ?: import ( "fs" ) . StatSyncFn ;
208
- lstat ?: typeof import ( "fs" ) . lstat ;
209
- existsSync ?: typeof import ( "fs" ) . existsSync ;
210
- readFileSync ?: typeof import ( "fs" ) . readFileSync ;
194
+ type WatchOptions = NonNullable < Configuration [ ' watchOptions' ] > ;
195
+ type Watching = Compiler [ ' watching' ] ;
196
+ type MultiWatching = ReturnType < Compiler [ ' watch' ] > ;
197
+ type OutputFileSystem = Compiler [ ' outputFileSystem' ] & {
198
+ createReadStream ?: typeof import ( 'fs' ) . createReadStream ;
199
+ statSync ?: import ( 'fs' ) . StatSyncFn ;
200
+ lstat ?: typeof import ( 'fs' ) . lstat ;
201
+ existsSync ?: typeof import ( 'fs' ) . existsSync ;
202
+ readFileSync ?: typeof import ( 'fs' ) . readFileSync ;
211
203
} ;
212
- type Logger = ReturnType < Compiler [ "getInfrastructureLogger" ] > ;
213
- type Callback = (
214
- stats ?: import ( "webpack" ) . Stats | import ( "webpack" ) . MultiStats | undefined
215
- ) => any ;
216
- type Context <
217
- RequestInternal extends import ( "http" ) . IncomingMessage ,
218
- ResponseInternal extends ServerResponse
219
- > = {
220
- state : boolean ;
221
- stats : Stats | MultiStats | undefined ;
222
- callbacks : Callback [ ] ;
223
- options : Options < RequestInternal , ResponseInternal > ;
224
- compiler : Compiler | MultiCompiler ;
225
- watching : Watching | MultiWatching ;
226
- logger : Logger ;
227
- outputFileSystem : OutputFileSystem ;
204
+ type Logger = ReturnType < Compiler [ 'getInfrastructureLogger' ] > ;
205
+ type Callback = ( stats ?: import ( 'webpack' ) . Stats | import ( 'webpack' ) . MultiStats | undefined ) => any ;
206
+ type Context < RequestInternal extends import ( 'http' ) . IncomingMessage , ResponseInternal extends ServerResponse > = {
207
+ state : boolean ;
208
+ stats : Stats | MultiStats | undefined ;
209
+ callbacks : Callback [ ] ;
210
+ options : Options < RequestInternal , ResponseInternal > ;
211
+ compiler : Compiler | MultiCompiler ;
212
+ watching : Watching | MultiWatching ;
213
+ logger : Logger ;
214
+ outputFileSystem : OutputFileSystem ;
228
215
} ;
229
- type Headers <
230
- RequestInternal extends import ( "http" ) . IncomingMessage ,
231
- ResponseInternal extends ServerResponse
232
- > =
233
- | Record < string , string | number >
234
- | {
235
- key : string ;
236
- value : number | string ;
237
- } [ ]
238
- | ( (
239
- req : RequestInternal ,
240
- res : ResponseInternal ,
241
- context : Context < RequestInternal , ResponseInternal >
242
- ) => void | undefined | Record < string , string | number > )
243
- | undefined ;
244
- type Middleware <
245
- RequestInternal extends import ( "http" ) . IncomingMessage ,
246
- ResponseInternal extends ServerResponse
247
- > = (
248
- req : RequestInternal ,
249
- res : ResponseInternal ,
250
- next : NextFunction
216
+ type Headers < RequestInternal extends import ( 'http' ) . IncomingMessage , ResponseInternal extends ServerResponse > =
217
+ | Record < string , string | number >
218
+ | {
219
+ key : string ;
220
+ value : number | string ;
221
+ } [ ]
222
+ | ( (
223
+ req : RequestInternal ,
224
+ res : ResponseInternal ,
225
+ context : Context < RequestInternal , ResponseInternal >
226
+ ) => void | undefined | Record < string , string | number > )
227
+ | undefined ;
228
+ type Middleware < RequestInternal extends import ( 'http' ) . IncomingMessage , ResponseInternal extends ServerResponse > = (
229
+ req : RequestInternal ,
230
+ res : ResponseInternal ,
231
+ next : NextFunction
251
232
) => Promise < void > ;
252
233
type GetFilenameFromUrl = ( url : string ) => string | undefined ;
253
234
type WaitUntilValid = ( callback : Callback ) => any ;
254
235
type Invalidate = ( callback : Callback ) => any ;
255
236
type Close = ( callback : ( err : Error | null | undefined ) => void ) => any ;
256
- type AdditionalMethods <
257
- RequestInternal extends import ( "http" ) . IncomingMessage ,
258
- ResponseInternal extends ServerResponse
259
- > = {
260
- getFilenameFromUrl : GetFilenameFromUrl ;
261
- waitUntilValid : WaitUntilValid ;
262
- invalidate : Invalidate ;
263
- close : Close ;
264
- context : Context < RequestInternal , ResponseInternal > ;
237
+ type AdditionalMethods < RequestInternal extends import ( 'http' ) . IncomingMessage , ResponseInternal extends ServerResponse > = {
238
+ getFilenameFromUrl : GetFilenameFromUrl ;
239
+ waitUntilValid : WaitUntilValid ;
240
+ invalidate : Invalidate ;
241
+ close : Close ;
242
+ context : Context < RequestInternal , ResponseInternal > ;
265
243
} ;
0 commit comments