react-native 0.82.0-rc.0 → 0.82.0-rc.3

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 (94) hide show
  1. package/Libraries/BatchedBridge/BatchedBridge.js +1 -0
  2. package/Libraries/BatchedBridge/MessageQueue.js +1 -0
  3. package/Libraries/Core/ReactNativeVersion.js +1 -1
  4. package/Libraries/Core/Timers/JSTimers.js +1 -0
  5. package/Libraries/Core/Timers/NativeTiming.js +1 -0
  6. package/Libraries/Core/Timers/immediateShim.js +1 -0
  7. package/Libraries/Core/setUpPerformance.js +3 -5
  8. package/React/Base/RCTVersion.m +1 -1
  9. package/React/CoreModules/RCTAlertController.mm +6 -1
  10. package/React/FBReactNativeSpec/FBReactNativeSpecJSI-generated.cpp +12 -0
  11. package/React/FBReactNativeSpec/FBReactNativeSpecJSI.h +18 -0
  12. package/ReactAndroid/build.gradle.kts +7 -0
  13. package/ReactAndroid/gradle.properties +2 -1
  14. package/ReactAndroid/hermes-engine/build.gradle.kts +28 -7
  15. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +7 -1
  16. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +11 -1
  17. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +3 -1
  18. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +3 -1
  19. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +12 -1
  20. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsOverrides_RNOSS_Canary_Android.kt +3 -1
  21. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +3 -1
  22. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
  23. package/ReactAndroid/src/main/jni/CMakeLists.txt +5 -0
  24. package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +15 -1
  25. package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +4 -1
  26. package/ReactAndroid/src/main/jni/react/hermes/reactexecutor/CMakeLists.txt +4 -0
  27. package/ReactAndroid/src/main/jni/react/runtime/hermes/jni/CMakeLists.txt +4 -0
  28. package/ReactAndroid/src/main/jni/react/runtime/jni/CMakeLists.txt +4 -0
  29. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  30. package/ReactCommon/hermes/executor/CMakeLists.txt +4 -0
  31. package/ReactCommon/hermes/executor/HermesExecutorFactory.cpp +8 -5
  32. package/ReactCommon/hermes/inspector-modern/CMakeLists.txt +4 -0
  33. package/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.cpp +2 -2
  34. package/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.h +2 -2
  35. package/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp +2 -2
  36. package/ReactCommon/hermes/inspector-modern/chrome/Registration.h +2 -2
  37. package/ReactCommon/jsinspector-modern/React-jsinspector.podspec +2 -0
  38. package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +5 -1
  39. package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +6 -1
  40. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +44 -26
  41. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +4 -2
  42. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +5 -1
  43. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +10 -1
  44. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsOverridesOSSCanary.h +5 -1
  45. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +2 -1
  46. package/ReactCommon/react/nativemodule/defaults/CMakeLists.txt +1 -0
  47. package/ReactCommon/react/nativemodule/defaults/DefaultTurboModules.cpp +8 -0
  48. package/ReactCommon/react/nativemodule/defaults/React-defaultsnativemodule.podspec +1 -0
  49. package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +6 -1
  50. package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +3 -1
  51. package/ReactCommon/react/nativemodule/webperformance/CMakeLists.txt +1 -1
  52. package/ReactCommon/react/nativemodule/webperformance/NativePerformance.cpp +9 -9
  53. package/ReactCommon/react/nativemodule/webperformance/NativePerformance.h +3 -0
  54. package/ReactCommon/react/nativemodule/webperformance/React-webperformancenativemodule.podspec +58 -0
  55. package/ReactCommon/react/runtime/CMakeLists.txt +4 -0
  56. package/ReactCommon/react/runtime/hermes/CMakeLists.txt +4 -0
  57. package/ReactCommon/react/runtime/hermes/HermesInstance.cpp +7 -3
  58. package/ReactCommon/react/timing/primitives.h +12 -0
  59. package/flow/bom.js.flow +158 -1
  60. package/package.json +9 -8
  61. package/scripts/cocoapods/autolinking.rb +6 -0
  62. package/scripts/cocoapods/codegen_utils.rb +1 -1
  63. package/scripts/cocoapods/jsengine.rb +2 -1
  64. package/scripts/cocoapods/utils.rb +8 -2
  65. package/scripts/codegen/generate-artifacts-executor/index.js +5 -6
  66. package/scripts/codegen/generate-artifacts-executor/utils.js +41 -10
  67. package/scripts/react_native_pods.rb +1 -0
  68. package/scripts/replace-rncore-version.js +4 -2
  69. package/sdks/hermes-engine/hermes-engine.podspec +35 -12
  70. package/sdks/hermes-engine/hermes-utils.rb +41 -10
  71. package/sdks/hermes-engine/utils/build-apple-framework.sh +7 -1
  72. package/sdks/hermes-engine/utils/build-hermes-xcode.sh +8 -1
  73. package/sdks/hermes-engine/utils/build-hermesc-xcode.sh +1 -1
  74. package/sdks/hermes-engine/utils/replace_hermes_version.js +4 -2
  75. package/sdks/hermes-engine/version.properties +1 -0
  76. package/sdks/hermesc/osx-bin/hermes +0 -0
  77. package/sdks/hermesc/osx-bin/hermesc +0 -0
  78. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  79. package/settings.gradle.kts +9 -0
  80. package/src/private/featureflags/ReactNativeFeatureFlags.js +6 -1
  81. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +2 -1
  82. package/src/private/setup/{setUpPerformanceObserver.js → setUpPerformanceModern.js} +43 -18
  83. package/src/private/specs_DEPRECATED/modules/NativeTiming.js +1 -0
  84. package/src/private/webapis/performance/EventTiming.js +34 -15
  85. package/src/private/webapis/performance/LongTasks.js +35 -2
  86. package/src/private/webapis/performance/Performance.js +49 -13
  87. package/src/private/webapis/performance/PerformanceEntry.js +21 -8
  88. package/src/private/webapis/performance/PerformanceObserver.js +30 -1
  89. package/src/private/webapis/performance/ReactNativeStartupTiming.js +3 -24
  90. package/src/private/webapis/performance/ResourceTiming.js +29 -18
  91. package/src/private/webapis/performance/UserTiming.js +33 -28
  92. package/src/private/webapis/performance/internals/RawPerformanceEntry.js +3 -4
  93. package/src/private/webapis/performance/specs/NativePerformance.js +2 -0
  94. package/third-party-podspecs/replace_dependencies_version.js +4 -2
