fix(build): tighten TypeScript compatibility and update project build configuration

This commit is contained in:
2026-04-30 15:22:54 +00:00
parent d75486ac6e
commit 554af7752e
14 changed files with 2389 additions and 1962 deletions
+8 -6
View File
@@ -11,8 +11,8 @@ import { logger } from './smartsocket.logging.js';
*/
export class SocketServer {
private smartsocket: Smartsocket;
private httpServer: pluginsTyped.http.Server | pluginsTyped.https.Server;
private wsServer: pluginsTyped.ws.WebSocketServer;
private httpServer: pluginsTyped.http.Server | pluginsTyped.https.Server | null = null;
private wsServer: pluginsTyped.ws.WebSocketServer | null = null;
/**
* whether httpServer is standalone (created by us)
@@ -38,17 +38,19 @@ export class SocketServer {
const httpModule = await this.smartsocket.smartenv.getSafeNodeModule('http');
const wsModule = await this.smartsocket.smartenv.getSafeNodeModule('ws');
this.httpServer = httpModule.createServer();
const httpServer = httpModule.createServer();
this.httpServer = httpServer;
this.standaloneServer = true;
// Create WebSocket server attached to HTTP server
this.wsServer = new wsModule.WebSocketServer({ server: this.httpServer });
const wsServer = new wsModule.WebSocketServer({ server: httpServer });
this.wsServer = wsServer;
this.wsServer.on('connection', (ws: pluginsTyped.ws.WebSocket) => {
wsServer.on('connection', (ws: pluginsTyped.ws.WebSocket) => {
this.smartsocket.handleNewConnection(ws);
});
this.httpServer.listen(this.smartsocket.options.port, () => {
httpServer.listen(this.smartsocket.options.port, () => {
logger.log(
'success',
`Server started in standalone mode on port ${this.smartsocket.options.port}`