react-native-nitro-modules 0.0.2 → 0.0.4

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 (120) hide show
  1. package/NitroModules.podspec +49 -0
  2. package/android/CMakeLists.txt +44 -7
  3. package/android/build.gradle +28 -24
  4. package/cpp/core/AnyMap.cpp +181 -0
  5. package/cpp/core/AnyMap.hpp +191 -0
  6. package/cpp/core/HybridContext.hpp +51 -0
  7. package/cpp/core/HybridObject.cpp +220 -0
  8. package/cpp/core/HybridObject.hpp +241 -0
  9. package/cpp/core/PointerHolder.hpp +93 -0
  10. package/cpp/jsi/ArrayBuffer.hpp +79 -0
  11. package/cpp/jsi/JSICache.hpp +145 -0
  12. package/cpp/jsi/JSIConverter.hpp +610 -0
  13. package/cpp/jsi/Promise.cpp +54 -0
  14. package/cpp/jsi/Promise.hpp +54 -0
  15. package/cpp/platform/ThreadUtils.hpp +23 -0
  16. package/cpp/registry/HybridObjectRegistry.cpp +57 -0
  17. package/cpp/registry/HybridObjectRegistry.hpp +44 -0
  18. package/cpp/test-object/TestHybridObject.cpp +37 -0
  19. package/cpp/test-object/TestHybridObject.hpp +87 -0
  20. package/cpp/threading/CallInvokerDispatcher.hpp +33 -0
  21. package/cpp/threading/Dispatcher.cpp +56 -0
  22. package/cpp/threading/Dispatcher.hpp +82 -0
  23. package/cpp/turbomodule/NativeNitroModules.cpp +70 -0
  24. package/cpp/turbomodule/NativeNitroModules.h +7 -0
  25. package/cpp/turbomodule/NativeNitroModules.hpp +35 -0
  26. package/cpp/turbomodule/RegisterNativeNitroModules.cpp +33 -0
  27. package/cpp/turbomodule/RegisterNativeNitroModules.hpp +21 -0
  28. package/cpp/utils/BorrowingReference+Owning.hpp +34 -0
  29. package/cpp/utils/BorrowingReference.hpp +115 -0
  30. package/cpp/utils/DoesClassExist.hpp +23 -0
  31. package/cpp/utils/GetRuntimeID.hpp +28 -0
  32. package/cpp/utils/NitroDefines.hpp +32 -0
  33. package/cpp/utils/NitroHash.hpp +42 -0
  34. package/cpp/utils/NitroLogger.hpp +55 -0
  35. package/cpp/utils/OwningLock.hpp +54 -0
  36. package/cpp/utils/OwningReference.hpp +214 -0
  37. package/cpp/utils/TypeInfo.hpp +81 -0
  38. package/ios/core/HybridObjectSpec.swift +52 -0
  39. package/ios/core/RuntimeError.swift +17 -0
  40. package/ios/platform/ThreadUtils.cpp +28 -0
  41. package/ios/turbomodule/NitroModuleOnLoad.mm +31 -0
  42. package/lib/AnyMap.d.ts +16 -0
  43. package/lib/AnyMap.js +1 -0
  44. package/lib/HybridObject.d.ts +57 -0
  45. package/lib/HybridObject.js +1 -0
  46. package/lib/ModuleNotFoundError.d.ts +6 -0
  47. package/lib/ModuleNotFoundError.js +61 -0
  48. package/lib/NativeNitro.d.ts +8 -0
  49. package/lib/NativeNitro.js +3 -0
  50. package/lib/NativeNitroModules.d.ts +7 -0
  51. package/lib/NativeNitroModules.js +17 -0
  52. package/lib/NitroModules.d.ts +17 -0
  53. package/lib/NitroModules.js +21 -0
  54. package/lib/__tests__/index.test.d.ts +0 -0
  55. package/lib/__tests__/index.test.js +2 -0
  56. package/lib/commonjs/AnyMap.js +2 -0
  57. package/lib/commonjs/AnyMap.js.map +1 -0
  58. package/lib/commonjs/HybridObject.js +2 -0
  59. package/lib/commonjs/HybridObject.js.map +1 -0
  60. package/lib/commonjs/ModuleNotFoundError.js +72 -0
  61. package/lib/commonjs/ModuleNotFoundError.js.map +1 -0
  62. package/lib/commonjs/NativeNitroModules.js +24 -0
  63. package/lib/commonjs/NativeNitroModules.js.map +1 -0
  64. package/lib/commonjs/NitroModules.js +32 -0
  65. package/lib/commonjs/NitroModules.js.map +1 -0
  66. package/lib/commonjs/createTestObject.js +15 -0
  67. package/lib/commonjs/createTestObject.js.map +1 -0
  68. package/lib/commonjs/index.js +44 -5
  69. package/lib/commonjs/index.js.map +1 -1
  70. package/lib/createTestObject.d.ts +22 -0
  71. package/lib/createTestObject.js +7 -0
  72. package/lib/index.d.ts +4 -0
  73. package/lib/index.js +4 -0
  74. package/lib/module/AnyMap.js +2 -0
  75. package/lib/module/AnyMap.js.map +1 -0
  76. package/lib/module/HybridObject.js +2 -0
  77. package/lib/module/HybridObject.js.map +1 -0
  78. package/lib/module/ModuleNotFoundError.js +65 -0
  79. package/lib/module/ModuleNotFoundError.js.map +1 -0
  80. package/lib/module/NativeNitroModules.js +18 -0
  81. package/lib/module/NativeNitroModules.js.map +1 -0
  82. package/lib/module/NitroModules.js +27 -0
  83. package/lib/module/NitroModules.js.map +1 -0
  84. package/lib/module/createTestObject.js +8 -0
  85. package/lib/module/createTestObject.js.map +1 -0
  86. package/lib/module/index.js +4 -4
  87. package/lib/module/index.js.map +1 -1
  88. package/lib/tsconfig.tsbuildinfo +1 -0
  89. package/package.json +76 -49
  90. package/react-native.config.js +16 -0
  91. package/src/AnyMap.ts +22 -0
  92. package/src/HybridObject.ts +58 -0
  93. package/src/ModuleNotFoundError.ts +90 -0
  94. package/src/NativeNitroModules.ts +26 -0
  95. package/src/NitroModules.ts +30 -0
  96. package/src/__tests__/index.test.tsx +1 -0
  97. package/src/createTestObject.ts +40 -0
  98. package/src/index.ts +4 -0
  99. package/LICENSE +0 -20
  100. package/README.md +0 -32
  101. package/android/cpp-adapter.cpp +0 -8
  102. package/android/src/main/AndroidManifest.xml +0 -3
  103. package/android/src/main/AndroidManifestNew.xml +0 -2
  104. package/android/src/main/java/com/nitro/NitroModule.java +0 -34
  105. package/android/src/main/java/com/nitro/NitroPackage.java +0 -44
  106. package/cpp/react-native-nitro.cpp +0 -7
  107. package/cpp/react-native-nitro.h +0 -8
  108. package/ios/Nitro.h +0 -15
  109. package/ios/Nitro.mm +0 -21
  110. package/lib/commonjs/NativeNitro.js +0 -9
  111. package/lib/commonjs/NativeNitro.js.map +0 -1
  112. package/lib/module/NativeNitro.js +0 -3
  113. package/lib/module/NativeNitro.js.map +0 -1
  114. package/lib/typescript/src/NativeNitro.d.ts +0 -7
  115. package/lib/typescript/src/NativeNitro.d.ts.map +0 -1
  116. package/lib/typescript/src/index.d.ts +0 -2
  117. package/lib/typescript/src/index.d.ts.map +0 -1
  118. package/react-native-nitro.podspec +0 -41
  119. package/src/NativeNitro.ts +0 -8
  120. package/src/index.tsx +0 -5
