@derec-alliance/react-native 0.0.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.
Files changed (65) hide show
  1. package/DeRec.podspec +25 -0
  2. package/LICENSE +201 -0
  3. package/README.md +222 -0
  4. package/android/CMakeLists.txt +38 -0
  5. package/android/build.gradle +79 -0
  6. package/android/src/main/AndroidManifest.xml +12 -0
  7. package/android/src/main/java/org/derec/DeRecModule.kt +56 -0
  8. package/android/src/main/java/org/derec/DeRecPackage.kt +24 -0
  9. package/android/src/main/jni/OnLoad.cpp +39 -0
  10. package/android/src/main/jniLibs/arm64-v8a/libderec_library.a +0 -0
  11. package/android/src/main/jniLibs/armeabi-v7a/libderec_library.a +0 -0
  12. package/android/src/main/jniLibs/x86_64/libderec_library.a +0 -0
  13. package/cpp/Convert.cpp +50 -0
  14. package/cpp/Convert.h +38 -0
  15. package/cpp/DeRecInstaller.cpp +186 -0
  16. package/cpp/DeRecInstaller.h +28 -0
  17. package/cpp/Invoker.h +20 -0
  18. package/cpp/JsCallbackBridge.cpp +144 -0
  19. package/cpp/JsCallbackBridge.h +148 -0
  20. package/cpp/Primitives.cpp +1193 -0
  21. package/cpp/Primitives.h +39 -0
  22. package/cpp/ProtocolHost.cpp +613 -0
  23. package/cpp/ProtocolHost.h +88 -0
  24. package/cpp/RuntimeInvoker.h +29 -0
  25. package/cpp/StoreCallbacks.cpp +1293 -0
  26. package/cpp/StoreCallbacks.h +111 -0
  27. package/cpp/WorkerThread.cpp +74 -0
  28. package/cpp/WorkerThread.h +54 -0
  29. package/cpp/derec_ffi.h +2145 -0
  30. package/ios/DeRec.h +23 -0
  31. package/ios/DeRec.mm +39 -0
  32. package/ios/DeRecFFI.xcframework/Info.plist +48 -0
  33. package/ios/DeRecFFI.xcframework/ios-arm64/Headers/derec_ffi.h +2145 -0
  34. package/ios/DeRecFFI.xcframework/ios-arm64/libderec_library.a +0 -0
  35. package/ios/DeRecFFI.xcframework/ios-arm64_x86_64-simulator/Headers/derec_ffi.h +2145 -0
  36. package/ios/DeRecFFI.xcframework/ios-arm64_x86_64-simulator/libderec_library.a +0 -0
  37. package/lib/binary.d.ts +19 -0
  38. package/lib/binary.js +164 -0
  39. package/lib/codec.d.ts +16 -0
  40. package/lib/codec.js +80 -0
  41. package/lib/errors.d.ts +23 -0
  42. package/lib/errors.js +35 -0
  43. package/lib/index.d.ts +4 -0
  44. package/lib/index.js +27 -0
  45. package/lib/messages.d.ts +41 -0
  46. package/lib/messages.js +192 -0
  47. package/lib/native.d.ts +11 -0
  48. package/lib/native.js +40 -0
  49. package/lib/primitives.d.ts +137 -0
  50. package/lib/primitives.js +329 -0
  51. package/lib/protocol.d.ts +188 -0
  52. package/lib/protocol.js +514 -0
  53. package/lib/types.d.ts +1014 -0
  54. package/lib/types.js +63 -0
  55. package/package.json +55 -0
  56. package/react-native.config.js +19 -0
  57. package/src/binary.ts +182 -0
  58. package/src/codec.ts +79 -0
  59. package/src/errors.ts +45 -0
  60. package/src/index.ts +7 -0
  61. package/src/messages.ts +192 -0
  62. package/src/native.ts +52 -0
  63. package/src/primitives.ts +770 -0
  64. package/src/protocol.ts +621 -0
  65. package/src/types.ts +1040 -0
