@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.
@@ -0,0 +1,17 @@
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 type Server from '../server';
11
+ import type { ClientConnection } from '../types';
12
+ declare class BaseServer {
13
+ server: Server;
14
+ clients: ClientConnection[];
15
+ constructor(server: Server);
16
+ }
17
+ export default BaseServer;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ /**
3
+ * The following code is modified based on
4
+ * https://github.com/webpack/webpack-dev-server
5
+ *
6
+ * MIT Licensed
7
+ * Author Tobias Koppers @sokra
8
+ * Copyright (c) JS Foundation and other contributors
9
+ * https://github.com/webpack/webpack-dev-server/blob/main/LICENSE
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ // base class that users should extend if they are making their own
13
+ // server implementation
14
+ class BaseServer {
15
+ constructor(server) {
16
+ this.server = server;
17
+ this.clients = [];
18
+ }
19
+ }
20
+ exports.default = BaseServer;
@@ -0,0 +1,10 @@
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
+ export {};
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ /**
3
+ * The following code is modified based on
4
+ * https://github.com/webpack/webpack-dev-server
5
+ *
6
+ * MIT Licensed
7
+ * Author Tobias Koppers @sokra
8
+ * Copyright (c) JS Foundation and other contributors
9
+ * https://github.com/webpack/webpack-dev-server/blob/main/LICENSE
10
+ */
11
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ var desc = Object.getOwnPropertyDescriptor(m, k);
14
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
15
+ desc = { enumerable: true, get: function() { return m[k]; } };
16
+ }
17
+ Object.defineProperty(o, k2, desc);
18
+ }) : (function(o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ o[k2] = m[k];
21
+ }));
22
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
23
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
24
+ }) : function(o, v) {
25
+ o["default"] = v;
26
+ });
27
+ var __importStar = (this && this.__importStar) || function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ const sockjs = __importStar(require("sockjs"));
39
+ const BaseServer_1 = __importDefault(require("./BaseServer"));
40
+ // Workaround for sockjs@~0.3.19
41
+ // sockjs will remove Origin header, however Origin header is required for checking host.
42
+ // See https://github.com/webpack/webpack-dev-server/issues/1604 for more information
43
+ {
44
+ const SockjsSession = require('sockjs/lib/transport').Session;
45
+ const { decorateConnection } = SockjsSession.prototype;
46
+ // eslint-disable-next-line func-names
47
+ SockjsSession.prototype.decorateConnection = function (req) {
48
+ decorateConnection.call(this, req);
49
+ const { connection } = this;
50
+ if (connection.headers &&
51
+ !('origin' in connection.headers) &&
52
+ 'origin' in req.headers) {
53
+ connection.headers.origin = req.headers.origin;
54
+ }
55
+ };
56
+ }
57
+ class SockJSServer extends BaseServer_1.default {
58
+ // options has: error (function), debug (function), server (http/s server), path (string)
59
+ constructor(server) {
60
+ super(server);
61
+ const webSocketServerOptions = this.server.options.webSocketServer.options;
62
+ const getSockjsUrl = (options) => {
63
+ if (typeof options.sockjsUrl !== 'undefined') {
64
+ return options.sockjsUrl;
65
+ }
66
+ return '/__webpack_dev_server__/sockjs.bundle.js';
67
+ };
68
+ this.implementation = sockjs.createServer({
69
+ // Use provided up-to-date sockjs-client
70
+ // eslint-disable-next-line camelcase
71
+ sockjs_url: getSockjsUrl(webSocketServerOptions),
72
+ // Default logger is very annoy. Limit useless logs.
73
+ log: (severity, line) => {
74
+ if (severity === 'error') {
75
+ this.server.logger.error(line);
76
+ }
77
+ else if (severity === 'info') {
78
+ this.server.logger.log(line);
79
+ }
80
+ else {
81
+ this.server.logger.debug(line);
82
+ }
83
+ },
84
+ });
85
+ const getPrefix = (options) => {
86
+ if (typeof options.prefix !== 'undefined') {
87
+ return options.prefix;
88
+ }
89
+ return options.path;
90
+ };
91
+ const options = {
92
+ ...webSocketServerOptions,
93
+ prefix: getPrefix(webSocketServerOptions),
94
+ };
95
+ this.implementation.installHandlers(this.server.server, options);
96
+ this.implementation.on('connection', (client) => {
97
+ // Implement the the same API as for `ws`
98
+ client.send = client.write;
99
+ client.terminate = client.close;
100
+ this.clients.push(client);
101
+ client.on('close', () => {
102
+ this.clients.splice(this.clients.indexOf(client), 1);
103
+ });
104
+ });
105
+ this.implementation.close = (callback) => {
106
+ callback();
107
+ };
108
+ }
109
+ }
110
+ module.exports = SockJSServer;
@@ -0,0 +1,10 @@
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
+ export {};
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ /**
3
+ * The following code is modified based on
4
+ * https://github.com/webpack/webpack-dev-server
5
+ *
6
+ * MIT Licensed
7
+ * Author Tobias Koppers @sokra
8
+ * Copyright (c) JS Foundation and other contributors
9
+ * https://github.com/webpack/webpack-dev-server/blob/main/LICENSE
10
+ */
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const ws_1 = __importDefault(require("ws"));
16
+ const BaseServer_1 = __importDefault(require("./BaseServer"));
17
+ class WebsocketServer extends BaseServer_1.default {
18
+ constructor(server) {
19
+ super(server);
20
+ const options = {
21
+ ...this.server.options.webSocketServer
22
+ .options,
23
+ clientTracking: false,
24
+ };
25
+ const isNoServerMode = typeof options.port === 'undefined' &&
26
+ typeof options.server === 'undefined';
27
+ if (isNoServerMode) {
28
+ options.noServer = true;
29
+ }
30
+ this.implementation = new ws_1.default.Server(options);
31
+ this.server.server.on('upgrade', (req, sock, head) => {
32
+ if (!this.implementation.shouldHandle(req)) {
33
+ return;
34
+ }
35
+ this.implementation.handleUpgrade(req, sock, head, (connection) => {
36
+ this.implementation.emit('connection', connection, req);
37
+ });
38
+ });
39
+ this.implementation.on('error', (err) => {
40
+ this.server.logger.error(err.message);
41
+ });
42
+ const interval = setInterval(() => {
43
+ for (const client of this.clients) {
44
+ if (client.isAlive === false) {
45
+ client.terminate();
46
+ continue;
47
+ }
48
+ client.isAlive = false;
49
+ client.ping(() => { });
50
+ }
51
+ }, WebsocketServer.heartbeatInterval);
52
+ this.implementation.on('connection', (client) => {
53
+ this.clients.push(client);
54
+ client.isAlive = true;
55
+ client.on('pong', () => {
56
+ client.isAlive = true;
57
+ });
58
+ client.on('close', () => {
59
+ this.clients.splice(this.clients.indexOf(client), 1);
60
+ });
61
+ // TODO: add a test case for this - https://github.com/webpack/webpack-dev-server/issues/5018
62
+ client.on('error', (err) => {
63
+ this.server.logger.error(err.message);
64
+ });
65
+ });
66
+ this.implementation.on('close', () => {
67
+ clearInterval(interval);
68
+ });
69
+ }
70
+ }
71
+ WebsocketServer.heartbeatInterval = 1000;
72
+ module.exports = WebsocketServer;
@@ -0,0 +1,158 @@
1
+ /// <reference types="node" />
2
+ import type { Server as HTTPServer, IncomingMessage, ServerResponse } from 'node:http';
3
+ export type { HTTPServer, IncomingMessage };
4
+ export type { Socket } from 'node:net';
5
+ export type { AddressInfo } from 'node:net';
6
+ export type { NetworkInterfaceInfo } from 'node:os';
7
+ 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
+ import type { FSWatcher, WatchOptions } from 'chokidar';
11
+ export type { FSWatcher, WatchOptions };
12
+ import type { Options as ConnectHistoryApiFallbackOptions } from 'connect-history-api-fallback';
13
+ export type { ConnectHistoryApiFallbackOptions };
14
+ import type { Application as ExpressApplication, ErrorRequestHandler as ExpressErrorRequestHandler, Request as ExpressRequest, RequestHandler as ExpressRequestHandler, Response as ExpressResponse } from 'express';
15
+ export type { ExpressApplication };
16
+ import type { Options as HttpProxyMiddlewareOptions, Filter as HttpProxyMiddlewareOptionsFilter, RequestHandler } from 'http-proxy-middleware';
17
+ export type { RequestHandler };
18
+ export type { IPv6 } from 'ipaddr.js';
19
+ export type { Schema } from 'schema-utils/declarations/validate';
20
+ import type { Options as ServeIndexOptions } from 'serve-index';
21
+ export type { ServeIndexOptions };
22
+ import type { ServeStaticOptions } from 'serve-static';
23
+ export type EXPECTED_ANY = any;
24
+ export type NextFunction = (err?: EXPECTED_ANY) => void;
25
+ export type SimpleHandleFunction = (req: IncomingMessage, res: ServerResponse) => void;
26
+ export type NextHandleFunction = (req: IncomingMessage, res: ServerResponse, next: NextFunction) => void;
27
+ export type ErrorHandleFunction = (err: EXPECTED_ANY, req: IncomingMessage, res: ServerResponse, next: NextFunction) => void;
28
+ 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
+ };
38
+ export type Request<T extends BasicApplication = ExpressApplication> = T extends ExpressApplication ? ExpressRequest : IncomingMessage;
39
+ export type Response<T extends BasicApplication = ExpressApplication> = T extends ExpressApplication ? ExpressResponse : ServerResponse;
40
+ export type DevMiddlewareOptions<T extends Request, U extends Response> = import('webpack-dev-middleware').Options<T, U>;
41
+ 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' | string;
43
+ export type Port = number | string | 'auto';
44
+ export interface WatchFiles {
45
+ paths: string | string[];
46
+ options?: WatchOptions & {
47
+ aggregateTimeout?: number;
48
+ ignored?: WatchOptions['ignored'];
49
+ poll?: number | boolean;
50
+ };
51
+ }
52
+ export interface Static {
53
+ directory?: string;
54
+ publicPath?: string | string[];
55
+ serveIndex?: boolean | ServeIndexOptions;
56
+ staticOptions?: ServeStaticOptions;
57
+ watch?: boolean | (WatchOptions & {
58
+ aggregateTimeout?: number;
59
+ ignored?: WatchOptions['ignored'];
60
+ poll?: number | boolean;
61
+ });
62
+ }
63
+ export interface NormalizedStatic {
64
+ directory: string;
65
+ publicPath: string[];
66
+ serveIndex: false | ServeIndexOptions;
67
+ staticOptions: ServeStaticOptions;
68
+ watch: false | WatchOptions;
69
+ }
70
+ export type ServerType<A extends BasicApplication = ExpressApplication, S extends import('http').Server = import('http').Server> = 'http' | 'https' | 'spdy' | 'http2' | string | ((serverOptions: ServerOptions, application: A) => S);
71
+ export interface ServerConfiguration<A extends BasicApplication = ExpressApplication, S extends import('http').Server = import('http').Server> {
72
+ type?: ServerType<A, S>;
73
+ options?: ServerOptions;
74
+ }
75
+ export interface WebSocketServerConfiguration {
76
+ type?: 'sockjs' | 'ws' | string | (() => WebSocketServerConfiguration);
77
+ options?: Record<string, EXPECTED_ANY>;
78
+ }
79
+ export type ClientConnection = (import('ws').WebSocket | (import('sockjs').Connection & {
80
+ send: import('ws').WebSocket['send'];
81
+ terminate: import('ws').WebSocket['terminate'];
82
+ ping: import('ws').WebSocket['ping'];
83
+ })) & {
84
+ isAlive?: boolean;
85
+ };
86
+ export type WebSocketServer = import('ws').WebSocketServer | (import('sockjs').Server & {
87
+ close: import('ws').WebSocketServer['close'];
88
+ });
89
+ export interface WebSocketServerImplementation {
90
+ implementation: WebSocketServer;
91
+ clients: ClientConnection[];
92
+ }
93
+ export type ByPass<Req = Request, Res = Response, ProxyConfig = ProxyConfigArrayItem> = (req: Req, res: Res, proxyConfig: ProxyConfig) => void;
94
+ export type ProxyConfigArrayItem = {
95
+ path?: HttpProxyMiddlewareOptionsFilter;
96
+ context?: HttpProxyMiddlewareOptionsFilter;
97
+ bypass?: ByPass;
98
+ } & HttpProxyMiddlewareOptions;
99
+ export type ProxyConfigArray = Array<ProxyConfigArrayItem | ((req?: Request | undefined, res?: Response | undefined, next?: NextFunction | undefined) => ProxyConfigArrayItem)>;
100
+ export interface OpenApp {
101
+ name?: string;
102
+ arguments?: string[];
103
+ }
104
+ export interface Open {
105
+ app?: string | string[] | OpenApp;
106
+ target?: string | string[];
107
+ }
108
+ export interface NormalizedOpen {
109
+ target: string;
110
+ options: OpenOptions;
111
+ }
112
+ export interface WebSocketURL {
113
+ hostname?: string;
114
+ password?: string;
115
+ pathname?: string;
116
+ port?: number | string;
117
+ protocol?: string;
118
+ username?: string;
119
+ }
120
+ export interface ClientConfiguration {
121
+ logging?: 'log' | 'info' | 'warn' | 'error' | 'none' | 'verbose';
122
+ overlay?: boolean | {
123
+ warnings?: OverlayMessageOptions;
124
+ errors?: OverlayMessageOptions;
125
+ runtimeErrors?: OverlayMessageOptions;
126
+ };
127
+ progress?: boolean;
128
+ reconnect?: boolean | number;
129
+ webSocketTransport?: 'ws' | 'sockjs' | string;
130
+ webSocketURL?: string | WebSocketURL;
131
+ }
132
+ export type Headers = Array<{
133
+ key: string;
134
+ value: string;
135
+ }> | Record<string, string | string[]>;
136
+ export type MiddlewareHandler<T extends BasicApplication = ExpressApplication> = T extends ExpressApplication ? ExpressRequestHandler | ExpressErrorRequestHandler : HandleFunction;
137
+ export interface MiddlewareObject<T extends BasicApplication = ExpressApplication> {
138
+ name?: string;
139
+ path?: string;
140
+ middleware: MiddlewareHandler<T>;
141
+ }
142
+ export type Middleware<T extends BasicApplication = ExpressApplication> = MiddlewareObject<T> | MiddlewareHandler<T>;
143
+ export type BasicServer = import('net').Server | import('tls').Server;
144
+ export type OverlayMessageOptions = boolean | ((error: Error) => void);
145
+ declare function useFn(fn: NextHandleFunction): BasicApplication;
146
+ declare function useFn(fn: HandleFunction): BasicApplication;
147
+ declare function useFn(route: string, fn: NextHandleFunction): BasicApplication;
148
+ declare function useFn(route: string, fn: HandleFunction): BasicApplication;
149
+ export type BasicApplication = {
150
+ use: typeof useFn;
151
+ };
152
+ export type OpenOptions = {
153
+ readonly wait?: boolean;
154
+ readonly background?: boolean;
155
+ readonly newInstance?: boolean;
156
+ readonly app?: OpenApp | readonly OpenApp[];
157
+ readonly allowNonzeroExitCode?: boolean;
158
+ };
package/dist/types.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function useFn(routeOrFn, fn) {
4
+ return {};
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/dev-server",
3
- "version": "1.1.4",
3
+ "version": "1.2.0",
4
4
  "license": "MIT",
5
5
  "description": "Development server for rspack",
6
6
  "main": "./dist/index.js",
@@ -13,16 +13,37 @@
13
13
  ".": {
14
14
  "default": "./dist/index.js"
15
15
  },
16
+ "./getPort": "./getPort.js",
17
+ "./servers/*": "./servers/*.js",
18
+ "./servers/*.js": "./servers/*.js",
16
19
  "./client/*": "./client/*.js",
17
20
  "./client/*.js": "./client/*.js",
18
21
  "./package.json": "./package.json"
19
22
  },
23
+ "scripts": {
24
+ "build": "pnpm run build:server && pnpm run build:client && pnpm run build:client-modules",
25
+ "build:server": "tsc -b ./tsconfig.build.json",
26
+ "build:client": "tsc -b ./tsconfig.client.json",
27
+ "build:client-modules": "node ./scripts/build-client-modules.cjs",
28
+ "dev": "tsc -b -w",
29
+ "lint": "biome check .",
30
+ "lint:write": "biome check . --write",
31
+ "format": "prettier --write .",
32
+ "prettier:ci": "prettier --check .",
33
+ "test:install": "cross-env ./node_modules/.bin/puppeteer browsers install chrome",
34
+ "test": "pnpm run test:install && pnpm run build && cross-env NO_COLOR=1 node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ./node_modules/jest-cli/bin/jest --colors",
35
+ "bump": "npx bumpp"
36
+ },
20
37
  "simple-git-hooks": {
21
38
  "pre-commit": "npx nano-staged"
22
39
  },
23
40
  "nano-staged": {
41
+ "*.{yaml,yml,json,md,json5}": [
42
+ "npm rum format"
43
+ ],
24
44
  "*.{js,jsx,ts,tsx,mjs,cjs}": [
25
- "biome check --write --no-errors-on-unmatched"
45
+ "npm run format",
46
+ "biome lint --write --no-errors-on-unmatched"
26
47
  ]
27
48
  },