@@ -131,9 +131,18 @@ NativePerformance::NativePerformance(std::shared_ptr<CallInvoker> jsInvoker)
131
131
  : NativePerformanceCxxSpec(std::move(jsInvoker)) {}
132
132
 
133
133
  HighResTimeStamp NativePerformance::now(jsi::Runtime& /*rt*/) {
134
+ // This is not spec-compliant, as this is the duration from system boot to
135
+ // now, instead of from app startup to now.
136
+ // This should be carefully changed eventually.
134
137
  return HighResTimeStamp::now();
135
138
  }
136
139
 
140
+ HighResDuration NativePerformance::timeOrigin(jsi::Runtime& /*rt*/) {
141
+ // This is not spec-compliant, as this is an approximation from Unix epoch to
142
+ // system boot, instead of a precise duration from Unix epoch to app startup.
143
+ return HighResTimeStamp::unsafeOriginFromUnixTimeStamp();
144
+ }
145
+
137
146
  void NativePerformance::reportMark(
138
147
  jsi::Runtime& rt,
139
148
  const std::string& name,
@@ -274,15 +283,6 @@ NativePerformance::getReactNativeStartupTiming(jsi::Runtime& /*rt*/) {
274
283
  startupLogger.getRunJSBundleStartTime();
275
284
  }
276
285
 
277
- if (!std::isnan(startupLogger.getRunJSBundleEndTime())) {
278
- result["executeJavaScriptBundleEntryPointEnd"] =
279
- startupLogger.getRunJSBundleEndTime();
280
- }
281
-
282
- if (!std::isnan(startupLogger.getInitReactRuntimeEndTime())) {
283
- result["initializeRuntimeEnd"] = startupLogger.getInitReactRuntimeEndTime();
284
- }
285
-
286
286
  if (!std::isnan(startupLogger.getAppStartupEndTime())) {
287
287
  result["endTime"] = startupLogger.getAppStartupEndTime();
288
288
  }
@@ -88,6 +88,9 @@ class NativePerformance : public NativePerformanceCxxSpec<NativePerformance> {
88
88
  // https://www.w3.org/TR/hr-time-3/#now-method
89
89
  HighResTimeStamp now(jsi::Runtime& rt);
90
90
 
91
+ // https://www.w3.org/TR/hr-time-3/#timeorigin-attribute
92
+ HighResDuration timeOrigin(jsi::Runtime& rt);
93
+
91
94
  #pragma mark - User Timing Level 3 functions (https://w3c.github.io/user-timing/)
92
95
 
93
96
  void reportMark(
@@ -0,0 +1,58 @@
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
+ require "json"
7
+
8
+ package = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "..", "package.json")))
9
+ version = package['version']
10
+
11
+ source = { :git => 'https://github.com/facebook/react-native.git' }
12
+ if version == '1000.0.0'
13
+ # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
14
+ source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
15
+ else
16
+ source[:tag] = "v#{version}"
17
+ end
18
+
19
+ header_search_paths = []
20
+
21
+ if ENV['USE_FRAMEWORKS']
22
+ header_search_paths << "\"$(PODS_TARGET_SRCROOT)/../../..\"" # this is needed to allow the module access its own files
23
+ end
24
+
25
+ Pod::Spec.new do |s|
26
+ s.name = "React-webperformancenativemodule"
27
+ s.version = version
28
+ s.summary = "React Native idle callbacks native module"
29
+ s.homepage = "https://reactnative.dev/"
30
+ s.license = package["license"]
31
+ s.author = "Meta Platforms, Inc. and its affiliates"
32
+ s.platforms = min_supported_versions
33
+ s.source = source
34
+ s.source_files = podspec_sources("*.{cpp,h}", "*.h")
35
+ s.header_dir = "react/nativemodule/webperformance"
36
+ s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
37
+ "HEADER_SEARCH_PATHS" => header_search_paths.join(' '),
38
+ "OTHER_CFLAGS" => "$(inherited)",
39
+ "DEFINES_MODULE" => "YES" }
40
+
41
+ if ENV['USE_FRAMEWORKS']
42
+ s.module_name = "webperformancenativemodule"
43
+ s.header_mappings_dir = "../.."
44
+ end
45
+
46
+ s.dependency "React-jsi"
47
+ s.dependency "React-jsiexecutor"
48
+
49
+ depend_on_js_engine(s)
50
+ add_rn_third_party_dependencies(s)
51
+ add_rncore_dependency(s)
52
+
53
+ s.dependency "ReactCommon/turbomodule/core"
54
+ add_dependency(s, "React-RCTFBReactNativeSpec")
55
+ add_dependency(s, "React-performancetimeline")
56
+ add_dependency(s, "React-runtimeexecutor", :additional_framework_paths => ["platform/ios"])
57
+
58
+ end
@@ -18,6 +18,10 @@ add_library(bridgeless
18
18
  target_compile_reactnative_options(bridgeless PRIVATE)
19
19
  if(${CMAKE_BUILD_TYPE} MATCHES Debug OR REACT_NATIVE_DEBUG_OPTIMIZED)
20
20
  target_compile_options(bridgeless PRIVATE -DHERMES_ENABLE_DEBUGGER=1)
21
+
22
+ if (HERMES_V1_ENABLED)
23
+ target_compile_options(bridgeless PRIVATE -DHERMES_V1_ENABLED=1)
24
+ endif()
21
25
  endif ()
22
26
  target_include_directories(bridgeless PUBLIC .)
23
27
 
@@ -35,4 +35,8 @@ if(${CMAKE_BUILD_TYPE} MATCHES Debug OR REACT_NATIVE_DEBUG_OPTIMIZED)
35
35
  PRIVATE
36
36
  -DHERMES_ENABLE_DEBUGGER=1
37
37
  )
