@react-native-firebase/perf 25.1.0 → 26.1.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.
Files changed (81) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/RNFBPerf.podspec +9 -7
  3. package/android/build.gradle +19 -0
  4. package/android/src/main/java/io/invertase/firebase/perf/UniversalFirebasePerfModule.java +88 -0
  5. package/android/src/reactnative/java/io/invertase/firebase/perf/NativeRNFBTurboPerf.java +108 -0
  6. package/android/src/reactnative/java/io/invertase/firebase/perf/ReactNativeFirebasePerfPackage.java +1 -1
  7. package/android/src/reactnative/java/io/invertase/firebase/perf/generated/java/com/facebook/fbreact/specs/NativeRNFBTurboPerfSpec.java +100 -0
  8. package/android/src/reactnative/java/io/invertase/firebase/perf/generated/jni/CMakeLists.txt +36 -0
  9. package/android/src/reactnative/java/io/invertase/firebase/perf/generated/jni/RNFBPerfTurboModules-generated.cpp +80 -0
  10. package/android/src/reactnative/java/io/invertase/firebase/perf/generated/jni/RNFBPerfTurboModules.h +31 -0
  11. package/android/src/reactnative/java/io/invertase/firebase/perf/generated/jni/react/renderer/components/RNFBPerfTurboModules/RNFBPerfTurboModulesJSI-generated.cpp +94 -0
  12. package/android/src/reactnative/java/io/invertase/firebase/perf/generated/jni/react/renderer/components/RNFBPerfTurboModules/RNFBPerfTurboModulesJSI.h +267 -0
  13. package/app.plugin.js +1 -1
  14. package/dist/module/HttpMetric.js +4 -4
  15. package/dist/module/HttpMetric.js.map +1 -1
  16. package/dist/module/ScreenTrace.js +5 -5
  17. package/dist/module/ScreenTrace.js.map +1 -1
  18. package/dist/module/Trace.js +4 -4
  19. package/dist/module/Trace.js.map +1 -1
  20. package/dist/module/index.js +142 -3
  21. package/dist/module/index.js.map +1 -1
  22. package/dist/module/version.js +1 -1
  23. package/dist/typescript/lib/HttpMetric.d.ts +2 -2
  24. package/dist/typescript/lib/HttpMetric.d.ts.map +1 -1
  25. package/dist/typescript/lib/ScreenTrace.d.ts +2 -2
  26. package/dist/typescript/lib/ScreenTrace.d.ts.map +1 -1
  27. package/dist/typescript/lib/Trace.d.ts +2 -2
  28. package/dist/typescript/lib/Trace.d.ts.map +1 -1
  29. package/dist/typescript/lib/index.d.ts +23 -4
  30. package/dist/typescript/lib/index.d.ts.map +1 -1
  31. package/dist/typescript/lib/types/internal.d.ts +12 -16
  32. package/dist/typescript/lib/types/internal.d.ts.map +1 -1
  33. package/dist/typescript/lib/types/perf.d.ts +7 -7
  34. package/dist/typescript/lib/types/perf.d.ts.map +1 -1
  35. package/dist/typescript/lib/version.d.ts +1 -1
  36. package/ios/RNFBPerf/RNFBPerfModule.h +3 -2
  37. package/ios/RNFBPerf/RNFBPerfModule.mm +268 -0
  38. package/ios/RNFBPerf.xcodeproj/project.pbxproj +8 -8
  39. package/ios/generated/RCTAppDependencyProvider.h +25 -0
  40. package/ios/generated/RCTAppDependencyProvider.mm +55 -0
  41. package/ios/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
  42. package/ios/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
  43. package/ios/generated/RCTThirdPartyComponentsProvider.h +16 -0
  44. package/ios/generated/RCTThirdPartyComponentsProvider.mm +23 -0
  45. package/ios/generated/RNFBPerfTurboModules/RNFBPerfTurboModules-generated.mm +106 -0
  46. package/ios/generated/RNFBPerfTurboModules/RNFBPerfTurboModules.h +191 -0
  47. package/ios/generated/RNFBPerfTurboModulesJSI-generated.cpp +94 -0
  48. package/ios/generated/RNFBPerfTurboModulesJSI.h +267 -0
  49. package/ios/generated/ReactAppDependencyProvider.podspec +34 -0
  50. package/lib/HttpMetric.ts +6 -6
  51. package/lib/ScreenTrace.ts +7 -7
  52. package/lib/Trace.ts +6 -6
  53. package/lib/index.ts +228 -5
  54. package/lib/types/internal.ts +12 -24
  55. package/lib/types/perf.ts +7 -7
  56. package/lib/version.ts +1 -1
  57. package/package.json +30 -5
  58. package/plugin/build/app.plugin.d.ts +2 -0
  59. package/plugin/build/app.plugin.js +6 -0
  60. package/plugin/src/app.plugin.ts +3 -0
  61. package/plugin/tsconfig.tsbuildinfo +1 -1
  62. package/react-native.config.js +10 -0
  63. package/specs/NativeRNFBTurboPerf.ts +44 -0
  64. package/typedoc.json +1 -1
  65. package/android/src/reactnative/java/io/invertase/firebase/perf/ReactNativeFirebasePerfModule.java +0 -158
  66. package/dist/module/modular.js +0 -93
  67. package/dist/module/modular.js.map +0 -1
  68. package/dist/module/namespaced.js +0 -130
  69. package/dist/module/namespaced.js.map +0 -1
  70. package/dist/module/types/namespaced.js +0 -65
  71. package/dist/module/types/namespaced.js.map +0 -1
  72. package/dist/typescript/lib/modular.d.ts +0 -43
  73. package/dist/typescript/lib/modular.d.ts.map +0 -1
  74. package/dist/typescript/lib/namespaced.d.ts +0 -11
  75. package/dist/typescript/lib/namespaced.d.ts.map +0 -1
  76. package/dist/typescript/lib/types/namespaced.d.ts +0 -128
  77. package/dist/typescript/lib/types/namespaced.d.ts.map +0 -1
  78. package/ios/RNFBPerf/RNFBPerfModule.m +0 -215
  79. package/lib/modular.ts +0 -116
  80. package/lib/namespaced.ts +0 -200
  81. package/lib/types/namespaced.ts +0 -162
