@op-engineering/op-sqlite 10.0.0-tokenizers-beta1 → 10.0.0-tokenizers-beta3

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,33 @@
1
+ require 'fileutils'
2
+
3
+ def generate_tokenizers_header_file(names, file_path, is_user_app)
4
+ # Ensure the directory exists
5
+ dir_path = File.dirname(file_path)
6
+ FileUtils.mkdir_p(dir_path) unless Dir.exist?(dir_path)
7
+ tokenizer_list = names.map { |name| "opsqlite_#{name}_init(db,&errMsg,nullptr);" }.join
8
+
9
+ File.open(file_path, 'w') do |file|
10
+ file.puts "#ifndef TOKENIZERS_H"
11
+ file.puts "#define TOKENIZERS_H"
12
+ file.puts
13
+ file.puts "#define TOKENIZER_LIST #{tokenizer_list}"
14
+ file.puts
15
+ if is_user_app
16
+ file.puts "#include \"sqlite3.h\""
17
+ else
18
+ file.puts "#include \"../../cpp/sqlite3.h\""
19
+ end
20
+ file.puts
21
+ file.puts "namespace opsqlite {"
22
+ file.puts
23
+
24
+ names.each do |name|
25
+ file.puts "int opsqlite_#{name}_init(sqlite3 *db, char **error, sqlite3_api_routines const *api);"
26
+ end
27
+
28
+ file.puts
29
+ file.puts "} // namespace opsqlite"
30
+ file.puts
31
+ file.puts "#endif // TOKENIZERS_H"
32
+ end
33
+ end
package/op-sqlite.podspec CHANGED
@@ -150,12 +150,12 @@ Pod::Spec.new do |s|
150
150
 
151
151
  if performance_mode == '1' then
152
152
  log_message.call("[OP-SQLITE] Thread unsafe (1) performance mode enabled. Use only transactions! 🚀🚀")
153
- xcconfig[:OTHER_CFLAGS] = optimizedCflags + ' -DSQLITE_THREADSAFE=0 '
153
+ other_cflags = optimizedCflags + ' -DSQLITE_THREADSAFE=0 '
154
154
  end
155
155
 
156
156
  if performance_mode == '2' then
157
157
  log_message.call("[OP-SQLITE] Thread safe (2) performance mode enabled 🚀")
158
- xcconfig[:OTHER_CFLAGS] = optimizedCflags + ' -DSQLITE_THREADSAFE=1 '
158
+ other_cflags = optimizedCflags + ' -DSQLITE_THREADSAFE=1 '
159
159
  end
160
160
 
161
161
  if use_crsqlite then
@@ -181,19 +181,19 @@ Pod::Spec.new do |s|
181
181
 
182
182
  if sqlite_flags != "" then
183
183
  log_message.call("[OP-SQLITE] Custom SQLite flags: #{sqlite_flags}")
184
- xcconfig[:OTHER_CFLAGS] += " #{sqlite_flags}"
184
+ other_cflags += " #{sqlite_flags}"
185
185
  end
186
186
 
187
187
  if tokenizers.any? then
188
- # tokenizer_inits = tokenizers.map { |tokenizer| "opsqlite_#{tokenizer}_init(db,&errMsg,nullptr);" }
189
- # xcconfig[:OTHER_CFLAGS] += " -DTOKENIZER_LIST=\"#{tokenizer_inits.join(" ")}\""
188
+ log_message.call("[OP_SQLITE] Tokenizers enabled: #{tokenizers}")
190
189
  if is_user_app then
191
- xcconfig[:OTHER_CFLAGS] += " -DTOKENIZERS_HEADER_PATH=\\\"../../../c_sources/tokenizers.h\\\""
190
+ other_cflags += " -DTOKENIZERS_HEADER_PATH=\\\"../../../c_sources/tokenizers.h\\\""
192
191
  else
193
- xcconfig[:OTHER_CFLAGS] += " -DTOKENIZERS_HEADER_PATH=\\\"../example/c_sources/tokenizers.h\\\""
192
+ other_cflags += " -DTOKENIZERS_HEADER_PATH=\\\"../example/c_sources/tokenizers.h\\\""
194
193
  end
195
194
  end
196
195
 
196
+ xcconfig[:OTHER_CFLAGS] = other_cflags
197
197
  s.pod_target_xcconfig = xcconfig
198
198
  s.vendored_frameworks = frameworks
199
199
  end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@op-engineering/op-sqlite",
3
- "version": "10.0.0-tokenizers-beta1",
3
+ "version": "10.0.0-tokenizers-beta3",
4
4
  "description": "Next generation SQLite for React Native",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -14,6 +14,7 @@
14
14
  "ios",
15
15
  "cpp",
16
16
  "op-sqlite.podspec",
17
+ "generate_tokenizers_header_file.rb",
17
18
  "ios/**.xcframework",
18
19
  "!lib/typescript/example",
19
20
  "!android/build",