passing lint but in a bad way

This commit is contained in:
EthanShoeDev
2025-09-13 02:29:05 -04:00
parent f1555446e9
commit 51ec527505
25 changed files with 3128 additions and 12463 deletions

View File

@@ -6,7 +6,8 @@
"**/mnt/**", "**/mnt/**",
"**/dist/**", "**/dist/**",
"**/node_modules/**", "**/node_modules/**",
"**/android/**" "**/android/**",
"**/generated/**"
], ],
"threshold": 0, "threshold": 0,
"minTokens": 50, "minTokens": 50,

View File

@@ -31,4 +31,7 @@ avd-start-headless:
avd-mirror-remote ssh_target: avd-mirror-remote ssh_target:
ssh -N -L 5037:127.0.0.1:5037 {{ ssh_target }} ssh -N -L 5037:127.0.0.1:5037 {{ ssh_target }}
scrcpy scrcpy
adb-logs:
while ! adb logcat --pid=$(adb shell pidof -s dev.fressh.app); do sleep 1; done

View File

@@ -21,7 +21,8 @@
"typecheck": "tsc", "typecheck": "tsc",
"lint:fix": "eslint --fix --max-warnings 0 --report-unused-disable-directives .", "lint:fix": "eslint --fix --max-warnings 0 --report-unused-disable-directives .",
"eslint:check": "eslint --max-warnings 0 --report-unused-disable-directives .", "eslint:check": "eslint --max-warnings 0 --report-unused-disable-directives .",
"test:e2e": "maestro test test/e2e/" "test:e2e": "maestro test test/e2e/",
"adb:logs": "while ! adb logcat --pid=$(adb shell pidof -s dev.fressh.app); do sleep 1; done"
}, },
"dependencies": { "dependencies": {
"@dylankenneally/react-native-ssh-sftp": "^1.5.20", "@dylankenneally/react-native-ssh-sftp": "^1.5.20",

View File

@@ -2,12 +2,19 @@
"extends": "expo/tsconfig.base", "extends": "expo/tsconfig.base",
"compilerOptions": { "compilerOptions": {
"strict": true, "strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true, // https://github.com/jhugman/uniffi-bindgen-react-native/pull/198
// https://github.com/microsoft/TypeScript/issues/41883#issuecomment-1758692340
// "noUnusedLocals": true,
// "noUnusedParameters": true,
"noUnusedLocals": false,
"noUnusedParameters": false,
"noImplicitOverride": false,
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true, "noUncheckedIndexedAccess": true,
"verbatimModuleSyntax": true, "verbatimModuleSyntax": true,
"noImplicitOverride": true, // "noImplicitOverride": true,
"allowJs": true, "allowJs": true,
"strictNullChecks": true, "strictNullChecks": true,
"baseUrl": ".", "baseUrl": ".",
@@ -21,5 +28,6 @@
".expo/types/**/*.ts", ".expo/types/**/*.ts",
"expo-env.d.ts", "expo-env.d.ts",
"eslint.config.js" "eslint.config.js"
] ],
"exclude": ["**/node_modules"]
} }

View File

@@ -88,3 +88,5 @@ nitrogen/
# From uniffi-bindgen-react-native # From uniffi-bindgen-react-native
rust_modules/ rust_modules/
*.a *.a
android/
cpp/

View File

