@rspack/dev-server 1.1.1 → 1.1.3

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/client/index.js CHANGED
@@ -156,7 +156,7 @@ if (parsedResourceQuery.overlay) {
156
156
  options.overlay = __assign({ errors: true, warnings: true, runtimeErrors: true }, options.overlay);
157
157
  decodeOverlayOptions(options.overlay);
158
158
  }
159
- enabledFeatures.Overlay = true;
159
+ enabledFeatures.Overlay = options.overlay !== false;
160
160
  }
161
161
  if (parsedResourceQuery.logging) {
162
162
  options.logging = parsedResourceQuery.logging;
package/dist/config.d.ts CHANGED
@@ -11,7 +11,7 @@ export interface ResolvedDevServer extends DevServer {
11
11
  magicHtml: boolean;
12
12
  liveReload: boolean;
13
13
  webSocketServer: false | WebpackDevServer.WebSocketServerConfiguration;
14
- proxy: WebpackDevServer.ProxyConfigArray;
14
+ proxy: Required<DevServer["proxy"]>;
15
15
  client: WebpackDevServer.ClientConfiguration;
16
16
  allowedHosts: "auto" | string[] | "all";
17
17
  bonjour: false | Record<string, never> | WebpackDevServer.BonjourOptions;
package/dist/server.d.ts CHANGED
@@ -20,6 +20,7 @@ export declare class RspackDevServer extends WebpackDevServer {
20
20
  /**
21
21
  * resolved after `normalizedOptions`
22
22
  */
23
+ /** @ts-ignore: types of path data of rspack is not compatible with webpack */
23
24
  options: ResolvedDevServer;
24
25
  staticWatchers: FSWatcher[];
25
26
  sockets: Socket[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/dev-server",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "license": "MIT",
5
5
  "description": "Development server for rspack",
6
6
  "main": "./dist/index.js",
@@ -43,7 +43,7 @@
43
43
  "@biomejs/biome": "^1.8.3",
44
44
  "@jest/reporters": "29.7.0",
45
45
  "@jest/test-sequencer": "^29.7.0",
46
- "@rspack/core": "1.0.11",
46
+ "@rspack/core": "1.3.11",
47
47
  "@rspack/plugin-react-refresh": "1.0.0",
48
48
  "@types/express": "4.17.21",
49
49
  "@types/jest": "29.5.12",
@@ -51,7 +51,7 @@
51
51
  "@types/ws": "8.5.10",
52
52
  "@hono/node-server": "^1.13.3",
53
53
  "cross-env": "^7.0.3",
54
- "css-loader": "^6.11.0",
54
+ "css-loader": "^7.1.2",
55
55
  "connect": "^3.7.0",
56
56
  "execa": "9.3.0",
57
57
  "fs-extra": "11.2.0",
@@ -76,16 +76,15 @@
76
76
  "ts-jest": "29.1.2",
77
77
  "typescript": "5.0.2",
78
78
  "wait-for-expect": "^3.0.2",
79
- "webpack": "^5.94.0"
79
+ "webpack": "^5.94.0",
80
+ "webpack-dev-middleware": "^7.4.2",
81
+ "express": "^4.21.2"
80
82
  },
81
83
  "dependencies": {
82
84
  "chokidar": "^3.6.0",
83
- "express": "^4.21.2",
84
- "http-proxy-middleware": "^2.0.7",
85
- "mime-types": "^2.1.35",
85
+ "http-proxy-middleware": "^2.0.9",
86
86
  "p-retry": "^6.2.0",
87
- "webpack-dev-middleware": "^7.4.2",
88
- "webpack-dev-server": "5.2.0",
87
+ "webpack-dev-server": "5.2.2",
89
88
  "ws": "^8.18.0"
90
89
  },
91
90
  "peerDependencies": {
@@ -1,4 +0,0 @@
1
- import type { Compiler } from "@rspack/core";
2
- import type { RequestHandler } from "express";
3
- import type wdm from "webpack-dev-middleware";
4
- export declare function getRspackMemoryAssets(compiler: Compiler, rdm: ReturnType<typeof wdm>): RequestHandler;
@@ -1,77 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getRspackMemoryAssets = void 0;
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
- const mime_types_1 = __importDefault(require("mime-types"));
11
- // biome-ignore lint/suspicious/noExplicitAny: _
12
- function etag(buf) {
13
- const hash = node_crypto_1.default.createHash("sha256").update(buf).digest("hex");
14
- const etag = hash;
15
- return etag;
16
- }
17
- function createPublicPathGetter(compiler) {
18
- const raw = compiler.options.output.publicPath || "/";
19
- if (typeof raw === "function") {
20
- return (compilation) => compilation ? compilation.getPath(raw) : raw({ hash: "XXXX" }, undefined);
21
- }
22
- if (/\[(hash|fullhash)[:\]]/.test(raw)) {
23
- return (compilation) => compilation ? compilation.getPath(raw) : `${raw.replace(/\/$/, "")}/`;
24
- }
25
- return () => `${raw.replace(/\/$/, "")}/`;
26
- }
27
- function getRspackMemoryAssets(compiler, rdm) {
28
- const getPublicPath = createPublicPathGetter(compiler);
29
- return (req, res, next) => {
30
- const { method, url } = req;
31
- if (method !== "GET") {
32
- return next();
33
- }
34
- // css hmr will append query string, so here need to remove query string
35
- // @ts-expect-error
36
- const path = (0, node_url_1.parse)(url).pathname;
37
- const publicPath = getPublicPath(compiler._lastCompilation);
38
- // asset name is not start with /, so path need to slice 1
39
- // @ts-expect-error
40
- const filename = path.startsWith(publicPath)
41
- ? // @ts-expect-error
42
- path.slice(publicPath.length)
43
- : // @ts-expect-error
44
- path.slice(1);
45
- const buffer = compiler._lastCompilation?.getAsset(filename) ??
46
- (() => {
47
- const { index } = rdm.context.options;
48
- const indexValue = typeof index === "undefined" || typeof index === "boolean"
49
- ? "index.html"
50
- : index;
51
- return compiler._lastCompilation?.getAsset(filename + indexValue);
52
- })();
53
- if (!buffer) {
54
- return next();
55
- }
56
- let contentType;
57
- if (filename === "") {
58
- contentType = "text/html; charset=utf-8";
59
- }
60
- else {
61
- contentType =
62
- // @ts-expect-error
63
- mime_types_1.default.contentType((0, node_path_1.extname)(path)) || "text/plain; charset=utf-8";
64
- }
65
- const calcEtag = etag(buffer);
66
- const oldEtag = req.headers["if-none-match"];
67
- res.setHeader("Content-Type", contentType);
68
- res.setHeader("ETag", calcEtag);
69
- if (calcEtag === oldEtag) {
70
- res.status(304).send();
71
- }
72
- else {
73
- res.send(buffer);
74
- }
75
- };
76
- }
77
- exports.getRspackMemoryAssets = getRspackMemoryAssets;