@kookyleo/graphviz-anywhere-rn 0.1.0 → 0.1.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/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # @kookyleo/graphviz-anywhere-react-native
2
+
3
+ <!-- TODO (follow-up PR): migrate to the shared C++ CGraphviz wrapper
4
+ introduced in `packages/web/src-cpp/main.cpp`. Plan: expose the same
5
+ typed `layout(dot, format, engine)` method through JSI / TurboModule
6
+ instead of the current C-ABI bridge, so RN and Web share one Graphviz
7
+ core. Tracked alongside the rearch introduced in the
8
+ `rearch/hpcc-js-aligned` branch. -->
9
+
10
+ React Native bindings for Graphviz. Not yet published to npm.
11
+
12
+ ## Status
13
+
14
+ This package currently builds against the legacy C-ABI wrapper
15
+ (`capi/graphviz_api.{h,c}`) and is **not affected** by the web Wasm
16
+ rearch landed in `rearch/hpcc-js-aligned`. A follow-up PR will port the
17
+ native side to consume the same `CGraphviz` C++ class as the web package
18
+ so all platforms share one implementation.
@@ -1,25 +1,26 @@
1
1
  cmake_minimum_required(VERSION 3.22.1)
2
2
  project(graphviz_jni)
3
3
 
4
- # Build the graphviz_api C library from source
5
- set(GRAPHVIZ_API_SRC "${CMAKE_CURRENT_SOURCE_DIR}/../../../../src")
4
+ # Link against the prebuilt core library downloaded during install.
5
+ set(GRAPHVIZ_PREBUILT "${CMAKE_CURRENT_SOURCE_DIR}/../../libs/${ANDROID_ABI}")
6
+ set(GRAPHVIZ_API_INCLUDE "${GRAPHVIZ_PREBUILT}/include")
7
+ set(GRAPHVIZ_API_LIB "${GRAPHVIZ_PREBUILT}/lib/libgraphviz_api.so")
6
8
 
7
- add_library(graphviz_api SHARED
8
- "${GRAPHVIZ_API_SRC}/graphviz_api.c"
9
- jni/graphviz_jni.c
10
- )
9
+ if(NOT EXISTS "${GRAPHVIZ_API_LIB}")
10
+ message(FATAL_ERROR "Missing prebuilt Graphviz core library: ${GRAPHVIZ_API_LIB}")
11
+ endif()
11
12
 