package/CHANGELOG.md CHANGED
@@ -3,6 +3,29 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [26.1.0](https://github.com/invertase/react-native-firebase/compare/v26.0.0...v26.1.0) (2026-08-03)
7
+
8
+ ### Features
9
+
10
+ - **ios:** add SPM dependency resolution support alongside CocoaPods ([#8933](https://github.com/invertase/react-native-firebase/issues/8933)) ([44a7a9a](https://github.com/invertase/react-native-firebase/commit/44a7a9ae7b404f412e9766c0417f1df8fa971a0b))
11
+
12
+ ## [26.0.0](https://github.com/invertase/react-native-firebase/compare/v25.1.0...v26.0.0) (2026-07-29)
13
+
14
+ ### ⚠ BREAKING CHANGES
15
+
16
+ - **perf:** migrate perf to TurboModules
17
+
18
+ ### Features
19
+
20
+ - **perf:** migrate perf to TurboModules ([bbccdf2](https://github.com/invertase/react-native-firebase/commit/bbccdf29199ea016decb4bd8993111124f9dd781))
21
+
22
+ ### Bug Fixes
23
+
24
+ - add codegen verify and spec-native parity tests ([49d9f1b](https://github.com/invertase/react-native-firebase/commit/49d9f1baba4fc83c1dd4983f582bbd7352d78809))
25
+ - add ResultT codegen type alias ([ff2d68f](https://github.com/invertase/react-native-firebase/commit/ff2d68ff8f73092f8ba3c75e007049dd31be822f))
26
+ - **ios:** set IPHONEOS_DEPLOYMENT_TARGET to 15.0, update platform support docs/conditionals ([#9108](https://github.com/invertase/react-native-firebase/issues/9108)) ([99d0899](https://github.com/invertase/react-native-firebase/commit/99d089908e3eec6155d73ecf05ff7274ad33c46e)), closes [#8882](https://github.com/invertase/react-native-firebase/issues/8882)
27
+ - resolve CI lint and spec-native parity failures ([6ff817e](https://github.com/invertase/react-native-firebase/commit/6ff817ed2154b2d4e77c5fd9709ec0eb95b408fa))
28
+
6
29
  ## [25.1.0](https://github.com/invertase/react-native-firebase/compare/v25.0.1...v25.1.0) (2026-06-25)
7
30
 
8
31
  ### Bug Fixes
package/RNFBPerf.podspec CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'json'
2
+ require_relative '../app/firebase_spm'
2
3
  package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
3
4
  appPackage = JSON.parse(File.read(File.join('..', 'app', 'package.json')))
4
5
 
@@ -28,15 +29,16 @@ Pod::Spec.new do |s|
28
29
  s.ios.deployment_target = firebase_ios_target
29
30
  s.macos.deployment_target = firebase_macos_target
30
31
  s.tvos.deployment_target = firebase_tvos_target
31
- s.source_files = 'ios/**/*.{h,m}'
32
+ s.source_files = 'ios/**/*.{h,m,mm,cpp,swift}'
33
+ s.private_header_files = "ios/**/*.h"
34
+ s.exclude_files = 'ios/generated/RCTThirdPartyComponentsProvider.*', 'ios/generated/RCTAppDependencyProvider.*', 'ios/generated/RCTModuleProviders.*', 'ios/generated/RCTModulesConformingToProtocolsProvider.*', 'ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.*'
32
35
 
33
36
  s.dependency 'RNFBApp'
34
37
 
35
- # React Native dependencies
36
- if defined?(install_modules_dependencies()) != nil
37
- install_modules_dependencies(s);
38
- else
39
- s.dependency "React-Core"
38
+ install_modules_dependencies(s);
39
+
40
+ if defined?(ENV["RCT_NEW_ARCH_ENABLED"]) != nil && (ENV["RCT_NEW_ARCH_ENABLED"] == '0')
41
+ raise "#{s.name} requires New Architecture. Enable New Architecture to use this module"
40
42
  end
41
43
 
42
44
  if defined?($FirebaseSDKVersion)
@@ -45,7 +47,7 @@ Pod::Spec.new do |s|
45
47
  end
46
48
 
47
49
  # Firebase dependencies
48
- s.dependency 'Firebase/Performance', firebase_sdk_version
50
+ firebase_dependency(s, firebase_sdk_version, ['FirebasePerformance'], 'Firebase/Performance')
49
51
 
50
52
  if defined?($RNFirebaseAsStaticFramework)
51
53
  Pod::UI.puts "#{s.name}: Using overridden static_framework value of '#{$RNFirebaseAsStaticFramework}'"
@@ -121,6 +121,7 @@ android {
121
121
  sourceSets {
122
122
  main {
123
123
  java.srcDirs = ['src/main/java', 'src/reactnative/java']
124
+ java.excludes = ['**/generated/jni/**']
124
125
  }
125
126
  }
126
127
  }
@@ -140,3 +141,21 @@ ReactNative.shared.applyPackageVersion()
140
141
  ReactNative.shared.applyDefaultExcludes()
141
142
  ReactNative.module.applyAndroidVersions()
142
143
  ReactNative.module.applyReactNativeDependency("api")
144
+
145
+ def isNewArchitectureDisabled() {
146
+ return project.hasProperty("newArchEnabled") && project.newArchEnabled != "true"
147
+ }
148
+
149
+ if (isNewArchitectureDisabled()) {
150
+ def ANSI_RED = "\u001B[31m";
151
+ def ANSI_RESET = "\u001B[0m";
152
+
153
+ println("\n\n\n")
154
+ println(ANSI_RED + "**************************************************************************************************************")
155
+ println("\n\n\n")
156
+ println("New Architecture support is required for @react-native-firebase/perf")
157
+ println("\n\n\n")
158
+ println("**************************************************************************************************************" + ANSI_RESET)
159
+ println("\n\n\n")
160
+ System.exit(1)
161
+ }
@@ -184,4 +184,92 @@ public class UniversalFirebasePerfModule extends UniversalFirebaseModule {
184
184
  return null;
185
185
  });
186
186
  }
187
+
188
+ // --- Synchronous variants for the TurboModule (all work is in-memory, no network/disk) ---
189
+
190
+ void startTraceSync(int id, String identifier) {
191
+ Trace trace = FirebasePerformance.getInstance().newTrace(identifier);
192
+ trace.start();
193
+ traces.put(id, trace);
194
+ }
195
+
196
+ void stopTraceSync(int id, Bundle metrics, Bundle attributes) {
197
+ Trace trace = traces.get(id);
198
+ // Traces can be cleared during module teardown before JS stops them.
199
+ if (trace == null) {
200
+ return;
201
+ }
202
+
203
+ Set<String> metricKeys = metrics.keySet();
204
+ Set<String> attributeKeys = attributes.keySet();
205
+
206
+ for (String metricKey : metricKeys) {
207
+ Double value = ((double) metrics.get(metricKey));
208
+ trace.putMetric(metricKey, value.intValue());
209
+ }
210
+
211
+ for (String attributeKey : attributeKeys) {
212
+ trace.putAttribute(
213
+ attributeKey, (String) Objects.requireNonNull(attributes.get(attributeKey)));
214
+ }
215
+
216
+ trace.stop();
217
+ traces.remove(id);
218
+ }
219
+
220
+ void startScreenTraceSync(Activity activity, int id, String identifier) {
221
+ ScreenTrace screenTrace = new ScreenTrace(activity, identifier);
222
+ screenTrace.recordScreenTrace();
223
+ screenTraces.put(id, screenTrace);
224
+ }
225
+
226
+ void stopScreenTraceSync(int id) {
227
+ ScreenTrace trace = screenTraces.get(id);
228
+ // Screen traces can be cleared during module teardown before JS stops them.
229
+ if (trace == null) {
230
+ return;
231
+ }
232
+ trace.sendScreenTrace();
233
+ screenTraces.remove(id);
234
+ }
235
+
236
+ void startHttpMetricSync(int id, String url, String httpMethod) {
237
+ HttpMetric httpMetric = FirebasePerformance.getInstance().newHttpMetric(url, httpMethod);
238
+ httpMetric.start();
239
+ httpMetrics.put(id, httpMetric);
240
+ }
241
+
242
+ void stopHttpMetricSync(int id, Bundle httpMetricConfig, Bundle attributes) {
243
+ HttpMetric httpMetric = httpMetrics.get(id);
244
+ // HTTP metrics can be cleared during module teardown before JS stops them.
245
+ if (httpMetric == null) {
246
+ return;
247
+ }
248
+
249
+ if (httpMetricConfig.containsKey("httpResponseCode")) {
250
+ httpMetric.setHttpResponseCode((int) httpMetricConfig.getDouble("httpResponseCode"));
251
+ }
252
+
253
+ if (httpMetricConfig.containsKey("requestPayloadSize")) {
254
+ httpMetric.setRequestPayloadSize((int) httpMetricConfig.getDouble("requestPayloadSize"));
255
+ }
256
+
257
+ if (httpMetricConfig.containsKey("responsePayloadSize")) {
258
+ httpMetric.setResponsePayloadSize((int) httpMetricConfig.getDouble("responsePayloadSize"));
259
+ }
260
+
261
+ if (httpMetricConfig.containsKey("responseContentType")) {
262
+ httpMetric.setResponseContentType(httpMetricConfig.getString("responseContentType"));
263
+ }
264
+
265
+ Set<String> attributeKeys = attributes.keySet();
266
+
267
+ for (String attributeKey : attributeKeys) {
268
+ httpMetric.putAttribute(
269
+ attributeKey, Objects.requireNonNull(attributes.getString(attributeKey)));
270
+ }
271
+
272
+ httpMetric.stop();
273
+ httpMetrics.remove(id);
274
+ }
187
275
  }
@@ -0,0 +1,108 @@
1
+ package io.invertase.firebase.perf;
2
+
3
+ /*
4
+ * Copyright (c) 2016-present Invertase Limited & Contributors
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this library except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ *
18
+ */
19
+
20
+ import android.app.Activity;
21
+ import com.facebook.fbreact.specs.NativeRNFBTurboPerfSpec;
22
+ import com.facebook.react.bridge.Arguments;
23
+ import com.facebook.react.bridge.Promise;
24
+ import com.facebook.react.bridge.ReactApplicationContext;
25
+ import com.facebook.react.bridge.ReadableMap;
26
+ import java.util.Map;
27
+
28
+ public class NativeRNFBTurboPerf extends NativeRNFBTurboPerfSpec {
29
+ private static final String SERVICE_NAME = "Perf";
30
+ private final UniversalFirebasePerfModule module;
31
+
32
+ public NativeRNFBTurboPerf(ReactApplicationContext reactContext) {
33
+ super(reactContext);
34
+ this.module = new UniversalFirebasePerfModule(reactContext, SERVICE_NAME);
35
+ }
36
+
37
+ @Override
38
+ public void invalidate() {
39
+ super.invalidate();
40
+ module.onTearDown();
41
+ }
42
+
43
+ @Override
44
+ protected Map<String, Object> getTypedExportedConstants() {
45
+ return module.getConstants();
46
+ }
47
+
48
+ @Override
49
+ public void setPerformanceCollectionEnabled(boolean enabled, Promise promise) {
50
+ module
51
+ .setPerformanceCollectionEnabled(enabled)
52
+ .addOnCompleteListener(
53
+ task -> {
54
+ if (task.isSuccessful()) {
55
+ promise.resolve(task.getResult());
56
+ } else {
57
+ promise.reject(task.getException());
58
+ }
59
+ });
60
+ }
61
+
62
+ @Override
63
+ public void instrumentationEnabled(boolean enabled, Promise promise) {
64
+ promise.resolve(null);
65
+ }
66
+
67
+ @Override
68
+ public void startTrace(double id, String identifier) {
69
+ module.startTraceSync((int) id, identifier);
70
+ }
71
+
72
+ @Override
73
+ public void stopTrace(double id, ReadableMap traceData) {
74
+ module.stopTraceSync(
75
+ (int) id,
76
+ Arguments.toBundle(traceData.getMap("metrics")),
77
+ Arguments.toBundle(traceData.getMap("attributes")));
78
+ }
79
+
80
+ @Override
81
+ public void startScreenTrace(double id, String identifier) {
82
+ Activity currentActivity = getCurrentActivity();
83
+
84
+ if (currentActivity == null) {
85
+ return;
86
+ }
87
+
88
+ module.startScreenTraceSync(currentActivity, (int) id, identifier);
89
+ }
90
+
91
+ @Override
92
+ public void stopScreenTrace(double id) {
93
+ module.stopScreenTraceSync((int) id);
94
+ }
95
+
96
+ @Override
97
+ public void startHttpMetric(double id, String url, String httpMethod) {
98
+ module.startHttpMetricSync((int) id, url, httpMethod);
99
+ }
100
+
101
+ @Override
102
+ public void stopHttpMetric(double id, ReadableMap metricData) {
103
+ module.stopHttpMetricSync(
104
+ (int) id,
105
+ Arguments.toBundle(metricData),
106
+ Arguments.toBundle(metricData.getMap("attributes")));
107
+ }
108
+ }
@@ -32,7 +32,7 @@ public class ReactNativeFirebasePerfPackage implements ReactPackage {
32
32
  @Override
33
33
  public List<NativeModule> createNativeModules(@Nonnull ReactApplicationContext reactContext) {
34
34
  List<NativeModule> modules = new ArrayList<>();
35
- modules.add(new ReactNativeFirebasePerfModule(reactContext));
35
+ modules.add(new NativeRNFBTurboPerf(reactContext));
36
36
  return modules;
37
37
  }
38
38
 
@@ -0,0 +1,100 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJavaSpec.js
9
+ *
10
+ * @nolint
11
+ */
12
+
13
+ package com.facebook.fbreact.specs;
14
+
15
+ import com.facebook.proguard.annotations.DoNotStrip;
16
+ import com.facebook.react.bridge.Promise;
17
+ import com.facebook.react.bridge.ReactApplicationContext;
18
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
19
+ import com.facebook.react.bridge.ReactMethod;
20
+ import com.facebook.react.bridge.ReadableMap;
21
+ import com.facebook.react.common.build.ReactBuildConfig;
22
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule;
23
+ import java.util.Arrays;
24
+ import java.util.HashSet;
25
+ import java.util.Map;
26
+ import java.util.Set;
27
+ import javax.annotation.Nonnull;
28
+ import javax.annotation.Nullable;
29
+
30
+ public abstract class NativeRNFBTurboPerfSpec extends ReactContextBaseJavaModule implements TurboModule {
31
+ public static final String NAME = "NativeRNFBTurboPerf";
32
+
33
+ public NativeRNFBTurboPerfSpec(ReactApplicationContext reactContext) {
34
+ super(reactContext);
35
+ }
36
+
37
+ @Override
38
+ public @Nonnull String getName() {
39
+ return NAME;
40
+ }
41
+
42
+ protected abstract Map<String, Object> getTypedExportedConstants();
43
+
44
+ @Override
45
+ @DoNotStrip
46
+ public final @Nullable Map<String, Object> getConstants() {
47
+ Map<String, Object> constants = getTypedExportedConstants();
48
+ if (ReactBuildConfig.DEBUG || ReactBuildConfig.IS_INTERNAL_BUILD) {
49
+ Set<String> obligatoryFlowConstants = new HashSet<>(Arrays.asList(
50
+ "isInstrumentationEnabled",
51
+ "isPerformanceCollectionEnabled"
52
+ ));
53
+ Set<String> optionalFlowConstants = new HashSet<>();
54
+ Set<String> undeclaredConstants = new HashSet<>(constants.keySet());
55
+ undeclaredConstants.removeAll(obligatoryFlowConstants);
56
+ undeclaredConstants.removeAll(optionalFlowConstants);
57
+ if (!undeclaredConstants.isEmpty()) {
58
+ throw new IllegalStateException(String.format("Native Module Flow doesn't declare constants: %s", undeclaredConstants));
59
+ }
60
+ undeclaredConstants = obligatoryFlowConstants;
61
+ undeclaredConstants.removeAll(constants.keySet());
62
+ if (!undeclaredConstants.isEmpty()) {
63
+ throw new IllegalStateException(String.format("Native Module doesn't fill in constants: %s", undeclaredConstants));
64
+ }
65
+ }
66
+ return constants;
67
+ }
68
+
69
+ @ReactMethod
70
+ @DoNotStrip
71
+ public abstract void setPerformanceCollectionEnabled(boolean enabled, Promise promise);
72
+
73
+ @ReactMethod
74
+ @DoNotStrip
75
+ public abstract void instrumentationEnabled(boolean enabled, Promise promise);
76
+
77
+ @ReactMethod
78
+ @DoNotStrip
79
+ public abstract void startTrace(double id, String identifier);
80
+
81
+ @ReactMethod
82
+ @DoNotStrip
83
+ public abstract void stopTrace(double id, ReadableMap traceData);
84
+
85
+ @ReactMethod
86
+ @DoNotStrip
87
+ public abstract void startScreenTrace(double id, String identifier);
88
+
89
+ @ReactMethod
90
+ @DoNotStrip
91
+ public abstract void stopScreenTrace(double id);
92
+
93
+ @ReactMethod
94
+ @DoNotStrip
95
+ public abstract void startHttpMetric(double id, String url, String httpMethod);
96
+
97
+ @ReactMethod
98
+ @DoNotStrip
99
+ public abstract void stopHttpMetric(double id, ReadableMap metricData);
100
+ }
@@ -0,0 +1,36 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ #
3
+ # This source code is licensed under the MIT license found in the
4
+ # LICENSE file in the root directory of this source tree.
5
+
6
+ cmake_minimum_required(VERSION 3.13)
7
+ set(CMAKE_VERBOSE_MAKEFILE on)
8
+
9
+ file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNFBPerfTurboModules/*.cpp)
10
+
11
+ add_library(
12
+ react_codegen_RNFBPerfTurboModules
13
+ OBJECT
14
+ ${react_codegen_SRCS}
15
+ )
16
+
17
+ target_include_directories(react_codegen_RNFBPerfTurboModules PUBLIC . react/renderer/components/RNFBPerfTurboModules)
18
+
19
+ target_link_libraries(
20
+ react_codegen_RNFBPerfTurboModules
21
+ fbjni
22
+ jsi
23
+ # We need to link different libraries based on whether we are building rncore or not, that's necessary
24
+ # because we want to break a circular dependency between react_codegen_rncore and reactnative
25
+ reactnative
26
+ )
27
+
28
+ target_compile_options(
29
+ react_codegen_RNFBPerfTurboModules
30
+ PRIVATE
31
+ -DLOG_TAG=\"ReactNative\"
32
+ -fexceptions
33
+ -frtti
34
+ -std=c++20
35
+ -Wall
36
+ )
@@ -0,0 +1,80 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJniCpp.js
9
+ */
10
+
11
+ #include "RNFBPerfTurboModules.h"
12
+
13
+ namespace facebook::react {
14
+
15
+ static facebook::jsi::Value __hostFunction_NativeRNFBTurboPerfSpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
16
+ static jmethodID cachedMethodId = nullptr;
17
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, ObjectKind, "getConstants", "()Ljava/util/Map;", args, count, cachedMethodId);
18
+ }
19
+
20
+ static facebook::jsi::Value __hostFunction_NativeRNFBTurboPerfSpecJSI_setPerformanceCollectionEnabled(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
21
+ static jmethodID cachedMethodId = nullptr;
22
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "setPerformanceCollectionEnabled", "(ZLcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
23
+ }
24
+
25
+ static facebook::jsi::Value __hostFunction_NativeRNFBTurboPerfSpecJSI_instrumentationEnabled(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
26
+ static jmethodID cachedMethodId = nullptr;
27
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "instrumentationEnabled", "(ZLcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
28
+ }
29
+
30
+ static facebook::jsi::Value __hostFunction_NativeRNFBTurboPerfSpecJSI_startTrace(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
31
+ static jmethodID cachedMethodId = nullptr;
32
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "startTrace", "(DLjava/lang/String;)V", args, count, cachedMethodId);
33
+ }
34
+
35
+ static facebook::jsi::Value __hostFunction_NativeRNFBTurboPerfSpecJSI_stopTrace(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
36
+ static jmethodID cachedMethodId = nullptr;
37
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "stopTrace", "(DLcom/facebook/react/bridge/ReadableMap;)V", args, count, cachedMethodId);
38
+ }
39
+
40
+ static facebook::jsi::Value __hostFunction_NativeRNFBTurboPerfSpecJSI_startScreenTrace(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
41
+ static jmethodID cachedMethodId = nullptr;
42
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "startScreenTrace", "(DLjava/lang/String;)V", args, count, cachedMethodId);
43
+ }
44
+
45
+ static facebook::jsi::Value __hostFunction_NativeRNFBTurboPerfSpecJSI_stopScreenTrace(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
46
+ static jmethodID cachedMethodId = nullptr;
47
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "stopScreenTrace", "(D)V", args, count, cachedMethodId);
48
+ }
49
+
50
+ static facebook::jsi::Value __hostFunction_NativeRNFBTurboPerfSpecJSI_startHttpMetric(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
51
+ static jmethodID cachedMethodId = nullptr;
52
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "startHttpMetric", "(DLjava/lang/String;Ljava/lang/String;)V", args, count, cachedMethodId);
53
+ }
54
+
55
+ static facebook::jsi::Value __hostFunction_NativeRNFBTurboPerfSpecJSI_stopHttpMetric(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
56
+ static jmethodID cachedMethodId = nullptr;
57
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "stopHttpMetric", "(DLcom/facebook/react/bridge/ReadableMap;)V", args, count, cachedMethodId);
58
+ }
59
+
60
+ NativeRNFBTurboPerfSpecJSI::NativeRNFBTurboPerfSpecJSI(const JavaTurboModule::InitParams &params)
61
+ : JavaTurboModule(params) {
62
+ methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeRNFBTurboPerfSpecJSI_getConstants};
63
+ methodMap_["setPerformanceCollectionEnabled"] = MethodMetadata {1, __hostFunction_NativeRNFBTurboPerfSpecJSI_setPerformanceCollectionEnabled};
64
+ methodMap_["instrumentationEnabled"] = MethodMetadata {1, __hostFunction_NativeRNFBTurboPerfSpecJSI_instrumentationEnabled};
65
+ methodMap_["startTrace"] = MethodMetadata {2, __hostFunction_NativeRNFBTurboPerfSpecJSI_startTrace};
66
+ methodMap_["stopTrace"] = MethodMetadata {2, __hostFunction_NativeRNFBTurboPerfSpecJSI_stopTrace};
67
+ methodMap_["startScreenTrace"] = MethodMetadata {2, __hostFunction_NativeRNFBTurboPerfSpecJSI_startScreenTrace};
68
+ methodMap_["stopScreenTrace"] = MethodMetadata {1, __hostFunction_NativeRNFBTurboPerfSpecJSI_stopScreenTrace};
69
+ methodMap_["startHttpMetric"] = MethodMetadata {3, __hostFunction_NativeRNFBTurboPerfSpecJSI_startHttpMetric};
70
+ methodMap_["stopHttpMetric"] = MethodMetadata {2, __hostFunction_NativeRNFBTurboPerfSpecJSI_stopHttpMetric};
71
+ }
72
+
73
+ std::shared_ptr<TurboModule> RNFBPerfTurboModules_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params) {
74
+ if (moduleName == "NativeRNFBTurboPerf") {
75
+ return std::make_shared<NativeRNFBTurboPerfSpecJSI>(params);
76
+ }
77
+ return nullptr;
78
+ }
79
+
80
+ } // namespace facebook::react
@@ -0,0 +1,31 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJniH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include <ReactCommon/JavaTurboModule.h>
14
+ #include <ReactCommon/TurboModule.h>
15
+ #include <jsi/jsi.h>
16
+
17
+ namespace facebook::react {
18
+
19
+ /**
20
+ * JNI C++ class for module 'NativeRNFBTurboPerf'
21
+ */
22
+ class JSI_EXPORT NativeRNFBTurboPerfSpecJSI : public JavaTurboModule {
23
+ public:
24
+ NativeRNFBTurboPerfSpecJSI(const JavaTurboModule::InitParams &params);
25
+ };
26
+
27
+
28
+ JSI_EXPORT
29
+ std::shared_ptr<TurboModule> RNFBPerfTurboModules_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params);
30
+
31
+ } // namespace facebook::react
@@ -0,0 +1,94 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateModuleCpp.js
8
+ */
9
+
10
+ #include "RNFBPerfTurboModulesJSI.h"
11
+
12
+ namespace facebook::react {
13
+
14
+ static jsi::Value __hostFunction_NativeRNFBTurboPerfCxxSpecJSI_getConstants(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
15
+ return static_cast<NativeRNFBTurboPerfCxxSpecJSI *>(&turboModule)->getConstants(
16
+ rt
17
+ );
18
+ }
19
+ static jsi::Value __hostFunction_NativeRNFBTurboPerfCxxSpecJSI_setPerformanceCollectionEnabled(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
20
+ return static_cast<NativeRNFBTurboPerfCxxSpecJSI *>(&turboModule)->setPerformanceCollectionEnabled(
21
+ rt,
22
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asBool()
23
+ );
24
+ }
25
+ static jsi::Value __hostFunction_NativeRNFBTurboPerfCxxSpecJSI_instrumentationEnabled(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
26
+ return static_cast<NativeRNFBTurboPerfCxxSpecJSI *>(&turboModule)->instrumentationEnabled(
27
+ rt,
28
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asBool()
29
+ );
30
+ }
31
+ static jsi::Value __hostFunction_NativeRNFBTurboPerfCxxSpecJSI_startTrace(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
32
+ static_cast<NativeRNFBTurboPerfCxxSpecJSI *>(&turboModule)->startTrace(
33
+ rt,
34
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber(),
35
+ count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt)
36
+ );
37
+ return jsi::Value::undefined();
38
+ }
39
+ static jsi::Value __hostFunction_NativeRNFBTurboPerfCxxSpecJSI_stopTrace(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
40
+ static_cast<NativeRNFBTurboPerfCxxSpecJSI *>(&turboModule)->stopTrace(
41
+ rt,
42
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber(),
43
+ count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asObject(rt)
44
+ );
45
+ return jsi::Value::undefined();
46
+ }
47
+ static jsi::Value __hostFunction_NativeRNFBTurboPerfCxxSpecJSI_startScreenTrace(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
48
+ static_cast<NativeRNFBTurboPerfCxxSpecJSI *>(&turboModule)->startScreenTrace(
49
+ rt,
50
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber(),
51
+ count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt)
52
+ );
53
+ return jsi::Value::undefined();
54
+ }
55
+ static jsi::Value __hostFunction_NativeRNFBTurboPerfCxxSpecJSI_stopScreenTrace(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
56
+ static_cast<NativeRNFBTurboPerfCxxSpecJSI *>(&turboModule)->stopScreenTrace(
57
+ rt,
58
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber()
59
+ );
60
+ return jsi::Value::undefined();
61
+ }
62
+ static jsi::Value __hostFunction_NativeRNFBTurboPerfCxxSpecJSI_startHttpMetric(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
63
+ static_cast<NativeRNFBTurboPerfCxxSpecJSI *>(&turboModule)->startHttpMetric(
64
+ rt,
65
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber(),
66
+ count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt),
67
+ count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt)
68
+ );
69
+ return jsi::Value::undefined();
70
+ }
71
+ static jsi::Value __hostFunction_NativeRNFBTurboPerfCxxSpecJSI_stopHttpMetric(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
72
+ static_cast<NativeRNFBTurboPerfCxxSpecJSI *>(&turboModule)->stopHttpMetric(
73
+ rt,
74
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber(),
75
+ count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asObject(rt)
76
+ );
77
+ return jsi::Value::undefined();
78
+ }
79
+
80
+ NativeRNFBTurboPerfCxxSpecJSI::NativeRNFBTurboPerfCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
81
+ : TurboModule("NativeRNFBTurboPerf", jsInvoker) {
82
+ methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeRNFBTurboPerfCxxSpecJSI_getConstants};
83
+ methodMap_["setPerformanceCollectionEnabled"] = MethodMetadata {1, __hostFunction_NativeRNFBTurboPerfCxxSpecJSI_setPerformanceCollectionEnabled};
84
+ methodMap_["instrumentationEnabled"] = MethodMetadata {1, __hostFunction_NativeRNFBTurboPerfCxxSpecJSI_instrumentationEnabled};
85
+ methodMap_["startTrace"] = MethodMetadata {2, __hostFunction_NativeRNFBTurboPerfCxxSpecJSI_startTrace};
86
+ methodMap_["stopTrace"] = MethodMetadata {2, __hostFunction_NativeRNFBTurboPerfCxxSpecJSI_stopTrace};
87
+ methodMap_["startScreenTrace"] = MethodMetadata {2, __hostFunction_NativeRNFBTurboPerfCxxSpecJSI_startScreenTrace};
88
+ methodMap_["stopScreenTrace"] = MethodMetadata {1, __hostFunction_NativeRNFBTurboPerfCxxSpecJSI_stopScreenTrace};
89
+ methodMap_["startHttpMetric"] = MethodMetadata {3, __hostFunction_NativeRNFBTurboPerfCxxSpecJSI_startHttpMetric};
90
+ methodMap_["stopHttpMetric"] = MethodMetadata {2, __hostFunction_NativeRNFBTurboPerfCxxSpecJSI_stopHttpMetric};
91
+ }
92
+
93
+
94
+ } // namespace facebook::react