@rspack/dev-middleware 0.2.12 → 2.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +17 -19
- package/README.md +735 -10
- package/dist/index.js +9291 -15
- package/dist/index.js.LICENSE.txt +19 -0
- package/dist/rslib-runtime.js +29 -0
- package/package.json +70 -19
- package/types/index.d.ts +487 -0
- package/types/middleware.d.ts +43 -0
- package/types/utils/compatibleAPI.d.ts +261 -0
- package/types/utils/escapeHtml.d.ts +6 -0
- package/types/utils/etag.d.ts +12 -0
- package/types/utils/getFilenameFromUrl.d.ts +46 -0
- package/types/utils/getPaths.d.ts +31 -0
- package/types/utils/memorize.d.ts +33 -0
- package/types/utils/parseTokenList.d.ts +7 -0
- package/types/utils/ready.d.ts +23 -0
- package/types/utils/setupHooks.d.ts +40 -0
- package/types/utils/setupOutputFileSystem.d.ts +23 -0
- package/types/utils/setupWriteToDisk.d.ts +21 -0
- package/dist/index.d.ts +0 -8
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/index.cjs +0 -2
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
export type IncomingMessage = import("../index").IncomingMessage;
|
|
2
|
+
export type ServerResponse = import("../index").ServerResponse;
|
|
3
|
+
export type OutputFileSystem = import("../index").OutputFileSystem;
|
|
4
|
+
export type EXPECTED_ANY = import("../index").EXPECTED_ANY;
|
|
5
|
+
export type ExpectedIncomingMessage = {
|
|
6
|
+
/**
|
|
7
|
+
* get header extra method
|
|
8
|
+
*/
|
|
9
|
+
getHeader?: ((name: string) => string | string[] | undefined) | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* get method extra method
|
|
12
|
+
*/
|
|
13
|
+
getMethod?: (() => string | undefined) | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* get URL extra method
|
|
16
|
+
*/
|
|
17
|
+
getURL?: (() => string | undefined) | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* an extra option for `fastify` (and `@fastify/express`) to get original URL
|
|
20
|
+
*/
|
|
21
|
+
originalUrl?: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
export type ExpectedServerResponse = {
|
|
24
|
+
/**
|
|
25
|
+
* set status code
|
|
26
|
+
*/
|
|
27
|
+
setStatusCode?: ((status: number) => void) | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* get status code
|
|
30
|
+
*/
|
|
31
|
+
getStatusCode?: (() => number) | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* get header
|
|
34
|
+
*/
|
|
35
|
+
getHeader: (name: string) => string | string[] | undefined | number;
|
|
36
|
+
/**
|
|
37
|
+
* set header
|
|
38
|
+
*/
|
|
39
|
+
setHeader?:
|
|
40
|
+
| ((
|
|
41
|
+
name: string,
|
|
42
|
+
value: number | string | Readonly<string[]>,
|
|
43
|
+
) => ExpectedServerResponse)
|
|
44
|
+
| undefined;
|
|
45
|
+
/**
|
|
46
|
+
* remove header
|
|
47
|
+
*/
|
|
48
|
+
removeHeader?: ((name: string) => void) | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* send
|
|
51
|
+
*/
|
|
52
|
+
send?: ((data: string | Buffer) => void) | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* finish
|
|
55
|
+
*/
|
|
56
|
+
finish?: ((data?: string | Buffer) => void) | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* get response header
|
|
59
|
+
*/
|
|
60
|
+
getResponseHeaders?: (() => string[]) | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* get headers sent
|
|
63
|
+
*/
|
|
64
|
+
getHeadersSent?: (() => boolean) | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* stream
|
|
67
|
+
*/
|
|
68
|
+
stream?: ((data: EXPECTED_ANY) => void) | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* get outgoing
|
|
71
|
+
*/
|
|
72
|
+
getOutgoing?: (() => EXPECTED_ANY) | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* set state
|
|
75
|
+
*/
|
|
76
|
+
setState?: ((name: string, value: EXPECTED_ANY) => void) | undefined;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* @param {string} filename filename
|
|
80
|
+
* @param {OutputFileSystem} outputFileSystem output file system
|
|
81
|
+
* @param {number} start start
|
|
82
|
+
* @param {number} end end
|
|
83
|
+
* @returns {{ bufferOrStream: (Buffer | import("fs").ReadStream), byteLength: number }} result with buffer or stream and byte length
|
|
84
|
+
*/
|
|
85
|
+
export function createReadStreamOrReadFileSync(
|
|
86
|
+
filename: string,
|
|
87
|
+
outputFileSystem: OutputFileSystem,
|
|
88
|
+
start: number,
|
|
89
|
+
end: number,
|
|
90
|
+
): {
|
|
91
|
+
bufferOrStream: Buffer | import("fs").ReadStream;
|
|
92
|
+
byteLength: number;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* @template {ServerResponse & ExpectedServerResponse} Response
|
|
96
|
+
* @param {Response} res res
|
|
97
|
+
* @param {(string | Buffer)=} data data
|
|
98
|
+
*/
|
|
99
|
+
export function finish<
|
|
100
|
+
Response extends ServerResponse & ExpectedServerResponse,
|
|
101
|
+
>(res: Response, data?: (string | Buffer) | undefined): void;
|
|
102
|
+
/**
|
|
103
|
+
* @template {ServerResponse & ExpectedServerResponse} Response
|
|
104
|
+
* @param {Response} res res
|
|
105
|
+
* @returns {boolean} true when headers were sent, otherwise false
|
|
106
|
+
*/
|
|
107
|
+
export function getHeadersSent<
|
|
108
|
+
Response extends ServerResponse & ExpectedServerResponse,
|
|
109
|
+
>(res: Response): boolean;
|
|
110
|
+
/**
|
|
111
|
+
* @template {ServerResponse & ExpectedServerResponse} Response
|
|
112
|
+
* @param {Response} res res
|
|
113
|
+
* @returns {Response} res res
|
|
114
|
+
*/
|
|
115
|
+
export function getOutgoing<
|
|
116
|
+
Response extends ServerResponse & ExpectedServerResponse,
|
|
117
|
+
>(res: Response): Response;
|
|
118
|
+
/** @typedef {import("../index").IncomingMessage} IncomingMessage */
|
|
119
|
+
/** @typedef {import("../index").ServerResponse} ServerResponse */
|
|
120
|
+
/** @typedef {import("../index").OutputFileSystem} OutputFileSystem */
|
|
121
|
+
/** @typedef {import("../index").EXPECTED_ANY} EXPECTED_ANY */
|
|
122
|
+
/**
|
|
123
|
+
* @typedef {object} ExpectedIncomingMessage
|
|
124
|
+
* @property {((name: string) => string | string[] | undefined)=} getHeader get header extra method
|
|
125
|
+
* @property {(() => string | undefined)=} getMethod get method extra method
|
|
126
|
+
* @property {(() => string | undefined)=} getURL get URL extra method
|
|
127
|
+
* @property {string=} originalUrl an extra option for `fastify` (and `@fastify/express`) to get original URL
|
|
128
|
+
*/
|
|
129
|
+
/**
|
|
130
|
+
* @typedef {object} ExpectedServerResponse
|
|
131
|
+
* @property {((status: number) => void)=} setStatusCode set status code
|
|
132
|
+
* @property {(() => number)=} getStatusCode get status code
|
|
133
|
+
* @property {((name: string) => string | string[] | undefined | number)} getHeader get header
|
|
134
|
+
* @property {((name: string, value: number | string | Readonly<string[]>) => ExpectedServerResponse)=} setHeader set header
|
|
135
|
+
* @property {((name: string) => void)=} removeHeader remove header
|
|
136
|
+
* @property {((data: string | Buffer) => void)=} send send
|
|
137
|
+
* @property {((data?: string | Buffer) => void)=} finish finish
|
|
138
|
+
* @property {(() => string[])=} getResponseHeaders get response header
|
|
139
|
+
* @property {(() => boolean)=} getHeadersSent get headers sent
|
|
140
|
+
* @property {((data: EXPECTED_ANY) => void)=} stream stream
|
|
141
|
+
* @property {(() => EXPECTED_ANY)=} getOutgoing get outgoing
|
|
142
|
+
* @property {((name: string, value: EXPECTED_ANY) => void)=} setState set state
|
|
143
|
+
*/
|
|
144
|
+
/**
|
|
145
|
+
* @template {IncomingMessage & ExpectedIncomingMessage} Request
|
|
146
|
+
* @param {Request} req req
|
|
147
|
+
* @param {string} name name
|
|
148
|
+
* @returns {string | string[] | undefined} request header
|
|
149
|
+
*/
|
|
150
|
+
export function getRequestHeader<
|
|
151
|
+
Request extends IncomingMessage & ExpectedIncomingMessage,
|
|
152
|
+
>(req: Request, name: string): string | string[] | undefined;
|
|
153
|
+
/**
|
|
154
|
+
* @template {IncomingMessage & ExpectedIncomingMessage} Request
|
|
155
|
+
* @param {Request} req req
|
|
156
|
+
* @returns {string | undefined} request method
|
|
157
|
+
*/
|
|
158
|
+
export function getRequestMethod<
|
|
159
|
+
Request extends IncomingMessage & ExpectedIncomingMessage,
|
|
160
|
+
>(req: Request): string | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* @template {IncomingMessage & ExpectedIncomingMessage} Request
|
|
163
|
+
* @param {Request} req req
|
|
164
|
+
* @returns {string | undefined} request URL
|
|
165
|
+
*/
|
|
166
|
+
export function getRequestURL<
|
|
167
|
+
Request extends IncomingMessage & ExpectedIncomingMessage,
|
|
168
|
+
>(req: Request): string | undefined;
|
|
169
|
+
/**
|
|
170
|
+
* @template {ServerResponse & ExpectedServerResponse} Response
|
|
171
|
+
* @param {Response} res res
|
|
172
|
+
* @param {string} name name
|
|
173
|
+
* @returns {string | string[] | undefined | number} header
|
|
174
|
+
*/
|
|
175
|
+
export function getResponseHeader<
|
|
176
|
+
Response extends ServerResponse & ExpectedServerResponse,
|
|
177
|
+
>(res: Response, name: string): string | string[] | undefined | number;
|
|
178
|
+
/**
|
|
179
|
+
* @template {ServerResponse & ExpectedServerResponse} Response
|
|
180
|
+
* @param {Response} res res
|
|
181
|
+
* @returns {string[]} header names
|
|
182
|
+
*/
|
|
183
|
+
export function getResponseHeaders<
|
|
184
|
+
Response extends ServerResponse & ExpectedServerResponse,
|
|
185
|
+
>(res: Response): string[];
|
|
186
|
+
/**
|
|
187
|
+
* @template {ServerResponse & ExpectedServerResponse} Response
|
|
188
|
+
* @param {Response} res res
|
|
189
|
+
* @returns {number} status code
|
|
190
|
+
*/
|
|
191
|
+
export function getStatusCode<
|
|
192
|
+
Response extends ServerResponse & ExpectedServerResponse,
|
|
193
|
+
>(res: Response): number;
|
|
194
|
+
/**
|
|
195
|
+
* @template {ServerResponse & ExpectedServerResponse} Response
|
|
196
|
+
* @param {Response} res res
|
|
197
|
+
*/
|
|
198
|
+
export function initState<
|
|
199
|
+
Response extends ServerResponse & ExpectedServerResponse,
|
|
200
|
+
>(res: Response): void;
|
|
201
|
+
/**
|
|
202
|
+
* @template {ServerResponse & ExpectedServerResponse} Response
|
|
203
|
+
* @param {Response} res res
|
|
204
|
+
* @param {import("fs").ReadStream} bufferOrStream buffer or stream
|
|
205
|
+
*/
|
|
206
|
+
export function pipe<Response extends ServerResponse & ExpectedServerResponse>(
|
|
207
|
+
res: Response,
|
|
208
|
+
bufferOrStream: import("fs").ReadStream,
|
|
209
|
+
): void;
|
|
210
|
+
/**
|
|
211
|
+
* @template {ServerResponse & ExpectedServerResponse} Response
|
|
212
|
+
* @param {Response} res res
|
|
213
|
+
* @param {string} name name
|
|
214
|
+
* @returns {void}
|
|
215
|
+
*/
|
|
216
|
+
export function removeResponseHeader<
|
|
217
|
+
Response extends ServerResponse & ExpectedServerResponse,
|
|
218
|
+
>(res: Response, name: string): void;
|
|
219
|
+
/**
|
|
220
|
+
* @template {ServerResponse & ExpectedServerResponse} Response
|
|
221
|
+
* @param {Response} res res
|
|
222
|
+
* @param {string | Buffer} bufferOrString buffer or string
|
|
223
|
+
* @returns {void}
|
|
224
|
+
*/
|
|
225
|
+
export function send<Response extends ServerResponse & ExpectedServerResponse>(
|
|
226
|
+
res: Response,
|
|
227
|
+
bufferOrString: string | Buffer,
|
|
228
|
+
): void;
|
|
229
|
+
/**
|
|
230
|
+
* @template {ServerResponse & ExpectedServerResponse} Response
|
|
231
|
+
* @param {Response} res res
|
|
232
|
+
* @param {string} name name
|
|
233
|
+
* @param {number | string | Readonly<string[]>} value value
|
|
234
|
+
* @returns {Response} response
|
|
235
|
+
*/
|
|
236
|
+
export function setResponseHeader<
|
|
237
|
+
Response extends ServerResponse & ExpectedServerResponse,
|
|
238
|
+
>(
|
|
239
|
+
res: Response,
|
|
240
|
+
name: string,
|
|
241
|
+
value: number | string | Readonly<string[]>,
|
|
242
|
+
): Response;
|
|
243
|
+
/**
|
|
244
|
+
* @template {ServerResponse & ExpectedServerResponse} Response
|
|
245
|
+
* @param {Response} res res
|
|
246
|
+
* @param {string} name name
|
|
247
|
+
* @param {EXPECTED_ANY} value state
|
|
248
|
+
* @returns {void}
|
|
249
|
+
*/
|
|
250
|
+
export function setState<
|
|
251
|
+
Response extends ServerResponse & ExpectedServerResponse,
|
|
252
|
+
>(res: Response, name: string, value: EXPECTED_ANY): void;
|
|
253
|
+
/**
|
|
254
|
+
* @template {ServerResponse & ExpectedServerResponse} Response
|
|
255
|
+
* @param {Response} res res
|
|
256
|
+
* @param {number} code code
|
|
257
|
+
* @returns {void}
|
|
258
|
+
*/
|
|
259
|
+
export function setStatusCode<
|
|
260
|
+
Response extends ServerResponse & ExpectedServerResponse,
|
|
261
|
+
>(res: Response, code: number): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default etag;
|
|
2
|
+
export type Stats = import("fs").Stats;
|
|
3
|
+
export type ReadStream = import("fs").ReadStream;
|
|
4
|
+
/**
|
|
5
|
+
* Create a simple ETag.
|
|
6
|
+
* @param {Buffer | ReadStream | Stats} entity entity
|
|
7
|
+
* @returns {Promise<{ hash: string, buffer?: Buffer }>} etag
|
|
8
|
+
*/
|
|
9
|
+
declare function etag(entity: Buffer | ReadStream | Stats): Promise<{
|
|
10
|
+
hash: string;
|
|
11
|
+
buffer?: Buffer;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export default getFilenameFromUrl;
|
|
2
|
+
export type IncomingMessage = import("../index.js").IncomingMessage;
|
|
3
|
+
export type ServerResponse = import("../index.js").ServerResponse;
|
|
4
|
+
export type Extra = {
|
|
5
|
+
/**
|
|
6
|
+
* stats
|
|
7
|
+
*/
|
|
8
|
+
stats?: import("fs").Stats | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* error code
|
|
11
|
+
*/
|
|
12
|
+
errorCode?: number | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* true when immutable, otherwise false
|
|
15
|
+
*/
|
|
16
|
+
immutable?: boolean | undefined;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {object} Extra
|
|
20
|
+
* @property {import("fs").Stats=} stats stats
|
|
21
|
+
* @property {number=} errorCode error code
|
|
22
|
+
* @property {boolean=} immutable true when immutable, otherwise false
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* decodeURIComponent.
|
|
26
|
+
*
|
|
27
|
+
* Allows V8 to only deoptimize this fn instead of all of send().
|
|
28
|
+
* @param {string} input
|
|
29
|
+
* @returns {string}
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* @template {IncomingMessage} Request
|
|
33
|
+
* @template {ServerResponse} Response
|
|
34
|
+
* @param {import("../index.js").FilledContext<Request, Response>} context context
|
|
35
|
+
* @param {string} url url
|
|
36
|
+
* @param {Extra=} extra extra
|
|
37
|
+
* @returns {string | undefined} filename
|
|
38
|
+
*/
|
|
39
|
+
declare function getFilenameFromUrl<
|
|
40
|
+
Request extends IncomingMessage,
|
|
41
|
+
Response extends ServerResponse,
|
|
42
|
+
>(
|
|
43
|
+
context: import("../index.js").FilledContext<Request, Response>,
|
|
44
|
+
url: string,
|
|
45
|
+
extra?: Extra | undefined,
|
|
46
|
+
): string | undefined;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export default getPaths;
|
|
2
|
+
export type Compiler = import("@rspack/core").Compiler;
|
|
3
|
+
export type Stats = import("@rspack/core").Stats;
|
|
4
|
+
export type MultiStats = import("@rspack/core").MultiStats;
|
|
5
|
+
export type Asset = import("@rspack/core").Asset;
|
|
6
|
+
export type DevServerOption = import("../index.js").DevServerOption;
|
|
7
|
+
export type IncomingMessage = import("../index.js").IncomingMessage;
|
|
8
|
+
export type ServerResponse = import("../index.js").ServerResponse;
|
|
9
|
+
/** @typedef {import("@rspack/core").Compiler} Compiler */
|
|
10
|
+
/** @typedef {import("@rspack/core").Stats} Stats */
|
|
11
|
+
/** @typedef {import("@rspack/core").MultiStats} MultiStats */
|
|
12
|
+
/** @typedef {import("@rspack/core").Asset} Asset */
|
|
13
|
+
/** @typedef {import("../index.js").DevServerOption} DevServerOption */
|
|
14
|
+
/** @typedef {import("../index.js").IncomingMessage} IncomingMessage */
|
|
15
|
+
/** @typedef {import("../index.js").ServerResponse} ServerResponse */
|
|
16
|
+
/**
|
|
17
|
+
* @template {IncomingMessage} Request
|
|
18
|
+
* @template {ServerResponse} Response
|
|
19
|
+
* @param {import("../index.js").FilledContext<Request, Response>} context context
|
|
20
|
+
* @returns {{ outputPath: string, publicPath: string, assetsInfo: Map<string, Asset["info"]> | undefined }[]} paths
|
|
21
|
+
*/
|
|
22
|
+
declare function getPaths<
|
|
23
|
+
Request extends IncomingMessage,
|
|
24
|
+
Response extends ServerResponse,
|
|
25
|
+
>(
|
|
26
|
+
context: import("../index.js").FilledContext<Request, Response>,
|
|
27
|
+
): {
|
|
28
|
+
outputPath: string;
|
|
29
|
+
publicPath: string;
|
|
30
|
+
assetsInfo: Map<string, Asset["info"]> | undefined;
|
|
31
|
+
}[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export default memorize;
|
|
2
|
+
export type FunctionReturning<T> = (...args: EXPECTED_ANY) => T;
|
|
3
|
+
export type EXPECTED_ANY = import("../index").EXPECTED_ANY;
|
|
4
|
+
/**
|
|
5
|
+
* @template T
|
|
6
|
+
* @typedef {(...args: EXPECTED_ANY) => T} FunctionReturning
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @template T
|
|
10
|
+
* @param {FunctionReturning<T>} fn memorized function
|
|
11
|
+
* @param {({ cache?: Map<string, { data: T }> } | undefined)=} cache cache
|
|
12
|
+
* @param {((value: T) => T)=} callback callback
|
|
13
|
+
* @returns {FunctionReturning<T>} new function
|
|
14
|
+
*/
|
|
15
|
+
declare function memorize<T>(
|
|
16
|
+
fn: FunctionReturning<T>,
|
|
17
|
+
{
|
|
18
|
+
cache,
|
|
19
|
+
}?:
|
|
20
|
+
| (
|
|
21
|
+
| {
|
|
22
|
+
cache?: Map<
|
|
23
|
+
string,
|
|
24
|
+
{
|
|
25
|
+
data: T;
|
|
26
|
+
}
|
|
27
|
+
>;
|
|
28
|
+
}
|
|
29
|
+
| undefined
|
|
30
|
+
)
|
|
31
|
+
| undefined,
|
|
32
|
+
callback?: ((value: T) => T) | undefined,
|
|
33
|
+
): FunctionReturning<T>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export default ready;
|
|
2
|
+
export type IncomingMessage = import("../index.js").IncomingMessage;
|
|
3
|
+
export type ServerResponse = import("../index.js").ServerResponse;
|
|
4
|
+
export type Callback = import("../index.js").Callback;
|
|
5
|
+
/** @typedef {import("../index.js").IncomingMessage} IncomingMessage */
|
|
6
|
+
/** @typedef {import("../index.js").ServerResponse} ServerResponse */
|
|
7
|
+
/** @typedef {import("../index.js").Callback} Callback */
|
|
8
|
+
/**
|
|
9
|
+
* @template {IncomingMessage} Request
|
|
10
|
+
* @template {ServerResponse} Response
|
|
11
|
+
* @param {import("../index.js").FilledContext<Request, Response>} context context
|
|
12
|
+
* @param {Callback} callback callback
|
|
13
|
+
* @param {Request=} req req
|
|
14
|
+
* @returns {void}
|
|
15
|
+
*/
|
|
16
|
+
declare function ready<
|
|
17
|
+
Request extends IncomingMessage,
|
|
18
|
+
Response extends ServerResponse,
|
|
19
|
+
>(
|
|
20
|
+
context: import("../index.js").FilledContext<Request, Response>,
|
|
21
|
+
callback: Callback,
|
|
22
|
+
req?: Request | undefined,
|
|
23
|
+
): void;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export default setupHooks;
|
|
2
|
+
export type Configuration = import("@rspack/core").Configuration;
|
|
3
|
+
export type Compiler = import("@rspack/core").Compiler;
|
|
4
|
+
export type MultiCompiler = import("@rspack/core").MultiCompiler;
|
|
5
|
+
export type Stats = import("@rspack/core").Stats;
|
|
6
|
+
export type MultiStats = import("@rspack/core").MultiStats;
|
|
7
|
+
export type IncomingMessage = import("../index.js").IncomingMessage;
|
|
8
|
+
export type ServerResponse = import("../index.js").ServerResponse;
|
|
9
|
+
export type StatsOptions = Configuration["stats"];
|
|
10
|
+
export type MultiStatsOptions = {
|
|
11
|
+
children: Configuration["stats"][];
|
|
12
|
+
};
|
|
13
|
+
export type StatsObjectOptions = Exclude<
|
|
14
|
+
Configuration["stats"],
|
|
15
|
+
boolean | string | undefined
|
|
16
|
+
>;
|
|
17
|
+
/** @typedef {import("@rspack/core").Configuration} Configuration */
|
|
18
|
+
/** @typedef {import("@rspack/core").Compiler} Compiler */
|
|
19
|
+
/** @typedef {import("@rspack/core").MultiCompiler} MultiCompiler */
|
|
20
|
+
/** @typedef {import("@rspack/core").Stats} Stats */
|
|
21
|
+
/** @typedef {import("@rspack/core").MultiStats} MultiStats */
|
|
22
|
+
/** @typedef {import("../index.js").IncomingMessage} IncomingMessage */
|
|
23
|
+
/** @typedef {import("../index.js").ServerResponse} ServerResponse */
|
|
24
|
+
/** @typedef {Configuration["stats"]} StatsOptions */
|
|
25
|
+
/** @typedef {{ children: Configuration["stats"][] }} MultiStatsOptions */
|
|
26
|
+
/** @typedef {Exclude<Configuration["stats"], boolean | string | undefined>} StatsObjectOptions */
|
|
27
|
+
/**
|
|
28
|
+
* @template {IncomingMessage} Request
|
|
29
|
+
* @template {ServerResponse} Response
|
|
30
|
+
* @param {import("../index.js").WithOptional<import("../index.js").Context<Request, Response>, "watching" | "outputFileSystem">} context context
|
|
31
|
+
*/
|
|
32
|
+
declare function setupHooks<
|
|
33
|
+
Request extends IncomingMessage,
|
|
34
|
+
Response extends ServerResponse,
|
|
35
|
+
>(
|
|
36
|
+
context: import("../index.js").WithOptional<
|
|
37
|
+
import("../index.js").Context<Request, Response>,
|
|
38
|
+
"watching" | "outputFileSystem"
|
|
39
|
+
>,
|
|
40
|
+
): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export default setupOutputFileSystem;
|
|
2
|
+
export type MultiCompiler = import("@rspack/core").MultiCompiler;
|
|
3
|
+
export type DevServerOption = import("../index.js").DevServerOption;
|
|
4
|
+
export type IncomingMessage = import("../index.js").IncomingMessage;
|
|
5
|
+
export type ServerResponse = import("../index.js").ServerResponse;
|
|
6
|
+
/** @typedef {import("@rspack/core").MultiCompiler} MultiCompiler */
|
|
7
|
+
/** @typedef {import("../index.js").DevServerOption} DevServerOption */
|
|
8
|
+
/** @typedef {import("../index.js").IncomingMessage} IncomingMessage */
|
|
9
|
+
/** @typedef {import("../index.js").ServerResponse} ServerResponse */
|
|
10
|
+
/**
|
|
11
|
+
* @template {IncomingMessage} Request
|
|
12
|
+
* @template {ServerResponse} Response
|
|
13
|
+
* @param {import("../index.js").WithOptional<import("../index.js").Context<Request, Response>, "watching" | "outputFileSystem">} context context
|
|
14
|
+
*/
|
|
15
|
+
declare function setupOutputFileSystem<
|
|
16
|
+
Request extends IncomingMessage,
|
|
17
|
+
Response extends ServerResponse,
|
|
18
|
+
>(
|
|
19
|
+
context: import("../index.js").WithOptional<
|
|
20
|
+
import("../index.js").Context<Request, Response>,
|
|
21
|
+
"watching" | "outputFileSystem"
|
|
22
|
+
>,
|
|
23
|
+
): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default setupWriteToDisk;
|
|
2
|
+
export type Compiler = import("@rspack/core").Compiler;
|
|
3
|
+
export type MultiCompiler = import("@rspack/core").MultiCompiler;
|
|
4
|
+
export type Compilation = import("@rspack/core").Compilation;
|
|
5
|
+
export type DevServerOption = import("../index.js").DevServerOption;
|
|
6
|
+
export type IncomingMessage = import("../index.js").IncomingMessage;
|
|
7
|
+
export type ServerResponse = import("../index.js").ServerResponse;
|
|
8
|
+
/**
|
|
9
|
+
* @template {IncomingMessage} Request
|
|
10
|
+
* @template {ServerResponse} Response
|
|
11
|
+
* @param {import("../index.js").WithOptional<import("../index.js").Context<Request, Response>, "watching" | "outputFileSystem">} context context
|
|
12
|
+
*/
|
|
13
|
+
declare function setupWriteToDisk<
|
|
14
|
+
Request extends IncomingMessage,
|
|
15
|
+
Response extends ServerResponse,
|
|
16
|
+
>(
|
|
17
|
+
context: import("../index.js").WithOptional<
|
|
18
|
+
import("../index.js").Context<Request, Response>,
|
|
19
|
+
"watching" | "outputFileSystem"
|
|
20
|
+
>,
|
|
21
|
+
): void;
|
package/dist/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import wdm from "webpack-dev-middleware";
|
|
2
|
-
/** @deprecated
|
|
3
|
-
*
|
|
4
|
-
* This package has the same functionality as webpack-dev-middleware, please use webpack-dev-middleware instead.
|
|
5
|
-
*/
|
|
6
|
-
declare const rdm: typeof wdm;
|
|
7
|
-
export default rdm;
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,wBAAwB,CAAC;AAGzC;;;GAGG;AACH,QAAA,MAAM,GAAG,EAAE,OAAO,GAEqK,CAAC;AAExL,eAAe,GAAG,CAAC"}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,oFAAyC;AACzC,gDAAwB;AAExB;;;GAGG;AACH,MAAM,GAAG,GAAe,cAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE;IAC5D,OAAO,IAAA,gCAAG,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC/B,CAAC,EAAE,mLAAmL,CAAC,CAAC;AAExL,kBAAe,GAAG,CAAC"}
|
package/index.cjs
DELETED