@rspack/dev-server 1.2.0 → 2.0.0-beta.1
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 +16 -17
- package/client/index.js +6 -6
- package/client/overlay.js +4 -4
- package/client/utils/ansiHTML.js +9 -9
- package/client/utils/log.js +1 -1
- package/dist/config.d.ts +1 -3
- package/dist/getPort.js +18 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -4
- package/dist/server.d.ts +6 -17
- package/dist/server.js +139 -389
- package/dist/servers/BaseServer.d.ts +1 -1
- package/dist/types.d.ts +10 -27
- package/package.json +39 -65
- package/client/clients/SockJSClient.js +0 -34
- package/client/modules/sockjs-client/index.js +0 -4506
- package/dist/options.json +0 -1034
- package/dist/servers/SockJSServer.d.ts +0 -10
- package/dist/servers/SockJSServer.js +0 -110
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Copyright (c) JS Foundation and other contributors
|
|
8
8
|
* https://github.com/webpack/webpack-dev-server/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
|
-
import type Server from '../server';
|
|
10
|
+
import type { Server } from '../server';
|
|
11
11
|
import type { ClientConnection } from '../types';
|
|
12
12
|
declare class BaseServer {
|
|
13
13
|
server: Server;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import type { Server as HTTPServer, IncomingMessage, ServerResponse } from 'node:http';
|
|
3
2
|
export type { HTTPServer, IncomingMessage };
|
|
4
3
|
export type { Socket } from 'node:net';
|
|
5
4
|
export type { AddressInfo } from 'node:net';
|
|
6
5
|
export type { NetworkInterfaceInfo } from 'node:os';
|
|
7
6
|
export type { Compiler, DevServer, MultiCompiler, MultiStats, Stats, StatsCompilation, StatsOptions, } from '@rspack/core';
|
|
8
|
-
import type { Bonjour, Service as BonjourOptions } from 'bonjour-service';
|
|
9
|
-
export type { Bonjour, BonjourOptions };
|
|
10
7
|
import type { FSWatcher, WatchOptions } from 'chokidar';
|
|
11
8
|
export type { FSWatcher, WatchOptions };
|
|
12
9
|
import type { Options as ConnectHistoryApiFallbackOptions } from 'connect-history-api-fallback';
|
|
@@ -16,7 +13,6 @@ export type { ExpressApplication };
|
|
|
16
13
|
import type { Options as HttpProxyMiddlewareOptions, Filter as HttpProxyMiddlewareOptionsFilter, RequestHandler } from 'http-proxy-middleware';
|
|
17
14
|
export type { RequestHandler };
|
|
18
15
|
export type { IPv6 } from 'ipaddr.js';
|
|
19
|
-
export type { Schema } from 'schema-utils/declarations/validate';
|
|
20
16
|
import type { Options as ServeIndexOptions } from 'serve-index';
|
|
21
17
|
export type { ServeIndexOptions };
|
|
22
18
|
import type { ServeStaticOptions } from 'serve-static';
|
|
@@ -26,15 +22,7 @@ export type SimpleHandleFunction = (req: IncomingMessage, res: ServerResponse) =
|
|
|
26
22
|
export type NextHandleFunction = (req: IncomingMessage, res: ServerResponse, next: NextFunction) => void;
|
|
27
23
|
export type ErrorHandleFunction = (err: EXPECTED_ANY, req: IncomingMessage, res: ServerResponse, next: NextFunction) => void;
|
|
28
24
|
export type HandleFunction = SimpleHandleFunction | NextHandleFunction | ErrorHandleFunction;
|
|
29
|
-
export type ServerOptions = import('https').ServerOptions
|
|
30
|
-
spdy?: {
|
|
31
|
-
plain?: boolean;
|
|
32
|
-
ssl?: boolean;
|
|
33
|
-
'x-forwarded-for'?: string;
|
|
34
|
-
protocol?: string;
|
|
35
|
-
protocols?: string[];
|
|
36
|
-
};
|
|
37
|
-
};
|
|
25
|
+
export type ServerOptions = import('https').ServerOptions;
|
|
38
26
|
export type Request<T extends BasicApplication = ExpressApplication> = T extends ExpressApplication ? ExpressRequest : IncomingMessage;
|
|
39
27
|
export type Response<T extends BasicApplication = ExpressApplication> = T extends ExpressApplication ? ExpressResponse : ServerResponse;
|
|
40
28
|
export type DevMiddlewareOptions<T extends Request, U extends Response> = import('webpack-dev-middleware').Options<T, U>;
|
|
@@ -67,34 +55,29 @@ export interface NormalizedStatic {
|
|
|
67
55
|
staticOptions: ServeStaticOptions;
|
|
68
56
|
watch: false | WatchOptions;
|
|
69
57
|
}
|
|
70
|
-
export type ServerType<A extends BasicApplication = ExpressApplication, S extends import('http').Server = import('http').Server> = 'http' | 'https' | '
|
|
58
|
+
export type ServerType<A extends BasicApplication = ExpressApplication, S extends import('http').Server = import('http').Server> = 'http' | 'https' | 'http2' | string | ((serverOptions: ServerOptions, application: A) => S);
|
|
71
59
|
export interface ServerConfiguration<A extends BasicApplication = ExpressApplication, S extends import('http').Server = import('http').Server> {
|
|
72
60
|
type?: ServerType<A, S>;
|
|
73
61
|
options?: ServerOptions;
|
|
74
62
|
}
|
|
75
63
|
export interface WebSocketServerConfiguration {
|
|
76
|
-
type?: '
|
|
64
|
+
type?: 'ws' | string | (() => WebSocketServerConfiguration);
|
|
77
65
|
options?: Record<string, EXPECTED_ANY>;
|
|
78
66
|
}
|
|
79
|
-
export type ClientConnection =
|
|
80
|
-
send: import('ws').WebSocket['send'];
|
|
81
|
-
terminate: import('ws').WebSocket['terminate'];
|
|
82
|
-
ping: import('ws').WebSocket['ping'];
|
|
83
|
-
})) & {
|
|
67
|
+
export type ClientConnection = import('ws').WebSocket & {
|
|
84
68
|
isAlive?: boolean;
|
|
85
69
|
};
|
|
86
|
-
export type WebSocketServer = import('ws').WebSocketServer
|
|
87
|
-
close: import('ws').WebSocketServer['close'];
|
|
88
|
-
});
|
|
70
|
+
export type WebSocketServer = import('ws').WebSocketServer;
|
|
89
71
|
export interface WebSocketServerImplementation {
|
|
90
72
|
implementation: WebSocketServer;
|
|
91
73
|
clients: ClientConnection[];
|
|
92
74
|
}
|
|
93
|
-
export type ByPass<Req = Request, Res = Response, ProxyConfig = ProxyConfigArrayItem> = (req: Req, res: Res, proxyConfig: ProxyConfig) => void;
|
|
94
75
|
export type ProxyConfigArrayItem = {
|
|
95
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Alias for `pathFilter` in `http-proxy-middleware` options.
|
|
78
|
+
* When both `context` and `pathFilter` are provided, `pathFilter` takes precedence.
|
|
79
|
+
*/
|
|
96
80
|
context?: HttpProxyMiddlewareOptionsFilter;
|
|
97
|
-
bypass?: ByPass;
|
|
98
81
|
} & HttpProxyMiddlewareOptions;
|
|
99
82
|
export type ProxyConfigArray = Array<ProxyConfigArrayItem | ((req?: Request | undefined, res?: Response | undefined, next?: NextFunction | undefined) => ProxyConfigArrayItem)>;
|
|
100
83
|
export interface OpenApp {
|
|
@@ -126,7 +109,7 @@ export interface ClientConfiguration {
|
|
|
126
109
|
};
|
|
127
110
|
progress?: boolean;
|
|
128
111
|
reconnect?: boolean | number;
|
|
129
|
-
webSocketTransport?: 'ws' |
|
|
112
|
+
webSocketTransport?: 'ws' | string;
|
|
130
113
|
webSocketURL?: string | WebSocketURL;
|
|
131
114
|
}
|
|
132
115
|
export type Headers = Array<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/dev-server",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Development server for rspack",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"format": "prettier --write .",
|
|
32
32
|
"prettier:ci": "prettier --check .",
|
|
33
33
|
"test:install": "cross-env ./node_modules/.bin/puppeteer browsers install chrome",
|
|
34
|
-
"test": "pnpm run test:install && pnpm run build &&
|
|
34
|
+
"test": "pnpm run test:install && pnpm run build && rstest",
|
|
35
35
|
"bump": "npx bumpp"
|
|
36
36
|
},
|
|
37
37
|
"simple-git-hooks": {
|
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"client"
|
|
52
52
|
],
|
|
53
53
|
"engines": {
|
|
54
|
-
"node": ">=
|
|
54
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
55
55
|
},
|
|
56
|
-
"packageManager": "pnpm@10.
|
|
56
|
+
"packageManager": "pnpm@10.30.3",
|
|
57
57
|
"homepage": "https://rspack.rs",
|
|
58
58
|
"bugs": "https://github.com/rstackjs/rspack-dev-server/issues",
|
|
59
59
|
"repository": {
|
|
@@ -61,81 +61,55 @@
|
|
|
61
61
|
"url": "https://github.com/rstackjs/rspack-dev-server"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@biomejs/biome": "^1.
|
|
65
|
-
"@
|
|
66
|
-
"@
|
|
67
|
-
"@rspack/
|
|
68
|
-
"@
|
|
64
|
+
"@biomejs/biome": "^1.9.4",
|
|
65
|
+
"@hono/node-server": "^1.19.9",
|
|
66
|
+
"@rspack/core": "2.0.0-beta.5",
|
|
67
|
+
"@rspack/plugin-react-refresh": "1.6.1",
|
|
68
|
+
"@rstest/core": "^0.8.5",
|
|
69
|
+
"@types/compression": "^1.8.1",
|
|
69
70
|
"@types/express": "5.0.6",
|
|
70
|
-
"@types/jest": "29.5.12",
|
|
71
71
|
"@types/mime-types": "3.0.1",
|
|
72
|
-
"@types/
|
|
73
|
-
"@types/
|
|
74
|
-
"@types/graceful-fs": "^4.1.9",
|
|
75
|
-
"@types/node": "^24.0.14",
|
|
76
|
-
"@types/node-forge": "^1.3.1",
|
|
77
|
-
"@types/sockjs-client": "^1.5.1",
|
|
72
|
+
"@types/node": "^24.11.0",
|
|
73
|
+
"@types/node-forge": "^1.3.14",
|
|
78
74
|
"@types/trusted-types": "^2.0.7",
|
|
79
|
-
"@
|
|
80
|
-
"cross-env": "^7.0.3",
|
|
81
|
-
"css-loader": "^7.1.2",
|
|
75
|
+
"@types/ws": "8.18.1",
|
|
82
76
|
"connect": "^3.7.0",
|
|
83
|
-
"
|
|
77
|
+
"cross-env": "^10.1.0",
|
|
78
|
+
"css-loader": "^7.1.4",
|
|
79
|
+
"hono": "^4.12.3",
|
|
84
80
|
"http-proxy": "^1.18.1",
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"jest-serializer-path": "^0.1.15",
|
|
90
|
-
"nano-staged": "^0.8.0",
|
|
91
|
-
"prettier": "3.2.5",
|
|
92
|
-
"puppeteer": "^24.34.0",
|
|
93
|
-
"react-refresh": "0.14.0",
|
|
81
|
+
"nano-staged": "^0.9.0",
|
|
82
|
+
"prettier": "3.8.1",
|
|
83
|
+
"puppeteer": "^24.37.5",
|
|
84
|
+
"react-refresh": "0.18.0",
|
|
94
85
|
"require-from-string": "^2.0.2",
|
|
95
|
-
"simple-git-hooks": "^2.
|
|
96
|
-
"sockjs-client": "^1.6.1",
|
|
86
|
+
"simple-git-hooks": "^2.13.1",
|
|
97
87
|
"style-loader": "^4.0.0",
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"wait-for-expect": "^3.0.2",
|
|
103
|
-
"webpack": "^5.94.0",
|
|
104
|
-
"webpack-merge": "^6.0.1",
|
|
105
|
-
"webpack-dev-middleware": "^7.4.2",
|
|
106
|
-
"express": "^5.2.1"
|
|
88
|
+
"typescript": "^5.9.3",
|
|
89
|
+
"webpack": "^5.105.3",
|
|
90
|
+
"webpack-dev-middleware": "^7.4.5",
|
|
91
|
+
"webpack-merge": "^6.0.1"
|
|
107
92
|
},
|
|
108
93
|
"dependencies": {
|
|
109
|
-
"chokidar": "^3.6.0",
|
|
110
|
-
"http-proxy-middleware": "^2.0.9",
|
|
111
|
-
"p-retry": "^6.2.0",
|
|
112
|
-
"ws": "^8.18.0",
|
|
113
|
-
"@types/bonjour": "^3.5.13",
|
|
114
94
|
"@types/connect-history-api-fallback": "^1.5.4",
|
|
115
|
-
"@types/express": "^4.17.25",
|
|
116
|
-
"@types/express-serve-static-core": "^4.17.21",
|
|
117
95
|
"@types/serve-index": "^1.9.4",
|
|
118
|
-
"@types/serve-static": "^
|
|
119
|
-
"@types/
|
|
120
|
-
"
|
|
121
|
-
"ansi-html-community": "^0.0.8",
|
|
122
|
-
"bonjour-service": "^1.2.1",
|
|
123
|
-
"colorette": "^2.0.10",
|
|
96
|
+
"@types/serve-static": "^2.2.0",
|
|
97
|
+
"@types/ws": "^8.18.1",
|
|
98
|
+
"chokidar": "^3.6.0",
|
|
124
99
|
"compression": "^1.8.1",
|
|
125
100
|
"connect-history-api-fallback": "^2.0.0",
|
|
126
|
-
"express": "^
|
|
127
|
-
"
|
|
128
|
-
"ipaddr.js": "^2.
|
|
129
|
-
"launch-editor": "^2.
|
|
130
|
-
"open": "^
|
|
131
|
-
"
|
|
132
|
-
"selfsigned": "^
|
|
133
|
-
"serve-index": "^1.9.
|
|
134
|
-
"
|
|
135
|
-
"
|
|
136
|
-
"webpack-dev-middleware": "^7.4.2"
|
|
101
|
+
"express": "^5.2.1",
|
|
102
|
+
"http-proxy-middleware": "^3.0.5",
|
|
103
|
+
"ipaddr.js": "^2.3.0",
|
|
104
|
+
"launch-editor": "^2.13.1",
|
|
105
|
+
"open": "^11.0.0",
|
|
106
|
+
"p-retry": "^7.1.1",
|
|
107
|
+
"selfsigned": "^5.5.0",
|
|
108
|
+
"serve-index": "^1.9.2",
|
|
109
|
+
"webpack-dev-middleware": "^7.4.5",
|
|
110
|
+
"ws": "^8.19.0"
|
|
137
111
|
},
|
|
138
112
|
"peerDependencies": {
|
|
139
|
-
"@rspack/core": "
|
|
113
|
+
"@rspack/core": "^2.0.0-0"
|
|
140
114
|
}
|
|
141
115
|
}
|
|
@@ -1,34 +0,0 @@
|
|
|
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 SockJS from '../modules/sockjs-client/index.js';
|
|
11
|
-
import { log } from '../utils/log.js';
|
|
12
|
-
var SockJSClient = /** @class */ (function () {
|
|
13
|
-
function SockJSClient(url) {
|
|
14
|
-
// SockJS requires `http` and `https` protocols
|
|
15
|
-
this.sock = new SockJS(url.replace(/^ws:/i, 'http:').replace(/^wss:/i, 'https:'));
|
|
16
|
-
this.sock.onerror = function (error) {
|
|
17
|
-
log.error(error);
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
SockJSClient.prototype.onOpen = function (fn) {
|
|
21
|
-
this.sock.onopen = fn;
|
|
22
|
-
};
|
|
23
|
-
SockJSClient.prototype.onClose = function (fn) {
|
|
24
|
-
this.sock.onclose = fn;
|
|
25
|
-
};
|
|
26
|
-
// call f with the message string as the first argument
|
|
27
|
-
SockJSClient.prototype.onMessage = function (fn) {
|
|
28
|
-
this.sock.onmessage = function (err) {
|
|
29
|
-
fn(err.data);
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
return SockJSClient;
|
|
33
|
-
}());
|
|
34
|
-
export default SockJSClient;
|