@rspack/dev-server 2.0.0-beta.5 → 2.0.0-beta.6

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.
@@ -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 { BasicApplication, BasicServer, ClientConfiguration, ClientConnection, Compiler, ConnectHistoryApiFallbackOptions, DevMiddlewareContext, DevMiddlewareOptions, DevServer, EXPECTED_ANY, FSWatcher, HTTPServer, Headers, Host, LiteralUnion, Middleware, MultiCompiler, MultiStats, Open, Port, ProxyConfigArray, Request, RequestHandler, Response, ServerConfiguration, ServerType, Socket, Static, Stats, StatsOptions, WatchFiles, WatchOptions, WebSocketServerConfiguration, WebSocketServerImplementation } from './types';
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?: 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?: boolean | string | Static | Array<string | 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?: ProxyConfigArray;
28
+ proxy?: DevServerProxyConfigArray;
28
29
  open?: boolean | string | Open | Array<string | Open>;
29
30
  setupExitSignals?: boolean;
30
- client?: boolean | ClientConfiguration;
31
- headers?: Headers | ((req: Request, res: Response, context: DevMiddlewareContext<Request, Response> | undefined) => 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
  }
@@ -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: Host): Promise<string>;
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;
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 { Options as ConnectHistoryApiFallbackOptions } from 'connect-history-api-fallback';
5
- import type { Server as ConnectApplication, IncomingMessage as ConnectIncomingMessage } from 'connect-next';
6
- import type { Options as HttpProxyMiddlewareOptions, Filter as HttpProxyMiddlewareOptionsFilter, RequestHandler } from 'http-proxy-middleware';
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 NextFunction = (err?: EXPECTED_ANY) => void;
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
20
  export type DevMiddlewareOptions<T extends Request, U extends Response> = import('webpack-dev-middleware').Options<T, U>;
26
21
  export type DevMiddlewareContext<T extends Request, U extends Response> = import('webpack-dev-middleware').Context<T, U>;
27
- export type Host = LiteralUnion<'local-ip' | 'local-ipv4' | 'local-ipv6', string>;
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: ServeStaticOptions;
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 ProxyConfigArrayItem = {
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: OpenOptions;
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: MiddlewareHandler;
63
+ middleware: DevServerMiddlewareHandler | ErrorHandleFunction;
114
64
  }
115
- export type Middleware = MiddlewareObject | MiddlewareHandler;
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.5",
3
+ "version": "2.0.0-beta.6",
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,6 @@
45
45
  ]
46
46
  },
47
47
  "dependencies": {
48
- "@types/connect-history-api-fallback": "^1.5.4",
49
- "@types/serve-static": "^2.2.0",
50
48
  "@types/ws": "^8.18.1",
51
49
  "chokidar": "^5.0.0",
52
50
  "connect-history-api-fallback": "^2.0.0",
@@ -60,13 +58,13 @@
60
58
  "devDependencies": {
61
59
  "@biomejs/biome": "^1.9.4",
62
60
  "@hono/node-server": "^1.19.11",
63
- "@rslib/core": "^0.19.6",
64
- "@rspack/core": "2.0.0-beta.5",
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.0",
64
+ "@rstest/core": "^0.9.2",
67
65
  "@types/mime-types": "3.0.1",
68
66
  "@types/node": "^24.12.0",
69
- "@types/node-forge": "^1.3.14",
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,7 +78,7 @@
80
78
  "open": "^11.0.0",
81
79
  "p-retry": "^7.1.1",
82
80
  "prettier": "3.8.1",
83
- "puppeteer": "^24.38.0",
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",
@@ -98,7 +96,7 @@
98
96
  "optional": true
99
97
  }
100
98
  },
101
- "packageManager": "pnpm@10.31.0",
99
+ "packageManager": "pnpm@10.32.1",
102
100
  "engines": {
103
101
  "node": "^20.19.0 || >=22.12.0"
104
102
  },