react-native-nitro-modules 0.4.1 → 0.6.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/NitroModules.podspec +4 -1
- package/README.md +35 -16
- package/android/gradle.properties +5 -5
- package/android/src/main/cpp/JNIOnLoad.cpp +8 -0
- package/android/src/main/cpp/core/ByteBufferArrayBuffer.hpp +47 -0
- package/android/src/main/cpp/core/JAnyMap.hpp +193 -0
- package/android/src/main/cpp/core/JAnyValue.hpp +191 -0
- package/android/src/main/cpp/core/JArrayBuffer.hpp +119 -0
- package/android/src/main/cpp/core/JHybridObject.hpp +11 -4
- package/android/src/main/cpp/core/JPromise.hpp +88 -0
- package/android/src/main/cpp/platform/NitroLogger.cpp +36 -0
- package/android/src/main/cpp/registry/JHybridObjectInitializer.hpp +1 -1
- package/android/src/main/cpp/registry/JHybridObjectRegistry.cpp +1 -1
- package/android/src/main/cpp/registry/JHybridObjectRegistry.hpp +1 -1
- package/android/src/main/cpp/utils/{JNISharedPtr.h → JNISharedPtr.hpp} +13 -1
- package/android/src/main/java/com/margelo/nitro/JNIOnLoad.java +27 -0
- package/android/src/main/java/com/margelo/nitro/NitroModulesPackage.java +1 -9
- package/android/src/main/java/com/margelo/nitro/core/AnyMap.kt +61 -0
- package/android/src/main/java/com/margelo/nitro/core/AnyValue.kt +153 -0
- package/android/src/main/java/com/margelo/nitro/core/ArrayBuffer.kt +84 -0
- package/android/src/main/java/com/margelo/nitro/{HybridObject.kt → core/HybridObject.kt} +12 -15
- package/android/src/main/java/com/margelo/nitro/{HybridObjectInitializer.java → core/HybridObjectInitializer.java} +1 -1
- package/android/src/main/java/com/margelo/nitro/{HybridObjectRegistry.java → core/HybridObjectRegistry.java} +6 -4
- package/android/src/main/java/com/margelo/nitro/core/Promise.kt +115 -0
- package/cpp/core/AnyMap.hpp +2 -2
- package/cpp/core/ArrayBuffer.cpp +5 -5
- package/cpp/core/ArrayBuffer.hpp +12 -7
- package/cpp/core/HybridFunction.hpp +119 -45
- package/cpp/core/HybridObject.cpp +17 -6
- package/cpp/core/HybridObject.hpp +32 -8
- package/cpp/jsi/JSICache.cpp +5 -5
- package/cpp/jsi/JSICache.hpp +1 -3
- package/cpp/jsi/JSIConverter+AnyMap.hpp +2 -2
- package/cpp/jsi/JSIConverter+ArrayBuffer.hpp +2 -2
- package/cpp/jsi/JSIConverter+Function.hpp +7 -6
- package/cpp/jsi/JSIConverter+HybridObject.hpp +6 -5
- package/cpp/jsi/JSIConverter+Optional.hpp +1 -1
- package/cpp/jsi/JSIConverter+Promise.hpp +6 -4
- package/cpp/jsi/JSIConverter+Tuple.hpp +1 -1
- package/cpp/jsi/JSIConverter+UnorderedMap.hpp +1 -1
- package/cpp/jsi/JSIConverter+Variant.hpp +1 -3
- package/cpp/jsi/JSIConverter+Vector.hpp +1 -1
- package/cpp/jsi/JSIConverter.hpp +11 -11
- package/cpp/jsi/JSPromise.cpp +2 -2
- package/cpp/platform/NitroLogger.hpp +67 -0
- package/cpp/prototype/HybridObjectPrototype.cpp +2 -2
- package/cpp/prototype/Prototype.hpp +43 -22
- package/cpp/registry/HybridObjectRegistry.cpp +4 -4
- package/cpp/threading/Dispatcher.cpp +4 -3
- package/cpp/threading/ThreadPool.cpp +2 -2
- package/cpp/turbomodule/NativeNitroModules.cpp +26 -8
- package/cpp/turbomodule/NativeNitroModules.h +1 -0
- package/cpp/turbomodule/NativeNitroModules.hpp +2 -0
- package/cpp/utils/TypeInfo.hpp +14 -0
- package/ios/core/AnyMapHolder.hpp +91 -0
- package/ios/core/AnyMapHolder.swift +316 -0
- package/ios/core/ArrayBufferHolder.hpp +16 -5
- package/ios/core/{ArrayBuffer.swift → ArrayBufferHolder.swift} +15 -17
- package/ios/core/HybridContext.hpp +3 -3
- package/ios/core/Promise.swift +182 -0
- package/ios/core/PromiseHolder.hpp +86 -0
- package/ios/platform/NitroLogger.mm +36 -0
- package/ios/platform/ThreadUtils.cpp +1 -1
- package/ios/turbomodule/NitroModuleOnLoad.mm +6 -0
- package/ios/utils/SwiftClosure.hpp +63 -0
- package/ios/utils/SwiftClosure.swift +58 -0
- package/lib/AnyMap.d.ts +3 -0
- package/lib/HybridObject.d.ts +15 -0
- package/lib/NativeNitroModules.d.ts +2 -0
- package/lib/NitroModules.d.ts +18 -0
- package/lib/NitroModules.js +24 -0
- package/lib/commonjs/NativeNitroModules.js.map +1 -1
- package/lib/commonjs/NitroModules.js +24 -0
- package/lib/commonjs/NitroModules.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/module/AnyMap.js +1 -1
- package/lib/module/HybridObject.js +1 -1
- package/lib/module/ModuleNotFoundError.js +2 -0
- package/lib/module/ModuleNotFoundError.js.map +1 -1
- package/lib/module/NativeNitroModules.js +2 -0
- package/lib/module/NativeNitroModules.js.map +1 -1
- package/lib/module/NativeNitroModules.web.js +2 -0
- package/lib/module/NativeNitroModules.web.js.map +1 -1
- package/lib/module/NitroModules.js +26 -0
- package/lib/module/NitroModules.js.map +1 -1
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/typescript/AnyMap.d.ts +20 -0
- package/lib/typescript/AnyMap.d.ts.map +1 -1
- package/lib/typescript/HybridObject.d.ts +98 -0
- package/lib/typescript/HybridObject.d.ts.map +1 -1
- package/lib/typescript/NativeNitroModules.d.ts +2 -0
- package/lib/typescript/NativeNitroModules.d.ts.map +1 -1
- package/lib/typescript/NitroModules.d.ts +18 -0
- package/lib/typescript/NitroModules.d.ts.map +1 -1
- package/package.json +13 -12
- package/src/AnyMap.ts +3 -0
- package/src/HybridObject.ts +15 -0
- package/src/NativeNitroModules.ts +5 -0
- package/src/NitroModules.ts +24 -0
- package/android/src/main/cpp/core/JHybridObject.cpp +0 -8
- package/cpp/templates/IsInPack.hpp +0 -21
- package/cpp/utils/NitroLogger.hpp +0 -58
- package/ios/core/ClosureWrapper.swift +0 -25
- package/ios/core/HybridContext.cpp +0 -8
- package/ios/core/Promise.cpp +0 -10
- package/ios/core/Promise.hpp +0 -43
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Promise.swift
|
|
3
|
+
// NitroModules
|
|
4
|
+
//
|
|
5
|
+
// Created by Marc Rousavy on 15.08.24.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents a Promise that can be passed to JS.
|
|
12
|
+
*
|
|
13
|
+
* Create a new Promise with the following APIs:
|
|
14
|
+
* - `Promise<T>.async { ... }` - Creates a new Promise that runs the given code in a Swift `async`/`await` Task.
|
|
15
|
+
* - `Promise<T>.parallel { ... }` - Creates a new Promise that runs the given code in a parallel `DispatchQueue`.
|
|
16
|
+
* - `Promise<T>.resolved(withResult:)` - Creates a new already resolved Promise.
|
|
17
|
+
* - `Promise<T>.rejected(withError:)` - Creates a new already rejected Promise.
|
|
18
|
+
* - `Promise<T>()` - Creates a new Promise with fully manual control over the `resolve(..)`/`reject(..)` functions.
|
|
19
|
+
*/
|
|
20
|
+
public class Promise<T> {
|
|
21
|
+
private enum State {
|
|
22
|
+
case result(T)
|
|
23
|
+
case error(Error)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
private var state: State?
|
|
27
|
+
private var onResolvedListeners: [(T) -> Void] = []
|
|
28
|
+
private var onRejectedListeners: [(Error) -> Void] = []
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Create a new pending Promise.
|
|
32
|
+
* It can (and must) be resolved **or** rejected later.
|
|
33
|
+
*/
|
|
34
|
+
public init() {
|
|
35
|
+
state = nil
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
deinit {
|
|
39
|
+
if state == nil {
|
|
40
|
+
print("⚠️ Promise<\(String(describing: T.self))> got destroyed, but was never resolved or rejected! It is probably left hanging in JS now.")
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Resolves this `Promise<T>` with the given `T` and notifies all listeners.
|
|
46
|
+
*/
|
|
47
|
+
public func resolve(withResult result: T) {
|
|
48
|
+
guard state == nil else {
|
|
49
|
+
fatalError("Failed to resolve promise with \(result) - it has already been resolved or rejected!")
|
|
50
|
+
}
|
|
51
|
+
state = .result(result)
|
|
52
|
+
onResolvedListeners.forEach { listener in listener(result) }
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Rejects this `Promise<T>` with the given `Error` and notifies all listeners.
|
|
57
|
+
*/
|
|
58
|
+
public func reject(withError error: Error) {
|
|
59
|
+
guard state == nil else {
|
|
60
|
+
fatalError("Failed to reject promise with \(error) - it has already been resolved or rejected!")
|
|
61
|
+
}
|
|
62
|
+
state = .error(error)
|
|
63
|
+
onRejectedListeners.forEach { listener in listener(error) }
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Extensions to easily create new Promises.
|
|
69
|
+
*/
|
|
70
|
+
extension Promise {
|
|
71
|
+
/**
|
|
72
|
+
* Create a new `Promise<T>` already resolved with the given `T`.
|
|
73
|
+
*/
|
|
74
|
+
public static func resolved(withResult result: T) -> Promise {
|
|
75
|
+
let promise = Promise()
|
|
76
|
+
promise.state = .result(result)
|
|
77
|
+
return promise
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Create a new `Promise<T>` already rejected with the given `Error`.
|
|
82
|
+
*/
|
|
83
|
+
public static func rejected(withError error: Error) -> Promise {
|
|
84
|
+
let promise = Promise()
|
|
85
|
+
promise.state = .error(error)
|
|
86
|
+
return promise
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Create a new `Promise<T>` that runs the given `async` code in a `Task`.
|
|
91
|
+
* This does not necessarily run the code in a different Thread, but supports Swift's `async`/`await`.
|
|
92
|
+
*/
|
|
93
|
+
public static func `async`(_ priority: TaskPriority? = nil,
|
|
94
|
+
_ run: @escaping () async throws -> T) -> Promise {
|
|
95
|
+
let promise = Promise()
|
|
96
|
+
Task(priority: priority) {
|
|
97
|
+
do {
|
|
98
|
+
let result = try await run()
|
|
99
|
+
promise.resolve(withResult: result)
|
|
100
|
+
} catch {
|
|
101
|
+
promise.reject(withError: error)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return promise
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Create a new `Promise<T>` that runs the given `run` function on a parallel Thread/`DispatchQueue`.
|
|
109
|
+
*/
|
|
110
|
+
public static func parallel(_ queue: DispatchQueue = .global(),
|
|
111
|
+
_ run: @escaping () throws -> T) -> Promise {
|
|
112
|
+
let promise = Promise()
|
|
113
|
+
queue.async {
|
|
114
|
+
do {
|
|
115
|
+
let result = try run()
|
|
116
|
+
promise.resolve(withResult: result)
|
|
117
|
+
} catch {
|
|
118
|
+
promise.reject(withError: error)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return promise
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Extensions to support then/catch syntax.
|
|
127
|
+
*/
|
|
128
|
+
extension Promise {
|
|
129
|
+
/**
|
|
130
|
+
* Add a continuation listener to this `Promise<T>`.
|
|
131
|
+
* Once the `Promise<T>` resolves, the `onResolvedListener` will be called.
|
|
132
|
+
*/
|
|
133
|
+
@discardableResult
|
|
134
|
+
public func then(_ onResolvedListener: @escaping (T) -> Void) -> Promise {
|
|
135
|
+
switch state {
|
|
136
|
+
case .result(let result):
|
|
137
|
+
onResolvedListener(result)
|
|
138
|
+
break
|
|
139
|
+
default:
|
|
140
|
+
onResolvedListeners.append(onResolvedListener)
|
|
141
|
+
break
|
|
142
|
+
}
|
|
143
|
+
return self
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Add an error continuation listener to this `Promise<T>`.
|
|
148
|
+
* Once the `Promise<T>` rejects, the `onRejectedListener` will be called with the error.
|
|
149
|
+
*/
|
|
150
|
+
@discardableResult
|
|
151
|
+
public func `catch`(_ onRejectedListener: @escaping (Error) -> Void) -> Promise {
|
|
152
|
+
switch state {
|
|
153
|
+
case .error(let error):
|
|
154
|
+
onRejectedListener(error)
|
|
155
|
+
break
|
|
156
|
+
default:
|
|
157
|
+
onRejectedListeners.append(onRejectedListener)
|
|
158
|
+
break
|
|
159
|
+
}
|
|
160
|
+
return self
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Extensions to support await syntax.
|
|
166
|
+
*/
|
|
167
|
+
extension Promise {
|
|
168
|
+
/**
|
|
169
|
+
* Asynchronously await the result of the Promise.
|
|
170
|
+
* If the Promise is already resolved/rejected, this will continue immediately,
|
|
171
|
+
* otherwise it will asynchronously wait for a result or throw on a rejection.
|
|
172
|
+
*/
|
|
173
|
+
public func `await`() async throws -> T {
|
|
174
|
+
return try await withUnsafeThrowingContinuation { continuation in
|
|
175
|
+
self.then { result in
|
|
176
|
+
continuation.resume(returning: result)
|
|
177
|
+
}.catch { error in
|
|
178
|
+
continuation.resume(throwing: error)
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
//
|
|
2
|
+
// PromiseHolder.hpp
|
|
3
|
+
// Pods
|
|
4
|
+
//
|
|
5
|
+
// Created by Marc Rousavy on 15.08.24.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <future>
|
|
11
|
+
#include <string>
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Holds a `std::promise` that can be accessed from Swift using proper ref management.
|
|
17
|
+
*/
|
|
18
|
+
template <typename T>
|
|
19
|
+
class PromiseHolder {
|
|
20
|
+
public:
|
|
21
|
+
/**
|
|
22
|
+
* Create a new PromiseHolder (and a new `std::promise<T>`).
|
|
23
|
+
*/
|
|
24
|
+
explicit PromiseHolder() {
|
|
25
|
+
_promise = std::make_shared<std::promise<T>>();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Resolve the underlying `std::promise<T>` with `T`.
|
|
30
|
+
*/
|
|
31
|
+
void resolve(const T& result) const {
|
|
32
|
+
_promise->set_value(result);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Reject the underlying `std::promise<T>` with the given message.
|
|
37
|
+
*/
|
|
38
|
+
void reject(const std::string& message) const {
|
|
39
|
+
try {
|
|
40
|
+
throw std::runtime_error(message);
|
|
41
|
+
} catch (...) {
|
|
42
|
+
_promise->set_exception(std::current_exception());
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Get the `std::future<T>` of the underlying `std::promise<T>`.
|
|
48
|
+
* This can only be called once.
|
|
49
|
+
*/
|
|
50
|
+
std::future<T> getFuture() {
|
|
51
|
+
return _promise->get_future();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
private:
|
|
55
|
+
std::shared_ptr<std::promise<T>> _promise;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Specialization for `void` (no args to `resolve()`)
|
|
59
|
+
template <>
|
|
60
|
+
class PromiseHolder<void> {
|
|
61
|
+
public:
|
|
62
|
+
explicit PromiseHolder() {
|
|
63
|
+
_promise = std::make_shared<std::promise<void>>();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
void resolve() const {
|
|
67
|
+
_promise->set_value();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
void reject(const std::string& message) const {
|
|
71
|
+
try {
|
|
72
|
+
throw std::runtime_error(message);
|
|
73
|
+
} catch (...) {
|
|
74
|
+
_promise->set_exception(std::current_exception());
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
std::future<void> getFuture() {
|
|
79
|
+
return _promise->get_future();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private:
|
|
83
|
+
std::shared_ptr<std::promise<void>> _promise;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//
|
|
2
|
+
// NitroLogger.mm
|
|
3
|
+
// react-native-nitro
|
|
4
|
+
//
|
|
5
|
+
// Created by Marc Rousavy on 14.07.24.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#include "NitroLogger.hpp"
|
|
9
|
+
#include "AnyMapHolder.hpp"
|
|
10
|
+
#include <Foundation/Foundation.h>
|
|
11
|
+
|
|
12
|
+
namespace margelo::nitro {
|
|
13
|
+
|
|
14
|
+
const char* levelToString(LogLevel level) {
|
|
15
|
+
switch (level) {
|
|
16
|
+
case LogLevel::Debug:
|
|
17
|
+
return "DEBUG";
|
|
18
|
+
case LogLevel::Info:
|
|
19
|
+
return "INFO";
|
|
20
|
+
case LogLevel::Warning:
|
|
21
|
+
return "WARNING";
|
|
22
|
+
case LogLevel::Error:
|
|
23
|
+
return "ERROR";
|
|
24
|
+
default:
|
|
25
|
+
throw std::runtime_error("Invalid LogLevel!");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
void Logger::nativeLog(LogLevel level, const char* tag, const std::string& message) {
|
|
30
|
+
#ifndef NDEBUG
|
|
31
|
+
const char* logLevel = levelToString(level);
|
|
32
|
+
NSLog(@"[%s] [Nitro.%s] %s", logLevel, tag, message.c_str());
|
|
33
|
+
#endif
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
} // namespace margelo::nitro
|
|
@@ -9,6 +9,12 @@
|
|
|
9
9
|
#import "RegisterNativeNitroModules.hpp"
|
|
10
10
|
#import <Foundation/Foundation.h>
|
|
11
11
|
|
|
12
|
+
// just import headers so we have syntax highlighting
|
|
13
|
+
#import "ArrayBufferHolder.hpp"
|
|
14
|
+
#import "HybridContext.hpp"
|
|
15
|
+
#import "PromiseHolder.hpp"
|
|
16
|
+
#import "SwiftClosure.hpp"
|
|
17
|
+
|
|
12
18
|
@interface NitroModulesOnLoad : NSObject
|
|
13
19
|
@end
|
|
14
20
|
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
//
|
|
2
|
+
// SwiftClosure.hpp
|
|
3
|
+
// Nitro Modules
|
|
4
|
+
//
|
|
5
|
+
// Created by Marc Rousavy on 29.08.24.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <functional>
|
|
11
|
+
#include <memory>
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Holds a Swift closure, including any captured values via `Unmanaged` context.
|
|
17
|
+
*
|
|
18
|
+
* This internally holds a `std::function`, which can be called via `()`,
|
|
19
|
+
* or accessed directly via `getFunction()`.
|
|
20
|
+
* Copying a `SwiftClosure` will copy the `std::function`.
|
|
21
|
+
*/
|
|
22
|
+
struct SwiftClosure final {
|
|
23
|
+
public:
|
|
24
|
+
using CallFn = void(void*);
|
|
25
|
+
using DeleteFn = void(void*);
|
|
26
|
+
|
|
27
|
+
private:
|
|
28
|
+
std::function<void()> _function;
|
|
29
|
+
|
|
30
|
+
public:
|
|
31
|
+
explicit SwiftClosure(void* context, CallFn* call, DeleteFn* destroy) {
|
|
32
|
+
// Create a std::shared_ptr of the `void* context` which calls `destroy`
|
|
33
|
+
// once no references of it exist anymore.
|
|
34
|
+
// Since the std::function captures this std::shared_ptr, it can now be
|
|
35
|
+
// safely copied around, and only once no more references to it exist,
|
|
36
|
+
// `destroy()` will be called.
|
|
37
|
+
std::shared_ptr<void> sharedContext(context, destroy);
|
|
38
|
+
// Create a std::function that captures `sharedContext`.
|
|
39
|
+
// Once it gets destroyed, `destroy()` gets called.
|
|
40
|
+
_function = [sharedContext, call]() {
|
|
41
|
+
// Call the actual Swift closure.
|
|
42
|
+
call(sharedContext.get());
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
/**
|
|
48
|
+
* Call the Swift Closure.
|
|
49
|
+
*/
|
|
50
|
+
inline void operator()() {
|
|
51
|
+
_function();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
/**
|
|
56
|
+
* Gets the underlying `std::function`.
|
|
57
|
+
*/
|
|
58
|
+
const std::function<void()>& getFunction() {
|
|
59
|
+
return _function;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
//
|
|
2
|
+
// SwiftClosure.swift
|
|
3
|
+
// NitroModules
|
|
4
|
+
//
|
|
5
|
+
// Created by Marc Rousavy on 14.08.24.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift closure in a Swift class.
|
|
12
|
+
* This can be used to create unmanaged pointers (`void*`) and
|
|
13
|
+
* passed to C-style function pointers via `void* context` parameters.
|
|
14
|
+
*/
|
|
15
|
+
fileprivate final class ClosureWrapper {
|
|
16
|
+
private let closure: () -> Void
|
|
17
|
+
|
|
18
|
+
init(closure: @escaping () -> Void) {
|
|
19
|
+
self.closure = closure
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
func invoke() {
|
|
23
|
+
closure()
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Represents a Swift Closure that can be called from both C++ and Swift.
|
|
29
|
+
*/
|
|
30
|
+
public typealias SwiftClosure = margelo.nitro.SwiftClosure
|
|
31
|
+
|
|
32
|
+
public extension SwiftClosure {
|
|
33
|
+
/**
|
|
34
|
+
* Create a new `SwiftClosure` wrapping the given Swift closure.
|
|
35
|
+
* This can then be called from both C++ and Swift.
|
|
36
|
+
*/
|
|
37
|
+
init(wrappingClosure closure: @escaping () -> Void) {
|
|
38
|
+
// Wrap closure in void*, and increment it's ref count so it stays alive.
|
|
39
|
+
let context = Unmanaged.passRetained(ClosureWrapper(closure: closure)).toOpaque()
|
|
40
|
+
|
|
41
|
+
// Create a C-style Function Pointer, which calls the actual Swift closure.
|
|
42
|
+
let call: @convention(c) (UnsafeMutableRawPointer?) -> Void = { context in
|
|
43
|
+
// Unwrap context from void* to closure again. We are assuming that it has not been deleted yet.
|
|
44
|
+
let closure = Unmanaged<ClosureWrapper>.fromOpaque(context!).takeUnretainedValue()
|
|
45
|
+
// Call it!
|
|
46
|
+
closure.invoke()
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Create a C-style Function Pointer, which deletes the `ClosureWrapper`.
|
|
50
|
+
let destroy: @convention(c) (UnsafeMutableRawPointer?) -> Void = { context in
|
|
51
|
+
guard let context else { return }
|
|
52
|
+
// Release the void* holding our `ClosureWrapper`
|
|
53
|
+
Unmanaged<ClosureWrapper>.fromOpaque(context).release()
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
self.init(context, call, destroy)
|
|
57
|
+
}
|
|
58
|
+
}
|
package/lib/AnyMap.d.ts
CHANGED
|
@@ -12,5 +12,8 @@ export type ValueType = string | number | boolean | bigint | null | ValueType[]
|
|
|
12
12
|
* - Objects of primitives (`Record<string, ValueType>`)
|
|
13
13
|
* - Arrays of arrays or objects
|
|
14
14
|
* - Objects of arrays or objects
|
|
15
|
+
*
|
|
16
|
+
* @note It is recommended to always use typed `interface`s instead of `AnyMap` for
|
|
17
|
+
* both type safety, as well as better performance.
|
|
15
18
|
*/
|
|
16
19
|
export type AnyMap = Record<string, ValueType>;
|
package/lib/HybridObject.d.ts
CHANGED
|
@@ -79,4 +79,19 @@ export interface HybridObject<Platforms extends PlatformSpec = {}> {
|
|
|
79
79
|
* ```
|
|
80
80
|
*/
|
|
81
81
|
equals(other: HybridObject<Platforms>): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Disposes any resources this {@linkcode HybridObject} might hold natively,
|
|
84
|
+
* and finally releases this {@linkcode HybridObject}'s `NativeState`.
|
|
85
|
+
*
|
|
86
|
+
* After calling {@linkcode dispose()}, this object can no longer be used.
|
|
87
|
+
*
|
|
88
|
+
* Eagerly disposing a {@linkcode HybridObject} could be beneficial for a queue-/handler-architecture
|
|
89
|
+
* where a bunch of Hybrid Objects are allocated, and later deallocated once a callback (e.g. a render function)
|
|
90
|
+
* completes.
|
|
91
|
+
*
|
|
92
|
+
* @note It is **NOT** required to call {@linkcode dispose()} manually, as the JavaScript
|
|
93
|
+
* Garbage Collector automatically disposes and releases any resources when needed.
|
|
94
|
+
* It is purely optional to eagerly-, and manually-, call {@linkcode dispose()} here - **use with caution!**
|
|
95
|
+
*/
|
|
96
|
+
dispose(): void;
|
|
82
97
|
}
|
|
@@ -5,6 +5,8 @@ export interface Spec extends TurboModule {
|
|
|
5
5
|
createHybridObject(name: string, args?: UnsafeObject): UnsafeObject;
|
|
6
6
|
hasHybridObject(name: string): boolean;
|
|
7
7
|
getAllHybridObjectNames(): string[];
|
|
8
|
+
hasNativeState(obj: UnsafeObject): boolean;
|
|
9
|
+
removeNativeState(obj: UnsafeObject): void;
|
|
8
10
|
}
|
|
9
11
|
export declare function getNativeNitroModules(): Spec;
|
|
10
12
|
declare global {
|
package/lib/NitroModules.d.ts
CHANGED
|
@@ -22,4 +22,22 @@ export declare const NitroModules: {
|
|
|
22
22
|
* Returns whether a HybridObject under the given {@linkcode name} is registered, or not.
|
|
23
23
|
*/
|
|
24
24
|
hasHybridObject(name: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Returns whether the given {@linkcode object} has a `NativeState` or not.
|
|
27
|
+
*
|
|
28
|
+
* This can be a quick way to check if an object is a valid {@linkcode HybridObject},
|
|
29
|
+
* and has not yet been disposed.
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const someObject = NitroModules.createHybridObject<Some>('Some')
|
|
33
|
+
* console.log(NitroModules.hasNativeState(someObject)) // -> true
|
|
34
|
+
* someObject.dispose()
|
|
35
|
+
* console.log(NitroModules.hasNativeState(someObject)) // -> false
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
hasNativeState(object: object): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Forcefully removes the `NativeState` of the given {@linkcode object}.
|
|
41
|
+
*/
|
|
42
|
+
removeNativeState(object: object): void;
|
|
25
43
|
};
|
package/lib/NitroModules.js
CHANGED
|
@@ -32,4 +32,28 @@ export const NitroModules = {
|
|
|
32
32
|
const nitro = getNativeNitroModules();
|
|
33
33
|
return nitro.hasHybridObject(name);
|
|
34
34
|
},
|
|
35
|
+
/**
|
|
36
|
+
* Returns whether the given {@linkcode object} has a `NativeState` or not.
|
|
37
|
+
*
|
|
38
|
+
* This can be a quick way to check if an object is a valid {@linkcode HybridObject},
|
|
39
|
+
* and has not yet been disposed.
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const someObject = NitroModules.createHybridObject<Some>('Some')
|
|
43
|
+
* console.log(NitroModules.hasNativeState(someObject)) // -> true
|
|
44
|
+
* someObject.dispose()
|
|
45
|
+
* console.log(NitroModules.hasNativeState(someObject)) // -> false
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
hasNativeState(object) {
|
|
49
|
+
const nitro = getNativeNitroModules();
|
|
50
|
+
return nitro.hasNativeState(object);
|
|
51
|
+
},
|
|
52
|
+
/**
|
|
53
|
+
* Forcefully removes the `NativeState` of the given {@linkcode object}.
|
|
54
|
+
*/
|
|
55
|
+
removeNativeState(object) {
|
|
56
|
+
const nitro = getNativeNitroModules();
|
|
57
|
+
nitro.removeNativeState(object);
|
|
58
|
+
},
|
|
35
59
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_ModuleNotFoundError","turboModule","getNativeNitroModules","TurboModuleRegistry","getEnforcing","install","e","ModuleNotFoundError","isRuntimeAlive","cache","global","__nitroModulesJSICache","dispatcher","__nitroDispatcher"],"sourceRoot":"../../src","sources":["NativeNitroModules.ts"],"mappings":";;;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,oBAAA,GAAAD,OAAA;
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_ModuleNotFoundError","turboModule","getNativeNitroModules","TurboModuleRegistry","getEnforcing","install","e","ModuleNotFoundError","isRuntimeAlive","cache","global","__nitroModulesJSICache","dispatcher","__nitroDispatcher"],"sourceRoot":"../../src","sources":["NativeNitroModules.ts"],"mappings":";;;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,oBAAA,GAAAD,OAAA;AAcA,IAAIE,WAA6B;AAC1B,SAASC,qBAAqBA,CAAA,EAAS;EAC5C,IAAID,WAAW,IAAI,IAAI,EAAE;IACvB,IAAI;MACF;MACAA,WAAW,GAAGE,gCAAmB,CAACC,YAAY,CAAO,iBAAiB,CAAC;;MAEvE;MACAH,WAAW,CAACI,OAAO,CAAC,CAAC;IACvB,CAAC,CAAC,OAAOC,CAAC,EAAE;MACV,MAAM,IAAIC,wCAAmB,CAACD,CAAC,CAAC;IAClC;EACF;EAEA,OAAOL,WAAW;AACpB;AAOO,SAASO,cAAcA,CAAA,EAAG;EAC/B,MAAMC,KAAK,GAAGC,MAAM,CAACC,sBAAsB;EAC3C,MAAMC,UAAU,GAAGF,MAAM,CAACG,iBAAiB;EAC3C,OAAOJ,KAAK,IAAI,IAAI,IAAIG,UAAU,IAAI,IAAI;AAC5C","ignoreList":[]}
|
|
@@ -41,6 +41,30 @@ const NitroModules = exports.NitroModules = {
|
|
|
41
41
|
hasHybridObject(name) {
|
|
42
42
|
const nitro = (0, _NativeNitroModules.getNativeNitroModules)();
|
|
43
43
|
return nitro.hasHybridObject(name);
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* Returns whether the given {@linkcode object} has a `NativeState` or not.
|
|
47
|
+
*
|
|
48
|
+
* This can be a quick way to check if an object is a valid {@linkcode HybridObject},
|
|
49
|
+
* and has not yet been disposed.
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* const someObject = NitroModules.createHybridObject<Some>('Some')
|
|
53
|
+
* console.log(NitroModules.hasNativeState(someObject)) // -> true
|
|
54
|
+
* someObject.dispose()
|
|
55
|
+
* console.log(NitroModules.hasNativeState(someObject)) // -> false
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
hasNativeState(object) {
|
|
59
|
+
const nitro = (0, _NativeNitroModules.getNativeNitroModules)();
|
|
60
|
+
return nitro.hasNativeState(object);
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* Forcefully removes the `NativeState` of the given {@linkcode object}.
|
|
64
|
+
*/
|
|
65
|
+
removeNativeState(object) {
|
|
66
|
+
const nitro = (0, _NativeNitroModules.getNativeNitroModules)();
|
|
67
|
+
nitro.removeNativeState(object);
|
|
44
68
|
}
|
|
45
69
|
};
|
|
46
70
|
//# sourceMappingURL=NitroModules.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_NativeNitroModules","require","NitroModules","exports","createHybridObject","name","nitro","getNativeNitroModules","instance","getAllHybridObjectNames","hasHybridObject"],"sourceRoot":"../../src","sources":["NitroModules.ts"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAGA;AACA;AACA;;AAKA;AACA;AACA;AACO,MAAMC,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG;EAC1B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEE,kBAAkBA,CAA8BC,IAAY,EAAK;IAC/D,MAAMC,KAAK,GAAG,IAAAC,yCAAqB,EAAC,CAAC;IACrC,MAAMC,QAAQ,GAAGF,KAAK,CAACF,kBAAkB,CAACC,IAAI,CAAC;IAC/C,OAAOG,QAAQ;EACjB,CAAC;EACD;AACF;AACA;EACEC,uBAAuBA,CAAA,EAAa;IAClC,MAAMH,KAAK,GAAG,IAAAC,yCAAqB,EAAC,CAAC;IACrC,OAAOD,KAAK,CAACG,uBAAuB,CAAC,CAAC;EACxC,CAAC;EACD;AACF;AACA;EACEC,eAAeA,CAACL,IAAY,EAAW;IACrC,MAAMC,KAAK,GAAG,IAAAC,yCAAqB,EAAC,CAAC;IACrC,OAAOD,KAAK,CAACI,eAAe,CAACL,IAAI,CAAC;EACpC;AACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_NativeNitroModules","require","NitroModules","exports","createHybridObject","name","nitro","getNativeNitroModules","instance","getAllHybridObjectNames","hasHybridObject","hasNativeState","object","removeNativeState"],"sourceRoot":"../../src","sources":["NitroModules.ts"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAGA;AACA;AACA;;AAKA;AACA;AACA;AACO,MAAMC,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG;EAC1B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEE,kBAAkBA,CAA8BC,IAAY,EAAK;IAC/D,MAAMC,KAAK,GAAG,IAAAC,yCAAqB,EAAC,CAAC;IACrC,MAAMC,QAAQ,GAAGF,KAAK,CAACF,kBAAkB,CAACC,IAAI,CAAC;IAC/C,OAAOG,QAAQ;EACjB,CAAC;EACD;AACF;AACA;EACEC,uBAAuBA,CAAA,EAAa;IAClC,MAAMH,KAAK,GAAG,IAAAC,yCAAqB,EAAC,CAAC;IACrC,OAAOD,KAAK,CAACG,uBAAuB,CAAC,CAAC;EACxC,CAAC;EACD;AACF;AACA;EACEC,eAAeA,CAACL,IAAY,EAAW;IACrC,MAAMC,KAAK,GAAG,IAAAC,yCAAqB,EAAC,CAAC;IACrC,OAAOD,KAAK,CAACI,eAAe,CAACL,IAAI,CAAC;EACpC,CAAC;EACD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEM,cAAcA,CAACC,MAAc,EAAW;IACtC,MAAMN,KAAK,GAAG,IAAAC,yCAAqB,EAAC,CAAC;IACrC,OAAOD,KAAK,CAACK,cAAc,CAACC,MAAM,CAAC;EACrC,CAAC;EACD;AACF;AACA;EACEC,iBAAiBA,CAACD,MAAc,EAAQ;IACtC,MAAMN,KAAK,GAAG,IAAAC,yCAAqB,EAAC,CAAC;IACrCD,KAAK,CAACO,iBAAiB,CAACD,MAAM,CAAC;EACjC;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
package/lib/module/AnyMap.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
//# sourceMappingURL=AnyMap.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
//# sourceMappingURL=HybridObject.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","BULLET_POINT","messageWithSuggestions","message","suggestions","join","getFrameworkType","ExpoConstants","NativeUnimoduleProxy","modulesConstants","ExponentConstants","appOwnership","ModuleNotFoundError","Error","constructor","cause","global","__turboModuleProxy","push","error","framework","OS"],"sourceRoot":"../../src","sources":["ModuleNotFoundError.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAOtD,MAAMC,YAAY,GAAG,MAAM;AAE3B,SAASC,sBAAsBA,CAC7BC,OAAe,EACfC,WAAqB,EACb;EACR,OAAOD,OAAO,GAAGF,YAAY,GAAGG,WAAW,CAACC,IAAI,CAACJ,YAAY,CAAC;AAChE;AAEA,SAASK,gBAAgBA,CAAA,EAAwC;EAC/D;EACA,MAAMC,aAAa,GACjBR,aAAa,CAACS,oBAAoB,EAAEC,gBAAgB,EAAEC,iBAAiB;EACzE,IAAIH,aAAa,IAAI,IAAI,EAAE;IACzB,IAAIA,aAAa,CAACI,YAAY,KAAK,MAAM,EAAE;MACzC;MACA,OAAO,SAAS;IAClB,CAAC,MAAM;MACL;MACA,OAAO,MAAM;IACf;EACF;EACA,OAAO,cAAc;AACvB;AAEA,OAAO,MAAMC,mBAAmB,SAASC,KAAK,CAAC;EAC7CC,WAAWA,CAACC,KAAe,EAAE;IAC3B;IACA,IAAIC,MAAM,CAACC,kBAAkB,IAAI,IAAI,EAAE;MACrC;MACA,MAAMd,OAAO,GACX,sFAAsF;MACxF,MAAMC,WAAqB,GAAG,EAAE;MAChCA,WAAW,CAACc,IAAI,CACd,2JACF,CAAC;MACD,MAAMC,KAAK,GAAGjB,sBAAsB,CAACC,OAAO,EAAEC,WAAW,CAAC;MAC1D,KAAK,CAACe,KAAK,EAAE;QAAEJ,KAAK,EAAEA;MAAM,CAAC,CAAC;MAC9B;IACF;IAEA,MAAMK,SAAS,GAAGd,gBAAgB,CAAC,CAAC;IACpC,IAAIc,SAAS,KAAK,SAAS,EAAE;MAC3B,KAAK,CACH,2GACF,CAAC;MACD;IACF;IAEA,MAAMjB,OAAO,GACX,uFAAuF;IACzF,MAAMC,WAAqB,GAAG,EAAE;IAChCA,WAAW,CAACc,IAAI,CACd,qHACF,CAAC;IACDd,WAAW,CAACc,IAAI,CACd,qOACF,CAAC;IACDd,WAAW,CAACc,IAAI,CACd,8GACF,CAAC;IACDd,WAAW,CAACc,IAAI,CAAC,gCAAgC,CAAC;IAClD,IAAIE,SAAS,KAAK,MAAM,EAAE;MACxBhB,WAAW,CAACc,IAAI,CAAC,oCAAoC,CAAC;IACxD;IACA,QAAQlB,QAAQ,CAACqB,EAAE;MACjB,KAAK,KAAK;MACV,KAAK,OAAO;QACVjB,WAAW,CAACc,IAAI,CACd,wDACF,CAAC;QACD;MACF,KAAK,SAAS;QACZd,WAAW,CAACc,IAAI,CAAC,6BAA6B,CAAC;QAC/C;MACF;QACE,MAAM,IAAIL,KAAK,CAAC,yCAAyCb,QAAQ,CAACqB,EAAE,GAAG,CAAC;IAC5E;IAEA,MAAMF,KAAK,GAAGjB,sBAAsB,CAACC,OAAO,EAAEC,WAAW,CAAC;IAC1D,KAAK,CAACe,KAAK,EAAE;MAAEJ,KAAK,EAAEA;IAAM,CAAC,CAAC;EAChC;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","BULLET_POINT","messageWithSuggestions","message","suggestions","join","getFrameworkType","ExpoConstants","NativeUnimoduleProxy","modulesConstants","ExponentConstants","appOwnership","ModuleNotFoundError","Error","constructor","cause","global","__turboModuleProxy","push","error","framework","OS"],"sourceRoot":"../../src","sources":["ModuleNotFoundError.ts"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAOtD,MAAMC,YAAY,GAAG,MAAM;AAE3B,SAASC,sBAAsBA,CAC7BC,OAAe,EACfC,WAAqB,EACb;EACR,OAAOD,OAAO,GAAGF,YAAY,GAAGG,WAAW,CAACC,IAAI,CAACJ,YAAY,CAAC;AAChE;AAEA,SAASK,gBAAgBA,CAAA,EAAwC;EAC/D;EACA,MAAMC,aAAa,GACjBR,aAAa,CAACS,oBAAoB,EAAEC,gBAAgB,EAAEC,iBAAiB;EACzE,IAAIH,aAAa,IAAI,IAAI,EAAE;IACzB,IAAIA,aAAa,CAACI,YAAY,KAAK,MAAM,EAAE;MACzC;MACA,OAAO,SAAS;IAClB,CAAC,MAAM;MACL;MACA,OAAO,MAAM;IACf;EACF;EACA,OAAO,cAAc;AACvB;AAEA,OAAO,MAAMC,mBAAmB,SAASC,KAAK,CAAC;EAC7CC,WAAWA,CAACC,KAAe,EAAE;IAC3B;IACA,IAAIC,MAAM,CAACC,kBAAkB,IAAI,IAAI,EAAE;MACrC;MACA,MAAMd,OAAO,GACX,sFAAsF;MACxF,MAAMC,WAAqB,GAAG,EAAE;MAChCA,WAAW,CAACc,IAAI,CACd,2JACF,CAAC;MACD,MAAMC,KAAK,GAAGjB,sBAAsB,CAACC,OAAO,EAAEC,WAAW,CAAC;MAC1D,KAAK,CAACe,KAAK,EAAE;QAAEJ,KAAK,EAAEA;MAAM,CAAC,CAAC;MAC9B;IACF;IAEA,MAAMK,SAAS,GAAGd,gBAAgB,CAAC,CAAC;IACpC,IAAIc,SAAS,KAAK,SAAS,EAAE;MAC3B,KAAK,CACH,2GACF,CAAC;MACD;IACF;IAEA,MAAMjB,OAAO,GACX,uFAAuF;IACzF,MAAMC,WAAqB,GAAG,EAAE;IAChCA,WAAW,CAACc,IAAI,CACd,qHACF,CAAC;IACDd,WAAW,CAACc,IAAI,CACd,qOACF,CAAC;IACDd,WAAW,CAACc,IAAI,CACd,8GACF,CAAC;IACDd,WAAW,CAACc,IAAI,CAAC,gCAAgC,CAAC;IAClD,IAAIE,SAAS,KAAK,MAAM,EAAE;MACxBhB,WAAW,CAACc,IAAI,CAAC,oCAAoC,CAAC;IACxD;IACA,QAAQlB,QAAQ,CAACqB,EAAE;MACjB,KAAK,KAAK;MACV,KAAK,OAAO;QACVjB,WAAW,CAACc,IAAI,CACd,wDACF,CAAC;QACD;MACF,KAAK,SAAS;QACZd,WAAW,CAACc,IAAI,CAAC,6BAA6B,CAAC;QAC/C;MACF;QACE,MAAM,IAAIL,KAAK,CAAC,yCAAyCb,QAAQ,CAACqB,EAAE,GAAG,CAAC;IAC5E;IAEA,MAAMF,KAAK,GAAGjB,sBAAsB,CAACC,OAAO,EAAEC,WAAW,CAAC;IAC1D,KAAK,CAACe,KAAK,EAAE;MAAEJ,KAAK,EAAEA;IAAM,CAAC,CAAC;EAChC;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","ModuleNotFoundError","turboModule","getNativeNitroModules","getEnforcing","install","e","isRuntimeAlive","cache","global","__nitroModulesJSICache","dispatcher","__nitroDispatcher"],"sourceRoot":"../../src","sources":["NativeNitroModules.ts"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAc;AAElD,SAASC,mBAAmB,QAAQ,uBAAuB;
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","ModuleNotFoundError","turboModule","getNativeNitroModules","getEnforcing","install","e","isRuntimeAlive","cache","global","__nitroModulesJSICache","dispatcher","__nitroDispatcher"],"sourceRoot":"../../src","sources":["NativeNitroModules.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAElD,SAASC,mBAAmB,QAAQ,uBAAuB;AAc3D,IAAIC,WAA6B;AACjC,OAAO,SAASC,qBAAqBA,CAAA,EAAS;EAC5C,IAAID,WAAW,IAAI,IAAI,EAAE;IACvB,IAAI;MACF;MACAA,WAAW,GAAGF,mBAAmB,CAACI,YAAY,CAAO,iBAAiB,CAAC;;MAEvE;MACAF,WAAW,CAACG,OAAO,CAAC,CAAC;IACvB,CAAC,CAAC,OAAOC,CAAC,EAAE;MACV,MAAM,IAAIL,mBAAmB,CAACK,CAAC,CAAC;IAClC;EACF;EAEA,OAAOJ,WAAW;AACpB;AAOA,OAAO,SAASK,cAAcA,CAAA,EAAG;EAC/B,MAAMC,KAAK,GAAGC,MAAM,CAACC,sBAAsB;EAC3C,MAAMC,UAAU,GAAGF,MAAM,CAACG,iBAAiB;EAC3C,OAAOJ,KAAK,IAAI,IAAI,IAAIG,UAAU,IAAI,IAAI;AAC5C","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getNativeNitroModules","Error"],"sourceRoot":"../../src","sources":["NativeNitroModules.web.ts"],"mappings":"AAIA,OAAO,SAASA,qBAAqBA,CAAA,EAAS;EAC5C,MAAM,IAAIC,KAAK,CACb,oIACF,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["getNativeNitroModules","Error"],"sourceRoot":"../../src","sources":["NativeNitroModules.web.ts"],"mappings":";;AAIA,OAAO,SAASA,qBAAqBA,CAAA,EAAS;EAC5C,MAAM,IAAIC,KAAK,CACb,oIACF,CAAC;AACH","ignoreList":[]}
|