@@ -0,0 +1,90 @@
1
+ import { NativeModules, Platform } from 'react-native'
2
+
3
+ declare global {
4
+ // A react-native internal from TurboModuleRegistry.js
5
+ var __turboModuleProxy: unknown | undefined
6
+ }
7
+
8
+ const BULLET_POINT = '\n* '
9
+
10
+ function messageWithSuggestions(
11
+ message: string,
12
+ suggestions: string[]
13
+ ): string {
14
+ return message + BULLET_POINT + suggestions.join(BULLET_POINT)
15
+ }
16
+
17
+ function getFrameworkType(): 'react-native' | 'expo' | 'expo-go' {
18
+ // check if Expo
19
+ const ExpoConstants =
20
+ NativeModules.NativeUnimoduleProxy?.modulesConstants?.ExponentConstants
21
+ if (ExpoConstants != null) {
22
+ if (ExpoConstants.appOwnership === 'expo') {
23
+ // We're running Expo Go
24
+ return 'expo-go'
25
+ } else {
26
+ // We're running Expo bare / standalone
27
+ return 'expo'
28
+ }
29
+ }
30
+ return 'react-native'
31
+ }
32
+
33
+ export class ModuleNotFoundError extends Error {
34
+ constructor(cause?: unknown) {
35
+ // TurboModule not found, something went wrong!
36
+ if (global.__turboModuleProxy == null) {
37
+ // TurboModules are not available/new arch is not enabled.
38
+ const message =
39
+ 'Failed to get NitroModules: NitroModules require the new architecture to be enabled!'
40
+ const suggestions: string[] = []
41
+ suggestions.push(
42
+ 'Enable the new architecture in your app to use NitroModules. (See https://github.com/reactwg/react-native-new-architecture/blob/main/docs/enable-apps.md)'
43
+ )
44
+ const error = messageWithSuggestions(message, suggestions)
45
+ super(error, { cause: cause })
46
+ return
47
+ }
48
+
49
+ const framework = getFrameworkType()
50
+ if (framework === 'expo-go') {
51
+ super(
52
+ 'NitroModules are not supported in Expo Go! Use EAS (`expo prebuild`) or eject to a bare workflow instead.'
53
+ )
54
+ return
55
+ }
56
+
57
+ const message =
58
+ 'Failed to get NitroModules: The native "NitroModules" TurboModule could not be found.'
59
+ const suggestions: string[] = []
60
+ suggestions.push(
61
+ 'Make sure react-native-nitro-modules/NitroModules is correctly autolinked (run `npx react-native config` to verify)'
62
+ )
63
+ suggestions.push(
64
+ 'Make sure you enabled the new architecture (TurboModules) and CodeGen properly generated the "NativeNitroModules"/NitroModulesCxx specs. See https://github.com/reactwg/react-native-new-architecture/blob/main/docs/enable-apps.md'
65
+ )
66
+ suggestions.push(
67
+ 'Make sure you are using react-native 0.74.0 or higher, because NitroModules are built with C++ TurboModules.'
68
+ )
69
+ suggestions.push('Make sure you rebuilt the app.')
70
+ if (framework === 'expo') {
71
+ suggestions.push('Make sure you ran `expo prebuild`.')
72
+ }
73
+ switch (Platform.OS) {
74
+ case 'ios':
75
+ case 'macos':
76
+ suggestions.push(
77
+ 'Make sure you ran `pod install` in the ios/ directory.'
78
+ )
79
+ break
80
+ case 'android':
81
+ suggestions.push('Make sure gradle is synced.')
82
+ break
83
+ default:
84
+ throw new Error(`NitroModules are not yet supported on ${Platform.OS}!`)
85
+ }
86
+
87
+ const error = messageWithSuggestions(message, suggestions)
88
+ super(error, { cause: cause })
89
+ }
90
+ }
@@ -0,0 +1,26 @@
1
+ import type { TurboModule } from 'react-native'
2
+ import { TurboModuleRegistry } from 'react-native'
3
+ import type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes'
4
+ import { ModuleNotFoundError } from './ModuleNotFoundError'
5
+
6
+ export interface Spec extends TurboModule {
7
+ install(): void
8
+ createHybridObject(name: string, args?: UnsafeObject): UnsafeObject
9
+ }
10
+
11
+ let turboModule: Spec | undefined
12
+ export function getNativeNitroModules(): Spec {
13
+ if (turboModule == null) {
14
+ try {
15
+ // 1. Get (and initialize) the C++ TurboModule
16
+ turboModule = TurboModuleRegistry.getEnforcing<Spec>('NitroModulesCxx')
17
+
18
+ // 2. Install Dispatcher and required bindings into the Runtime
19
+ turboModule.install()
20
+ } catch (e) {
21
+ throw new ModuleNotFoundError(e)
22
+ }
23
+ }
24
+
25
+ return turboModule
26
+ }
@@ -0,0 +1,30 @@
1
+ import { getNativeNitroModules } from './NativeNitroModules'
2
+ import type { HybridObject } from './HybridObject'
3
+
4
+ // TODO: Do we wanna support such constructors?
5
+ // @ts-expect-error
6
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
7
+ type ExtractConstructors<T> = {
8
+ [K in keyof T as K extends `constructor` ? `create` : never]: T[K]
9
+ }
10
+
11
+ /**
12
+ * A lazy proxy for initializing Nitro Modules HybridObjects.
13
+ */
14
+ export const NitroModules = {
15
+ /**
16
+ * Create a new instance of the `HybridObject` {@linkcode T}.
17
+ *
18
+ * {@linkcode T} has to be registered beforehand under the name {@linkcode name}
19
+ * in the native Nitro Modules `HybridObjectRegistry`.
20
+ *
21
+ * @param name The name of the `HybridObject` under which it was registered at.
22
+ * @returns An instance of {@linkcode T}
23
+ * @throws an Error if {@linkcode T} has not been registered under the name {@linkcode name}.
24
+ */
25
+ get<T extends HybridObject<any>>(name: string): T {
26
+ const nitro = getNativeNitroModules()
27
+ const instance = nitro.createHybridObject(name)
28
+ return instance as T
29
+ },
30
+ }
@@ -0,0 +1 @@
1
+ it.todo('write a test')
@@ -0,0 +1,40 @@
1
+ import { NitroModules, type HybridObject } from '.'
2
+
3
+ export interface TestHybridObject extends HybridObject<{}> {
4
+ // C++ getter & setter
5
+ int: number
6
+ string: string
7
+ nullableString: string | undefined
8
+ // C++ methods
9
+ multipleArguments(
10
+ first: number,
11
+ second: boolean,
12
+ third: string
13
+ ): Record<string, number>
14
+ getIntGetter(): () => number
15
+ sayHelloCallback(callback: (name: string) => void): void
16
+ createNewHybridObject(): TestHybridObject
17
+ // C++ Threading
18
+ calculateFibonacci(count: number): bigint
19
+ calculateFibonacciAsync(count: number): Promise<bigint>
20
+ asyncVoidFunc(): Promise<void>
21
+ syncVoidFunc(): void
22
+ // Errors
23
+ throwError(): void
24
+ }
25
+
26
+ export function createCppTestHybridObject(): TestHybridObject {
27
+ return NitroModules.get<TestHybridObject>('TestHybridObject')
28
+ }
29
+
30
+ export interface SwiftTestHybridObject extends HybridObject<{}> {
31
+ // Swift getter & setter
32
+ int: number
33
+ // Swift methods
34
+ throwError(): number
35
+ asyncMethod(): Promise<number>
36
+ }
37
+
38
+ export function createSwiftTestHybridObject(): SwiftTestHybridObject {
39
+ return NitroModules.get<SwiftTestHybridObject>('SwiftTestObject')
40
+ }
package/src/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from './createTestObject'
2
+ export * from './HybridObject'
3
+ export * from './NitroModules'
4
+ export * from './AnyMap'
package/LICENSE DELETED
@@ -1,20 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 Marc Rousavy
4
- Permission is hereby granted, free of charge, to any person obtaining a copy
5
- of this software and associated documentation files (the "Software"), to deal
6
- in the Software without restriction, including without limitation the rights
7
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the Software is
9
- furnished to do so, subject to the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be included in all
12
- copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- SOFTWARE.
package/README.md DELETED
@@ -1,32 +0,0 @@
1
- # react-native-nitro
2
-
3
- Nitro Modules
4
-
5
- ## Installation
6
-
7
- ```sh
8
- npm install react-native-nitro
9
- ```
10
-
11
- ## Usage
12
-
13
-
14
- ```js
15
- import { multiply } from 'react-native-nitro';
16
-
17
- // ...
18
-
19
- const result = multiply(3, 7);
20
- ```
21
-
22
- ## Contributing
23
-
24
- See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
25
-
26
- ## License
27
-
28
- MIT
29
-
30
- ---
31
-
32
- Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
@@ -1,8 +0,0 @@
1
- #include <jni.h>
2
- #include "react-native-nitro.h"
3
-
4
- extern "C"
5
- JNIEXPORT jdouble JNICALL
6
- Java_com_nitro_NitroModule_nativeMultiply(JNIEnv *env, jclass type, jdouble a, jdouble b) {
7
- return nitro::multiply(a, b);
8
- }
@@ -1,3 +0,0 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="com.nitro">
3
- </manifest>
@@ -1,2 +0,0 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
- </manifest>
@@ -1,34 +0,0 @@
1
- package com.nitro;
2
-
3
- import androidx.annotation.NonNull;
4
-
5
- import com.facebook.react.bridge.ReactApplicationContext;
6
- import com.facebook.react.module.annotations.ReactModule;
7
-
8
- @ReactModule(name = NitroModule.NAME)
9
- public class NitroModule extends NativeNitroSpec {
10
- public static final String NAME = "Nitro";
11
-
12
- public NitroModule(ReactApplicationContext reactContext) {
13
- super(reactContext);
14
- }
15
-
16
- @Override
17
- @NonNull
18
- public String getName() {
19
- return NAME;
20
- }
21
-
22
- static {
23
- System.loadLibrary("react-native-nitro");
24
- }
25
-
26
- private static native double nativeMultiply(double a, double b);
27
-
28
- // Example method
29
- // See https://reactnative.dev/docs/native-modules-android
30
- @Override
31
- public double multiply(double a, double b) {
32
- return nativeMultiply(a, b);
33
- }
34
- }
@@ -1,44 +0,0 @@
1
- package com.nitro;
2
-
3
- import androidx.annotation.Nullable;
4
-
5
- import com.facebook.react.bridge.NativeModule;
6
- import com.facebook.react.bridge.ReactApplicationContext;
7
- import com.facebook.react.module.model.ReactModuleInfo;
8
- import com.facebook.react.module.model.ReactModuleInfoProvider;
9
- import com.facebook.react.TurboReactPackage;
10
-
11
- import java.util.HashMap;
12
- import java.util.Map;
13
-
14
- public class NitroPackage extends TurboReactPackage {
15
-
16
- @Nullable
17
- @Override
18
- public NativeModule getModule(String name, ReactApplicationContext reactContext) {
19
- if (name.equals(NitroModule.NAME)) {
20
- return new NitroModule(reactContext);
21
- } else {
22
- return null;
23
- }
24
- }
25
-
26
- @Override
27
- public ReactModuleInfoProvider getReactModuleInfoProvider() {
28
- return () -> {
29
- final Map<String, ReactModuleInfo> moduleInfos = new HashMap<>();
30
- moduleInfos.put(
31
- NitroModule.NAME,
32
- new ReactModuleInfo(
33
- NitroModule.NAME,
34
- NitroModule.NAME,
35
- false, // canOverrideExistingModule
36
- false, // needsEagerInit
37
- true, // hasConstants
38
- false, // isCxxModule
39
- true // isTurboModule
40
- ));
41
- return moduleInfos;
42
- };
43
- }
44
- }
@@ -1,7 +0,0 @@
1
- #include "react-native-nitro.h"
2
-
3
- namespace nitro {
4
- double multiply(double a, double b) {
5
- return a * b;
6
- }
7
- }
@@ -1,8 +0,0 @@
1
- #ifndef NITRO_H
2
- #define NITRO_H
3
-
4
- namespace nitro {
5
- double multiply(double a, double b);
6
- }
7
-
8
- #endif /* NITRO_H */
package/ios/Nitro.h DELETED
@@ -1,15 +0,0 @@
1
- #ifdef __cplusplus
2
- #import "react-native-nitro.h"
3
- #endif
4
-
5
- #ifdef RCT_NEW_ARCH_ENABLED
6
- #import "RNNitroSpec.h"
7
-
8
- @interface Nitro : NSObject <NativeNitroSpec>
9
- #else
10
- #import <React/RCTBridgeModule.h>
11
-
12
- @interface Nitro : NSObject <RCTBridgeModule>
13
- #endif
14
-
15
- @end
package/ios/Nitro.mm DELETED
@@ -1,21 +0,0 @@
1
- #import "Nitro.h"
2
-
3
- @implementation Nitro
4
- RCT_EXPORT_MODULE()
5
-
6
- // Don't compile this code when we build for the old architecture.
7
- #ifdef RCT_NEW_ARCH_ENABLED
8
- - (NSNumber *)multiply:(double)a b:(double)b {
9
- NSNumber *result = @(nitro::multiply(a, b));
10
-
11
- return result;
12
- }
13
-
14
- - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
15
- (const facebook::react::ObjCTurboModule::InitParams &)params
16
- {
17
- return std::make_shared<facebook::react::NativeNitroSpecJSI>(params);
18
- }
19
- #endif
20
-
21
- @end
@@ -1,9 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _reactNative = require("react-native");
8
- var _default = exports.default = _reactNative.TurboModuleRegistry.getEnforcing('Nitro');
9
- //# sourceMappingURL=NativeNitro.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeNitro.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAMpCC,gCAAmB,CAACC,YAAY,CAAO,OAAO,CAAC","ignoreList":[]}
@@ -1,3 +0,0 @@
1
- import { TurboModuleRegistry } from 'react-native';
2
- export default TurboModuleRegistry.getEnforcing('Nitro');
3
- //# sourceMappingURL=NativeNitro.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeNitro.ts"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAc;AAMlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,OAAO,CAAC","ignoreList":[]}
@@ -1,7 +0,0 @@
1
- import type { TurboModule } from 'react-native';
2
- export interface Spec extends TurboModule {
3
- multiply(a: number, b: number): number;
4
- }
5
- declare const _default: Spec;
6
- export default _default;
7
- //# sourceMappingURL=NativeNitro.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NativeNitro.d.ts","sourceRoot":"","sources":["../../../src/NativeNitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACxC;;AAED,wBAA+D"}
@@ -1,2 +0,0 @@
1
- export declare function multiply(a: number, b: number): number;
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD"}
@@ -1,41 +0,0 @@
1
- require "json"
2
-
3
- package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
- folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
5
-
6
- Pod::Spec.new do |s|
7
- s.name = "react-native-nitro"
8
- s.version = package["version"]
9
- s.summary = package["description"]
10
- s.homepage = package["homepage"]
11
- s.license = package["license"]
12
- s.authors = package["author"]
13
-
14
- s.platforms = { :ios => min_ios_version_supported }
15
- s.source = { :git => "https://github.com/mrousavy/react-native-nitro.git", :tag => "#{s.version}" }
16
-
17
- s.source_files = "ios/**/*.{h,m,mm}", "cpp/**/*.{hpp,cpp,c,h}"
18
-
19
- # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
20
- # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
21
- if respond_to?(:install_modules_dependencies, true)
22
- install_modules_dependencies(s)
23
- else
24
- s.dependency "React-Core"
25
-
26
- # Don't install the dependencies when we run `pod install` in the old architecture.
27
- if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
28
- s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
29
- s.pod_target_xcconfig = {
30
- "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
31
- "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
32
- "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
33
- }
34
- s.dependency "React-Codegen"
35
- s.dependency "RCT-Folly"
36
- s.dependency "RCTRequired"
37
- s.dependency "RCTTypeSafety"
38
- s.dependency "ReactCommon/turbomodule/core"
39
- end
40
- end
41
- end
@@ -1,8 +0,0 @@
1
- import type { TurboModule } from 'react-native';
2
- import { TurboModuleRegistry } from 'react-native';
3
-
4
- export interface Spec extends TurboModule {
5
- multiply(a: number, b: number): number;
6
- }
7
-
8
- export default TurboModuleRegistry.getEnforcing<Spec>('Nitro');
package/src/index.tsx DELETED
@@ -1,5 +0,0 @@
1
- const Nitro = require('./NativeNitro').default;
2
-
3
- export function multiply(a: number, b: number): number {
4
- return Nitro.multiply(a, b);
5
- }