38
+
39
+ if (HERMES_V1_ENABLED)
40
+ target_compile_options(bridgelesshermes PRIVATE -DHERMES_V1_ENABLED=1)
41
+ endif()
38
42
  endif()
@@ -14,7 +14,11 @@
14
14
 
15
15
  #ifdef HERMES_ENABLE_DEBUGGER
16
16
  #include <hermes/inspector-modern/chrome/Registration.h>
17
+
18
+ #ifndef HERMES_V1_ENABLED
17
19
  #include <hermes/inspector/RuntimeAdapter.h>
20
+ #endif
21
+
18
22
  #include <jsi/decorator.h>
19
23
  #endif
20
24
 
@@ -23,7 +27,7 @@ using namespace facebook::jsi;
23
27
 
24
28
  namespace facebook::react {
25
29
 
26
- #ifdef HERMES_ENABLE_DEBUGGER
30
+ #if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED)
27
31
 
28
32
  // Wrapper that strongly retains the HermesRuntime for on device debugging.
29
33
  //
@@ -90,7 +94,7 @@ class DecoratedRuntime : public jsi::RuntimeDecorator<jsi::Runtime> {
90
94
  inspector_modern::chrome::DebugSessionToken debugToken_;
91
95
  };
92
96
 
93
- #endif
97
+ #endif // defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED)
94
98
 
95
99
  class HermesJSRuntime : public JSRuntime {
96
100
  public:
@@ -157,7 +161,7 @@ std::unique_ptr<JSRuntime> HermesInstance::createJSRuntime(
157
161
  .getPropertyAsObject(*hermesRuntime, "prototype");
158
162
  errorPrototype.setProperty(*hermesRuntime, "jsEngine", "hermes");
159
163
 
160
- #ifdef HERMES_ENABLE_DEBUGGER
164
+ #if defined(HERMES_ENABLE_DEBUGGER) && !defined(HERMES_V1_ENABLED)
161
165
  auto& inspectorFlags = jsinspector_modern::InspectorFlags::getInstance();
162
166
  if (!inspectorFlags.getFuseboxEnabled()) {
163
167
  std::unique_ptr<DecoratedRuntime> decoratedRuntime =
@@ -201,6 +201,11 @@ class HighResTimeStamp {
201
201
  return HighResTimeStamp(chronoNow());
202
202
  }
203
203
 
204
+ static HighResDuration unsafeOriginFromUnixTimeStamp() noexcept {
205
+ static auto origin = computeUnsafeOriginFromUnixTimeStamp();
206
+ return origin;
207
+ }
208
+
204
209
  static constexpr HighResTimeStamp min() noexcept {
205
210
  return HighResTimeStamp(std::chrono::steady_clock::time_point::min());
206
211
  }
@@ -285,6 +290,13 @@ class HighResTimeStamp {
285
290
 
286
291
  std::chrono::steady_clock::time_point chronoTimePoint_;
287
292
 
293
+ static HighResDuration computeUnsafeOriginFromUnixTimeStamp() noexcept {
294
+ auto systemNow = std::chrono::system_clock::now();
295
+ auto steadyNow = std::chrono::steady_clock::now();
296
+ return HighResDuration(
297
+ systemNow.time_since_epoch() - steadyNow.time_since_epoch());
298
+ }
299
+
288
300
  #ifdef REACT_NATIVE_DEBUG
289
301
  static std::function<std::chrono::steady_clock::time_point()>&
290
302
  getTimeStampProvider() {
package/flow/bom.js.flow CHANGED
@@ -88,12 +88,169 @@ declare var navigator: Navigator;
88
88
  // https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp
89
89
  declare type DOMHighResTimeStamp = number;
90
90
 
91
+ type PerformanceEntryFilterOptions = {
92
+ entryType: string,
93
+ name: string,
94
+ ...
95
+ };
96
+
97
+ // https://www.w3.org/TR/performance-timeline-2/
98
+ declare class PerformanceEntry {
99
+ duration: DOMHighResTimeStamp;
100
+ entryType: string;
101
+ name: string;
102
+ startTime: DOMHighResTimeStamp;
103
+ toJSON(): string;
104
+ }
105
+
106
+ // https://w3c.github.io/user-timing/#performancemark
107
+ declare class PerformanceMark extends PerformanceEntry {
108
+ constructor(name: string, markOptions?: PerformanceMarkOptions): void;
109
+ +detail: mixed;
110
+ }
111
+
112
+ // https://w3c.github.io/user-timing/#performancemeasure
113
+ declare class PerformanceMeasure extends PerformanceEntry {
114
+ +detail: mixed;
115
+ }
116
+
117
+ // https://w3c.github.io/server-timing/#the-performanceservertiming-interface
118
+ declare class PerformanceServerTiming {
119
+ description: string;
120
+ duration: DOMHighResTimeStamp;
121
+ name: string;
122
+ toJSON(): string;
123
+ }
124
+
125
+ // https://www.w3.org/TR/resource-timing-2/#sec-performanceresourcetiming
126
+ // https://w3c.github.io/server-timing/#extension-to-the-performanceresourcetiming-interface
127
+ declare class PerformanceResourceTiming extends PerformanceEntry {
128
+ connectEnd: number;
129
+ connectStart: number;
130
+ decodedBodySize: number;
131
+ domainLookupEnd: number;
132
+ domainLookupStart: number;
133
+ encodedBodySize: number;
134
+ fetchStart: number;
135
+ initiatorType: string;
136
+ nextHopProtocol: string;
137
+ redirectEnd: number;
138
+ redirectStart: number;
139
+ requestStart: number;
140
+ responseEnd: number;
141
+ responseStart: number;
142
+ secureConnectionStart: number;
143
+ serverTiming: Array<PerformanceServerTiming>;
144
+ transferSize: number;
145
+ workerStart: number;
146
+ }
147
+
148
+ // https://w3c.github.io/event-timing/#sec-performance-event-timing
149
+ declare class PerformanceEventTiming extends PerformanceEntry {
150
+ cancelable: boolean;
151
+ interactionId: number;
152
+ processingEnd: number;
153
+ processingStart: number;
154
+ target: ?Node;
155
+ }
156
+
157
+ // https://w3c.github.io/longtasks/#taskattributiontiming
158
+ declare class TaskAttributionTiming extends PerformanceEntry {
159
+ containerId: string;
160
+ containerName: string;
161
+ containerSrc: string;
162
+ containerType: string;
163
+ }
164
+
165
+ // https://w3c.github.io/longtasks/#sec-PerformanceLongTaskTiming
166
+ declare class PerformanceLongTaskTiming extends PerformanceEntry {
167
+ attribution: $ReadOnlyArray<TaskAttributionTiming>;
168
+ }
169
+
170
+ // https://www.w3.org/TR/user-timing/#extensions-performance-interface
171
+ declare type PerformanceMarkOptions = {
172
+ detail?: mixed,
173
+ startTime?: number,
174
+ };
175
+
176
+ declare type PerformanceMeasureOptions = {
177
+ detail?: mixed,
178
+ duration?: number,
179
+ end?: number | string,
180
+ start?: number | string,
181
+ };
182
+
183
+ type EventCountsForEachCallbackType =
184
+ | (() => void)
185
+ | ((value: number) => void)
186
+ | ((value: number, key: string) => void)
187
+ | ((value: number, key: string, map: Map<string, number>) => void);
188
+
189
+ // https://www.w3.org/TR/event-timing/#eventcounts
190
+ declare interface EventCounts {
191
+ entries(): Iterator<[string, number]>;
192
+
193
+ forEach(callback: EventCountsForEachCallbackType): void;
194
+ get(key: string): ?number;
195
+ has(key: string): boolean;
196
+ keys(): Iterator<string>;
197
+ size: number;
198
+ values(): Iterator<number>;
199
+ }
200
+
91
201
  declare class Performance {
92
- now: () => DOMHighResTimeStamp;
202
+ +eventCounts: EventCounts;
203
+ +timeOrigin: DOMHighResTimeStamp;
204
+
205
+ clearMarks(name?: string): void;
206
+ clearMeasures(name?: string): void;
207
+ getEntries: (
208
+ options?: PerformanceEntryFilterOptions,
209
+ ) => Array<PerformanceEntry>;
210
+ getEntriesByName: (name: string, type?: string) => Array<PerformanceEntry>;
211
+ getEntriesByType: (type: string) => Array<PerformanceEntry>;
212
+ mark(name: string, options?: PerformanceMarkOptions): PerformanceMark;
213
+ measure(
214
+ name: string,
215
+ startMarkOrOptions?: string | PerformanceMeasureOptions,
216
+ endMark?: string,
217
+ ): PerformanceMeasure;
218
+ now(): DOMHighResTimeStamp;
219
+ toJSON(): string;
93
220
  }
94
221
 
95
222
  declare var performance: Performance;
96
223
 
224
+ type PerformanceEntryList = Array<PerformanceEntry>;
225
+
226
+ declare interface PerformanceObserverEntryList {
227
+ getEntries(): PerformanceEntryList;
228
+ getEntriesByName(name: string, type: ?string): PerformanceEntryList;
229
+ getEntriesByType(type: string): PerformanceEntryList;
230
+ }
231
+
232
+ type PerformanceObserverInit = {
233
+ buffered?: boolean,
234
+ entryTypes?: Array<string>,
235
+ type?: string,
236
+ ...
237
+ };
238
+
239
+ declare class PerformanceObserver {
240
+ constructor(
241
+ callback: (
242
+ entries: PerformanceObserverEntryList,
243
+ observer: PerformanceObserver,
244
+ ) => mixed,
245
+ ): void;
246
+
247
+ disconnect(): void;
248
+ observe(options: ?PerformanceObserverInit): void;
249
+ static supportedEntryTypes: Array<string>;
250
+
251
+ takeRecords(): PerformanceEntryList;
252
+ }
253
+
97
254
  type FormDataEntryValue = string | File;
98
255
 
99
256
  declare class FormData {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native",
3
- "version": "0.82.0-rc.0",
3
+ "version": "0.82.0-rc.3",
4
4
  "description": "A framework for building native apps using React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -162,13 +162,13 @@
162
162
  },
163
163
  "dependencies": {
164
164
  "@jest/create-cache-key-function": "^29.7.0",
165
- "@react-native/assets-registry": "0.82.0-rc.0",
166
- "@react-native/codegen": "0.82.0-rc.0",
167
- "@react-native/community-cli-plugin": "0.82.0-rc.0",
168
- "@react-native/gradle-plugin": "0.82.0-rc.0",
169
- "@react-native/js-polyfills": "0.82.0-rc.0",
170
- "@react-native/normalize-colors": "0.82.0-rc.0",
171
- "@react-native/virtualized-lists": "0.82.0-rc.0",
165
+ "@react-native/assets-registry": "0.82.0-rc.3",
166
+ "@react-native/codegen": "0.82.0-rc.3",
167
+ "@react-native/community-cli-plugin": "0.82.0-rc.3",
168
+ "@react-native/gradle-plugin": "0.82.0-rc.3",
169
+ "@react-native/js-polyfills": "0.82.0-rc.3",
170
+ "@react-native/normalize-colors": "0.82.0-rc.3",
171
+ "@react-native/virtualized-lists": "0.82.0-rc.3",
172
172
  "abort-controller": "^3.0.0",
173
173
  "anser": "^1.4.9",
174
174
  "ansi-regex": "^5.0.0",
@@ -178,6 +178,7 @@
178
178
  "commander": "^12.0.0",
179
179
  "flow-enums-runtime": "^0.0.6",
180
180
  "glob": "^7.1.1",
181
+ "hermes-compiler": "0.0.0",
181
182
  "invariant": "^2.2.4",
182
183
  "jest-environment-node": "^29.7.0",
183
184
  "memoize-one": "^5.0.0",
@@ -40,6 +40,12 @@ def list_native_modules!(config_command)
40
40
  packages = config["dependencies"]
41
41
  ios_project_root = Pathname.new(config["project"]["ios"]["sourceDir"])
42
42
  react_native_path = Pathname.new(config["reactNativePath"])
43
+ codegen_output_path = ios_project_root.join("build/generated/autolinking/autolinking.json")
44
+
45
+ # Write autolinking react-native-config output to codegen folder
46
+ FileUtils.mkdir_p(File.dirname(codegen_output_path))
47
+ File.write(codegen_output_path, json)
48
+
43
49
  found_pods = []
44
50
 
45
51
  packages.each do |package_name, package|
@@ -87,7 +87,7 @@ class CodegenUtils
87
87
  codegen_path = file_manager.join(ios_folder, codegen_dir)
88
88
  return if !dir_manager.exist?(codegen_path)
89
89
 
90
- FileUtils.rm_rf(dir_manager.glob("#{codegen_path}/*"))
90
+ FileUtils.rm_rf("#{codegen_path}")
91
91
  base_provider_path = file_manager.join(rn_path, 'React', 'Fabric', 'RCTThirdPartyFabricComponentsProvider')
92
92
  FileUtils.rm_rf("#{base_provider_path}.h")
93
93
  FileUtils.rm_rf("#{base_provider_path}.mm")
@@ -13,7 +13,8 @@ def setup_hermes!(react_native_path: "../node_modules/react-native")
13
13
  react_native_dir = Pod::Config.instance.installation_root.join(react_native_path)
14
14
  # This `:tag => hermestag` below is only to tell CocoaPods to update hermes-engine when React Native version changes.
15
15
  # We have custom logic to compute the source for hermes-engine. See sdks/hermes-engine/*
16
- hermestag_file = File.join(react_native_dir, "sdks", ".hermesversion")
16
+ hermestag_file_name = ENV['RCT_HERMES_V1_ENABLED'] == "1" ? ".hermesv1version" : ".hermesversion"
17
+ hermestag_file = File.join(react_native_dir, "sdks", hermestag_file_name)
17
18
  hermestag = File.exist?(hermestag_file) ? File.read(hermestag_file).strip : ''
18
19
  pod 'hermes-engine', :podspec => "#{react_native_path}/sdks/hermes-engine/hermes-engine.podspec", :tag => hermestag
19
20
  pod 'React-hermes', :path => "#{react_native_path}/ReactCommon/hermes"
@@ -45,9 +45,15 @@ class ReactNativePodsUtils
45
45
  end
46
46
 
47
47
  def self.set_gcc_preprocessor_definition_for_React_hermes(installer)
48
- self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "React-hermes", :debug)
48
+ if ENV['RCT_HERMES_V1_ENABLED'] == "1"
49
+ self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1 HERMES_V1_ENABLED=1", "React-hermes", :debug)
50
+ self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1 HERMES_V1_ENABLED=1", "React-RuntimeHermes", :debug)
51
+ else
52
+ self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "React-hermes", :debug)
53
+ self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "React-RuntimeHermes", :debug)
54
+ end
55
+
49
56
  self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "hermes-engine", :debug)
50
- self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "HERMES_ENABLE_DEBUGGER=1", "React-RuntimeHermes", :debug)
51
57
  end
52
58
 
53
59
  def self.set_gcc_preprocessor_definition_for_debugger(installer)
@@ -86,16 +86,19 @@ function execute(
86
86
  buildCodegenIfNeeded();
87
87
  }
88
88
 
89
- const reactNativeConfig = readReactNativeConfig(projectRoot);
89
+ const reactNativeConfig = readReactNativeConfig(
90
+ projectRoot,
91
+ baseOutputPath,
92
+ );
90
93
  const codegenEnabledLibraries = findCodegenEnabledLibraries(
91
94
  pkgJson,
92
95
  projectRoot,
96
+ baseOutputPath,
93
97
  reactNativeConfig,
94
98
  );
95
99
 
96
100
  if (codegenEnabledLibraries.length === 0) {
97
101
  codegenLog('No codegen-enabled libraries found.', true);
98
- return;
99
102
  }
100
103
 
101
104
  let platforms =
@@ -110,10 +113,6 @@ function execute(
110
113
  ({name}) => !disabledLibraries.includes(name),
111
114
  );
112
115
 
113
- if (!libraries.length) {
114
- continue;
115
- }
116
-
117
116
  const outputPath = computeOutputPath(
118
117
  projectRoot,
119
118
  baseOutputPath,
@@ -97,15 +97,40 @@ function cleanupEmptyFilesAndFolders(filepath /*: string */) {
97
97
  }
98
98
  }
99
99
 
100
- function readReactNativeConfig(projectRoot /*: string */) /*: $FlowFixMe */ {
101
- const rnConfigFilePath = path.resolve(projectRoot, 'react-native.config.js');
100
+ function readGeneratedAutolinkingOutput(
101
+ baseOutputPath /*: string */,
102
+ ) /*: $FlowFixMe */ {
103
+ // NOTE: Generated by scripts/cocoapods/autolinking.rb in list_native_modules (called by use_native_modules)
104
+ const autolinkingGeneratedPath = path.resolve(
105
+ baseOutputPath,
106
+ 'build/generated/autolinking/autolinking.json',
107
+ );
108
+ if (fs.existsSync(autolinkingGeneratedPath)) {
109
+ // $FlowFixMe[unsupported-syntax]
110
+ return require(autolinkingGeneratedPath);
111
+ } else {
112
+ codegenLog(
113
+ `Could not find generated autolinking output at: ${autolinkingGeneratedPath}`,
114
+ );
115
+ return null;
116
+ }
117
+ }
102
118
 
103
- if (!fs.existsSync(rnConfigFilePath)) {
119
+ function readReactNativeConfig(
120
+ projectRoot /*: string */,
121
+ baseOutputPath /*: string */,
122
+ ) /*: $FlowFixMe */ {
123
+ const autolinkingOutput = readGeneratedAutolinkingOutput(baseOutputPath);
124
+ const rnConfigFilePath = path.resolve(projectRoot, 'react-native.config.js');
125
+ if (autolinkingOutput) {
126
+ return autolinkingOutput;
127
+ } else if (fs.existsSync(rnConfigFilePath)) {
128
+ // $FlowFixMe[unsupported-syntax]
129
+ return require(rnConfigFilePath);
130
+ } else {
131
+ codegenLog(`Could not find React Native config at: ${rnConfigFilePath}`);
104
132
  return {};
105
133
  }
106
-
107
- // $FlowFixMe[unsupported-syntax]
108
- return require(rnConfigFilePath);
109
134
  }
110
135
 
111
136
  /**
@@ -114,17 +139,23 @@ function readReactNativeConfig(projectRoot /*: string */) /*: $FlowFixMe */ {
114
139
  function findCodegenEnabledLibraries(
115
140
  pkgJson /*: $FlowFixMe */,
116
141
  projectRoot /*: string */,
142
+ baseOutputPath /*: string */,
117
143
  reactNativeConfig /*: $FlowFixMe */,
118
144
  ) /*: Array<$FlowFixMe> */ {
119
145
  const projectLibraries = findProjectRootLibraries(pkgJson, projectRoot);
120
146
  if (pkgJsonIncludesGeneratedCode(pkgJson)) {
121
147
  return projectLibraries;
122
148
  } else {
123
- return [
124
- ...projectLibraries,
125
- ...findExternalLibraries(pkgJson, projectRoot),
149
+ const libraries = [...projectLibraries];
150
+ // If we ran autolinking, we shouldn't try to run our own "autolinking-like"
151
+ // library discovery
152
+ if (!readGeneratedAutolinkingOutput(baseOutputPath)) {
153
+ libraries.push(...findExternalLibraries(pkgJson, projectRoot));
154
+ }
155
+ libraries.push(
126
156
  ...findLibrariesFromReactNativeConfig(projectRoot, reactNativeConfig),
127
- ];
157
+ );
158
+ return libraries;
128
159
  }
129
160
  }
130
161
 
@@ -142,6 +142,7 @@ def use_react_native! (
142
142
  pod 'React-featureflagsnativemodule', :path => "#{prefix}/ReactCommon/react/nativemodule/featureflags"
143
143
  pod 'React-microtasksnativemodule', :path => "#{prefix}/ReactCommon/react/nativemodule/microtasks"
144
144
  pod 'React-idlecallbacksnativemodule', :path => "#{prefix}/ReactCommon/react/nativemodule/idlecallbacks"
145
+ pod 'React-webperformancenativemodule', :path => "#{prefix}/ReactCommon/react/nativemodule/webperformance"
145
146
  pod 'React-domnativemodule', :path => "#{prefix}/ReactCommon/react/nativemodule/dom"
146
147
  pod 'React-defaultsnativemodule', :path => "#{prefix}/ReactCommon/react/nativemodule/defaults"
147
148
  pod 'React-Mapbuffer', :path => "#{prefix}/ReactCommon"
@@ -10,7 +10,7 @@
10
10
 
11
11
  'use strict';
12
12
 
13
- const {execSync} = require('child_process');
13
+ const {spawnSync} = require('child_process');
14
14
  const fs = require('fs');
15
15
  const yargs = require('yargs');
16
16
 
@@ -67,7 +67,9 @@ function replaceRNCoreConfiguration(
67
67
  fs.mkdirSync(finalLocation, {recursive: true});
68
68
 
69
69
  console.log('Extracting the tarball', tarballURLPath);
70
- execSync(`tar -xf ${tarballURLPath} -C ${finalLocation}`);
70
+ spawnSync('tar', ['-xf', tarballURLPath, '-C', finalLocation], {
71
+ stdio: 'inherit',
72
+ });
71
73
  }
72
74
 
73
75
  function updateLastBuildConfiguration(configuration /*: string */) {
@@ -20,8 +20,14 @@ end
20
20
 
21
21
  # package.json
22
22
  package = JSON.parse(File.read(File.join(react_native_path, "package.json")))
23
+ # TODO: T231755000 read hermes version from version.properties when consuming hermes
23
24
  version = package['version']
24
25
 
26
+ if ENV['RCT_HERMES_V1_ENABLED'] == "1"
27
+ versionProperties = Hash[*File.read("version.properties").split(/[=\n]+/)]
28
+ version = versionProperties['HERMES_V1_VERSION_NAME']
29
+ end
30
+
25
31
  source_type = hermes_source_type(version, react_native_path)
26
32
  source = podspec_source(source_type, version, react_native_path)
27
33
 
@@ -62,6 +68,21 @@ Pod::Spec.new do |spec|
62
68
  ss.osx.vendored_frameworks = "destroot/Library/Frameworks/macosx/hermesvm.framework"
63
69
  end
64
70
 
71
+ # When using the local prebuilt tarball, it should include hermesc compatible with the used VM.
72
+ # In other cases, when using Hermes V1, the prebuilt versioned binaries can be used.
73
+ # TODO: T236142916 hermesc should be consumed from NPM even when not using Hermes V1
74
+ if source_type != HermesEngineSourceType::LOCAL_PREBUILT_TARBALL && ENV['RCT_HERMES_V1_ENABLED'] == "1"
75
+ hermes_compiler_path = File.dirname(Pod::Executable.execute_command('node', ['-p',
76
+ 'require.resolve(
77
+ "hermes-compiler",
78
+ {paths: [process.argv[1]]}
79
+ )', __dir__]).strip
80
+ )
81
+
82
+ spec.user_target_xcconfig = {
83
+ 'HERMES_CLI_PATH' => "#{hermes_compiler_path}/osx-bin/hermesc"
84
+ }
85
+ end
65
86
 
66
87
  # Right now, even reinstalling pods with the PRODUCTION flag turned on, does not change the version of hermes that is downloaded
67
88
  # To remove the PRODUCTION flag, we want to download the right version of hermes on the flight
@@ -100,24 +121,26 @@ Pod::Spec.new do |spec|
100
121
  ss.header_dir = 'hermes/cdp'
101
122
  end
102
123
 
103
- spec.subspec 'inspector' do |ss|
104
- ss.source_files = ''
105
- ss.public_header_files = 'API/hermes/inspector/*.h'
106
- ss.header_dir = 'hermes/inspector'
107
- end
108
-
109
- spec.subspec 'inspector_chrome' do |ss|
110
- ss.source_files = ''
111
- ss.public_header_files = 'API/hermes/inspector/chrome/*.h'
112
- ss.header_dir = 'hermes/inspector/chrome'
113
- end
114
-
115
124
  spec.subspec 'Public' do |ss|
116
125
  ss.source_files = ''
117
126
  ss.public_header_files = 'public/hermes/Public/*.h'
118
127
  ss.header_dir = 'hermes/Public'
119
128
  end
120
129
 
130
+ if ENV['RCT_HERMES_V1_ENABLED'] != "1"
131
+ spec.subspec 'inspector' do |ss|
132
+ ss.source_files = ''
133
+ ss.public_header_files = 'API/hermes/inspector/*.h'
134
+ ss.header_dir = 'hermes/inspector'
135
+ end
136
+
137
+ spec.subspec 'inspector_chrome' do |ss|
138
+ ss.source_files = ''
139
+ ss.public_header_files = 'API/hermes/inspector/chrome/*.h'
140
+ ss.header_dir = 'hermes/inspector/chrome'
141
+ end
142
+ end
143
+
121
144
  hermesc_path = "${PODS_ROOT}/hermes-engine/build_host_hermesc"
122
145
 
123
146
  if ENV.has_key?('HERMES_OVERRIDE_HERMESC_PATH') && File.exist?(ENV['HERMES_OVERRIDE_HERMESC_PATH']) then