@rspack/dev-server 2.0.0-beta.5 → 2.0.0-beta.7
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 +2 -2
- package/client/clients/WebSocketClient.js +1 -1
- package/client/modules/logger/createConsoleLogger.js +1 -1
- package/client/modules/logger/index.js +3 -3
- package/client/socket.js +2 -1
- package/client/utils/ansiHTML.js +1 -1
- package/client/utils/sendMessage.js +1 -1
- package/dist/0~launch-editor.js +2 -1
- package/dist/0~open.js +13 -9
- package/dist/0~p-retry.js +1 -1
- package/dist/config.d.ts +4 -3
- package/dist/index.js +1467 -1
- package/dist/rslib-runtime.js +5 -5
- package/dist/server.d.ts +10 -9
- package/dist/types.d.ts +13 -70
- package/package.json +9 -12
- package/dist/131.js +0 -1474
package/dist/rslib-runtime.js
CHANGED
|
@@ -10,11 +10,6 @@ function __webpack_require__(moduleId) {
|
|
|
10
10
|
return module.exports;
|
|
11
11
|
}
|
|
12
12
|
__webpack_require__.m = __webpack_modules__;
|
|
13
|
-
(()=>{
|
|
14
|
-
__webpack_require__.add = function(modules) {
|
|
15
|
-
Object.assign(__webpack_require__.m, modules);
|
|
16
|
-
};
|
|
17
|
-
})();
|
|
18
13
|
(()=>{
|
|
19
14
|
__webpack_require__.n = (module)=>{
|
|
20
15
|
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
@@ -59,6 +54,11 @@ __webpack_require__.m = __webpack_modules__;
|
|
|
59
54
|
});
|
|
60
55
|
};
|
|
61
56
|
})();
|
|
57
|
+
(()=>{
|
|
58
|
+
__webpack_require__.add = function(modules) {
|
|
59
|
+
Object.assign(__webpack_require__.m, modules);
|
|
60
|
+
};
|
|
61
|
+
})();
|
|
62
62
|
(()=>{
|
|
63
63
|
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
64
64
|
})();
|
package/dist/server.d.ts
CHANGED
|
@@ -7,11 +7,12 @@
|
|
|
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 {
|
|
10
|
+
import type { DevServerClient, DevServerHeaders, DevServerHost, DevServerProxyConfigArray, DevServerStatic } from '@rspack/core';
|
|
11
|
+
import type { BasicApplication, BasicServer, ClientConnection, Compiler, ConnectHistoryApiFallbackOptions, DevMiddlewareContext, DevMiddlewareOptions, DevServer, EXPECTED_ANY, FSWatcher, HTTPServer, LiteralUnion, Middleware, MultiCompiler, MultiStats, Open, Port, Request, RequestHandler, Response, ServerConfiguration, ServerType, Socket, Stats, StatsOptions, WatchFiles, WatchOptions, WebSocketServerConfiguration, WebSocketServerImplementation } from './types';
|
|
11
12
|
import type { ConnectApplication } from './types';
|
|
12
13
|
export interface Configuration<A extends BasicApplication = ConnectApplication, S extends BasicServer = HTTPServer> {
|
|
13
14
|
ipc?: boolean | string;
|
|
14
|
-
host?:
|
|
15
|
+
host?: DevServerHost;
|
|
15
16
|
port?: Port;
|
|
16
17
|
hot?: boolean | 'only';
|
|
17
18
|
liveReload?: boolean;
|
|
@@ -20,15 +21,15 @@ export interface Configuration<A extends BasicApplication = ConnectApplication,
|
|
|
20
21
|
allowedHosts?: LiteralUnion<'auto' | 'all', string> | string[];
|
|
21
22
|
historyApiFallback?: boolean | ConnectHistoryApiFallbackOptions;
|
|
22
23
|
watchFiles?: string | string[] | WatchFiles | Array<string | WatchFiles>;
|
|
23
|
-
static?:
|
|
24
|
+
static?: DevServerStatic;
|
|
24
25
|
server?: ServerType<A, S> | ServerConfiguration<A, S>;
|
|
25
26
|
app?: () => Promise<A>;
|
|
26
27
|
webSocketServer?: boolean | LiteralUnion<'ws', string> | WebSocketServerConfiguration;
|
|
27
|
-
proxy?:
|
|
28
|
+
proxy?: DevServerProxyConfigArray;
|
|
28
29
|
open?: boolean | string | Open | Array<string | Open>;
|
|
29
30
|
setupExitSignals?: boolean;
|
|
30
|
-
client?: boolean |
|
|
31
|
-
headers?:
|
|
31
|
+
client?: boolean | DevServerClient;
|
|
32
|
+
headers?: DevServerHeaders | ((req: Request, res: Response, context: DevMiddlewareContext<Request, Response> | undefined) => DevServerHeaders);
|
|
32
33
|
onListening?: (devServer: Server<A, S>) => void;
|
|
33
34
|
setupMiddlewares?: (middlewares: Middleware[], devServer: Server<A, S>) => Middleware[];
|
|
34
35
|
}
|
|
@@ -47,7 +48,7 @@ declare class Server<A extends BasicApplication = ConnectApplication, S extends
|
|
|
47
48
|
currentHash: string | undefined;
|
|
48
49
|
isTlsServer: boolean;
|
|
49
50
|
webSocketServer: WebSocketServerImplementation | null | undefined;
|
|
50
|
-
middleware: import('
|
|
51
|
+
middleware: import('@rspack/dev-middleware').API<Request, Response> | undefined;
|
|
51
52
|
server: S | undefined;
|
|
52
53
|
app: A | undefined;
|
|
53
54
|
stats: Stats | MultiStats | undefined;
|
|
@@ -55,7 +56,7 @@ declare class Server<A extends BasicApplication = ConnectApplication, S extends
|
|
|
55
56
|
static get DEFAULT_STATS(): StatsOptions;
|
|
56
57
|
static isAbsoluteURL(URL: string): boolean;
|
|
57
58
|
static findIp(gatewayOrFamily: string, isInternal: boolean): string | undefined;
|
|
58
|
-
static getHostname(hostname:
|
|
59
|
+
static getHostname(hostname: DevServerHost): Promise<string>;
|
|
59
60
|
static getFreePort(port: string, host: string): Promise<string | number>;
|
|
60
61
|
static findCacheDir(): string;
|
|
61
62
|
getClientEntry(): string;
|
|
@@ -63,7 +64,7 @@ declare class Server<A extends BasicApplication = ConnectApplication, S extends
|
|
|
63
64
|
isValidHost(headers: Record<string, string | undefined>, headerToCheck: string, validateHost?: boolean): boolean;
|
|
64
65
|
sendMessage(clients: ClientConnection[], type: string, data?: EXPECTED_ANY, params?: EXPECTED_ANY): void;
|
|
65
66
|
watchFiles(watchPath: string | string[], watchOptions?: WatchOptions): Promise<void>;
|
|
66
|
-
invalidate(callback?: import('
|
|
67
|
+
invalidate(callback?: import('@rspack/dev-middleware').Callback): void;
|
|
67
68
|
start(): Promise<void>;
|
|
68
69
|
startCallback(callback?: (err?: Error) => void): void;
|
|
69
70
|
stop(): Promise<void>;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { Server as HTTPServer, IncomingMessage, ServerResponse } from 'node:http';
|
|
2
2
|
import type { ServerOptions } from 'node:https';
|
|
3
|
+
import type { DevServer, DevServerMiddlewareHandler, DevServerOpenOptions, DevServerStaticItem } from '@rspack/core';
|
|
3
4
|
import type { FSWatcher, ChokidarOptions as WatchOptions } from 'chokidar';
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
|
|
7
|
-
import type { ServeStaticOptions } from 'serve-static';
|
|
8
|
-
export type { FSWatcher, WatchOptions, RequestHandler, BasicServer, HTTPServer, ServerOptions, IncomingMessage, ConnectApplication, ConnectHistoryApiFallbackOptions, };
|
|
5
|
+
import type { Server as ConnectApplication, IncomingMessage as ConnectIncomingMessage, ErrorHandleFunction, HandleFunction, NextHandleFunction } from 'connect-next';
|
|
6
|
+
import type { RequestHandler } from 'http-proxy-middleware';
|
|
7
|
+
export type { FSWatcher, WatchOptions, RequestHandler, BasicServer, HTTPServer, ServerOptions, IncomingMessage, ConnectApplication, };
|
|
9
8
|
export type { IPv6 } from 'ipaddr.js';
|
|
10
9
|
export type { Socket } from 'node:net';
|
|
11
10
|
export type { AddressInfo } from 'node:net';
|
|
@@ -15,16 +14,11 @@ export type EXPECTED_ANY = any;
|
|
|
15
14
|
type BasicServer = import('node:net').Server | import('node:tls').Server;
|
|
16
15
|
/** https://github.com/microsoft/TypeScript/issues/29729 */
|
|
17
16
|
export type LiteralUnion<T extends U, U> = T | (U & Record<never, never>);
|
|
18
|
-
export type
|
|
19
|
-
export type SimpleHandleFunction = (req: IncomingMessage, res: ServerResponse) => void;
|
|
20
|
-
export type NextHandleFunction = (req: IncomingMessage, res: ServerResponse, next: NextFunction) => void;
|
|
21
|
-
export type ErrorHandleFunction = (err: EXPECTED_ANY, req: IncomingMessage, res: ServerResponse, next: NextFunction) => void;
|
|
22
|
-
export type HandleFunction = SimpleHandleFunction | NextHandleFunction | ErrorHandleFunction;
|
|
17
|
+
export type ConnectHistoryApiFallbackOptions = Exclude<NonNullable<DevServer['historyApiFallback']>, boolean>;
|
|
23
18
|
export type Request<T extends BasicApplication = ConnectApplication> = T extends ConnectApplication ? ConnectIncomingMessage : IncomingMessage;
|
|
24
19
|
export type Response = ServerResponse;
|
|
25
|
-
export type DevMiddlewareOptions<T extends Request, U extends Response> = import('
|
|
26
|
-
export type DevMiddlewareContext<T extends Request, U extends Response> = import('
|
|
27
|
-
export type Host = LiteralUnion<'local-ip' | 'local-ipv4' | 'local-ipv6', string>;
|
|
20
|
+
export type DevMiddlewareOptions<T extends Request, U extends Response> = import('@rspack/dev-middleware').Options<T, U>;
|
|
21
|
+
export type DevMiddlewareContext<T extends Request, U extends Response> = import('@rspack/dev-middleware').Context<T, U>;
|
|
28
22
|
export type Port = number | LiteralUnion<'auto', string>;
|
|
29
23
|
export interface WatchFiles {
|
|
30
24
|
paths: string | string[];
|
|
@@ -33,16 +27,10 @@ export interface WatchFiles {
|
|
|
33
27
|
poll?: number | boolean;
|
|
34
28
|
};
|
|
35
29
|
}
|
|
36
|
-
export interface Static {
|
|
37
|
-
directory?: string;
|
|
38
|
-
publicPath?: string | string[];
|
|
39
|
-
staticOptions?: ServeStaticOptions;
|
|
40
|
-
watch?: boolean | NonNullable<WatchFiles['options']>;
|
|
41
|
-
}
|
|
42
30
|
export interface NormalizedStatic {
|
|
43
31
|
directory: string;
|
|
44
32
|
publicPath: string[];
|
|
45
|
-
staticOptions:
|
|
33
|
+
staticOptions: DevServerStaticItem['staticOptions'];
|
|
46
34
|
watch: false | WatchOptions;
|
|
47
35
|
}
|
|
48
36
|
export type ServerType<A extends BasicApplication, S extends BasicServer> = LiteralUnion<'http' | 'https' | 'http2', string> | ((serverOptions: ServerOptions, application: A) => S);
|
|
@@ -62,57 +50,19 @@ export interface WebSocketServerImplementation {
|
|
|
62
50
|
implementation: WebSocketServer;
|
|
63
51
|
clients: ClientConnection[];
|
|
64
52
|
}
|
|
65
|
-
export type
|
|
66
|
-
/**
|
|
67
|
-
* Alias for `pathFilter` in `http-proxy-middleware` options.
|
|
68
|
-
* When both `context` and `pathFilter` are provided, `pathFilter` takes precedence.
|
|
69
|
-
*/
|
|
70
|
-
context?: HttpProxyMiddlewareOptionsFilter;
|
|
71
|
-
} & HttpProxyMiddlewareOptions;
|
|
72
|
-
export type ProxyConfigArray = Array<ProxyConfigArrayItem | ((req?: Request | undefined, res?: Response | undefined, next?: NextFunction | undefined) => ProxyConfigArrayItem)>;
|
|
73
|
-
export interface OpenApp {
|
|
74
|
-
name?: string;
|
|
75
|
-
arguments?: string[];
|
|
76
|
-
}
|
|
77
|
-
export interface Open {
|
|
78
|
-
app?: string | string[] | OpenApp;
|
|
53
|
+
export type Open = DevServerOpenOptions & {
|
|
79
54
|
target?: string | string[];
|
|
80
|
-
}
|
|
55
|
+
};
|
|
81
56
|
export interface NormalizedOpen {
|
|
82
57
|
target: string;
|
|
83
|
-
options:
|
|
58
|
+
options: DevServerOpenOptions;
|
|
84
59
|
}
|
|
85
|
-
export interface WebSocketURL {
|
|
86
|
-
hostname?: string;
|
|
87
|
-
password?: string;
|
|
88
|
-
pathname?: string;
|
|
89
|
-
port?: number | string;
|
|
90
|
-
protocol?: string;
|
|
91
|
-
username?: string;
|
|
92
|
-
}
|
|
93
|
-
export interface ClientConfiguration {
|
|
94
|
-
logging?: 'log' | 'info' | 'warn' | 'error' | 'none' | 'verbose';
|
|
95
|
-
overlay?: boolean | {
|
|
96
|
-
warnings?: OverlayMessageOptions;
|
|
97
|
-
errors?: OverlayMessageOptions;
|
|
98
|
-
runtimeErrors?: OverlayMessageOptions;
|
|
99
|
-
};
|
|
100
|
-
progress?: boolean;
|
|
101
|
-
reconnect?: boolean | number;
|
|
102
|
-
webSocketTransport?: LiteralUnion<'ws', string>;
|
|
103
|
-
webSocketURL?: string | WebSocketURL;
|
|
104
|
-
}
|
|
105
|
-
export type Headers = Array<{
|
|
106
|
-
key: string;
|
|
107
|
-
value: string;
|
|
108
|
-
}> | Record<string, string | string[]>;
|
|
109
|
-
export type MiddlewareHandler = (...args: EXPECTED_ANY[]) => EXPECTED_ANY;
|
|
110
60
|
export interface MiddlewareObject {
|
|
111
61
|
name?: string;
|
|
112
62
|
path?: string;
|
|
113
|
-
middleware:
|
|
63
|
+
middleware: DevServerMiddlewareHandler | ErrorHandleFunction;
|
|
114
64
|
}
|
|
115
|
-
export type Middleware = MiddlewareObject |
|
|
65
|
+
export type Middleware = MiddlewareObject | DevServerMiddlewareHandler | ErrorHandleFunction;
|
|
116
66
|
export type OverlayMessageOptions = boolean | ((error: Error) => void);
|
|
117
67
|
declare function useFn(fn: NextHandleFunction): BasicApplication;
|
|
118
68
|
declare function useFn(fn: HandleFunction): BasicApplication;
|
|
@@ -121,10 +71,3 @@ declare function useFn(route: string, fn: HandleFunction): BasicApplication;
|
|
|
121
71
|
export type BasicApplication = {
|
|
122
72
|
use: typeof useFn;
|
|
123
73
|
};
|
|
124
|
-
export type OpenOptions = {
|
|
125
|
-
readonly wait?: boolean;
|
|
126
|
-
readonly background?: boolean;
|
|
127
|
-
readonly newInstance?: boolean;
|
|
128
|
-
readonly app?: OpenApp | readonly OpenApp[];
|
|
129
|
-
readonly allowNonzeroExitCode?: boolean;
|
|
130
|
-
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/dev-server",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.7",
|
|
4
4
|
"description": "Development server for rspack",
|
|
5
5
|
"homepage": "https://rspack.rs",
|
|
6
6
|
"bugs": "https://github.com/rstackjs/rspack-dev-server/issues",
|
|
@@ -45,8 +45,7 @@
|
|
|
45
45
|
]
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@
|
|
49
|
-
"@types/serve-static": "^2.2.0",
|
|
48
|
+
"@rspack/dev-middleware": "2.0.0-beta.2",
|
|
50
49
|
"@types/ws": "^8.18.1",
|
|
51
50
|
"chokidar": "^5.0.0",
|
|
52
51
|
"connect-history-api-fallback": "^2.0.0",
|
|
@@ -54,19 +53,18 @@
|
|
|
54
53
|
"http-proxy-middleware": "^3.0.5",
|
|
55
54
|
"ipaddr.js": "^2.3.0",
|
|
56
55
|
"serve-static": "^2.2.1",
|
|
57
|
-
"webpack-dev-middleware": "^7.4.5",
|
|
58
56
|
"ws": "^8.19.0"
|
|
59
57
|
},
|
|
60
58
|
"devDependencies": {
|
|
61
59
|
"@biomejs/biome": "^1.9.4",
|
|
62
60
|
"@hono/node-server": "^1.19.11",
|
|
63
|
-
"@rslib/core": "^0.
|
|
64
|
-
"@rspack/core": "2.0.0-beta.
|
|
61
|
+
"@rslib/core": "^0.20.0",
|
|
62
|
+
"@rspack/core": "2.0.0-beta.6",
|
|
65
63
|
"@rspack/plugin-react-refresh": "1.6.1",
|
|
66
|
-
"@rstest/core": "^0.9.
|
|
64
|
+
"@rstest/core": "^0.9.2",
|
|
67
65
|
"@types/mime-types": "3.0.1",
|
|
68
66
|
"@types/node": "^24.12.0",
|
|
69
|
-
"@types/
|
|
67
|
+
"@types/serve-static": "^2.2.0",
|
|
70
68
|
"@types/trusted-types": "^2.0.7",
|
|
71
69
|
"@types/ws": "8.18.1",
|
|
72
70
|
"cross-env": "^10.1.0",
|
|
@@ -80,14 +78,13 @@
|
|
|
80
78
|
"open": "^11.0.0",
|
|
81
79
|
"p-retry": "^7.1.1",
|
|
82
80
|
"prettier": "3.8.1",
|
|
83
|
-
"puppeteer": "^24.
|
|
81
|
+
"puppeteer": "^24.39.0",
|
|
84
82
|
"react-refresh": "0.18.0",
|
|
85
83
|
"require-from-string": "^2.0.2",
|
|
86
84
|
"selfsigned": "^5.5.0",
|
|
87
85
|
"simple-git-hooks": "^2.13.1",
|
|
88
86
|
"style-loader": "^4.0.0",
|
|
89
|
-
"typescript": "^5.9.3"
|
|
90
|
-
"webpack-dev-middleware": "^7.4.5"
|
|
87
|
+
"typescript": "^5.9.3"
|
|
91
88
|
},
|
|
92
89
|
"peerDependencies": {
|
|
93
90
|
"@rspack/core": "^2.0.0-0",
|
|
@@ -98,7 +95,7 @@
|
|
|
98
95
|
"optional": true
|
|
99
96
|
}
|
|
100
97
|
},
|
|
101
|
-
"packageManager": "pnpm@10.
|
|
98
|
+
"packageManager": "pnpm@10.32.1",
|
|
102
99
|
"engines": {
|
|
103
100
|
"node": "^20.19.0 || >=22.12.0"
|
|
104
101
|
},
|