12
- target_include_directories(graphviz_api PRIVATE
13
- "${GRAPHVIZ_API_SRC}"
13
+ add_library(graphviz_core SHARED IMPORTED)
14
+ set_target_properties(graphviz_core PROPERTIES
15
+ IMPORTED_LOCATION "${GRAPHVIZ_API_LIB}"
14
16
  )
15
17
 
16
- # Link against the prebuilt Graphviz libraries for Android
17
- set(GRAPHVIZ_PREBUILT "${CMAKE_CURRENT_SOURCE_DIR}/../../../../graphviz")
18
-
19
- target_include_directories(graphviz_api PRIVATE
20
- "${GRAPHVIZ_PREBUILT}/include"
18
+ add_library(graphviz_jni SHARED
19
+ jni/graphviz_jni.c
21
20
  )
22
21
 
22
+ target_include_directories(graphviz_jni PRIVATE "${GRAPHVIZ_API_INCLUDE}")
23
+
23
24
  # Link Android log library for JNI
24
25
  find_library(log-lib log)
25
- target_link_libraries(graphviz_api ${log-lib})
26
+ target_link_libraries(graphviz_jni graphviz_core ${log-lib})
@@ -40,7 +40,7 @@ public class GraphvizModule extends ReactContextBaseJavaModule {
40
40
  private long contextPtr = 0;
41
41
 
42
42
  static {
43
- System.loadLibrary("graphviz_api");
43
+ System.loadLibrary("graphviz_jni");
44
44
  }
45
45
 
46
46
  public GraphvizModule(ReactApplicationContext reactContext) {
@@ -9,19 +9,19 @@ Pod::Spec.new do |s|
9
9
  s.homepage = package["repository"]["url"]
10
10
  s.license = package["license"]
11
11
  s.authors = package["author"]
12
- s.source = { :git => package["repository"]["url"], :tag => s.version }
12
+ s.source = { :git => package["repository"]["url"], :tag => "v#{s.version}" }
13
13
 
14
14
  s.ios.deployment_target = "15.1"
15
15
  s.osx.deployment_target = "11.0"
16
16
 
17
- s.source_files = "*.{h,m,mm}", "../src/*.{h,c}"
17
+ s.source_files = "*.{h,m,mm}"
18
18
  s.public_header_files = "GraphvizModule.h"
19
19
 
20
- # Link against the prebuilt Graphviz static/shared libraries
21
- s.preserve_paths = "../third_party/graphviz/**"
20
+ # Link against the prebuilt Graphviz wrapper downloaded by postinstall.
21
+ s.preserve_paths = "Frameworks/**"
22
22
  s.xcconfig = {
23
- "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/../src\"",
24
- "LIBRARY_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/../third_party/graphviz/lib\"",
23
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/Frameworks/include\"",
24
+ "LIBRARY_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/Frameworks/lib\"",
25
25
  }
26
26
  s.libraries = "graphviz_api"
27
27
 
@@ -7,7 +7,7 @@ exports.default = exports.GraphvizErrorCode = void 0;
7
7
  exports.getVersion = getVersion;
8
8
  exports.renderDot = renderDot;
9
9
  var _reactNative = require("react-native");
10
- const LINKING_ERROR = `The package 'graphviz-anywhere-react-native' doesn't seem to be linked. Make sure:\n\n` + _reactNative.Platform.select({
10
+ const LINKING_ERROR = `The package '@kookyleo/graphviz-anywhere-rn' doesn't seem to be linked. Make sure:\n\n` + _reactNative.Platform.select({
11
11
  ios: '- You have run `pod install`\n',
12
12
  macos: '- You have run `pod install`\n',
13
13
  android: '',
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  import { NativeModules, Platform } from 'react-native';
4
- const LINKING_ERROR = `The package 'graphviz-anywhere-react-native' doesn't seem to be linked. Make sure:\n\n` + Platform.select({
4
+ const LINKING_ERROR = `The package '@kookyleo/graphviz-anywhere-rn' doesn't seem to be linked. Make sure:\n\n` + Platform.select({
5
5
  ios: '- You have run `pod install`\n',
6
6
  macos: '- You have run `pod install`\n',
7
7
  android: '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kookyleo/graphviz-anywhere-rn",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "React Native package for graphviz-anywhere with native binary support",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -21,7 +21,6 @@
21
21
  "macos",
22
22
  "windows",
23
23
  "scripts",
24
- "graphviz-anywhere-react-native.podspec",
25
24
  "!**/__tests__"
26
25
  ],
27
26
  "publishConfig": {
@@ -62,7 +62,7 @@ async function main() {
62
62
 
63
63
  for (const { name, dest } of downloads) {
64
64
  const url = `${RELEASE_URL}/${name}`;
65
- const tempFile = path.join(__dirname, '../../', name);
65
+ const tempFile = path.join(__dirname, '..', name);
66
66
 
67
67
  try {
68
68
  // Create destination directory
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { NativeModules, Platform } from 'react-native';
2
2
 
3
3
  const LINKING_ERROR =
4
- `The package 'graphviz-anywhere-react-native' doesn't seem to be linked. Make sure:\n\n` +
4
+ `The package '@kookyleo/graphviz-anywhere-rn' doesn't seem to be linked. Make sure:\n\n` +
5
5
  Platform.select({
6
6
  ios: '- You have run `pod install`\n',
7
7
  macos: '- You have run `pod install`\n',