@yodlpay/react-native 0.1.2 → 0.1.3

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.
package/package.json CHANGED
@@ -1,9 +1,22 @@
1
1
  {
2
2
  "name": "@yodlpay/react-native",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "description": "Yodl React Native SDK — drop-in components for EIP-1193 wallets",
6
- "license": "MIT",
6
+ "keywords": [
7
+ "yodl",
8
+ "payments",
9
+ "crypto",
10
+ "stablecoin",
11
+ "web3",
12
+ "wallet",
13
+ "react-native",
14
+ "expo",
15
+ "eip-1193",
16
+ "eip-5792",
17
+ "qr"
18
+ ],
19
+ "license": "BUSL-1.1",
7
20
  "engines": {
8
21
  "node": ">=18"
9
22
  },
@@ -25,8 +38,7 @@
25
38
  "types": "./dist/index.d.cts",
26
39
  "default": "./dist/index.cjs"
27
40
  }
28
- },
29
- "./metro-config": "./metro-config.cjs"
41
+ }
30
42
  },
31
43
  "repository": {
32
44
  "type": "git",
@@ -44,8 +56,9 @@
44
56
  "dist/**/*.mjs",
45
57
  "dist/**/*.d.cts",
46
58
  "dist/**/*.d.mts",
47
- "metro-config.cjs",
48
- "README.md"
59
+ "README.md",
60
+ "LICENSE.md",
61
+ "THIRD_PARTY_NOTICES.txt"
49
62
  ],
50
63
  "peerDependencies": {
51
64
  "react": ">=18.0.0",
package/metro-config.cjs DELETED
@@ -1,95 +0,0 @@
1
- /**
2
- * Metro configuration helper for apps using @yodlpay/react-native via local `file:` linking.
3
- *
4
- * Usage in your app's metro.config.js:
5
- *
6
- * ```js
7
- * const { getDefaultConfig } = require('expo/metro-config');
8
- * const { withYodlReactNative } = require('@yodlpay/react-native/metro-config');
9
- *
10
- * const config = getDefaultConfig(__dirname);
11
- * module.exports = withYodlReactNative(config, __dirname);
12
- * ```
13
- *
14
- * If you have a custom resolveRequest, set it BEFORE calling withYodlReactNative:
15
- *
16
- * ```js
17
- * config.resolver.resolveRequest = myCustomResolver;
18
- * module.exports = withYodlReactNative(config, __dirname);
19
- * ```
20
- */
21
- const path = require('node:path');
22
- const fs = require('node:fs');
23
-
24
- /**
25
- * Decide whether a bare module specifier should resolve from the consumer's
26
- * project root instead of the linked workspace.
27
- *
28
- * When linked via `file:`, Metro bundles the SDK's compiled output straight
29
- * out of the sibling workspace. The SDK keeps its peer deps external (`react`,
30
- * `react-native`, `react-native-webview`) so those would otherwise resolve into
31
- * the workspace's pnpm store, a directory that lives *outside* the consumer's
32
- * project root. Metro can't represent those sibling paths and emits broken
33
- * specifiers.
34
- *
35
- * Deps the consumer installs itself (e.g. `react`, `react-native-webview`) live
36
- * under the project root, so resolving them from there avoids the broken
37
- * sibling paths and guarantees a single instance. Anything else (the SDK's own
38
- * bundled deps are already inlined, so this is mainly a defensive fallback)
39
- * resolves from the workspace (see the `try/catch` in `resolveRequest`).
40
- */
41
- function shouldResolveFromApp(moduleName) {
42
- // Relative / absolute imports and node builtins resolve normally
43
- if (moduleName.startsWith('.') || moduleName.startsWith('/') || moduleName.startsWith('node:')) {
44
- return false;
45
- }
46
- // First-party workspace packages must resolve through the linked workspace
47
- if (moduleName === '@yodlpay' || moduleName.startsWith('@yodlpay/')) {
48
- return false;
49
- }
50
- return true;
51
- }
52
-
53
- function withYodlReactNative(config, projectRoot) {
54
- // Resolve the real path of the linked package (follows symlinks)
55
- const yodlPkgDir = fs.realpathSync(
56
- path.resolve(projectRoot, 'node_modules/@yodlpay/react-native'),
57
- );
58
- const workspaceRoot = path.resolve(yodlPkgDir, '../..');
59
-
60
- // Watch the linked workspace for live reloading
61
- config.watchFolders = [...(config.watchFolders || []), workspaceRoot];
62
-
63
- // Capture any existing resolveRequest the user already set
64
- config.resolver = config.resolver || {};
65
- const userResolveRequest = config.resolver.resolveRequest || null;
66
-
67
- const resolve = (ctx, name, plat) =>
68
- userResolveRequest ? userResolveRequest(ctx, name, plat) : ctx.resolveRequest(ctx, name, plat);
69
-
70
- config.resolver.resolveRequest = (context, moduleName, platform) => {
71
- // When a third-party dep is imported from within the linked workspace,
72
- // first try to resolve it from the consumer's project root. This keeps the
73
- // app's own deps (react, react-native, react-native-webview, ...) as single instances
74
- // and sidesteps the broken sibling-path resolution.
75
- if (context.originModulePath?.includes(workspaceRoot) && shouldResolveFromApp(moduleName)) {
76
- const redirectedContext = {
77
- ...context,
78
- originModulePath: path.resolve(projectRoot, '_virtual.js'),
79
- };
80
- try {
81
- return resolve(redirectedContext, moduleName, platform);
82
- } catch {
83
- // Workspace-only dependency that the
84
- // consumer app doesn't install — fall back to workspace resolution.
85
- }
86
- }
87
-
88
- // Otherwise delegate to the user's resolveRequest or Metro's default
89
- return resolve(context, moduleName, platform);
90
- };
91
-
92
- return config;
93
- }
94
-
95
- module.exports = { withYodlReactNative };