@rspack/dev-server 1.1.4 → 1.2.0
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 +14 -17
- package/client/clients/SockJSClient.js +34 -0
- package/client/clients/WebSocketClient.js +32 -0
- package/client/index.js +131 -214
- package/client/modules/logger/index.js +725 -0
- package/client/modules/sockjs-client/index.js +4506 -0
- package/client/overlay.js +503 -0
- package/client/progress.js +130 -0
- package/client/socket.js +60 -0
- package/client/utils/ansiHTML.js +63 -64
- package/client/utils/log.js +21 -0
- package/client/utils/sendMessage.js +17 -0
- package/dist/config.d.ts +14 -15
- package/dist/getPort.d.ts +10 -0
- package/dist/getPort.js +131 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -1
- package/dist/options.json +1034 -0
- package/dist/server.d.ts +106 -23
- package/dist/server.js +2195 -46
- package/dist/servers/BaseServer.d.ts +17 -0
- package/dist/servers/BaseServer.js +20 -0
- package/dist/servers/SockJSServer.d.ts +10 -0
- package/dist/servers/SockJSServer.js +110 -0
- package/dist/servers/WebsocketServer.d.ts +10 -0
- package/dist/servers/WebsocketServer.js +72 -0
- package/dist/types.d.ts +158 -0
- package/dist/types.js +5 -0
- package/package.json +66 -29
- package/dist/patch.d.ts +0 -3
- package/dist/patch.js +0 -32
package/dist/server.d.ts
CHANGED
|
@@ -1,36 +1,119 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
1
|
/**
|
|
4
2
|
* The following code is modified based on
|
|
5
|
-
* https://github.com/webpack/webpack-dev-server
|
|
3
|
+
* https://github.com/webpack/webpack-dev-server
|
|
6
4
|
*
|
|
7
5
|
* MIT Licensed
|
|
8
6
|
* Author Tobias Koppers @sokra
|
|
9
7
|
* Copyright (c) JS Foundation and other contributors
|
|
10
|
-
* https://github.com/webpack/webpack-dev-server/blob/
|
|
8
|
+
* https://github.com/webpack/webpack-dev-server/blob/main/LICENSE
|
|
11
9
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
10
|
+
/// <reference types="express" />
|
|
11
|
+
/// <reference types="node" />
|
|
12
|
+
/// <reference types="connect-history-api-fallback" />
|
|
13
|
+
/// <reference types="node" />
|
|
14
|
+
import type { BasicApplication, ExpressApplication, HTTPServer, Response, Request, Host, Port, DevMiddlewareOptions, ConnectHistoryApiFallbackOptions, BonjourOptions, WatchFiles, Static, ServerType, ServerConfiguration, WebSocketServerConfiguration, ProxyConfigArray, Open, ClientConfiguration, Middleware, DevMiddlewareContext, Compiler, MultiCompiler, FSWatcher, EXPECTED_ANY, RequestHandler, Socket, Bonjour, WebSocketServerImplementation, Stats, MultiStats, DevServer, Schema, StatsOptions, WatchOptions, StatsCompilation, NextFunction, ClientConnection, Headers } from './types';
|
|
15
|
+
export interface Configuration<A extends BasicApplication = ExpressApplication, S extends HTTPServer = HTTPServer> {
|
|
16
|
+
ipc?: boolean | string;
|
|
17
|
+
host?: Host;
|
|
18
|
+
port?: Port;
|
|
19
|
+
hot?: boolean | 'only';
|
|
20
|
+
liveReload?: boolean;
|
|
21
|
+
devMiddleware?: DevMiddlewareOptions<Request, Response>;
|
|
22
|
+
compress?: boolean;
|
|
23
|
+
allowedHosts?: 'auto' | 'all' | string | string[];
|
|
24
|
+
historyApiFallback?: boolean | ConnectHistoryApiFallbackOptions;
|
|
25
|
+
bonjour?: boolean | Record<string, never> | BonjourOptions;
|
|
26
|
+
watchFiles?: string | string[] | WatchFiles | Array<string | WatchFiles>;
|
|
27
|
+
static?: boolean | string | Static | Array<string | Static>;
|
|
28
|
+
server?: ServerType<A, S> | ServerConfiguration<A, S>;
|
|
29
|
+
app?: () => Promise<A>;
|
|
30
|
+
webSocketServer?: boolean | 'sockjs' | 'ws' | string | WebSocketServerConfiguration;
|
|
31
|
+
proxy?: ProxyConfigArray;
|
|
32
|
+
open?: boolean | string | Open | Array<string | Open>;
|
|
33
|
+
setupExitSignals?: boolean;
|
|
34
|
+
client?: boolean | ClientConfiguration;
|
|
35
|
+
headers?: Headers | ((req: Request, res: Response, context: DevMiddlewareContext<Request, Response> | undefined) => Headers);
|
|
36
|
+
onListening?: (devServer: Server<A, S>) => void;
|
|
37
|
+
setupMiddlewares?: (middlewares: Middleware[], devServer: Server<A, S>) => Middleware[];
|
|
38
|
+
}
|
|
39
|
+
declare class Server<A extends BasicApplication = ExpressApplication, S extends import('http').Server = HTTPServer> {
|
|
40
|
+
compiler: Compiler | MultiCompiler;
|
|
41
|
+
logger: ReturnType<Compiler['getInfrastructureLogger']>;
|
|
42
|
+
options: Configuration<A, S>;
|
|
25
43
|
staticWatchers: FSWatcher[];
|
|
44
|
+
listeners: {
|
|
45
|
+
name: string | symbol;
|
|
46
|
+
listener: (...args: EXPECTED_ANY[]) => void;
|
|
47
|
+
}[];
|
|
48
|
+
webSocketProxies: RequestHandler[];
|
|
26
49
|
sockets: Socket[];
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
webSocketServer:
|
|
31
|
-
|
|
50
|
+
currentHash: string | undefined;
|
|
51
|
+
isTlsServer: boolean;
|
|
52
|
+
bonjour: Bonjour | undefined;
|
|
53
|
+
webSocketServer: WebSocketServerImplementation | null | undefined;
|
|
54
|
+
middleware: import('webpack-dev-middleware').API<Request, Response> | undefined;
|
|
55
|
+
server: S | undefined;
|
|
56
|
+
app: A | undefined;
|
|
57
|
+
stats: Stats | MultiStats | undefined;
|
|
32
58
|
constructor(options: DevServer, compiler: Compiler | MultiCompiler);
|
|
33
|
-
|
|
59
|
+
static get schema(): Schema;
|
|
60
|
+
static get DEFAULT_STATS(): StatsOptions;
|
|
61
|
+
static isAbsoluteURL(URL: string): boolean;
|
|
62
|
+
static findIp(gatewayOrFamily: string, isInternal: boolean): string | undefined;
|
|
63
|
+
static internalIP(family: 'v4' | 'v6'): Promise<string | undefined>;
|
|
64
|
+
static internalIPSync(family: 'v4' | 'v6'): string | undefined;
|
|
65
|
+
static getHostname(hostname: Host): Promise<string>;
|
|
66
|
+
static getFreePort(port: string, host: string): Promise<any>;
|
|
67
|
+
static findCacheDir(): string;
|
|
68
|
+
static isWebTarget(compiler: Compiler): boolean;
|
|
69
|
+
addAdditionalEntries(compiler: Compiler): void;
|
|
70
|
+
/**
|
|
71
|
+
* @private
|
|
72
|
+
* @returns {Compiler["options"]} compiler options
|
|
73
|
+
*/
|
|
74
|
+
getCompilerOptions(): import("@rspack/core").RspackOptionsNormalized;
|
|
75
|
+
normalizeOptions(): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* @private
|
|
78
|
+
* @returns {string} client transport
|
|
79
|
+
*/
|
|
80
|
+
getClientTransport(): string;
|
|
81
|
+
getServerTransport(): typeof import("./servers/SockJSServer") | typeof import("./servers/WebsocketServer") | undefined;
|
|
34
82
|
getClientEntry(): string;
|
|
35
83
|
getClientHotEntry(): string | undefined;
|
|
84
|
+
setupProgressPlugin(): void;
|
|
85
|
+
/**
|
|
86
|
+
* @private
|
|
87
|
+
* @returns {Promise<void>}
|
|
88
|
+
*/
|
|
89
|
+
initialize(): Promise<void>;
|
|
90
|
+
setupApp(): Promise<void>;
|
|
91
|
+
getStats(statsObj: Stats | MultiStats): StatsCompilation;
|
|
92
|
+
setupHooks(): void;
|
|
93
|
+
setupWatchStaticFiles(): void;
|
|
94
|
+
setupWatchFiles(): void;
|
|
95
|
+
setupMiddlewares(): void;
|
|
96
|
+
/**
|
|
97
|
+
* @private
|
|
98
|
+
* @returns {Promise<void>}
|
|
99
|
+
*/
|
|
100
|
+
createServer(): Promise<void>;
|
|
101
|
+
createWebSocketServer(): void;
|
|
102
|
+
openBrowser(defaultOpenTarget: string): Promise<void>;
|
|
103
|
+
runBonjour(): void;
|
|
104
|
+
stopBonjour(callback?: () => void): void;
|
|
105
|
+
logStatus(): Promise<void>;
|
|
106
|
+
setHeaders(req: Request, res: Response, next: NextFunction): void;
|
|
107
|
+
isHostAllowed(value: string): boolean;
|
|
108
|
+
isValidHost(headers: Record<string, string | undefined>, headerToCheck: string, validateHost?: boolean): boolean;
|
|
109
|
+
isSameOrigin(headers: Record<string, string | undefined>): boolean;
|
|
110
|
+
sendMessage(clients: ClientConnection[], type: string, data?: EXPECTED_ANY, params?: EXPECTED_ANY): void;
|
|
111
|
+
sendStats(clients: ClientConnection[], stats: StatsCompilation, force?: boolean): void;
|
|
112
|
+
watchFiles(watchPath: string | string[], watchOptions?: WatchOptions): void;
|
|
113
|
+
invalidate(callback?: import('webpack-dev-middleware').Callback): void;
|
|
114
|
+
start(): Promise<void>;
|
|
115
|
+
startCallback(callback?: (err?: Error) => void): void;
|
|
116
|
+
stop(): Promise<void>;
|
|
117
|
+
stopCallback(callback?: (err?: Error) => void): void;
|
|
36
118
|
}
|
|
119
|
+
export default Server;
|