@rspack/dev-server 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.
Files changed (42) hide show
  1. package/README.md +4 -3
  2. package/client/clients/WebSocketClient.d.ts +17 -0
  3. package/client/clients/WebSocketClient.js +28 -28
  4. package/client/index.d.ts +17 -0
  5. package/client/index.js +224 -363
  6. package/client/modules/logger/Logger.d.ts +40 -0
  7. package/client/modules/logger/Logger.js +123 -0
  8. package/client/modules/logger/createConsoleLogger.d.ts +12 -0
  9. package/client/modules/logger/createConsoleLogger.js +119 -0
  10. package/client/modules/logger/index.d.ts +18 -0
  11. package/client/modules/logger/index.js +20 -712
  12. package/client/modules/types.d.ts +45 -0
  13. package/client/modules/types.js +17 -0
  14. package/client/overlay.d.ts +44 -0
  15. package/client/overlay.js +241 -290
  16. package/client/progress.d.ts +11 -0
  17. package/client/progress.js +178 -111
  18. package/client/socket.d.ts +15 -0
  19. package/client/socket.js +19 -46
  20. package/client/utils/ansiHTML.d.ts +30 -0
  21. package/client/utils/ansiHTML.js +106 -153
  22. package/client/utils/log.d.ts +13 -0
  23. package/client/utils/log.js +7 -17
  24. package/client/utils/sendMessage.d.ts +11 -0
  25. package/client/utils/sendMessage.js +6 -15
  26. package/dist/0~launch-editor.js +618 -0
  27. package/dist/0~open.js +547 -0
  28. package/dist/0~p-retry.js +158 -0
  29. package/dist/131.js +1398 -0
  30. package/dist/getPort.d.ts +4 -1
  31. package/dist/index.js +1 -5
  32. package/dist/rslib-runtime.js +66 -0
  33. package/dist/server.d.ts +7 -7
  34. package/dist/servers/WebsocketServer.d.ts +8 -1
  35. package/dist/types.d.ts +7 -5
  36. package/package.json +55 -58
  37. package/dist/config.js +0 -2
  38. package/dist/getPort.js +0 -141
  39. package/dist/server.js +0 -1971
  40. package/dist/servers/BaseServer.js +0 -20
  41. package/dist/servers/WebsocketServer.js +0 -72
  42. package/dist/types.js +0 -5
package/README.md CHANGED
@@ -9,9 +9,10 @@
9
9
 
10
10
  Use Rspack with a development server that provides live reloading. This should be used for development only.
11
11
 
12
- > [!NOTE]
13
- > The `main` branch is under active development for 2.0.
14
- > The stable `1.x` releases are maintained in the [v1.x](https://github.com/rstackjs/rspack-dev-server/tree/v1.x) branch.
12
+ ## Versions
13
+
14
+ - `2.x`: For Rspack v2
15
+ - `1.x`: For Rspack v1, see [v1.x - README](https://github.com/rstackjs/rspack-dev-server/tree/v1.x#rspackdev-server) for usage guide.
15
16
 
16
17
  ## Installation
17
18
 
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The following code is modified based on
3
+ * https://github.com/webpack/webpack-dev-server
4
+ *
5
+ * MIT Licensed
6
+ * Author Tobias Koppers @sokra
7
+ * Copyright (c) JS Foundation and other contributors
8
+ * https://github.com/webpack/webpack-dev-server/blob/main/LICENSE
9
+ */
10
+ import { CommunicationClient } from '../type.js';
11
+ export default class WebSocketClient implements CommunicationClient {
12
+ private client;
13
+ constructor(url: string);
14
+ onOpen(fn: (...args: unknown[]) => void): void;
15
+ onClose(fn: (...args: unknown[]) => void): void;
16
+ onMessage(fn: (...args: unknown[]) => void): void;
17
+ }
@@ -1,32 +1,32 @@
1
- /**
2
- * The following code is modified based on
3
- * https://github.com/webpack/webpack-dev-server
4
- *
5
- * MIT Licensed
6
- * Author Tobias Koppers @sokra
7
- * Copyright (c) JS Foundation and other contributors
8
- * https://github.com/webpack/webpack-dev-server/blob/main/LICENSE
9
- */
10
- import { log } from '../utils/log.js';
11
- var WebSocketClient = /** @class */ (function () {
12
- function WebSocketClient(url) {
13
- this.client = new WebSocket(url);
14
- this.client.onerror = function (error) {
15
- log.error(error);
16
- };
17
- }
18
- WebSocketClient.prototype.onOpen = function (fn) {
1
+ import { log } from "../utils/log.js";
2
+ function _define_property(obj, key, value) {
3
+ if (key in obj) Object.defineProperty(obj, key, {
4
+ value: value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ else obj[key] = value;
10
+ return obj;
11
+ }
12
+ class WebSocketClient {
13
+ onOpen(fn) {
19
14
  this.client.onopen = fn;
20
- };
21
- WebSocketClient.prototype.onClose = function (fn) {
15
+ }
16
+ onClose(fn) {
22
17
  this.client.onclose = fn;
23
- };
24
- // call fn with the message string as the first argument
25
- WebSocketClient.prototype.onMessage = function (fn) {
26
- this.client.onmessage = function (event) {
18
+ }
19
+ onMessage(fn) {
20
+ this.client.onmessage = (event)=>{
27
21
  fn(event.data);
28
22
  };
29
- };
30
- return WebSocketClient;
31
- }());
32
- export default WebSocketClient;
23
+ }
24
+ constructor(url){
25
+ _define_property(this, "client", void 0);
26
+ this.client = new WebSocket(url);
27
+ this.client.onerror = (error)=>{
28
+ log.error(error);
29
+ };
30
+ }
31
+ }
32
+ export { WebSocketClient as default };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The following code is modified based on
3
+ * https://github.com/webpack/webpack-dev-server
4
+ *
5
+ * MIT Licensed
6
+ * Author Tobias Koppers @sokra
7
+ * Copyright (c) JS Foundation and other contributors
8
+ * https://github.com/webpack/webpack-dev-server/blob/main/LICENSE
9
+ */
10
+ declare const parseURL: (resourceQuery: string) => {
11
+ [key: string]: string;
12
+ };
13
+ declare const getCurrentScriptSource: () => string;
14
+ declare const createSocketURL: (parsedURL: URL & {
15
+ fromCurrentScript?: boolean;
16
+ }) => string;
17
+ export { getCurrentScriptSource, parseURL, createSocketURL };