react-native-nitro-modules 0.4.1 → 0.5.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.
@@ -38,6 +38,7 @@ Pod::Spec.new do |s|
38
38
  "cpp/utils/NitroDefines.hpp",
39
39
  # Public iOS-specific headers that will be exposed in modulemap (for Swift)
40
40
  "ios/core/ArrayBufferHolder.hpp",
41
+ "ios/core/PromiseHolder.hpp",
41
42
  "ios/core/HybridContext.hpp",
42
43
  ]
43
44
 
package/README.md CHANGED
@@ -162,7 +162,7 @@ The following C++ / JS types are supported out of the box:
162
162
  <tr>
163
163
  <td><code>Promise&lt;T&gt;</code></td>
164
164
  <td><code>std::future&lt;T&gt;</code></td>
165
- <td>❌</td>
165
+ <td><code><a href="./ios/core/Promise.swift">Promise&lt;T&gt;</a></code></td>
166
166
  </tr>
167
167
  <tr>
168
168
  <td><code>(TArgs...) =&gt; void</code></td>
@@ -185,7 +185,7 @@ The following C++ / JS types are supported out of the box:
185
185
  <td><code><a href="./ios/core/ArrayBufferHolder.hpp">ArrayBufferHolder</a></code></td>
186
186
  </tr>
187
187
  <tr>
188
- <td><code><a href="./src/HybridObject.ts">HybridObject</a></code></td>
188
+ <td>..any <code><a href="./src/HybridObject.ts">HybridObject</a></code></td>
189
189
  <td><code>std::shared_ptr&lt;<a href="./cpp/core/HybridObject.hpp">HybridObject</a>&gt;</code></td>
190
190
  <td><code><a href="./ios/core/HybridObjectSpec.swift">HybridObjectSpec</a></code></td>
191
191
  </tr>
@@ -33,6 +33,12 @@ using DeleteFn = void (*)(void* context);
33
33
  * When this `ArrayBuffer` gets deleted, the memory will not be freed explicitly, as someone else owns it.
34
34
  */
