@rspack/dev-server 1.1.4 → 1.1.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/README.md CHANGED
@@ -1,15 +1,10 @@
1
- <picture>
2
- <source media="(prefers-color-scheme: dark)" srcset="https://assets.rspack.dev/rspack/rspack-banner-plain-dark.png">
3
- <img alt="Rspack Banner" src="https://assets.rspack.dev/rspack/rspack-banner-plain-light.png">
4
- </picture>
5
-
6
1
  # @rspack/dev-server
7
2
 
8
3
  <p>
9
4
  <a href="https://npmjs.com/package/@rspack/dev-server?activeTab=readme"><img src="https://img.shields.io/npm/v/@rspack/dev-server?style=flat-square&colorA=564341&colorB=EDED91" alt="npm version" /></a>
10
5
  <a href="https://npmcharts.com/compare/@rspack/dev-server?minimal=true"><img src="https://img.shields.io/npm/dm/@rspack/dev-server.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="downloads" /></a>
11
6
  <a href="https://nodejs.org/en/about/previous-releases"><img src="https://img.shields.io/node/v/@rspack/dev-server.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="node version"></a>
12
- <a href="https://github.com/web-infra-dev/rspack-dev-server/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="license" /></a>
7
+ <a href="https://github.com/rstackjs/rspack-dev-server/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="license" /></a>
13
8
  </p>
14
9
 
15
10
  Use Rspack with a development server that provides live reloading. This should be used for development only.
@@ -68,37 +63,37 @@ $ rspack serve
68
63
  $ rspack serve -c ./your.config.js
69
64
  ```
70
65
 
71
- > See [CLI](https://rspack.dev/api/cli) for more details.
66
+ > See [CLI](https://rspack.rs/api/cli) for more details.
72
67
 
73
68
  While starting the development server, you can specify the configuration by the `devServer` field of your Rspack config file:
74
69
 
75
70
  ```js
