-
-
Save steveluscher/c85ff3247e717b9d62e36dbd9bc486b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/packages/library-legacy/package.json b/packages/library-legacy/package.json | |
index 75f5b51222..8f10dcc50e 100644 | |
--- a/packages/library-legacy/package.json | |
+++ b/packages/library-legacy/package.json | |
@@ -68,7 +68,7 @@ | |
"fast-stable-stringify": "^1.0.0", | |
"jayson": "^4.1.0", | |
"node-fetch": "^2.7.0", | |
- "rpc-websockets": "^8.0.1", | |
+ "rpc-websockets": "../../../rpc-websockets", | |
"superstruct": "^1.0.4" | |
}, | |
"devDependencies": { | |
diff --git a/packages/library-legacy/rollup.config.mjs b/packages/library-legacy/rollup.config.mjs | |
index 0a9cb2a92e..d00b589ab7 100644 | |
--- a/packages/library-legacy/rollup.config.mjs | |
+++ b/packages/library-legacy/rollup.config.mjs | |
@@ -110,10 +110,6 @@ function generateConfig(configType, format) { | |
'jayson/lib/client/browser', | |
'node-fetch', | |
'rpc-websockets', | |
- 'rpc-websockets/dist/lib/client.cjs', | |
- 'rpc-websockets/dist/lib/client/client.types.cjs', | |
- 'rpc-websockets/dist/lib/client/websocket.cjs', | |
- 'rpc-websockets/dist/lib/client/websocket.browser.cjs', | |
'superstruct', | |
]; | |
} | |
@@ -182,10 +178,6 @@ function generateConfig(configType, format) { | |
'node-fetch', | |
'react-native-url-polyfill', | |
'rpc-websockets', | |
- 'rpc-websockets/dist/lib/client.cjs', | |
- 'rpc-websockets/dist/lib/client/client.types.cjs', | |
- 'rpc-websockets/dist/lib/client/websocket.cjs', | |
- 'rpc-websockets/dist/lib/client/websocket.browser.cjs', | |
'superstruct', | |
]; | |
diff --git a/packages/library-legacy/src/__forks__/browser/rpc-websocket-factory.ts b/packages/library-legacy/src/__forks__/browser/rpc-websocket-factory.ts | |
deleted file mode 100644 | |
index 013a5fc894..0000000000 | |
--- a/packages/library-legacy/src/__forks__/browser/rpc-websocket-factory.ts | |
+++ /dev/null | |
@@ -1 +0,0 @@ | |
-export {default} from 'rpc-websockets/dist/lib/client/websocket.browser.cjs'; | |
diff --git a/packages/library-legacy/src/__forks__/react-native/rpc-websocket-factory.ts b/packages/library-legacy/src/__forks__/react-native/rpc-websocket-factory.ts | |
deleted file mode 100644 | |
index 013a5fc894..0000000000 | |
--- a/packages/library-legacy/src/__forks__/react-native/rpc-websocket-factory.ts | |
+++ /dev/null | |
@@ -1 +0,0 @@ | |
-export {default} from 'rpc-websockets/dist/lib/client/websocket.browser.cjs'; | |
diff --git a/packages/library-legacy/src/rpc-websocket-factory.ts b/packages/library-legacy/src/rpc-websocket-factory.ts | |
deleted file mode 100644 | |
index d4af0bbdc4..0000000000 | |
--- a/packages/library-legacy/src/rpc-websocket-factory.ts | |
+++ /dev/null | |
@@ -1,4 +0,0 @@ | |
-import {ICommonWebSocketFactory} from 'rpc-websockets/dist/lib/client/client.types.cjs'; | |
-import WebsocketFactory from 'rpc-websockets/dist/lib/client/websocket.cjs'; | |
- | |
-export default WebsocketFactory as ICommonWebSocketFactory; | |
diff --git a/packages/library-legacy/src/rpc-websocket.ts b/packages/library-legacy/src/rpc-websocket.ts | |
index 114c2dd725..5c5863866e 100644 | |
--- a/packages/library-legacy/src/rpc-websocket.ts | |
+++ b/packages/library-legacy/src/rpc-websocket.ts | |
@@ -1,19 +1,17 @@ | |
-import RpcWebSocketCommonClient from 'rpc-websockets/dist/lib/client.cjs'; | |
-import WebSocketBrowserImpl from 'rpc-websockets/dist/lib/client/websocket.cjs'; | |
import { | |
+ CommonClient, | |
ICommonWebSocket, | |
IWSClientAdditionalOptions, | |
NodeWebSocketType, | |
NodeWebSocketTypeOptions, | |
-} from 'rpc-websockets/dist/lib/client/client.types.cjs'; | |
- | |
-import createRpc from './rpc-websocket-factory'; | |
+ WebSocket as createRpc, | |
+} from 'rpc-websockets'; | |
interface IHasReadyState { | |
readyState: WebSocket['readyState']; | |
} | |
-export default class RpcWebSocketClient extends RpcWebSocketCommonClient { | |
+export default class RpcWebSocketClient extends CommonClient { | |
private underlyingSocket: IHasReadyState | undefined; | |
constructor( | |
address?: string, | |
@@ -32,9 +30,7 @@ export default class RpcWebSocketClient extends RpcWebSocketCommonClient { | |
...options, | |
}); | |
if ('socket' in rpc) { | |
- this.underlyingSocket = rpc.socket as ReturnType< | |
- typeof WebSocketBrowserImpl | |
- >; | |
+ this.underlyingSocket = rpc.socket as ReturnType<typeof createRpc>; | |
} else { | |
this.underlyingSocket = rpc as NodeWebSocketType; | |
} | |
@@ -43,8 +39,8 @@ export default class RpcWebSocketClient extends RpcWebSocketCommonClient { | |
super(webSocketFactory, address, options, generate_request_id); | |
} | |
call( | |
- ...args: Parameters<RpcWebSocketCommonClient['call']> | |
- ): ReturnType<RpcWebSocketCommonClient['call']> { | |
+ ...args: Parameters<CommonClient['call']> | |
+ ): ReturnType<CommonClient['call']> { | |
const readyState = this.underlyingSocket?.readyState; | |
if (readyState === 1 /* WebSocket.OPEN */) { | |
return super.call(...args); | |
@@ -60,8 +56,8 @@ export default class RpcWebSocketClient extends RpcWebSocketCommonClient { | |
); | |
} | |
notify( | |
- ...args: Parameters<RpcWebSocketCommonClient['notify']> | |
- ): ReturnType<RpcWebSocketCommonClient['notify']> { | |
+ ...args: Parameters<CommonClient['notify']> | |
+ ): ReturnType<CommonClient['notify']> { | |
const readyState = this.underlyingSocket?.readyState; | |
if (readyState === 1 /* WebSocket.OPEN */) { | |
return super.notify(...args); | |
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml | |
index 8399042a0c..39e90b9fd4 100644 | |
--- a/pnpm-lock.yaml | |
+++ b/pnpm-lock.yaml | |
@@ -459,8 +459,8 @@ importers: | |
specifier: ^2.7.0 | |
version: 2.7.0 | |
rpc-websockets: | |
- specifier: ^8.0.1 | |
- version: 8.0.1 | |
+ specifier: ../../../rpc-websockets | |
+ version: link:../../../rpc-websockets | |
superstruct: | |
specifier: ^1.0.4 | |
version: 1.0.4 | |
@@ -4679,9 +4679,6 @@ packages: | |
eventemitter3@3.1.2: | |
resolution: {integrity: sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==} | |
- eventemitter3@4.0.7: | |
- resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==} | |
- | |
execa@5.1.1: | |
resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==} | |
engines: {node: '>=10'} | |
@@ -6933,9 +6930,6 @@ packages: | |
engines: {node: '>=18.0.0', npm: '>=8.0.0'} | |
hasBin: true | |
- rpc-websockets@8.0.1: | |
- resolution: {integrity: sha512-PptrPRK40uQvifq5sCcObmqInVcZXhy+RRrirzdE5KUPvDI47y1wPvfckD2QzqngOU9xaPW/dT+G+b+wj6M1MQ==} | |
- | |
rrweb-cssom@0.6.0: | |
resolution: {integrity: sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==} | |
@@ -12005,8 +11999,6 @@ snapshots: | |
eventemitter3@3.1.2: {} | |
- eventemitter3@4.0.7: {} | |
- | |
execa@5.1.1: | |
dependencies: | |
cross-spawn: 7.0.3 | |
@@ -14687,15 +14679,6 @@ snapshots: | |
'@rollup/rollup-win32-x64-msvc': 4.18.0 | |
fsevents: 2.3.3 | |
- rpc-websockets@8.0.1: | |
- dependencies: | |
- eventemitter3: 4.0.7 | |
- uuid: 8.3.2 | |
- ws: 8.14.2(bufferutil@4.0.8)(utf-8-validate@5.0.10) | |
- optionalDependencies: | |
- bufferutil: 4.0.8 | |
- utf-8-validate: 5.0.10 | |
- | |
rrweb-cssom@0.6.0: {} | |
run-parallel@1.2.0: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment