@rspack/dev-server 1.0.0-alpha.2 → 1.0.0-alpha.4

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/ansiHTML.js CHANGED
@@ -47,7 +47,7 @@ var _openTags = {
47
47
  4: "<u>",
48
48
  8: "display:none",
49
49
  9: "<del>",
50
- 38: function (match) {
50
+ 38: match => {
51
51
  // color
52
52
  var mode = _colorMode[match[0]];
53
53
  if (mode === "rgb") {
@@ -59,7 +59,7 @@ var _openTags = {
59
59
  return "color: rgb(" + r + "," + g + "," + b + ")";
60
60
  }
61
61
  },
62
- 48: function (match) {
62
+ 48: match => {
63
63
  // background color
64
64
  var mode = _colorMode[match[0]];
65
65
  if (mode === "rgb") {
@@ -78,7 +78,7 @@ var _openTagToCloseTag = {
78
78
  9: "29"
79
79
  };
80
80
  var _closeTags = {
81
- 0: function (ansiCodes) {
81
+ 0: ansiCodes => {
82
82
  if (!ansiCodes)
83
83
  return "</span>";
84
84
  if (!ansiCodes.length)
@@ -98,7 +98,7 @@ var _closeTags = {
98
98
  24: "</u>",
99
99
  29: "</del>" // reset delete
100
100
  };
101
- [21, 22, 27, 28, 39, 49].forEach(function (n) {
101
+ [21, 22, 27, 28, 39, 49].forEach(n => {
102
102
  _closeTags[n] = "</span>";
103
103
  });
104
104
  /**
@@ -127,7 +127,7 @@ function ansiHTML(text) {
127
127
  // Cache opened sequence.
128
128
  var ansiCodes = [];
129
129
  // Replace with markup.
130
- var ret = text.replace(/\033\[(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?m/g, function (m) {
130
+ var ret = text.replace(/\033\[(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?m/g, m => {
131
131
  var match = m.match(/(;?\d+)/g).map(normalizeSeq);
132
132
  Object.defineProperty(match, "advance", {
133
133
  value: function (count) {
@@ -180,7 +180,7 @@ function ansiHTML(text) {
180
180
  * Customize colors.
181
181
  * @param {Object} colors reference to _defColors
182
182
  */
183
- ansiHTML.setColors = function (colors) {
183
+ ansiHTML.setColors = colors => {
184
184
  if (typeof colors !== "object") {
185
185
  throw new Error("`colors` parameter must be an Object.");
186
186
  }
@@ -197,9 +197,7 @@ ansiHTML.setColors = function (colors) {
197
197
  }
198
198
  if (!Array.isArray(hex) ||
199
199
  hex.length === 0 ||
200
- hex.some(function (h) {
201
- return typeof h !== "string";
202
- })) {
200
+ hex.some(h => typeof h !== "string")) {
203
201
  throw new Error("The value of `" +
204
202
  key +
205
203
  "` property must be an Array and each item could only be a hex string, e.g.: FF0000");
@@ -224,7 +222,7 @@ ansiHTML.setColors = function (colors) {
224
222
  /**
225
223
  * Reset colors.
226
224
  */
227
- ansiHTML.reset = function () {
225
+ ansiHTML.reset = () => {
228
226
  _setTags(_defColors);
229
227
  };
230
228
  /**
@@ -234,14 +232,10 @@ ansiHTML.reset = function () {
234
232
  ansiHTML.tags = {};
235
233
  if (Object.defineProperty) {
236
234
  Object.defineProperty(ansiHTML.tags, "open", {
237
- get: function () {
238
- return _openTags;
239
- }
235
+ get: () => _openTags
240
236
  });
241
237
  Object.defineProperty(ansiHTML.tags, "close", {
242
- get: function () {
243
- return _closeTags;
244
- }
238
+ get: () => _closeTags
245
239
  });
246
240
  }
247
241
  else {
@@ -264,7 +258,7 @@ function _setTags(colors) {
264
258
  var color = _styles[code];
265
259
  var oriColor = colors[color] || "000";
266
260
  _openTags[code] = "color:#" + oriColor;
267
- code = parseInt(code);
261
+ code = Number.parseInt(code);
268
262
  _openTags[(code + 10).toString()] = "background:#" + oriColor;
269
263
  }
270
264
  }
package/dist/config.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { DevServer } from "@rspack/core";
2
- import WebpackDevServer from "webpack-dev-server";
2
+ import type WebpackDevServer from "webpack-dev-server";
3
3
  export type { DevServer };
4
4
  export interface ResolvedDevServer extends DevServer {
5
5
  port: number | string;
@@ -1,4 +1,4 @@
1
1
  import type { Compiler } from "@rspack/core";
2
2
  import type { RequestHandler } from "express";
3
- import wdm from "webpack-dev-middleware";
3
+ import type wdm from "webpack-dev-middleware";
4
4
  export declare function getRspackMemoryAssets(compiler: Compiler, rdm: ReturnType<typeof wdm>): RequestHandler;
@@ -17,7 +17,7 @@ function getRspackMemoryAssets(compiler, rdm) {
17
17
  const publicPath = compiler.options.output.publicPath
18
18
  ? compiler.options.output.publicPath.replace(/\/$/, "") + "/"
19
19
  : "/";
20
- return function (req, res, next) {
20
+ return (req, res, next) => {
21
21
  const { method, url } = req;
22
22
  if (method !== "GET") {
23
23
  return next();
package/dist/patch.js CHANGED
@@ -21,7 +21,7 @@ function applyDevServerPatch() {
21
21
  webpack_dev_server_1.default.prototype.sendStats = function sendStats__rspack_patched(
22
22
  // @ts-expect-error
23
23
  ...args) {
24
- let stats = args[1];
24
+ const stats = args[1];
25
25
  if (!stats) {
26
26
  return;
27
27
  }
package/dist/server.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  /// <reference types="node" />
3
3
  import type { Server } from "http";
4
4
  import type { Socket } from "net";
5
- import { Compiler, MultiCompiler } from "@rspack/core";
5
+ import { type Compiler, MultiCompiler } from "@rspack/core";
6
6
  import type { FSWatcher } from "chokidar";
7
7
  import WebpackDevServer from "webpack-dev-server";
8
8
  import type { DevServer, ResolvedDevServer } from "./config";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/dev-server",
3
- "version": "1.0.0-alpha.2",
3
+ "version": "1.0.0-alpha.4",
4
4
  "license": "MIT",
5
5
  "description": "Development server for rspack",
6
6
  "main": "./dist/index.js",
@@ -33,12 +33,12 @@
33
33
  "@types/express": "4.17.21",
34
34
  "@types/mime-types": "2.1.4",
35
35
  "@types/ws": "8.5.10",
36
- "@rspack/dev-server": "1.0.0-alpha.2",
37
- "@rspack/core": "1.0.0-alpha.2",
38
- "@rspack/plugin-react-refresh": "1.0.0-alpha.2"
36
+ "@rspack/core": "1.0.0-alpha.4",
37
+ "@rspack/dev-server": "1.0.0-alpha.4",
38
+ "@rspack/plugin-react-refresh": "1.0.0-alpha.4"
39
39
  },
40
40
  "dependencies": {
41
- "chokidar": "3.5.3",
41
+ "chokidar": "3.6.0",
42
42
  "connect-history-api-fallback": "2.0.0",
43
43
  "express": "4.19.2",
44
44
  "http-proxy-middleware": "2.0.6",