76
- // rspack.config.js
77
- module.exports = {
71
+ // rspack.config.mjs
72
+ export default {
78
73
  // ...
79
74
  devServer: {
80
75
  // the configuration of the development server
81
- port: 8080
76
+ port: 8080,
82
77
  },
83
78
  };
84
79
  ```
85
80
 
86
- > See [DevServer](https://rspack.dev/config/dev-server) for all configuration options.
81
+ > See [DevServer](https://rspack.rs/config/dev-server) for all configuration options.
87
82
 
88
83
  ### With the API
89
84
 
90
85
  While it's recommended to run `@rspack/dev-server` via the CLI, you may also choose to start a server via the API.
91
86
 
92
87
  ```js
93
- import { RspackDevServer } from "@rspack/dev-server";
94
- import rspack from "@rspack/core";
95
- import rspackConfig from './rspack.config.js';
88
+ import { RspackDevServer } from '@rspack/dev-server';
89
+ import rspack from '@rspack/core';
90
+ import rspackConfig from './rspack.config.mjs';
96
91
 
97
92
  const compiler = rspack(rspackConfig);
98
93
  const devServerOptions = {
99
94
  ...rspackConfig.devServer,
100
95
  // override
101
- port: 8888
96
+ port: 8888,
102
97
  };
103
98
 
104
99
  const server = new RspackDevServer(devServerOptions, compiler);
@@ -116,4 +111,4 @@ Thanks to the [webpack-dev-server](https://github.com/webpack/webpack-dev-server
116
111
 
117
112
  ## License
118
113
 
119
- [MIT licensed](https://github.com/web-infra-dev/rspack-dev-server/blob/main/LICENSE).
114
+ [MIT licensed](https://github.com/rstackjs/rspack-dev-server/blob/main/LICENSE).
package/client/index.js CHANGED
@@ -10,16 +10,16 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
- import hotEmitter from "@rspack/core/hot/emitter.js";
13
+ import hotEmitter from '@rspack/core/hot/emitter.js';
14
14
  /* global __resourceQuery, __webpack_hash__ */
15
15
  /* Rspack dev server runtime client */
16
16
  /// <reference types="webpack/module" />
17
- import webpackHotLog from "@rspack/core/hot/log.js";
18
- import { createOverlay, formatProblem, } from "webpack-dev-server/client/overlay.js";
19
- import socket from "webpack-dev-server/client/socket.js";
20
- import { defineProgressElement, isProgressSupported, } from "webpack-dev-server/client/progress.js";
21
- import { log, setLogLevel } from "webpack-dev-server/client/utils/log.js";
22
- import sendMessage from "webpack-dev-server/client/utils/sendMessage.js";
17
+ import webpackHotLog from '@rspack/core/hot/log.js';
18
+ import { createOverlay, formatProblem, } from 'webpack-dev-server/client/overlay.js';
19
+ import socket from 'webpack-dev-server/client/socket.js';
20
+ import { defineProgressElement, isProgressSupported, } from 'webpack-dev-server/client/progress.js';
21
+ import { log, setLogLevel } from 'webpack-dev-server/client/utils/log.js';
22
+ import sendMessage from 'webpack-dev-server/client/utils/sendMessage.js';
23
23
  /**
24
24
  * @typedef {Object} OverlayOptions
25
25
  * @property {boolean | (error: Error) => boolean} [warnings]
@@ -46,12 +46,12 @@ import sendMessage from "webpack-dev-server/client/utils/sendMessage.js";
46
46
  * @param {boolean | { warnings?: boolean | string; errors?: boolean | string; runtimeErrors?: boolean | string; }} overlayOptions
47
47
  */
48
48
  var decodeOverlayOptions = function (overlayOptions) {
49
- if (typeof overlayOptions === "object") {
50
- ["warnings", "errors", "runtimeErrors"].forEach(function (property) {
51
- if (typeof overlayOptions[property] === "string") {
49
+ if (typeof overlayOptions === 'object') {
50
+ ['warnings', 'errors', 'runtimeErrors'].forEach(function (property) {
51
+ if (typeof overlayOptions[property] === 'string') {
52
52
  var overlayFilterFunctionString = decodeURIComponent(overlayOptions[property]);
53
53
  // eslint-disable-next-line no-new-func
54
- overlayOptions[property] = new Function("message", "var callback = ".concat(overlayFilterFunctionString, "\n\t\t\t\treturn callback(message)"));
54
+ overlayOptions[property] = new Function('message', "var callback = ".concat(overlayFilterFunctionString, "\n\t\t\t\treturn callback(message)"));
55
55
  }
56
56
  });
57
57
  }
@@ -63,10 +63,10 @@ var decodeOverlayOptions = function (overlayOptions) {
63
63
  var parseURL = function (resourceQuery) {
64
64
  /** @type {{ [key: string]: string }} */
65
65
  var result = {};
66
- if (typeof resourceQuery === "string" && resourceQuery !== "") {
67
- var searchParams = resourceQuery.slice(1).split("&");
66
+ if (typeof resourceQuery === 'string' && resourceQuery !== '') {
67
+ var searchParams = resourceQuery.slice(1).split('&');
68
68
  for (var i = 0; i < searchParams.length; i++) {
69
- var pair = searchParams[i].split("=");
69
+ var pair = searchParams[i].split('=');
70
70
  result[pair[0]] = decodeURIComponent(pair[1]);
71
71
  }
72
72
  }
@@ -106,22 +106,22 @@ var getCurrentScriptSource = function () {
106
106
  // `document.currentScript` is the most accurate way to find the current script,
107
107
  // but is not supported in all browsers.
108
108
  if (document.currentScript) {
109
- return document.currentScript.getAttribute("src");
109
+ return document.currentScript.getAttribute('src');
110
110
  }
111
111
  // Fallback to getting all scripts running in the document.
112
112
  var scriptElements = document.scripts || [];
113
- var scriptElementsWithSrc = Array.prototype.filter.call(scriptElements, function (element) { return element.getAttribute("src"); });
113
+ var scriptElementsWithSrc = Array.prototype.filter.call(scriptElements, function (element) { return element.getAttribute('src'); });
114
114
  if (scriptElementsWithSrc.length > 0) {
115
115
  var currentScript = scriptElementsWithSrc[scriptElementsWithSrc.length - 1];
116
- return currentScript.getAttribute("src");
116
+ return currentScript.getAttribute('src');
117
117
  }
118
118
  // Fail as there was no script to use.
119
- throw new Error("[webpack-dev-server] Failed to get current script source.");
119
+ throw new Error('[webpack-dev-server] Failed to get current script source.');
120
120
  };
121
121
  var parsedResourceQuery = parseURL(__resourceQuery);
122
122
  var enabledFeatures = {
123
- "Hot Module Replacement": false,
124
- "Live Reloading": false,
123
+ 'Hot Module Replacement': false,
124
+ 'Live Reloading': false,
125
125
  Progress: false,
126
126
  Overlay: false,
127
127
  };
@@ -132,15 +132,15 @@ var options = {
132
132
  progress: false,
133
133
  overlay: false,
134
134
  };
135
- if (parsedResourceQuery.hot === "true") {
135
+ if (parsedResourceQuery.hot === 'true') {
136
136
  options.hot = true;
137
- enabledFeatures["Hot Module Replacement"] = true;
137
+ enabledFeatures['Hot Module Replacement'] = true;
138
138
  }
139
- if (parsedResourceQuery["live-reload"] === "true") {
139
+ if (parsedResourceQuery['live-reload'] === 'true') {
140
140
  options.liveReload = true;
141
- enabledFeatures["Live Reloading"] = true;
141
+ enabledFeatures['Live Reloading'] = true;
142
142
  }
143
- if (parsedResourceQuery.progress === "true") {
143
+ if (parsedResourceQuery.progress === 'true') {
144
144
  options.progress = true;
145
145
  enabledFeatures.Progress = true;
146
146
  }
@@ -149,10 +149,10 @@ if (parsedResourceQuery.overlay) {
149
149
  options.overlay = JSON.parse(parsedResourceQuery.overlay);
150
150
  }
151
151
  catch (e) {
152
- log.error("Error parsing overlay options from resource query:", e);
152
+ log.error('Error parsing overlay options from resource query:', e);
153
153
  }
154
154
  // Fill in default "true" params for partially-specified objects.
155
- if (typeof options.overlay === "object") {
155
+ if (typeof options.overlay === 'object') {
156
156
  options.overlay = __assign({ errors: true, warnings: true, runtimeErrors: true }, options.overlay);
157
157
  decodeOverlayOptions(options.overlay);
158
158
  }
@@ -161,7 +161,7 @@ if (parsedResourceQuery.overlay) {
161
161
  if (parsedResourceQuery.logging) {
162
162
  options.logging = parsedResourceQuery.logging;
163
163
  }
164
- if (typeof parsedResourceQuery.reconnect !== "undefined") {
164
+ if (typeof parsedResourceQuery.reconnect !== 'undefined') {
165
165
  options.reconnect = Number(parsedResourceQuery.reconnect);
166
166
  }
167
167
  /**
@@ -169,7 +169,7 @@ if (typeof parsedResourceQuery.reconnect !== "undefined") {
169
169
  */
170
170
  var setAllLogLevel = function (level) {
171
171
  // This is needed because the HMR logger operate separately from dev server logger
172
- webpackHotLog.setLogLevel(level === "verbose" || level === "log" ? "info" : level);
172
+ webpackHotLog.setLogLevel(level === 'verbose' || level === 'log' ? 'info' : level);
173
173
  setLogLevel(level);
174
174
  };
175
175
  if (options.logging) {
@@ -180,22 +180,22 @@ var logEnabledFeatures = function (features) {
180
180
  if (!features || listEnabledFeatures.length === 0) {
181
181
  return;
182
182
  }
183
- var logString = "Server started:";
183
+ var logString = 'Server started:';
184
184
  // Server started: Hot Module Replacement enabled, Live Reloading enabled, Overlay disabled.
185
185
  for (var i = 0; i < listEnabledFeatures.length; i++) {
186
186
  var key = listEnabledFeatures[i];
187
- logString += " ".concat(key, " ").concat(features[key] ? "enabled" : "disabled", ",");
187
+ logString += " ".concat(key, " ").concat(features[key] ? 'enabled' : 'disabled', ",");
188
188
  }
189
189
  // replace last comma with a period
190
- logString = logString.slice(0, -1).concat(".");
190
+ logString = logString.slice(0, -1).concat('.');
191
191
  log.info(logString);
192
192
  };
193
193
  logEnabledFeatures(enabledFeatures);
194
- self.addEventListener("beforeunload", function () {
194
+ self.addEventListener('beforeunload', function () {
195
195
  status.isUnloading = true;
196
196
  });
197
- var overlay = typeof window !== "undefined"
198
- ? createOverlay(typeof options.overlay === "object"
197
+ var overlay = typeof window !== 'undefined'
198
+ ? createOverlay(typeof options.overlay === 'object'
199
199
  ? {
200
200
  trustedTypesPolicyName: options.overlay.trustedTypesPolicyName,
201
201
  catchRuntimeError: options.overlay.runtimeErrors,
@@ -225,18 +225,18 @@ var reloadApp = function (_a, currentStatus) {
225
225
  */
226
226
  function applyReload(rootWindow, intervalId) {
227
227
  clearInterval(intervalId);
228
- log.info("App updated. Reloading...");
228
+ log.info('App updated. Reloading...');
229
229
  rootWindow.location.reload();
230
230
  }
231
231
  var search = self.location.search.toLowerCase();
232
- var allowToHot = search.indexOf("webpack-dev-server-hot=false") === -1;
233
- var allowToLiveReload = search.indexOf("webpack-dev-server-live-reload=false") === -1;
232
+ var allowToHot = search.indexOf('webpack-dev-server-hot=false') === -1;
233
+ var allowToLiveReload = search.indexOf('webpack-dev-server-live-reload=false') === -1;
234
234
  if (hot && allowToHot) {
235
- log.info("App hot update...");
236
- hotEmitter.emit("webpackHotUpdate", currentStatus.currentHash);
237
- if (typeof self !== "undefined" && self.window) {
235
+ log.info('App hot update...');
236
+ hotEmitter.emit('webpackHotUpdate', currentStatus.currentHash);
237
+ if (typeof self !== 'undefined' && self.window) {
238
238
  // broadcast update to window
239
- self.postMessage("webpackHotUpdate".concat(currentStatus.currentHash), "*");
239
+ self.postMessage("webpackHotUpdate".concat(currentStatus.currentHash), '*');
240
240
  }
241
241
  }
242
242
  // allow refreshing the page only if liveReload isn't disabled
@@ -244,7 +244,7 @@ var reloadApp = function (_a, currentStatus) {
244
244
  var rootWindow_1 = self;
245
245
  // use parent window for reload (in case we're in an iframe with no valid src)
246
246
  var intervalId_1 = self.setInterval(function () {
247
- if (rootWindow_1.location.protocol !== "about:") {
247
+ if (rootWindow_1.location.protocol !== 'about:') {
248
248
  // reload immediately if protocol is valid
249
249
  applyReload(rootWindow_1, intervalId_1);
250
250
  }
@@ -259,9 +259,9 @@ var reloadApp = function (_a, currentStatus) {
259
259
  }
260
260
  };
261
261
  var ansiRegex = new RegExp([
262
- "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
263
- "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))",
264
- ].join("|"), "g");
262
+ '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
263
+ '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))',
264
+ ].join('|'), 'g');
265
265
  /**
266
266
  *
267
267
  * Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string.
@@ -272,31 +272,31 @@ var ansiRegex = new RegExp([
272
272
  * @return {string}
273
273
  */
274
274
  var stripAnsi = function (string) {
275
- if (typeof string !== "string") {
275
+ if (typeof string !== 'string') {
276
276
  throw new TypeError("Expected a `string`, got `".concat(typeof string, "`"));
277
277
  }
278
- return string.replace(ansiRegex, "");
278
+ return string.replace(ansiRegex, '');
279
279
  };
280
280
  var onSocketMessage = {
281
281
  hot: function () {
282
- if (parsedResourceQuery.hot === "false") {
282
+ if (parsedResourceQuery.hot === 'false') {
283
283
  return;
284
284
  }
285
285
  options.hot = true;
286
286
  },
287
287
  liveReload: function () {
288
- if (parsedResourceQuery["live-reload"] === "false") {
288
+ if (parsedResourceQuery['live-reload'] === 'false') {
289
289
  return;
290
290
  }
291
291
  options.liveReload = true;
292
292
  },
293
293
  invalid: function () {
294
- log.info("App updated. Recompiling...");
294
+ log.info('App updated. Recompiling...');
295
295
  // Fixes #1042. overlay doesn't clear if errors are fixed but warnings remain.
296
296
  if (options.overlay) {
297
- overlay.send({ type: "DISMISS" });
297
+ overlay.send({ type: 'DISMISS' });
298
298
  }
299
- sendMessage("Invalid");
299
+ sendMessage('Invalid');
300
300
  },
301
301
  /**
302
302
  * @param {string | undefined} hash
@@ -313,7 +313,7 @@ var onSocketMessage = {
313
313
  * @param {boolean} value
314
314
  */
315
315
  overlay: function (value) {
316
- if (typeof document === "undefined") {
316
+ if (typeof document === 'undefined') {
317
317
  return;
318
318
  }
319
319
  options.overlay = value;
@@ -323,7 +323,7 @@ var onSocketMessage = {
323
323
  * @param {number} value
324
324
  */
325
325
  reconnect: function (value) {
326
- if (parsedResourceQuery.reconnect === "false") {
326
+ if (parsedResourceQuery.reconnect === 'false') {
327
327
  return;
328
328
  }
329
329
  options.reconnect = value;
@@ -337,43 +337,43 @@ var onSocketMessage = {
337
337
  /**
338
338
  * @param {{ pluginName?: string, percent: number, msg: string }} data
339
339
  */
340
- "progress-update": function progressUpdate(data) {
340
+ 'progress-update': function progressUpdate(data) {
341
341
  if (options.progress) {
342
- log.info("".concat(data.pluginName ? "[".concat(data.pluginName, "] ") : "").concat(data.percent, "% - ").concat(data.msg, "."));
342
+ log.info("".concat(data.pluginName ? "[".concat(data.pluginName, "] ") : '').concat(data.percent, "% - ").concat(data.msg, "."));
343
343
  }
344
344
  if (isProgressSupported()) {
345
- if (typeof options.progress === "string") {
346
- var progress = document.querySelector("wds-progress");
345
+ if (typeof options.progress === 'string') {
346
+ var progress = document.querySelector('wds-progress');
347
347
  if (!progress) {
348
348
  defineProgressElement();
349
- progress = document.createElement("wds-progress");
349
+ progress = document.createElement('wds-progress');
350
350
  document.body.appendChild(progress);
351
351
  }
352
- progress.setAttribute("progress", data.percent);
353
- progress.setAttribute("type", options.progress);
352
+ progress.setAttribute('progress', data.percent);
353
+ progress.setAttribute('type', options.progress);
354
354
  }
355
355
  }
356
- sendMessage("Progress", data);
356
+ sendMessage('Progress', data);
357
357
  },
358
- "still-ok": function stillOk() {
359
- log.info("Nothing changed.");
358
+ 'still-ok': function stillOk() {
359
+ log.info('Nothing changed.');
360
360
  if (options.overlay) {
361
- overlay.send({ type: "DISMISS" });
361
+ overlay.send({ type: 'DISMISS' });
362
362
  }
363
- sendMessage("StillOk");
363
+ sendMessage('StillOk');
364
364
  },
365
365
  ok: function () {
366
- sendMessage("Ok");
366
+ sendMessage('Ok');
367
367
  if (options.overlay) {
368
- overlay.send({ type: "DISMISS" });
368
+ overlay.send({ type: 'DISMISS' });
369
369
  }
370
370
  reloadApp(options, status);
371
371
  },
372
372
  /**
373
373
  * @param {string} file
374
374
  */
375
- "static-changed": function staticChanged(file) {
376
- log.info("".concat(file ? "\"".concat(file, "\"") : "Content", " from static directory was changed. Reloading..."));
375
+ 'static-changed': function staticChanged(file) {
376
+ log.info("".concat(file ? "\"".concat(file, "\"") : 'Content', " from static directory was changed. Reloading..."));
377
377
  self.location.reload();
378
378
  },
379
379
  /**
@@ -381,26 +381,26 @@ var onSocketMessage = {
381
381
  * @param {any} params
382
382
  */
383
383
  warnings: function (warnings, params) {
384
- log.warn("Warnings while compiling.");
384
+ log.warn('Warnings while compiling.');
385
385
  var printableWarnings = warnings.map(function (error) {
386
- var _a = formatProblem("warning", error), header = _a.header, body = _a.body;
386
+ var _a = formatProblem('warning', error), header = _a.header, body = _a.body;
387
387
  return "".concat(header, "\n").concat(stripAnsi(body));
388
388
  });
389
- sendMessage("Warnings", printableWarnings);
389
+ sendMessage('Warnings', printableWarnings);
390
390
  for (var i = 0; i < printableWarnings.length; i++) {
391
391
  log.warn(printableWarnings[i]);
392
392
  }
393
- var overlayWarningsSetting = typeof options.overlay === "boolean"
393
+ var overlayWarningsSetting = typeof options.overlay === 'boolean'
394
394
  ? options.overlay
395
395
  : options.overlay && options.overlay.warnings;
396
396
  if (overlayWarningsSetting) {
397
- var warningsToDisplay = typeof overlayWarningsSetting === "function"
397
+ var warningsToDisplay = typeof overlayWarningsSetting === 'function'
398
398
  ? warnings.filter(overlayWarningsSetting)
399
399
  : warnings;
400
400
  if (warningsToDisplay.length) {
401
401
  overlay.send({
402
- type: "BUILD_ERROR",
403
- level: "warning",
402
+ type: 'BUILD_ERROR',
403
+ level: 'warning',
404
404
  messages: warnings,
405
405
  });
406
406
  }
@@ -414,26 +414,26 @@ var onSocketMessage = {
414
414
  * @param {Error[]} errors
415
415
  */
416
416
  errors: function (errors) {
417
- log.error("Errors while compiling. Reload prevented.");
417
+ log.error('Errors while compiling. Reload prevented.');
418
418
  var printableErrors = errors.map(function (error) {
419
- var _a = formatProblem("error", error), header = _a.header, body = _a.body;
419
+ var _a = formatProblem('error', error), header = _a.header, body = _a.body;
420
420
  return "".concat(header, "\n").concat(stripAnsi(body));
421
421
  });
422
- sendMessage("Errors", printableErrors);
422
+ sendMessage('Errors', printableErrors);
423
423
  for (var i = 0; i < printableErrors.length; i++) {
424
424
  log.error(printableErrors[i]);
425
425
  }
426
- var overlayErrorsSettings = typeof options.overlay === "boolean"
426
+ var overlayErrorsSettings = typeof options.overlay === 'boolean'
427
427
  ? options.overlay
428
428
  : options.overlay && options.overlay.errors;
429
429
  if (overlayErrorsSettings) {
430
- var errorsToDisplay = typeof overlayErrorsSettings === "function"
430
+ var errorsToDisplay = typeof overlayErrorsSettings === 'function'
431
431
  ? errors.filter(overlayErrorsSettings)
432
432
  : errors;
433
433
  if (errorsToDisplay.length) {
434
434
  overlay.send({
435
- type: "BUILD_ERROR",
436
- level: "error",
435
+ type: 'BUILD_ERROR',
436
+ level: 'error',
437
437
  messages: errors,
438
438
  });
439
439
  }
@@ -446,11 +446,11 @@ var onSocketMessage = {
446
446
  log.error(error);
447
447
  },
448
448
  close: function () {
449
- log.info("Disconnected!");
449
+ log.info('Disconnected!');
450
450
  if (options.overlay) {
451
- overlay.send({ type: "DISMISS" });
451
+ overlay.send({ type: 'DISMISS' });
452
452
  }
453
- sendMessage("Close");
453
+ sendMessage('Close');
454
454
  },
455
455
  };
456
456
  /**
@@ -458,43 +458,43 @@ var onSocketMessage = {
458
458
  * @returns {string}
459
459
  */
460
460
  var formatURL = function (objURL) {
461
- var protocol = objURL.protocol || "";
462
- if (protocol && protocol.substr(-1) !== ":") {
463
- protocol += ":";
461
+ var protocol = objURL.protocol || '';
462
+ if (protocol && protocol.substr(-1) !== ':') {
463
+ protocol += ':';
464
464
  }
465
- var auth = objURL.auth || "";
465
+ var auth = objURL.auth || '';
466
466
  if (auth) {
467
467
  auth = encodeURIComponent(auth);
468
- auth = auth.replace(/%3A/i, ":");
469
- auth += "@";
468
+ auth = auth.replace(/%3A/i, ':');
469
+ auth += '@';
470
470
  }
471
- var host = "";
471
+ var host = '';
472
472
  if (objURL.hostname) {
473
473
  host =
474
474
  auth +
475
- (objURL.hostname.indexOf(":") === -1
475
+ (objURL.hostname.indexOf(':') === -1
476
476
  ? objURL.hostname
477
477
  : "[".concat(objURL.hostname, "]"));
478
478
  if (objURL.port) {
479
479
  host += ":".concat(objURL.port);
480
480
  }
481
481
  }
482
- var pathname = objURL.pathname || "";
482
+ var pathname = objURL.pathname || '';
483
483
  if (objURL.slashes) {
484
- host = "//".concat(host || "");
485
- if (pathname && pathname.charAt(0) !== "/") {
484
+ host = "//".concat(host || '');
485
+ if (pathname && pathname.charAt(0) !== '/') {
486
486
  pathname = "/".concat(pathname);
487
487
  }
488
488
  }
489
489
  else if (!host) {
490
- host = "";
490
+ host = '';
491
491
  }
492
- var search = objURL.search || "";
493
- if (search && search.charAt(0) !== "?") {
492
+ var search = objURL.search || '';
493
+ if (search && search.charAt(0) !== '?') {
494
494
  search = "?".concat(search);
495
495
  }
496
- var hash = objURL.hash || "";
497
- if (hash && hash.charAt(0) !== "#") {
496
+ var hash = objURL.hash || '';
497
+ if (hash && hash.charAt(0) !== '#') {
498
498
  hash = "#".concat(hash);
499
499
  }
500
500
  pathname = pathname.replace(/[?#]/g,
@@ -503,7 +503,7 @@ var formatURL = function (objURL) {
503
503
  * @returns {string}
504
504
  */
505
505
  function (match) { return encodeURIComponent(match); });
506
- search = search.replace("#", "%23");
506
+ search = search.replace('#', '%23');
507
507
  return "".concat(protocol).concat(host).concat(pathname).concat(search).concat(hash);
508
508
  };
509
509
  /**
@@ -514,23 +514,23 @@ var createSocketURL = function (parsedURL) {
514
514
  var hostname = parsedURL.hostname;
515
515
  // Node.js module parses it as `::`
516
516
  // `new URL(urlString, [baseURLString])` parses it as '[::]'
517
- var isInAddrAny = hostname === "0.0.0.0" || hostname === "::" || hostname === "[::]";
517
+ var isInAddrAny = hostname === '0.0.0.0' || hostname === '::' || hostname === '[::]';
518
518
  // why do we need this check?
519
519
  // hostname n/a for file protocol (example, when using electron, ionic)
520
520
  // see: https://github.com/webpack/webpack-dev-server/pull/384
521
521
  if (isInAddrAny &&
522
522
  self.location.hostname &&
523
- self.location.protocol.indexOf("http") === 0) {
523
+ self.location.protocol.indexOf('http') === 0) {
524
524
  hostname = self.location.hostname;
525
525
  }
526
526
  var socketURLProtocol = parsedURL.protocol || self.location.protocol;
527
527
  // When https is used in the app, secure web sockets are always necessary because the browser doesn't accept non-secure web sockets.
528
- if (socketURLProtocol === "auto:" ||
529
- (hostname && isInAddrAny && self.location.protocol === "https:")) {
528
+ if (socketURLProtocol === 'auto:' ||
529
+ (hostname && isInAddrAny && self.location.protocol === 'https:')) {
530
530
  socketURLProtocol = self.location.protocol;
531
531
  }
532
- socketURLProtocol = socketURLProtocol.replace(/^(?:http|.+-extension|file)/i, "ws");
533
- var socketURLAuth = "";
532
+ socketURLProtocol = socketURLProtocol.replace(/^(?:http|.+-extension|file)/i, 'ws');
533
+ var socketURLAuth = '';
534
534
  // `new URL(urlString, [baseURLstring])` doesn't have `auth` property
535
535
  // Parse authentication credentials in case we need them
536
536
  if (parsedURL.username) {
@@ -539,7 +539,7 @@ var createSocketURL = function (parsedURL) {
539
539
  // we only include password if the username is not empty.
540
540
  if (parsedURL.password) {
541
541
  // Result: <username>:<password>
542
- socketURLAuth = socketURLAuth.concat(":", parsedURL.password);
542
+ socketURLAuth = socketURLAuth.concat(':', parsedURL.password);
543
543
  }
544
544
  }
545
545
  // In case the host is a raw IPv6 address, it can be enclosed in
@@ -552,15 +552,15 @@ var createSocketURL = function (parsedURL) {
552
552
  // so we need to fall back to the default if they are not provided
553
553
  var socketURLHostname = (hostname ||
554
554
  self.location.hostname ||
555
- "localhost").replace(/^\[(.*)\]$/, "$1");
555
+ 'localhost').replace(/^\[(.*)\]$/, '$1');
556
556
  var socketURLPort = parsedURL.port;
557
- if (!socketURLPort || socketURLPort === "0") {
557
+ if (!socketURLPort || socketURLPort === '0') {
558
558
  socketURLPort = self.location.port;
559
559
  }
560
560
  // If path is provided it'll be passed in via the resourceQuery as a
561
561
  // query param so it has to be parsed out of the querystring in order for the
562
562
  // client to open the socket to the correct location.
563
- var socketURLPathname = "/ws";
563
+ var socketURLPathname = '/ws';
564
564
  if (parsedURL.pathname && !parsedURL.fromCurrentScript) {
565
565
  socketURLPathname = parsedURL.pathname;
566
566
  }
@@ -1,41 +1,41 @@
1
1
  // Reference to https://github.com/sindresorhus/ansi-regex
2
2
  var _regANSI = /(?:(?:\u001b\[)|\u009b)(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\u001b[A-M]/;
3
3
  var _defColors = {
4
- reset: ["fff", "000"],
5
- black: "000",
6
- red: "ff0000",
7
- green: "209805",
8
- yellow: "e8bf03",
9
- blue: "0000ff",
10
- magenta: "ff00ff",
11
- cyan: "00ffee",
12
- lightgrey: "f0f0f0",
13
- darkgrey: "888",
4
+ reset: ['fff', '000'],
5
+ black: '000',
6
+ red: 'ff0000',
7
+ green: '209805',
8
+ yellow: 'e8bf03',
9
+ blue: '0000ff',
10
+ magenta: 'ff00ff',
11
+ cyan: '00ffee',
12
+ lightgrey: 'f0f0f0',
13
+ darkgrey: '888',
14
14
  };
15
15
  var _styles = {
16
- 30: "black",
17
- 31: "red",
18
- 32: "green",
19
- 33: "yellow",
20
- 34: "blue",
21
- 35: "magenta",
22
- 36: "cyan",
23
- 37: "lightgrey",
16
+ 30: 'black',
17
+ 31: 'red',
18
+ 32: 'green',
19
+ 33: 'yellow',
20
+ 34: 'blue',
21
+ 35: 'magenta',
22
+ 36: 'cyan',
23
+ 37: 'lightgrey',
24
24
  };
25
25
  var _colorMode = {
26
- 2: "rgb",
26
+ 2: 'rgb',
27
27
  };
28
28
  var _openTags = {
29
- 1: "font-weight:bold",
30
- 2: "opacity:0.5",
31
- 3: "<i>",
32
- 4: "<u>",
33
- 8: "display:none",
34
- 9: "<del>",
29
+ 1: 'font-weight:bold',
30
+ 2: 'opacity:0.5',
31
+ 3: '<i>',
32
+ 4: '<u>',
33
+ 8: 'display:none',
34
+ 9: '<del>',
35
35
  38: function (match) {
36
36
  // color
37
37
  var mode = _colorMode[match[0]];
38
- if (mode === "rgb") {
38
+ if (mode === 'rgb') {
39
39
  var r = match[1];
40
40
  var g = match[2];
41
41
  var b = match[3];
@@ -46,7 +46,7 @@ var _openTags = {
46
46
  48: function (match) {
47
47
  // background color
48
48
  var mode = _colorMode[match[0]];
49
- if (mode === "rgb") {
49
+ if (mode === 'rgb') {
50
50
  var r = match[1];
51
51
  var g = match[2];
52
52
  var b = match[3];
@@ -56,35 +56,35 @@ var _openTags = {
56
56
  },
57
57
  };
58
58
  var _openTagToCloseTag = {
59
- 3: "23",
60
- 4: "24",
61
- 9: "29",
59
+ 3: '23',
60
+ 4: '24',
61
+ 9: '29',
62
62
  };
63
63
  var _closeTags = {
64
64
  0: function (ansiCodes) {
65
65
  if (!ansiCodes)
66
- return "</span>";
66
+ return '</span>';
67
67
  if (!ansiCodes.length)
68
- return "";
68
+ return '';
69
69
  var code;
70
- var ret = "";
70
+ var ret = '';
71
71
  while ((code = ansiCodes.pop())) {
72
72
  var closeTag = _openTagToCloseTag[code];
73
73
  if (closeTag) {
74
74
  ret += _closeTags[closeTag];
75
75
  continue;
76
76
  }
77
- ret += "</span>";
77
+ ret += '</span>';
78
78
  }
79
79
  return ret;
80
80
  },
81
- 23: "</i>",
82
- 24: "</u>",
83
- 29: "</del>", // reset delete
81
+ 23: '</i>',
82
+ 24: '</u>',
83
+ 29: '</del>', // reset delete
84
84
  };
85
85
  for (var _i = 0, _a = [21, 22, 27, 28, 39, 49]; _i < _a.length; _i++) {
86
86
  var n = _a[_i];
87
- _closeTags[n] = "</span>";
87
+ _closeTags[n] = '</span>';
88
88
  }
89
89
  /**
90
90
  * Normalize ';<seq>' | '<seq>' -> '<seq>'
@@ -92,7 +92,7 @@ for (var _i = 0, _a = [21, 22, 27, 28, 39, 49]; _i < _a.length; _i++) {
92
92
  function normalizeSeq(seq) {
93
93
  if (seq === null || seq === undefined)
94
94
  return null;
95
- if (seq.startsWith(";")) {
95
+ if (seq.startsWith(';')) {
96
96
  return seq.slice(1);
97
97
  }
98
98
  return seq;
@@ -112,12 +112,12 @@ export default function ansiHTML(text) {
112
112
  var ret = text.replace(/\033\[(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?m/g, function (m) {
113
113
  var _a;
114
114
  var match = (_a = m.match(/(;?\d+)/g)) === null || _a === void 0 ? void 0 : _a.map(normalizeSeq);
115
- Object.defineProperty(match, "advance", {
115
+ Object.defineProperty(match, 'advance', {
116
116
  value: function (count) {
117
117
  this.splice(0, count);
118
118
  },
119
119
  });
120
- var rep = "";
120
+ var rep = '';
121
121
  var seq;
122
122
  while ((seq = match[0])) {
123
123
  match.advance(1);
@@ -128,23 +128,23 @@ export default function ansiHTML(text) {
128
128
  var other = _openTags[seq];
129
129
  if (other &&
130
130
  (other =
131
- typeof other === "function" ? other(match) : other)) {
131
+ typeof other === 'function' ? other(match) : other)) {
132
132
  // If reset signal is encountered, we have to reset everything.
133
- var ret_1 = "";
134
- if (seq === "0") {
133
+ var ret_1 = '';
134
+ if (seq === '0') {
135
135
  ret_1 += _closeTags[seq](ansiCodes);
136
136
  }
137
137
  // If current sequence has been opened, close it.
138
138
  if (ansiCodes.indexOf(seq) !== -1) {
139
139
  ansiCodes.pop();
140
- return "</span>";
140
+ return '</span>';
141
141
  }
142
142
  // Open tag.
143
143
  ansiCodes.push(seq);
144
- return ret_1 + (other[0] === "<" ? other : "<span style=\"".concat(other, ";\">"));
144
+ return ret_1 + (other[0] === '<' ? other : "<span style=\"".concat(other, ";\">"));
145
145
  }
146
146
  var ct = _closeTags[seq];
147
- if (typeof ct === "function") {
147
+ if (typeof ct === 'function') {
148
148
  return ct(ansiCodes);
149
149
  }
150
150
  if (ct) {
@@ -152,12 +152,12 @@ export default function ansiHTML(text) {
152
152
  ansiCodes.pop();
153
153
  return ct;
154
154
  }
155
- return "";
155
+ return '';
156
156
  }
157
157
  });
158
158
  // Make sure tags are closed.
159
159
  var l = ansiCodes.length;
160
- l > 0 && (ret += Array(l + 1).join("</span>"));
160
+ l > 0 && (ret += Array(l + 1).join('</span>'));
161
161
  return ret;
162
162
  }
163
163
  /**
@@ -165,8 +165,8 @@ export default function ansiHTML(text) {
165
165
  * @param {Object} colors reference to _defColors
166
166
  */
167
167
  ansiHTML.setColors = function (colors) {
168
- if (typeof colors !== "object") {
169
- throw new Error("`colors` parameter must be an Object.");
168
+ if (typeof colors !== 'object') {
169
+ throw new Error('`colors` parameter must be an Object.');
170
170
  }
171
171
  var _finalColors = {};
172
172
  for (var key in _defColors) {
@@ -175,13 +175,13 @@ ansiHTML.setColors = function (colors) {
175
175
  _finalColors[key] = _defColors[key];
176
176
  continue;
177
177
  }
178
- if ("reset" === key) {
179
- if (typeof hex === "string") {
178
+ if ('reset' === key) {
179
+ if (typeof hex === 'string') {
180
180
  hex = [hex];
181
181
  }
182
182
  if (!Array.isArray(hex) ||
183
183
  hex.length === 0 ||
184
- hex.some(function (h) { return typeof h !== "string"; })) {
184
+ hex.some(function (h) { return typeof h !== 'string'; })) {
185
185
  throw new Error("The value of `".concat(key, "` property must be an Array and each item could only be a hex string, e.g.: FF0000"));
186
186
  }
187
187
  var defHexColor = _defColors[key];
@@ -194,7 +194,7 @@ ansiHTML.setColors = function (colors) {
194
194
  }
195
195
  hex = hex.slice(0, 2);
196
196
  }
197
- else if (typeof hex !== "string") {
197
+ else if (typeof hex !== 'string') {
198
198
  throw new Error("The value of `".concat(key, "` property must be a hex string, e.g.: FF0000"));
199
199
  }
200
200
  _finalColors[key] = hex;
@@ -213,10 +213,10 @@ ansiHTML.reset = function () {
213
213
  */
214
214
  ansiHTML.tags = {};
215
215
  if (Object.defineProperty) {
216
- Object.defineProperty(ansiHTML.tags, "open", {
216
+ Object.defineProperty(ansiHTML.tags, 'open', {
217
217
  get: function () { return _openTags; },
218
218
  });
219
- Object.defineProperty(ansiHTML.tags, "close", {
219
+ Object.defineProperty(ansiHTML.tags, 'close', {
220
220
  get: function () { return _closeTags; },
221
221
  });
222
222
  }
@@ -226,15 +226,15 @@ else {
226
226
  }
227
227
  function _setTags(colors) {
228
228
  // reset all
229
- _openTags["0"] =
229
+ _openTags['0'] =
230
230
  "font-weight:normal;opacity:1;color:#".concat(colors.reset[0], ";background:#").concat(colors.reset[1]);
231
231
  // inverse
232
- _openTags["7"] = "color:#".concat(colors.reset[1], ";background:#").concat(colors.reset[0]);
232
+ _openTags['7'] = "color:#".concat(colors.reset[1], ";background:#").concat(colors.reset[0]);
233
233
  // dark grey
234
- _openTags["90"] = "color:#".concat(colors.darkgrey);
234
+ _openTags['90'] = "color:#".concat(colors.darkgrey);
235
235
  for (var code in _styles) {
236
236
  var color = _styles[code];
237
- var oriColor = colors[color] || "000";
237
+ var oriColor = colors[color] || '000';
238
238
  _openTags[code] = "color:#".concat(oriColor);
239
239
  var codeInt = Number.parseInt(code);
240
240
  _openTags[(codeInt + 10).toString()] = "background:#".concat(oriColor);
package/dist/config.d.ts CHANGED
@@ -1,19 +1,19 @@
1
- import type { DevServer } from "@rspack/core";
2
- import type WebpackDevServer from "webpack-dev-server";
1
+ import type { DevServer } from '@rspack/core';
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;
6
6
  static: false | Array<WebpackDevServer.NormalizedStatic>;
7
- devMiddleware: DevServer["devMiddleware"];
8
- hot: boolean | "only";
7
+ devMiddleware: DevServer['devMiddleware'];
8
+ hot: boolean | 'only';
9
9
  host?: string;
10
10
  open: WebpackDevServer.Open[];
11
11
  magicHtml: boolean;
12
12
  liveReload: boolean;
13
13
  webSocketServer: false | WebpackDevServer.WebSocketServerConfiguration;
14
- proxy: Required<DevServer["proxy"]>;
14
+ proxy: Required<DevServer['proxy']>;
15
15
  client: WebpackDevServer.ClientConfiguration;
16
- allowedHosts: "auto" | string[] | "all";
16
+ allowedHosts: 'auto' | string[] | 'all';
17
17
  bonjour: false | Record<string, never> | WebpackDevServer.BonjourOptions;
18
18
  compress: boolean;
19
19
  historyApiFallback: false | WebpackDevServer.ConnectHistoryApiFallbackOptions;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { RspackDevServer } from "./server";
2
- export type { DevServer as Configuration } from "@rspack/core";
1
+ export { RspackDevServer } from './server';
2
+ export type { DevServer as Configuration } from '@rspack/core';
package/dist/server.d.ts CHANGED
@@ -9,12 +9,12 @@
9
9
  * Copyright (c) JS Foundation and other contributors
10
10
  * https://github.com/webpack/webpack-dev-server/blob/b0f15ace0123c125d5870609ef4691c141a6d187/LICENSE
11
11
  */
12
- import type { Server } from "node:http";
13
- import type { Socket } from "node:net";
14
- import { type Compiler, MultiCompiler } from "@rspack/core";
15
- import type { FSWatcher } from "chokidar";
16
- import WebpackDevServer from "webpack-dev-server";
17
- import type { DevServer, ResolvedDevServer } from "./config";
12
+ import type { Server } from 'node:http';
13
+ import type { Socket } from 'node:net';
14
+ import type { Compiler, MultiCompiler } from '@rspack/core';
15
+ import type { FSWatcher } from 'chokidar';
16
+ import WebpackDevServer from 'webpack-dev-server';
17
+ import type { DevServer, ResolvedDevServer } from './config';
18
18
  export declare class RspackDevServer extends WebpackDevServer {
19
19
  static getFreePort: (port: string, host: string) => Promise<any>;
20
20
  /**
package/dist/server.js CHANGED
@@ -4,24 +4,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.RspackDevServer = void 0;
7
- const core_1 = require("@rspack/core");
8
7
  const webpack_dev_server_1 = __importDefault(require("webpack-dev-server"));
9
8
  // @ts-ignore 'package.json' is not under 'rootDir'
10
9
  const package_json_1 = require("../package.json");
11
10
  const patch_1 = require("./patch");
12
11
  (0, patch_1.applyDevServerPatch)();
13
12
  const getFreePort = async function getFreePort(port, host) {
14
- if (typeof port !== "undefined" && port !== null && port !== "auto") {
13
+ if (typeof port !== 'undefined' && port !== null && port !== 'auto') {
15
14
  return port;
16
15
  }
17
- const { default: pRetry } = await import("p-retry");
18
- const getPort = require("webpack-dev-server/lib/getPort");
19
- const basePort = typeof process.env.WEBPACK_DEV_SERVER_BASE_PORT !== "undefined"
16
+ const { default: pRetry } = await import('p-retry');
17
+ const getPort = require('webpack-dev-server/lib/getPort');
18
+ const basePort = typeof process.env.WEBPACK_DEV_SERVER_BASE_PORT !== 'undefined'
20
19
  ? Number.parseInt(process.env.WEBPACK_DEV_SERVER_BASE_PORT, 10)
21
20
  : 8080;
22
21
  // Try to find unused port and listen on it for 3 times,
23
22
  // if port is not specified in options.
24
- const defaultPortRetry = typeof process.env.WEBPACK_DEV_SERVER_PORT_RETRY !== "undefined"
23
+ const defaultPortRetry = typeof process.env.WEBPACK_DEV_SERVER_PORT_RETRY !== 'undefined'
25
24
  ? Number.parseInt(process.env.WEBPACK_DEV_SERVER_PORT_RETRY, 10)
26
25
  : 3;
27
26
  return pRetry(() => getPort(basePort, host), {
@@ -29,6 +28,9 @@ const getFreePort = async function getFreePort(port, host) {
29
28
  });
30
29
  };
31
30
  webpack_dev_server_1.default.getFreePort = getFreePort;
31
+ function isMultiCompiler(compiler) {
32
+ return Array.isArray(compiler.compilers);
33
+ }
32
34
  class RspackDevServer extends webpack_dev_server_1.default {
33
35
  constructor(options, compiler) {
34
36
  // biome-ignore lint/suspicious/noExplicitAny: _
@@ -36,18 +38,18 @@ class RspackDevServer extends webpack_dev_server_1.default {
36
38
  // override
37
39
  }
38
40
  async initialize() {
39
- const compilers = this.compiler instanceof core_1.MultiCompiler
41
+ const compilers = isMultiCompiler(this.compiler)
40
42
  ? this.compiler.compilers
41
43
  : [this.compiler];
42
44
  for (const compiler of compilers) {
43
45
  const mode = compiler.options.mode || process.env.NODE_ENV;
44
46
  if (this.options.hot) {
45
- if (mode === "production") {
46
- this.logger.warn("Hot Module Replacement (HMR) is enabled for the production build. \n" +
47
- "Make sure to disable HMR for production by setting `devServer.hot` to `false` in the configuration.");
47
+ if (mode === 'production') {
48
+ this.logger.warn('Hot Module Replacement (HMR) is enabled for the production build. \n' +
49
+ 'Make sure to disable HMR for production by setting `devServer.hot` to `false` in the configuration.');
48
50
  }
49
51
  compiler.options.resolve.alias = {
50
- "ansi-html-community": require.resolve("@rspack/dev-server/client/utils/ansiHTML"),
52
+ 'ansi-html-community': require.resolve('@rspack/dev-server/client/utils/ansiHTML'),
51
53
  ...compiler.options.resolve.alias,
52
54
  };
53
55
  }
@@ -56,14 +58,14 @@ class RspackDevServer extends webpack_dev_server_1.default {
56
58
  await super.initialize();
57
59
  }
58
60
  getClientEntry() {
59
- return require.resolve("@rspack/dev-server/client/index");
61
+ return require.resolve('@rspack/dev-server/client/index');
60
62
  }
61
63
  getClientHotEntry() {
62
- if (this.options.hot === "only") {
63
- return require.resolve("@rspack/core/hot/only-dev-server");
64
+ if (this.options.hot === 'only') {
65
+ return require.resolve('@rspack/core/hot/only-dev-server');
64
66
  }
65
67
  if (this.options.hot) {
66
- return require.resolve("@rspack/core/hot/dev-server");
68
+ return require.resolve('@rspack/core/hot/dev-server');
67
69
  }
68
70
  }
69
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/dev-server",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "license": "MIT",
5
5
  "description": "Development server for rspack",
6
6
  "main": "./dist/index.js",
@@ -17,12 +17,29 @@
17
17
  "./client/*.js": "./client/*.js",
18
18
  "./package.json": "./package.json"
19
19
  },
20
+ "scripts": {
21
+ "build": "pnpm run build:server && pnpm run build:client",
22
+ "build:server": "tsc -b ./tsconfig.build.json",
23
+ "build:client": "tsc -b ./tsconfig.client.json",
24
+ "dev": "tsc -b -w",
25
+ "lint": "biome check .",
26
+ "lint:write": "biome check . --write",
27
+ "format": "prettier --write .",
28
+ "prettier:ci": "prettier --check .",
29
+ "test:install": "cross-env ./node_modules/.bin/puppeteer browsers install chrome",
30
+ "test": "pnpm run test:install && pnpm run build && cross-env NO_COLOR=1 node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ./node_modules/jest-cli/bin/jest --colors",
31
+ "bump": "npx bumpp"
32
+ },
20
33
  "simple-git-hooks": {
21
34
  "pre-commit": "npx nano-staged"
22
35
  },
23
36
  "nano-staged": {
37
+ "*.{yaml,yml,json,md,json5}": [
38
+ "npm rum format"
39
+ ],
24
40
  "*.{js,jsx,ts,tsx,mjs,cjs}": [
25
- "biome check --write --no-errors-on-unmatched"
41
+ "npm run format",
42
+ "biome lint --write --no-errors-on-unmatched"
26
43
  ]
27
44
  },
28
45
  "files": [
@@ -32,28 +49,27 @@
32
49
  "engines": {
33
50
  "node": ">= 18.12.0"
34
51
  },
35
- "homepage": "https://rspack.dev",
36
- "bugs": "https://github.com/web-infra-dev/rspack-dev-server/issues",
52
+ "packageManager": "pnpm@10.27.0",
53
+ "homepage": "https://rspack.rs",
54
+ "bugs": "https://github.com/rstackjs/rspack-dev-server/issues",
37
55
  "repository": {
38
56
  "type": "git",
39
- "url": "https://github.com/web-infra-dev/rspack-dev-server"
57
+ "url": "https://github.com/rstackjs/rspack-dev-server"
40
58
  },
41
59
  "devDependencies": {
42
60
  "@biomejs/biome": "^1.8.3",
43
61
  "@jest/reporters": "29.7.0",
44
62
  "@jest/test-sequencer": "^29.7.0",
45
- "@rspack/core": "npm:@rspack-canary/core@1.4.3-canary-98b815e4-20250703091256",
63
+ "@rspack/core": "1.7.0-beta.0",
46
64
  "@rspack/plugin-react-refresh": "1.0.0",
47
- "@types/express": "4.17.21",
65
+ "@types/express": "5.0.6",
48
66
  "@types/jest": "29.5.12",
49
- "@types/mime-types": "2.1.4",
67
+ "@types/mime-types": "3.0.1",
50
68
  "@types/ws": "8.5.10",
51
69
  "@hono/node-server": "^1.13.3",
52
70
  "cross-env": "^7.0.3",
53
71
  "css-loader": "^7.1.2",
54
72
  "connect": "^3.7.0",
55
- "execa": "9.3.0",
56
- "fs-extra": "11.2.0",
57
73
  "graceful-fs": "4.2.10",
58
74
  "http-proxy": "^1.18.1",
59
75
  "hono": "^4.6.8",
@@ -63,13 +79,12 @@
63
79
  "jest-serializer-path": "^0.1.15",
64
80
  "nano-staged": "^0.8.0",
65
81
  "prettier": "3.2.5",
66
- "puppeteer": "^23.2.2",
82
+ "puppeteer": "^24.34.0",
67
83
  "react-refresh": "0.14.0",
68
84
  "require-from-string": "^2.0.2",
69
- "semver": "7.6.3",
70
85
  "simple-git-hooks": "^2.11.1",
71
86
  "sockjs-client": "^1.6.1",
72
- "style-loader": "^3.3.3",
87
+ "style-loader": "^4.0.0",
73
88
  "supertest": "^6.1.3",
74
89
  "tcp-port-used": "^1.0.2",
75
90
  "ts-jest": "29.1.2",
@@ -77,7 +92,7 @@
77
92
  "wait-for-expect": "^3.0.2",
78
93
  "webpack": "^5.94.0",
79
94
  "webpack-dev-middleware": "^7.4.2",
80
- "express": "^4.21.2"
95
+ "express": "^5.2.1"
81
96
  },
82
97
  "dependencies": {
83
98
  "chokidar": "^3.6.0",
@@ -88,17 +103,5 @@
88
103
  },
89
104
  "peerDependencies": {
90
105
  "@rspack/core": "*"
91
- },
92
- "scripts": {
93
- "build": "pnpm run build:server && pnpm run build:client",
94
- "build:server": "tsc -b ./tsconfig.build.json",
95
- "build:client": "tsc -b ./tsconfig.client.json",
96
- "dev": "tsc -b -w",
97
- "lint": "biome check .",
98
- "lint:write": "biome check . --write",
99
- "format": "node ./node_modules/prettier/bin/prettier.cjs \"packages/**/src/**/*.{ts,tsx,js}\" \"crates/rspack_plugin_runtime/**/*.{ts,js}\" \"x.mjs\" --check",
100
- "test:install": "cross-env ./node_modules/.bin/puppeteer browsers install chrome",
101
- "test": "pnpm run test:install && pnpm run build && cross-env NO_COLOR=1 node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ./node_modules/jest-cli/bin/jest --colors",
102
- "release": "node ./scripts/release.mjs"
103
106
  }
104
- }
107
+ }