From 6fb5d3f5baf0a35fd179c049a0cb112c04139e20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9lcio=20Franco?= Date: Thu, 9 May 2024 09:00:31 -0400 Subject: [PATCH] fix: export walletconnect and evm separate (#73) --- .changeset/famous-bears-shout.md | 5 +++++ examples/react-app/src/main.tsx | 2 +- examples/react-next/src/components/Providers.tsx | 2 +- packages/connectors/package.json | 10 ++++++++++ packages/connectors/src/defaultConnectors.ts | 2 -- packages/connectors/src/evm-connector/index.ts | 1 + packages/connectors/src/index.ts | 2 -- .../connectors/src/walletconnect-connector/index.ts | 1 + packages/connectors/tsup.config.js | 6 +++++- 9 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 .changeset/famous-bears-shout.md create mode 100644 packages/connectors/src/evm-connector/index.ts create mode 100644 packages/connectors/src/walletconnect-connector/index.ts diff --git a/.changeset/famous-bears-shout.md b/.changeset/famous-bears-shout.md new file mode 100644 index 00000000..e42abf46 --- /dev/null +++ b/.changeset/famous-bears-shout.md @@ -0,0 +1,5 @@ +--- +"@fuels/connectors": minor +--- + +fix: bundle only browser-compatible connectors in the main bundle diff --git a/examples/react-app/src/main.tsx b/examples/react-app/src/main.tsx index bf91f39e..b35e1292 100644 --- a/examples/react-app/src/main.tsx +++ b/examples/react-app/src/main.tsx @@ -13,8 +13,8 @@ import { FuelWalletConnector, FuelWalletDevelopmentConnector, FueletWalletConnector, - WalletConnectConnector, } from '@fuels/connectors'; +import { WalletConnectConnector } from '@fuels/connectors/walletconnect'; import { FuelProvider } from '@fuels/react'; import * as Toast from '@radix-ui/react-toast'; diff --git a/examples/react-next/src/components/Providers.tsx b/examples/react-next/src/components/Providers.tsx index 27e9ac60..57c12075 100644 --- a/examples/react-next/src/components/Providers.tsx +++ b/examples/react-next/src/components/Providers.tsx @@ -7,8 +7,8 @@ import { FuelWalletConnector, FuelWalletDevelopmentConnector, FueletWalletConnector, - WalletConnectConnector, } from '@fuels/connectors'; +import { WalletConnectConnector } from '@fuels/connectors/walletconnect'; import { FuelProvider } from '@fuels/react'; const queryClient = new QueryClient(); diff --git a/packages/connectors/package.json b/packages/connectors/package.json index d69b5877..a31f5857 100644 --- a/packages/connectors/package.json +++ b/packages/connectors/package.json @@ -9,6 +9,16 @@ "require": "./dist/index.js", "import": "./dist/index.mjs", "types": "./dist/index.d.ts" + }, + "./walletconnect": { + "require": "./dist/walletconnect-connector/index.js", + "import": "./dist/walletconnect-connector/index.mjs", + "types": "./dist/walletconnect-connector/src/index.d.ts" + }, + "./evm": { + "require": "./dist/evm-connector/index.js", + "import": "./dist/evm-connector/index.mjs", + "types": "./dist/evm-connector/src/index.d.ts" } }, "files": ["dist"], diff --git a/packages/connectors/src/defaultConnectors.ts b/packages/connectors/src/defaultConnectors.ts index df61b63a..bc9bbf3e 100644 --- a/packages/connectors/src/defaultConnectors.ts +++ b/packages/connectors/src/defaultConnectors.ts @@ -2,7 +2,6 @@ import { BurnerWalletConnector } from '@fuel-connectors/burner-wallet-connector' import { FuelWalletDevelopmentConnector } from '@fuel-connectors/fuel-development-wallet'; import { FuelWalletConnector } from '@fuel-connectors/fuel-wallet'; import { FueletWalletConnector } from '@fuel-connectors/fuelet-wallet'; -import { WalletConnectConnector } from '@fuel-connectors/walletconnect-connector'; import type { FuelConnector } from 'fuels'; type DefaultConnectors = { @@ -15,7 +14,6 @@ export function defaultConnectors({ const connectors = [ new FuelWalletConnector(), new FueletWalletConnector(), - new WalletConnectConnector(), new BurnerWalletConnector(), ]; diff --git a/packages/connectors/src/evm-connector/index.ts b/packages/connectors/src/evm-connector/index.ts new file mode 100644 index 00000000..4e16f47e --- /dev/null +++ b/packages/connectors/src/evm-connector/index.ts @@ -0,0 +1 @@ +export * from '@fuel-connectors/evm-connector'; diff --git a/packages/connectors/src/index.ts b/packages/connectors/src/index.ts index f8b25c92..80cc354d 100644 --- a/packages/connectors/src/index.ts +++ b/packages/connectors/src/index.ts @@ -2,6 +2,4 @@ export * from './defaultConnectors'; export * from '@fuel-connectors/fuel-development-wallet'; export * from '@fuel-connectors/fuel-wallet'; export * from '@fuel-connectors/fuelet-wallet'; -export * from '@fuel-connectors/evm-connector'; -export * from '@fuel-connectors/walletconnect-connector'; export * from '@fuel-connectors/burner-wallet-connector'; diff --git a/packages/connectors/src/walletconnect-connector/index.ts b/packages/connectors/src/walletconnect-connector/index.ts new file mode 100644 index 00000000..ef6c5e4e --- /dev/null +++ b/packages/connectors/src/walletconnect-connector/index.ts @@ -0,0 +1 @@ +export * from '@fuel-connectors/walletconnect-connector'; diff --git a/packages/connectors/tsup.config.js b/packages/connectors/tsup.config.js index 37f09c79..29d19c94 100644 --- a/packages/connectors/tsup.config.js +++ b/packages/connectors/tsup.config.js @@ -3,7 +3,11 @@ import { defineConfig } from 'tsup'; export default defineConfig((options) => ({ ...baseConfig(options, { withReact: false }), - entry: ['src/index.ts'], + entry: [ + 'src/index.ts', + 'src/walletconnect-connector/index.ts', + 'src/evm-connector/index.ts', + ], external: ['fuels'], noExternal: [ '@fuel-connectors/fuel-development-wallet',