react-native-ariel 0.1.0-dev.52 → 0.1.0-dev.54

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.
@@ -0,0 +1,79 @@
1
+ # Generated by uniffi-bindgen-react-native
2
+ cmake_minimum_required(VERSION 3.9.0)
3
+ project(Ariel)
4
+
5
+ set (CMAKE_VERBOSE_MAKEFILE ON)
6
+ set (CMAKE_CXX_STANDARD 17)
7
+
8
+ # Resolve uniffi-bindgen-react-native includes.
9
+ # When building the library locally: ../node_modules/ (workspace root)
10
+ # When installed as npm dependency: ../../ (npm hoists to consumer's node_modules)
11
+ set(_UNIFFI_LOCAL "${CMAKE_CURRENT_LIST_DIR}/../node_modules/uniffi-bindgen-react-native/cpp/includes")
12
+ set(_UNIFFI_HOISTED "${CMAKE_CURRENT_LIST_DIR}/../../uniffi-bindgen-react-native/cpp/includes")
13
+ if(EXISTS "${_UNIFFI_LOCAL}")
14
+ cmake_path(SET UNIFFI_INCLUDES "${_UNIFFI_LOCAL}" NORMALIZE)
15
+ else()
16
+ cmake_path(SET UNIFFI_INCLUDES "${_UNIFFI_HOISTED}" NORMALIZE)
17
+ endif()
18
+
19
+ include_directories(
20
+ ../cpp
21
+ ../cpp/generated
22
+
23
+ ${UNIFFI_INCLUDES}
24
+ )
25
+
26
+ add_library(react-native-ariel SHARED
27
+ ../cpp/react-native-ariel.cpp
28
+ ../cpp/generated/mermaid_wrapper.cpp
29
+ cpp-adapter.cpp
30
+ )
31
+
32
+ # Set C++ compiler flags
33
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
34
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions")
35
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti")
36
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-all")
37
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
38
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
39
+
40
+ # Set linker flags for 16KB page size alignment (required for Android 15+)
41
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,max-page-size=16384")
42
+
43
+ cmake_path(
44
+ SET MY_RUST_LIB
45
+ ${CMAKE_CURRENT_LIST_DIR}/src/main/jniLibs/${ANDROID_ABI}/libmermaid_wrapper.a
46
+ NORMALIZE
47
+ )
48
+ add_library(my_rust_lib STATIC IMPORTED)
49
+ set_target_properties(my_rust_lib PROPERTIES IMPORTED_LOCATION ${MY_RUST_LIB})
50
+
51
+ # Add ReactAndroid libraries, being careful to account for different versions.
52
+ find_package(ReactAndroid REQUIRED CONFIG)
53
+ find_library(LOGCAT log)
54
+
55
+ # REACTNATIVE_MERGED_SO seems to be only be set in a build.gradle.kt file,
56
+ # which we don't use. Thus falling back to version number sniffing.
57
+ if (ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
58
+ set(REACTNATIVE_MERGED_SO true)
59
+ endif()
60
+
61
+ # https://github.com/react-native-community/discussions-and-proposals/discussions/816
62
+ # This if-then-else can be removed once this library does not support version below 0.76
63
+ if (REACTNATIVE_MERGED_SO)
64
+ target_link_libraries(react-native-ariel ReactAndroid::reactnative)
65
+ else()
66
+ target_link_libraries(react-native-ariel
67
+ ReactAndroid::turbomodulejsijni
68
+ ReactAndroid::react_nativemodule_core
69
+ )
70
+ endif()
71
+
72
+ find_package(fbjni REQUIRED CONFIG)
73
+ target_link_libraries(
74
+ react-native-ariel
75
+ fbjni::fbjni
76
+ ReactAndroid::jsi
77
+ ${LOGCAT}
78
+ my_rust_lib
79
+ )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-ariel",
3
- "version": "0.1.0-dev.52",
3
+ "version": "0.1.0-dev.54",
4
4
  "description": "Mermaid diagrams for React Native and React Native Web. No DOM. No WebView. Pure Rust.",
5
5
  "main": "./lib/module/index.js",
6
6
  "source": "./src/index.tsx",
package/src/index.web.tsx DELETED
@@ -1,17 +0,0 @@
1
- // Generated by uniffi-bindgen-react-native
2
- // Export the generated bindings to the app.
3
- export * from './generated/web/mermaid_wrapper';
4
-
5
- import * as mermaid_wrapper from './generated/web/mermaid_wrapper';
6
-
7
- import initAsync from './generated/web/wasm-bindgen/react_native_ariel.js';
8
- import wasmPath from './generated/web/wasm-bindgen/react_native_ariel_bg.wasm';
9
-
10
- export async function uniffiInitAsync() {
11
- await initAsync({ module_or_path: wasmPath });
12
- mermaid_wrapper.default.initialize();
13
- }
14
-
15
- export default {
16
- mermaid_wrapper,
17
- };