react-native-litert-lm 0.3.6 → 0.4.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/README.md +207 -158
- package/android/build.gradle +12 -0
- package/android/src/main/AndroidManifest.xml +5 -0
- package/android/src/main/java/com/margelo/nitro/dev/litert/litertlm/HybridLiteRTLM.kt +316 -63
- package/android/src/main/java/dev/litert/litertlm/LiteRTLMPackage.kt +19 -2
- package/android/src/test/java/com/margelo/nitro/core/Promise.kt +46 -0
- package/android/src/test/java/com/margelo/nitro/dev/litert/litertlm/HybridLiteRTLMTest.kt +83 -0
- package/cpp/include/README.md +9 -11
- package/ios/HybridLiteRTLM.swift +1058 -0
- package/ios/Tests/HybridLiteRTLMTests.swift +67 -0
- package/lib/__mocks__/react-native-nitro-modules.d.ts +61 -0
- package/lib/__mocks__/react-native-nitro-modules.js +50 -0
- package/lib/__tests__/hooks.test.d.ts +1 -0
- package/lib/__tests__/hooks.test.js +124 -0
- package/lib/__tests__/memoryTracker.test.d.ts +1 -0
- package/lib/__tests__/memoryTracker.test.js +74 -0
- package/lib/__tests__/modelFactory.test.d.ts +1 -0
- package/lib/__tests__/modelFactory.test.js +52 -0
- package/lib/hooks.js +1 -1
- package/lib/index.d.ts +2 -4
- package/lib/index.js +12 -7
- package/lib/modelFactory.js +62 -63
- package/lib/specs/LiteRTLM.nitro.d.ts +71 -2
- package/nitrogen/generated/android/c++/JHybridLiteRTLMSpec.cpp +62 -7
- package/nitrogen/generated/android/c++/JHybridLiteRTLMSpec.hpp +3 -1
- package/nitrogen/generated/android/c++/JLLMConfig.hpp +40 -3
- package/nitrogen/generated/android/c++/JMultimodalPart.hpp +74 -0
- package/nitrogen/generated/android/c++/JPartType.hpp +61 -0
- package/nitrogen/generated/android/c++/JToolDefinition.hpp +65 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dev/litert/litertlm/GenerationStats.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dev/litert/litertlm/HybridLiteRTLMSpec.kt +10 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dev/litert/litertlm/LLMConfig.kt +46 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dev/litert/litertlm/MemoryUsage.kt +19 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dev/litert/litertlm/Message.kt +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dev/litert/litertlm/MultimodalPart.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dev/litert/litertlm/PartType.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/dev/litert/litertlm/ToolDefinition.kt +61 -0
- package/nitrogen/generated/ios/LiteRTLM-Swift-Cxx-Bridge.cpp +57 -1
- package/nitrogen/generated/ios/LiteRTLM-Swift-Cxx-Bridge.hpp +414 -3
- package/nitrogen/generated/ios/LiteRTLM-Swift-Cxx-Umbrella.hpp +41 -3
- package/nitrogen/generated/ios/LiteRTLMAutolinking.mm +4 -6
- package/nitrogen/generated/ios/LiteRTLMAutolinking.swift +10 -0
- package/nitrogen/generated/ios/c++/HybridLiteRTLMSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridLiteRTLMSpecSwift.hpp +224 -0
- package/nitrogen/generated/ios/swift/Backend.swift +44 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string_bool.swift +46 -0
- package/nitrogen/generated/ios/swift/GenerationStats.swift +54 -0
- package/nitrogen/generated/ios/swift/HybridLiteRTLMSpec.swift +69 -0
- package/nitrogen/generated/ios/swift/HybridLiteRTLMSpec_cxx.swift +383 -0
- package/nitrogen/generated/ios/swift/LLMConfig.swift +203 -0
- package/nitrogen/generated/ios/swift/MemoryUsage.swift +44 -0
- package/nitrogen/generated/ios/swift/Message.swift +34 -0
- package/nitrogen/generated/ios/swift/MultimodalPart.swift +83 -0
- package/nitrogen/generated/ios/swift/PartType.swift +44 -0
- package/nitrogen/generated/ios/swift/Role.swift +44 -0
- package/nitrogen/generated/ios/swift/ToolDefinition.swift +39 -0
- package/nitrogen/generated/shared/c++/HybridLiteRTLMSpec.cpp +2 -0
- package/nitrogen/generated/shared/c++/HybridLiteRTLMSpec.hpp +7 -2
- package/nitrogen/generated/shared/c++/LLMConfig.hpp +22 -2
- package/nitrogen/generated/shared/c++/MultimodalPart.hpp +99 -0
- package/nitrogen/generated/shared/c++/PartType.hpp +80 -0
- package/nitrogen/generated/shared/c++/ToolDefinition.hpp +91 -0
- package/package.json +16 -8
- package/react-native-litert-lm.podspec +15 -19
- package/scripts/download-ios-frameworks.sh +14 -48
- package/scripts/postinstall.js +1 -2
- package/src/__mocks__/react-native-nitro-modules.ts +48 -0
- package/src/__tests__/hooks.test.ts +153 -0
- package/src/__tests__/memoryTracker.test.ts +87 -0
- package/src/__tests__/modelFactory.test.ts +68 -0
- package/src/hooks.ts +1 -1
- package/src/index.ts +12 -9
- package/src/modelFactory.ts +82 -80
- package/src/specs/LiteRTLM.nitro.ts +80 -2
- package/cpp/HybridLiteRTLM.cpp +0 -838
- package/cpp/HybridLiteRTLM.hpp +0 -167
- package/cpp/IOSDownloadHelper.h +0 -24
- package/ios/IOSDownloadHelper.mm +0 -129
- package/scripts/build-ios-engine.sh +0 -302
- package/scripts/stubs/cxx_bridge_stubs.cc +0 -224
- package/scripts/stubs/gemma_model_constraint_provider.cc +0 -46
- package/scripts/stubs/llguidance_stubs.c +0 -101
- package/src/templates.ts +0 -105
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// MultimodalPart.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `MultimodalPart`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias MultimodalPart = margelo.nitro.litertlm.MultimodalPart
|
|
14
|
+
|
|
15
|
+
public extension MultimodalPart {
|
|
16
|
+
private typealias bridge = margelo.nitro.litertlm.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `MultimodalPart`.
|
|
20
|
+
*/
|
|
21
|
+
init(type: PartType, text: String?, imageBuffer: ArrayBuffer?, audioBuffer: ArrayBuffer?) {
|
|
22
|
+
self.init(type, { () -> bridge.std__optional_std__string_ in
|
|
23
|
+
if let __unwrappedValue = text {
|
|
24
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
25
|
+
} else {
|
|
26
|
+
return .init()
|
|
27
|
+
}
|
|
28
|
+
}(), { () -> bridge.std__optional_std__shared_ptr_ArrayBuffer__ in
|
|
29
|
+
if let __unwrappedValue = imageBuffer {
|
|
30
|
+
return bridge.create_std__optional_std__shared_ptr_ArrayBuffer__(__unwrappedValue.getArrayBuffer())
|
|
31
|
+
} else {
|
|
32
|
+
return .init()
|
|
33
|
+
}
|
|
34
|
+
}(), { () -> bridge.std__optional_std__shared_ptr_ArrayBuffer__ in
|
|
35
|
+
if let __unwrappedValue = audioBuffer {
|
|
36
|
+
return bridge.create_std__optional_std__shared_ptr_ArrayBuffer__(__unwrappedValue.getArrayBuffer())
|
|
37
|
+
} else {
|
|
38
|
+
return .init()
|
|
39
|
+
}
|
|
40
|
+
}())
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@inline(__always)
|
|
44
|
+
var type: PartType {
|
|
45
|
+
return self.__type
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@inline(__always)
|
|
49
|
+
var text: String? {
|
|
50
|
+
return { () -> String? in
|
|
51
|
+
if bridge.has_value_std__optional_std__string_(self.__text) {
|
|
52
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__text)
|
|
53
|
+
return String(__unwrapped)
|
|
54
|
+
} else {
|
|
55
|
+
return nil
|
|
56
|
+
}
|
|
57
|
+
}()
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@inline(__always)
|
|
61
|
+
var imageBuffer: ArrayBuffer? {
|
|
62
|
+
return { () -> ArrayBuffer? in
|
|
63
|
+
if bridge.has_value_std__optional_std__shared_ptr_ArrayBuffer__(self.__imageBuffer) {
|
|
64
|
+
let __unwrapped = bridge.get_std__optional_std__shared_ptr_ArrayBuffer__(self.__imageBuffer)
|
|
65
|
+
return ArrayBuffer(__unwrapped)
|
|
66
|
+
} else {
|
|
67
|
+
return nil
|
|
68
|
+
}
|
|
69
|
+
}()
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@inline(__always)
|
|
73
|
+
var audioBuffer: ArrayBuffer? {
|
|
74
|
+
return { () -> ArrayBuffer? in
|
|
75
|
+
if bridge.has_value_std__optional_std__shared_ptr_ArrayBuffer__(self.__audioBuffer) {
|
|
76
|
+
let __unwrapped = bridge.get_std__optional_std__shared_ptr_ArrayBuffer__(self.__audioBuffer)
|
|
77
|
+
return ArrayBuffer(__unwrapped)
|
|
78
|
+
} else {
|
|
79
|
+
return nil
|
|
80
|
+
}
|
|
81
|
+
}()
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// PartType.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the JS union `PartType`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias PartType = margelo.nitro.litertlm.PartType
|
|
12
|
+
|
|
13
|
+
public extension PartType {
|
|
14
|
+
/**
|
|
15
|
+
* Get a PartType for the given String value, or
|
|
16
|
+
* return `nil` if the given value was invalid/unknown.
|
|
17
|
+
*/
|
|
18
|
+
init?(fromString string: String) {
|
|
19
|
+
switch string {
|
|
20
|
+
case "text":
|
|
21
|
+
self = .text
|
|
22
|
+
case "image":
|
|
23
|
+
self = .image
|
|
24
|
+
case "audio":
|
|
25
|
+
self = .audio
|
|
26
|
+
default:
|
|
27
|
+
return nil
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get the String value this PartType represents.
|
|
33
|
+
*/
|
|
34
|
+
var stringValue: String {
|
|
35
|
+
switch self {
|
|
36
|
+
case .text:
|
|
37
|
+
return "text"
|
|
38
|
+
case .image:
|
|
39
|
+
return "image"
|
|
40
|
+
case .audio:
|
|
41
|
+
return "audio"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Role.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the JS union `Role`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias Role = margelo.nitro.litertlm.Role
|
|
12
|
+
|
|
13
|
+
public extension Role {
|
|
14
|
+
/**
|
|
15
|
+
* Get a Role for the given String value, or
|
|
16
|
+
* return `nil` if the given value was invalid/unknown.
|
|
17
|
+
*/
|
|
18
|
+
init?(fromString string: String) {
|
|
19
|
+
switch string {
|
|
20
|
+
case "user":
|
|
21
|
+
self = .user
|
|
22
|
+
case "model":
|
|
23
|
+
self = .model
|
|
24
|
+
case "system":
|
|
25
|
+
self = .system
|
|
26
|
+
default:
|
|
27
|
+
return nil
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get the String value this Role represents.
|
|
33
|
+
*/
|
|
34
|
+
var stringValue: String {
|
|
35
|
+
switch self {
|
|
36
|
+
case .user:
|
|
37
|
+
return "user"
|
|
38
|
+
case .model:
|
|
39
|
+
return "model"
|
|
40
|
+
case .system:
|
|
41
|
+
return "system"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ToolDefinition.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `ToolDefinition`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias ToolDefinition = margelo.nitro.litertlm.ToolDefinition
|
|
14
|
+
|
|
15
|
+
public extension ToolDefinition {
|
|
16
|
+
private typealias bridge = margelo.nitro.litertlm.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `ToolDefinition`.
|
|
20
|
+
*/
|
|
21
|
+
init(name: String, description: String, parametersJson: String) {
|
|
22
|
+
self.init(std.string(name), std.string(description), std.string(parametersJson))
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@inline(__always)
|
|
26
|
+
var name: String {
|
|
27
|
+
return String(self.__name)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@inline(__always)
|
|
31
|
+
var description: String {
|
|
32
|
+
return String(self.__description)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@inline(__always)
|
|
36
|
+
var parametersJson: String {
|
|
37
|
+
return String(self.__parametersJson)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -20,11 +20,13 @@ namespace margelo::nitro::litertlm {
|
|
|
20
20
|
prototype.registerHybridMethod("downloadModel", &HybridLiteRTLMSpec::downloadModel);
|
|
21
21
|
prototype.registerHybridMethod("deleteModel", &HybridLiteRTLMSpec::deleteModel);
|
|
22
22
|
prototype.registerHybridMethod("sendMessageWithAudio", &HybridLiteRTLMSpec::sendMessageWithAudio);
|
|
23
|
+
prototype.registerHybridMethod("sendMultimodalMessage", &HybridLiteRTLMSpec::sendMultimodalMessage);
|
|
23
24
|
prototype.registerHybridMethod("sendMessageAsync", &HybridLiteRTLMSpec::sendMessageAsync);
|
|
24
25
|
prototype.registerHybridMethod("getHistory", &HybridLiteRTLMSpec::getHistory);
|
|
25
26
|
prototype.registerHybridMethod("resetConversation", &HybridLiteRTLMSpec::resetConversation);
|
|
26
27
|
prototype.registerHybridMethod("isReady", &HybridLiteRTLMSpec::isReady);
|
|
27
28
|
prototype.registerHybridMethod("getStats", &HybridLiteRTLMSpec::getStats);
|
|
29
|
+
prototype.registerHybridMethod("countTokens", &HybridLiteRTLMSpec::countTokens);
|
|
28
30
|
prototype.registerHybridMethod("getMemoryUsage", &HybridLiteRTLMSpec::getMemoryUsage);
|
|
29
31
|
prototype.registerHybridMethod("close", &HybridLiteRTLMSpec::close);
|
|
30
32
|
});
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
// Forward declaration of `LLMConfig` to properly resolve imports.
|
|
17
17
|
namespace margelo::nitro::litertlm { struct LLMConfig; }
|
|
18
|
+
// Forward declaration of `MultimodalPart` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::litertlm { struct MultimodalPart; }
|
|
18
20
|
// Forward declaration of `Message` to properly resolve imports.
|
|
19
21
|
namespace margelo::nitro::litertlm { struct Message; }
|
|
20
22
|
// Forward declaration of `GenerationStats` to properly resolve imports.
|
|
@@ -27,8 +29,9 @@ namespace margelo::nitro::litertlm { struct MemoryUsage; }
|
|
|
27
29
|
#include "LLMConfig.hpp"
|
|
28
30
|
#include <optional>
|
|
29
31
|
#include <functional>
|
|
30
|
-
#include "
|
|
32
|
+
#include "MultimodalPart.hpp"
|
|
31
33
|
#include <vector>
|
|
34
|
+
#include "Message.hpp"
|
|
32
35
|
#include "GenerationStats.hpp"
|
|
33
36
|
#include "MemoryUsage.hpp"
|
|
34
37
|
|
|
@@ -69,11 +72,13 @@ namespace margelo::nitro::litertlm {
|
|
|
69
72
|
virtual std::shared_ptr<Promise<std::string>> downloadModel(const std::string& url, const std::string& fileName, const std::optional<std::function<void(double /* progress */)>>& onProgress) = 0;
|
|
70
73
|
virtual std::shared_ptr<Promise<void>> deleteModel(const std::string& fileName) = 0;
|
|
71
74
|
virtual std::shared_ptr<Promise<std::string>> sendMessageWithAudio(const std::string& message, const std::string& audioPath) = 0;
|
|
72
|
-
virtual
|
|
75
|
+
virtual std::shared_ptr<Promise<std::string>> sendMultimodalMessage(const std::vector<MultimodalPart>& parts) = 0;
|
|
76
|
+
virtual std::shared_ptr<Promise<void>> sendMessageAsync(const std::string& message, const std::function<void(const std::string& /* token */, bool /* done */)>& onToken) = 0;
|
|
73
77
|
virtual std::vector<Message> getHistory() = 0;
|
|
74
78
|
virtual void resetConversation() = 0;
|
|
75
79
|
virtual bool isReady() = 0;
|
|
76
80
|
virtual GenerationStats getStats() = 0;
|
|
81
|
+
virtual double countTokens(const std::string& text) = 0;
|
|
77
82
|
virtual MemoryUsage getMemoryUsage() = 0;
|
|
78
83
|
virtual void close() = 0;
|
|
79
84
|
|
|
@@ -30,10 +30,14 @@
|
|
|
30
30
|
|
|
31
31
|
// Forward declaration of `Backend` to properly resolve imports.
|
|
32
32
|
namespace margelo::nitro::litertlm { enum class Backend; }
|
|
33
|
+
// Forward declaration of `ToolDefinition` to properly resolve imports.
|
|
34
|
+
namespace margelo::nitro::litertlm { struct ToolDefinition; }
|
|
33
35
|
|
|
34
36
|
#include <string>
|
|
35
37
|
#include <optional>
|
|
36
38
|
#include "Backend.hpp"
|
|
39
|
+
#include "ToolDefinition.hpp"
|
|
40
|
+
#include <vector>
|
|
37
41
|
|
|
38
42
|
namespace margelo::nitro::litertlm {
|
|
39
43
|
|
|
@@ -48,10 +52,14 @@ namespace margelo::nitro::litertlm {
|
|
|
48
52
|
std::optional<double> temperature SWIFT_PRIVATE;
|
|
49
53
|
std::optional<double> topK SWIFT_PRIVATE;
|
|
50
54
|
std::optional<double> topP SWIFT_PRIVATE;
|
|
55
|
+
std::optional<bool> validate SWIFT_PRIVATE;
|
|
56
|
+
std::optional<bool> multimodal SWIFT_PRIVATE;
|
|
57
|
+
std::optional<std::vector<ToolDefinition>> tools SWIFT_PRIVATE;
|
|
58
|
+
std::optional<bool> enableSpeculativeDecoding SWIFT_PRIVATE;
|
|
51
59
|
|
|
52
60
|
public:
|
|
53
61
|
LLMConfig() = default;
|
|
54
|
-
explicit LLMConfig(std::optional<std::string> systemPrompt, std::optional<Backend> backend, std::optional<double> maxTokens, std::optional<double> temperature, std::optional<double> topK, std::optional<double> topP): systemPrompt(systemPrompt), backend(backend), maxTokens(maxTokens), temperature(temperature), topK(topK), topP(topP) {}
|
|
62
|
+
explicit LLMConfig(std::optional<std::string> systemPrompt, std::optional<Backend> backend, std::optional<double> maxTokens, std::optional<double> temperature, std::optional<double> topK, std::optional<double> topP, std::optional<bool> validate, std::optional<bool> multimodal, std::optional<std::vector<ToolDefinition>> tools, std::optional<bool> enableSpeculativeDecoding): systemPrompt(systemPrompt), backend(backend), maxTokens(maxTokens), temperature(temperature), topK(topK), topP(topP), validate(validate), multimodal(multimodal), tools(tools), enableSpeculativeDecoding(enableSpeculativeDecoding) {}
|
|
55
63
|
|
|
56
64
|
public:
|
|
57
65
|
friend bool operator==(const LLMConfig& lhs, const LLMConfig& rhs) = default;
|
|
@@ -72,7 +80,11 @@ namespace margelo::nitro {
|
|
|
72
80
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maxTokens"))),
|
|
73
81
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "temperature"))),
|
|
74
82
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "topK"))),
|
|
75
|
-
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "topP")))
|
|
83
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "topP"))),
|
|
84
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "validate"))),
|
|
85
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "multimodal"))),
|
|
86
|
+
JSIConverter<std::optional<std::vector<margelo::nitro::litertlm::ToolDefinition>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "tools"))),
|
|
87
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableSpeculativeDecoding")))
|
|
76
88
|
);
|
|
77
89
|
}
|
|
78
90
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::litertlm::LLMConfig& arg) {
|
|
@@ -83,6 +95,10 @@ namespace margelo::nitro {
|
|
|
83
95
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "temperature"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.temperature));
|
|
84
96
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "topK"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.topK));
|
|
85
97
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "topP"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.topP));
|
|
98
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "validate"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.validate));
|
|
99
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "multimodal"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.multimodal));
|
|
100
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "tools"), JSIConverter<std::optional<std::vector<margelo::nitro::litertlm::ToolDefinition>>>::toJSI(runtime, arg.tools));
|
|
101
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "enableSpeculativeDecoding"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.enableSpeculativeDecoding));
|
|
86
102
|
return obj;
|
|
87
103
|
}
|
|
88
104
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -99,6 +115,10 @@ namespace margelo::nitro {
|
|
|
99
115
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "temperature")))) return false;
|
|
100
116
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "topK")))) return false;
|
|
101
117
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "topP")))) return false;
|
|
118
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "validate")))) return false;
|
|
119
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "multimodal")))) return false;
|
|
120
|
+
if (!JSIConverter<std::optional<std::vector<margelo::nitro::litertlm::ToolDefinition>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "tools")))) return false;
|
|
121
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableSpeculativeDecoding")))) return false;
|
|
102
122
|
return true;
|
|
103
123
|
}
|
|
104
124
|
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// MultimodalPart.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `PartType` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::litertlm { enum class PartType; }
|
|
33
|
+
|
|
34
|
+
#include "PartType.hpp"
|
|
35
|
+
#include <string>
|
|
36
|
+
#include <optional>
|
|
37
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro::litertlm {
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* A struct which can be represented as a JavaScript object (MultimodalPart).
|
|
43
|
+
*/
|
|
44
|
+
struct MultimodalPart final {
|
|
45
|
+
public:
|
|
46
|
+
PartType type SWIFT_PRIVATE;
|
|
47
|
+
std::optional<std::string> text SWIFT_PRIVATE;
|
|
48
|
+
std::optional<std::shared_ptr<ArrayBuffer>> imageBuffer SWIFT_PRIVATE;
|
|
49
|
+
std::optional<std::shared_ptr<ArrayBuffer>> audioBuffer SWIFT_PRIVATE;
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
MultimodalPart() = default;
|
|
53
|
+
explicit MultimodalPart(PartType type, std::optional<std::string> text, std::optional<std::shared_ptr<ArrayBuffer>> imageBuffer, std::optional<std::shared_ptr<ArrayBuffer>> audioBuffer): type(type), text(text), imageBuffer(imageBuffer), audioBuffer(audioBuffer) {}
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
friend bool operator==(const MultimodalPart& lhs, const MultimodalPart& rhs) = default;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
} // namespace margelo::nitro::litertlm
|
|
60
|
+
|
|
61
|
+
namespace margelo::nitro {
|
|
62
|
+
|
|
63
|
+
// C++ MultimodalPart <> JS MultimodalPart (object)
|
|
64
|
+
template <>
|
|
65
|
+
struct JSIConverter<margelo::nitro::litertlm::MultimodalPart> final {
|
|
66
|
+
static inline margelo::nitro::litertlm::MultimodalPart fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
67
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
68
|
+
return margelo::nitro::litertlm::MultimodalPart(
|
|
69
|
+
JSIConverter<margelo::nitro::litertlm::PartType>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type"))),
|
|
70
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text"))),
|
|
71
|
+
JSIConverter<std::optional<std::shared_ptr<ArrayBuffer>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "imageBuffer"))),
|
|
72
|
+
JSIConverter<std::optional<std::shared_ptr<ArrayBuffer>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "audioBuffer")))
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::litertlm::MultimodalPart& arg) {
|
|
76
|
+
jsi::Object obj(runtime);
|
|
77
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "type"), JSIConverter<margelo::nitro::litertlm::PartType>::toJSI(runtime, arg.type));
|
|
78
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "text"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.text));
|
|
79
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "imageBuffer"), JSIConverter<std::optional<std::shared_ptr<ArrayBuffer>>>::toJSI(runtime, arg.imageBuffer));
|
|
80
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "audioBuffer"), JSIConverter<std::optional<std::shared_ptr<ArrayBuffer>>>::toJSI(runtime, arg.audioBuffer));
|
|
81
|
+
return obj;
|
|
82
|
+
}
|
|
83
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
84
|
+
if (!value.isObject()) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
jsi::Object obj = value.getObject(runtime);
|
|
88
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
if (!JSIConverter<margelo::nitro::litertlm::PartType>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type")))) return false;
|
|
92
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text")))) return false;
|
|
93
|
+
if (!JSIConverter<std::optional<std::shared_ptr<ArrayBuffer>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "imageBuffer")))) return false;
|
|
94
|
+
if (!JSIConverter<std::optional<std::shared_ptr<ArrayBuffer>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "audioBuffer")))) return false;
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// PartType.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::litertlm {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (PartType).
|
|
30
|
+
*/
|
|
31
|
+
enum class PartType {
|
|
32
|
+
TEXT SWIFT_NAME(text) = 0,
|
|
33
|
+
IMAGE SWIFT_NAME(image) = 1,
|
|
34
|
+
AUDIO SWIFT_NAME(audio) = 2,
|
|
35
|
+
} CLOSED_ENUM;
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro::litertlm
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro {
|
|
40
|
+
|
|
41
|
+
// C++ PartType <> JS PartType (union)
|
|
42
|
+
template <>
|
|
43
|
+
struct JSIConverter<margelo::nitro::litertlm::PartType> final {
|
|
44
|
+
static inline margelo::nitro::litertlm::PartType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
45
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
46
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
47
|
+
case hashString("text"): return margelo::nitro::litertlm::PartType::TEXT;
|
|
48
|
+
case hashString("image"): return margelo::nitro::litertlm::PartType::IMAGE;
|
|
49
|
+
case hashString("audio"): return margelo::nitro::litertlm::PartType::AUDIO;
|
|
50
|
+
default: [[unlikely]]
|
|
51
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum PartType - invalid value!");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::litertlm::PartType arg) {
|
|
55
|
+
switch (arg) {
|
|
56
|
+
case margelo::nitro::litertlm::PartType::TEXT: return JSIConverter<std::string>::toJSI(runtime, "text");
|
|
57
|
+
case margelo::nitro::litertlm::PartType::IMAGE: return JSIConverter<std::string>::toJSI(runtime, "image");
|
|
58
|
+
case margelo::nitro::litertlm::PartType::AUDIO: return JSIConverter<std::string>::toJSI(runtime, "audio");
|
|
59
|
+
default: [[unlikely]]
|
|
60
|
+
throw std::invalid_argument("Cannot convert PartType to JS - invalid value: "
|
|
61
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
65
|
+
if (!value.isString()) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
69
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
70
|
+
case hashString("text"):
|
|
71
|
+
case hashString("image"):
|
|
72
|
+
case hashString("audio"):
|
|
73
|
+
return true;
|
|
74
|
+
default:
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ToolDefinition.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <string>
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro::litertlm {
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A struct which can be represented as a JavaScript object (ToolDefinition).
|
|
39
|
+
*/
|
|
40
|
+
struct ToolDefinition final {
|
|
41
|
+
public:
|
|
42
|
+
std::string name SWIFT_PRIVATE;
|
|
43
|
+
std::string description SWIFT_PRIVATE;
|
|
44
|
+
std::string parametersJson SWIFT_PRIVATE;
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
ToolDefinition() = default;
|
|
48
|
+
explicit ToolDefinition(std::string name, std::string description, std::string parametersJson): name(name), description(description), parametersJson(parametersJson) {}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
friend bool operator==(const ToolDefinition& lhs, const ToolDefinition& rhs) = default;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
} // namespace margelo::nitro::litertlm
|
|
55
|
+
|
|
56
|
+
namespace margelo::nitro {
|
|
57
|
+
|
|
58
|
+
// C++ ToolDefinition <> JS ToolDefinition (object)
|
|
59
|
+
template <>
|
|
60
|
+
struct JSIConverter<margelo::nitro::litertlm::ToolDefinition> final {
|
|
61
|
+
static inline margelo::nitro::litertlm::ToolDefinition fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
62
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
63
|
+
return margelo::nitro::litertlm::ToolDefinition(
|
|
64
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name"))),
|
|
65
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "description"))),
|
|
66
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "parametersJson")))
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::litertlm::ToolDefinition& arg) {
|
|
70
|
+
jsi::Object obj(runtime);
|
|
71
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "name"), JSIConverter<std::string>::toJSI(runtime, arg.name));
|
|
72
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "description"), JSIConverter<std::string>::toJSI(runtime, arg.description));
|
|
73
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "parametersJson"), JSIConverter<std::string>::toJSI(runtime, arg.parametersJson));
|
|
74
|
+
return obj;
|
|
75
|
+
}
|
|
76
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
77
|
+
if (!value.isObject()) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
jsi::Object obj = value.getObject(runtime);
|
|
81
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name")))) return false;
|
|
85
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "description")))) return false;
|
|
86
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "parametersJson")))) return false;
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
} // namespace margelo::nitro
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-litert-lm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"litertLm": {
|
|
5
|
-
"version": "0.
|
|
6
|
-
"androidMavenVersion": "0.
|
|
7
|
-
"iosGitTag": "v0.
|
|
5
|
+
"version": "0.12.0",
|
|
6
|
+
"androidMavenVersion": "0.12.0",
|
|
7
|
+
"iosGitTag": "v0.12.0"
|
|
8
8
|
},
|
|
9
9
|
"description": "High-performance LLM inference for React Native using LiteRT-LM. Optimized for Gemma 4 and other on-device language models.",
|
|
10
10
|
"license": "MIT",
|
|
@@ -43,14 +43,13 @@
|
|
|
43
43
|
"android/src",
|
|
44
44
|
"android/build.gradle",
|
|
45
45
|
"android/CMakeLists.txt",
|
|
46
|
-
"ios
|
|
47
|
-
"ios
|
|
46
|
+
"ios/**/*.swift",
|
|
47
|
+
"ios/**/*.mm",
|
|
48
|
+
"ios/**/*.m",
|
|
48
49
|
"cpp",
|
|
49
50
|
"nitrogen/generated",
|
|
50
51
|
"scripts/postinstall.js",
|
|
51
52
|
"scripts/download-ios-frameworks.sh",
|
|
52
|
-
"scripts/build-ios-engine.sh",
|
|
53
|
-
"scripts/stubs",
|
|
54
53
|
"react-native.config.js",
|
|
55
54
|
"react-native-litert-lm.podspec",
|
|
56
55
|
"app.plugin.js",
|
|
@@ -64,6 +63,7 @@
|
|
|
64
63
|
"postinstall": "node scripts/postinstall.js",
|
|
65
64
|
"build": "tsc",
|
|
66
65
|
"typecheck": "tsc --noEmit",
|
|
66
|
+
"test": "jest",
|
|
67
67
|
"lint": "eslint \"**/*.{js,ts,tsx}\" --fix",
|
|
68
68
|
"prepack": "npm run build",
|
|
69
69
|
"specs": "npx nitrogen",
|
|
@@ -76,9 +76,17 @@
|
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@expo/config-plugins": "~55.0.0",
|
|
79
|
+
"@types/jest": "^30.0.0",
|
|
79
80
|
"@types/react": "~19.2.10",
|
|
81
|
+
"@types/react-test-renderer": "^19.1.0",
|
|
82
|
+
"jest": "^30.4.2",
|
|
83
|
+
"react": "^19.2.6",
|
|
84
|
+
"react-native": "^0.85.3",
|
|
80
85
|
"react-native-nitro-modules": "^0.35.4",
|
|
86
|
+
"react-test-renderer": "^19.2.6",
|
|
81
87
|
"release-it": "^19.2.4",
|
|
88
|
+
"ts-jest": "^29.4.10",
|
|
89
|
+
"ts-node": "^10.9.2",
|
|
82
90
|
"typescript": "^5.0.0"
|
|
83
91
|
},
|
|
84
92
|
"peerDependencies": {
|