react-native-nitro-sqlite-vec 9.7.0
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/RNNitroSqliteVec.podspec +34 -0
- package/cpp/registerVectorExtensions.cpp +17 -0
- package/cpp/registerVectorExtensions.hpp +8 -0
- package/cpp/sqlite-vec/sqlite-vec.c +10199 -0
- package/cpp/sqlite-vec/sqlite-vec.h +41 -0
- package/package.json +75 -0
- package/react-native.config.js +9 -0
- package/src/index.ts +81 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
# iOS opt-in (NITRO_SQLITE_VEC=1); compile sqlite-vec and static-link into the core's sqlite3.
|
|
6
|
+
nitro_sqlite_vec = ENV['NITRO_SQLITE_VEC'] == '1'
|
|
7
|
+
|
|
8
|
+
# The core's bundled sqlite3.h (compiled with SQLITE_CORE to link it directly).
|
|
9
|
+
core_sqlite_headers = File.expand_path(File.join(__dir__, "..", "react-native-nitro-sqlite", "cpp", "sqlite"))
|
|
10
|
+
|
|
11
|
+
Pod::Spec.new do |s|
|
|
12
|
+
s.name = "RNNitroSqliteVec"
|
|
13
|
+
s.version = package["version"]
|
|
14
|
+
s.summary = package["description"]
|
|
15
|
+
s.homepage = "https://github.com/margelo/react-native-nitro-sqlite"
|
|
16
|
+
s.license = "MIT"
|
|
17
|
+
s.authors = "Margelo"
|
|
18
|
+
s.platforms = { :ios => min_ios_version_supported, :visionos => "1.0" }
|
|
19
|
+
s.source = { :git => "https://github.com/margelo/react-native-nitro-sqlite.git", :tag => "#{s.version}" }
|
|
20
|
+
|
|
21
|
+
if nitro_sqlite_vec
|
|
22
|
+
s.source_files = "cpp/**/*.{c,cpp,h,hpp}"
|
|
23
|
+
s.pod_target_xcconfig = {
|
|
24
|
+
"GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) SQLITE_CORE=1 SQLITE_VEC_STATIC=1",
|
|
25
|
+
"USER_HEADER_SEARCH_PATHS" => "\"#{core_sqlite_headers}\"",
|
|
26
|
+
"HEADER_SEARCH_PATHS" => "\"#{core_sqlite_headers}\"",
|
|
27
|
+
"WARNING_CFLAGS" => "-Wno-shorten-64-to-32 -Wno-comma -Wno-unreachable-code -Wno-conditional-uninitialized",
|
|
28
|
+
}
|
|
29
|
+
s.dependency "RNNitroSQLite"
|
|
30
|
+
else
|
|
31
|
+
# Disabled: ship headers only, compile nothing.
|
|
32
|
+
s.source_files = "cpp/**/*.{h,hpp}"
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#include "registerVectorExtensions.hpp"
|
|
2
|
+
|
|
3
|
+
#include <mutex>
|
|
4
|
+
#include <sqlite3.h>
|
|
5
|
+
|
|
6
|
+
#include "sqlite-vec/sqlite-vec.h"
|
|
7
|
+
|
|
8
|
+
namespace margelo::rnnitrosqlitevec {
|
|
9
|
+
|
|
10
|
+
void registerVectorExtensions() {
|
|
11
|
+
static std::once_flag onceFlag;
|
|
12
|
+
std::call_once(onceFlag, []() {
|
|
13
|
+
sqlite3_auto_extension(reinterpret_cast<void (*)(void)>(sqlite3_vec_init));
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
} // namespace margelo::rnnitrosqlitevec
|