@@ -1,76 +0,0 @@
# Generated by uniffi-bindgen-react-native
cmake_minimum_required(VERSION 3.9.0)
project(UniffiRussh)
set (CMAKE_VERBOSE_MAKEFILE ON)
set (CMAKE_CXX_STANDARD 17)
# Resolve the path to the uniffi-bindgen-react-native package
execute_process(
COMMAND node -p "require.resolve('uniffi-bindgen-react-native/package.json')"
OUTPUT_VARIABLE UNIFFI_BINDGEN_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Get the directory; get_filename_component and cmake_path will normalize
# paths with Windows path separators.
get_filename_component(UNIFFI_BINDGEN_PATH "${UNIFFI_BINDGEN_PATH}" DIRECTORY)
# Specifies a path to native header files.
include_directories(
../cpp
../cpp/generated
${UNIFFI_BINDGEN_PATH}/cpp/includes
)
add_library(react-native-uniffi-russh SHARED
../cpp/react-native-uniffi-russh.cpp
../cpp/generated/foobar.cpp
cpp-adapter.cpp
)
# Set C++ compiler flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-all")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
cmake_path(
SET MY_RUST_LIB
${CMAKE_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/libfoobar.a
NORMALIZE
)
add_library(my_rust_lib STATIC IMPORTED)
set_target_properties(my_rust_lib PROPERTIES IMPORTED_LOCATION ${MY_RUST_LIB})
# Add ReactAndroid libraries, being careful to account for different versions.
find_package(ReactAndroid REQUIRED CONFIG)
find_library(LOGCAT log)
# REACTNATIVE_MERGED_SO seems to be only be set in a build.gradle.kt file,
# which we don't use. Thus falling back to version number sniffing.
if (ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
set(REACTNATIVE_MERGED_SO true)
endif()
# https://github.com/react-native-community/discussions-and-proposals/discussions/816
# This if-then-else can be removed once this library does not support version below 0.76
if (REACTNATIVE_MERGED_SO)
target_link_libraries(react-native-uniffi-russh ReactAndroid::reactnative)
else()
target_link_libraries(react-native-uniffi-russh
ReactAndroid::turbomodulejsijni
ReactAndroid::react_nativemodule_core
)
endif()
find_package(fbjni REQUIRED CONFIG)
target_link_libraries(
react-native-uniffi-russh
fbjni::fbjni
ReactAndroid::jsi
${LOGCAT}
my_rust_lib
)

View File

@@ -1,144 +0,0 @@
// Generated by uniffi-bindgen-react-native
buildscript {
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["DummyLibForAndroid_kotlinVersion"]
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.2.1"
// noinspection DifferentKotlinGradleVersion
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
def reactNativeArchitectures() {
def value = rootProject.getProperties().get("reactNativeArchitectures")
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
}
def isNewArchitectureEnabled() {
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
}
apply plugin: "com.android.library"
apply plugin: "kotlin-android"
if (isNewArchitectureEnabled()) {
apply plugin: "com.facebook.react"
}
def getExtOrDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["UniffiRussh_" + name]
}
def getExtOrIntegerDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["UniffiRussh_" + name]).toInteger()
}
def supportsNamespace() {
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
def major = parsed[0].toInteger()
def minor = parsed[1].toInteger()
// Namespace support was added in 7.3.0
return (major == 7 && minor >= 3) || major >= 8
}
android {
if (supportsNamespace()) {
namespace "com.uniffirussh"
sourceSets {
main {
manifest.srcFile "src/main/AndroidManifestNew.xml"
}
}
}
ndkVersion getExtOrDefault("ndkVersion")
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
defaultConfig {
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
consumerProguardFiles 'proguard-rules.pro'
buildFeatures {
prefab true
}
externalNativeBuild {
cmake {
arguments '-DANDROID_STL=c++_shared'
abiFilters (*reactNativeArchitectures())
}
}
ndk {
abiFilters "arm64-v8a", "armeabi-v7a", "x86", "x86_64"
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
buildFeatures {
buildConfig true
}
buildTypes {
release {
minifyEnabled false
}
}
lintOptions {
disable "GradleCompatible"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
sourceSets {
main {
if (isNewArchitectureEnabled()) {
java.srcDirs += [
"generated/java",
"generated/jni"
]
}
}
}
}
repositories {
mavenCentral()
google()
}
def kotlin_version = getExtOrDefault("kotlinVersion")
dependencies {
// For < 0.71, this will be from the local maven repo
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
if (isNewArchitectureEnabled()) {
react {
jsRootDir = file("../src/")
libraryName = "UniffiRussh"
codegenJavaPackageName = "com.uniffirussh"
}
}

View File

@@ -1,63 +0,0 @@
// Generated by uniffi-bindgen-react-native
#include <jni.h>
#include <jsi/jsi.h>
#include <ReactCommon/CallInvokerHolder.h>
#include "react-native-uniffi-russh.h"
namespace jsi = facebook::jsi;
namespace react = facebook::react;
// Automated testing checks Java_com_uniffirussh_UniffiRusshModule and uniffirussh
// by comparing the whole line here.
/*
Java_com_uniffirussh_UniffiRusshModule_nativeMultiply(JNIEnv *env, jclass type, jdouble a, jdouble b) {
return uniffirussh::multiply(a, b);
}
*/
// Installer coming from UniffiRusshModule
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_uniffirussh_UniffiRusshModule_nativeInstallRustCrate(
JNIEnv *env,
jclass type,
jlong rtPtr,
jobject callInvokerHolderJavaObj
) {
// https://github.com/realm/realm-js/blob/main/packages/realm/binding/android/src/main/cpp/io_realm_react_RealmReactModule.cpp#L122-L145
// React Native uses the fbjni library for handling JNI, which has the concept of "hybrid objects",
// which are Java objects containing a pointer to a C++ object. The CallInvokerHolder, which has the
// invokeAsync method we want access to, is one such hybrid object.
// Rather than reworking our code to use fbjni throughout, this code unpacks the C++ object from the Java
// object `callInvokerHolderJavaObj` manually, based on reverse engineering the fbjni code.
// 1. Get the Java object referred to by the mHybridData field of the Java holder object
auto callInvokerHolderClass = env->GetObjectClass(callInvokerHolderJavaObj);
auto hybridDataField = env->GetFieldID(callInvokerHolderClass, "mHybridData", "Lcom/facebook/jni/HybridData;");
auto hybridDataObj = env->GetObjectField(callInvokerHolderJavaObj, hybridDataField);
// 2. Get the destructor Java object referred to by the mDestructor field from the myHybridData Java object
auto hybridDataClass = env->FindClass("com/facebook/jni/HybridData");
auto destructorField =
env->GetFieldID(hybridDataClass, "mDestructor", "Lcom/facebook/jni/HybridData$Destructor;");
auto destructorObj = env->GetObjectField(hybridDataObj, destructorField);
// 3. Get the mNativePointer field from the mDestructor Java object
auto destructorClass = env->FindClass("com/facebook/jni/HybridData$Destructor");
auto nativePointerField = env->GetFieldID(destructorClass, "mNativePointer", "J");
auto nativePointerValue = env->GetLongField(destructorObj, nativePointerField);
// 4. Cast the mNativePointer back to its C++ type
auto nativePointer = reinterpret_cast<facebook::react::CallInvokerHolder*>(nativePointerValue);
auto jsCallInvoker = nativePointer->getCallInvoker();
auto runtime = reinterpret_cast<jsi::Runtime *>(rtPtr);
return uniffirussh::installRustCrate(*runtime, jsCallInvoker);
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_uniffirussh_UniffiRusshModule_nativeCleanupRustCrate(JNIEnv *env, jclass type, jlong rtPtr) {
auto runtime = reinterpret_cast<jsi::Runtime *>(rtPtr);
return uniffirussh::cleanupRustCrate(*runtime);
}

View File

@@ -1,5 +0,0 @@
UniffiRussh_kotlinVersion=2.0.21
UniffiRussh_minSdkVersion=24
UniffiRussh_targetSdkVersion=34
UniffiRussh_compileSdkVersion=35
UniffiRussh_ndkVersion=27.1.12297006

View File

@@ -1,5 +0,0 @@
<!-- Generated by uniffi-bindgen-react-native -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.uniffirussh">
</manifest>

View File

@@ -1,43 +0,0 @@
// Generated by uniffi-bindgen-react-native
package com.uniffirussh
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.module.annotations.ReactModule
import com.facebook.react.turbomodule.core.interfaces.CallInvokerHolder
@ReactModule(name = UniffiRusshModule.NAME)
class UniffiRusshModule(reactContext: ReactApplicationContext) :
NativeUniffiRusshSpec(reactContext) {
override fun getName(): String {
return NAME
}
// Two native methods implemented in cpp-adapter.cpp, and ultimately
// react-native-uniffi-russh.cpp
external fun nativeInstallRustCrate(runtimePointer: Long, callInvoker: CallInvokerHolder): Boolean
external fun nativeCleanupRustCrate(runtimePointer: Long): Boolean
override fun installRustCrate(): Boolean {
val context = this.reactApplicationContext
return nativeInstallRustCrate(
context.javaScriptContextHolder!!.get(),
context.jsCallInvokerHolder!!
)
}
override fun cleanupRustCrate(): Boolean {
return nativeCleanupRustCrate(
this.reactApplicationContext.javaScriptContextHolder!!.get()
)
}
companion object {
const val NAME = "UniffiRussh"
init {
System.loadLibrary("react-native-uniffi-russh")
}
}
}

View File

@@ -1,34 +0,0 @@
// Generated by uniffi-bindgen-react-native
package com.uniffirussh
import com.facebook.react.TurboReactPackage
import com.facebook.react.bridge.NativeModule
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.module.model.ReactModuleInfo
import com.facebook.react.module.model.ReactModuleInfoProvider
import java.util.HashMap
class UniffiRusshPackage : TurboReactPackage() {
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
return if (name == UniffiRusshModule.NAME) {
UniffiRusshModule(reactContext)
} else {
null
}
}
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
return ReactModuleInfoProvider {
val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
moduleInfos[UniffiRusshModule.NAME] = ReactModuleInfo(
UniffiRusshModule.NAME,
UniffiRusshModule.NAME,
false, // canOverrideExistingModule
false, // needsEagerInit
false, // isCxxModule
true // isTurboModule
)
moduleInfos
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,85 +0,0 @@
// This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
// Trust me, you don't want to mess with it!
#pragma once
#include <jsi/jsi.h>
#include <iostream>
#include <map>
#include <memory>
#include <ReactCommon/CallInvoker.h>
#include "UniffiCallInvoker.h"
namespace react = facebook::react;
namespace jsi = facebook::jsi;
class NativeFoobar : public jsi::HostObject {
private:
// For calling back into JS from Rust.
std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker;
protected:
std::map<std::string,jsi::Value> props;
jsi::Value cpp_uniffi_internal_fn_func_ffi__string_to_byte_length(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_internal_fn_func_ffi__string_to_arraybuffer(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_internal_fn_func_ffi__arraybuffer_to_string(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_fn_clone_binaryoperator(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_fn_free_binaryoperator(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_fn_init_callback_vtable_binaryoperator(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_fn_method_binaryoperator_perform(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_fn_clone_calculator(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_fn_free_calculator(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_fn_constructor_calculator_new(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_fn_method_calculator_calculate(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_fn_method_calculator_calculate_more(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_fn_method_calculator_last_result(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_fn_clone_safeaddition(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_fn_free_safeaddition(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_fn_constructor_safeaddition_new(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_fn_method_safeaddition_perform(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_fn_clone_safedivision(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_fn_free_safedivision(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_fn_constructor_safedivision_new(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_fn_method_safedivision_perform(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_fn_func_safe_addition_operator(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_fn_func_safe_division_operator(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_checksum_func_safe_addition_operator(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_checksum_func_safe_division_operator(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_checksum_method_binaryoperator_perform(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_checksum_method_calculator_calculate(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_checksum_method_calculator_calculate_more(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_checksum_method_calculator_last_result(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_checksum_method_safeaddition_perform(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_checksum_method_safedivision_perform(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_checksum_constructor_calculator_new(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_checksum_constructor_safeaddition_new(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_foobar_checksum_constructor_safedivision_new(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_ffi_foobar_uniffi_contract_version(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_internal_fn_method_binaryoperator_ffi__bless_pointer(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_internal_fn_method_calculator_ffi__bless_pointer(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_internal_fn_method_safeaddition_ffi__bless_pointer(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
jsi::Value cpp_uniffi_internal_fn_method_safedivision_ffi__bless_pointer(jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count);
public:
NativeFoobar(jsi::Runtime &rt, std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker);
virtual ~NativeFoobar();
/**
* The entry point into the crate.
*
* React Native must call `NativeFoobar.registerModule(rt, callInvoker)` before using
* the Javascript interface.
*/
static void registerModule(jsi::Runtime &rt, std::shared_ptr<react::CallInvoker> callInvoker);
/**
* Some cleanup into the crate goes here.
*
* Current implementation is empty, however, this is not guaranteed to always be the case.
*
* Clients should call `NativeFoobar.unregisterModule(rt)` after final use where possible.
*/
static void unregisterModule(jsi::Runtime &rt);
virtual jsi::Value get(jsi::Runtime& rt, const jsi::PropNameID& name);
virtual void set(jsi::Runtime& rt,const jsi::PropNameID& name,const jsi::Value& value);
virtual std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& rt);
};

View File

@@ -1,16 +0,0 @@
// Generated by uniffi-bindgen-react-native
#include "react-native-uniffi-russh.h"
#include "generated/foobar.hpp"
namespace uniffirussh {
using namespace facebook;
uint8_t installRustCrate(jsi::Runtime &runtime, std::shared_ptr<react::CallInvoker> callInvoker) {
NativeFoobar::registerModule(runtime, callInvoker);
return true;
}
uint8_t cleanupRustCrate(jsi::Runtime &runtime) {
return false;
}
}

View File

@@ -1,15 +0,0 @@
#ifndef UNIFFIRUSSH_H
#define UNIFFIRUSSH_H
// Generated by uniffi-bindgen-react-native
#include <cstdint>
#include <jsi/jsi.h>
#include <ReactCommon/CallInvoker.h>
namespace uniffirussh {
using namespace facebook;
uint8_t installRustCrate(jsi::Runtime &runtime, std::shared_ptr<react::CallInvoker> callInvoker);
uint8_t cleanupRustCrate(jsi::Runtime &runtime);
}
#endif /* UNIFFIRUSSH_H */

View File

@@ -1,7 +1,6 @@
import { fixupConfigRules } from '@eslint/compat'; import { fixupConfigRules } from '@eslint/compat';
import { FlatCompat } from '@eslint/eslintrc'; import { FlatCompat } from '@eslint/eslintrc';
import js from '@eslint/js'; import js from '@eslint/js';
import prettier from 'eslint-plugin-prettier';
import { defineConfig } from 'eslint/config'; import { defineConfig } from 'eslint/config';
import path from 'node:path'; import path from 'node:path';
import { fileURLToPath } from 'node:url'; import { fileURLToPath } from 'node:url';
@@ -16,11 +15,9 @@ const compat = new FlatCompat({
export default defineConfig([ export default defineConfig([
{ {
extends: fixupConfigRules(compat.extends('@react-native', 'prettier')), extends: fixupConfigRules(compat.extends('@react-native')),
plugins: { prettier },
rules: { rules: {
'react/react-in-jsx-scope': 'off', 'react/react-in-jsx-scope': 'off',
'prettier/prettier': 'error',
}, },
}, },
{ {

View File

@@ -6,14 +6,12 @@
"types": "./lib/typescript/src/index.d.ts", "types": "./lib/typescript/src/index.d.ts",
"exports": { "exports": {
".": { ".": {
"source": "./src/index.tsx",
"types": "./lib/typescript/src/index.d.ts", "types": "./lib/typescript/src/index.d.ts",
"default": "./lib/module/index.js" "default": "./lib/module/index.js"
}, },
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"files": [ "files": [
"src",
"lib", "lib",
"android", "android",
"ios", "ios",
@@ -66,23 +64,21 @@
"@react-native/eslint-config": "^0.81.1", "@react-native/eslint-config": "^0.81.1",
"@release-it/conventional-changelog": "^10.0.1", "@release-it/conventional-changelog": "^10.0.1",
"@types/jest": "^29.5.14", "@types/jest": "^29.5.14",
"@types/react": "^19.1.0", "@types/react": "~19.1.12",
"del-cli": "^6.0.0", "del-cli": "^6.0.0",
"eslint": "^9.35.0", "eslint": "^9.35.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.4",
"jest": "^29.7.0", "jest": "^29.7.0",
"prettier": "^3.6.2", "prettier": "^3.6.2",
"react": "19.1.0", "react": "19.1.0",
"react-native": "0.81.1", "react-native": "0.81.4",
"react-native-builder-bob": "^0.40.13", "react-native-builder-bob": "^0.40.13",
"release-it": "^19.0.4", "release-it": "^19.0.4",
"turbo": "^2.5.6", "turbo": "^2.5.6",
"typescript": "^5.9.2" "typescript": "~5.9.2"
}, },
"peerDependencies": { "peerDependencies": {
"react": "*", "react": "19.1.0",
"react-native": "*" "react-native": "0.81.4"
}, },
"packageManager": "pnpm@10.15.1", "packageManager": "pnpm@10.15.1",
"jest": { "jest": {

View File

@@ -0,0 +1,9 @@
module.exports = {
dependency: {
platforms: {
android: { sourceDir: 'android' },
// add ios if you generate it later:
// ios: { project: 'ios/ReactNativeUniffiRussh.xcodeproj' },
},
},
};

View File

@@ -7,4 +7,4 @@ export interface Spec extends TurboModule {
cleanupRustCrate(): boolean; cleanupRustCrate(): boolean;
} }
export default TurboModuleRegistry.getEnforcing<Spec>('UniffiRussh'); export default TurboModuleRegistry.getEnforcing<Spec>('UniffiRussh');

View File

@@ -1,53 +1,20 @@
// This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate. // This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
// Trust me, you don't want to mess with it! // Trust me, you don't want to mess with it!
import nativeModule, { import nativeModule, {
type UniffiRustFutureContinuationCallback,
type UniffiForeignFuture,
type UniffiForeignFutureStructU8,
type UniffiForeignFutureCompleteU8,
type UniffiForeignFutureStructI8,
type UniffiForeignFutureCompleteI8,
type UniffiForeignFutureStructU16,
type UniffiForeignFutureCompleteU16,
type UniffiForeignFutureStructI16,
type UniffiForeignFutureCompleteI16,
type UniffiForeignFutureStructU32,
type UniffiForeignFutureCompleteU32,
type UniffiForeignFutureStructI32,
type UniffiForeignFutureCompleteI32,
type UniffiForeignFutureStructU64,
type UniffiForeignFutureCompleteU64,
type UniffiForeignFutureStructI64,
type UniffiForeignFutureCompleteI64,
type UniffiForeignFutureStructF32,
type UniffiForeignFutureCompleteF32,
type UniffiForeignFutureStructF64,
type UniffiForeignFutureCompleteF64,
type UniffiForeignFutureStructPointer,
type UniffiForeignFutureCompletePointer,
type UniffiForeignFutureStructRustBuffer,
type UniffiForeignFutureCompleteRustBuffer,
type UniffiForeignFutureStructVoid,
type UniffiForeignFutureCompleteVoid,
type UniffiVTableCallbackInterfaceBinaryOperator, type UniffiVTableCallbackInterfaceBinaryOperator,
} from './foobar-ffi'; } from './foobar-ffi';
import { import {
type FfiConverter,
type UniffiByteArray, type UniffiByteArray,
type UniffiHandle, type UniffiHandle,
type UniffiObjectFactory, type UniffiObjectFactory,
type UniffiReferenceHolder,
type UniffiRustArcPtr, type UniffiRustArcPtr,
type UniffiRustCallStatus,
type UnsafeMutableRawPointer, type UnsafeMutableRawPointer,
AbstractFfiConverterByteArray, AbstractFfiConverterByteArray,
FfiConverterBool,
FfiConverterInt32, FfiConverterInt32,
FfiConverterInt64, FfiConverterInt64,
FfiConverterObject, FfiConverterObject,
FfiConverterObjectWithCallbacks, FfiConverterObjectWithCallbacks,
FfiConverterOptional, FfiConverterOptional,
FfiConverterUInt64,
RustBuffer, RustBuffer,
UniffiAbstractObject, UniffiAbstractObject,
UniffiEnum, UniffiEnum,
@@ -61,7 +28,6 @@ import {
uniffiCreateRecord, uniffiCreateRecord,
uniffiTraitInterfaceCallWithError, uniffiTraitInterfaceCallWithError,
uniffiTypeNameSymbol, uniffiTypeNameSymbol,
variantOrdinalSymbol,
} from 'uniffi-bindgen-react-native'; } from 'uniffi-bindgen-react-native';
// Get converters from the other files, if any. // Get converters from the other files, if any.

View File

@@ -38,4 +38,3 @@ export async function uniffiInitAsync() {
export default { export default {
foobar, foobar,
}; };

View File

@@ -19,12 +19,15 @@
"noImplicitUseStrict": false, "noImplicitUseStrict": false,
"noStrictGenericChecks": false, "noStrictGenericChecks": false,
"noUncheckedIndexedAccess": true, "noUncheckedIndexedAccess": true,
"noUnusedLocals": true, // "noUnusedLocals": true,
"noUnusedParameters": true, // "noUnusedParameters": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"skipLibCheck": true, "skipLibCheck": true,
"strict": true, "strict": true,
"target": "ESNext", "target": "ESNext",
"verbatimModuleSyntax": true "verbatimModuleSyntax": true,
} "noUnusedLocals": false,
"noUnusedParameters": false
},
"exclude": ["**/node_modules"]
} }

View File

@@ -10,33 +10,15 @@
"android", "android",
"!android/build", "!android/build",
"src/*.ts", "src/*.ts",
"src/*.tsx", "src/*.tsx"
"example/package.json",
"example/android",
"!example/android/.gradle",
"!example/android/build",
"!example/android/app/build"
], ],
"outputs": [] "outputs": []
}, },
"build:ios": { "build:ios": {
"env": [ "env": ["RCT_USE_RN_DEP", "RCT_USE_PREBUILT_RNCORE"],
"RCT_NEW_ARCH_ENABLED", "inputs": ["package.json", "*.podspec", "ios", "src/*.ts", "src/*.tsx"],
"RCT_USE_RN_DEP",
"RCT_USE_PREBUILT_RNCORE"
],
"inputs": [
"package.json",
"*.podspec",
"ios",
"src/*.ts",
"src/*.tsx",
"example/package.json",
"example/ios",
"!example/ios/build",
"!example/ios/Pods"
],
"outputs": [] "outputs": []
} }
} },
"extends": ["//"]
} }

12007
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff