@idosgames/wallet 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +16 -1
  2. package/package.json +6 -1
package/README.md CHANGED
@@ -28,12 +28,27 @@ npm i wagmi viem @tanstack/react-query
28
28
  npm i @solana/web3.js @solana/wallet-adapter-react @solana/wallet-adapter-base @solana/wallet-adapter-wallets
29
29
  ```
30
30
 
31
- Two entry points:
31
+ Entry points:
32
32
 
33
33
  - `@idosgames/wallet` — framework-agnostic bridge functions (viem +
34
34
  `@solana/web3.js` only). Use these directly if you're not on React.
35
35
  - `@idosgames/wallet/react` — wagmi/React hooks + providers. Everything below
36
36
  uses these.
37
+ - `@idosgames/wallet/react/solana` — the Solana React bindings, kept off
38
+ `/react` so an EVM-only game doesn't bundle the Solana adapters.
39
+ - `@idosgames/wallet/react/lazy` — `LazyWalletLogin` /
40
+ `LazySolanaWalletLogin`: the same sign-in button, but it fetches the wallet
41
+ machinery on the player's first tap. This is the only entry with **no Reown
42
+ AppKit in its module graph**, which is what makes it safe on a login screen
43
+ in sandboxed/preview bundlers where AppKit isn't installable. It also
44
+ re-exports the supported chains as plain objects, so a login screen never has
45
+ to import the `wagmi/chains` / `viem/chains` barrel.
46
+
47
+ Every subpath declares a `browser` export condition pointing at the ESM build.
48
+ That is load-bearing, not cosmetic: some browser bundlers (CodeSandbox's
49
+ classic Sandpack bundler among them) rank the `require` condition above
50
+ `import` and would otherwise take the CommonJS build — where a dynamic
51
+ `import()` cannot survive, so the lazy entry would eagerly require AppKit.
37
52
 
38
53
  ## Operation category
39
54
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idosgames/wallet",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Wallet-bridge companion to @idosgames/core: connect browser & mobile wallets (EVM via wagmi/viem/WalletConnect, Solana via wallet-adapter) and move tokens/NFTs in and out of the game through client.blockchain.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -32,24 +32,29 @@
32
32
  "main": "./dist/index.cjs",
33
33
  "module": "./dist/index.js",
34
34
  "types": "./dist/index.d.ts",
35
+ "//exports": "Каждый подпуть объявляет \"browser\" -> ESM, и это НЕ косметика. Классический бандлер Sandpack (живое превью AI-кодера) матчит условия по СВОЕМУ списку приоритетов ['browser','development','default','require','import'] — 'require' ВЫШЕ 'import', то есть без 'browser' он берёт .cjs даже в браузере. Для ./react/lazy это фатально: в CJS нет ленивого импорта, tsup инлайнит туда весь ./react и поднимает require('@reown/appkit-adapter-wagmi') наверх файла — превью падает с «Could not find dependency», потому что AppKit намеренно не объявлен в зависимостях проекта (пакаджер CodeSandbox отдаёт на нём 504). С 'browser' бандлер берёт lazyIndex.js, где import() остаётся настоящим ленивым рубежом. Для остальных подпутей 'browser' держит браузерный граф на ОДНОЙ (ESM) копии модуля — иначе ленивый вход тянул бы .js, а панель кошелька .cjs, и в игре оказалось бы два независимых экземпляра wagmi. Node условие 'browser' не знает и по-прежнему получает 'require' -> .cjs. Проверено на реальном bundler'е, не по докам.",
35
36
  "exports": {
36
37
  ".": {
37
38
  "types": "./dist/index.d.ts",
39
+ "browser": "./dist/index.js",
38
40
  "import": "./dist/index.js",
39
41
  "require": "./dist/index.cjs"
40
42
  },
41
43
  "./react": {
42
44
  "types": "./dist/react/index.d.ts",
45
+ "browser": "./dist/react/index.js",
43
46
  "import": "./dist/react/index.js",
44
47
  "require": "./dist/react/index.cjs"
45
48
  },
46
49
  "./react/solana": {
47
50
  "types": "./dist/react/solanaIndex.d.ts",
51
+ "browser": "./dist/react/solanaIndex.js",
48
52
  "import": "./dist/react/solanaIndex.js",
49
53
  "require": "./dist/react/solanaIndex.cjs"
50
54
  },
51
55
  "./react/lazy": {
52
56
  "types": "./dist/react/lazyIndex.d.ts",
57
+ "browser": "./dist/react/lazyIndex.js",
53
58
  "import": "./dist/react/lazyIndex.js",
54
59
  "require": "./dist/react/lazyIndex.cjs"
55
60
  }