35
35
  class ArrayBuffer : public jsi::MutableBuffer {
36
+ public:
37
+ ArrayBuffer() = default;
38
+ ArrayBuffer(const ArrayBuffer&) = delete;
39
+ ArrayBuffer(ArrayBuffer&&) = delete;
40
+ virtual ~ArrayBuffer() = default;
41
+
36
42
  public:
37
43
  /**
38
44
  * Returns whether this `ArrayBuffer` is actually owning the data,
@@ -40,7 +46,8 @@ public:
40
46
  * memory that we didn't allocate, or from JS - which can be deleted at any point).
41
47
  */
42
48
  virtual bool isOwner() const noexcept = 0;
43
-
49
+
50
+ public:
44
51
  /**
45
52
  * Create a new `NativeArrayBuffer` that wraps the given data (without copy) of the given size,
46
53
  * and calls `deleteFunc` with the given `deleteFuncContext` as a parameter in which `data` should be deleted.
@@ -67,9 +67,9 @@ struct JSIConverter<std::function<ReturnType(Args...)>> {
67
67
  };
68
68
  }
69
69
 
70
- static inline jsi::Value toJSI(jsi::Runtime& runtime, std::function<ReturnType(Args...)>&& function) {
71
- jsi::HostFunctionType jsFunction = [function = std::move(function)](jsi::Runtime& runtime, const jsi::Value& thisValue,
72
- const jsi::Value* args, size_t count) -> jsi::Value {
70
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const std::function<ReturnType(Args...)>& function) {
71
+ jsi::HostFunctionType jsFunction = [function](jsi::Runtime& runtime, const jsi::Value& thisValue,
72
+ const jsi::Value* args, size_t count) -> jsi::Value {
73
73
  if (count != sizeof...(Args)) [[unlikely]] {
74
74
  throw jsi::JSError(runtime, "Function expected " + std::to_string(sizeof...(Args)) + " arguments, but received " +
75
75
  std::to_string(count) + "!");
@@ -7,7 +7,8 @@
7
7
  // Forward declare a few of the common types that might have cyclic includes.
8
8
  namespace margelo::nitro {
9
9
  class Dispatcher;
10
- class Promise;
10
+
11
+ class JSPromise;
11
12
 
12
13
  template <typename T, typename Enable>
13
14
  struct JSIConverter;
@@ -8,7 +8,7 @@
8
8
  #pragma once
9
9
 
10
10
  #include "ArrayBuffer.hpp"
11
- #include "NitroDefines.hpp"
11
+ #include <swift/bridging>
12
12
  #include <memory>
13
13
 
14
14
  namespace margelo::nitro {
@@ -53,7 +53,16 @@ public:
53
53
  return _arrayBuffer->size();
54
54
  }
55
55
 
56
- bool isOwner() const SWIFT_COMPUTED_PROPERTY {
56
+ /**
57
+ * Whether the underlying `ArrayBuffer` actually owns the data it points to, or not.
58
+ *
59
+ * - If an `ArrayBuffer` owns the data, it is likely an ArrayBuffer created on the native side (C++/Swift).
60
+ * This means the `ArrayBuffer` is safe to access as long as you have a reference to it, and cannot be deleted otherwise.
61
+ * - If an `ArrayBuffer` doesn't own the data, it is likely an ArrayBuffer coming from JS.
62
+ * This means the `ArrayBuffer` is **NOT** safe to access outside of the synchronous function's scope.
63
+ * If you plan on hopping do a different Thread, or storing a long-lived reference to it, make sure to **copy** the data.
64
+ */
65
+ bool getIsOwner() const SWIFT_COMPUTED_PROPERTY {
57
66
  return _arrayBuffer->isOwner();
58
67
  }
59
68
 
@@ -1,5 +1,5 @@
1
1
  //
2
- // ArrayBuffer.swift
2
+ // ArrayBufferHolder.swift
3
3
  // NitroModules
4
4
  //
5
5
  // Created by Marc Rousavy on 17.07.24.
@@ -7,6 +7,12 @@
7
7
 
8
8
  import Foundation
9
9
 
10
+ /**
11
+ * Holds instances of `std::shared_ptr<ArrayBuffer>`, which can be passed
12
+ * between native and JS **without copy**.
13
+ *
14
+ * See `data`, `size` and `isOwning`.
15
+ */
10
16
  public typealias ArrayBufferHolder = margelo.nitro.ArrayBufferHolder
11
17
 
12
18
  public extension ArrayBufferHolder {
@@ -16,22 +22,13 @@ public extension ArrayBufferHolder {
16
22
  * When the `ArrayBuffer` is no longer used, `onDelete` will be called, in which
17
23
  * you as a caller are responsible for deleting `data`.
18
24
  */
19
- static func wrap(wrappingDataWithoutCopy data: UnsafeMutablePointer<UInt8>,
25
+ static func wrap(dataWithoutCopy data: UnsafeMutablePointer<UInt8>,
20
26
  size: Int,
21
27
  onDelete delete: @escaping () -> Void) -> ArrayBufferHolder {
22
28
  // Convert escaping Swift closure to a `void*`
23
- let wrapper = ClosureWrapper(closure: delete)
24
- let wrappedClosure = Unmanaged.passRetained(wrapper).toOpaque()
25
-
26
- return ArrayBufferHolder.makeBuffer(data, size, { context in
27
- guard let context else {
28
- fatalError("Context was null, even though we created one!")
29
- }
30
- // Convert `void*` to a Swift closure
31
- let closure = Unmanaged<ClosureWrapper>.fromOpaque(context).takeRetainedValue()
32
- // Call it (deleteFunc)
33
- closure.invoke()
34
- }, wrappedClosure)
29
+ let (wrappedClosure, context) = ClosureWrapper.wrap(closure: delete)
30
+ // Create ArrayBufferHolder with our wrapped Swift closure to make it callable as a C-function pointer
31
+ return ArrayBufferHolder.makeBuffer(data, size, wrappedClosure, context)
35
32
  }
36
33
 
37
34
  /**
@@ -0,0 +1,162 @@
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
+ }
@@ -0,0 +1,82 @@
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() { return _promise->get_future(); }
51
+
52
+ private:
53
+ std::shared_ptr<std::promise<T>> _promise;
54
+ };
55
+
56
+ // Specialization for `void` (no args to `resolve()`)
57
+ template<>
58
+ class PromiseHolder<void> {
59
+ public:
60
+ explicit PromiseHolder() {
61
+ _promise = std::make_shared<std::promise<void>>();
62
+ }
63
+
64
+ void resolve() const {
65
+ _promise->set_value();
66
+ }
67
+
68
+ void reject(const std::string& message) const {
69
+ try {
70
+ throw std::runtime_error(message);
71
+ } catch (...) {
72
+ _promise->set_exception(std::current_exception());
73
+ }
74
+ }
75
+
76
+ std::future<void> getFuture() { return _promise->get_future(); }
77
+
78
+ private:
79
+ std::shared_ptr<std::promise<void>> _promise;
80
+ };
81
+
82
+ } // namespace margelo::nitro
@@ -9,6 +9,11 @@
9
9
  #import "RegisterNativeNitroModules.hpp"
10
10
  #import <Foundation/Foundation.h>
11
11
 
12
+ // just import headers so we have syntax highlighting
13
+ #import "PromiseHolder.hpp"
14
+ #import "ArrayBufferHolder.hpp"
15
+ #import "HybridContext.hpp"
16
+
12
17
  @interface NitroModulesOnLoad : NSObject
13
18
  @end
14
19
 
@@ -0,0 +1,45 @@
1
+ //
2
+ // ClosureWrapper.swift
3
+ // NitroModules
4
+ //
5
+ // Created by Marc Rousavy on 14.08.24.
6
+ //
7
+
8
+ import Foundation
9
+
10
+ /**
11
+ * Wraps a 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
+ * To create a `ClosureWrapper`, use `ClosureWrapper.wrap(...)`.
16
+ */
17
+ public final class ClosureWrapper {
18
+ private let closure: () -> Void
19
+
20
+ private init(closure: @escaping () -> Void) {
21
+ self.closure = closure
22
+ }
23
+
24
+ private func invoke() {
25
+ closure()
26
+ }
27
+
28
+ /**
29
+ * Wraps the given Swift closure in a C-style function pointer with `void* context` associated to it.
30
+ * This way it can be passed to C/C++ and called without worrying about context/binding.
31
+ */
32
+ public static func wrap(closure: @escaping () -> Void) -> (@convention(c) (UnsafeMutableRawPointer?) -> Void, UnsafeMutableRawPointer) {
33
+ // Wrap closure in void*
34
+ let context = Unmanaged.passRetained(ClosureWrapper(closure: closure)).toOpaque()
35
+ // Create C-style Function Pointer
36
+ let cFunc: @convention(c) (UnsafeMutableRawPointer?) -> Void = { context in
37
+ guard let context else { fatalError("Context was null, even though we created one!") }
38
+ // Unwrap context from void* to closure again
39
+ let closure = Unmanaged<ClosureWrapper>.fromOpaque(context).takeRetainedValue()
40
+ // Call it!
41
+ closure.invoke()
42
+ }
43
+ return (cFunc, context)
44
+ }
45
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-nitro-modules",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Insanely fast native C++, Swift or Kotlin modules with a statically compiled binding layer to JSI.",
5
5
  "main": "lib/index",
6
6
  "module": "lib/index",
@@ -1,25 +0,0 @@
1
- //
2
- // ClosureWrapper.swift
3
- // NitroModules
4
- //
5
- // Created by Marc Rousavy on 14.08.24.
6
- //
7
-
8
- import Foundation
9
-
10
- /**
11
- * Wraps a 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
- final class ClosureWrapper {
16
- let closure: () -> Void
17
-
18
- init(closure: @escaping () -> Void) {
19
- self.closure = closure
20
- }
21
-
22
- func invoke() {
23
- closure()
24
- }
25
- }
@@ -1,8 +0,0 @@
1
- //
2
- // HybridContext.hpp
3
- // NitroModules
4
- //
5
- // Created by Marc Rousavy on 17.07.24.
6
- //
7
-
8
- #include "HybridContext.hpp"
@@ -1,10 +0,0 @@
1
- //
2
- // Promise.cpp
3
- // NitroModules
4
- //
5
- // Created by Marc Rousavy on 11.08.24.
6
- //
7
-
8
- #include "Promise.hpp"
9
-
10
- namespace margelo::nitro {} // namespace margelo::nitro
@@ -1,43 +0,0 @@
1
- //
2
- // Promise.hpp
3
- // NitroModules
4
- //
5
- // Created by Marc Rousavy on 11.08.24.
6
- //
7
-
8
- #pragma once
9
-
10
- #include <future>
11
- #include <memory>
12
- #include <string>
13
-
14
- namespace margelo::nitro {
15
-
16
- class Promise {
17
- public:
18
- Promise(const Promise&) = delete;
19
- Promise(Promise&&) = delete;
20
-
21
- public:
22
- void reject(const std::string& message) {
23
- // TODO: reject()
24
- }
25
-
26
- void resolve(int result) {
27
- // TODO: resolve()
28
- }
29
-
30
- private:
31
- explicit Promise() {
32
- // TODO: Init? From Future?
33
- }
34
-
35
- public:
36
- static std::shared_ptr<Promise> run(void (*run)(std::shared_ptr<Promise> promise)) {
37
- auto promise = std::shared_ptr<Promise>(new Promise());
38
- run(promise);
39
- return promise;
40
- }
41
- };
42
-
43
- } // namespace margelo::nitro
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnyMap.d.ts","sourceRoot":"","sources":["../../src/AnyMap.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,OAAO,GACP,MAAM,GACN,IAAI,GACJ,SAAS,EAAE,GACX;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAA;AAE9B;;;;;;;;GAQG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"HybridObject.d.ts","sourceRoot":"","sources":["../../src/HybridObject.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;IACrB,OAAO,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAA;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,YAAY,CAAC,SAAS,SAAS,YAAY,GAAG,EAAE;IAC/D;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB;;;;;;;;;;OAUG;IACH,QAAQ,IAAI,MAAM,CAAA;IAClB;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,SAAS,CAAC,GAAG,OAAO,CAAA;CAChD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ModuleNotFoundError.d.ts","sourceRoot":"","sources":["../../src/ModuleNotFoundError.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,kBAAkB,EAAE,OAAO,GAAG,SAAS,CAAA;CAC5C;AA2BD,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,KAAK,CAAC,EAAE,OAAO;CAwD5B"}
@@ -1,15 +0,0 @@
1
- import type { TurboModule } from 'react-native';
2
- import type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
3
- export interface Spec extends TurboModule {
4
- install(): void;
5
- createHybridObject(name: string, args?: UnsafeObject): UnsafeObject;
6
- hasHybridObject(name: string): boolean;
7
- getAllHybridObjectNames(): string[];
8
- }
9
- export declare function getNativeNitroModules(): Spec;
10
- declare global {
11
- var __nitroModulesJSICache: {};
12
- var __nitroDispatcher: {};
13
- }
14
- export declare function isRuntimeAlive(): boolean;
15
- //# sourceMappingURL=NativeNitroModules.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NativeNitroModules.d.ts","sourceRoot":"","sources":["../../src/NativeNitroModules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAA;AAG7E,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,OAAO,IAAI,IAAI,CAAA;IACf,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,YAAY,CAAA;IACnE,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;IACtC,uBAAuB,IAAI,MAAM,EAAE,CAAA;CACpC;AAGD,wBAAgB,qBAAqB,IAAI,IAAI,CAc5C;AAED,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,sBAAsB,EAAE,EAAE,CAAA;IAC9B,IAAI,iBAAiB,EAAE,EAAE,CAAA;CAC1B;AAED,wBAAgB,cAAc,YAI7B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"NativeNitroModules.web.d.ts","sourceRoot":"","sources":["../../src/NativeNitroModules.web.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C,MAAM,WAAW,IAAK,SAAQ,WAAW;CAAG;AAE5C,wBAAgB,qBAAqB,IAAI,IAAI,CAI5C"}
@@ -1,26 +0,0 @@
1
- import type { HybridObject } from './HybridObject';
2
- /**
3
- * A lazy proxy for initializing Nitro Modules HybridObjects.
4
- */
5
- export declare const NitroModules: {
6
- /**
7
- * Create a new instance of the `HybridObject` {@linkcode T}.
8
- *
9
- * {@linkcode T} has to be registered beforehand under the name {@linkcode name}
10
- * in the native Nitro Modules `HybridObjectRegistry`.
11
- *
12
- * @param name The name of the `HybridObject` under which it was registered at.
13
- * @returns An instance of {@linkcode T}
14
- * @throws an Error if {@linkcode T} has not been registered under the name {@linkcode name}.
15
- */
16
- createHybridObject<T extends HybridObject<any>>(name: string): T;
17
- /**
18
- * Get a list of all registered Hybrid Objects.
19
- */
20
- getAllHybridObjectNames(): string[];
21
- /**
22
- * Returns whether a HybridObject under the given {@linkcode name} is registered, or not.
23
- */
24
- hasHybridObject(name: string): boolean;
25
- };
26
- //# sourceMappingURL=NitroModules.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NitroModules.d.ts","sourceRoot":"","sources":["../../src/NitroModules.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AASlD;;GAEG;AACH,eAAO,MAAM,YAAY;IACvB;;;;;;;;;OASG;uBACgB,CAAC,SAAS,YAAY,CAAC,GAAG,CAAC,QAAQ,MAAM,GAAG,CAAC;IAKhE;;OAEG;+BACwB,MAAM,EAAE;IAInC;;OAEG;0BACmB,MAAM,GAAG,OAAO;CAIvC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/index.test.tsx"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA"}