@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.
- package/README.md +4 -3
- package/client/clients/WebSocketClient.d.ts +17 -0
- package/client/clients/WebSocketClient.js +28 -28
- package/client/index.d.ts +17 -0
- package/client/index.js +224 -363
- package/client/modules/logger/Logger.d.ts +40 -0
- package/client/modules/logger/Logger.js +123 -0
- package/client/modules/logger/createConsoleLogger.d.ts +12 -0
- package/client/modules/logger/createConsoleLogger.js +119 -0
- package/client/modules/logger/index.d.ts +18 -0
- package/client/modules/logger/index.js +20 -712
- package/client/modules/types.d.ts +45 -0
- package/client/modules/types.js +17 -0
- package/client/overlay.d.ts +44 -0
- package/client/overlay.js +241 -290
- package/client/progress.d.ts +11 -0
- package/client/progress.js +178 -111
- package/client/socket.d.ts +15 -0
- package/client/socket.js +19 -46
- package/client/utils/ansiHTML.d.ts +30 -0
- package/client/utils/ansiHTML.js +106 -153
- package/client/utils/log.d.ts +13 -0
- package/client/utils/log.js +7 -17
- package/client/utils/sendMessage.d.ts +11 -0
- package/client/utils/sendMessage.js +6 -15
- package/dist/0~launch-editor.js +618 -0
- package/dist/0~open.js +547 -0
- package/dist/0~p-retry.js +158 -0
- package/dist/131.js +1398 -0
- package/dist/getPort.d.ts +4 -1
- package/dist/index.js +1 -5
- package/dist/rslib-runtime.js +66 -0
- package/dist/server.d.ts +7 -7
- package/dist/servers/WebsocketServer.d.ts +8 -1
- package/dist/types.d.ts +7 -5
- package/package.json +55 -58
- package/dist/config.js +0 -2
- package/dist/getPort.js +0 -141
- package/dist/server.js +0 -1971
- package/dist/servers/BaseServer.js +0 -20
- package/dist/servers/WebsocketServer.js +0 -72
- 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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
15
|
+
}
|
|
16
|
+
onClose(fn) {
|
|
22
17
|
this.client.onclose = fn;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
this.client.onmessage = function (event) {
|
|
18
|
+
}
|
|
19
|
+
onMessage(fn) {
|
|
20
|
+
this.client.onmessage = (event)=>{
|
|
27
21
|
fn(event.data);
|
|
28
22
|
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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 };
|