@rnpack/utils 0.1.5 → 0.1.7
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/LICENSE +1 -1
- package/README.md +16 -26
- package/Utils.podspec +29 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +128 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/rnpack/utils/RNPackUtils.kt +10 -0
- package/android/src/main/java/com/margelo/nitro/rnpack/utils/RNPackUtilsPackage.kt +22 -0
- package/ios/RNPackUtils.swift +5 -0
- package/lib/module/RNPackUtils.nitro.js +4 -0
- package/lib/module/RNPackUtils.nitro.js.map +1 -0
- package/lib/module/constants/index.js +2 -0
- package/lib/module/constants/index.js.map +1 -1
- package/lib/module/constants/permissions.js +2 -0
- package/lib/module/constants/permissions.js.map +1 -1
- package/lib/module/constants/settings.js +2 -0
- package/lib/module/constants/settings.js.map +1 -1
- package/lib/module/hooks/index.js +2 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/usePagination.js +2 -0
- package/lib/module/hooks/usePagination.js.map +1 -1
- package/lib/module/hooks/useTimer.js +3 -1
- package/lib/module/hooks/useTimer.js.map +1 -1
- package/lib/module/index.js +7 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/types/index.js +2 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/types/settings.js +1 -1
- package/lib/module/utils/index.js +2 -1
- package/lib/module/utils/index.js.map +1 -1
- package/lib/module/utils/object.js +2 -0
- package/lib/module/utils/object.js.map +1 -1
- package/lib/module/utils/permissions.js +2 -0
- package/lib/module/utils/permissions.js.map +1 -1
- package/lib/module/utils/responsive.js +5 -3
- package/lib/module/utils/responsive.js.map +1 -1
- package/lib/module/utils/settings.js +2 -0
- package/lib/module/utils/settings.js.map +1 -1
- package/lib/module/utils/string.js +2 -0
- package/lib/module/utils/string.js.map +1 -1
- package/lib/module/utils/utils.js +2 -0
- package/lib/module/utils/utils.js.map +1 -1
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/RNPackUtils.nitro.d.ts +8 -0
- package/lib/typescript/src/RNPackUtils.nitro.d.ts.map +1 -0
- package/lib/typescript/src/constants/permissions.d.ts +4 -4
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +0 -1
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/utils/index.d.ts +0 -1
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/nitro.json +24 -0
- package/nitrogen/generated/android/RNPackUtils+autolinking.cmake +81 -0
- package/nitrogen/generated/android/RNPackUtils+autolinking.gradle +27 -0
- package/nitrogen/generated/android/RNPackUtilsOnLoad.cpp +44 -0
- package/nitrogen/generated/android/RNPackUtilsOnLoad.hpp +25 -0
- package/nitrogen/generated/android/c++/JHybridRNPackUtilsSpec.cpp +52 -0
- package/nitrogen/generated/android/c++/JHybridRNPackUtilsSpec.hpp +65 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rnpack/utils/HybridRNPackUtilsSpec.kt +57 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rnpack/utils/RNPackUtilsOnLoad.kt +35 -0
- package/nitrogen/generated/ios/RNPackUtils+autolinking.rb +60 -0
- package/nitrogen/generated/ios/RNPackUtils-Swift-Cxx-Bridge.cpp +33 -0
- package/nitrogen/generated/ios/RNPackUtils-Swift-Cxx-Bridge.hpp +51 -0
- package/nitrogen/generated/ios/RNPackUtils-Swift-Cxx-Umbrella.hpp +43 -0
- package/nitrogen/generated/ios/RNPackUtilsAutolinking.mm +33 -0
- package/nitrogen/generated/ios/RNPackUtilsAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridRNPackUtilsSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridRNPackUtilsSpecSwift.hpp +76 -0
- package/nitrogen/generated/ios/swift/HybridRNPackUtilsSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridRNPackUtilsSpec_cxx.swift +131 -0
- package/nitrogen/generated/shared/c++/HybridRNPackUtilsSpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridRNPackUtilsSpec.hpp +62 -0
- package/package.json +95 -95
- package/src/RNPackUtils.nitro.ts +6 -0
- package/src/hooks/useTimer.tsx +1 -1
- package/src/index.tsx +10 -0
- package/src/types/index.ts +0 -1
- package/src/utils/index.ts +0 -1
- package/src/utils/responsive.tsx +3 -3
- package/lib/commonjs/constants/index.js +0 -28
- package/lib/commonjs/constants/index.js.map +0 -1
- package/lib/commonjs/constants/permissions.js +0 -20
- package/lib/commonjs/constants/permissions.js.map +0 -1
- package/lib/commonjs/constants/settings.js +0 -17
- package/lib/commonjs/constants/settings.js.map +0 -1
- package/lib/commonjs/hooks/index.js +0 -28
- package/lib/commonjs/hooks/index.js.map +0 -1
- package/lib/commonjs/hooks/usePagination.js +0 -29
- package/lib/commonjs/hooks/usePagination.js.map +0 -1
- package/lib/commonjs/hooks/useTimer.js +0 -44
- package/lib/commonjs/hooks/useTimer.js.map +0 -1
- package/lib/commonjs/index.js +0 -50
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/package.json +0 -1
- package/lib/commonjs/types/index.js +0 -28
- package/lib/commonjs/types/index.js.map +0 -1
- package/lib/commonjs/types/settings.js +0 -2
- package/lib/commonjs/types/settings.js.map +0 -1
- package/lib/commonjs/types/storage.js +0 -2
- package/lib/commonjs/types/storage.js.map +0 -1
- package/lib/commonjs/utils/index.js +0 -83
- package/lib/commonjs/utils/index.js.map +0 -1
- package/lib/commonjs/utils/object.js +0 -32
- package/lib/commonjs/utils/object.js.map +0 -1
- package/lib/commonjs/utils/permissions.js +0 -55
- package/lib/commonjs/utils/permissions.js.map +0 -1
- package/lib/commonjs/utils/responsive.js +0 -36
- package/lib/commonjs/utils/responsive.js.map +0 -1
- package/lib/commonjs/utils/settings.js +0 -100
- package/lib/commonjs/utils/settings.js.map +0 -1
- package/lib/commonjs/utils/storage.js +0 -36
- package/lib/commonjs/utils/storage.js.map +0 -1
- package/lib/commonjs/utils/string.js +0 -60
- package/lib/commonjs/utils/string.js.map +0 -1
- package/lib/commonjs/utils/utils.js +0 -23
- package/lib/commonjs/utils/utils.js.map +0 -1
- package/lib/module/types/storage.js +0 -2
- package/lib/module/types/storage.js.map +0 -1
- package/lib/module/utils/storage.js +0 -30
- package/lib/module/utils/storage.js.map +0 -1
- package/lib/typescript/src/types/storage.d.ts +0 -16
- package/lib/typescript/src/types/storage.d.ts.map +0 -1
- package/lib/typescript/src/utils/storage.d.ts +0 -15
- package/lib/typescript/src/utils/storage.d.ts.map +0 -1
- package/src/types/storage.ts +0 -24
- package/src/utils/storage.ts +0 -45
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// RNPackUtilsAutolinking.mm
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import <NitroModules/HybridObjectRegistry.hpp>
|
|
10
|
+
#import "RNPackUtils-Swift-Cxx-Umbrella.hpp"
|
|
11
|
+
#import <type_traits>
|
|
12
|
+
|
|
13
|
+
#include "HybridRNPackUtilsSpecSwift.hpp"
|
|
14
|
+
|
|
15
|
+
@interface RNPackUtilsAutolinking : NSObject
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation RNPackUtilsAutolinking
|
|
19
|
+
|
|
20
|
+
+ (void) load {
|
|
21
|
+
using namespace margelo::nitro;
|
|
22
|
+
using namespace margelo::nitro::RNPackUtils;
|
|
23
|
+
|
|
24
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
+
"RNPackUtils",
|
|
26
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
+
std::shared_ptr<HybridRNPackUtilsSpec> hybridObject = RNPackUtils::RNPackUtilsAutolinking::createRNPackUtils();
|
|
28
|
+
return hybridObject;
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// RNPackUtilsAutolinking.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
public final class RNPackUtilsAutolinking {
|
|
9
|
+
public typealias bridge = margelo.nitro.RNPackUtils.bridge.swift
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of a Swift class that implements `HybridRNPackUtilsSpec`,
|
|
13
|
+
* and wraps it in a Swift class that can directly interop with C++ (`HybridRNPackUtilsSpec_cxx`)
|
|
14
|
+
*
|
|
15
|
+
* This is generated by Nitrogen and will initialize the class specified
|
|
16
|
+
* in the `"autolinking"` property of `nitro.json` (in this case, `RNPackUtils`).
|
|
17
|
+
*/
|
|
18
|
+
public static func createRNPackUtils() -> bridge.std__shared_ptr_HybridRNPackUtilsSpec_ {
|
|
19
|
+
let hybridObject = RNPackUtils()
|
|
20
|
+
return { () -> bridge.std__shared_ptr_HybridRNPackUtilsSpec_ in
|
|
21
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
22
|
+
return __cxxWrapped.getCxxPart()
|
|
23
|
+
}()
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridRNPackUtilsSpecSwift.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridRNPackUtilsSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::RNPackUtils {
|
|
11
|
+
} // namespace margelo::nitro::RNPackUtils
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridRNPackUtilsSpecSwift.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "HybridRNPackUtilsSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridRNPackUtilsSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace RNPackUtils { class HybridRNPackUtilsSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
#include "RNPackUtils-Swift-Cxx-Umbrella.hpp"
|
|
20
|
+
|
|
21
|
+
namespace margelo::nitro::RNPackUtils {
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The C++ part of HybridRNPackUtilsSpec_cxx.swift.
|
|
25
|
+
*
|
|
26
|
+
* HybridRNPackUtilsSpecSwift (C++) accesses HybridRNPackUtilsSpec_cxx (Swift), and might
|
|
27
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
28
|
+
*
|
|
29
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
30
|
+
* the future, HybridRNPackUtilsSpec_cxx can directly inherit from the C++ class HybridRNPackUtilsSpec
|
|
31
|
+
* to simplify the whole structure and memory management.
|
|
32
|
+
*/
|
|
33
|
+
class HybridRNPackUtilsSpecSwift: public virtual HybridRNPackUtilsSpec {
|
|
34
|
+
public:
|
|
35
|
+
// Constructor from a Swift instance
|
|
36
|
+
explicit HybridRNPackUtilsSpecSwift(const RNPackUtils::HybridRNPackUtilsSpec_cxx& swiftPart):
|
|
37
|
+
HybridObject(HybridRNPackUtilsSpec::TAG),
|
|
38
|
+
_swiftPart(swiftPart) { }
|
|
39
|
+
|
|
40
|
+
public:
|
|
41
|
+
// Get the Swift part
|
|
42
|
+
inline RNPackUtils::HybridRNPackUtilsSpec_cxx& getSwiftPart() noexcept {
|
|
43
|
+
return _swiftPart;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
48
|
+
return _swiftPart.getMemorySize();
|
|
49
|
+
}
|
|
50
|
+
void dispose() noexcept override {
|
|
51
|
+
_swiftPart.dispose();
|
|
52
|
+
}
|
|
53
|
+
std::string toString() override {
|
|
54
|
+
return _swiftPart.toString();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public:
|
|
58
|
+
// Properties
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
public:
|
|
62
|
+
// Methods
|
|
63
|
+
inline double multiply(double a, double b) override {
|
|
64
|
+
auto __result = _swiftPart.multiply(std::forward<decltype(a)>(a), std::forward<decltype(b)>(b));
|
|
65
|
+
if (__result.hasError()) [[unlikely]] {
|
|
66
|
+
std::rethrow_exception(__result.error());
|
|
67
|
+
}
|
|
68
|
+
auto __value = std::move(__result.value());
|
|
69
|
+
return __value;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private:
|
|
73
|
+
RNPackUtils::HybridRNPackUtilsSpec_cxx _swiftPart;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
} // namespace margelo::nitro::RNPackUtils
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridRNPackUtilsSpec.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/// See ``HybridRNPackUtilsSpec``
|
|
12
|
+
public protocol HybridRNPackUtilsSpec_protocol: HybridObject {
|
|
13
|
+
// Properties
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// Methods
|
|
17
|
+
func multiply(a: Double, b: Double) throws -> Double
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public extension HybridRNPackUtilsSpec_protocol {
|
|
21
|
+
/// Default implementation of ``HybridObject.toString``
|
|
22
|
+
func toString() -> String {
|
|
23
|
+
return "[HybridObject RNPackUtils]"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/// See ``HybridRNPackUtilsSpec``
|
|
28
|
+
open class HybridRNPackUtilsSpec_base {
|
|
29
|
+
private weak var cxxWrapper: HybridRNPackUtilsSpec_cxx? = nil
|
|
30
|
+
public init() { }
|
|
31
|
+
public func getCxxWrapper() -> HybridRNPackUtilsSpec_cxx {
|
|
32
|
+
#if DEBUG
|
|
33
|
+
guard self is HybridRNPackUtilsSpec else {
|
|
34
|
+
fatalError("`self` is not a `HybridRNPackUtilsSpec`! Did you accidentally inherit from `HybridRNPackUtilsSpec_base` instead of `HybridRNPackUtilsSpec`?")
|
|
35
|
+
}
|
|
36
|
+
#endif
|
|
37
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
38
|
+
return cxxWrapper
|
|
39
|
+
} else {
|
|
40
|
+
let cxxWrapper = HybridRNPackUtilsSpec_cxx(self as! HybridRNPackUtilsSpec)
|
|
41
|
+
self.cxxWrapper = cxxWrapper
|
|
42
|
+
return cxxWrapper
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A Swift base-protocol representing the RNPackUtils HybridObject.
|
|
49
|
+
* Implement this protocol to create Swift-based instances of RNPackUtils.
|
|
50
|
+
* ```swift
|
|
51
|
+
* class HybridRNPackUtils : HybridRNPackUtilsSpec {
|
|
52
|
+
* // ...
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
public typealias HybridRNPackUtilsSpec = HybridRNPackUtilsSpec_protocol & HybridRNPackUtilsSpec_base
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridRNPackUtilsSpec_cxx.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A class implementation that bridges HybridRNPackUtilsSpec over to C++.
|
|
13
|
+
* In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
|
|
14
|
+
*
|
|
15
|
+
* Also, some Swift types need to be bridged with special handling:
|
|
16
|
+
* - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
|
|
17
|
+
* - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
|
|
18
|
+
* - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
|
|
19
|
+
*/
|
|
20
|
+
open class HybridRNPackUtilsSpec_cxx {
|
|
21
|
+
/**
|
|
22
|
+
* The Swift <> C++ bridge's namespace (`margelo::nitro::RNPackUtils::bridge::swift`)
|
|
23
|
+
* from `RNPackUtils-Swift-Cxx-Bridge.hpp`.
|
|
24
|
+
* This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
|
|
25
|
+
*/
|
|
26
|
+
public typealias bridge = margelo.nitro.RNPackUtils.bridge.swift
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Holds an instance of the `HybridRNPackUtilsSpec` Swift protocol.
|
|
30
|
+
*/
|
|
31
|
+
private var __implementation: any HybridRNPackUtilsSpec
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Holds a weak pointer to the C++ class that wraps the Swift class.
|
|
35
|
+
*/
|
|
36
|
+
private var __cxxPart: bridge.std__weak_ptr_HybridRNPackUtilsSpec_
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Create a new `HybridRNPackUtilsSpec_cxx` that wraps the given `HybridRNPackUtilsSpec`.
|
|
40
|
+
* All properties and methods bridge to C++ types.
|
|
41
|
+
*/
|
|
42
|
+
public init(_ implementation: any HybridRNPackUtilsSpec) {
|
|
43
|
+
self.__implementation = implementation
|
|
44
|
+
self.__cxxPart = .init()
|
|
45
|
+
/* no base class */
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Get the actual `HybridRNPackUtilsSpec` instance this class wraps.
|
|
50
|
+
*/
|
|
51
|
+
@inline(__always)
|
|
52
|
+
public func getHybridRNPackUtilsSpec() -> any HybridRNPackUtilsSpec {
|
|
53
|
+
return __implementation
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
58
|
+
* This acquires one additional strong reference on the object!
|
|
59
|
+
*/
|
|
60
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
61
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Casts an unsafe pointer to a `HybridRNPackUtilsSpec_cxx`.
|
|
66
|
+
* The pointer has to be a retained opaque `Unmanaged<HybridRNPackUtilsSpec_cxx>`.
|
|
67
|
+
* This removes one strong reference from the object!
|
|
68
|
+
*/
|
|
69
|
+
public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridRNPackUtilsSpec_cxx {
|
|
70
|
+
return Unmanaged<HybridRNPackUtilsSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Gets (or creates) the C++ part of this Hybrid Object.
|
|
75
|
+
* The C++ part is a `std::shared_ptr<HybridRNPackUtilsSpec>`.
|
|
76
|
+
*/
|
|
77
|
+
public func getCxxPart() -> bridge.std__shared_ptr_HybridRNPackUtilsSpec_ {
|
|
78
|
+
let cachedCxxPart = self.__cxxPart.lock()
|
|
79
|
+
if Bool(fromCxx: cachedCxxPart) {
|
|
80
|
+
return cachedCxxPart
|
|
81
|
+
} else {
|
|
82
|
+
let newCxxPart = bridge.create_std__shared_ptr_HybridRNPackUtilsSpec_(self.toUnsafe())
|
|
83
|
+
__cxxPart = bridge.weakify_std__shared_ptr_HybridRNPackUtilsSpec_(newCxxPart)
|
|
84
|
+
return newCxxPart
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Get the memory size of the Swift class (plus size of any other allocations)
|
|
92
|
+
* so the JS VM can properly track it and garbage-collect the JS object if needed.
|
|
93
|
+
*/
|
|
94
|
+
@inline(__always)
|
|
95
|
+
public var memorySize: Int {
|
|
96
|
+
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Call dispose() on the Swift class.
|
|
101
|
+
* This _may_ be called manually from JS.
|
|
102
|
+
*/
|
|
103
|
+
@inline(__always)
|
|
104
|
+
public func dispose() {
|
|
105
|
+
self.__implementation.dispose()
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Call toString() on the Swift class.
|
|
110
|
+
*/
|
|
111
|
+
@inline(__always)
|
|
112
|
+
public func toString() -> String {
|
|
113
|
+
return self.__implementation.toString()
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Properties
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
// Methods
|
|
120
|
+
@inline(__always)
|
|
121
|
+
public final func multiply(a: Double, b: Double) -> bridge.Result_double_ {
|
|
122
|
+
do {
|
|
123
|
+
let __result = try self.__implementation.multiply(a: a, b: b)
|
|
124
|
+
let __resultCpp = __result
|
|
125
|
+
return bridge.create_Result_double_(__resultCpp)
|
|
126
|
+
} catch (let __error) {
|
|
127
|
+
let __exceptionPtr = __error.toCpp()
|
|
128
|
+
return bridge.create_Result_double_(__exceptionPtr)
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridRNPackUtilsSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridRNPackUtilsSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::RNPackUtils {
|
|
11
|
+
|
|
12
|
+
void HybridRNPackUtilsSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridMethod("multiply", &HybridRNPackUtilsSpec::multiply);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
} // namespace margelo::nitro::RNPackUtils
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridRNPackUtilsSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
namespace margelo::nitro::RNPackUtils {
|
|
21
|
+
|
|
22
|
+
using namespace margelo::nitro;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* An abstract base class for `RNPackUtils`
|
|
26
|
+
* Inherit this class to create instances of `HybridRNPackUtilsSpec` in C++.
|
|
27
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
28
|
+
* @example
|
|
29
|
+
* ```cpp
|
|
30
|
+
* class HybridRNPackUtils: public HybridRNPackUtilsSpec {
|
|
31
|
+
* public:
|
|
32
|
+
* HybridRNPackUtils(...): HybridObject(TAG) { ... }
|
|
33
|
+
* // ...
|
|
34
|
+
* };
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
class HybridRNPackUtilsSpec: public virtual HybridObject {
|
|
38
|
+
public:
|
|
39
|
+
// Constructor
|
|
40
|
+
explicit HybridRNPackUtilsSpec(): HybridObject(TAG) { }
|
|
41
|
+
|
|
42
|
+
// Destructor
|
|
43
|
+
~HybridRNPackUtilsSpec() override = default;
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
// Properties
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
// Methods
|
|
51
|
+
virtual double multiply(double a, double b) = 0;
|
|
52
|
+
|
|
53
|
+
protected:
|
|
54
|
+
// Hybrid Setup
|
|
55
|
+
void loadHybridMethods() override;
|
|
56
|
+
|
|
57
|
+
protected:
|
|
58
|
+
// Tag for logging
|
|
59
|
+
static constexpr auto TAG = "RNPackUtils";
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
} // namespace margelo::nitro::RNPackUtils
|
package/package.json
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rnpack/utils",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Basic utilities will be available and ready to use",
|
|
5
|
-
"
|
|
6
|
-
"main": "./lib/commonjs/index.js",
|
|
7
|
-
"module": "./lib/module/index.js",
|
|
5
|
+
"main": "./lib/module/index.js",
|
|
8
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
9
7
|
"exports": {
|
|
10
8
|
".": {
|
|
9
|
+
"source": "./src/index.tsx",
|
|
11
10
|
"types": "./lib/typescript/src/index.d.ts",
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
"default": "./lib/module/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
15
14
|
},
|
|
16
15
|
"files": [
|
|
17
16
|
"src",
|
|
@@ -19,7 +18,10 @@
|
|
|
19
18
|
"android",
|
|
20
19
|
"ios",
|
|
21
20
|
"cpp",
|
|
21
|
+
"nitrogen",
|
|
22
|
+
"nitro.json",
|
|
22
23
|
"*.podspec",
|
|
24
|
+
"react-native.config.js",
|
|
23
25
|
"!ios/build",
|
|
24
26
|
"!android/build",
|
|
25
27
|
"!android/gradle",
|
|
@@ -33,12 +35,13 @@
|
|
|
33
35
|
],
|
|
34
36
|
"scripts": {
|
|
35
37
|
"example": "yarn workspace @rnpack/utils-example",
|
|
36
|
-
"
|
|
37
|
-
"typecheck": "tsc --noEmit",
|
|
38
|
-
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
39
|
-
"clean": "del-cli lib",
|
|
38
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
40
39
|
"prepare": "bob build",
|
|
41
|
-
"
|
|
40
|
+
"nitrogen": "nitrogen",
|
|
41
|
+
"typecheck": "tsc",
|
|
42
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
43
|
+
"release": "release-it patch --only-version",
|
|
44
|
+
"test": "jest"
|
|
42
45
|
},
|
|
43
46
|
"keywords": [
|
|
44
47
|
"react-native",
|
|
@@ -49,49 +52,85 @@
|
|
|
49
52
|
"type": "git",
|
|
50
53
|
"url": "git+https://github.com/rnpack/utils.git"
|
|
51
54
|
},
|
|
52
|
-
"author": "Abiraman K <abiramancit@gmail.com> (https://github.
|
|
55
|
+
"author": "Abiraman K <abiramancit@gmail.com> (https://abiramank.github.io)",
|
|
53
56
|
"license": "MIT",
|
|
54
57
|
"bugs": {
|
|
55
58
|
"url": "https://github.com/rnpack/utils/issues"
|
|
56
59
|
},
|
|
57
60
|
"homepage": "https://github.com/rnpack/utils#readme",
|
|
58
61
|
"publishConfig": {
|
|
59
|
-
"registry": "https://registry.npmjs.org/"
|
|
60
|
-
"access": "public"
|
|
62
|
+
"registry": "https://registry.npmjs.org/"
|
|
61
63
|
},
|
|
62
64
|
"devDependencies": {
|
|
63
|
-
"@commitlint/config-conventional": "^
|
|
64
|
-
"@
|
|
65
|
-
"@
|
|
66
|
-
"@
|
|
67
|
-
"@
|
|
68
|
-
"@
|
|
69
|
-
"@
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
65
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
66
|
+
"@eslint/compat": "^1.3.2",
|
|
67
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
68
|
+
"@eslint/js": "^9.35.0",
|
|
69
|
+
"@react-native/babel-preset": "0.81.1",
|
|
70
|
+
"@react-native/eslint-config": "^0.81.1",
|
|
71
|
+
"@release-it/conventional-changelog": "^10.0.1",
|
|
72
|
+
"@types/jest": "^29.5.14",
|
|
73
|
+
"@types/react": "^19.1.0",
|
|
74
|
+
"buffer": "^6.0.3",
|
|
75
|
+
"commitlint": "^19.8.1",
|
|
76
|
+
"del-cli": "^6.0.0",
|
|
77
|
+
"eslint": "^9.35.0",
|
|
78
|
+
"eslint-config-prettier": "^10.1.8",
|
|
79
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
75
80
|
"jest": "^29.7.0",
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"react
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
"
|
|
81
|
+
"lefthook": "^2.0.3",
|
|
82
|
+
"nitrogen": "^0.31.10",
|
|
83
|
+
"prettier": "^2.8.8",
|
|
84
|
+
"react": "19.1.0",
|
|
85
|
+
"react-native": "0.81.1",
|
|
86
|
+
"react-native-builder-bob": "^0.40.16",
|
|
87
|
+
"react-native-nitro-modules": "^0.31.10",
|
|
88
|
+
"release-it": "^19.0.4",
|
|
89
|
+
"turbo": "^2.5.6",
|
|
90
|
+
"typescript": "^5.9.2"
|
|
85
91
|
},
|
|
86
92
|
"peerDependencies": {
|
|
87
|
-
"
|
|
93
|
+
"buffer": "*",
|
|
88
94
|
"react": "*",
|
|
89
|
-
"react-native": "*"
|
|
95
|
+
"react-native": "*",
|
|
96
|
+
"react-native-nitro-modules": "^0.31.10"
|
|
90
97
|
},
|
|
91
98
|
"workspaces": [
|
|
92
99
|
"example"
|
|
93
100
|
],
|
|
94
|
-
"packageManager": "yarn@
|
|
101
|
+
"packageManager": "yarn@4.11.0",
|
|
102
|
+
"react-native-builder-bob": {
|
|
103
|
+
"source": "src",
|
|
104
|
+
"output": "lib",
|
|
105
|
+
"targets": [
|
|
106
|
+
[
|
|
107
|
+
"custom",
|
|
108
|
+
{
|
|
109
|
+
"script": "nitrogen",
|
|
110
|
+
"clean": "nitrogen/"
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
[
|
|
114
|
+
"module",
|
|
115
|
+
{
|
|
116
|
+
"esm": true
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
[
|
|
120
|
+
"typescript",
|
|
121
|
+
{
|
|
122
|
+
"project": "tsconfig.build.json"
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
"prettier": {
|
|
128
|
+
"quoteProps": "consistent",
|
|
129
|
+
"singleQuote": true,
|
|
130
|
+
"tabWidth": 2,
|
|
131
|
+
"trailingComma": "es5",
|
|
132
|
+
"useTabs": false
|
|
133
|
+
},
|
|
95
134
|
"commitlint": {
|
|
96
135
|
"extends": [
|
|
97
136
|
"@commitlint/config-conventional"
|
|
@@ -110,67 +149,28 @@
|
|
|
110
149
|
},
|
|
111
150
|
"plugins": {
|
|
112
151
|
"@release-it/conventional-changelog": {
|
|
113
|
-
"preset":
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
"eslintConfig": {
|
|
118
|
-
"root": true,
|
|
119
|
-
"extends": [
|
|
120
|
-
"@react-native",
|
|
121
|
-
"prettier"
|
|
122
|
-
],
|
|
123
|
-
"rules": {
|
|
124
|
-
"react/react-in-jsx-scope": "off",
|
|
125
|
-
"prettier/prettier": [
|
|
126
|
-
"error",
|
|
127
|
-
{
|
|
128
|
-
"quoteProps": "consistent",
|
|
129
|
-
"singleQuote": true,
|
|
130
|
-
"tabWidth": 2,
|
|
131
|
-
"trailingComma": "es5",
|
|
132
|
-
"useTabs": false
|
|
152
|
+
"preset": {
|
|
153
|
+
"name": "angular"
|
|
133
154
|
}
|
|
134
|
-
|
|
155
|
+
}
|
|
135
156
|
}
|
|
136
157
|
},
|
|
137
|
-
"
|
|
138
|
-
"
|
|
139
|
-
"
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
"quoteProps": "consistent",
|
|
143
|
-
"singleQuote": true,
|
|
144
|
-
"tabWidth": 2,
|
|
145
|
-
"trailingComma": "es5",
|
|
146
|
-
"useTabs": false
|
|
147
|
-
},
|
|
148
|
-
"react-native-builder-bob": {
|
|
149
|
-
"source": "src",
|
|
150
|
-
"output": "lib",
|
|
151
|
-
"targets": [
|
|
152
|
-
[
|
|
153
|
-
"commonjs",
|
|
154
|
-
{
|
|
155
|
-
"esm": true
|
|
156
|
-
}
|
|
157
|
-
],
|
|
158
|
-
[
|
|
159
|
-
"module",
|
|
160
|
-
{
|
|
161
|
-
"esm": true
|
|
162
|
-
}
|
|
163
|
-
],
|
|
164
|
-
[
|
|
165
|
-
"typescript",
|
|
166
|
-
{
|
|
167
|
-
"project": "tsconfig.build.json"
|
|
168
|
-
}
|
|
169
|
-
]
|
|
158
|
+
"jest": {
|
|
159
|
+
"preset": "react-native",
|
|
160
|
+
"modulePathIgnorePatterns": [
|
|
161
|
+
"<rootDir>/example/node_modules",
|
|
162
|
+
"<rootDir>/lib/"
|
|
170
163
|
]
|
|
171
164
|
},
|
|
172
165
|
"create-react-native-library": {
|
|
173
|
-
"
|
|
174
|
-
"
|
|
166
|
+
"languages": "kotlin-swift",
|
|
167
|
+
"type": "nitro-module",
|
|
168
|
+
"tools": [
|
|
169
|
+
"eslint",
|
|
170
|
+
"lefthook",
|
|
171
|
+
"release-it",
|
|
172
|
+
"jest"
|
|
173
|
+
],
|
|
174
|
+
"version": "0.55.1"
|
|
175
175
|
}
|
|
176
176
|
}
|