create-crossbind 2.0.0-beta.50

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 (235) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +63 -0
  3. package/package.json +47 -0
  4. package/src/index.js +182 -0
  5. package/src/manifest.json +14 -0
  6. package/src/utils.js +8 -0
  7. package/templates/backend-nodejs-wasm/CHANGELOG.md +34 -0
  8. package/templates/backend-nodejs-wasm/README.md +32 -0
  9. package/templates/backend-nodejs-wasm/crossbind.config.mjs +14 -0
  10. package/templates/backend-nodejs-wasm/package.json +25 -0
  11. package/templates/backend-nodejs-wasm/src/index.js +5 -0
  12. package/templates/backend-nodejs-wasm/src/index.mjs +5 -0
  13. package/templates/backend-nodejs-wasm/src/native/native.cpp +9 -0
  14. package/templates/backend-nodejs-wasm/src/native/native.h +12 -0
  15. package/templates/cloud-cloudflare-worker/CHANGELOG.md +27 -0
  16. package/templates/cloud-cloudflare-worker/Readme.md +46 -0
  17. package/templates/cloud-cloudflare-worker/crossbind.config.mjs +9 -0
  18. package/templates/cloud-cloudflare-worker/e2e/crossbind.spec.cjs +7 -0
  19. package/templates/cloud-cloudflare-worker/index.js +10 -0
  20. package/templates/cloud-cloudflare-worker/package.json +38 -0
  21. package/templates/cloud-cloudflare-worker/playwright.dev.config.cjs +48 -0
  22. package/templates/cloud-cloudflare-worker/src/native/native.cpp +5 -0
  23. package/templates/cloud-cloudflare-worker/src/native/native.h +11 -0
  24. package/templates/cloud-cloudflare-worker/wrangler.toml +3 -0
  25. package/templates/lib-cmake/CHANGELOG.md +20 -0
  26. package/templates/lib-cmake/CMakeLists.txt +16 -0
  27. package/templates/lib-cmake/README.md +51 -0
  28. package/templates/lib-cmake/crossbind.config.js +9 -0
  29. package/templates/lib-cmake/package.json +16 -0
  30. package/templates/lib-cmake/src/native/crossbind-lib-samplebasic-cmake/samplebasiccmake.h +11 -0
  31. package/templates/lib-cmake/src/native/samplebasiccmake.cpp +5 -0
  32. package/templates/lib-prebuilt/AGENTS.md +78 -0
  33. package/templates/lib-prebuilt/CHANGELOG.md +20 -0
  34. package/templates/lib-prebuilt/README.md +81 -0
  35. package/templates/lib-prebuilt/crossbind-example-lib-prebuilt-matrix.podspec +21 -0
  36. package/templates/lib-prebuilt/crossbind.config.js +13 -0
  37. package/templates/lib-prebuilt/package.json +36 -0
  38. package/templates/lib-prebuilt/playground/Matrix.js +19 -0
  39. package/templates/lib-prebuilt/playground/index.html +74 -0
  40. package/templates/lib-prebuilt/src/native/Matrix.cpp +17 -0
  41. package/templates/lib-prebuilt/src/native/Matrix.h +12 -0
  42. package/templates/lib-source/CHANGELOG.md +20 -0
  43. package/templates/lib-source/README.md +51 -0
  44. package/templates/lib-source/crossbind.config.js +8 -0
  45. package/templates/lib-source/package.json +12 -0
  46. package/templates/lib-source/src/native/crossbind-lib-samplebasic/samplebasic.h +13 -0
  47. package/templates/mobile-reactnative-cli/.bundle/config +2 -0
  48. package/templates/mobile-reactnative-cli/.eslintrc.js +4 -0
  49. package/templates/mobile-reactnative-cli/.prettierrc.js +7 -0
  50. package/templates/mobile-reactnative-cli/AGENTS.md +89 -0
  51. package/templates/mobile-reactnative-cli/CHANGELOG.md +38 -0
  52. package/templates/mobile-reactnative-cli/Gemfile +20 -0
  53. package/templates/mobile-reactnative-cli/README.md +55 -0
  54. package/templates/mobile-reactnative-cli/__tests__/App.test.tsx +13 -0
  55. package/templates/mobile-reactnative-cli/android/app/build.gradle +119 -0
  56. package/templates/mobile-reactnative-cli/android/app/debug.keystore +0 -0
  57. package/templates/mobile-reactnative-cli/android/app/proguard-rules.pro +10 -0
  58. package/templates/mobile-reactnative-cli/android/app/src/debug/AndroidManifest.xml +9 -0
  59. package/templates/mobile-reactnative-cli/android/app/src/main/AndroidManifest.xml +27 -0
  60. package/templates/mobile-reactnative-cli/android/app/src/main/java/dev/crossbind/sampleReactNativeCLI/MainActivity.kt +22 -0
  61. package/templates/mobile-reactnative-cli/android/app/src/main/java/dev/crossbind/sampleReactNativeCLI/MainApplication.kt +27 -0
  62. package/templates/mobile-reactnative-cli/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
  63. package/templates/mobile-reactnative-cli/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  64. package/templates/mobile-reactnative-cli/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  65. package/templates/mobile-reactnative-cli/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  66. package/templates/mobile-reactnative-cli/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  67. package/templates/mobile-reactnative-cli/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  68. package/templates/mobile-reactnative-cli/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  69. package/templates/mobile-reactnative-cli/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  70. package/templates/mobile-reactnative-cli/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  71. package/templates/mobile-reactnative-cli/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  72. package/templates/mobile-reactnative-cli/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  73. package/templates/mobile-reactnative-cli/android/app/src/main/res/values/strings.xml +3 -0
  74. package/templates/mobile-reactnative-cli/android/app/src/main/res/values/styles.xml +9 -0
  75. package/templates/mobile-reactnative-cli/android/build.gradle +21 -0
  76. package/templates/mobile-reactnative-cli/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  77. package/templates/mobile-reactnative-cli/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  78. package/templates/mobile-reactnative-cli/android/gradle.properties +44 -0
  79. package/templates/mobile-reactnative-cli/android/gradlew +248 -0
  80. package/templates/mobile-reactnative-cli/android/gradlew.bat +98 -0
  81. package/templates/mobile-reactnative-cli/android/settings.gradle +6 -0
  82. package/templates/mobile-reactnative-cli/app.json +4 -0
  83. package/templates/mobile-reactnative-cli/babel.config.js +3 -0
  84. package/templates/mobile-reactnative-cli/ci/crossbind-snapshot/cache.json +12 -0
  85. package/templates/mobile-reactnative-cli/crossbind.config.mjs +10 -0
  86. package/templates/mobile-reactnative-cli/index.js +9 -0
  87. package/templates/mobile-reactnative-cli/ios/.xcode.env +11 -0
  88. package/templates/mobile-reactnative-cli/ios/Podfile +42 -0
  89. package/templates/mobile-reactnative-cli/ios/crossbindSampleReactNativeCLI/AppDelegate.swift +48 -0
  90. package/templates/mobile-reactnative-cli/ios/crossbindSampleReactNativeCLI/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  91. package/templates/mobile-reactnative-cli/ios/crossbindSampleReactNativeCLI/Images.xcassets/Contents.json +6 -0
  92. package/templates/mobile-reactnative-cli/ios/crossbindSampleReactNativeCLI/Info.plist +60 -0
  93. package/templates/mobile-reactnative-cli/ios/crossbindSampleReactNativeCLI/LaunchScreen.storyboard +47 -0
  94. package/templates/mobile-reactnative-cli/ios/crossbindSampleReactNativeCLI/PrivacyInfo.xcprivacy +37 -0
  95. package/templates/mobile-reactnative-cli/ios/crossbindSampleReactNativeCLI.xcodeproj/project.pbxproj +494 -0
  96. package/templates/mobile-reactnative-cli/ios/crossbindSampleReactNativeCLI.xcodeproj/xcshareddata/xcschemes/crossbindSampleReactNativeCLI.xcscheme +88 -0
  97. package/templates/mobile-reactnative-cli/ios/crossbindSampleReactNativeCLI.xcworkspace/contents.xcworkspacedata +10 -0
  98. package/templates/mobile-reactnative-cli/jest.config.js +3 -0
  99. package/templates/mobile-reactnative-cli/maestro.yaml +4 -0
  100. package/templates/mobile-reactnative-cli/metro.config.js +17 -0
  101. package/templates/mobile-reactnative-cli/package.json +68 -0
  102. package/templates/mobile-reactnative-cli/src/App.tsx +53 -0
  103. package/templates/mobile-reactnative-cli/src/native/native.cpp +9 -0
  104. package/templates/mobile-reactnative-cli/src/native/native.h +12 -0
  105. package/templates/mobile-reactnative-cli/tsconfig.json +16 -0
  106. package/templates/mobile-reactnative-expo/README.md +34 -0
  107. package/templates/mobile-reactnative-expo/app.json +51 -0
  108. package/templates/mobile-reactnative-expo/assets/expo.icon/Assets/expo-symbol 2.svg +3 -0
  109. package/templates/mobile-reactnative-expo/assets/expo.icon/Assets/grid.png +0 -0
  110. package/templates/mobile-reactnative-expo/assets/expo.icon/icon.json +40 -0
  111. package/templates/mobile-reactnative-expo/assets/images/android-icon-background.png +0 -0
  112. package/templates/mobile-reactnative-expo/assets/images/android-icon-foreground.png +0 -0
  113. package/templates/mobile-reactnative-expo/assets/images/android-icon-monochrome.png +0 -0
  114. package/templates/mobile-reactnative-expo/assets/images/expo-badge-white.png +0 -0
  115. package/templates/mobile-reactnative-expo/assets/images/expo-badge.png +0 -0
  116. package/templates/mobile-reactnative-expo/assets/images/expo-logo.png +0 -0
  117. package/templates/mobile-reactnative-expo/assets/images/favicon.png +0 -0
  118. package/templates/mobile-reactnative-expo/assets/images/icon.png +0 -0
  119. package/templates/mobile-reactnative-expo/assets/images/logo-glow.png +0 -0
  120. package/templates/mobile-reactnative-expo/assets/images/react-logo.png +0 -0
  121. package/templates/mobile-reactnative-expo/assets/images/react-logo@2x.png +0 -0
  122. package/templates/mobile-reactnative-expo/assets/images/react-logo@3x.png +0 -0
  123. package/templates/mobile-reactnative-expo/assets/images/splash-icon.png +0 -0
  124. package/templates/mobile-reactnative-expo/assets/images/tabIcons/explore.png +0 -0
  125. package/templates/mobile-reactnative-expo/assets/images/tabIcons/explore@2x.png +0 -0
  126. package/templates/mobile-reactnative-expo/assets/images/tabIcons/explore@3x.png +0 -0
  127. package/templates/mobile-reactnative-expo/assets/images/tabIcons/home.png +0 -0
  128. package/templates/mobile-reactnative-expo/assets/images/tabIcons/home@2x.png +0 -0
  129. package/templates/mobile-reactnative-expo/assets/images/tabIcons/home@3x.png +0 -0
  130. package/templates/mobile-reactnative-expo/assets/images/tutorial-web.png +0 -0
  131. package/templates/mobile-reactnative-expo/crossbind.config.mjs +10 -0
  132. package/templates/mobile-reactnative-expo/maestro.yaml +4 -0
  133. package/templates/mobile-reactnative-expo/metro.config.js +13 -0
  134. package/templates/mobile-reactnative-expo/package-lock.json +9433 -0
  135. package/templates/mobile-reactnative-expo/package.json +82 -0
  136. package/templates/mobile-reactnative-expo/scripts/reset-project.js +113 -0
  137. package/templates/mobile-reactnative-expo/src/app/_layout.tsx +16 -0
  138. package/templates/mobile-reactnative-expo/src/app/explore.tsx +181 -0
  139. package/templates/mobile-reactnative-expo/src/app/index.tsx +110 -0
  140. package/templates/mobile-reactnative-expo/src/components/animated-icon.module.css +6 -0
  141. package/templates/mobile-reactnative-expo/src/components/animated-icon.tsx +132 -0
  142. package/templates/mobile-reactnative-expo/src/components/animated-icon.web.tsx +108 -0
  143. package/templates/mobile-reactnative-expo/src/components/app-tabs.tsx +33 -0
  144. package/templates/mobile-reactnative-expo/src/components/app-tabs.web.tsx +116 -0
  145. package/templates/mobile-reactnative-expo/src/components/external-link.tsx +25 -0
  146. package/templates/mobile-reactnative-expo/src/components/hint-row.tsx +35 -0
  147. package/templates/mobile-reactnative-expo/src/components/themed-text.tsx +73 -0
  148. package/templates/mobile-reactnative-expo/src/components/themed-view.tsx +16 -0
  149. package/templates/mobile-reactnative-expo/src/components/ui/collapsible.tsx +65 -0
  150. package/templates/mobile-reactnative-expo/src/components/web-badge.tsx +44 -0
  151. package/templates/mobile-reactnative-expo/src/constants/theme.ts +65 -0
  152. package/templates/mobile-reactnative-expo/src/global.css +9 -0
  153. package/templates/mobile-reactnative-expo/src/hooks/use-color-scheme.ts +1 -0
  154. package/templates/mobile-reactnative-expo/src/hooks/use-color-scheme.web.ts +21 -0
  155. package/templates/mobile-reactnative-expo/src/hooks/use-theme.ts +14 -0
  156. package/templates/mobile-reactnative-expo/src/native/native.cpp +9 -0
  157. package/templates/mobile-reactnative-expo/src/native/native.h +12 -0
  158. package/templates/mobile-reactnative-expo/tsconfig.json +20 -0
  159. package/templates/web-react-rspack/CHANGELOG.md +35 -0
  160. package/templates/web-react-rspack/README.md +38 -0
  161. package/templates/web-react-rspack/crossbind.config.mjs +13 -0
  162. package/templates/web-react-rspack/e2e/crossbind.spec.cjs +7 -0
  163. package/templates/web-react-rspack/index.html +11 -0
  164. package/templates/web-react-rspack/package.json +44 -0
  165. package/templates/web-react-rspack/playwright.dev.config.cjs +48 -0
  166. package/templates/web-react-rspack/playwright.prod.config.cjs +52 -0
  167. package/templates/web-react-rspack/rspack.config.mjs +78 -0
  168. package/templates/web-react-rspack/src/App.css +41 -0
  169. package/templates/web-react-rspack/src/App.jsx +19 -0
  170. package/templates/web-react-rspack/src/index.css +70 -0
  171. package/templates/web-react-rspack/src/main.jsx +10 -0
  172. package/templates/web-react-rspack/src/native/native.cpp +9 -0
  173. package/templates/web-react-rspack/src/native/native.h +12 -0
  174. package/templates/web-react-vite/CHANGELOG.md +34 -0
  175. package/templates/web-react-vite/README.md +38 -0
  176. package/templates/web-react-vite/crossbind.config.js +13 -0
  177. package/templates/web-react-vite/e2e/crossbind.spec.cjs +7 -0
  178. package/templates/web-react-vite/eslint.config.js +38 -0
  179. package/templates/web-react-vite/index.html +13 -0
  180. package/templates/web-react-vite/package.json +44 -0
  181. package/templates/web-react-vite/playwright.dev.config.cjs +48 -0
  182. package/templates/web-react-vite/playwright.prod.config.cjs +52 -0
  183. package/templates/web-react-vite/public/vite.svg +1 -0
  184. package/templates/web-react-vite/src/App.css +42 -0
  185. package/templates/web-react-vite/src/App.jsx +21 -0
  186. package/templates/web-react-vite/src/assets/react.svg +1 -0
  187. package/templates/web-react-vite/src/index.css +68 -0
  188. package/templates/web-react-vite/src/main.jsx +10 -0
  189. package/templates/web-react-vite/src/native/native.cpp +9 -0
  190. package/templates/web-react-vite/src/native/native.h +12 -0
  191. package/templates/web-react-vite/vite.config.js +8 -0
  192. package/templates/web-svelte-vite/CHANGELOG.md +34 -0
  193. package/templates/web-svelte-vite/README.md +38 -0
  194. package/templates/web-svelte-vite/crossbind.config.js +13 -0
  195. package/templates/web-svelte-vite/e2e/crossbind.spec.cjs +7 -0
  196. package/templates/web-svelte-vite/index.html +13 -0
  197. package/templates/web-svelte-vite/jsconfig.json +32 -0
  198. package/templates/web-svelte-vite/package.json +35 -0
  199. package/templates/web-svelte-vite/playwright.dev.config.cjs +48 -0
  200. package/templates/web-svelte-vite/playwright.prod.config.cjs +52 -0
  201. package/templates/web-svelte-vite/public/vite.svg +1 -0
  202. package/templates/web-svelte-vite/src/App.svelte +12 -0
  203. package/templates/web-svelte-vite/src/app.css +79 -0
  204. package/templates/web-svelte-vite/src/main.js +9 -0
  205. package/templates/web-svelte-vite/src/native/native.cpp +9 -0
  206. package/templates/web-svelte-vite/src/native/native.h +12 -0
  207. package/templates/web-svelte-vite/src/vite-env.d.ts +2 -0
  208. package/templates/web-svelte-vite/svelte.config.js +7 -0
  209. package/templates/web-svelte-vite/vite.config.js +8 -0
  210. package/templates/web-vanilla/CHANGELOG.md +34 -0
  211. package/templates/web-vanilla/README.md +32 -0
  212. package/templates/web-vanilla/crossbind.config.mjs +14 -0
  213. package/templates/web-vanilla/e2e/crossbind.spec.cjs +7 -0
  214. package/templates/web-vanilla/index.html +37 -0
  215. package/templates/web-vanilla/package.json +29 -0
  216. package/templates/web-vanilla/playwright.prod.config.cjs +52 -0
  217. package/templates/web-vanilla/serve.json +17 -0
  218. package/templates/web-vanilla/src/native/native.cpp +9 -0
  219. package/templates/web-vanilla/src/native/native.h +12 -0
  220. package/templates/web-vue-vite/CHANGELOG.md +34 -0
  221. package/templates/web-vue-vite/README.md +38 -0
  222. package/templates/web-vue-vite/crossbind.config.js +13 -0
  223. package/templates/web-vue-vite/e2e/crossbind.spec.cjs +7 -0
  224. package/templates/web-vue-vite/index.html +13 -0
  225. package/templates/web-vue-vite/package.json +35 -0
  226. package/templates/web-vue-vite/playwright.dev.config.cjs +48 -0
  227. package/templates/web-vue-vite/playwright.prod.config.cjs +52 -0
  228. package/templates/web-vue-vite/public/vite.svg +1 -0
  229. package/templates/web-vue-vite/serve.json +17 -0
  230. package/templates/web-vue-vite/src/App.vue +14 -0
  231. package/templates/web-vue-vite/src/main.js +5 -0
  232. package/templates/web-vue-vite/src/native/native.cpp +9 -0
  233. package/templates/web-vue-vite/src/native/native.h +12 -0
  234. package/templates/web-vue-vite/src/style.css +38 -0
  235. package/templates/web-vue-vite/vite.config.js +18 -0
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@crossbind/example-lib-source",
3
+ "version": "2.0.0-beta.50",
4
+ "description": "crossbind sample library: simple source library",
5
+ "homepage": "https://github.com/crossbind/crossbind/tree/main/examples/lib-source#readme",
6
+ "repository": "https://github.com/crossbind/crossbind.git",
7
+ "license": "MIT",
8
+ "type": "module",
9
+ "keywords": [
10
+ "crossbind-sample"
11
+ ]
12
+ }
@@ -0,0 +1,13 @@
1
+ #ifndef _SAMPLE_BASIC_H
2
+ #define _SAMPLE_BASIC_H
3
+
4
+ #include <string>
5
+
6
+ class SampleBasic {
7
+ public:
8
+ static std::string sample() {
9
+ return "this message comes from basic sample lib";
10
+ }
11
+ };
12
+
13
+ #endif
@@ -0,0 +1,2 @@
1
+ BUNDLE_PATH: "vendor/bundle"
2
+ BUNDLE_FORCE_RUBY_PLATFORM: 1
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ root: true,
3
+ extends: '@react-native',
4
+ };
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ arrowParens: 'avoid',
3
+ bracketSameLine: true,
4
+ bracketSpacing: false,
5
+ singleQuote: true,
6
+ trailingComma: 'all',
7
+ };
@@ -0,0 +1,89 @@
1
+ # AGENTS.md — @crossbind/example-mobile-reactnative-cli
2
+
3
+ > Canonical reference for the **React Native CLI** integration. This sample is what `docs/playbooks/integration/react-native-cli.md` and the iOS CI workflow point at.
4
+
5
+ ## What this sample is for
6
+
7
+ - A minimal RN-cli app that loads `@crossbind/example-lib-prebuilt-matrix` and calls into it from JS.
8
+ - Reference for `metro.config.js` + `crossbind.config.mjs` shape in a bare RN project.
9
+ - Source of the **CI bridge cache** used by `.github/workflows/test-ios-sample.yml` to skip SWIG bridge generation in CI.
10
+
11
+ ## Layout
12
+
13
+ ```
14
+ examples/mobile-reactnative-cli/
15
+ ├── android/ ← bare RN Android project
16
+ ├── ios/ ← bare RN iOS project (Podfile + Podfile.lock)
17
+ ├── ci/
18
+ │ └── crossbind-snapshot/ ← bridge fixtures restored by iOS workflow
19
+ │ ├── build/bridge/native.i.cpp
20
+ │ ├── build/bridge/native.i.cpp.exports.json
21
+ │ ├── build/interface/native.i
22
+ │ └── cache.json
23
+ ├── src/ ← RN JS app
24
+ ├── app.json
25
+ ├── crossbind.config.mjs ← imports Matrix sample-lib
26
+ ├── metro.config.js ← wraps getDefaultConfig with CrossbindMetroPlugin
27
+ ├── package.json
28
+ └── playwright.{dev,prod}.config.cjs ← e2e configs
29
+ ```
30
+
31
+ ## Key files an agent will touch
32
+
33
+ - **`metro.config.js`** — exact wiring for `@crossbind/plugin-metro`. Used as the canonical example in `docs/playbooks/integration/react-native-cli.md`.
34
+ - **`crossbind.config.mjs`** — shows how to consume a workspace dep (`@crossbind/example-lib-prebuilt-matrix`).
35
+ - **`ci/crossbind-snapshot/`** — git-tracked fixtures. **Do not delete.** The iOS workflow's `cp -r ci/crossbind-snapshot/. .crossbind/` step depends on them.
36
+
37
+ ## CI bridge cache pattern
38
+
39
+ The directory is named `crossbind-snapshot/` (not `.crossbind/`) on purpose: `pnpm clear:cache:examples` and similar globs match `*/.crossbind`, which would otherwise wipe these fixtures. Renaming the snapshot dir survives clear globs.
40
+
41
+ The iOS workflow restores the snapshot **before** `pod install` so SWIG / bridge generation can be skipped in CI:
42
+
43
+ ```yaml
44
+ - name: Restore cached bridge files
45
+ run: |
46
+ mkdir -p ./examples/.../my-app/.crossbind
47
+ cp -r ./examples/.../my-app/ci/crossbind-snapshot/. ./examples/.../my-app/.crossbind/
48
+ ```
49
+
50
+ The trailing `/.` + `mkdir -p` keeps the merge nesting-safe regardless of pre-existing state in the runner.
51
+
52
+ If you regenerate the snapshot, re-commit the four files under `ci/crossbind-snapshot/build/...` and `ci/crossbind-snapshot/cache.json`.
53
+
54
+ ## Validation
55
+
56
+ Local (macOS):
57
+
58
+ ```bash
59
+ pnpm install
60
+ cd examples/mobile-reactnative-cli/ios && pod install && cd -
61
+ pnpm --filter=@crossbind/example-mobile-reactnative-cli ios
62
+
63
+ # E2E
64
+ pnpm run e2e:ios
65
+ ```
66
+
67
+ Local (Linux/macOS for Android):
68
+
69
+ ```bash
70
+ pnpm --filter=@crossbind/example-mobile-reactnative-cli android
71
+ pnpm run e2e:android
72
+ ```
73
+
74
+ CI: `.github/workflows/test-ios-sample.yml` and `test-android-sample.yml`.
75
+
76
+ ## Common pitfalls
77
+
78
+ - **Deleting `ci/crossbind-snapshot/`** with a careless `rm -rf` or assuming it's regenerable — it isn't (well, it is, but only after a full local build that we skip in CI).
79
+ - **Renaming back to `ci/.crossbind`.** `pnpm run clear`-style globs will eat it.
80
+ - **Skipping `pod install`** after touching the RN plugin's `react-native-crossbind.podspec`. Cached pods will be wrong.
81
+ - **Editing the `monorepo` `watchFolders` config** in `metro.config.js` to point elsewhere. The default `require('path').resolve('../../')` is intentional — Metro must see the workspace root to resolve the crossbind plugin packages.
82
+ - **Adding `ios/Pods/` or `android/.gradle/` to git.** They're ignored; build artifacts.
83
+
84
+ ## Reference
85
+
86
+ - RN-cli playbook: `docs/playbooks/integration/react-native-cli.md`
87
+ - Plugin source: `plugins/react-native/AGENTS.md`
88
+ - iOS CI workflow: `.github/workflows/test-ios-sample.yml`
89
+ - Snapshot restoration logic in CI: see "Restore cached bridge files" step
@@ -0,0 +1,38 @@
1
+ # @crossbind/example-mobile-reactnative-cli
2
+
3
+ ## 2.0.0-beta.50
4
+
5
+ ### Patch Changes
6
+
7
+ - The app identifier is now `dev.crossbind.…`, and the sample and the conformance playground no
8
+ longer share one, so both can be installed side by side. Android needs `android/build` and
9
+ `android/app/build` removed after this: `gradlew clean` fails in the native step and never
10
+ runs, and React Native's autolinking caches the old package name at the project level.
11
+
12
+ ## 1.0.1
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+ - @crossbind/core-embind-jsi@1.0.3
18
+ - @crossbind/plugin-metro@1.0.2
19
+ - @crossbind/plugin-react-native@1.0.2
20
+
21
+ ## 1.0.0
22
+
23
+ ### Major Changes
24
+
25
+ - 🚀 first stable release
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies
30
+ - @crossbind/example-lib-prebuilt-matrix@1.0.0
31
+
32
+ ## 1.0.0-beta.4
33
+
34
+ ### Patch Changes
35
+
36
+ - chore: add initial version of CHANGELOGS files
37
+ - Updated dependencies
38
+ - @crossbind/example-lib-prebuilt-matrix@1.0.0-beta.32
@@ -0,0 +1,20 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4
+ ruby ">= 2.6.10"
5
+
6
+ # Exclude problematic versions of cocoapods and activesupport that causes build failures.
7
+ gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
8
+ gem 'activesupport', '>= 7.2.3.1'
9
+ gem 'xcodeproj', '< 1.26.0'
10
+ # The upstream template caps this below 1.3.4, where concurrent-ruby stopped requiring logger
11
+ # and broke activesupport < 7.1. This Gemfile pins activesupport 7.2 and requires logger
12
+ # itself, so the cap only kept a fixed CVE (1.3.7) out.
13
+ gem 'concurrent-ruby', '>= 1.3.7'
14
+
15
+ # Ruby 3.4.0 has removed some libraries from the standard library.
16
+ gem 'bigdecimal'
17
+ gem 'logger'
18
+ gem 'benchmark'
19
+ gem 'mutex_m'
20
+ gem 'nkf'
@@ -0,0 +1,55 @@
1
+ # @crossbind/example-mobile-reactnative-cli
2
+ **crossbind React Native sample**
3
+
4
+ <a href="https://www.npmjs.com/package/@crossbind/example-mobile-reactnative-cli">
5
+ <img alt="NPM version" src="https://img.shields.io/npm/v/@crossbind/example-mobile-reactnative-cli?style=for-the-badge" />
6
+ </a>
7
+ <a href="https://github.com/crossbind/crossbind/blob/main/LICENSE">
8
+ <img alt="License" src="https://img.shields.io/github/license/crossbind/crossbind?style=for-the-badge" />
9
+ </a>
10
+ <a href="https://crossbind.dev/docs/guide/integrate-into-existing-project/react-native">
11
+ <img alt="Docs - React Native" src="https://img.shields.io/badge/Docs_-_React%20Native-20B2AA?style=for-the-badge" />
12
+ </a>
13
+
14
+ # Getting Started
15
+
16
+ >**Note**: Make sure you have completed the [crossbind - Prerequisites](https://crossbind.dev/docs/guide/getting-started/prerequisites) instructions.
17
+
18
+ ## Step 1: Install dependencies
19
+
20
+ ```bash
21
+ npm install
22
+ cd ios
23
+ pod install
24
+ cd ..
25
+ ```
26
+
27
+ ## Step 2: Start the Metro Server
28
+
29
+ First, you will need to start **Metro**, the JavaScript _bundler_ that ships _with_ React Native.
30
+
31
+ To start Metro, run the following command from the _root_ of your React Native project:
32
+
33
+ ```bash
34
+ npm start
35
+ ```
36
+
37
+ ## Step 3: Start your Application
38
+
39
+ Let Metro Bundler run in its _own_ terminal. Open a _new_ terminal from the _root_ of your React Native project. Run the following command to start your _Android_ or _iOS_ app:
40
+
41
+ ### For Android
42
+
43
+ ```bash
44
+ npm run android
45
+ ```
46
+
47
+ ### For iOS
48
+
49
+ ```bash
50
+ npm run ios
51
+ ```
52
+
53
+ If everything is set up _correctly_, you should see your new app running in your _Android Emulator_ or _iOS Simulator_ shortly provided you have set up your emulator/simulator correctly.
54
+
55
+ This is one way to run your app — you can also run it directly from within Android Studio and Xcode respectively.
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @format
3
+ */
4
+
5
+ import React from 'react';
6
+ import ReactTestRenderer from 'react-test-renderer';
7
+ import App from '../App';
8
+
9
+ test('renders correctly', async () => {
10
+ await ReactTestRenderer.act(() => {
11
+ ReactTestRenderer.create(<App />);
12
+ });
13
+ });
@@ -0,0 +1,119 @@
1
+ apply plugin: "com.android.application"
2
+ apply plugin: "org.jetbrains.kotlin.android"
3
+ apply plugin: "com.facebook.react"
4
+
5
+ /**
6
+ * This is the configuration block to customize your React Native Android app.
7
+ * By default you don't need to apply any configuration, just uncomment the lines you need.
8
+ */
9
+ react {
10
+ /* Folders */
11
+ // The root of your project, i.e. where "package.json" lives. Default is '../..'
12
+ // root = file("../../")
13
+ // The folder where the react-native NPM package is. Default is ../../node_modules/react-native
14
+ // reactNativeDir = file("../../node_modules/react-native")
15
+ // The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
16
+ // codegenDir = file("../../node_modules/@react-native/codegen")
17
+ // The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
18
+ // cliFile = file("../../node_modules/react-native/cli.js")
19
+
20
+ /* Variants */
21
+ // The list of variants to that are debuggable. For those we're going to
22
+ // skip the bundling of the JS bundle and the assets. Default is "debug", "debugOptimized".
23
+ // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
24
+ // debuggableVariants = ["liteDebug", "liteDebugOptimized", "prodDebug", "prodDebugOptimized"]
25
+
26
+ /* Bundling */
27
+ // A list containing the node command and its flags. Default is just 'node'.
28
+ // nodeExecutableAndArgs = ["node"]
29
+ //
30
+ // The command to run when bundling. By default is 'bundle'
31
+ // bundleCommand = "ram-bundle"
32
+ //
33
+ // The path to the CLI configuration file. Default is empty.
34
+ // bundleConfig = file(../rn-cli.config.js)
35
+ //
36
+ // The name of the generated asset file containing your JS bundle
37
+ // bundleAssetName = "MyApplication.android.bundle"
38
+ //
39
+ // The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
40
+ // entryFile = file("../js/MyApplication.android.js")
41
+ //
42
+ // A list of extra flags to pass to the 'bundle' commands.
43
+ // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
44
+ // extraPackagerArgs = []
45
+
46
+ /* Hermes Commands */
47
+ // The hermes compiler command to run. By default it is 'hermesc'
48
+ // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
49
+ //
50
+ // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
51
+ // hermesFlags = ["-O", "-output-source-map"]
52
+
53
+ /* Autolinking */
54
+ autolinkLibrariesWithApp()
55
+ }
56
+
57
+ /**
58
+ * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
59
+ */
60
+ def enableProguardInReleaseBuilds = false
61
+
62
+ /**
63
+ * The preferred build flavor of JavaScriptCore (JSC)
64
+ *
65
+ * For example, to use the international variant, you can use:
66
+ * `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+`
67
+ *
68
+ * The international variant includes ICU i18n library and necessary data
69
+ * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
70
+ * give correct results when using with locales other than en-US. Note that
71
+ * this variant is about 6MiB larger per architecture than default.
72
+ */
73
+ def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
74
+
75
+ android {
76
+ ndkVersion rootProject.ext.ndkVersion
77
+ buildToolsVersion rootProject.ext.buildToolsVersion
78
+ compileSdk rootProject.ext.compileSdkVersion
79
+
80
+ namespace "dev.crossbind.sampleReactNativeCLI"
81
+ defaultConfig {
82
+ applicationId "dev.crossbind.sampleReactNativeCLI"
83
+ minSdkVersion rootProject.ext.minSdkVersion
84
+ targetSdkVersion rootProject.ext.targetSdkVersion
85
+ versionCode 1
86
+ versionName "1.0"
87
+ }
88
+ signingConfigs {
89
+ debug {
90
+ storeFile file('debug.keystore')
91
+ storePassword 'android'
92
+ keyAlias 'androiddebugkey'
93
+ keyPassword 'android'
94
+ }
95
+ }
96
+ buildTypes {
97
+ debug {
98
+ signingConfig signingConfigs.debug
99
+ }
100
+ release {
101
+ // Caution! In production, you need to generate your own keystore file.
102
+ // see https://reactnative.dev/docs/signed-apk-android.
103
+ signingConfig signingConfigs.debug
104
+ minifyEnabled enableProguardInReleaseBuilds
105
+ proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
106
+ }
107
+ }
108
+ }
109
+
110
+ dependencies {
111
+ // The version of react-native is set by the React Native Gradle Plugin
112
+ implementation("com.facebook.react:react-android")
113
+
114
+ if (hermesEnabled.toBoolean()) {
115
+ implementation("com.facebook.react:hermes-android")
116
+ } else {
117
+ implementation jscFlavor
118
+ }
119
+ }
@@ -0,0 +1,10 @@
1
+ # Add project specific ProGuard rules here.
2
+ # By default, the flags in this file are appended to flags specified
3
+ # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4
+ # You can edit the include path and order by changing the proguardFiles
5
+ # directive in build.gradle.
6
+ #
7
+ # For more details, see
8
+ # http://developer.android.com/guide/developing/tools/proguard.html
9
+
10
+ # Add any project specific keep options here:
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+ xmlns:tools="http://schemas.android.com/tools">
4
+
5
+ <application
6
+ android:usesCleartextTraffic="true"
7
+ tools:targetApi="28"
8
+ tools:ignore="GoogleAppIndexingWarning"/>
9
+ </manifest>
@@ -0,0 +1,27 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+
3
+ <uses-permission android:name="android.permission.INTERNET" />
4
+
5
+ <application
6
+ android:name=".MainApplication"
7
+ android:label="@string/app_name"
8
+ android:icon="@mipmap/ic_launcher"
9
+ android:roundIcon="@mipmap/ic_launcher_round"
10
+ android:allowBackup="false"
11
+ android:theme="@style/AppTheme"
12
+ android:usesCleartextTraffic="${usesCleartextTraffic}"
13
+ android:supportsRtl="true">
14
+ <activity
15
+ android:name=".MainActivity"
16
+ android:label="@string/app_name"
17
+ android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
18
+ android:launchMode="singleTask"
19
+ android:windowSoftInputMode="adjustResize"
20
+ android:exported="true">
21
+ <intent-filter>
22
+ <action android:name="android.intent.action.MAIN" />
23
+ <category android:name="android.intent.category.LAUNCHER" />
24
+ </intent-filter>
25
+ </activity>
26
+ </application>
27
+ </manifest>
@@ -0,0 +1,22 @@
1
+ package dev.crossbind.sampleReactNativeCLI
2
+
3
+ import com.facebook.react.ReactActivity
4
+ import com.facebook.react.ReactActivityDelegate
5
+ import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
6
+ import com.facebook.react.defaults.DefaultReactActivityDelegate
7
+
8
+ class MainActivity : ReactActivity() {
9
+
10
+ /**
11
+ * Returns the name of the main component registered from JavaScript. This is used to schedule
12
+ * rendering of the component.
13
+ */
14
+ override fun getMainComponentName(): String = "crossbindSampleReactNativeCLI"
15
+
16
+ /**
17
+ * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
18
+ * which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
19
+ */
20
+ override fun createReactActivityDelegate(): ReactActivityDelegate =
21
+ DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
22
+ }
@@ -0,0 +1,27 @@
1
+ package dev.crossbind.sampleReactNativeCLI
2
+
3
+ import android.app.Application
4
+ import com.facebook.react.PackageList
5
+ import com.facebook.react.ReactApplication
6
+ import com.facebook.react.ReactHost
7
+ import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
8
+ import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
9
+
10
+ class MainApplication : Application(), ReactApplication {
11
+
12
+ override val reactHost: ReactHost by lazy {
13
+ getDefaultReactHost(
14
+ context = applicationContext,
15
+ packageList =
16
+ PackageList(this).packages.apply {
17
+ // Packages that cannot be autolinked yet can be added manually here, for example:
18
+ // add(MyReactNativePackage())
19
+ },
20
+ )
21
+ }
22
+
23
+ override fun onCreate() {
24
+ super.onCreate()
25
+ loadReactNative(this)
26
+ }
27
+ }
@@ -0,0 +1,37 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Copyright (C) 2014 The Android Open Source Project
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ -->
16
+ <inset xmlns:android="http://schemas.android.com/apk/res/android"
17
+ android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material"
18
+ android:insetRight="@dimen/abc_edit_text_inset_horizontal_material"
19
+ android:insetTop="@dimen/abc_edit_text_inset_top_material"
20
+ android:insetBottom="@dimen/abc_edit_text_inset_bottom_material"
21
+ >
22
+
23
+ <selector>
24
+ <!--
25
+ This file is a copy of abc_edit_text_material (https://bit.ly/3k8fX7I).
26
+ The item below with state_pressed="false" and state_focused="false" causes a NullPointerException.
27
+ NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)'
28
+
29
+ <item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
30
+
31
+ For more info, see https://bit.ly/3CdLStv (react-native/pull/29452) and https://bit.ly/3nxOMoR.
32
+ -->
33
+ <item android:state_enabled="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
34
+ <item android:drawable="@drawable/abc_textfield_activated_mtrl_alpha"/>
35
+ </selector>
36
+
37
+ </inset>
@@ -0,0 +1,3 @@
1
+ <resources>
2
+ <string name="app_name">crossbindSampleReactNativeCLI</string>
3
+ </resources>
@@ -0,0 +1,9 @@
1
+ <resources>
2
+
3
+ <!-- Base application theme. -->
4
+ <style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
5
+ <!-- Customize your theme here. -->
6
+ <item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
7
+ </style>
8
+
9
+ </resources>
@@ -0,0 +1,21 @@
1
+ buildscript {
2
+ ext {
3
+ buildToolsVersion = "36.0.0"
4
+ minSdkVersion = 24
5
+ compileSdkVersion = 36
6
+ targetSdkVersion = 36
7
+ ndkVersion = "27.1.12297006"
8
+ kotlinVersion = "2.1.20"
9
+ }
10
+ repositories {
11
+ google()
12
+ mavenCentral()
13
+ }
14
+ dependencies {
15
+ classpath("com.android.tools.build:gradle")
16
+ classpath("com.facebook.react:react-native-gradle-plugin")
17
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
18
+ }
19
+ }
20
+
21
+ apply plugin: "com.facebook.react.rootproject"
@@ -0,0 +1,7 @@
1
+ distributionBase=GRADLE_USER_HOME
2
+ distributionPath=wrapper/dists
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
4
+ networkTimeout=10000
5
+ validateDistributionUrl=true
6
+ zipStoreBase=GRADLE_USER_HOME
7
+ zipStorePath=wrapper/dists
@@ -0,0 +1,44 @@
1
+ # Project-wide Gradle settings.
2
+
3
+ # IDE (e.g. Android Studio) users:
4
+ # Gradle settings configured through the IDE *will override*
5
+ # any settings specified in this file.
6
+
7
+ # For more details on how to configure your build environment visit
8
+ # http://www.gradle.org/docs/current/userguide/build_environment.html
9
+
10
+ # Specifies the JVM arguments used for the daemon process.
11
+ # The setting is particularly useful for tweaking memory settings.
12
+ # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
13
+ org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
14
+
15
+ # When configured, Gradle will run in incubating parallel mode.
16
+ # This option should only be used with decoupled projects. More details, visit
17
+ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18
+ # org.gradle.parallel=true
19
+
20
+ # AndroidX package structure to make it clearer which packages are bundled with the
21
+ # Android operating system, and which are packaged with your app's APK
22
+ # https://developer.android.com/topic/libraries/support-library/androidx-rn
23
+ android.useAndroidX=true
24
+
25
+ # Use this property to specify which architecture you want to build.
26
+ # You can also override it from the CLI using
27
+ # ./gradlew <task> -PreactNativeArchitectures=x86_64
28
+ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
29
+
30
+ # Use this property to enable support to the new architecture.
31
+ # This will allow you to use TurboModules and the Fabric render in
32
+ # your application. You should enable this flag either if you want
33
+ # to write custom TurboModules/Fabric components OR use libraries that
34
+ # are providing them.
35
+ newArchEnabled=true
36
+
37
+ # Use this property to enable or disable the Hermes JS engine.
38
+ # If set to false, you will be using JSC instead.
39
+ hermesEnabled=true
40
+
41
+ # Use this property to enable edge-to-edge display support.
42
+ # This allows your app to draw behind system bars for an immersive UI.
43
+ # Note: Only works with ReactActivity and should not be used with custom Activity.
44
+ edgeToEdgeEnabled=false