Skip to content

Commit

Permalink
fix(library-legacy/deps): rpc-websockets@^7.11.0->^7.11.1 (#2758)
Browse files Browse the repository at this point in the history
* fix(library-legacy/deps): rpc-websockets@^7.11.0->^7.11.1

* Force web3.js to workspace version and update Rollup scripts to extern the websockets code

* Revert unrelated changes

* Self-compile the legacy library before running tests

* Run Prettier

---------

Co-authored-by: steveluscher <steven.luscher@anza.xyz>
  • Loading branch information
legobeat and steveluscher authored Jun 3, 2024
1 parent e807cd9 commit 5527b0e
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 81 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"packageManager": "pnpm@9.1.0",
"pnpm": {
"overrides": {
"@solana/web3.js": "workspace:*",
"jsdom": "^22",
"mock-socket": "^9.3.1",
"shelljs": ">=0.8.5"
Expand Down
2 changes: 1 addition & 1 deletion packages/library-legacy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"fast-stable-stringify": "^1.0.0",
"jayson": "^4.1.0",
"node-fetch": "^2.7.0",
"rpc-websockets": "^7.11.0",
"rpc-websockets": "^7.11.1",
"superstruct": "^1.0.4"
},
"devDependencies": {
Expand Down
16 changes: 8 additions & 8 deletions packages/library-legacy/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ function generateConfig(configType, format) {
'jayson/lib/client/browser',
'node-fetch',
'rpc-websockets',
'rpc-websockets/dist/lib/client',
'rpc-websockets/dist/lib/client/client.types',
'rpc-websockets/dist/lib/client/websocket',
'rpc-websockets/dist/lib/client/websocket.browser',
'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',
];
}
Expand Down Expand Up @@ -182,10 +182,10 @@ function generateConfig(configType, format) {
'node-fetch',
'react-native-url-polyfill',
'rpc-websockets',
'rpc-websockets/dist/lib/client',
'rpc-websockets/dist/lib/client/client.types',
'rpc-websockets/dist/lib/client/websocket',
'rpc-websockets/dist/lib/client/websocket.browser',
'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',
];

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export {default} from 'rpc-websockets/dist/lib/client/websocket.browser';
export {default} from 'rpc-websockets/dist/lib/client/websocket.browser.cjs';
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export {default} from 'rpc-websockets/dist/lib/client/websocket.browser';
export {default} from 'rpc-websockets/dist/lib/client/websocket.browser.cjs';
4 changes: 2 additions & 2 deletions packages/library-legacy/src/rpc-websocket-factory.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ICommonWebSocketFactory} from 'rpc-websockets/dist/lib/client/client.types';
import WebsocketFactory from 'rpc-websockets/dist/lib/client/websocket';
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;
12 changes: 6 additions & 6 deletions packages/library-legacy/src/rpc-websocket.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import RpcWebSocketCommonClient from 'rpc-websockets/dist/lib/client';
import RpcWebSocketBrowserFactory from 'rpc-websockets/dist/lib/client/websocket.browser';
import RpcWebSocketCommonClient from 'rpc-websockets/dist/lib/client.cjs';
import WebSocketBrowserImpl from 'rpc-websockets/dist/lib/client/websocket.cjs';
import {
ICommonWebSocket,
IWSClientAdditionalOptions,
NodeWebSocketType,
NodeWebSocketTypeOptions,
} from 'rpc-websockets/dist/lib/client/client.types';
} from 'rpc-websockets/dist/lib/client/client.types.cjs';

import createRpc from './rpc-websocket-factory';

Expand All @@ -32,9 +32,9 @@ export default class RpcWebSocketClient extends RpcWebSocketCommonClient {
...options,
});
if ('socket' in rpc) {
this.underlyingSocket = (
rpc as ReturnType<typeof RpcWebSocketBrowserFactory>
).socket;
this.underlyingSocket = rpc.socket as ReturnType<
typeof WebSocketBrowserImpl
>;
} else {
this.underlyingSocket = rpc as NodeWebSocketType;
}
Expand Down
78 changes: 19 additions & 59 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@
"inputs": ["$TURBO_DEFAULT$", "src/**", "test/**"]
},
"@solana/web3.js#test:live-with-test-validator": {
"dependsOn": ["^compile:js"],
"dependsOn": ["compile:js"],
"inputs": ["$TURBO_DEFAULT$", "src/**", "test/**"]
},
"@solana/web3.js#test:typecheck": {
"dependsOn": ["^compile:typedefs"],
"dependsOn": ["compile:typedefs"],
"inputs": ["$TURBO_DEFAULT$", "src/**", "test/**", "tsconfig.*"]
},
"@solana/web3.js#test:unit:node": {
"dependsOn": ["^compile:js"],
"dependsOn": ["compile:js"],
"inputs": ["$TURBO_DEFAULT$", "src/**", "test/**"]
}
},
Expand Down

0 comments on commit 5527b0e

Please sign in to comment.