@callstack/repack-dev-server 5.3.0 → 5.4.0-canary-20260822202143
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/dist/createServer.d.ts +1 -1
- package/dist/createServer.js +0 -1
- package/dist/plugins/symbolicate/index.d.ts +1 -1
- package/dist/plugins/symbolicate/index.js +1 -1
- package/dist/plugins/wss/WebSocketServer.d.ts +1 -1
- package/dist/plugins/wss/WebSocketServer.js +4 -2
- package/dist/plugins/wss/index.d.ts +2 -2
- package/dist/plugins/wss/index.js +2 -2
- package/dist/plugins/wss/servers/WebSocketMessageServer.js +1 -1
- package/dist/plugins/wss/wssPlugin.d.ts +2 -2
- package/dist/plugins/wss/wssPlugin.js +2 -2
- package/dist/types.d.ts +1 -2
- package/package.json +2 -2
package/dist/createServer.d.ts
CHANGED
|
@@ -10,6 +10,6 @@ export declare function createServer(config: Server.Config): Promise<{
|
|
|
10
10
|
start: () => Promise<void>;
|
|
11
11
|
stop: () => Promise<void>;
|
|
12
12
|
instance: Fastify.FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, Fastify.FastifyBaseLogger, Fastify.FastifyTypeProviderDefault> & PromiseLike<Fastify.FastifyInstance<import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, Fastify.FastifyBaseLogger, Fastify.FastifyTypeProviderDefault>> & {
|
|
13
|
-
__linterBrands:
|
|
13
|
+
__linterBrands: 'SafePromiseLike';
|
|
14
14
|
};
|
|
15
15
|
}>;
|
package/dist/createServer.js
CHANGED
|
@@ -21,7 +21,6 @@ import { normalizeOptions } from './utils/normalizeOptions.js';
|
|
|
21
21
|
* @returns `start` and `stop` functions as well as an underlying Fastify `instance`.
|
|
22
22
|
*/
|
|
23
23
|
export async function createServer(config) {
|
|
24
|
-
// biome-ignore lint/style/useConst: needed in fastify constructor
|
|
25
24
|
let delegate;
|
|
26
25
|
const options = normalizeOptions(config.options);
|
|
27
26
|
/** Fastify instance powering the development server. */
|
|
@@ -17,7 +17,7 @@ export declare abstract class WebSocketServer<T extends WebSocket = WebSocket> i
|
|
|
17
17
|
protected paths: string[];
|
|
18
18
|
protected clients: Map<string, T>;
|
|
19
19
|
protected nextClientId: number;
|
|
20
|
-
private
|
|
20
|
+
private heartbeatTimer;
|
|
21
21
|
/**
|
|
22
22
|
* Create a new instance of the WebSocketServer.
|
|
23
23
|
* Any logging information, will be passed through standard `fastify.log` API.
|
|
@@ -15,7 +15,6 @@ export class WebSocketServer {
|
|
|
15
15
|
*/
|
|
16
16
|
constructor(fastify, options) {
|
|
17
17
|
this.nextClientId = 0;
|
|
18
|
-
this.timer = null;
|
|
19
18
|
this.fastify = fastify;
|
|
20
19
|
this.name = options.name;
|
|
21
20
|
this.paths = Array.isArray(options.path) ? options.path : [options.path];
|
|
@@ -23,7 +22,7 @@ export class WebSocketServer {
|
|
|
23
22
|
this.server.on('connection', this.onConnection.bind(this));
|
|
24
23
|
this.clients = new Map();
|
|
25
24
|
// setup heartbeat timer
|
|
26
|
-
this.
|
|
25
|
+
this.heartbeatTimer = setInterval(() => {
|
|
27
26
|
this.clients.forEach((socket) => {
|
|
28
27
|
if (!socket.isAlive) {
|
|
29
28
|
socket.terminate();
|
|
@@ -34,6 +33,9 @@ export class WebSocketServer {
|
|
|
34
33
|
}
|
|
35
34
|
});
|
|
36
35
|
}, 30000);
|
|
36
|
+
this.fastify.addHook('onClose', async () => {
|
|
37
|
+
clearInterval(this.heartbeatTimer);
|
|
38
|
+
});
|
|
37
39
|
}
|
|
38
40
|
shouldUpgrade(pathname) {
|
|
39
41
|
return this.paths.includes(pathname);
|
|
@@ -271,7 +271,7 @@ export class WebSocketMessageServer extends WebSocketServer {
|
|
|
271
271
|
this.upgradeRequests[clientId] = request;
|
|
272
272
|
socket.addEventListener('message', (event) => {
|
|
273
273
|
const message = this.parseMessage(event.data.toString(),
|
|
274
|
-
// @ts-
|
|
274
|
+
// @ts-expect-error
|
|
275
275
|
event.binary);
|
|
276
276
|
if (!message) {
|
|
277
277
|
this.fastify.log.error({
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { FastifyInstance } from 'fastify';
|
|
2
2
|
import type { WebSocketServer } from 'ws';
|
|
3
3
|
import type { Server } from '../../types.js';
|
|
4
|
-
import { WebSocketRouter } from './WebSocketRouter.js';
|
|
5
|
-
import { WebSocketServerAdapter } from './WebSocketServerAdapter.js';
|
|
6
4
|
import { WebSocketApiServer } from './servers/WebSocketApiServer.js';
|
|
7
5
|
import { WebSocketDevClientServer } from './servers/WebSocketDevClientServer.js';
|
|
8
6
|
import { WebSocketEventsServer } from './servers/WebSocketEventsServer.js';
|
|
9
7
|
import { WebSocketHMRServer } from './servers/WebSocketHMRServer.js';
|
|
10
8
|
import { WebSocketMessageServer } from './servers/WebSocketMessageServer.js';
|
|
9
|
+
import { WebSocketRouter } from './WebSocketRouter.js';
|
|
10
|
+
import { WebSocketServerAdapter } from './WebSocketServerAdapter.js';
|
|
11
11
|
declare module 'fastify' {
|
|
12
12
|
interface FastifyInstance {
|
|
13
13
|
wss: {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import fastifyPlugin from 'fastify-plugin';
|
|
2
|
-
import { WebSocketRouter } from './WebSocketRouter.js';
|
|
3
|
-
import { WebSocketServerAdapter } from './WebSocketServerAdapter.js';
|
|
4
2
|
import { WebSocketApiServer } from './servers/WebSocketApiServer.js';
|
|
5
3
|
import { WebSocketDevClientServer } from './servers/WebSocketDevClientServer.js';
|
|
6
4
|
import { WebSocketEventsServer } from './servers/WebSocketEventsServer.js';
|
|
7
5
|
import { WebSocketHMRServer } from './servers/WebSocketHMRServer.js';
|
|
8
6
|
import { WebSocketMessageServer } from './servers/WebSocketMessageServer.js';
|
|
7
|
+
import { WebSocketRouter } from './WebSocketRouter.js';
|
|
8
|
+
import { WebSocketServerAdapter } from './WebSocketServerAdapter.js';
|
|
9
9
|
/**
|
|
10
10
|
* Defined in @react-native/dev-middleware
|
|
11
11
|
* Reference: https://github.com/facebook/react-native/blob/main/packages/dev-middleware/src/inspector-proxy/InspectorProxy.js
|
package/dist/types.d.ts
CHANGED
|
@@ -13,8 +13,7 @@ type MiddlewareObject<RequestInternal extends Http.IncomingMessage = Http.Incomi
|
|
|
13
13
|
middleware: MiddlewareHandler<RequestInternal, ResponseInternal>;
|
|
14
14
|
};
|
|
15
15
|
export type Middleware<RequestInternal extends Http.IncomingMessage = Http.IncomingMessage, ResponseInternal extends Http.ServerResponse = Http.ServerResponse> = MiddlewareObject<RequestInternal, ResponseInternal> | MiddlewareHandler<RequestInternal, ResponseInternal>;
|
|
16
|
-
export type { CompilerDelegate };
|
|
17
|
-
export type { CodeFrame, InputStackFrame, ReactNativeStackFrame, StackFrame, SymbolicatorDelegate, SymbolicatorResults, };
|
|
16
|
+
export type { CodeFrame, CompilerDelegate, InputStackFrame, ReactNativeStackFrame, StackFrame, SymbolicatorDelegate, SymbolicatorResults, };
|
|
18
17
|
interface ProxyConfig extends ProxyOptions {
|
|
19
18
|
path?: ProxyOptions['pathFilter'];
|
|
20
19
|
context?: ProxyOptions['pathFilter'];
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@callstack/repack-dev-server",
|
|
3
3
|
"description": "A bundler-agnostic development server for React Native applications as part of @callstack/repack.",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "5.
|
|
5
|
+
"version": "5.4.0-canary-20260822202143",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@types/babel__code-frame": "^7.0.6",
|
|
54
54
|
"@types/node": "^20.19.31",
|
|
55
55
|
"@types/ws": "^8.18.0",
|
|
56
|
-
"typescript": "^
|
|
56
|
+
"typescript": "^7.0.2",
|
|
57
57
|
"vitest": "^4.1.0"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|