@rspack/dev-middleware 2.0.0-beta.1 → 2.0.0-beta.2
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/README.md +1 -21
- package/dist/index.js +0 -1
- package/package.json +1 -3
- package/types/utils/compatibleAPI.d.ts +0 -5
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ app.use(
|
|
|
58
58
|
app.listen(3000, () => console.log("Example app listening on port 3000!"));
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
See [below](#other-servers) for
|
|
61
|
+
See [below](#other-servers) for examples of use with other servers.
|
|
62
62
|
|
|
63
63
|
## Options
|
|
64
64
|
|
|
@@ -685,26 +685,6 @@ process.on("unhandledRejection", (err) => {
|
|
|
685
685
|
});
|
|
686
686
|
```
|
|
687
687
|
|
|
688
|
-
### Fastify
|
|
689
|
-
|
|
690
|
-
Fastify interop will require the use of `fastify-express` instead of `middie` for providing middleware support. As the authors of `fastify-express` recommend, this should only be used as a stopgap while full Fastify support is worked on.
|
|
691
|
-
|
|
692
|
-
```js
|
|
693
|
-
const { devMiddleware } = require("@rspack/dev-middleware");
|
|
694
|
-
const fastify = require("fastify")();
|
|
695
|
-
const { rspack } = require("@rspack/core");
|
|
696
|
-
const rspackConfig = require("./rspack.config.js");
|
|
697
|
-
|
|
698
|
-
const compiler = rspack(rspackConfig);
|
|
699
|
-
const devMiddlewareOptions = {
|
|
700
|
-
// options
|
|
701
|
-
};
|
|
702
|
-
|
|
703
|
-
await fastify.register(require("@fastify/express"));
|
|
704
|
-
await fastify.use(devMiddleware(compiler, devMiddlewareOptions));
|
|
705
|
-
await fastify.listen(3000);
|
|
706
|
-
```
|
|
707
|
-
|
|
708
688
|
### Hono
|
|
709
689
|
|
|
710
690
|
```js
|
package/dist/index.js
CHANGED
|
@@ -8337,7 +8337,6 @@ function getRequestMethod(req) {
|
|
|
8337
8337
|
}
|
|
8338
8338
|
function getRequestURL(req) {
|
|
8339
8339
|
if ("function" == typeof req.getURL) return req.getURL();
|
|
8340
|
-
if (void 0 !== req.originalUrl) return req.originalUrl;
|
|
8341
8340
|
return req.url;
|
|
8342
8341
|
}
|
|
8343
8342
|
function setStatusCode(res, code) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/dev-middleware",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.2",
|
|
4
4
|
"description": "A development middleware for Rspack",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rspack",
|
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
"bump": "npx bumpp"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@fastify/express": "^4.0.2",
|
|
36
35
|
"@hapi/hapi": "^21.3.7",
|
|
37
36
|
"@hono/node-server": "^1.12.0",
|
|
38
37
|
"@rslib/core": "^0.20.0",
|
|
@@ -48,7 +47,6 @@
|
|
|
48
47
|
"deepmerge": "^4.2.2",
|
|
49
48
|
"execa": "^5.1.1",
|
|
50
49
|
"express": "^5.1.0",
|
|
51
|
-
"fastify": "^5.2.1",
|
|
52
50
|
"file-loader": "^6.2.0",
|
|
53
51
|
"finalhandler": "^2.1.0",
|
|
54
52
|
"hono": "^4.4.13",
|
|
@@ -15,10 +15,6 @@ export type ExpectedIncomingMessage = {
|
|
|
15
15
|
* get URL extra method
|
|
16
16
|
*/
|
|
17
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
18
|
};
|
|
23
19
|
export type ExpectedServerResponse = {
|
|
24
20
|
/**
|
|
@@ -124,7 +120,6 @@ export function getOutgoing<
|
|
|
124
120
|
* @property {((name: string) => string | string[] | undefined)=} getHeader get header extra method
|
|
125
121
|
* @property {(() => string | undefined)=} getMethod get method extra method
|
|
126
122
|
* @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
123
|
*/
|
|
129
124
|
/**
|
|
130
125
|
* @typedef {object} ExpectedServerResponse
|