Skip to content

Commit c3242ae

Browse files
committed
chore: after build
1 parent 4ed02bb commit c3242ae

9 files changed

+206
-256
lines changed

types/index.d.ts

Lines changed: 111 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export = wdm;
2828
* @typedef {ReturnType<Compiler["watch"]>} MultiWatching
2929
*/
3030
/**
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
3232
*/
3333
/** @typedef {ReturnType<Compiler["getInfrastructureLogger"]>} Logger */
3434
/**
@@ -116,150 +116,128 @@ export = wdm;
116116
* @param {Options<RequestInternal, ResponseInternal>} [options]
117117
* @returns {API<RequestInternal, ResponseInternal>}
118118
*/
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
125122
): API<RequestInternal, ResponseInternal>;
126123
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+
};
155152
}
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;
177171
};
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;
187181
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;
199191
};
200-
type IncomingMessage = import("http").IncomingMessage;
192+
type IncomingMessage = import('http').IncomingMessage;
201193
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;
211203
};
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;
228215
};
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
251232
) => Promise<void>;
252233
type GetFilenameFromUrl = (url: string) => string | undefined;
253234
type WaitUntilValid = (callback: Callback) => any;
254235
type Invalidate = (callback: Callback) => any;
255236
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>;
265243
};

types/middleware.d.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,12 @@ export = wrapper;
66
* @param {import("./index.js").Context<Request, Response>} context
77
* @return {import("./index.js").Middleware<Request, Response>}
88
*/
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>;
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>;
1512
declare namespace wrapper {
16-
export { NextFunction, IncomingMessage, ServerResponse };
13+
export { NextFunction, IncomingMessage, ServerResponse };
1714
}
18-
type NextFunction = import("./index.js").NextFunction;
19-
type IncomingMessage = import("./index.js").IncomingMessage;
20-
type ServerResponse = import("./index.js").ServerResponse;
15+
type NextFunction = import('./index.js').NextFunction;
16+
type IncomingMessage = import('./index.js').IncomingMessage;
17+
type ServerResponse = import('./index.js').ServerResponse;

types/utils/compatibleAPI.d.ts

Lines changed: 24 additions & 30 deletions
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,45 +28,42 @@ export type ExpectedResponse = {
2828
* @param {Response} res
2929
* @returns {string[]}
3030
*/
31-
export function getHeaderNames<
32-
Response_1 extends import("../index.js").ServerResponse
33-
>(res: Response_1): string[];
31+
export function getHeaderNames<Response_1 extends import('../index.js').ServerResponse>(res: Response_1): string[];
3432
/**
3533
* @template {IncomingMessage} Request
3634
* @param {Request} req
3735
* @param {string} name
3836
* @returns {string | undefined}
3937
*/
40-
export function getHeaderFromRequest<
41-
Request_1 extends import("http").IncomingMessage
42-
>(req: Request_1, name: string): string | undefined;
38+
export function getHeaderFromRequest<Request_1 extends import('http').IncomingMessage>(req: Request_1, name: string): string | undefined;
4339
/**
4440
* @template {ServerResponse} Response
4541
* @param {Response} res
4642
* @param {string} name
4743
* @returns {number | string | string[] | undefined}
4844
*/
49-
export function getHeaderFromResponse<
50-
Response_1 extends import("../index.js").ServerResponse
51-
>(res: Response_1, name: string): number | string | string[] | undefined;
45+
export function getHeaderFromResponse<Response_1 extends import('../index.js').ServerResponse>(
46+
res: Response_1,
47+
name: string
48+
): number | string | string[] | undefined;
5249
/**
5350
* @template {ServerResponse} Response
5451
* @param {Response} res
5552
* @param {string} name
5653
* @param {number | string | string[]} value
5754
* @returns {void}
5855
*/
59-
export function setHeaderForResponse<
60-
Response_1 extends import("../index.js").ServerResponse
61-
>(res: Response_1, name: string, value: number | string | string[]): void;
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;
6261
/**
6362
* @template {ServerResponse} Response
6463
* @param {Response} res
6564
* @param {number} code
6665
*/
67-
export function setStatusCode<
68-
Response_1 extends import("../index.js").ServerResponse
69-
>(res: Response_1, code: number): void;
66+
export function setStatusCode<Response_1 extends import('../index.js').ServerResponse>(res: Response_1, code: number): void;
7067
/**
7168
* @template {IncomingMessage} Request
7269
* @template {ServerResponse} Response
@@ -75,12 +72,9 @@ export function setStatusCode<
7572
* @param {string | Buffer | import("fs").ReadStream} bufferOtStream
7673
* @param {number} byteLength
7774
*/
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
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
8680
): void;

0 commit comments

Comments
 (0)