28
49
  "files": [
@@ -32,28 +53,33 @@
32
53
  "engines": {
33
54
  "node": ">= 18.12.0"
34
55
  },
35
- "homepage": "https://rspack.dev",
36
- "bugs": "https://github.com/web-infra-dev/rspack-dev-server/issues",
56
+ "packageManager": "pnpm@10.27.0",
57
+ "homepage": "https://rspack.rs",
58
+ "bugs": "https://github.com/rstackjs/rspack-dev-server/issues",
37
59
  "repository": {
38
60
  "type": "git",
39
- "url": "https://github.com/web-infra-dev/rspack-dev-server"
61
+ "url": "https://github.com/rstackjs/rspack-dev-server"
40
62
  },
41
63
  "devDependencies": {
42
64
  "@biomejs/biome": "^1.8.3",
43
65
  "@jest/reporters": "29.7.0",
44
66
  "@jest/test-sequencer": "^29.7.0",
45
- "@rspack/core": "npm:@rspack-canary/core@1.4.3-canary-98b815e4-20250703091256",
67
+ "@rspack/core": "1.7.1",
46
68
  "@rspack/plugin-react-refresh": "1.0.0",
47
- "@types/express": "4.17.21",
69
+ "@types/express": "5.0.6",
48
70
  "@types/jest": "29.5.12",
49
- "@types/mime-types": "2.1.4",
71
+ "@types/mime-types": "3.0.1",
50
72
  "@types/ws": "8.5.10",
73
+ "@types/compression": "^1.7.2",
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",
78
+ "@types/trusted-types": "^2.0.7",
51
79
  "@hono/node-server": "^1.13.3",
52
80
  "cross-env": "^7.0.3",
53
81
  "css-loader": "^7.1.2",
54
82
  "connect": "^3.7.0",
55
- "execa": "9.3.0",
56
- "fs-extra": "11.2.0",
57
83
  "graceful-fs": "4.2.10",
58
84
  "http-proxy": "^1.18.1",
59
85
  "hono": "^4.6.8",
@@ -63,42 +89,53 @@
63
89
  "jest-serializer-path": "^0.1.15",
64
90
  "nano-staged": "^0.8.0",
65
91
  "prettier": "3.2.5",
66
- "puppeteer": "^23.2.2",
92
+ "puppeteer": "^24.34.0",
67
93
  "react-refresh": "0.14.0",
68
94
  "require-from-string": "^2.0.2",
69
- "semver": "7.6.3",
70
95
  "simple-git-hooks": "^2.11.1",
71
96
  "sockjs-client": "^1.6.1",
72
- "style-loader": "^3.3.3",
97
+ "style-loader": "^4.0.0",
73
98
  "supertest": "^6.1.3",
74
99
  "tcp-port-used": "^1.0.2",
75
100
  "ts-jest": "29.1.2",
76
101
  "typescript": "5.0.2",
77
102
  "wait-for-expect": "^3.0.2",
78
103
  "webpack": "^5.94.0",
104
+ "webpack-merge": "^6.0.1",
79
105
  "webpack-dev-middleware": "^7.4.2",
80
- "express": "^4.21.2"
106
+ "express": "^5.2.1"
81
107
  },
82
108
  "dependencies": {
83
109
  "chokidar": "^3.6.0",
84
110
  "http-proxy-middleware": "^2.0.9",
85
111
  "p-retry": "^6.2.0",
86
- "webpack-dev-server": "5.2.2",
87
- "ws": "^8.18.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"
88
137
  },
89
138
  "peerDependencies": {
90
139
  "@rspack/core": "*"
91
- },
92
- "scripts": {
93
- "build": "pnpm run build:server && pnpm run build:client",
94
- "build:server": "tsc -b ./tsconfig.build.json",
95
- "build:client": "tsc -b ./tsconfig.client.json",
96
- "dev": "tsc -b -w",
97
- "lint": "biome check .",
98
- "lint:write": "biome check . --write",
99
- "format": "node ./node_modules/prettier/bin/prettier.cjs \"packages/**/src/**/*.{ts,tsx,js}\" \"crates/rspack_plugin_runtime/**/*.{ts,js}\" \"x.mjs\" --check",
100
- "test:install": "cross-env ./node_modules/.bin/puppeteer browsers install chrome",
101
- "test": "pnpm run test:install && pnpm run build && cross-env NO_COLOR=1 node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ./node_modules/jest-cli/bin/jest --colors",
102
- "release": "node ./scripts/release.mjs"
103
140
  }
104
- }
141
+ }
package/dist/patch.d.ts DELETED
@@ -1,3 +0,0 @@
1
- declare function restoreDevServerPatch(): void;
2
- declare function applyDevServerPatch(): typeof restoreDevServerPatch;
3
- export { applyDevServerPatch };
package/dist/patch.js DELETED
@@ -1,32 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.applyDevServerPatch = void 0;
7
- const webpack_dev_server_1 = __importDefault(require("webpack-dev-server"));
8
- let old;
9
- function restoreDevServerPatch() {
10
- // @ts-expect-error private API
11
- webpack_dev_server_1.default.prototype.sendStats = old;
12
- }
13
- // Patch webpack-dev-server to prevent it from failing to send stats.
14
- // See https://github.com/web-infra-dev/rspack/pull/4028 for details.
15
- function applyDevServerPatch() {
16
- if (old)
17
- return restoreDevServerPatch;
18
- // @ts-expect-error private API
19
- old = webpack_dev_server_1.default.prototype.sendStats;
20
- // @ts-expect-error private API
21
- webpack_dev_server_1.default.prototype.sendStats = function sendStats__rspack_patched(
22
- // @ts-expect-error
23
- ...args) {
24
- const stats = args[1];
25
- if (!stats) {
26
- return;
27
- }
28
- return old.apply(this, args);
29
- };
30
- return restoreDevServerPatch;
31
- }
32
- exports.applyDevServerPatch = applyDevServerPatch;