Skip to content

Commit e47ffe6

Browse files
drudrumAleksey Druzhinin
authored and
Aleksey Druzhinin
committed
chore: run build cmd
1 parent baa8925 commit e47ffe6

9 files changed

+255
-205
lines changed

types/index.d.ts

+132-110
Original file line numberDiff line numberDiff line change
@@ -116,128 +116,150 @@ export = wdm;
116116
* @param {Options<RequestInternal, ResponseInternal>} [options]
117117
* @returns {API<RequestInternal, ResponseInternal>}
118118
*/
119-
declare function wdm<RequestInternal extends import('http').IncomingMessage, ResponseInternal extends ServerResponse>(
120-
compiler: Compiler | MultiCompiler,
121-
options?: Options<RequestInternal, ResponseInternal> | undefined
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
122125
): API<RequestInternal, ResponseInternal>;
123126
declare namespace wdm {
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-
};
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+
};
152155
}
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;
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 | undefined;
171177
};
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;
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;
181187
type ExtendedServerResponse = {
182-
locals?:
183-
| {
184-
webpack?:
185-
| {
186-
devMiddleware?: Context<import('http').IncomingMessage, ServerResponse> | undefined;
187-
}
188-
| undefined;
189-
}
190-
| undefined;
188+
locals?:
189+
| {
190+
webpack?:
191+
| {
192+
devMiddleware?:
193+
| Context<import("http").IncomingMessage, ServerResponse>
194+
| undefined;
195+
}
196+
| undefined;
197+
}
198+
| undefined;
191199
};
192-
type IncomingMessage = import('http').IncomingMessage;
200+
type IncomingMessage = import("http").IncomingMessage;
193201
type NextFunction = (err?: any) => void;
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;
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;
203211
};
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;
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;
215228
};
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
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
232251
) => Promise<void>;
233252
type GetFilenameFromUrl = (url: string) => string | undefined;
234253
type WaitUntilValid = (callback: Callback) => any;
235254
type Invalidate = (callback: Callback) => any;
236255
type Close = (callback: (err: Error | null | undefined) => void) => any;
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>;
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>;
243265
};

types/middleware.d.ts

+10-7
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@ export = wrapper;
66
* @param {import("./index.js").Context<Request, Response>} context
77
* @return {import("./index.js").Middleware<Request, Response>}
88
*/
9-
declare function wrapper<Request_1 extends import('http').IncomingMessage, Response_1 extends import('./index.js').ServerResponse>(
10-
context: import('./index.js').Context<Request_1, Response_1>
11-
): import('./index.js').Middleware<Request_1, Response_1>;
9+
declare function wrapper<
10+
Request_1 extends import("http").IncomingMessage,
11+
Response_1 extends import("./index.js").ServerResponse
12+
>(
13+
context: import("./index.js").Context<Request_1, Response_1>
14+
): import("./index.js").Middleware<Request_1, Response_1>;
1215
declare namespace wrapper {
13-
export { NextFunction, IncomingMessage, ServerResponse };
16+
export { NextFunction, IncomingMessage, ServerResponse };
1417
}
15-
type NextFunction = import('./index.js').NextFunction;
16-
type IncomingMessage = import('./index.js').IncomingMessage;
17-
type ServerResponse = import('./index.js').ServerResponse;
18+
type NextFunction = import("./index.js").NextFunction;
19+
type IncomingMessage = import("./index.js").IncomingMessage;
20+
type ServerResponse = import("./index.js").ServerResponse;

types/utils/compatibleAPI.d.ts

