@yodlpay/react-native 0.1.0 → 0.1.1
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/README.md +98 -140
- package/dist/index.cjs +66 -8
- package/dist/index.d.cts +87 -31
- package/dist/index.d.mts +87 -31
- package/dist/index.mjs +66 -9
- package/metro-config.cjs +12 -13
- package/package.json +7 -9
package/metro-config.cjs
CHANGED
|
@@ -26,18 +26,17 @@ const fs = require('node:fs');
|
|
|
26
26
|
* project root instead of the linked workspace.
|
|
27
27
|
*
|
|
28
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 (`
|
|
30
|
-
* `react
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* `./yodl-sdk/node_modules/.pnpm/ox@.../index`.
|
|
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.
|
|
35
34
|
*
|
|
36
|
-
* Deps the consumer installs itself (e.g. `
|
|
37
|
-
* the project root, so resolving them from there avoids the broken
|
|
38
|
-
* paths and guarantees a single instance. Anything else (the SDK's own
|
|
39
|
-
* deps are already inlined, so this is mainly a defensive fallback)
|
|
40
|
-
* from the workspace (see the `try/catch` in `resolveRequest`).
|
|
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`).
|
|
41
40
|
*/
|
|
42
41
|
function shouldResolveFromApp(moduleName) {
|
|
43
42
|
// Relative / absolute imports and node builtins resolve normally
|
|
@@ -71,7 +70,7 @@ function withYodlReactNative(config, projectRoot) {
|
|
|
71
70
|
config.resolver.resolveRequest = (context, moduleName, platform) => {
|
|
72
71
|
// When a third-party dep is imported from within the linked workspace,
|
|
73
72
|
// first try to resolve it from the consumer's project root. This keeps the
|
|
74
|
-
// app's own deps (react, react-native,
|
|
73
|
+
// app's own deps (react, react-native, react-native-webview, ...) as single instances
|
|
75
74
|
// and sidesteps the broken sibling-path resolution.
|
|
76
75
|
if (context.originModulePath?.includes(workspaceRoot) && shouldResolveFromApp(moduleName)) {
|
|
77
76
|
const redirectedContext = {
|
|
@@ -81,7 +80,7 @@ function withYodlReactNative(config, projectRoot) {
|
|
|
81
80
|
try {
|
|
82
81
|
return resolve(redirectedContext, moduleName, platform);
|
|
83
82
|
} catch {
|
|
84
|
-
// Workspace-only dependency
|
|
83
|
+
// Workspace-only dependency that the
|
|
85
84
|
// consumer app doesn't install — fall back to workspace resolution.
|
|
86
85
|
}
|
|
87
86
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yodlpay/react-native",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Yodl React Native SDK —
|
|
5
|
+
"description": "Yodl React Native SDK — drop-in components for EIP-1193 wallets",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=18"
|
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
"react-native": "./dist/index.cjs",
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
|
-
"react-native":
|
|
16
|
+
"react-native": {
|
|
17
|
+
"types": "./dist/index.d.mts",
|
|
18
|
+
"default": "./dist/index.cjs"
|
|
19
|
+
},
|
|
17
20
|
"import": {
|
|
18
21
|
"types": "./dist/index.d.mts",
|
|
19
22
|
"default": "./dist/index.mjs"
|
|
@@ -44,14 +47,10 @@
|
|
|
44
47
|
"metro-config.cjs",
|
|
45
48
|
"README.md"
|
|
46
49
|
],
|
|
47
|
-
"dependencies": {
|
|
48
|
-
"permissionless": "^0.3.6"
|
|
49
|
-
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"react": ">=18.0.0",
|
|
52
52
|
"react-native": ">=0.72.0",
|
|
53
|
-
"react-native-webview": ">=13.0.0"
|
|
54
|
-
"viem": ">=2.0.0"
|
|
53
|
+
"react-native-webview": ">=13.0.0"
|
|
55
54
|
},
|
|
56
55
|
"devDependencies": {
|
|
57
56
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
@@ -62,7 +61,6 @@
|
|
|
62
61
|
"react-native-webview": "^13.12.0",
|
|
63
62
|
"tsdown": "^0.22.0",
|
|
64
63
|
"typescript": "^5.7.2",
|
|
65
|
-
"viem": "^2.50.4",
|
|
66
64
|
"vitest": "^4.1.7",
|
|
67
65
|
"@yodlpay/sdk-core": "0.1.0"
|
|
68
66
|
},
|