@rspack/dev-server 1.0.0-alpha.4 → 1.0.0-alpha.5
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/dist/middleware.js +6 -6
- package/dist/server.d.ts +2 -2
- package/package.json +4 -4
package/dist/middleware.js
CHANGED
|
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getRspackMemoryAssets = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
7
|
+
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
|
+
const node_url_1 = require("node:url");
|
|
10
10
|
const mime_types_1 = __importDefault(require("mime-types"));
|
|
11
11
|
function etag(buf) {
|
|
12
|
-
const hash =
|
|
12
|
+
const hash = node_crypto_1.default.createHash("sha256").update(buf).digest("hex");
|
|
13
13
|
const etag = hash;
|
|
14
14
|
return etag;
|
|
15
15
|
}
|
|
@@ -24,7 +24,7 @@ function getRspackMemoryAssets(compiler, rdm) {
|
|
|
24
24
|
}
|
|
25
25
|
// css hmr will append query string, so here need to remove query string
|
|
26
26
|
// @ts-expect-error
|
|
27
|
-
const path = (0,
|
|
27
|
+
const path = (0, node_url_1.parse)(url).pathname;
|
|
28
28
|
// asset name is not start with /, so path need to slice 1
|
|
29
29
|
// @ts-expect-error
|
|
30
30
|
const filename = path.startsWith(publicPath)
|
|
@@ -50,7 +50,7 @@ function getRspackMemoryAssets(compiler, rdm) {
|
|
|
50
50
|
else {
|
|
51
51
|
contentType =
|
|
52
52
|
// @ts-expect-error
|
|
53
|
-
mime_types_1.default.contentType((0,
|
|
53
|
+
mime_types_1.default.contentType((0, node_path_1.extname)(path)) || "text/plain; charset=utf-8";
|
|
54
54
|
}
|
|
55
55
|
const calcEtag = etag(buffer);
|
|
56
56
|
const oldEtag = req.headers["if-none-match"];
|
package/dist/server.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import type { Server } from "http";
|
|
4
|
-
import type { Socket } from "net";
|
|
3
|
+
import type { Server } from "node:http";
|
|
4
|
+
import type { Socket } from "node:net";
|
|
5
5
|
import { type Compiler, MultiCompiler } from "@rspack/core";
|
|
6
6
|
import type { FSWatcher } from "chokidar";
|
|
7
7
|
import WebpackDevServer from "webpack-dev-server";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/dev-server",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Development server for rspack",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"@types/express": "4.17.21",
|
|
34
34
|
"@types/mime-types": "2.1.4",
|
|
35
35
|
"@types/ws": "8.5.10",
|
|
36
|
-
"@rspack/
|
|
37
|
-
"@rspack/
|
|
38
|
-
"@rspack/plugin-react-refresh": "1.0.0-alpha.
|
|
36
|
+
"@rspack/dev-server": "1.0.0-alpha.5",
|
|
37
|
+
"@rspack/core": "1.0.0-alpha.5",
|
|
38
|
+
"@rspack/plugin-react-refresh": "1.0.0-alpha.5"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"chokidar": "3.6.0",
|