react-native-nitro-modules 0.0.2
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/LICENSE +20 -0
- package/README.md +32 -0
- package/android/CMakeLists.txt +15 -0
- package/android/build.gradle +127 -0
- package/android/cpp-adapter.cpp +8 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/nitro/NitroModule.java +34 -0
- package/android/src/main/java/com/nitro/NitroPackage.java +44 -0
- package/cpp/react-native-nitro.cpp +7 -0
- package/cpp/react-native-nitro.h +8 -0
- package/ios/Nitro.h +15 -0
- package/ios/Nitro.mm +21 -0
- package/lib/commonjs/NativeNitro.js +9 -0
- package/lib/commonjs/NativeNitro.js.map +1 -0
- package/lib/commonjs/index.js +11 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/NativeNitro.js +3 -0
- package/lib/module/NativeNitro.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/src/NativeNitro.d.ts +7 -0
- package/lib/typescript/src/NativeNitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +157 -0
- package/react-native-nitro.podspec +41 -0
- package/src/NativeNitro.ts +8 -0
- package/src/index.tsx +5 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
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)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.4.1)
|
|
2
|
+
project(Nitro)
|
|
3
|
+
|
|
4
|
+
set (CMAKE_VERBOSE_MAKEFILE ON)
|
|
5
|
+
set (CMAKE_CXX_STANDARD 14)
|
|
6
|
+
|
|
7
|
+
add_library(react-native-nitro SHARED
|
|
8
|
+
../cpp/react-native-nitro.cpp
|
|
9
|
+
cpp-adapter.cpp
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
# Specifies a path to native header files.
|
|
13
|
+
include_directories(
|
|
14
|
+
../cpp
|
|
15
|
+
)
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
repositories {
|
|
3
|
+
google()
|
|
4
|
+
mavenCentral()
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
dependencies {
|
|
8
|
+
classpath "com.android.tools.build:gradle:7.2.1"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
def reactNativeArchitectures() {
|
|
13
|
+
def value = rootProject.getProperties().get("reactNativeArchitectures")
|
|
14
|
+
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
def isNewArchitectureEnabled() {
|
|
18
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
apply plugin: "com.android.library"
|
|
22
|
+
|
|
23
|
+
if (isNewArchitectureEnabled()) {
|
|
24
|
+
apply plugin: "com.facebook.react"
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
def getExtOrDefault(name) {
|
|
28
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["Nitro_" + name]
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
def getExtOrIntegerDefault(name) {
|
|
32
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Nitro_" + name]).toInteger()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
def supportsNamespace() {
|
|
36
|
+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
|
37
|
+
def major = parsed[0].toInteger()
|
|
38
|
+
def minor = parsed[1].toInteger()
|
|
39
|
+
|
|
40
|
+
// Namespace support was added in 7.3.0
|
|
41
|
+
return (major == 7 && minor >= 3) || major >= 8
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
android {
|
|
45
|
+
if (supportsNamespace()) {
|
|
46
|
+
namespace "com.nitro"
|
|
47
|
+
|
|
48
|
+
sourceSets {
|
|
49
|
+
main {
|
|
50
|
+
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
ndkVersion getExtOrDefault("ndkVersion")
|
|
56
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
57
|
+
|
|
58
|
+
defaultConfig {
|
|
59
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
60
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
61
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
62
|
+
|
|
63
|
+
externalNativeBuild {
|
|
64
|
+
cmake {
|
|
65
|
+
cppFlags "-O2 -frtti -fexceptions -Wall -fstack-protector-all"
|
|
66
|
+
abiFilters (*reactNativeArchitectures())
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
externalNativeBuild {
|
|
72
|
+
cmake {
|
|
73
|
+
path "CMakeLists.txt"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
buildFeatures {
|
|
78
|
+
buildConfig true
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
buildTypes {
|
|
82
|
+
release {
|
|
83
|
+
minifyEnabled false
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
lintOptions {
|
|
88
|
+
disable "GradleCompatible"
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
compileOptions {
|
|
92
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
93
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
sourceSets {
|
|
97
|
+
main {
|
|
98
|
+
if (isNewArchitectureEnabled()) {
|
|
99
|
+
java.srcDirs += [
|
|
100
|
+
// This is needed to build Kotlin project with NewArch enabled
|
|
101
|
+
"${project.buildDir}/generated/source/codegen/java"
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
repositories {
|
|
109
|
+
mavenCentral()
|
|
110
|
+
google()
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
dependencies {
|
|
115
|
+
// For < 0.71, this will be from the local maven repo
|
|
116
|
+
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
117
|
+
//noinspection GradleDynamicVersion
|
|
118
|
+
implementation "com.facebook.react:react-native:+"
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (isNewArchitectureEnabled()) {
|
|
122
|
+
react {
|
|
123
|
+
jsRootDir = file("../src/")
|
|
124
|
+
libraryName = "Nitro"
|
|
125
|
+
codegenJavaPackageName = "com.nitro"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
}
|
package/ios/Nitro.h
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.multiply = multiply;
|
|
7
|
+
const Nitro = require('./NativeNitro').default;
|
|
8
|
+
function multiply(a, b) {
|
|
9
|
+
return Nitro.multiply(a, b);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Nitro","require","default","multiply","a","b"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;AAAA,MAAMA,KAAK,GAAGC,OAAO,CAAC,eAAe,CAAC,CAACC,OAAO;AAEvC,SAASC,QAAQA,CAACC,CAAS,EAAEC,CAAS,EAAU;EACrD,OAAOL,KAAK,CAACG,QAAQ,CAACC,CAAC,EAAEC,CAAC,CAAC;AAC7B","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
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":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Nitro","require","default","multiply","a","b"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,MAAMA,KAAK,GAAGC,OAAO,CAAC,eAAe,CAAC,CAACC,OAAO;AAE9C,OAAO,SAASC,QAAQA,CAACC,CAAS,EAAEC,CAAS,EAAU;EACrD,OAAOL,KAAK,CAACG,QAAQ,CAACC,CAAC,EAAEC,CAAC,CAAC;AAC7B","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/package.json
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-nitro-modules",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Nitro Modules",
|
|
5
|
+
"main": "lib/commonjs/index",
|
|
6
|
+
"module": "lib/module/index",
|
|
7
|
+
"types": "lib/typescript/src/index.d.ts",
|
|
8
|
+
"react-native": "src/index",
|
|
9
|
+
"source": "src/index",
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"lib",
|
|
13
|
+
"android",
|
|
14
|
+
"ios",
|
|
15
|
+
"cpp",
|
|
16
|
+
"*.podspec",
|
|
17
|
+
"!ios/build",
|
|
18
|
+
"!android/build",
|
|
19
|
+
"!android/gradle",
|
|
20
|
+
"!android/gradlew",
|
|
21
|
+
"!android/gradlew.bat",
|
|
22
|
+
"!android/local.properties",
|
|
23
|
+
"!**/__tests__",
|
|
24
|
+
"!**/__fixtures__",
|
|
25
|
+
"!**/__mocks__",
|
|
26
|
+
"!**/.*"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"example": "yarn workspace react-native-nitro-example",
|
|
30
|
+
"test": "jest",
|
|
31
|
+
"typecheck": "tsc --noEmit",
|
|
32
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
33
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
34
|
+
"prepare": "bob build",
|
|
35
|
+
"release": "release-it"
|
|
36
|
+
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"react-native",
|
|
39
|
+
"ios",
|
|
40
|
+
"android"
|
|
41
|
+
],
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "git+https://github.com/mrousavy/react-native-nitro.git"
|
|
45
|
+
},
|
|
46
|
+
"author": "Marc Rousavy <me@mrousavy.com> (https://github.com/mrousavy)",
|
|
47
|
+
"license": "MIT",
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/mrousavy/react-native-nitro/issues"
|
|
50
|
+
},
|
|
51
|
+
"homepage": "https://github.com/mrousavy/react-native-nitro#readme",
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"registry": "https://registry.npmjs.org/"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@react-native/eslint-config": "^0.73.1",
|
|
57
|
+
"@release-it/conventional-changelog": "^5.0.0",
|
|
58
|
+
"@types/jest": "^29.5.5",
|
|
59
|
+
"@types/react": "^18.2.44",
|
|
60
|
+
"del-cli": "^5.1.0",
|
|
61
|
+
"eslint": "^8.51.0",
|
|
62
|
+
"eslint-config-prettier": "^9.0.0",
|
|
63
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
64
|
+
"jest": "^29.7.0",
|
|
65
|
+
"prettier": "^3.0.3",
|
|
66
|
+
"react": "18.2.0",
|
|
67
|
+
"react-native": "0.74.2",
|
|
68
|
+
"react-native-builder-bob": "^0.23.2",
|
|
69
|
+
"release-it": "^15.0.0",
|
|
70
|
+
"turbo": "^1.10.7",
|
|
71
|
+
"typescript": "^5.2.2"
|
|
72
|
+
},
|
|
73
|
+
"resolutions": {
|
|
74
|
+
"@types/react": "^18.2.44"
|
|
75
|
+
},
|
|
76
|
+
"peerDependencies": {
|
|
77
|
+
"react": "*",
|
|
78
|
+
"react-native": "*"
|
|
79
|
+
},
|
|
80
|
+
"workspaces": [
|
|
81
|
+
"example"
|
|
82
|
+
],
|
|
83
|
+
"packageManager": "yarn@3.6.1",
|
|
84
|
+
"jest": {
|
|
85
|
+
"preset": "react-native",
|
|
86
|
+
"modulePathIgnorePatterns": [
|
|
87
|
+
"<rootDir>/example/node_modules",
|
|
88
|
+
"<rootDir>/lib/"
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
"release-it": {
|
|
92
|
+
"git": {
|
|
93
|
+
"commitMessage": "chore: release ${version}",
|
|
94
|
+
"tagName": "v${version}"
|
|
95
|
+
},
|
|
96
|
+
"npm": {
|
|
97
|
+
"publish": true
|
|
98
|
+
},
|
|
99
|
+
"github": {
|
|
100
|
+
"release": true
|
|
101
|
+
},
|
|
102
|
+
"plugins": {
|
|
103
|
+
"@release-it/conventional-changelog": {
|
|
104
|
+
"preset": "angular"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"eslintConfig": {
|
|
109
|
+
"root": true,
|
|
110
|
+
"extends": [
|
|
111
|
+
"@react-native",
|
|
112
|
+
"prettier"
|
|
113
|
+
],
|
|
114
|
+
"rules": {
|
|
115
|
+
"prettier/prettier": [
|
|
116
|
+
"error",
|
|
117
|
+
{
|
|
118
|
+
"quoteProps": "consistent",
|
|
119
|
+
"singleQuote": true,
|
|
120
|
+
"tabWidth": 2,
|
|
121
|
+
"trailingComma": "es5",
|
|
122
|
+
"useTabs": false
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"eslintIgnore": [
|
|
128
|
+
"node_modules/",
|
|
129
|
+
"lib/"
|
|
130
|
+
],
|
|
131
|
+
"prettier": {
|
|
132
|
+
"quoteProps": "consistent",
|
|
133
|
+
"singleQuote": true,
|
|
134
|
+
"tabWidth": 2,
|
|
135
|
+
"trailingComma": "es5",
|
|
136
|
+
"useTabs": false
|
|
137
|
+
},
|
|
138
|
+
"react-native-builder-bob": {
|
|
139
|
+
"source": "src",
|
|
140
|
+
"output": "lib",
|
|
141
|
+
"targets": [
|
|
142
|
+
"commonjs",
|
|
143
|
+
"module",
|
|
144
|
+
[
|
|
145
|
+
"typescript",
|
|
146
|
+
{
|
|
147
|
+
"project": "tsconfig.build.json"
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
"codegenConfig": {
|
|
153
|
+
"name": "RNNitroSpec",
|
|
154
|
+
"type": "modules",
|
|
155
|
+
"jsSrcsDir": "src"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|