@rspack/dev-server 1.2.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 +17 -17
- 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 +243 -292
- 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 +98 -145
- package/client/utils/log.d.ts +13 -0
- package/client/utils/log.js +7 -17
- package/{dist/servers/SockJSServer.d.ts → client/utils/sendMessage.d.ts} +2 -1
- 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/config.d.ts +1 -3
- 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 -18
- package/dist/servers/WebsocketServer.d.ts +8 -1
- package/dist/types.d.ts +14 -29
- package/package.json +74 -103
- package/client/clients/SockJSClient.js +0 -34
- package/client/modules/sockjs-client/index.js +0 -4506
- package/dist/config.js +0 -2
- package/dist/getPort.js +0 -131
- package/dist/options.json +0 -1034
- package/dist/server.js +0 -2222
- package/dist/servers/BaseServer.js +0 -20
- package/dist/servers/SockJSServer.js +0 -110
- package/dist/servers/WebsocketServer.js +0 -72
- package/dist/types.js +0 -5
package/dist/config.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import type { BonjourOptions, ClientConfiguration, ConnectHistoryApiFallbackOptions, DevServer, NormalizedStatic, Open, ServerConfiguration, WatchFiles, WebSocketServerConfiguration } from './types';
|
|
1
|
+
import type { ClientConfiguration, ConnectHistoryApiFallbackOptions, DevServer, NormalizedStatic, Open, ServerConfiguration, WatchFiles, WebSocketServerConfiguration } from './types';
|
|
3
2
|
export interface ResolvedDevServer extends DevServer {
|
|
4
3
|
port: number | string;
|
|
5
4
|
static: false | Array<NormalizedStatic>;
|
|
@@ -13,7 +12,6 @@ export interface ResolvedDevServer extends DevServer {
|
|
|
13
12
|
proxy: Required<DevServer['proxy']>;
|
|
14
13
|
client: ClientConfiguration;
|
|
15
14
|
allowedHosts: 'auto' | string[] | 'all';
|
|
16
|
-
bonjour: false | Record<string, never> | BonjourOptions;
|
|
17
15
|
compress: boolean;
|
|
18
16
|
historyApiFallback: false | ConnectHistoryApiFallbackOptions;
|
|
19
17
|
server: ServerConfiguration;
|
package/dist/getPort.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RspackDevServer = void 0;
|
|
4
|
-
var server_1 = require("./server");
|
|
5
|
-
Object.defineProperty(exports, "RspackDevServer", { enumerable: true, get: function () { return server_1.Server; } });
|
|
1
|
+
export { RspackDevServer } from "./131.js";
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var __webpack_modules__ = {};
|
|
2
|
+
var __webpack_module_cache__ = {};
|
|
3
|
+
function __webpack_require__(moduleId) {
|
|
4
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
5
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
6
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
7
|
+
exports: {}
|
|
8
|
+
};
|
|
9
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
10
|
+
return module.exports;
|
|
11
|
+
}
|
|
12
|
+
__webpack_require__.m = __webpack_modules__;
|
|
13
|
+
(()=>{
|
|
14
|
+
__webpack_require__.add = function(modules) {
|
|
15
|
+
Object.assign(__webpack_require__.m, modules);
|
|
16
|
+
};
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
var getProto = Object.getPrototypeOf ? (obj)=>Object.getPrototypeOf(obj) : (obj)=>obj.__proto__;
|
|
20
|
+
var leafPrototypes;
|
|
21
|
+
__webpack_require__.t = function(value, mode) {
|
|
22
|
+
if (1 & mode) value = this(value);
|
|
23
|
+
if (8 & mode) return value;
|
|
24
|
+
if ('object' == typeof value && value) {
|
|
25
|
+
if (4 & mode && value.__esModule) return value;
|
|
26
|
+
if (16 & mode && 'function' == typeof value.then) return value;
|
|
27
|
+
}
|
|
28
|
+
var ns = Object.create(null);
|
|
29
|
+
__webpack_require__.r(ns);
|
|
30
|
+
var def = {};
|
|
31
|
+
leafPrototypes = leafPrototypes || [
|
|
32
|
+
null,
|
|
33
|
+
getProto({}),
|
|
34
|
+
getProto([]),
|
|
35
|
+
getProto(getProto)
|
|
36
|
+
];
|
|
37
|
+
for(var current = 2 & mode && value; ('object' == typeof current || 'function' == typeof current) && !~leafPrototypes.indexOf(current); current = getProto(current))Object.getOwnPropertyNames(current).forEach((key)=>{
|
|
38
|
+
def[key] = ()=>value[key];
|
|
39
|
+
});
|
|
40
|
+
def['default'] = ()=>value;
|
|
41
|
+
__webpack_require__.d(ns, def);
|
|
42
|
+
return ns;
|
|
43
|
+
};
|
|
44
|
+
})();
|
|
45
|
+
(()=>{
|
|
46
|
+
__webpack_require__.d = (exports, definition)=>{
|
|
47
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: definition[key]
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
})();
|
|
53
|
+
(()=>{
|
|
54
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
55
|
+
})();
|
|
56
|
+
(()=>{
|
|
57
|
+
__webpack_require__.r = (exports)=>{
|
|
58
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
|
|
59
|
+
value: 'Module'
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(exports, '__esModule', {
|
|
62
|
+
value: true
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
})();
|
|
66
|
+
export { __webpack_require__ };
|
package/dist/server.d.ts
CHANGED
|
@@ -7,11 +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
|
-
|
|
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';
|
|
10
|
+
import type { BasicApplication, ClientConfiguration, ClientConnection, Compiler, ConnectHistoryApiFallbackOptions, DevMiddlewareContext, DevMiddlewareOptions, DevServer, EXPECTED_ANY, ExpressApplication, FSWatcher, HTTPServer, Headers, Host, LiteralUnion, Middleware, MultiCompiler, MultiStats, NextFunction, Open, Port, ProxyConfigArray, Request, RequestHandler, Response, ServerConfiguration, ServerType, Socket, Static, Stats, StatsCompilation, StatsOptions, WatchFiles, WatchOptions, WebSocketServerConfiguration, WebSocketServerImplementation } from './types';
|
|
15
11
|
export interface Configuration<A extends BasicApplication = ExpressApplication, S extends HTTPServer = HTTPServer> {
|
|
16
12
|
ipc?: boolean | string;
|
|
17
13
|
host?: Host;
|
|
@@ -20,14 +16,13 @@ export interface Configuration<A extends BasicApplication = ExpressApplication,
|
|
|
20
16
|
liveReload?: boolean;
|
|
21
17
|
devMiddleware?: DevMiddlewareOptions<Request, Response>;
|
|
22
18
|
compress?: boolean;
|
|
23
|
-
allowedHosts?: 'auto' | 'all'
|
|
19
|
+
allowedHosts?: LiteralUnion<'auto' | 'all', string> | string[];
|
|
24
20
|
historyApiFallback?: boolean | ConnectHistoryApiFallbackOptions;
|
|
25
|
-
bonjour?: boolean | Record<string, never> | BonjourOptions;
|
|
26
21
|
watchFiles?: string | string[] | WatchFiles | Array<string | WatchFiles>;
|
|
27
22
|
static?: boolean | string | Static | Array<string | Static>;
|
|
28
23
|
server?: ServerType<A, S> | ServerConfiguration<A, S>;
|
|
29
24
|
app?: () => Promise<A>;
|
|
30
|
-
webSocketServer?: boolean | '
|
|
25
|
+
webSocketServer?: boolean | LiteralUnion<'ws', string> | WebSocketServerConfiguration;
|
|
31
26
|
proxy?: ProxyConfigArray;
|
|
32
27
|
open?: boolean | string | Open | Array<string | Open>;
|
|
33
28
|
setupExitSignals?: boolean;
|
|
@@ -49,36 +44,32 @@ declare class Server<A extends BasicApplication = ExpressApplication, S extends
|
|
|
49
44
|
sockets: Socket[];
|
|
50
45
|
currentHash: string | undefined;
|
|
51
46
|
isTlsServer: boolean;
|
|
52
|
-
bonjour: Bonjour | undefined;
|
|
53
47
|
webSocketServer: WebSocketServerImplementation | null | undefined;
|
|
54
48
|
middleware: import('webpack-dev-middleware').API<Request, Response> | undefined;
|
|
55
49
|
server: S | undefined;
|
|
56
50
|
app: A | undefined;
|
|
57
51
|
stats: Stats | MultiStats | undefined;
|
|
58
52
|
constructor(options: DevServer, compiler: Compiler | MultiCompiler);
|
|
59
|
-
static get schema(): Schema;
|
|
60
53
|
static get DEFAULT_STATS(): StatsOptions;
|
|
61
54
|
static isAbsoluteURL(URL: string): boolean;
|
|
62
55
|
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
56
|
static getHostname(hostname: Host): Promise<string>;
|
|
66
|
-
static getFreePort(port: string, host: string): Promise<
|
|
57
|
+
static getFreePort(port: string, host: string): Promise<string | number>;
|
|
67
58
|
static findCacheDir(): string;
|
|
68
|
-
static isWebTarget(compiler: Compiler): boolean;
|
|
69
59
|
addAdditionalEntries(compiler: Compiler): void;
|
|
70
60
|
/**
|
|
71
61
|
* @private
|
|
72
62
|
* @returns {Compiler["options"]} compiler options
|
|
73
63
|
*/
|
|
74
64
|
getCompilerOptions(): import("@rspack/core").RspackOptionsNormalized;
|
|
65
|
+
shouldLogInfrastructureInfo(): boolean;
|
|
75
66
|
normalizeOptions(): Promise<void>;
|
|
76
67
|
/**
|
|
77
68
|
* @private
|
|
78
69
|
* @returns {string} client transport
|
|
79
70
|
*/
|
|
80
71
|
getClientTransport(): string;
|
|
81
|
-
getServerTransport():
|
|
72
|
+
getServerTransport(): unknown;
|
|
82
73
|
getClientEntry(): string;
|
|
83
74
|
getClientHotEntry(): string | undefined;
|
|
84
75
|
setupProgressPlugin(): void;
|
|
@@ -92,7 +83,7 @@ declare class Server<A extends BasicApplication = ExpressApplication, S extends
|
|
|
92
83
|
setupHooks(): void;
|
|
93
84
|
setupWatchStaticFiles(): void;
|
|
94
85
|
setupWatchFiles(): void;
|
|
95
|
-
setupMiddlewares(): void
|
|
86
|
+
setupMiddlewares(): Promise<void>;
|
|
96
87
|
/**
|
|
97
88
|
* @private
|
|
98
89
|
* @returns {Promise<void>}
|
|
@@ -100,8 +91,6 @@ declare class Server<A extends BasicApplication = ExpressApplication, S extends
|
|
|
100
91
|
createServer(): Promise<void>;
|
|
101
92
|
createWebSocketServer(): void;
|
|
102
93
|
openBrowser(defaultOpenTarget: string): Promise<void>;
|
|
103
|
-
runBonjour(): void;
|
|
104
|
-
stopBonjour(callback?: () => void): void;
|
|
105
94
|
logStatus(): Promise<void>;
|
|
106
95
|
setHeaders(req: Request, res: Response, next: NextFunction): void;
|
|
107
96
|
isHostAllowed(value: string): boolean;
|
|
@@ -7,4 +7,11 @@
|
|
|
7
7
|
* Copyright (c) JS Foundation and other contributors
|
|
8
8
|
* https://github.com/webpack/webpack-dev-server/blob/main/LICENSE
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
import * as Ws from 'ws';
|
|
11
|
+
import type { Server } from '../server';
|
|
12
|
+
import BaseServer from './BaseServer';
|
|
13
|
+
export declare class WebsocketServer extends BaseServer {
|
|
14
|
+
static heartbeatInterval: number;
|
|
15
|
+
implementation: Ws.WebSocketServer;
|
|
16
|
+
constructor(server: Server);
|
|
17
|
+
}
|
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,31 +13,24 @@ 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';
|
|
23
19
|
export type EXPECTED_ANY = any;
|
|
20
|
+
/** https://github.com/microsoft/TypeScript/issues/29729 */
|
|
21
|
+
export type LiteralUnion<T extends U, U> = T | (U & Record<never, never>);
|
|
24
22
|
export type NextFunction = (err?: EXPECTED_ANY) => void;
|
|
25
23
|
export type SimpleHandleFunction = (req: IncomingMessage, res: ServerResponse) => void;
|
|
26
24
|
export type NextHandleFunction = (req: IncomingMessage, res: ServerResponse, next: NextFunction) => void;
|
|
27
25
|
export type ErrorHandleFunction = (err: EXPECTED_ANY, req: IncomingMessage, res: ServerResponse, next: NextFunction) => void;
|
|
28
26
|
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
|
-
};
|
|
27
|
+
export type ServerOptions = import('https').ServerOptions;
|
|
38
28
|
export type Request<T extends BasicApplication = ExpressApplication> = T extends ExpressApplication ? ExpressRequest : IncomingMessage;
|
|
39
29
|
export type Response<T extends BasicApplication = ExpressApplication> = T extends ExpressApplication ? ExpressResponse : ServerResponse;
|
|
40
30
|
export type DevMiddlewareOptions<T extends Request, U extends Response> = import('webpack-dev-middleware').Options<T, U>;
|
|
41
31
|
export type DevMiddlewareContext<T extends Request, U extends Response> = import('webpack-dev-middleware').Context<T, U>;
|
|
42
|
-
export type Host = 'local-ip' | 'local-ipv4' | 'local-ipv6'
|
|
43
|
-
export type Port = number |
|
|
32
|
+
export type Host = LiteralUnion<'local-ip' | 'local-ipv4' | 'local-ipv6', string>;
|
|
33
|
+
export type Port = number | LiteralUnion<'auto', string>;
|
|
44
34
|
export interface WatchFiles {
|
|
45
35
|
paths: string | string[];
|
|
46
36
|
options?: WatchOptions & {
|
|
@@ -67,34 +57,29 @@ export interface NormalizedStatic {
|
|
|
67
57
|
staticOptions: ServeStaticOptions;
|
|
68
58
|
watch: false | WatchOptions;
|
|
69
59
|
}
|
|
70
|
-
export type ServerType<A extends BasicApplication = ExpressApplication, S extends import('http').Server = import('http').Server> = 'http' | 'https' | '
|
|
60
|
+
export type ServerType<A extends BasicApplication = ExpressApplication, S extends import('http').Server = import('http').Server> = LiteralUnion<'http' | 'https' | 'http2', string> | ((serverOptions: ServerOptions, application: A) => S);
|
|
71
61
|
export interface ServerConfiguration<A extends BasicApplication = ExpressApplication, S extends import('http').Server = import('http').Server> {
|
|
72
62
|
type?: ServerType<A, S>;
|
|
73
63
|
options?: ServerOptions;
|
|
74
64
|
}
|
|
75
65
|
export interface WebSocketServerConfiguration {
|
|
76
|
-
type?: '
|
|
66
|
+
type?: LiteralUnion<'ws', string> | (() => WebSocketServerConfiguration);
|
|
77
67
|
options?: Record<string, EXPECTED_ANY>;
|
|
78
68
|
}
|
|
79
|
-
export type ClientConnection =
|
|
80
|
-
send: import('ws').WebSocket['send'];
|
|
81
|
-
terminate: import('ws').WebSocket['terminate'];
|
|
82
|
-
ping: import('ws').WebSocket['ping'];
|
|
83
|
-
})) & {
|
|
69
|
+
export type ClientConnection = import('ws').WebSocket & {
|
|
84
70
|
isAlive?: boolean;
|
|
85
71
|
};
|
|
86
|
-
export type WebSocketServer = import('ws').WebSocketServer
|
|
87
|
-
close: import('ws').WebSocketServer['close'];
|
|
88
|
-
});
|
|
72
|
+
export type WebSocketServer = import('ws').WebSocketServer;
|
|
89
73
|
export interface WebSocketServerImplementation {
|
|
90
74
|
implementation: WebSocketServer;
|
|
91
75
|
clients: ClientConnection[];
|
|
92
76
|
}
|
|
93
|
-
export type ByPass<Req = Request, Res = Response, ProxyConfig = ProxyConfigArrayItem> = (req: Req, res: Res, proxyConfig: ProxyConfig) => void;
|
|
94
77
|
export type ProxyConfigArrayItem = {
|
|
95
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Alias for `pathFilter` in `http-proxy-middleware` options.
|
|
80
|
+
* When both `context` and `pathFilter` are provided, `pathFilter` takes precedence.
|
|
81
|
+
*/
|
|
96
82
|
context?: HttpProxyMiddlewareOptionsFilter;
|
|
97
|
-
bypass?: ByPass;
|
|
98
83
|
} & HttpProxyMiddlewareOptions;
|
|
99
84
|
export type ProxyConfigArray = Array<ProxyConfigArrayItem | ((req?: Request | undefined, res?: Response | undefined, next?: NextFunction | undefined) => ProxyConfigArrayItem)>;
|
|
100
85
|
export interface OpenApp {
|
|
@@ -126,7 +111,7 @@ export interface ClientConfiguration {
|
|
|
126
111
|
};
|
|
127
112
|
progress?: boolean;
|
|
128
113
|
reconnect?: boolean | number;
|
|
129
|
-
webSocketTransport?: 'ws'
|
|
114
|
+
webSocketTransport?: LiteralUnion<'ws', string>;
|
|
130
115
|
webSocketURL?: string | WebSocketURL;
|
|
131
116
|
}
|
|
132
117
|
export type Headers = Array<{
|
package/package.json
CHANGED
|
@@ -1,38 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/dev-server",
|
|
3
|
-
"version": "
|
|
4
|
-
"license": "MIT",
|
|
3
|
+
"version": "2.0.0-beta.2",
|
|
5
4
|
"description": "Development server for rspack",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
5
|
+
"homepage": "https://rspack.rs",
|
|
6
|
+
"bugs": "https://github.com/rstackjs/rspack-dev-server/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/rstackjs/rspack-dev-server"
|
|
11
10
|
},
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"type": "module",
|
|
12
13
|
"exports": {
|
|
13
|
-
".":
|
|
14
|
-
"default": "./dist/index.js"
|
|
15
|
-
},
|
|
16
|
-
"./getPort": "./getPort.js",
|
|
17
|
-
"./servers/*": "./servers/*.js",
|
|
18
|
-
"./servers/*.js": "./servers/*.js",
|
|
19
|
-
"./client/*": "./client/*.js",
|
|
14
|
+
".": "./dist/index.js",
|
|
20
15
|
"./client/*.js": "./client/*.js",
|
|
16
|
+
"./client/*": "./client/*.js",
|
|
21
17
|
"./package.json": "./package.json"
|
|
22
18
|
},
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"client"
|
|
23
|
+
],
|
|
23
24
|
"scripts": {
|
|
24
|
-
"build": "
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"dev": "tsc -b -w",
|
|
25
|
+
"build": "rslib",
|
|
26
|
+
"bump": "npx bumpp",
|
|
27
|
+
"dev": "rslib -w",
|
|
28
|
+
"format": "prettier --write .",
|
|
29
29
|
"lint": "biome check .",
|
|
30
30
|
"lint:write": "biome check . --write",
|
|
31
|
-
"format": "prettier --write .",
|
|
32
31
|
"prettier:ci": "prettier --check .",
|
|
33
|
-
"test
|
|
34
|
-
"test": "
|
|
35
|
-
"bump": "npx bumpp"
|
|
32
|
+
"test": "pnpm run test:install && pnpm run build && rstest",
|
|
33
|
+
"test:install": "cross-env ./node_modules/.bin/puppeteer browsers install chrome"
|
|
36
34
|
},
|
|
37
35
|
"simple-git-hooks": {
|
|
38
36
|
"pre-commit": "npx nano-staged"
|
|
@@ -46,96 +44,69 @@
|
|
|
46
44
|
"biome lint --write --no-errors-on-unmatched"
|
|
47
45
|
]
|
|
48
46
|
},
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"
|
|
61
|
-
"
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@types/connect-history-api-fallback": "^1.5.4",
|
|
49
|
+
"@types/serve-index": "^1.9.4",
|
|
50
|
+
"@types/serve-static": "^2.2.0",
|
|
51
|
+
"@types/ws": "^8.18.1",
|
|
52
|
+
"chokidar": "^3.6.0",
|
|
53
|
+
"connect-history-api-fallback": "^2.0.0",
|
|
54
|
+
"express": "^5.2.1",
|
|
55
|
+
"http-proxy-middleware": "^3.0.5",
|
|
56
|
+
"ipaddr.js": "^2.3.0",
|
|
57
|
+
"serve-index": "^1.9.2",
|
|
58
|
+
"webpack-dev-middleware": "^7.4.5",
|
|
59
|
+
"ws": "^8.19.0"
|
|
62
60
|
},
|
|
63
61
|
"devDependencies": {
|
|
64
|
-
"@biomejs/biome": "^1.
|
|
65
|
-
"@
|
|
66
|
-
"@
|
|
67
|
-
"@rspack/core": "
|
|
68
|
-
"@rspack/plugin-react-refresh": "1.
|
|
62
|
+
"@biomejs/biome": "^1.9.4",
|
|
63
|
+
"@hono/node-server": "^1.19.9",
|
|
64
|
+
"@rslib/core": "^0.19.6",
|
|
65
|
+
"@rspack/core": "2.0.0-beta.5",
|
|
66
|
+
"@rspack/plugin-react-refresh": "1.6.1",
|
|
67
|
+
"@rstest/core": "^0.8.5",
|
|
68
|
+
"@types/compression": "^1.8.1",
|
|
69
69
|
"@types/express": "5.0.6",
|
|
70
|
-
"@types/jest": "29.5.12",
|
|
71
70
|
"@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",
|
|
71
|
+
"@types/node": "^24.11.0",
|
|
72
|
+
"@types/node-forge": "^1.3.14",
|
|
78
73
|
"@types/trusted-types": "^2.0.7",
|
|
79
|
-
"@
|
|
80
|
-
"
|
|
81
|
-
"css-loader": "^7.1.2",
|
|
74
|
+
"@types/ws": "8.18.1",
|
|
75
|
+
"compression": "^1.8.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
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"puppeteer": "^24.34.0",
|
|
93
|
-
"react-refresh": "0.14.0",
|
|
81
|
+
"launch-editor": "^2.13.1",
|
|
82
|
+
"nano-staged": "^0.9.0",
|
|
83
|
+
"open": "^11.0.0",
|
|
84
|
+
"p-retry": "^7.1.1",
|
|
85
|
+
"prettier": "3.8.1",
|
|
86
|
+
"puppeteer": "^24.37.5",
|
|
87
|
+
"react-refresh": "0.18.0",
|
|
94
88
|
"require-from-string": "^2.0.2",
|
|
95
|
-
"
|
|
96
|
-
"
|
|
89
|
+
"selfsigned": "^5.5.0",
|
|
90
|
+
"simple-git-hooks": "^2.13.1",
|
|
97
91
|
"style-loader": "^4.0.0",
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"ts-jest": "29.1.2",
|
|
101
|
-
"typescript": "5.0.2",
|
|
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"
|
|
107
|
-
},
|
|
108
|
-
"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
|
-
"@types/connect-history-api-fallback": "^1.5.4",
|
|
115
|
-
"@types/express": "^4.17.25",
|
|
116
|
-
"@types/express-serve-static-core": "^4.17.21",
|
|
117
|
-
"@types/serve-index": "^1.9.4",
|
|
118
|
-
"@types/serve-static": "^1.15.5",
|
|
119
|
-
"@types/sockjs": "^0.3.36",
|
|
120
|
-
"@types/ws": "^8.5.10",
|
|
121
|
-
"ansi-html-community": "^0.0.8",
|
|
122
|
-
"bonjour-service": "^1.2.1",
|
|
123
|
-
"colorette": "^2.0.10",
|
|
124
|
-
"compression": "^1.8.1",
|
|
125
|
-
"connect-history-api-fallback": "^2.0.0",
|
|
126
|
-
"express": "^4.22.1",
|
|
127
|
-
"graceful-fs": "^4.2.6",
|
|
128
|
-
"ipaddr.js": "^2.1.0",
|
|
129
|
-
"launch-editor": "^2.6.1",
|
|
130
|
-
"open": "^10.0.3",
|
|
131
|
-
"schema-utils": "^4.2.0",
|
|
132
|
-
"selfsigned": "^2.4.1",
|
|
133
|
-
"serve-index": "^1.9.1",
|
|
134
|
-
"sockjs": "^0.3.24",
|
|
135
|
-
"spdy": "^4.0.2",
|
|
136
|
-
"webpack-dev-middleware": "^7.4.2"
|
|
92
|
+
"typescript": "^5.9.3",
|
|
93
|
+
"webpack-dev-middleware": "^7.4.5"
|
|
137
94
|
},
|
|
138
95
|
"peerDependencies": {
|
|
139
|
-
"@rspack/core": "
|
|
96
|
+
"@rspack/core": "^2.0.0-0",
|
|
97
|
+
"selfsigned": "^5.0.0"
|
|
98
|
+
},
|
|
99
|
+
"peerDependenciesMeta": {
|
|
100
|
+
"selfsigned": {
|
|
101
|
+
"optional": true
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"packageManager": "pnpm@10.30.3",
|
|
105
|
+
"engines": {
|
|
106
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
107
|
+
},
|
|
108
|
+
"publishConfig": {
|
|
109
|
+
"access": "public",
|
|
110
|
+
"registry": "https://registry.npmjs.org/"
|
|
140
111
|
}
|
|
141
112
|
}
|
|
@@ -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;
|