@salve-software/mako-react-native 1.0.1
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 +21 -0
- package/NitroMako.podspec +31 -0
- package/README.md +90 -0
- package/android/CMakeLists.txt +32 -0
- package/android/build.gradle +148 -0
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +9 -0
- package/android/src/main/java/com/margelo/nitro/mako/HybridMako.kt +235 -0
- package/android/src/main/java/com/margelo/nitro/mako/MakoPackage.kt +18 -0
- package/android/src/main/java/com/margelo/nitro/mako/PerformanceMonitor.kt +260 -0
- package/ios/Bridge.h +8 -0
- package/ios/HybridMako.swift +245 -0
- package/ios/PerformanceMonitor.swift +223 -0
- package/lib/commonjs/index.js +17 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/library/client/constants.js +34 -0
- package/lib/commonjs/library/client/constants.js.map +1 -0
- package/lib/commonjs/library/client/index.js +28 -0
- package/lib/commonjs/library/client/index.js.map +1 -0
- package/lib/commonjs/library/client/mako-client.js +419 -0
- package/lib/commonjs/library/client/mako-client.js.map +1 -0
- package/lib/commonjs/library/component-handler/component-handler.js +158 -0
- package/lib/commonjs/library/component-handler/component-handler.js.map +1 -0
- package/lib/commonjs/library/component-handler/index.js +39 -0
- package/lib/commonjs/library/component-handler/index.js.map +1 -0
- package/lib/commonjs/library/component-handler/types.js +6 -0
- package/lib/commonjs/library/component-handler/types.js.map +1 -0
- package/lib/commonjs/library/component-handler/utils/index.js +26 -0
- package/lib/commonjs/library/component-handler/utils/index.js.map +1 -0
- package/lib/commonjs/library/device/device-handler.js +80 -0
- package/lib/commonjs/library/device/device-handler.js.map +1 -0
- package/lib/commonjs/library/device/index.js +9 -0
- package/lib/commonjs/library/device/index.js.map +1 -0
- package/lib/commonjs/library/device/types.js +2 -0
- package/lib/commonjs/library/device/types.js.map +1 -0
- package/lib/commonjs/library/device/utils/generate-uuid.js +14 -0
- package/lib/commonjs/library/device/utils/generate-uuid.js.map +1 -0
- package/lib/commonjs/library/index.js +156 -0
- package/lib/commonjs/library/index.js.map +1 -0
- package/lib/commonjs/library/interceptors/index.js +13 -0
- package/lib/commonjs/library/interceptors/index.js.map +1 -0
- package/lib/commonjs/library/interceptors/js-console.js +88 -0
- package/lib/commonjs/library/interceptors/js-console.js.map +1 -0
- package/lib/commonjs/library/interceptors/react-devtools.js +219 -0
- package/lib/commonjs/library/interceptors/react-devtools.js.map +1 -0
- package/lib/commonjs/library/interceptors/xhr.js +74 -0
- package/lib/commonjs/library/interceptors/xhr.js.map +1 -0
- package/lib/commonjs/library/network-handler/index.js +17 -0
- package/lib/commonjs/library/network-handler/index.js.map +1 -0
- package/lib/commonjs/library/network-handler/network-handler.js +103 -0
- package/lib/commonjs/library/network-handler/network-handler.js.map +1 -0
- package/lib/commonjs/library/network-handler/types.js +6 -0
- package/lib/commonjs/library/network-handler/types.js.map +1 -0
- package/lib/commonjs/library/network-handler/utils/generate-request-id.js +13 -0
- package/lib/commonjs/library/network-handler/utils/generate-request-id.js.map +1 -0
- package/lib/commonjs/library/network-handler/utils/index.js +41 -0
- package/lib/commonjs/library/network-handler/utils/index.js.map +1 -0
- package/lib/commonjs/library/network-handler/utils/parse-response-headers.js +26 -0
- package/lib/commonjs/library/network-handler/utils/parse-response-headers.js.map +1 -0
- package/lib/commonjs/library/network-handler/utils/read-blob-as-text.js +18 -0
- package/lib/commonjs/library/network-handler/utils/read-blob-as-text.js.map +1 -0
- package/lib/commonjs/library/network-handler/utils/response-to-string.js +35 -0
- package/lib/commonjs/library/network-handler/utils/response-to-string.js.map +1 -0
- package/lib/commonjs/library/network-handler/utils/should-ignore-url.js +13 -0
- package/lib/commonjs/library/network-handler/utils/should-ignore-url.js.map +1 -0
- package/lib/commonjs/library/performance-handler/index.js +13 -0
- package/lib/commonjs/library/performance-handler/index.js.map +1 -0
- package/lib/commonjs/library/performance-handler/performance-handler.js +94 -0
- package/lib/commonjs/library/performance-handler/performance-handler.js.map +1 -0
- package/lib/commonjs/library/performance-handler/types.js +6 -0
- package/lib/commonjs/library/performance-handler/types.js.map +1 -0
- package/lib/commonjs/library/project/index.js +15 -0
- package/lib/commonjs/library/project/index.js.map +1 -0
- package/lib/commonjs/library/project/project-handler.js +31 -0
- package/lib/commonjs/library/project/project-handler.js.map +1 -0
- package/lib/commonjs/library/types.js +2 -0
- package/lib/commonjs/library/types.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/specs/mako.nitro.js +6 -0
- package/lib/commonjs/specs/mako.nitro.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/library/client/constants.js +30 -0
- package/lib/module/library/client/constants.js.map +1 -0
- package/lib/module/library/client/index.js +6 -0
- package/lib/module/library/client/index.js.map +1 -0
- package/lib/module/library/client/mako-client.js +415 -0
- package/lib/module/library/client/mako-client.js.map +1 -0
- package/lib/module/library/component-handler/component-handler.js +153 -0
- package/lib/module/library/component-handler/component-handler.js.map +1 -0
- package/lib/module/library/component-handler/index.js +6 -0
- package/lib/module/library/component-handler/index.js.map +1 -0
- package/lib/module/library/component-handler/types.js +4 -0
- package/lib/module/library/component-handler/types.js.map +1 -0
- package/lib/module/library/component-handler/utils/index.js +21 -0
- package/lib/module/library/component-handler/utils/index.js.map +1 -0
- package/lib/module/library/device/device-handler.js +75 -0
- package/lib/module/library/device/device-handler.js.map +1 -0
- package/lib/module/library/device/index.js +5 -0
- package/lib/module/library/device/index.js.map +1 -0
- package/lib/module/library/device/types.js +2 -0
- package/lib/module/library/device/types.js.map +1 -0
- package/lib/module/library/device/utils/generate-uuid.js +10 -0
- package/lib/module/library/device/utils/generate-uuid.js.map +1 -0
- package/lib/module/library/index.js +155 -0
- package/lib/module/library/index.js.map +1 -0
- package/lib/module/library/interceptors/index.js +9 -0
- package/lib/module/library/interceptors/index.js.map +1 -0
- package/lib/module/library/interceptors/js-console.js +83 -0
- package/lib/module/library/interceptors/js-console.js.map +1 -0
- package/lib/module/library/interceptors/react-devtools.js +214 -0
- package/lib/module/library/interceptors/react-devtools.js.map +1 -0
- package/lib/module/library/interceptors/xhr.js +69 -0
- package/lib/module/library/interceptors/xhr.js.map +1 -0
- package/lib/module/library/network-handler/index.js +4 -0
- package/lib/module/library/network-handler/index.js.map +1 -0
- package/lib/module/library/network-handler/network-handler.js +98 -0
- package/lib/module/library/network-handler/network-handler.js.map +1 -0
- package/lib/module/library/network-handler/types.js +4 -0
- package/lib/module/library/network-handler/types.js.map +1 -0
- package/lib/module/library/network-handler/utils/generate-request-id.js +9 -0
- package/lib/module/library/network-handler/utils/generate-request-id.js.map +1 -0
- package/lib/module/library/network-handler/utils/index.js +8 -0
- package/lib/module/library/network-handler/utils/index.js.map +1 -0
- package/lib/module/library/network-handler/utils/parse-response-headers.js +22 -0
- package/lib/module/library/network-handler/utils/parse-response-headers.js.map +1 -0
- package/lib/module/library/network-handler/utils/read-blob-as-text.js +14 -0
- package/lib/module/library/network-handler/utils/read-blob-as-text.js.map +1 -0
- package/lib/module/library/network-handler/utils/response-to-string.js +31 -0
- package/lib/module/library/network-handler/utils/response-to-string.js.map +1 -0
- package/lib/module/library/network-handler/utils/should-ignore-url.js +9 -0
- package/lib/module/library/network-handler/utils/should-ignore-url.js.map +1 -0
- package/lib/module/library/performance-handler/index.js +4 -0
- package/lib/module/library/performance-handler/index.js.map +1 -0
- package/lib/module/library/performance-handler/performance-handler.js +89 -0
- package/lib/module/library/performance-handler/performance-handler.js.map +1 -0
- package/lib/module/library/performance-handler/types.js +4 -0
- package/lib/module/library/performance-handler/types.js.map +1 -0
- package/lib/module/library/project/index.js +6 -0
- package/lib/module/library/project/index.js.map +1 -0
- package/lib/module/library/project/project-handler.js +26 -0
- package/lib/module/library/project/project-handler.js.map +1 -0
- package/lib/module/library/types.js +2 -0
- package/lib/module/library/types.js.map +1 -0
- package/lib/module/specs/mako.nitro.js +4 -0
- package/lib/module/specs/mako.nitro.js.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/library/client/constants.d.ts +24 -0
- package/lib/typescript/src/library/client/constants.d.ts.map +1 -0
- package/lib/typescript/src/library/client/index.d.ts +4 -0
- package/lib/typescript/src/library/client/index.d.ts.map +1 -0
- package/lib/typescript/src/library/client/mako-client.d.ts +87 -0
- package/lib/typescript/src/library/client/mako-client.d.ts.map +1 -0
- package/lib/typescript/src/library/component-handler/component-handler.d.ts +21 -0
- package/lib/typescript/src/library/component-handler/component-handler.d.ts.map +1 -0
- package/lib/typescript/src/library/component-handler/index.d.ts +4 -0
- package/lib/typescript/src/library/component-handler/index.d.ts.map +1 -0
- package/lib/typescript/src/library/component-handler/types.d.ts +22 -0
- package/lib/typescript/src/library/component-handler/types.d.ts.map +1 -0
- package/lib/typescript/src/library/component-handler/utils/index.d.ts +13 -0
- package/lib/typescript/src/library/component-handler/utils/index.d.ts.map +1 -0
- package/lib/typescript/src/library/device/__tests__/device-handler.test.d.ts +2 -0
- package/lib/typescript/src/library/device/__tests__/device-handler.test.d.ts.map +1 -0
- package/lib/typescript/src/library/device/device-handler.d.ts +11 -0
- package/lib/typescript/src/library/device/device-handler.d.ts.map +1 -0
- package/lib/typescript/src/library/device/index.d.ts +3 -0
- package/lib/typescript/src/library/device/index.d.ts.map +1 -0
- package/lib/typescript/src/library/device/types.d.ts +8 -0
- package/lib/typescript/src/library/device/types.d.ts.map +1 -0
- package/lib/typescript/src/library/device/utils/generate-uuid.d.ts +2 -0
- package/lib/typescript/src/library/device/utils/generate-uuid.d.ts.map +1 -0
- package/lib/typescript/src/library/index.d.ts +120 -0
- package/lib/typescript/src/library/index.d.ts.map +1 -0
- package/lib/typescript/src/library/interceptors/__tests__/js-console.test.d.ts +2 -0
- package/lib/typescript/src/library/interceptors/__tests__/js-console.test.d.ts.map +1 -0
- package/lib/typescript/src/library/interceptors/__tests__/react-devtools.test.d.ts +2 -0
- package/lib/typescript/src/library/interceptors/__tests__/react-devtools.test.d.ts.map +1 -0
- package/lib/typescript/src/library/interceptors/__tests__/xhr.test.d.ts +2 -0
- package/lib/typescript/src/library/interceptors/__tests__/xhr.test.d.ts.map +1 -0
- package/lib/typescript/src/library/interceptors/index.d.ts +7 -0
- package/lib/typescript/src/library/interceptors/index.d.ts.map +1 -0
- package/lib/typescript/src/library/interceptors/js-console.d.ts +17 -0
- package/lib/typescript/src/library/interceptors/js-console.d.ts.map +1 -0
- package/lib/typescript/src/library/interceptors/react-devtools.d.ts +54 -0
- package/lib/typescript/src/library/interceptors/react-devtools.d.ts.map +1 -0
- package/lib/typescript/src/library/interceptors/xhr.d.ts +14 -0
- package/lib/typescript/src/library/interceptors/xhr.d.ts.map +1 -0
- package/lib/typescript/src/library/network-handler/__tests__/network-handler.test.d.ts +2 -0
- package/lib/typescript/src/library/network-handler/__tests__/network-handler.test.d.ts.map +1 -0
- package/lib/typescript/src/library/network-handler/index.d.ts +2 -0
- package/lib/typescript/src/library/network-handler/index.d.ts.map +1 -0
- package/lib/typescript/src/library/network-handler/network-handler.d.ts +19 -0
- package/lib/typescript/src/library/network-handler/network-handler.d.ts.map +1 -0
- package/lib/typescript/src/library/network-handler/types.d.ts +6 -0
- package/lib/typescript/src/library/network-handler/types.d.ts.map +1 -0
- package/lib/typescript/src/library/network-handler/utils/__tests__/generate-request-id.test.d.ts +2 -0
- package/lib/typescript/src/library/network-handler/utils/__tests__/generate-request-id.test.d.ts.map +1 -0
- package/lib/typescript/src/library/network-handler/utils/__tests__/parse-response-headers.test.d.ts +2 -0
- package/lib/typescript/src/library/network-handler/utils/__tests__/parse-response-headers.test.d.ts.map +1 -0
- package/lib/typescript/src/library/network-handler/utils/__tests__/read-blob-as-text.test.d.ts +2 -0
- package/lib/typescript/src/library/network-handler/utils/__tests__/read-blob-as-text.test.d.ts.map +1 -0
- package/lib/typescript/src/library/network-handler/utils/__tests__/response-to-string.test.d.ts +2 -0
- package/lib/typescript/src/library/network-handler/utils/__tests__/response-to-string.test.d.ts.map +1 -0
- package/lib/typescript/src/library/network-handler/utils/__tests__/should-ignore-url.test.d.ts +2 -0
- package/lib/typescript/src/library/network-handler/utils/__tests__/should-ignore-url.test.d.ts.map +1 -0
- package/lib/typescript/src/library/network-handler/utils/generate-request-id.d.ts +5 -0
- package/lib/typescript/src/library/network-handler/utils/generate-request-id.d.ts.map +1 -0
- package/lib/typescript/src/library/network-handler/utils/index.d.ts +6 -0
- package/lib/typescript/src/library/network-handler/utils/index.d.ts.map +1 -0
- package/lib/typescript/src/library/network-handler/utils/parse-response-headers.d.ts +5 -0
- package/lib/typescript/src/library/network-handler/utils/parse-response-headers.d.ts.map +1 -0
- package/lib/typescript/src/library/network-handler/utils/read-blob-as-text.d.ts +5 -0
- package/lib/typescript/src/library/network-handler/utils/read-blob-as-text.d.ts.map +1 -0
- package/lib/typescript/src/library/network-handler/utils/response-to-string.d.ts +5 -0
- package/lib/typescript/src/library/network-handler/utils/response-to-string.d.ts.map +1 -0
- package/lib/typescript/src/library/network-handler/utils/should-ignore-url.d.ts +5 -0
- package/lib/typescript/src/library/network-handler/utils/should-ignore-url.d.ts.map +1 -0
- package/lib/typescript/src/library/performance-handler/index.d.ts +3 -0
- package/lib/typescript/src/library/performance-handler/index.d.ts.map +1 -0
- package/lib/typescript/src/library/performance-handler/performance-handler.d.ts +27 -0
- package/lib/typescript/src/library/performance-handler/performance-handler.d.ts.map +1 -0
- package/lib/typescript/src/library/performance-handler/types.d.ts +20 -0
- package/lib/typescript/src/library/performance-handler/types.d.ts.map +1 -0
- package/lib/typescript/src/library/project/index.d.ts +4 -0
- package/lib/typescript/src/library/project/index.d.ts.map +1 -0
- package/lib/typescript/src/library/project/project-handler.d.ts +7 -0
- package/lib/typescript/src/library/project/project-handler.d.ts.map +1 -0
- package/lib/typescript/src/library/types.d.ts +41 -0
- package/lib/typescript/src/library/types.d.ts.map +1 -0
- package/lib/typescript/src/specs/mako.nitro.d.ts +100 -0
- package/lib/typescript/src/specs/mako.nitro.d.ts.map +1 -0
- package/nitro.json +24 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/NitroMako+autolinking.cmake +81 -0
- package/nitrogen/generated/android/NitroMako+autolinking.gradle +27 -0
- package/nitrogen/generated/android/NitroMakoOnLoad.cpp +58 -0
- package/nitrogen/generated/android/NitroMakoOnLoad.hpp +34 -0
- package/nitrogen/generated/android/c++/JDeviceInfoResult.hpp +69 -0
- package/nitrogen/generated/android/c++/JFunc_void_NativeLogEntry.hpp +80 -0
- package/nitrogen/generated/android/c++/JFunc_void_PerformanceMetrics.hpp +77 -0
- package/nitrogen/generated/android/c++/JHybridNitroMakoSpec.cpp +124 -0
- package/nitrogen/generated/android/c++/JHybridNitroMakoSpec.hpp +74 -0
- package/nitrogen/generated/android/c++/JNativeLogEntry.hpp +71 -0
- package/nitrogen/generated/android/c++/JNativeLogLevel.hpp +64 -0
- package/nitrogen/generated/android/c++/JPerformanceMetrics.hpp +69 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/mako/DeviceInfoResult.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/mako/Func_void_NativeLogEntry.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/mako/Func_void_PerformanceMetrics.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/mako/HybridNitroMakoSpec.kt +108 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/mako/NativeLogEntry.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/mako/NativeLogLevel.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/mako/NitroMakoOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/mako/PerformanceMetrics.kt +47 -0
- package/nitrogen/generated/ios/NitroMako+autolinking.rb +62 -0
- package/nitrogen/generated/ios/NitroMako-Swift-Cxx-Bridge.cpp +49 -0
- package/nitrogen/generated/ios/NitroMako-Swift-Cxx-Bridge.hpp +185 -0
- package/nitrogen/generated/ios/NitroMako-Swift-Cxx-Umbrella.hpp +58 -0
- package/nitrogen/generated/ios/NitroMakoAutolinking.mm +33 -0
- package/nitrogen/generated/ios/NitroMakoAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridNitroMakoSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroMakoSpecSwift.hpp +175 -0
- package/nitrogen/generated/ios/swift/DeviceInfoResult.swift +44 -0
- package/nitrogen/generated/ios/swift/Func_void_NativeLogEntry.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_PerformanceMetrics.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridNitroMakoSpec.swift +66 -0
- package/nitrogen/generated/ios/swift/HybridNitroMakoSpec_cxx.swift +289 -0
- package/nitrogen/generated/ios/swift/NativeLogEntry.swift +44 -0
- package/nitrogen/generated/ios/swift/NativeLogLevel.swift +48 -0
- package/nitrogen/generated/ios/swift/PerformanceMetrics.swift +44 -0
- package/nitrogen/generated/shared/c++/DeviceInfoResult.hpp +95 -0
- package/nitrogen/generated/shared/c++/HybridNitroMakoSpec.cpp +32 -0
- package/nitrogen/generated/shared/c++/HybridNitroMakoSpec.hpp +83 -0
- package/nitrogen/generated/shared/c++/NativeLogEntry.hpp +97 -0
- package/nitrogen/generated/shared/c++/NativeLogLevel.hpp +84 -0
- package/nitrogen/generated/shared/c++/PerformanceMetrics.hpp +95 -0
- package/package.json +128 -0
- package/react-native.config.js +16 -0
- package/src/index.ts +7 -0
- package/src/library/client/constants.ts +36 -0
- package/src/library/client/index.ts +9 -0
- package/src/library/client/mako-client.ts +494 -0
- package/src/library/component-handler/component-handler.ts +162 -0
- package/src/library/component-handler/index.ts +3 -0
- package/src/library/component-handler/types.ts +24 -0
- package/src/library/component-handler/utils/index.ts +23 -0
- package/src/library/device/__tests__/device-handler.test.ts +86 -0
- package/src/library/device/device-handler.ts +85 -0
- package/src/library/device/index.ts +3 -0
- package/src/library/device/types.ts +7 -0
- package/src/library/device/utils/generate-uuid.ts +7 -0
- package/src/library/index.ts +183 -0
- package/src/library/interceptors/__tests__/js-console.test.ts +186 -0
- package/src/library/interceptors/__tests__/react-devtools.test.ts +848 -0
- package/src/library/interceptors/__tests__/xhr.test.ts +313 -0
- package/src/library/interceptors/index.ts +7 -0
- package/src/library/interceptors/js-console.ts +93 -0
- package/src/library/interceptors/react-devtools.ts +268 -0
- package/src/library/interceptors/xhr.ts +123 -0
- package/src/library/network-handler/__tests__/network-handler.test.ts +265 -0
- package/src/library/network-handler/index.ts +1 -0
- package/src/library/network-handler/network-handler.ts +141 -0
- package/src/library/network-handler/types.ts +6 -0
- package/src/library/network-handler/utils/__tests__/generate-request-id.test.ts +22 -0
- package/src/library/network-handler/utils/__tests__/parse-response-headers.test.ts +71 -0
- package/src/library/network-handler/utils/__tests__/read-blob-as-text.test.ts +79 -0
- package/src/library/network-handler/utils/__tests__/response-to-string.test.ts +85 -0
- package/src/library/network-handler/utils/__tests__/should-ignore-url.test.ts +45 -0
- package/src/library/network-handler/utils/generate-request-id.ts +6 -0
- package/src/library/network-handler/utils/index.ts +5 -0
- package/src/library/network-handler/utils/parse-response-headers.ts +20 -0
- package/src/library/network-handler/utils/read-blob-as-text.ts +11 -0
- package/src/library/network-handler/utils/response-to-string.ts +32 -0
- package/src/library/network-handler/utils/should-ignore-url.ts +6 -0
- package/src/library/performance-handler/index.ts +2 -0
- package/src/library/performance-handler/performance-handler.ts +104 -0
- package/src/library/performance-handler/types.ts +22 -0
- package/src/library/project/index.ts +4 -0
- package/src/library/project/project-handler.ts +28 -0
- package/src/library/types.ts +82 -0
- package/src/specs/mako.nitro.ts +114 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroMakoSpec.kt
|
|
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
|
+
package com.margelo.nitro.mako
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import com.margelo.nitro.core.HybridObject
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A Kotlin class representing the NitroMako HybridObject.
|
|
17
|
+
* Implement this abstract class to create Kotlin-based instances of NitroMako.
|
|
18
|
+
*/
|
|
19
|
+
@DoNotStrip
|
|
20
|
+
@Keep
|
|
21
|
+
@Suppress(
|
|
22
|
+
"KotlinJniMissingFunction", "unused",
|
|
23
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
24
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
25
|
+
)
|
|
26
|
+
abstract class HybridNitroMakoSpec: HybridObject() {
|
|
27
|
+
// Properties
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
// Methods
|
|
31
|
+
@DoNotStrip
|
|
32
|
+
@Keep
|
|
33
|
+
abstract fun sum(num1: Double, num2: Double): Double
|
|
34
|
+
|
|
35
|
+
abstract fun startLogCapture(onLog: (log: NativeLogEntry) -> Unit): Boolean
|
|
36
|
+
|
|
37
|
+
@DoNotStrip
|
|
38
|
+
@Keep
|
|
39
|
+
private fun startLogCapture_cxx(onLog: Func_void_NativeLogEntry): Boolean {
|
|
40
|
+
val __result = startLogCapture(onLog)
|
|
41
|
+
return __result
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@DoNotStrip
|
|
45
|
+
@Keep
|
|
46
|
+
abstract fun stopLogCapture(): Unit
|
|
47
|
+
|
|
48
|
+
@DoNotStrip
|
|
49
|
+
@Keep
|
|
50
|
+
abstract fun isCapturing(): Boolean
|
|
51
|
+
|
|
52
|
+
@DoNotStrip
|
|
53
|
+
@Keep
|
|
54
|
+
abstract fun getDeviceInfo(): DeviceInfoResult
|
|
55
|
+
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
@Keep
|
|
58
|
+
abstract fun getStoredDeviceId(): String?
|
|
59
|
+
|
|
60
|
+
@DoNotStrip
|
|
61
|
+
@Keep
|
|
62
|
+
abstract fun storeDeviceId(deviceId: String): Unit
|
|
63
|
+
|
|
64
|
+
abstract fun startPerformanceMonitoring(onMetrics: (metrics: PerformanceMetrics) -> Unit, intervalMs: Double?): Boolean
|
|
65
|
+
|
|
66
|
+
@DoNotStrip
|
|
67
|
+
@Keep
|
|
68
|
+
private fun startPerformanceMonitoring_cxx(onMetrics: Func_void_PerformanceMetrics, intervalMs: Double?): Boolean {
|
|
69
|
+
val __result = startPerformanceMonitoring(onMetrics, intervalMs)
|
|
70
|
+
return __result
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
abstract fun stopPerformanceMonitoring(): Unit
|
|
76
|
+
|
|
77
|
+
@DoNotStrip
|
|
78
|
+
@Keep
|
|
79
|
+
abstract fun isPerformanceMonitoring(): Boolean
|
|
80
|
+
|
|
81
|
+
@DoNotStrip
|
|
82
|
+
@Keep
|
|
83
|
+
abstract fun getPerformanceSnapshot(): PerformanceMetrics
|
|
84
|
+
|
|
85
|
+
@DoNotStrip
|
|
86
|
+
@Keep
|
|
87
|
+
abstract fun recordJsFrame(): Unit
|
|
88
|
+
|
|
89
|
+
// Default implementation of `HybridObject.toString()`
|
|
90
|
+
override fun toString(): String {
|
|
91
|
+
return "[HybridObject NitroMako]"
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// C++ backing class
|
|
95
|
+
@DoNotStrip
|
|
96
|
+
@Keep
|
|
97
|
+
protected open class CxxPart(javaPart: HybridNitroMakoSpec): HybridObject.CxxPart(javaPart) {
|
|
98
|
+
// C++ JHybridNitroMakoSpec::CxxPart::initHybrid(...)
|
|
99
|
+
external override fun initHybrid(): HybridData
|
|
100
|
+
}
|
|
101
|
+
override fun createCxxPart(): CxxPart {
|
|
102
|
+
return CxxPart(this)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
companion object {
|
|
106
|
+
protected const val TAG = "HybridNitroMakoSpec"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NativeLogEntry.kt
|
|
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
|
+
package com.margelo.nitro.mako
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents the JavaScript object/struct "NativeLogEntry".
|
|
16
|
+
*/
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
@Keep
|
|
19
|
+
data class NativeLogEntry(
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
val level: NativeLogLevel,
|
|
23
|
+
@DoNotStrip
|
|
24
|
+
@Keep
|
|
25
|
+
val message: String,
|
|
26
|
+
@DoNotStrip
|
|
27
|
+
@Keep
|
|
28
|
+
val tag: String,
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
31
|
+
val timestamp: Double
|
|
32
|
+
) {
|
|
33
|
+
/* primary constructor */
|
|
34
|
+
|
|
35
|
+
companion object {
|
|
36
|
+
/**
|
|
37
|
+
* Constructor called from C++
|
|
38
|
+
*/
|
|
39
|
+
@DoNotStrip
|
|
40
|
+
@Keep
|
|
41
|
+
@Suppress("unused")
|
|
42
|
+
@JvmStatic
|
|
43
|
+
private fun fromCpp(level: NativeLogLevel, message: String, tag: String, timestamp: Double): NativeLogEntry {
|
|
44
|
+
return NativeLogEntry(level, message, tag, timestamp)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NativeLogLevel.kt
|
|
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
|
+
package com.margelo.nitro.mako
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "NativeLogLevel".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class NativeLogLevel(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
VERBOSE(0),
|
|
20
|
+
INFO(1),
|
|
21
|
+
WARN(2),
|
|
22
|
+
ERROR(3);
|
|
23
|
+
|
|
24
|
+
companion object
|
|
25
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroMakoOnLoad.kt
|
|
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
|
+
package com.margelo.nitro.mako
|
|
9
|
+
|
|
10
|
+
import android.util.Log
|
|
11
|
+
|
|
12
|
+
internal class NitroMakoOnLoad {
|
|
13
|
+
companion object {
|
|
14
|
+
private const val TAG = "NitroMakoOnLoad"
|
|
15
|
+
private var didLoad = false
|
|
16
|
+
/**
|
|
17
|
+
* Initializes the native part of "NitroMako".
|
|
18
|
+
* This method is idempotent and can be called more than once.
|
|
19
|
+
*/
|
|
20
|
+
@JvmStatic
|
|
21
|
+
fun initializeNative() {
|
|
22
|
+
if (didLoad) return
|
|
23
|
+
try {
|
|
24
|
+
Log.i(TAG, "Loading NitroMako C++ library...")
|
|
25
|
+
System.loadLibrary("NitroMako")
|
|
26
|
+
Log.i(TAG, "Successfully loaded NitroMako C++ library!")
|
|
27
|
+
didLoad = true
|
|
28
|
+
} catch (e: Error) {
|
|
29
|
+
Log.e(TAG, "Failed to load NitroMako C++ library! Is it properly installed and linked? " +
|
|
30
|
+
"Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
|
|
31
|
+
throw e
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// PerformanceMetrics.kt
|
|
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
|
+
package com.margelo.nitro.mako
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents the JavaScript object/struct "PerformanceMetrics".
|
|
16
|
+
*/
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
@Keep
|
|
19
|
+
data class PerformanceMetrics(
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
val uiFps: Double,
|
|
23
|
+
@DoNotStrip
|
|
24
|
+
@Keep
|
|
25
|
+
val jsFps: Double,
|
|
26
|
+
@DoNotStrip
|
|
27
|
+
@Keep
|
|
28
|
+
val memoryUsageMB: Double,
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
31
|
+
val cpuUsagePercent: Double
|
|
32
|
+
) {
|
|
33
|
+
/* primary constructor */
|
|
34
|
+
|
|
35
|
+
companion object {
|
|
36
|
+
/**
|
|
37
|
+
* Constructor called from C++
|
|
38
|
+
*/
|
|
39
|
+
@DoNotStrip
|
|
40
|
+
@Keep
|
|
41
|
+
@Suppress("unused")
|
|
42
|
+
@JvmStatic
|
|
43
|
+
private fun fromCpp(uiFps: Double, jsFps: Double, memoryUsageMB: Double, cpuUsagePercent: Double): PerformanceMetrics {
|
|
44
|
+
return PerformanceMetrics(uiFps, jsFps, memoryUsageMB, cpuUsagePercent)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#
|
|
2
|
+
# NitroMako+autolinking.rb
|
|
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
|
+
# This is a Ruby script that adds all files generated by Nitrogen
|
|
9
|
+
# to the given podspec.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your .podspec:
|
|
12
|
+
# ```ruby
|
|
13
|
+
# Pod::Spec.new do |spec|
|
|
14
|
+
# # ...
|
|
15
|
+
#
|
|
16
|
+
# # Add all files generated by Nitrogen
|
|
17
|
+
# load 'nitrogen/generated/ios/NitroMako+autolinking.rb'
|
|
18
|
+
# add_nitrogen_files(spec)
|
|
19
|
+
# end
|
|
20
|
+
# ```
|
|
21
|
+
|
|
22
|
+
def add_nitrogen_files(spec)
|
|
23
|
+
Pod::UI.puts "[NitroModules] 🔥 NitroMako is boosted by nitro!"
|
|
24
|
+
|
|
25
|
+
spec.dependency "NitroModules"
|
|
26
|
+
|
|
27
|
+
current_source_files = Array(spec.attributes_hash['source_files'])
|
|
28
|
+
spec.source_files = current_source_files + [
|
|
29
|
+
# Generated cross-platform specs
|
|
30
|
+
"nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}",
|
|
31
|
+
# Generated bridges for the cross-platform specs
|
|
32
|
+
"nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
current_public_header_files = Array(spec.attributes_hash['public_header_files'])
|
|
36
|
+
spec.public_header_files = current_public_header_files + [
|
|
37
|
+
# Generated specs
|
|
38
|
+
"nitrogen/generated/shared/**/*.{h,hpp}",
|
|
39
|
+
# Swift to C++ bridging helpers
|
|
40
|
+
"nitrogen/generated/ios/NitroMako-Swift-Cxx-Bridge.hpp"
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
current_private_header_files = Array(spec.attributes_hash['private_header_files'])
|
|
44
|
+
spec.private_header_files = current_private_header_files + [
|
|
45
|
+
# iOS specific specs
|
|
46
|
+
"nitrogen/generated/ios/c++/**/*.{h,hpp}",
|
|
47
|
+
# Views are framework-specific and should be private
|
|
48
|
+
"nitrogen/generated/shared/**/views/**/*"
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
|
|
52
|
+
spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
|
|
53
|
+
# Use C++ 20
|
|
54
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
|
55
|
+
# Enables C++ <-> Swift interop (by default it's only ObjC)
|
|
56
|
+
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
|
+
# Enables stricter modular headers
|
|
58
|
+
"DEFINES_MODULE" => "YES",
|
|
59
|
+
# Disable auto-generated ObjC header for Swift (Static linkage on Xcode 26.4 breaks here)
|
|
60
|
+
"SWIFT_INSTALL_OBJC_HEADER" => "NO",
|
|
61
|
+
})
|
|
62
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroMako-Swift-Cxx-Bridge.cpp
|
|
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
|
+
#include "NitroMako-Swift-Cxx-Bridge.hpp"
|
|
9
|
+
|
|
10
|
+
// Include C++ implementation defined types
|
|
11
|
+
#include "HybridNitroMakoSpecSwift.hpp"
|
|
12
|
+
#include "NitroMako-Swift-Cxx-Umbrella.hpp"
|
|
13
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::mako::bridge::swift {
|
|
16
|
+
|
|
17
|
+
// pragma MARK: std::function<void(const NativeLogEntry& /* log */)>
|
|
18
|
+
Func_void_NativeLogEntry create_Func_void_NativeLogEntry(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
19
|
+
auto swiftClosure = NitroMako::Func_void_NativeLogEntry::fromUnsafe(swiftClosureWrapper);
|
|
20
|
+
return [swiftClosure = std::move(swiftClosure)](const NativeLogEntry& log) mutable -> void {
|
|
21
|
+
swiftClosure.call(log);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// pragma MARK: std::function<void(const PerformanceMetrics& /* metrics */)>
|
|
26
|
+
Func_void_PerformanceMetrics create_Func_void_PerformanceMetrics(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
27
|
+
auto swiftClosure = NitroMako::Func_void_PerformanceMetrics::fromUnsafe(swiftClosureWrapper);
|
|
28
|
+
return [swiftClosure = std::move(swiftClosure)](const PerformanceMetrics& metrics) mutable -> void {
|
|
29
|
+
swiftClosure.call(metrics);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// pragma MARK: std::shared_ptr<HybridNitroMakoSpec>
|
|
34
|
+
std::shared_ptr<HybridNitroMakoSpec> create_std__shared_ptr_HybridNitroMakoSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
35
|
+
NitroMako::HybridNitroMakoSpec_cxx swiftPart = NitroMako::HybridNitroMakoSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
36
|
+
return std::make_shared<margelo::nitro::mako::HybridNitroMakoSpecSwift>(swiftPart);
|
|
37
|
+
}
|
|
38
|
+
void* NON_NULL get_std__shared_ptr_HybridNitroMakoSpec_(std__shared_ptr_HybridNitroMakoSpec_ cppType) {
|
|
39
|
+
std::shared_ptr<margelo::nitro::mako::HybridNitroMakoSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::mako::HybridNitroMakoSpecSwift>(cppType);
|
|
40
|
+
#ifdef NITRO_DEBUG
|
|
41
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
42
|
+
throw std::runtime_error("Class \"HybridNitroMakoSpec\" is not implemented in Swift!");
|
|
43
|
+
}
|
|
44
|
+
#endif
|
|
45
|
+
NitroMako::HybridNitroMakoSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
46
|
+
return swiftPart.toUnsafe();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
} // namespace margelo::nitro::mako::bridge::swift
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroMako-Swift-Cxx-Bridge.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
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `DeviceInfoResult` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::mako { struct DeviceInfoResult; }
|
|
13
|
+
// Forward declaration of `HybridNitroMakoSpec` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::mako { class HybridNitroMakoSpec; }
|
|
15
|
+
// Forward declaration of `NativeLogEntry` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::mako { struct NativeLogEntry; }
|
|
17
|
+
// Forward declaration of `NativeLogLevel` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::mako { enum class NativeLogLevel; }
|
|
19
|
+
// Forward declaration of `PerformanceMetrics` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::mako { struct PerformanceMetrics; }
|
|
21
|
+
|
|
22
|
+
// Forward declarations of Swift defined types
|
|
23
|
+
// Forward declaration of `HybridNitroMakoSpec_cxx` to properly resolve imports.
|
|
24
|
+
namespace NitroMako { class HybridNitroMakoSpec_cxx; }
|
|
25
|
+
|
|
26
|
+
// Include C++ defined types
|
|
27
|
+
#include "DeviceInfoResult.hpp"
|
|
28
|
+
#include "HybridNitroMakoSpec.hpp"
|
|
29
|
+
#include "NativeLogEntry.hpp"
|
|
30
|
+
#include "NativeLogLevel.hpp"
|
|
31
|
+
#include "PerformanceMetrics.hpp"
|
|
32
|
+
#include <NitroModules/Result.hpp>
|
|
33
|
+
#include <exception>
|
|
34
|
+
#include <functional>
|
|
35
|
+
#include <memory>
|
|
36
|
+
#include <optional>
|
|
37
|
+
#include <string>
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
41
|
+
* as well as helper functions to interact with those C++ types from Swift.
|
|
42
|
+
*/
|
|
43
|
+
namespace margelo::nitro::mako::bridge::swift {
|
|
44
|
+
|
|
45
|
+
// pragma MARK: std::function<void(const NativeLogEntry& /* log */)>
|
|
46
|
+
/**
|
|
47
|
+
* Specialized version of `std::function<void(const NativeLogEntry&)>`.
|
|
48
|
+
*/
|
|
49
|
+
using Func_void_NativeLogEntry = std::function<void(const NativeLogEntry& /* log */)>;
|
|
50
|
+
/**
|
|
51
|
+
* Wrapper class for a `std::function<void(const NativeLogEntry& / * log * /)>`, this can be used from Swift.
|
|
52
|
+
*/
|
|
53
|
+
class Func_void_NativeLogEntry_Wrapper final {
|
|
54
|
+
public:
|
|
55
|
+
explicit Func_void_NativeLogEntry_Wrapper(std::function<void(const NativeLogEntry& /* log */)>&& func): _function(std::make_unique<std::function<void(const NativeLogEntry& /* log */)>>(std::move(func))) {}
|
|
56
|
+
inline void call(NativeLogEntry log) const noexcept {
|
|
57
|
+
_function->operator()(log);
|
|
58
|
+
}
|
|
59
|
+
private:
|
|
60
|
+
std::unique_ptr<std::function<void(const NativeLogEntry& /* log */)>> _function;
|
|
61
|
+
} SWIFT_NONCOPYABLE;
|
|
62
|
+
Func_void_NativeLogEntry create_Func_void_NativeLogEntry(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
63
|
+
inline Func_void_NativeLogEntry_Wrapper wrap_Func_void_NativeLogEntry(Func_void_NativeLogEntry value) noexcept {
|
|
64
|
+
return Func_void_NativeLogEntry_Wrapper(std::move(value));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// pragma MARK: std::optional<std::string>
|
|
68
|
+
/**
|
|
69
|
+
* Specialized version of `std::optional<std::string>`.
|
|
70
|
+
*/
|
|
71
|
+
using std__optional_std__string_ = std::optional<std::string>;
|
|
72
|
+
inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {
|
|
73
|
+
return std::optional<std::string>(value);
|
|
74
|
+
}
|
|
75
|
+
inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
76
|
+
return optional.has_value();
|
|
77
|
+
}
|
|
78
|
+
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
79
|
+
return optional.value();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// pragma MARK: std::function<void(const PerformanceMetrics& /* metrics */)>
|
|
83
|
+
/**
|
|
84
|
+
* Specialized version of `std::function<void(const PerformanceMetrics&)>`.
|
|
85
|
+
*/
|
|
86
|
+
using Func_void_PerformanceMetrics = std::function<void(const PerformanceMetrics& /* metrics */)>;
|
|
87
|
+
/**
|
|
88
|
+
* Wrapper class for a `std::function<void(const PerformanceMetrics& / * metrics * /)>`, this can be used from Swift.
|
|
89
|
+
*/
|
|
90
|
+
class Func_void_PerformanceMetrics_Wrapper final {
|
|
91
|
+
public:
|
|
92
|
+
explicit Func_void_PerformanceMetrics_Wrapper(std::function<void(const PerformanceMetrics& /* metrics */)>&& func): _function(std::make_unique<std::function<void(const PerformanceMetrics& /* metrics */)>>(std::move(func))) {}
|
|
93
|
+
inline void call(PerformanceMetrics metrics) const noexcept {
|
|
94
|
+
_function->operator()(metrics);
|
|
95
|
+
}
|
|
96
|
+
private:
|
|
97
|
+
std::unique_ptr<std::function<void(const PerformanceMetrics& /* metrics */)>> _function;
|
|
98
|
+
} SWIFT_NONCOPYABLE;
|
|
99
|
+
Func_void_PerformanceMetrics create_Func_void_PerformanceMetrics(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
100
|
+
inline Func_void_PerformanceMetrics_Wrapper wrap_Func_void_PerformanceMetrics(Func_void_PerformanceMetrics value) noexcept {
|
|
101
|
+
return Func_void_PerformanceMetrics_Wrapper(std::move(value));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// pragma MARK: std::optional<double>
|
|
105
|
+
/**
|
|
106
|
+
* Specialized version of `std::optional<double>`.
|
|
107
|
+
*/
|
|
108
|
+
using std__optional_double_ = std::optional<double>;
|
|
109
|
+
inline std::optional<double> create_std__optional_double_(const double& value) noexcept {
|
|
110
|
+
return std::optional<double>(value);
|
|
111
|
+
}
|
|
112
|
+
inline bool has_value_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
113
|
+
return optional.has_value();
|
|
114
|
+
}
|
|
115
|
+
inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
116
|
+
return optional.value();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// pragma MARK: std::shared_ptr<HybridNitroMakoSpec>
|
|
120
|
+
/**
|
|
121
|
+
* Specialized version of `std::shared_ptr<HybridNitroMakoSpec>`.
|
|
122
|
+
*/
|
|
123
|
+
using std__shared_ptr_HybridNitroMakoSpec_ = std::shared_ptr<HybridNitroMakoSpec>;
|
|
124
|
+
std::shared_ptr<HybridNitroMakoSpec> create_std__shared_ptr_HybridNitroMakoSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
125
|
+
void* NON_NULL get_std__shared_ptr_HybridNitroMakoSpec_(std__shared_ptr_HybridNitroMakoSpec_ cppType);
|
|
126
|
+
|
|
127
|
+
// pragma MARK: std::weak_ptr<HybridNitroMakoSpec>
|
|
128
|
+
using std__weak_ptr_HybridNitroMakoSpec_ = std::weak_ptr<HybridNitroMakoSpec>;
|
|
129
|
+
inline std__weak_ptr_HybridNitroMakoSpec_ weakify_std__shared_ptr_HybridNitroMakoSpec_(const std::shared_ptr<HybridNitroMakoSpec>& strong) noexcept { return strong; }
|
|
130
|
+
|
|
131
|
+
// pragma MARK: Result<double>
|
|
132
|
+
using Result_double_ = Result<double>;
|
|
133
|
+
inline Result_double_ create_Result_double_(double value) noexcept {
|
|
134
|
+
return Result<double>::withValue(std::move(value));
|
|
135
|
+
}
|
|
136
|
+
inline Result_double_ create_Result_double_(const std::exception_ptr& error) noexcept {
|
|
137
|
+
return Result<double>::withError(error);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// pragma MARK: Result<bool>
|
|
141
|
+
using Result_bool_ = Result<bool>;
|
|
142
|
+
inline Result_bool_ create_Result_bool_(bool value) noexcept {
|
|
143
|
+
return Result<bool>::withValue(std::move(value));
|
|
144
|
+
}
|
|
145
|
+
inline Result_bool_ create_Result_bool_(const std::exception_ptr& error) noexcept {
|
|
146
|
+
return Result<bool>::withError(error);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// pragma MARK: Result<void>
|
|
150
|
+
using Result_void_ = Result<void>;
|
|
151
|
+
inline Result_void_ create_Result_void_() noexcept {
|
|
152
|
+
return Result<void>::withValue();
|
|
153
|
+
}
|
|
154
|
+
inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
|
|
155
|
+
return Result<void>::withError(error);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// pragma MARK: Result<DeviceInfoResult>
|
|
159
|
+
using Result_DeviceInfoResult_ = Result<DeviceInfoResult>;
|
|
160
|
+
inline Result_DeviceInfoResult_ create_Result_DeviceInfoResult_(const DeviceInfoResult& value) noexcept {
|
|
161
|
+
return Result<DeviceInfoResult>::withValue(value);
|
|
162
|
+
}
|
|
163
|
+
inline Result_DeviceInfoResult_ create_Result_DeviceInfoResult_(const std::exception_ptr& error) noexcept {
|
|
164
|
+
return Result<DeviceInfoResult>::withError(error);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// pragma MARK: Result<std::optional<std::string>>
|
|
168
|
+
using Result_std__optional_std__string__ = Result<std::optional<std::string>>;
|
|
169
|
+
inline Result_std__optional_std__string__ create_Result_std__optional_std__string__(const std::optional<std::string>& value) noexcept {
|
|
170
|
+
return Result<std::optional<std::string>>::withValue(value);
|
|
171
|
+
}
|
|
172
|
+
inline Result_std__optional_std__string__ create_Result_std__optional_std__string__(const std::exception_ptr& error) noexcept {
|
|
173
|
+
return Result<std::optional<std::string>>::withError(error);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// pragma MARK: Result<PerformanceMetrics>
|
|
177
|
+
using Result_PerformanceMetrics_ = Result<PerformanceMetrics>;
|
|
178
|
+
inline Result_PerformanceMetrics_ create_Result_PerformanceMetrics_(const PerformanceMetrics& value) noexcept {
|
|
179
|
+
return Result<PerformanceMetrics>::withValue(value);
|
|
180
|
+
}
|
|
181
|
+
inline Result_PerformanceMetrics_ create_Result_PerformanceMetrics_(const std::exception_ptr& error) noexcept {
|
|
182
|
+
return Result<PerformanceMetrics>::withError(error);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
} // namespace margelo::nitro::mako::bridge::swift
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroMako-Swift-Cxx-Umbrella.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
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `DeviceInfoResult` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::mako { struct DeviceInfoResult; }
|
|
13
|
+
// Forward declaration of `HybridNitroMakoSpec` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::mako { class HybridNitroMakoSpec; }
|
|
15
|
+
// Forward declaration of `NativeLogEntry` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::mako { struct NativeLogEntry; }
|
|
17
|
+
// Forward declaration of `NativeLogLevel` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::mako { enum class NativeLogLevel; }
|
|
19
|
+
// Forward declaration of `PerformanceMetrics` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::mako { struct PerformanceMetrics; }
|
|
21
|
+
|
|
22
|
+
// Include C++ defined types
|
|
23
|
+
#include "DeviceInfoResult.hpp"
|
|
24
|
+
#include "HybridNitroMakoSpec.hpp"
|
|
25
|
+
#include "NativeLogEntry.hpp"
|
|
26
|
+
#include "NativeLogLevel.hpp"
|
|
27
|
+
#include "PerformanceMetrics.hpp"
|
|
28
|
+
#include <NitroModules/Result.hpp>
|
|
29
|
+
#include <exception>
|
|
30
|
+
#include <functional>
|
|
31
|
+
#include <memory>
|
|
32
|
+
#include <optional>
|
|
33
|
+
#include <string>
|
|
34
|
+
|
|
35
|
+
// C++ helpers for Swift
|
|
36
|
+
#include "NitroMako-Swift-Cxx-Bridge.hpp"
|
|
37
|
+
|
|
38
|
+
// Common C++ types used in Swift
|
|
39
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
40
|
+
#include <NitroModules/AnyMapUtils.hpp>
|
|
41
|
+
#include <NitroModules/RuntimeError.hpp>
|
|
42
|
+
#include <NitroModules/DateToChronoDate.hpp>
|
|
43
|
+
|
|
44
|
+
// Forward declarations of Swift defined types
|
|
45
|
+
// Forward declaration of `HybridNitroMakoSpec_cxx` to properly resolve imports.
|
|
46
|
+
namespace NitroMako { class HybridNitroMakoSpec_cxx; }
|
|
47
|
+
|
|
48
|
+
// Include Swift defined types
|
|
49
|
+
#if __has_include("NitroMako-Swift.h")
|
|
50
|
+
// This header is generated by Xcode/Swift on every app build.
|
|
51
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "NitroMako".
|
|
52
|
+
#include "NitroMako-Swift.h"
|
|
53
|
+
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
54
|
+
#elif __has_include(<NitroMako/NitroMako-Swift.h>)
|
|
55
|
+
#include <NitroMako/NitroMako-Swift.h>
|
|
56
|
+
#else
|
|
57
|
+
#error NitroMako's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "NitroMako", and try building the app first.
|
|
58
|
+
#endif
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroMakoAutolinking.mm
|
|
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 <Foundation/Foundation.h>
|
|
9
|
+
#import <NitroModules/HybridObjectRegistry.hpp>
|
|
10
|
+
#import "NitroMako-Swift-Cxx-Umbrella.hpp"
|
|
11
|
+
#import <type_traits>
|
|
12
|
+
|
|
13
|
+
#include "HybridNitroMakoSpecSwift.hpp"
|
|
14
|
+
|
|
15
|
+
@interface NitroMakoAutolinking : NSObject
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation NitroMakoAutolinking
|
|
19
|
+
|
|
20
|
+
+ (void) load {
|
|
21
|
+
using namespace margelo::nitro;
|
|
22
|
+
using namespace margelo::nitro::mako;
|
|
23
|
+
|
|
24
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
+
"NitroMako",
|
|
26
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
+
std::shared_ptr<HybridNitroMakoSpec> hybridObject = NitroMako::NitroMakoAutolinking::createNitroMako();
|
|
28
|
+
return hybridObject;
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroMakoAutolinking.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
|
+
// TODO: Use empty enums once Swift supports exporting them as namespaces
|
|
11
|
+
// See: https://github.com/swiftlang/swift/pull/83616
|
|
12
|
+
public final class NitroMakoAutolinking {
|
|
13
|
+
public typealias bridge = margelo.nitro.mako.bridge.swift
|
|
14
|
+
|
|
15
|
+
public static func createNitroMako() -> bridge.std__shared_ptr_HybridNitroMakoSpec_ {
|
|
16
|
+
let hybridObject = HybridMako()
|
|
17
|
+
return { () -> bridge.std__shared_ptr_HybridNitroMakoSpec_ in
|
|
18
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
19
|
+
return __cxxWrapped.getCxxPart()
|
|
20
|
+
}()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public static func isNitroMakoRecyclable() -> Bool {
|
|
24
|
+
return HybridMako.self is any RecyclableView.Type
|
|
25
|
+
}
|
|
26
|
+
}
|