+30-24
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/// <reference types="node" />
2-
export type IncomingMessage = import('../index.js').IncomingMessage;
3-
export type ServerResponse = import('../index.js').ServerResponse;
2+
export type IncomingMessage = import("../index.js").IncomingMessage;
3+
export type ServerResponse = import("../index.js").ServerResponse;
44
export type ExpectedRequest = {
5-
get: (name: string) => string | undefined;
5+
get: (name: string) => string | undefined;
66
};
77
export type ExpectedResponse = {
8-
get: (name: string) => string | string[] | undefined;
9-
set: (name: string, value: number | string | string[]) => void;
10-
status: (status: number) => void;
11-
send: (data: any) => void;
8+
get: (name: string) => string | string[] | undefined;
9+
set: (name: string, value: number | string | string[]) => void;
10+
status: (status: number) => void;
11+
send: (data: any) => void;
1212
};
1313
/** @typedef {import("../index.js").IncomingMessage} IncomingMessage */
1414
/** @typedef {import("../index.js").ServerResponse} ServerResponse */
@@ -28,42 +28,45 @@ export type ExpectedResponse = {
2828
* @param {Response} res
2929
* @returns {string[]}
3030
*/
31-
export function getHeaderNames<Response_1 extends import('../index.js').ServerResponse>(res: Response_1): string[];
31+
export function getHeaderNames<
32+
Response_1 extends import("../index.js").ServerResponse
33+
>(res: Response_1): string[];
3234
/**
3335
* @template {IncomingMessage} Request
3436
* @param {Request} req
3537
* @param {string} name
3638
* @returns {string | undefined}
3739
*/
38-
export function getHeaderFromRequest<Request_1 extends import('http').IncomingMessage>(req: Request_1, name: string): string | undefined;
40+
export function getHeaderFromRequest<
41+
Request_1 extends import("http").IncomingMessage
42+
>(req: Request_1, name: string): string | undefined;
3943
/**
4044
* @template {ServerResponse} Response
4145
* @param {Response} res
4246
* @param {string} name
4347
* @returns {number | string | string[] | undefined}
4448
*/
45-
export function getHeaderFromResponse<Response_1 extends import('../index.js').ServerResponse>(
46-
res: Response_1,
47-
name: string
48-
): number | string | string[] | undefined;
49+
export function getHeaderFromResponse<
50+
Response_1 extends import("../index.js").ServerResponse
51+
>(res: Response_1, name: string): number | string | string[] | undefined;
4952
/**
5053
* @template {ServerResponse} Response
5154
* @param {Response} res
5255
* @param {string} name
5356
* @param {number | string | string[]} value
5457
* @returns {void}
5558
*/
56-
export function setHeaderForResponse<Response_1 extends import('../index.js').ServerResponse>(
57-
res: Response_1,
58-
name: string,
59-
value: number | string | string[]
60-
): void;
59+
export function setHeaderForResponse<
60+
Response_1 extends import("../index.js").ServerResponse
61+
>(res: Response_1, name: string, value: number | string | string[]): void;
6162
/**
6263
* @template {ServerResponse} Response
6364
* @param {Response} res
6465
* @param {number} code
6566
*/
66-
export function setStatusCode<Response_1 extends import('../index.js').ServerResponse>(res: Response_1, code: number): void;
67+
export function setStatusCode<
68+
Response_1 extends import("../index.js").ServerResponse
69+
>(res: Response_1, code: number): void;
6770
/**
6871
* @template {IncomingMessage} Request
6972
* @template {ServerResponse} Response
@@ -72,9 +75,12 @@ export function setStatusCode<Response_1 extends import('../index.js').ServerRes
7275
* @param {string | Buffer | import("fs").ReadStream} bufferOtStream
7376
* @param {number} byteLength
7477
*/
75-
export function send<Request_1 extends import('http').IncomingMessage, Response_1 extends import('../index.js').ServerResponse>(
76-
req: Request_1,
77-
res: Response_1,
78-
bufferOtStream: string | Buffer | import('fs').ReadStream,
79-
byteLength: number
78+
export function send<
79+
Request_1 extends import("http").IncomingMessage,
80+
Response_1 extends import("../index.js").ServerResponse
81+
>(
82+
req: Request_1,
83+
res: Response_1,
84+
bufferOtStream: string | Buffer | import("fs").ReadStream,
85+
byteLength: number
8086
): void;

0 commit comments

Comments
 (0)