From a6ec1cea71d8a45d1e269445182620afd2302a1f Mon Sep 17 00:00:00 2001 From: Nick Mitchell Date: Tue, 11 Apr 2023 19:20:25 -0400 Subject: [PATCH] chore: bump ws 7->8 --- package-lock.json | 60 +++++++++++----------- plugins/plugin-bash-like/package.json | 5 +- plugins/plugin-bash-like/src/pty/server.ts | 6 +-- 3 files changed, 37 insertions(+), 34 deletions(-) diff --git a/package-lock.json b/package-lock.json index c90d384f3a6..3990e802b42 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17041,26 +17041,6 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/ws": { - "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", - "engines": { - "node": ">=8.3.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, "node_modules/xml": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz", @@ -17484,7 +17464,7 @@ "speed-date": "^1.0.0", "tmp": "^0.2.1", "uuid": "^9.0.0", - "ws": "^7.5.9", + "ws": "^8.13.0", "xterm": "^5.1.0", "xterm-addon-fit": "^0.7.0", "xterm-addon-webgl": "^0.14.0" @@ -17495,7 +17475,8 @@ "@types/properties-parser": "0.3.0", "@types/shelljs": "^0.8.11", "@types/tmp": "^0.2.3", - "@types/uuid": "^9.0.1" + "@types/uuid": "^9.0.1", + "@types/ws": "^8.5.4" } }, "plugins/plugin-bash-like/node_modules/globby": { @@ -17527,6 +17508,26 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "plugins/plugin-bash-like/node_modules/ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "plugins/plugin-carbon-themes": { "name": "@kui-shell/plugin-carbon-themes", "version": "13.1.0", @@ -18589,6 +18590,7 @@ "@types/shelljs": "^0.8.11", "@types/tmp": "^0.2.3", "@types/uuid": "^9.0.1", + "@types/ws": "^8.5.4", "cookie": "^0.5.0", "debug": "^4.3.4", "globby": "^13.1.4", @@ -18599,7 +18601,7 @@ "speed-date": "^1.0.0", "tmp": "^0.2.1", "uuid": "^9.0.0", - "ws": "^7.5.9", + "ws": "^8.13.0", "xterm": "^5.1.0", "xterm-addon-fit": "^0.7.0", "xterm-addon-webgl": "^0.14.0" @@ -18623,6 +18625,12 @@ "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==" } } + }, + "ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "requires": {} } } }, @@ -30690,12 +30698,6 @@ "signal-exit": "^3.0.7" } }, - "ws": { - "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", - "requires": {} - }, "xml": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/xml/-/xml-1.0.1.tgz", diff --git a/plugins/plugin-bash-like/package.json b/plugins/plugin-bash-like/package.json index d4ae601ae80..cbb92367f3c 100644 --- a/plugins/plugin-bash-like/package.json +++ b/plugins/plugin-bash-like/package.json @@ -33,7 +33,8 @@ "@types/properties-parser": "0.3.0", "@types/shelljs": "^0.8.11", "@types/tmp": "^0.2.3", - "@types/uuid": "^9.0.1" + "@types/uuid": "^9.0.1", + "@types/ws": "^8.5.4" }, "dependencies": { "@kui-shell/xterm-helpers": "^2.1.0", @@ -47,7 +48,7 @@ "speed-date": "^1.0.0", "tmp": "^0.2.1", "uuid": "^9.0.0", - "ws": "^7.5.9", + "ws": "^8.13.0", "xterm": "^5.1.0", "xterm-addon-fit": "^0.7.0", "xterm-addon-webgl": "^0.14.0" diff --git a/plugins/plugin-bash-like/src/pty/server.ts b/plugins/plugin-bash-like/src/pty/server.ts index f888ce309a3..bb5965601f9 100755 --- a/plugins/plugin-bash-like/src/pty/server.ts +++ b/plugins/plugin-bash-like/src/pty/server.ts @@ -517,7 +517,7 @@ export const main = async ( if (cachedWss) { return cachedPort } else { - const WebSocket = (await import('ws')).default + const { WebSocketServer } = await import('ws') // eslint-disable-next-line no-async-promise-executor return new Promise(async resolve => { @@ -537,7 +537,7 @@ export const main = async ( // if we were given a session cookie, then use the // verifyClient functionality of WebSocket.Server to enforce // the session's validity - const wss = new WebSocket.Server({ + const wss = new WebSocketServer({ noServer: true, verifyClient: expectedCookie && verifySession(expectedCookie) }) @@ -561,7 +561,7 @@ export const main = async ( cachedPort = await getPort() const server = createDefaultServer() server.listen(cachedPort, async () => { - const wss = (cachedWss = new WebSocket.Server({ server })) + const wss = (cachedWss = new WebSocketServer({ server })) servers.push({ wss: cachedWss, server }) resolve({ wss, port: cachedPort, exitNow }) })