From f3bb59597e49dbc333cc1448d8a7b10549506a03 Mon Sep 17 00:00:00 2001 From: Felicio Mununga Date: Wed, 3 May 2023 14:48:16 +0200 Subject: [PATCH] Fix `@status-im/js` build (#389) * build cjs * change mod exports * tmp: add rebuild script * export peers * user browser field * rm tmp changes --- packages/status-js/package.json | 13 ++++++------- packages/status-js/src/index.ts | 7 ++----- packages/status-js/vite.config.ts | 4 +--- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/packages/status-js/package.json b/packages/status-js/package.json index 1f5ec0eb..2bfcfecf 100644 --- a/packages/status-js/package.json +++ b/packages/status-js/package.json @@ -3,13 +3,9 @@ "version": "0.1.1", "license": "MIT OR Apache-2.0", "type": "module", - "exports": { - "types": "./dist/types/index.d.ts", - "import": "./dist/index.es.js", - "default": "./dist/index.es.js" - }, - "module": "dist/index.es.js", - "types": "dist/types/index.d.ts", + "main": "./dist/index.cjs", + "module": "./dist/index.js", + "types": "./dist/types/index.d.ts", "repository": { "url": "https://github.com/status-im/status-web.git", "directory": "packages/status-js", @@ -54,5 +50,8 @@ ], "publishConfig": { "access": "public" + }, + "browser": { + "./src/utils/encode-url-data": false } } diff --git a/packages/status-js/src/index.ts b/packages/status-js/src/index.ts index 591e9412..0a0ce10e 100644 --- a/packages/status-js/src/index.ts +++ b/packages/status-js/src/index.ts @@ -11,6 +11,7 @@ export { createClient } from './client/client' export type { Community } from './client/community/community' export type { Reaction, Reactions } from './client/community/get-reactions' export type { Member } from './client/member' +export { peers } from './consts/peers' export { EthereumClient } from './ethereum-client/ethereum-client' export type { ChannelInfo } from './request-client/map-channel' export type { CommunityInfo } from './request-client/map-community' @@ -18,10 +19,6 @@ export type { UserInfo } from './request-client/map-user' export { RequestClient } from './request-client/request-client' export { createRequestClient } from './request-client/request-client' export { deserializePublicKey } from './utils/deserialize-public-key' -export { - decodeChannelURLData, - decodeCommunityURLData, - decodeUserURLData, -} from './utils/encode-url-data' +export * from './utils/encode-url-data' export { publicKeyToEmojiHash } from './utils/public-key-to-emoji-hash' export { verifyEncodedURLData } from './utils/sign-url-data' diff --git a/packages/status-js/vite.config.ts b/packages/status-js/vite.config.ts index 3734ccd5..56babaa4 100644 --- a/packages/status-js/vite.config.ts +++ b/packages/status-js/vite.config.ts @@ -1,5 +1,3 @@ -/// - import { defineConfig } from 'vite' import { dependencies } from './package.json' @@ -30,7 +28,7 @@ export default defineConfig(({ mode }) => { lib: { entry: './src/index.ts', fileName: 'index', - formats: ['es'], + formats: ['es', 'cjs'], }, sourcemap: true, emptyOutDir: mode === 'production',