Skip to content

Commit

Permalink
chore(deps): socket.io@4.8.0, esbuild@0.24.0
Browse files Browse the repository at this point in the history
- adjust socket.io code to close returning a promise now
- regenerate lock file
  • Loading branch information
AviVahl committed Sep 22, 2024
1 parent cace2be commit a7ba76f
Show file tree
Hide file tree
Showing 11 changed files with 142 additions and 143 deletions.
246 changes: 123 additions & 123 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"chai": "^4.5.0",
"chai-as-promised": "^7.1.2",
"create-temp-directory": "^2.4.0",
"esbuild": "^0.23.1",
"esbuild": "^0.24.0",
"eslint": "^9.11.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-no-only-tests": "^3.3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@wixc3/isomorphic-worker": "^1.2.5",
"@wixc3/patterns": "^17.1.1",
"promise-assist": "^2.0.1",
"socket.io-client": "^4.7.5",
"socket.io-client": "^4.8.0",
"typescript-type-utils": "^0.1.0"
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/engine-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"express": "^4.21.0",
"is-ci": "^3.0.1",
"promise-assist": "^2.0.1",
"socket.io": "^4.7.5"
"socket.io": "^4.8.0"
},
"files": [
"dist",
Expand Down
9 changes: 4 additions & 5 deletions packages/engine-cli/src/start-dev-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@ export async function launchServer({
transports: ['websocket'],
});

const close = () =>
new Promise<void>((res, rej) => {
httpServer.closeAllConnections();
socketServer.close((e) => (e ? rej(e) : res()));
});
const close = async () => {
httpServer.closeAllConnections();
await socketServer.close();
};

return {
close,
Expand Down
2 changes: 1 addition & 1 deletion packages/engineer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"commander": "^12.1.0",
"express": "^4.21.0",
"open": "^8.4.2",
"socket.io": "^4.7.5",
"socket.io": "^4.8.0",
"webpack-dev-middleware": "^7.4.2"
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"create-listening-server": "^2.1.0",
"express": "^4.21.0",
"minimist": "^1.2.8",
"socket.io": "^4.7.5"
"socket.io": "^4.8.0"
},
"files": [
"dist",
Expand Down
6 changes: 2 additions & 4 deletions packages/runtime-node/src/launch-http-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,8 @@ export async function launchEngineHttpServer({

return {
close: async () => {
await new Promise<void>((res, rej) => {
httpServer.closeAllConnections();
socketServer.close((e) => (e ? rej(e) : res()));
});
httpServer.closeAllConnections();
await socketServer.close();
},
port,
app,
Expand Down
4 changes: 2 additions & 2 deletions packages/runtime-node/src/node-environments-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ export class NodeEnvironmentsManager {
).start();
close = wsEnvClose;
} catch (e) {
await new Promise<void>((res, rej) => socketServer.close((e) => (e ? rej(e) : res())));
await socketServer.close();
throw e;
}
const openSockets = new Set<Socket>();
Expand All @@ -457,7 +457,7 @@ export class NodeEnvironmentsManager {
for (const socket of openSockets) {
socket.destroy();
}
await new Promise<void>((res, rej) => socketServer.close((e) => (e ? rej(e) : res())));
await socketServer.close();
await close();
},
};
Expand Down
8 changes: 5 additions & 3 deletions packages/runtime-node/test/node-com.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('Socket communication', () => {
const nameSpace = socketServer.of('processing');
serverTopology['server-host'] = `http://localhost:${port}/processing`;
const connections = new Set<Socket>();
disposables.add('socketServer.close', () => new Promise((res) => socketServer.close(res)));
disposables.add('socketServer.close', () => socketServer.close());
disposables.add('reset serverTopology', () => (serverTopology = {}));
const onConnection = (connection: Socket): void => {
connections.add(connection);
Expand Down Expand Up @@ -231,7 +231,7 @@ describe('Socket communication', () => {
expect(onDisconnect).to.not.eq(undefined);

onDisconnect(spy);
socketServer.close();
await socketServer.close();
await waitFor(
() => {
expect(spy.callCount).to.be.eq(1);
Expand Down Expand Up @@ -328,7 +328,9 @@ describe('IPC communication', () => {
const { waitForCall, spy } = createWaitForCall<(e: Error) => void>();
proxy.echo().catch(spy);
await waitForCall((args) => {
expect(args[0].message).to.have.string('Remote call failed in "process" - environment disconnected at "main"');
expect(args[0].message).to.have.string(
'Remote call failed in "process" - environment disconnected at "main"',
);
});
});
});
2 changes: 1 addition & 1 deletion packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"create-listening-server": "^2.1.0",
"express": "^4.21.0",
"semver": "^7.6.3",
"socket.io": "^4.7.5",
"socket.io": "^4.8.0",
"type-fest": "^4.26.1"
},
"files": [
Expand Down

0 comments on commit a7ba76f

Please sign in to comment.