diff --git a/client.tsx b/client.tsx index 58ab91e..782b5cd 100644 --- a/client.tsx +++ b/client.tsx @@ -4,15 +4,11 @@ import { ApolloLink, concat, split } from 'apollo-link'; import { WebSocketLink } from 'apollo-link-ws'; import fetch from 'node-fetch'; import path from 'path'; +import ws from 'ws'; import { debug } from './debug'; const moduleLog = debug.extend('client') -let ws; -if (typeof(window) !== 'object') { - ws = require('ws'); -} - const DEEP_FOUNDATION_HASURA_RELATIVE: boolean | undefined = ((r) => r ? !!+r : undefined)(process.env.DEEP_FOUNDATION_HASURA_RELATIVE); const NEXT_PUBLIC_DEEP_FOUNDATION_HASURA_RELATIVE: boolean | undefined = ((r) => r ? !!+r : undefined)(process.env.NEXT_PUBLIC_DEEP_FOUNDATION_HASURA_RELATIVE); diff --git a/package-lock.json b/package-lock.json index bb164cd..968a289 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,8 @@ "normalize-url": "^7.0.2", "path": "^0.12.7", "rimraf": "^3.0.2", - "ts-node": "^10.9.1" + "ts-node": "^10.9.1", + "ws": "^8.17.1" }, "devDependencies": { "@types/debug": "^4.1.9", @@ -37,8 +38,7 @@ "apollo-link": "^1.2.14", "apollo-link-ws": "^1.0.20", "apollo-server-micro": "^2.21.0", - "react": "^18.2.0", - "ws": "^7.5.6" + "react": "^18.2.0" } }, "node_modules/@apollo/client": { @@ -4474,6 +4474,28 @@ "node": ">=0.10.0" } }, + "node_modules/subscriptions-transport-ws/node_modules/ws": { + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "license": "MIT", + "peer": true, + "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/supports-color": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", @@ -4875,17 +4897,16 @@ "license": "ISC" }, "node_modules/ws": { - "version": "7.5.10", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", - "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", "license": "MIT", - "peer": true, "engines": { - "node": ">=8.3.0" + "node": ">=10.0.0" }, "peerDependencies": { "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" + "utf-8-validate": ">=5.0.2" }, "peerDependenciesMeta": { "bufferutil": { diff --git a/package.json b/package.json index 3311d2f..2c9f8f9 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,8 @@ "normalize-url": "^7.0.2", "path": "^0.12.7", "rimraf": "^3.0.2", - "ts-node": "^10.9.1" + "ts-node": "^10.9.1", + "ws": "^8.17.1" }, "scripts": { "package:refresh": "rm -rf node_modules; rm -f package-lock.json; npm i", @@ -47,7 +48,6 @@ "apollo-link": "^1.2.14", "apollo-link-ws": "^1.0.20", "apollo-server-micro": "^2.21.0", - "react": "^18.2.0", - "ws": "^7.5.6" + "react": "^18.2.0" } }