package/ios/DeRec.h ADDED
@@ -0,0 +1,23 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Copyright (c) 2026 DeRec Alliance. All rights reserved.
3
+
4
+ #import <React/RCTBridgeModule.h>
5
+ #import <React/RCTInvalidating.h>
6
+ #import <ReactCommon/RCTTurboModule.h>
7
+ #import <ReactCommon/RCTTurboModuleWithJSIBindings.h>
8
+
9
+ /// Minimal TurboModule whose only job is to install the `__DeRec` JSI host
10
+ /// object into the JavaScript runtime.
11
+ ///
12
+ /// It conforms to `RCTTurboModule` — and so implements `getTurboModule:` —
13
+ /// even though it exports no methods. `RCTTurboModuleManager` invokes
14
+ /// `installJSIBindingsWithRuntime:callInvoker:` only inside the branch guarded
15
+ /// by `respondsToSelector:@selector(getTurboModule:)`; a module registered
16
+ /// with `RCT_EXPORT_MODULE()` alone takes the legacy interop path instead and
17
+ /// never receives the hook, leaving `globalThis.__DeRec` undefined.
18
+ ///
19
+ /// The pre-0.76 route — casting the bridge to `RCTCxxBridge` and reading its
20
+ /// `runtime` property — is not an alternative: there is no `RCTCxxBridge` in a
21
+ /// bridgeless app, which is the default from React Native 0.76 onward.
22
+ @interface DeRec : NSObject <RCTBridgeModule, RCTTurboModule, RCTTurboModuleWithJSIBindings, RCTInvalidating>
23
+ @end
package/ios/DeRec.mm ADDED
@@ -0,0 +1,39 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Copyright (c) 2026 DeRec Alliance. All rights reserved.
3
+
4
+ #import "DeRec.h"
5
+
6
+ #import "DeRecInstaller.h"
7
+ #import "RuntimeInvoker.h"
8
+
9
+ @implementation DeRec
10
+
11
+ RCT_EXPORT_MODULE()
12
+
13
+ + (BOOL)requiresMainQueueSetup {
14
+ return YES;
15
+ }
16
+
17
+ // No methods are exported: JavaScript reaches the SDK through the `__DeRec`
18
+ // host object, not through this module. The bare `ObjCTurboModule` exists so
19
+ // the manager takes the TurboModule path, which is the only path that calls
20
+ // `installJSIBindingsWithRuntime:callInvoker:`.
21
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
22
+ (const facebook::react::ObjCTurboModule::InitParams &)params {
23
+ return std::make_shared<facebook::react::ObjCTurboModule>(params);
24
+ }
25
+
26
+ - (void)installJSIBindingsWithRuntime:(facebook::jsi::Runtime &)runtime
27
+ callInvoker:
28
+ (const std::shared_ptr<facebook::react::CallInvoker> &)callInvoker {
29
+ auto invoker = std::make_shared<derec::RuntimeInvoker>(callInvoker);
30
+ derec::install(runtime, invoker);
31
+ }
32
+
33
+ - (void)invalidate {
34
+ // The runtime is going away: wake every worker blocked in a store callback
35
+ // so it unwinds rather than hanging on a condition variable forever.
36
+ derec::invalidateAll();
37
+ }
38
+
39
+ @end
@@ -0,0 +1,48 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>AvailableLibraries</key>
6
+ <array>
7
+ <dict>
8
+ <key>BinaryPath</key>
9
+ <string>libderec_library.a</string>
10
+ <key>HeadersPath</key>
11
+ <string>Headers</string>
12
+ <key>LibraryIdentifier</key>
13
+ <string>ios-arm64</string>
14
+ <key>LibraryPath</key>
15
+ <string>libderec_library.a</string>
16
+ <key>SupportedArchitectures</key>
17
+ <array>
18
+ <string>arm64</string>
19
+ </array>
20
+ <key>SupportedPlatform</key>
21
+ <string>ios</string>
22
+ </dict>
23
+ <dict>
24
+ <key>BinaryPath</key>
25
+ <string>libderec_library.a</string>
26
+ <key>HeadersPath</key>
27
+ <string>Headers</string>
28
+ <key>LibraryIdentifier</key>
29
+ <string>ios-arm64_x86_64-simulator</string>
30
+ <key>LibraryPath</key>
31
+ <string>libderec_library.a</string>
32
+ <key>SupportedArchitectures</key>
33
+ <array>
34
+ <string>arm64</string>
35
+ <string>x86_64</string>
36
+ </array>
37
+ <key>SupportedPlatform</key>
38
+ <string>ios</string>
39
+ <key>SupportedPlatformVariant</key>
40
+ <string>simulator</string>
41
+ </dict>
42
+ </array>
43
+ <key>CFBundlePackageType</key>
44
+ <string>XFWK</string>
45
+ <key>XCFrameworkFormatVersion</key>
46
+ <string>1.0</string>
47
+ </dict>
48
+ </plist>