From 209526e8175e00ce95e982aa71a8d8de493c471d Mon Sep 17 00:00:00 2001 From: Druzhinin Aleksey <2452452@gmail.com> Date: Sun, 30 May 2021 23:16:42 +0500 Subject: [PATCH 1/7] Add option historyApiFallback --- src/options.json | 8 ++++++++ src/utils/getFilenameFromUrl.js | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/options.json b/src/options.json index a6c605696..d9274d0c1 100644 --- a/src/options.json +++ b/src/options.json @@ -48,6 +48,14 @@ } ] }, + "historyApiFallback": { + "description": "When using the HTML5 History API, the index.html page will likely have to be served in place of any 404 responses. Enable historyApiFallback by setting it to true", + "anyOf": [ + { + "type": "boolean" + } + ] + }, "stats": { "description": "Stats options object or preset name.", "anyOf": [ diff --git a/src/utils/getFilenameFromUrl.js b/src/utils/getFilenameFromUrl.js index 017e52c7f..923cb09ec 100644 --- a/src/utils/getFilenameFromUrl.js +++ b/src/utils/getFilenameFromUrl.js @@ -53,8 +53,11 @@ export default function getFilenameFromUrl(context, url) { filename = path.join(outputPath, querystring.unescape(pathname)); } - let fsStats; + if (!context.outputFileSystem.existsSync(filename) && options.historyApiFallback){ + filename = path.join(outputPath); + } + let fsStats; try { fsStats = context.outputFileSystem.statSync(filename); } catch (_ignoreError) { From 59382db08e47b9961153930d24b6b38f9765f60f Mon Sep 17 00:00:00 2001 From: Aleksey Druzhinin <2452452@gmail.com> Date: Tue, 1 Jun 2021 10:43:28 +0500 Subject: [PATCH 2/7] Update README.md --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 2cbb9b3a5..e6a41d827 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,13 @@ The public path that the middleware is bound to. _Best Practice: use the same `publicPath` defined in your webpack config. For more information about `publicPath`, please see [the webpack documentation](https://webpack.js.org/guides/public-path)._ +### historyApiFallback + +type: `Boolean` +Default: `false` + +When using the HTML5 History API, the index.html page will likely have to be served in place of any 404 responses. Enable historyApiFallback by setting it to true + ### stats Type: `Boolean|String|Object` From 8825e2ec332c9db382c439b03400c6c8570cc36f Mon Sep 17 00:00:00 2001 From: Druzhinin Aleksey <2452452@gmail.com> Date: Tue, 1 Jun 2021 21:54:46 +0500 Subject: [PATCH 3/7] Tests --- src/options.json | 6 +----- src/utils/getFilenameFromUrl.js | 5 ++++- test/middleware.test.js | 21 +++++++++++++++++++++ test/validation-options.test.js | 4 ++++ 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/options.json b/src/options.json index d9274d0c1..87a856480 100644 --- a/src/options.json +++ b/src/options.json @@ -50,11 +50,7 @@ }, "historyApiFallback": { "description": "When using the HTML5 History API, the index.html page will likely have to be served in place of any 404 responses. Enable historyApiFallback by setting it to true", - "anyOf": [ - { - "type": "boolean" - } - ] + "type": "boolean" }, "stats": { "description": "Stats options object or preset name.", diff --git a/src/utils/getFilenameFromUrl.js b/src/utils/getFilenameFromUrl.js index 923cb09ec..8469578a3 100644 --- a/src/utils/getFilenameFromUrl.js +++ b/src/utils/getFilenameFromUrl.js @@ -53,7 +53,10 @@ export default function getFilenameFromUrl(context, url) { filename = path.join(outputPath, querystring.unescape(pathname)); } - if (!context.outputFileSystem.existsSync(filename) && options.historyApiFallback){ + if ( + !context.outputFileSystem.existsSync(filename) && + options.historyApiFallback + ) { filename = path.join(outputPath); } diff --git a/test/middleware.test.js b/test/middleware.test.js index 024b6de34..8cccb2f74 100644 --- a/test/middleware.test.js +++ b/test/middleware.test.js @@ -2566,6 +2566,27 @@ describe.each([ }); }); + describe("historyApiFallback option", () => { + describe("index.html page will likely have to be served in place of any 404 responses", () => { + beforeAll((done) => { + const compiler = getCompiler(webpackConfig); + + instance = middleware(compiler, { historyApiFallback: true }); + + app = framework(); + app.use(instance); + + listen = listenShorthand(done); + }); + + afterAll(close); + + it('should return the "200" code for the "GET" request', (done) => { + request(app).get("/foo/bar/baz").expect(200, done); + }); + }); + }); + describe("serverSideRender option", () => { let locals; diff --git a/test/validation-options.test.js b/test/validation-options.test.js index be7164773..63b6a6887 100644 --- a/test/validation-options.test.js +++ b/test/validation-options.test.js @@ -35,6 +35,10 @@ describe("validation", () => { success: ["/foo", "", "auto", () => "/public/path"], failure: [false], }, + historyApiFallback: { + success: [true], + failure: [], + }, serverSideRender: { success: [true], failure: ["foo", 0], From dda8999cc8156beba3b366972b0761f524768ce9 Mon Sep 17 00:00:00 2001 From: Aleksey Druzhinin <2452452@gmail.com> Date: Thu, 29 Dec 2022 21:13:57 +0400 Subject: [PATCH 4/7] chore: fix missing 2 ts --- types/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/index.d.ts b/types/index.d.ts index 152459637..0134935f9 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -172,6 +172,7 @@ type Options< serverSideRender?: boolean | undefined; outputFileSystem?: OutputFileSystem | undefined; index?: string | boolean | undefined; + historyApiFallback?: boolean; }; type API< RequestInternal extends import("http").IncomingMessage, @@ -204,6 +205,7 @@ type OutputFileSystem = Compiler["outputFileSystem"] & { createReadStream?: typeof import("fs").createReadStream; statSync?: import("fs").StatSyncFn; lstat?: typeof import("fs").lstat; + existsSync?: typeof import("fs").existsSync; readFileSync?: typeof import("fs").readFileSync; }; type Logger = ReturnType; From 4ed02bb6e114ae68a5682be2fc5c8196842ef98f Mon Sep 17 00:00:00 2001 From: Aleksey Druzhinin <2452452@gmail.com> Date: Thu, 29 Dec 2022 21:49:37 +0400 Subject: [PATCH 5/7] chore: ts at comments --- src/index.js | 3 ++- src/utils/getFilenameFromUrl.js | 1 + types/index.d.ts | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 0d6d6dec0..8cff67ecb 100644 --- a/src/index.js +++ b/src/index.js @@ -45,7 +45,7 @@ const noop = () => {}; */ /** - * @typedef {Compiler["outputFileSystem"] & { createReadStream?: import("fs").createReadStream, statSync?: import("fs").statSync, lstat?: import("fs").lstat, readFileSync?: import("fs").readFileSync }} OutputFileSystem + * @typedef {Compiler["outputFileSystem"] & { createReadStream?: import("fs").createReadStream, statSync?: import("fs").statSync, lstat?: import("fs").lstat, existsSync?: import("fs").existsSync, readFileSync?: import("fs").readFileSync }} OutputFileSystem */ /** @typedef {ReturnType} Logger */ @@ -88,6 +88,7 @@ const noop = () => {}; * @property {boolean} [serverSideRender] * @property {OutputFileSystem} [outputFileSystem] * @property {boolean | string} [index] + * @property {boolean | undefined} [historyApiFallback] */ /** diff --git a/src/utils/getFilenameFromUrl.js b/src/utils/getFilenameFromUrl.js index 840cb1ad7..ab9b64575 100644 --- a/src/utils/getFilenameFromUrl.js +++ b/src/utils/getFilenameFromUrl.js @@ -96,6 +96,7 @@ function getFilenameFromUrl(context, url) { } if ( + context.outputFileSystem.existsSync && !context.outputFileSystem.existsSync(filename) && options.historyApiFallback ) { diff --git a/types/index.d.ts b/types/index.d.ts index 0134935f9..34b143241 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -66,6 +66,7 @@ export = wdm; * @property {boolean} [serverSideRender] * @property {OutputFileSystem} [outputFileSystem] * @property {boolean | string} [index] + * @property {boolean | undefined} [historyApiFallback] */ /** * @template {IncomingMessage} RequestInternal From c3242aebed393f51d162510c3f2b7cd02383ac03 Mon Sep 17 00:00:00 2001 From: Aleksey Druzhinin <2452452@gmail.com> Date: Thu, 29 Dec 2022 21:55:17 +0400 Subject: [PATCH 6/7] chore: after build --- types/index.d.ts | 244 +++++++++++-------------- types/middleware.d.ts | 17 +- types/utils/compatibleAPI.d.ts | 54 +++--- types/utils/getFilenameFromUrl.d.ts | 15 +- types/utils/getPaths.d.ts | 23 +-- types/utils/ready.d.ts | 17 +- types/utils/setupHooks.d.ts | 54 +++--- types/utils/setupOutputFileSystem.d.ts | 14 +- types/utils/setupWriteToDisk.d.ts | 24 +-- 9 files changed, 206 insertions(+), 256 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 34b143241..3faa91b6c 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -28,7 +28,7 @@ export = wdm; * @typedef {ReturnType} MultiWatching */ /** - * @typedef {Compiler["outputFileSystem"] & { createReadStream?: import("fs").createReadStream, statSync?: import("fs").statSync, lstat?: import("fs").lstat, readFileSync?: import("fs").readFileSync }} OutputFileSystem + * @typedef {Compiler["outputFileSystem"] & { createReadStream?: import("fs").createReadStream, statSync?: import("fs").statSync, lstat?: import("fs").lstat, existsSync?: import("fs").existsSync, readFileSync?: import("fs").readFileSync }} OutputFileSystem */ /** @typedef {ReturnType} Logger */ /** @@ -116,150 +116,128 @@ export = wdm; * @param {Options} [options] * @returns {API} */ -declare function wdm< - RequestInternal extends import("http").IncomingMessage, - ResponseInternal extends ServerResponse ->( - compiler: Compiler | MultiCompiler, - options?: Options | undefined +declare function wdm( + compiler: Compiler | MultiCompiler, + options?: Options | undefined ): API; declare namespace wdm { - export { - Schema, - Compiler, - MultiCompiler, - Configuration, - Stats, - MultiStats, - ExtendedServerResponse, - IncomingMessage, - ServerResponse, - NextFunction, - WatchOptions, - Watching, - MultiWatching, - OutputFileSystem, - Logger, - Callback, - Context, - Headers, - Options, - Middleware, - GetFilenameFromUrl, - WaitUntilValid, - Invalidate, - Close, - AdditionalMethods, - API, - }; + export { + Schema, + Compiler, + MultiCompiler, + Configuration, + Stats, + MultiStats, + ExtendedServerResponse, + IncomingMessage, + ServerResponse, + NextFunction, + WatchOptions, + Watching, + MultiWatching, + OutputFileSystem, + Logger, + Callback, + Context, + Headers, + Options, + Middleware, + GetFilenameFromUrl, + WaitUntilValid, + Invalidate, + Close, + AdditionalMethods, + API, + }; } -type ServerResponse = import("http").ServerResponse & ExtendedServerResponse; -type Compiler = import("webpack").Compiler; -type MultiCompiler = import("webpack").MultiCompiler; -type Options< - RequestInternal extends import("http").IncomingMessage, - ResponseInternal extends ServerResponse -> = { - mimeTypes?: - | { - [key: string]: string; - } - | undefined; - writeToDisk?: boolean | ((targetPath: string) => boolean) | undefined; - methods?: string | undefined; - headers?: Headers; - publicPath?: NonNullable["publicPath"]; - stats?: Configuration["stats"]; - serverSideRender?: boolean | undefined; - outputFileSystem?: OutputFileSystem | undefined; - index?: string | boolean | undefined; - historyApiFallback?: boolean; +type ServerResponse = import('http').ServerResponse & ExtendedServerResponse; +type Compiler = import('webpack').Compiler; +type MultiCompiler = import('webpack').MultiCompiler; +type Options = { + mimeTypes?: + | { + [key: string]: string; + } + | undefined; + writeToDisk?: boolean | ((targetPath: string) => boolean) | undefined; + methods?: string | undefined; + headers?: Headers; + publicPath?: NonNullable['publicPath']; + stats?: Configuration['stats']; + serverSideRender?: boolean | undefined; + outputFileSystem?: OutputFileSystem | undefined; + index?: string | boolean | undefined; + historyApiFallback?: boolean | undefined; }; -type API< - RequestInternal extends import("http").IncomingMessage, - ResponseInternal extends ServerResponse -> = Middleware & - AdditionalMethods; -type Schema = import("schema-utils/declarations/validate").Schema; -type Configuration = import("webpack").Configuration; -type Stats = import("webpack").Stats; -type MultiStats = import("webpack").MultiStats; +type API = Middleware< + RequestInternal, + ResponseInternal +> & + AdditionalMethods; +type Schema = import('schema-utils/declarations/validate').Schema; +type Configuration = import('webpack').Configuration; +type Stats = import('webpack').Stats; +type MultiStats = import('webpack').MultiStats; type ExtendedServerResponse = { - locals?: - | { - webpack?: - | { - devMiddleware?: - | Context - | undefined; - } - | undefined; - } - | undefined; + locals?: + | { + webpack?: + | { + devMiddleware?: Context | undefined; + } + | undefined; + } + | undefined; }; -type IncomingMessage = import("http").IncomingMessage; +type IncomingMessage = import('http').IncomingMessage; type NextFunction = (err?: any) => void; -type WatchOptions = NonNullable; -type Watching = Compiler["watching"]; -type MultiWatching = ReturnType; -type OutputFileSystem = Compiler["outputFileSystem"] & { - createReadStream?: typeof import("fs").createReadStream; - statSync?: import("fs").StatSyncFn; - lstat?: typeof import("fs").lstat; - existsSync?: typeof import("fs").existsSync; - readFileSync?: typeof import("fs").readFileSync; +type WatchOptions = NonNullable; +type Watching = Compiler['watching']; +type MultiWatching = ReturnType; +type OutputFileSystem = Compiler['outputFileSystem'] & { + createReadStream?: typeof import('fs').createReadStream; + statSync?: import('fs').StatSyncFn; + lstat?: typeof import('fs').lstat; + existsSync?: typeof import('fs').existsSync; + readFileSync?: typeof import('fs').readFileSync; }; -type Logger = ReturnType; -type Callback = ( - stats?: import("webpack").Stats | import("webpack").MultiStats | undefined -) => any; -type Context< - RequestInternal extends import("http").IncomingMessage, - ResponseInternal extends ServerResponse -> = { - state: boolean; - stats: Stats | MultiStats | undefined; - callbacks: Callback[]; - options: Options; - compiler: Compiler | MultiCompiler; - watching: Watching | MultiWatching; - logger: Logger; - outputFileSystem: OutputFileSystem; +type Logger = ReturnType; +type Callback = (stats?: import('webpack').Stats | import('webpack').MultiStats | undefined) => any; +type Context = { + state: boolean; + stats: Stats | MultiStats | undefined; + callbacks: Callback[]; + options: Options; + compiler: Compiler | MultiCompiler; + watching: Watching | MultiWatching; + logger: Logger; + outputFileSystem: OutputFileSystem; }; -type Headers< - RequestInternal extends import("http").IncomingMessage, - ResponseInternal extends ServerResponse -> = - | Record - | { - key: string; - value: number | string; - }[] - | (( - req: RequestInternal, - res: ResponseInternal, - context: Context - ) => void | undefined | Record) - | undefined; -type Middleware< - RequestInternal extends import("http").IncomingMessage, - ResponseInternal extends ServerResponse -> = ( - req: RequestInternal, - res: ResponseInternal, - next: NextFunction +type Headers = + | Record + | { + key: string; + value: number | string; + }[] + | (( + req: RequestInternal, + res: ResponseInternal, + context: Context + ) => void | undefined | Record) + | undefined; +type Middleware = ( + req: RequestInternal, + res: ResponseInternal, + next: NextFunction ) => Promise; type GetFilenameFromUrl = (url: string) => string | undefined; type WaitUntilValid = (callback: Callback) => any; type Invalidate = (callback: Callback) => any; type Close = (callback: (err: Error | null | undefined) => void) => any; -type AdditionalMethods< - RequestInternal extends import("http").IncomingMessage, - ResponseInternal extends ServerResponse -> = { - getFilenameFromUrl: GetFilenameFromUrl; - waitUntilValid: WaitUntilValid; - invalidate: Invalidate; - close: Close; - context: Context; +type AdditionalMethods = { + getFilenameFromUrl: GetFilenameFromUrl; + waitUntilValid: WaitUntilValid; + invalidate: Invalidate; + close: Close; + context: Context; }; diff --git a/types/middleware.d.ts b/types/middleware.d.ts index 4d65c4fef..30e37bbc4 100644 --- a/types/middleware.d.ts +++ b/types/middleware.d.ts @@ -6,15 +6,12 @@ export = wrapper; * @param {import("./index.js").Context} context * @return {import("./index.js").Middleware} */ -declare function wrapper< - Request_1 extends import("http").IncomingMessage, - Response_1 extends import("./index.js").ServerResponse ->( - context: import("./index.js").Context -): import("./index.js").Middleware; +declare function wrapper( + context: import('./index.js').Context +): import('./index.js').Middleware; declare namespace wrapper { - export { NextFunction, IncomingMessage, ServerResponse }; + export { NextFunction, IncomingMessage, ServerResponse }; } -type NextFunction = import("./index.js").NextFunction; -type IncomingMessage = import("./index.js").IncomingMessage; -type ServerResponse = import("./index.js").ServerResponse; +type NextFunction = import('./index.js').NextFunction; +type IncomingMessage = import('./index.js').IncomingMessage; +type ServerResponse = import('./index.js').ServerResponse; diff --git a/types/utils/compatibleAPI.d.ts b/types/utils/compatibleAPI.d.ts index 833fed359..885d3ba7a 100644 --- a/types/utils/compatibleAPI.d.ts +++ b/types/utils/compatibleAPI.d.ts @@ -1,14 +1,14 @@ /// -export type IncomingMessage = import("../index.js").IncomingMessage; -export type ServerResponse = import("../index.js").ServerResponse; +export type IncomingMessage = import('../index.js').IncomingMessage; +export type ServerResponse = import('../index.js').ServerResponse; export type ExpectedRequest = { - get: (name: string) => string | undefined; + get: (name: string) => string | undefined; }; export type ExpectedResponse = { - get: (name: string) => string | string[] | undefined; - set: (name: string, value: number | string | string[]) => void; - status: (status: number) => void; - send: (data: any) => void; + get: (name: string) => string | string[] | undefined; + set: (name: string, value: number | string | string[]) => void; + status: (status: number) => void; + send: (data: any) => void; }; /** @typedef {import("../index.js").IncomingMessage} IncomingMessage */ /** @typedef {import("../index.js").ServerResponse} ServerResponse */ @@ -28,27 +28,24 @@ export type ExpectedResponse = { * @param {Response} res * @returns {string[]} */ -export function getHeaderNames< - Response_1 extends import("../index.js").ServerResponse ->(res: Response_1): string[]; +export function getHeaderNames(res: Response_1): string[]; /** * @template {IncomingMessage} Request * @param {Request} req * @param {string} name * @returns {string | undefined} */ -export function getHeaderFromRequest< - Request_1 extends import("http").IncomingMessage ->(req: Request_1, name: string): string | undefined; +export function getHeaderFromRequest(req: Request_1, name: string): string | undefined; /** * @template {ServerResponse} Response * @param {Response} res * @param {string} name * @returns {number | string | string[] | undefined} */ -export function getHeaderFromResponse< - Response_1 extends import("../index.js").ServerResponse ->(res: Response_1, name: string): number | string | string[] | undefined; +export function getHeaderFromResponse( + res: Response_1, + name: string +): number | string | string[] | undefined; /** * @template {ServerResponse} Response * @param {Response} res @@ -56,17 +53,17 @@ export function getHeaderFromResponse< * @param {number | string | string[]} value * @returns {void} */ -export function setHeaderForResponse< - Response_1 extends import("../index.js").ServerResponse ->(res: Response_1, name: string, value: number | string | string[]): void; +export function setHeaderForResponse( + res: Response_1, + name: string, + value: number | string | string[] +): void; /** * @template {ServerResponse} Response * @param {Response} res * @param {number} code */ -export function setStatusCode< - Response_1 extends import("../index.js").ServerResponse ->(res: Response_1, code: number): void; +export function setStatusCode(res: Response_1, code: number): void; /** * @template {IncomingMessage} Request * @template {ServerResponse} Response @@ -75,12 +72,9 @@ export function setStatusCode< * @param {string | Buffer | import("fs").ReadStream} bufferOtStream * @param {number} byteLength */ -export function send< - Request_1 extends import("http").IncomingMessage, - Response_1 extends import("../index.js").ServerResponse ->( - req: Request_1, - res: Response_1, - bufferOtStream: string | Buffer | import("fs").ReadStream, - byteLength: number +export function send( + req: Request_1, + res: Response_1, + bufferOtStream: string | Buffer | import('fs').ReadStream, + byteLength: number ): void; diff --git a/types/utils/getFilenameFromUrl.d.ts b/types/utils/getFilenameFromUrl.d.ts index 8ad2ff148..1c64b8f7f 100644 --- a/types/utils/getFilenameFromUrl.d.ts +++ b/types/utils/getFilenameFromUrl.d.ts @@ -8,14 +8,11 @@ export = getFilenameFromUrl; * @returns {string | undefined} */ declare function getFilenameFromUrl< - Request_1 extends import("http").IncomingMessage, - Response_1 extends import("../index.js").ServerResponse ->( - context: import("../index.js").Context, - url: string -): string | undefined; + Request_1 extends import('http').IncomingMessage, + Response_1 extends import('../index.js').ServerResponse +>(context: import('../index.js').Context, url: string): string | undefined; declare namespace getFilenameFromUrl { - export { IncomingMessage, ServerResponse }; + export { IncomingMessage, ServerResponse }; } -type IncomingMessage = import("../index.js").IncomingMessage; -type ServerResponse = import("../index.js").ServerResponse; +type IncomingMessage = import('../index.js').IncomingMessage; +type ServerResponse = import('../index.js').ServerResponse; diff --git a/types/utils/getPaths.d.ts b/types/utils/getPaths.d.ts index c3aaace0b..36465b918 100644 --- a/types/utils/getPaths.d.ts +++ b/types/utils/getPaths.d.ts @@ -10,20 +10,17 @@ export = getPaths; * @template {ServerResponse} Response * @param {import("../index.js").Context} context */ -declare function getPaths< - Request_1 extends import("http").IncomingMessage, - Response_1 extends import("../index.js").ServerResponse ->( - context: import("../index.js").Context +declare function getPaths( + context: import('../index.js').Context ): { - outputPath: string; - publicPath: string; + outputPath: string; + publicPath: string; }[]; declare namespace getPaths { - export { Compiler, Stats, MultiStats, IncomingMessage, ServerResponse }; + export { Compiler, Stats, MultiStats, IncomingMessage, ServerResponse }; } -type Compiler = import("webpack").Compiler; -type Stats = import("webpack").Stats; -type MultiStats = import("webpack").MultiStats; -type IncomingMessage = import("../index.js").IncomingMessage; -type ServerResponse = import("../index.js").ServerResponse; +type Compiler = import('webpack').Compiler; +type Stats = import('webpack').Stats; +type MultiStats = import('webpack').MultiStats; +type IncomingMessage = import('../index.js').IncomingMessage; +type ServerResponse = import('../index.js').ServerResponse; diff --git a/types/utils/ready.d.ts b/types/utils/ready.d.ts index 8ab026a54..387d68bec 100644 --- a/types/utils/ready.d.ts +++ b/types/utils/ready.d.ts @@ -10,16 +10,13 @@ export = ready; * @param {Request} [req] * @returns {void} */ -declare function ready< - Request_1 extends import("http").IncomingMessage, - Response_1 extends import("../index.js").ServerResponse ->( - context: import("../index.js").Context, - callback: (...args: any[]) => any, - req?: Request_1 | undefined +declare function ready( + context: import('../index.js').Context, + callback: (...args: any[]) => any, + req?: Request_1 | undefined ): void; declare namespace ready { - export { IncomingMessage, ServerResponse }; + export { IncomingMessage, ServerResponse }; } -type IncomingMessage = import("../index.js").IncomingMessage; -type ServerResponse = import("../index.js").ServerResponse; +type IncomingMessage = import('../index.js').IncomingMessage; +type ServerResponse = import('../index.js').ServerResponse; diff --git a/types/utils/setupHooks.d.ts b/types/utils/setupHooks.d.ts index 0ba421e1c..b8b16693d 100644 --- a/types/utils/setupHooks.d.ts +++ b/types/utils/setupHooks.d.ts @@ -15,36 +15,32 @@ export = setupHooks; * @template {ServerResponse} Response * @param {import("../index.js").Context} context */ -declare function setupHooks< - Request_1 extends import("http").IncomingMessage, - Response_1 extends import("../index.js").ServerResponse ->(context: import("../index.js").Context): void; +declare function setupHooks( + context: import('../index.js').Context +): void; declare namespace setupHooks { - export { - Configuration, - Compiler, - MultiCompiler, - Stats, - MultiStats, - IncomingMessage, - ServerResponse, - StatsOptions, - MultiStatsOptions, - NormalizedStatsOptions, - }; + export { + Configuration, + Compiler, + MultiCompiler, + Stats, + MultiStats, + IncomingMessage, + ServerResponse, + StatsOptions, + MultiStatsOptions, + NormalizedStatsOptions, + }; } -type Configuration = import("webpack").Configuration; -type Compiler = import("webpack").Compiler; -type MultiCompiler = import("webpack").MultiCompiler; -type Stats = import("webpack").Stats; -type MultiStats = import("webpack").MultiStats; -type IncomingMessage = import("../index.js").IncomingMessage; -type ServerResponse = import("../index.js").ServerResponse; -type StatsOptions = Configuration["stats"]; +type Configuration = import('webpack').Configuration; +type Compiler = import('webpack').Compiler; +type MultiCompiler = import('webpack').MultiCompiler; +type Stats = import('webpack').Stats; +type MultiStats = import('webpack').MultiStats; +type IncomingMessage = import('../index.js').IncomingMessage; +type ServerResponse = import('../index.js').ServerResponse; +type StatsOptions = Configuration['stats']; type MultiStatsOptions = { - children: Configuration["stats"][]; + children: Configuration['stats'][]; }; -type NormalizedStatsOptions = Exclude< - Configuration["stats"], - boolean | string | undefined ->; +type NormalizedStatsOptions = Exclude; diff --git a/types/utils/setupOutputFileSystem.d.ts b/types/utils/setupOutputFileSystem.d.ts index b1a917bed..8c23288e5 100644 --- a/types/utils/setupOutputFileSystem.d.ts +++ b/types/utils/setupOutputFileSystem.d.ts @@ -9,12 +9,12 @@ export = setupOutputFileSystem; * @param {import("../index.js").Context} context */ declare function setupOutputFileSystem< - Request_1 extends import("http").IncomingMessage, - Response_1 extends import("../index.js").ServerResponse ->(context: import("../index.js").Context): void; + Request_1 extends import('http').IncomingMessage, + Response_1 extends import('../index.js').ServerResponse +>(context: import('../index.js').Context): void; declare namespace setupOutputFileSystem { - export { MultiCompiler, IncomingMessage, ServerResponse }; + export { MultiCompiler, IncomingMessage, ServerResponse }; } -type MultiCompiler = import("webpack").MultiCompiler; -type IncomingMessage = import("../index.js").IncomingMessage; -type ServerResponse = import("../index.js").ServerResponse; +type MultiCompiler = import('webpack').MultiCompiler; +type IncomingMessage = import('../index.js').IncomingMessage; +type ServerResponse = import('../index.js').ServerResponse; diff --git a/types/utils/setupWriteToDisk.d.ts b/types/utils/setupWriteToDisk.d.ts index 88e0c4e1b..df0a571b5 100644 --- a/types/utils/setupWriteToDisk.d.ts +++ b/types/utils/setupWriteToDisk.d.ts @@ -11,20 +11,14 @@ export = setupWriteToDisk; * @param {import("../index.js").Context} context */ declare function setupWriteToDisk< - Request_1 extends import("http").IncomingMessage, - Response_1 extends import("../index.js").ServerResponse ->(context: import("../index.js").Context): void; + Request_1 extends import('http').IncomingMessage, + Response_1 extends import('../index.js').ServerResponse +>(context: import('../index.js').Context): void; declare namespace setupWriteToDisk { - export { - Compiler, - MultiCompiler, - Compilation, - IncomingMessage, - ServerResponse, - }; + export { Compiler, MultiCompiler, Compilation, IncomingMessage, ServerResponse }; } -type Compiler = import("webpack").Compiler; -type MultiCompiler = import("webpack").MultiCompiler; -type Compilation = import("webpack").Compilation; -type IncomingMessage = import("../index.js").IncomingMessage; -type ServerResponse = import("../index.js").ServerResponse; +type Compiler = import('webpack').Compiler; +type MultiCompiler = import('webpack').MultiCompiler; +type Compilation = import('webpack').Compilation; +type IncomingMessage = import('../index.js').IncomingMessage; +type ServerResponse = import('../index.js').ServerResponse; From e47ffe6aa1480579c90c7c4cb5ef9c74102b0264 Mon Sep 17 00:00:00 2001 From: Aleksey Druzhinin <2452452@gmail.com> Date: Thu, 9 Mar 2023 14:46:01 +0400 Subject: [PATCH 7/7] chore: run build cmd --- types/index.d.ts | 242 ++++++++++++++----------- types/middleware.d.ts | 17 +- types/utils/compatibleAPI.d.ts | 54 +++--- types/utils/getFilenameFromUrl.d.ts | 15 +- types/utils/getPaths.d.ts | 23 ++- types/utils/ready.d.ts | 17 +- types/utils/setupHooks.d.ts | 54 +++--- types/utils/setupOutputFileSystem.d.ts | 14 +- types/utils/setupWriteToDisk.d.ts | 24 ++- 9 files changed, 255 insertions(+), 205 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 3faa91b6c..ee8ee80dc 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -116,128 +116,150 @@ export = wdm; * @param {Options} [options] * @returns {API} */ -declare function wdm( - compiler: Compiler | MultiCompiler, - options?: Options | undefined +declare function wdm< + RequestInternal extends import("http").IncomingMessage, + ResponseInternal extends ServerResponse +>( + compiler: Compiler | MultiCompiler, + options?: Options | undefined ): API; declare namespace wdm { - export { - Schema, - Compiler, - MultiCompiler, - Configuration, - Stats, - MultiStats, - ExtendedServerResponse, - IncomingMessage, - ServerResponse, - NextFunction, - WatchOptions, - Watching, - MultiWatching, - OutputFileSystem, - Logger, - Callback, - Context, - Headers, - Options, - Middleware, - GetFilenameFromUrl, - WaitUntilValid, - Invalidate, - Close, - AdditionalMethods, - API, - }; + export { + Schema, + Compiler, + MultiCompiler, + Configuration, + Stats, + MultiStats, + ExtendedServerResponse, + IncomingMessage, + ServerResponse, + NextFunction, + WatchOptions, + Watching, + MultiWatching, + OutputFileSystem, + Logger, + Callback, + Context, + Headers, + Options, + Middleware, + GetFilenameFromUrl, + WaitUntilValid, + Invalidate, + Close, + AdditionalMethods, + API, + }; } -type ServerResponse = import('http').ServerResponse & ExtendedServerResponse; -type Compiler = import('webpack').Compiler; -type MultiCompiler = import('webpack').MultiCompiler; -type Options = { - mimeTypes?: - | { - [key: string]: string; - } - | undefined; - writeToDisk?: boolean | ((targetPath: string) => boolean) | undefined; - methods?: string | undefined; - headers?: Headers; - publicPath?: NonNullable['publicPath']; - stats?: Configuration['stats']; - serverSideRender?: boolean | undefined; - outputFileSystem?: OutputFileSystem | undefined; - index?: string | boolean | undefined; - historyApiFallback?: boolean | undefined; +type ServerResponse = import("http").ServerResponse & ExtendedServerResponse; +type Compiler = import("webpack").Compiler; +type MultiCompiler = import("webpack").MultiCompiler; +type Options< + RequestInternal extends import("http").IncomingMessage, + ResponseInternal extends ServerResponse +> = { + mimeTypes?: + | { + [key: string]: string; + } + | undefined; + writeToDisk?: boolean | ((targetPath: string) => boolean) | undefined; + methods?: string | undefined; + headers?: Headers; + publicPath?: NonNullable["publicPath"]; + stats?: Configuration["stats"]; + serverSideRender?: boolean | undefined; + outputFileSystem?: OutputFileSystem | undefined; + index?: string | boolean | undefined; + historyApiFallback?: boolean | undefined; }; -type API = Middleware< - RequestInternal, - ResponseInternal -> & - AdditionalMethods; -type Schema = import('schema-utils/declarations/validate').Schema; -type Configuration = import('webpack').Configuration; -type Stats = import('webpack').Stats; -type MultiStats = import('webpack').MultiStats; +type API< + RequestInternal extends import("http").IncomingMessage, + ResponseInternal extends ServerResponse +> = Middleware & + AdditionalMethods; +type Schema = import("schema-utils/declarations/validate").Schema; +type Configuration = import("webpack").Configuration; +type Stats = import("webpack").Stats; +type MultiStats = import("webpack").MultiStats; type ExtendedServerResponse = { - locals?: - | { - webpack?: - | { - devMiddleware?: Context | undefined; - } - | undefined; - } - | undefined; + locals?: + | { + webpack?: + | { + devMiddleware?: + | Context + | undefined; + } + | undefined; + } + | undefined; }; -type IncomingMessage = import('http').IncomingMessage; +type IncomingMessage = import("http").IncomingMessage; type NextFunction = (err?: any) => void; -type WatchOptions = NonNullable; -type Watching = Compiler['watching']; -type MultiWatching = ReturnType; -type OutputFileSystem = Compiler['outputFileSystem'] & { - createReadStream?: typeof import('fs').createReadStream; - statSync?: import('fs').StatSyncFn; - lstat?: typeof import('fs').lstat; - existsSync?: typeof import('fs').existsSync; - readFileSync?: typeof import('fs').readFileSync; +type WatchOptions = NonNullable; +type Watching = Compiler["watching"]; +type MultiWatching = ReturnType; +type OutputFileSystem = Compiler["outputFileSystem"] & { + createReadStream?: typeof import("fs").createReadStream; + statSync?: import("fs").StatSyncFn; + lstat?: typeof import("fs").lstat; + existsSync?: typeof import("fs").existsSync; + readFileSync?: typeof import("fs").readFileSync; }; -type Logger = ReturnType; -type Callback = (stats?: import('webpack').Stats | import('webpack').MultiStats | undefined) => any; -type Context = { - state: boolean; - stats: Stats | MultiStats | undefined; - callbacks: Callback[]; - options: Options; - compiler: Compiler | MultiCompiler; - watching: Watching | MultiWatching; - logger: Logger; - outputFileSystem: OutputFileSystem; +type Logger = ReturnType; +type Callback = ( + stats?: import("webpack").Stats | import("webpack").MultiStats | undefined +) => any; +type Context< + RequestInternal extends import("http").IncomingMessage, + ResponseInternal extends ServerResponse +> = { + state: boolean; + stats: Stats | MultiStats | undefined; + callbacks: Callback[]; + options: Options; + compiler: Compiler | MultiCompiler; + watching: Watching | MultiWatching; + logger: Logger; + outputFileSystem: OutputFileSystem; }; -type Headers = - | Record - | { - key: string; - value: number | string; - }[] - | (( - req: RequestInternal, - res: ResponseInternal, - context: Context - ) => void | undefined | Record) - | undefined; -type Middleware = ( - req: RequestInternal, - res: ResponseInternal, - next: NextFunction +type Headers< + RequestInternal extends import("http").IncomingMessage, + ResponseInternal extends ServerResponse +> = + | Record + | { + key: string; + value: number | string; + }[] + | (( + req: RequestInternal, + res: ResponseInternal, + context: Context + ) => void | undefined | Record) + | undefined; +type Middleware< + RequestInternal extends import("http").IncomingMessage, + ResponseInternal extends ServerResponse +> = ( + req: RequestInternal, + res: ResponseInternal, + next: NextFunction ) => Promise; type GetFilenameFromUrl = (url: string) => string | undefined; type WaitUntilValid = (callback: Callback) => any; type Invalidate = (callback: Callback) => any; type Close = (callback: (err: Error | null | undefined) => void) => any; -type AdditionalMethods = { - getFilenameFromUrl: GetFilenameFromUrl; - waitUntilValid: WaitUntilValid; - invalidate: Invalidate; - close: Close; - context: Context; +type AdditionalMethods< + RequestInternal extends import("http").IncomingMessage, + ResponseInternal extends ServerResponse +> = { + getFilenameFromUrl: GetFilenameFromUrl; + waitUntilValid: WaitUntilValid; + invalidate: Invalidate; + close: Close; + context: Context; }; diff --git a/types/middleware.d.ts b/types/middleware.d.ts index 30e37bbc4..4d65c4fef 100644 --- a/types/middleware.d.ts +++ b/types/middleware.d.ts @@ -6,12 +6,15 @@ export = wrapper; * @param {import("./index.js").Context} context * @return {import("./index.js").Middleware} */ -declare function wrapper( - context: import('./index.js').Context -): import('./index.js').Middleware; +declare function wrapper< + Request_1 extends import("http").IncomingMessage, + Response_1 extends import("./index.js").ServerResponse +>( + context: import("./index.js").Context +): import("./index.js").Middleware; declare namespace wrapper { - export { NextFunction, IncomingMessage, ServerResponse }; + export { NextFunction, IncomingMessage, ServerResponse }; } -type NextFunction = import('./index.js').NextFunction; -type IncomingMessage = import('./index.js').IncomingMessage; -type ServerResponse = import('./index.js').ServerResponse; +type NextFunction = import("./index.js").NextFunction; +type IncomingMessage = import("./index.js").IncomingMessage; +type ServerResponse = import("./index.js").ServerResponse; diff --git a/types/utils/compatibleAPI.d.ts b/types/utils/compatibleAPI.d.ts index 885d3ba7a..833fed359 100644 --- a/types/utils/compatibleAPI.d.ts +++ b/types/utils/compatibleAPI.d.ts @@ -1,14 +1,14 @@ /// -export type IncomingMessage = import('../index.js').IncomingMessage; -export type ServerResponse = import('../index.js').ServerResponse; +export type IncomingMessage = import("../index.js").IncomingMessage; +export type ServerResponse = import("../index.js").ServerResponse; export type ExpectedRequest = { - get: (name: string) => string | undefined; + get: (name: string) => string | undefined; }; export type ExpectedResponse = { - get: (name: string) => string | string[] | undefined; - set: (name: string, value: number | string | string[]) => void; - status: (status: number) => void; - send: (data: any) => void; + get: (name: string) => string | string[] | undefined; + set: (name: string, value: number | string | string[]) => void; + status: (status: number) => void; + send: (data: any) => void; }; /** @typedef {import("../index.js").IncomingMessage} IncomingMessage */ /** @typedef {import("../index.js").ServerResponse} ServerResponse */ @@ -28,24 +28,27 @@ export type ExpectedResponse = { * @param {Response} res * @returns {string[]} */ -export function getHeaderNames(res: Response_1): string[]; +export function getHeaderNames< + Response_1 extends import("../index.js").ServerResponse +>(res: Response_1): string[]; /** * @template {IncomingMessage} Request * @param {Request} req * @param {string} name * @returns {string | undefined} */ -export function getHeaderFromRequest(req: Request_1, name: string): string | undefined; +export function getHeaderFromRequest< + Request_1 extends import("http").IncomingMessage +>(req: Request_1, name: string): string | undefined; /** * @template {ServerResponse} Response * @param {Response} res * @param {string} name * @returns {number | string | string[] | undefined} */ -export function getHeaderFromResponse( - res: Response_1, - name: string -): number | string | string[] | undefined; +export function getHeaderFromResponse< + Response_1 extends import("../index.js").ServerResponse +>(res: Response_1, name: string): number | string | string[] | undefined; /** * @template {ServerResponse} Response * @param {Response} res @@ -53,17 +56,17 @@ export function getHeaderFromResponse( - res: Response_1, - name: string, - value: number | string | string[] -): void; +export function setHeaderForResponse< + Response_1 extends import("../index.js").ServerResponse +>(res: Response_1, name: string, value: number | string | string[]): void; /** * @template {ServerResponse} Response * @param {Response} res * @param {number} code */ -export function setStatusCode(res: Response_1, code: number): void; +export function setStatusCode< + Response_1 extends import("../index.js").ServerResponse +>(res: Response_1, code: number): void; /** * @template {IncomingMessage} Request * @template {ServerResponse} Response @@ -72,9 +75,12 @@ export function setStatusCode( - req: Request_1, - res: Response_1, - bufferOtStream: string | Buffer | import('fs').ReadStream, - byteLength: number +export function send< + Request_1 extends import("http").IncomingMessage, + Response_1 extends import("../index.js").ServerResponse +>( + req: Request_1, + res: Response_1, + bufferOtStream: string | Buffer | import("fs").ReadStream, + byteLength: number ): void; diff --git a/types/utils/getFilenameFromUrl.d.ts b/types/utils/getFilenameFromUrl.d.ts index 1c64b8f7f..8ad2ff148 100644 --- a/types/utils/getFilenameFromUrl.d.ts +++ b/types/utils/getFilenameFromUrl.d.ts @@ -8,11 +8,14 @@ export = getFilenameFromUrl; * @returns {string | undefined} */ declare function getFilenameFromUrl< - Request_1 extends import('http').IncomingMessage, - Response_1 extends import('../index.js').ServerResponse ->(context: import('../index.js').Context, url: string): string | undefined; + Request_1 extends import("http").IncomingMessage, + Response_1 extends import("../index.js").ServerResponse +>( + context: import("../index.js").Context, + url: string +): string | undefined; declare namespace getFilenameFromUrl { - export { IncomingMessage, ServerResponse }; + export { IncomingMessage, ServerResponse }; } -type IncomingMessage = import('../index.js').IncomingMessage; -type ServerResponse = import('../index.js').ServerResponse; +type IncomingMessage = import("../index.js").IncomingMessage; +type ServerResponse = import("../index.js").ServerResponse; diff --git a/types/utils/getPaths.d.ts b/types/utils/getPaths.d.ts index 36465b918..c3aaace0b 100644 --- a/types/utils/getPaths.d.ts +++ b/types/utils/getPaths.d.ts @@ -10,17 +10,20 @@ export = getPaths; * @template {ServerResponse} Response * @param {import("../index.js").Context} context */ -declare function getPaths( - context: import('../index.js').Context +declare function getPaths< + Request_1 extends import("http").IncomingMessage, + Response_1 extends import("../index.js").ServerResponse +>( + context: import("../index.js").Context ): { - outputPath: string; - publicPath: string; + outputPath: string; + publicPath: string; }[]; declare namespace getPaths { - export { Compiler, Stats, MultiStats, IncomingMessage, ServerResponse }; + export { Compiler, Stats, MultiStats, IncomingMessage, ServerResponse }; } -type Compiler = import('webpack').Compiler; -type Stats = import('webpack').Stats; -type MultiStats = import('webpack').MultiStats; -type IncomingMessage = import('../index.js').IncomingMessage; -type ServerResponse = import('../index.js').ServerResponse; +type Compiler = import("webpack").Compiler; +type Stats = import("webpack").Stats; +type MultiStats = import("webpack").MultiStats; +type IncomingMessage = import("../index.js").IncomingMessage; +type ServerResponse = import("../index.js").ServerResponse; diff --git a/types/utils/ready.d.ts b/types/utils/ready.d.ts index 387d68bec..8ab026a54 100644 --- a/types/utils/ready.d.ts +++ b/types/utils/ready.d.ts @@ -10,13 +10,16 @@ export = ready; * @param {Request} [req] * @returns {void} */ -declare function ready( - context: import('../index.js').Context, - callback: (...args: any[]) => any, - req?: Request_1 | undefined +declare function ready< + Request_1 extends import("http").IncomingMessage, + Response_1 extends import("../index.js").ServerResponse +>( + context: import("../index.js").Context, + callback: (...args: any[]) => any, + req?: Request_1 | undefined ): void; declare namespace ready { - export { IncomingMessage, ServerResponse }; + export { IncomingMessage, ServerResponse }; } -type IncomingMessage = import('../index.js').IncomingMessage; -type ServerResponse = import('../index.js').ServerResponse; +type IncomingMessage = import("../index.js").IncomingMessage; +type ServerResponse = import("../index.js").ServerResponse; diff --git a/types/utils/setupHooks.d.ts b/types/utils/setupHooks.d.ts index b8b16693d..0ba421e1c 100644 --- a/types/utils/setupHooks.d.ts +++ b/types/utils/setupHooks.d.ts @@ -15,32 +15,36 @@ export = setupHooks; * @template {ServerResponse} Response * @param {import("../index.js").Context} context */ -declare function setupHooks( - context: import('../index.js').Context -): void; +declare function setupHooks< + Request_1 extends import("http").IncomingMessage, + Response_1 extends import("../index.js").ServerResponse +>(context: import("../index.js").Context): void; declare namespace setupHooks { - export { - Configuration, - Compiler, - MultiCompiler, - Stats, - MultiStats, - IncomingMessage, - ServerResponse, - StatsOptions, - MultiStatsOptions, - NormalizedStatsOptions, - }; + export { + Configuration, + Compiler, + MultiCompiler, + Stats, + MultiStats, + IncomingMessage, + ServerResponse, + StatsOptions, + MultiStatsOptions, + NormalizedStatsOptions, + }; } -type Configuration = import('webpack').Configuration; -type Compiler = import('webpack').Compiler; -type MultiCompiler = import('webpack').MultiCompiler; -type Stats = import('webpack').Stats; -type MultiStats = import('webpack').MultiStats; -type IncomingMessage = import('../index.js').IncomingMessage; -type ServerResponse = import('../index.js').ServerResponse; -type StatsOptions = Configuration['stats']; +type Configuration = import("webpack").Configuration; +type Compiler = import("webpack").Compiler; +type MultiCompiler = import("webpack").MultiCompiler; +type Stats = import("webpack").Stats; +type MultiStats = import("webpack").MultiStats; +type IncomingMessage = import("../index.js").IncomingMessage; +type ServerResponse = import("../index.js").ServerResponse; +type StatsOptions = Configuration["stats"]; type MultiStatsOptions = { - children: Configuration['stats'][]; + children: Configuration["stats"][]; }; -type NormalizedStatsOptions = Exclude; +type NormalizedStatsOptions = Exclude< + Configuration["stats"], + boolean | string | undefined +>; diff --git a/types/utils/setupOutputFileSystem.d.ts b/types/utils/setupOutputFileSystem.d.ts index 8c23288e5..b1a917bed 100644 --- a/types/utils/setupOutputFileSystem.d.ts +++ b/types/utils/setupOutputFileSystem.d.ts @@ -9,12 +9,12 @@ export = setupOutputFileSystem; * @param {import("../index.js").Context} context */ declare function setupOutputFileSystem< - Request_1 extends import('http').IncomingMessage, - Response_1 extends import('../index.js').ServerResponse ->(context: import('../index.js').Context): void; + Request_1 extends import("http").IncomingMessage, + Response_1 extends import("../index.js").ServerResponse +>(context: import("../index.js").Context): void; declare namespace setupOutputFileSystem { - export { MultiCompiler, IncomingMessage, ServerResponse }; + export { MultiCompiler, IncomingMessage, ServerResponse }; } -type MultiCompiler = import('webpack').MultiCompiler; -type IncomingMessage = import('../index.js').IncomingMessage; -type ServerResponse = import('../index.js').ServerResponse; +type MultiCompiler = import("webpack").MultiCompiler; +type IncomingMessage = import("../index.js").IncomingMessage; +type ServerResponse = import("../index.js").ServerResponse; diff --git a/types/utils/setupWriteToDisk.d.ts b/types/utils/setupWriteToDisk.d.ts index df0a571b5..88e0c4e1b 100644 --- a/types/utils/setupWriteToDisk.d.ts +++ b/types/utils/setupWriteToDisk.d.ts @@ -11,14 +11,20 @@ export = setupWriteToDisk; * @param {import("../index.js").Context} context */ declare function setupWriteToDisk< - Request_1 extends import('http').IncomingMessage, - Response_1 extends import('../index.js').ServerResponse ->(context: import('../index.js').Context): void; + Request_1 extends import("http").IncomingMessage, + Response_1 extends import("../index.js").ServerResponse +>(context: import("../index.js").Context): void; declare namespace setupWriteToDisk { - export { Compiler, MultiCompiler, Compilation, IncomingMessage, ServerResponse }; + export { + Compiler, + MultiCompiler, + Compilation, + IncomingMessage, + ServerResponse, + }; } -type Compiler = import('webpack').Compiler; -type MultiCompiler = import('webpack').MultiCompiler; -type Compilation = import('webpack').Compilation; -type IncomingMessage = import('../index.js').IncomingMessage; -type ServerResponse = import('../index.js').ServerResponse; +type Compiler = import("webpack").Compiler; +type MultiCompiler = import("webpack").MultiCompiler; +type Compilation = import("webpack").Compilation; +type IncomingMessage = import("../index.js").IncomingMessage; +type ServerResponse = import("../index.js").ServerResponse;