react-native-tvos 0.83.6-0 → 0.83.10-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 (208) hide show
  1. package/Libraries/ActionSheetIOS/React-RCTActionSheet.podspec +1 -1
  2. package/Libraries/Animated/components/AnimatedScrollView.js +1 -1
  3. package/Libraries/AppDelegate/React-RCTAppDelegate.podspec +1 -1
  4. package/Libraries/Blob/React-RCTBlob.podspec +1 -1
  5. package/Libraries/Components/Button.js +2 -2
  6. package/Libraries/Components/ScrollView/ScrollView.d.ts +1 -1
  7. package/Libraries/Components/ScrollView/ScrollView.js +1 -1
  8. package/Libraries/Components/TV/TVViewPropTypes.js +9 -0
  9. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +1 -1
  10. package/Libraries/Components/TextInput/TextInput.flow.js +1 -1
  11. package/Libraries/Components/Touchable/Touchable.d.ts +1 -1
  12. package/Libraries/Components/View/View.js +7 -3
  13. package/Libraries/Components/View/ViewAccessibility.d.ts +1 -1
  14. package/Libraries/Components/View/ViewAccessibility.js +1 -1
  15. package/Libraries/Core/ReactNativeVersion.js +1 -1
  16. package/Libraries/Core/Timers/JSTimers.js +1 -1
  17. package/Libraries/Core/setUpNavigator.js +1 -1
  18. package/Libraries/EventEmitter/RCTNativeAppEventEmitter.d.ts +1 -1
  19. package/Libraries/FBLazyVector/FBLazyVector.podspec +1 -1
  20. package/Libraries/Image/ImageSource.d.ts +1 -1
  21. package/Libraries/Image/RCTImageLoader.mm +1 -1
  22. package/Libraries/Image/React-RCTImage.podspec +1 -1
  23. package/Libraries/Interaction/PanResponder.js +1 -1
  24. package/Libraries/LinkingIOS/React-RCTLinking.podspec +1 -1
  25. package/Libraries/NativeAnimation/React-RCTAnimation.podspec +1 -1
  26. package/Libraries/NativeComponent/TVViewConfig.js +1 -0
  27. package/Libraries/Network/React-RCTNetwork.podspec +1 -1
  28. package/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec +1 -1
  29. package/Libraries/Renderer/README.md +2 -2
  30. package/Libraries/Required/RCTRequired.podspec +1 -1
  31. package/Libraries/Settings/React-RCTSettings.podspec +1 -1
  32. package/Libraries/Text/React-RCTText.podspec +1 -1
  33. package/Libraries/TypeSafety/RCTTypeSafety.podspec +1 -1
  34. package/Libraries/Utilities/PolyfillFunctions.js +1 -1
  35. package/Libraries/Vibration/React-RCTVibration.podspec +1 -1
  36. package/README-core.md +6 -6
  37. package/README.md +13 -1
  38. package/React/Base/RCTVersion.m +1 -1
  39. package/React/CoreModules/RCTJscSafeUrl+Internal.h +23 -0
  40. package/React/CoreModules/RCTJscSafeUrl.mm +38 -0
  41. package/React/CoreModules/RCTRedBox+Internal.h +42 -0
  42. package/React/CoreModules/RCTRedBox.mm +30 -471
  43. package/React/CoreModules/RCTRedBox2AnsiParser+Internal.h +22 -0
  44. package/React/CoreModules/RCTRedBox2AnsiParser.mm +55 -0
  45. package/React/CoreModules/RCTRedBox2Controller+Internal.h +34 -0
  46. package/React/CoreModules/RCTRedBox2Controller.mm +764 -0
  47. package/React/CoreModules/RCTRedBox2ErrorParser+Internal.h +46 -0
  48. package/React/CoreModules/RCTRedBox2ErrorParser.mm +57 -0
  49. package/React/CoreModules/RCTRedBoxController+Internal.h +31 -0
  50. package/React/CoreModules/RCTRedBoxController.mm +447 -0
  51. package/React/CoreModules/RCTRedBoxHMRClient+Internal.h +26 -0
  52. package/React/CoreModules/RCTRedBoxHMRClient.mm +125 -0
  53. package/React/CoreModules/React-CoreModules.podspec +2 -1
  54. package/React/FBReactNativeSpec/FBReactNativeSpecJSI.h +24 -0
  55. package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +49 -17
  56. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +12 -1
  57. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +35 -7
  58. package/React/React-RCTFBReactNativeSpec.podspec +1 -1
  59. package/React/React-RCTFabric.podspec +1 -1
  60. package/React/Runtime/React-RCTRuntime.podspec +1 -1
  61. package/React/Tests/Mounting/RCTViewComponentViewTests.mm +145 -0
  62. package/React/Views/ScrollView/RCTScrollView.m +1 -1
  63. package/React-Core.podspec +1 -1
  64. package/React.podspec +1 -1
  65. package/ReactAndroid/build.gradle.kts +1 -1
  66. package/ReactAndroid/gradle.properties +1 -1
  67. package/ReactAndroid/hermes-engine/build.gradle.kts +6 -0
  68. package/ReactAndroid/publish.gradle +20 -46
  69. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/CxxInspectorPackagerConnection.kt +99 -9
  70. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/inspector/InspectorNetworkHelper.kt +1 -1
  71. package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java +2 -2
  72. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +19 -1
  73. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +31 -1
  74. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +7 -1
  75. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +7 -1
  76. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +34 -1
  77. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +7 -1
  78. package/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.kt +1 -1
  79. package/ReactAndroid/src/main/java/com/facebook/react/modules/core/ReactAndroidHWInputDeviceHelper.java +1 -0
  80. package/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.kt +1 -1
  81. package/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.kt +3 -3
  82. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
  83. package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.kt +1 -1
  84. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java +1 -1
  85. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +14 -4
  86. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java +14 -4
  87. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewHelper.kt +46 -6
  88. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewManager.kt +1 -1
  89. package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java +1 -1
  90. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.kt +2 -2
  91. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.kt +2 -2
  92. package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextSelectionWatcher.kt +1 -1
  93. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.kt +1 -0
  94. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.kt +5 -0
  95. package/ReactAndroid/src/main/jni/CMakeLists.txt +7 -0
  96. package/ReactAndroid/src/main/jni/react/devsupport/JCxxInspectorPackagerConnectionWebSocket.cpp +29 -2
  97. package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +43 -1
  98. package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +10 -1
  99. package/ReactApple/Libraries/RCTFoundation/RCTDeprecation/RCTDeprecation.podspec +1 -1
  100. package/ReactApple/RCTSwiftUI/RCTSwiftUI.podspec +1 -1
  101. package/ReactApple/RCTSwiftUIWrapper/RCTSwiftUIWrapper.podspec +1 -1
  102. package/ReactCommon/React-Fabric.podspec +7 -1
  103. package/ReactCommon/React-FabricComponents.podspec +1 -1
  104. package/ReactCommon/React-FabricImage.podspec +1 -1
  105. package/ReactCommon/React-Mapbuffer.podspec +1 -1
  106. package/ReactCommon/ReactCommon.podspec +1 -1
  107. package/ReactCommon/callinvoker/React-callinvoker.podspec +1 -1
  108. package/ReactCommon/cxxreact/React-cxxreact.podspec +1 -1
  109. package/ReactCommon/cxxreact/ReactNativeVersion.h +2 -2
  110. package/ReactCommon/hermes/React-hermes.podspec +1 -1
  111. package/ReactCommon/hermes/executor/React-jsitracing.podspec +1 -1
  112. package/ReactCommon/jserrorhandler/React-jserrorhandler.podspec +1 -1
  113. package/ReactCommon/jsi/React-jsi.podspec +1 -1
  114. package/ReactCommon/jsiexecutor/React-jsiexecutor.podspec +1 -1
  115. package/ReactCommon/jsinspector-modern/InspectorInterfaces.cpp +7 -3
  116. package/ReactCommon/jsinspector-modern/React-jsinspector.podspec +1 -1
  117. package/ReactCommon/jsinspector-modern/TracingAgent.cpp +1 -5
  118. package/ReactCommon/jsinspector-modern/cdp/React-jsinspectorcdp.podspec +1 -1
  119. package/ReactCommon/jsinspector-modern/network/React-jsinspectornetwork.podspec +1 -1
  120. package/ReactCommon/jsinspector-modern/tracing/React-jsinspectortracing.podspec +1 -1
  121. package/ReactCommon/jsitooling/React-jsitooling.podspec +1 -1
  122. package/ReactCommon/logger/React-logger.podspec +1 -1
  123. package/ReactCommon/oscompat/React-oscompat.podspec +1 -1
  124. package/ReactCommon/react/debug/CMakeLists.txt +2 -1
  125. package/ReactCommon/react/debug/React-debug.podspec +8 -2
  126. package/ReactCommon/react/debug/redbox/AnsiParser.cpp +139 -0
  127. package/ReactCommon/react/debug/redbox/AnsiParser.h +35 -0
  128. package/ReactCommon/react/debug/redbox/JscSafeUrl.cpp +179 -0
  129. package/ReactCommon/react/debug/redbox/JscSafeUrl.h +27 -0
  130. package/ReactCommon/react/debug/redbox/RedBoxErrorParser.cpp +171 -0
  131. package/ReactCommon/react/debug/redbox/RedBoxErrorParser.h +40 -0
  132. package/ReactCommon/react/debug/redbox/tests/AnsiParserTest.cpp +97 -0
  133. package/ReactCommon/react/debug/redbox/tests/JscSafeUrlTest.cpp +173 -0
  134. package/ReactCommon/react/debug/redbox/tests/RedBoxErrorParserTest.cpp +107 -0
  135. package/ReactCommon/react/featureflags/React-featureflags.podspec +1 -1
  136. package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +13 -1
  137. package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +16 -1
  138. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +106 -52
  139. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +8 -2
  140. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +13 -1
  141. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +28 -1
  142. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +4 -1
  143. package/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp +1 -1
  144. package/ReactCommon/react/nativemodule/core/platform/ios/React-NativeModulesApple.podspec +1 -1
  145. package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTInteropTurboModule.mm +1 -1
  146. package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm +1 -1
  147. package/ReactCommon/react/nativemodule/defaults/CMakeLists.txt +1 -0
  148. package/ReactCommon/react/nativemodule/defaults/DefaultTurboModules.cpp +7 -0
  149. package/ReactCommon/react/nativemodule/defaults/React-defaultsnativemodule.podspec +2 -1
  150. package/ReactCommon/react/nativemodule/dom/React-domnativemodule.podspec +1 -1
  151. package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +16 -1
  152. package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +7 -1
  153. package/ReactCommon/react/nativemodule/featureflags/React-featureflagsnativemodule.podspec +1 -1
  154. package/ReactCommon/react/nativemodule/idlecallbacks/React-idlecallbacksnativemodule.podspec +1 -1
  155. package/ReactCommon/react/nativemodule/intersectionobserver/React-intersectionobservernativemodule.podspec +1 -1
  156. package/ReactCommon/react/nativemodule/microtasks/React-microtasksnativemodule.podspec +1 -1
  157. package/ReactCommon/react/nativemodule/mutationobserver/NativeMutationObserver.h +4 -0
  158. package/ReactCommon/react/nativemodule/mutationobserver/React-mutationobservernativemodule.podspec +66 -0
  159. package/ReactCommon/react/nativemodule/samples/ReactCommon-Samples.podspec +1 -1
  160. package/ReactCommon/react/nativemodule/webperformance/React-webperformancenativemodule.podspec +1 -1
  161. package/ReactCommon/react/networking/React-networking.podspec +1 -1
  162. package/ReactCommon/react/performance/cdpmetrics/React-performancecdpmetrics.podspec +1 -1
  163. package/ReactCommon/react/performance/timeline/React-performancetimeline.podspec +1 -1
  164. package/ReactCommon/react/renderer/animated/internal/primitives.h +1 -1
  165. package/ReactCommon/react/renderer/components/view/BaseViewProps.cpp +7 -0
  166. package/ReactCommon/react/renderer/components/view/BaseViewProps.h +1 -0
  167. package/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.cpp +18 -0
  168. package/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.h +1 -0
  169. package/ReactCommon/react/renderer/consistency/React-rendererconsistency.podspec +1 -1
  170. package/ReactCommon/react/renderer/css/React-renderercss.podspec +1 -1
  171. package/ReactCommon/react/renderer/debug/React-rendererdebug.podspec +1 -1
  172. package/ReactCommon/react/renderer/graphics/React-graphics.podspec +1 -1
  173. package/ReactCommon/react/renderer/imagemanager/platform/ios/React-ImageManager.podspec +1 -1
  174. package/ReactCommon/react/renderer/mounting/internal/CullingContext.cpp +1 -1
  175. package/ReactCommon/react/renderer/runtimescheduler/React-runtimescheduler.podspec +1 -1
  176. package/ReactCommon/react/runtime/React-RuntimeCore.podspec +1 -1
  177. package/ReactCommon/react/runtime/React-RuntimeHermes.podspec +1 -1
  178. package/ReactCommon/react/runtime/platform/ios/React-RuntimeApple.podspec +1 -1
  179. package/ReactCommon/react/timing/React-timing.podspec +1 -1
  180. package/ReactCommon/react/utils/React-utils.podspec +1 -1
  181. package/ReactCommon/reactperflogger/React-perflogger.podspec +1 -1
  182. package/ReactCommon/runtimeexecutor/React-runtimeexecutor.podspec +1 -1
  183. package/ReactCommon/yoga/Yoga.podspec +2 -2
  184. package/ReactCommon/yoga/yoga/algorithm/AbsoluteLayout.cpp +2 -0
  185. package/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp +11 -7
  186. package/ReactCommon/yoga/yoga/algorithm/CalculateLayout.h +2 -0
  187. package/ReactCommon/yoga/yoga/node/Node.cpp +6 -1
  188. package/package.json +9 -9
  189. package/scripts/cocoapods/rncore.rb +26 -8
  190. package/scripts/cocoapods/rndependencies.rb +26 -5
  191. package/scripts/cocoapods/spm.rb +1 -1
  192. package/scripts/cocoapods/utils.rb +2 -2
  193. package/scripts/codegen/templates/ReactAppDependencyProvider.podspec.template +1 -1
  194. package/scripts/codegen/templates/ReactCodegen.podspec.template +1 -1
  195. package/scripts/ios-configure-glog.sh +1 -1
  196. package/scripts/react_native_pods.rb +1 -0
  197. package/sdks/hermes-engine/hermes-engine.podspec +6 -1
  198. package/sdks/hermes-engine/hermes-utils.rb +27 -5
  199. package/src/private/featureflags/ReactNativeFeatureFlags.js +16 -1
  200. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +4 -1
  201. package/src/private/setup/setUpDefaultReactNativeEnvironment.js +6 -0
  202. package/src/private/types/HostInstance.js +1 -1
  203. package/src/types/globals.d.ts +2 -2
  204. package/third-party-podspecs/RCT-Folly.podspec +1 -1
  205. package/third-party-podspecs/ReactNativeDependencies.podspec +1 -1
  206. package/third-party-podspecs/glog.podspec +1 -1
  207. package/types/public/ReactNativeTVTypes.d.ts +9 -0
  208. package/types/public/ReactNativeTypes.d.ts +2 -2
@@ -8,7 +8,7 @@ require "json"
8
8
  package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json")))
9
9
  version = package['version']
10
10
 
11
- source = { :git => 'https://github.com/facebook/react-native.git' }
11
+ source = { :git => 'https://github.com/react/react-native.git' }
12
12
  if version == '1000.0.0'
13
13
  # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
14
14
  source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
@@ -8,7 +8,7 @@ require "json"
8
8
  package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json")))
9
9
  version = package['version']
10
10
 
11
- source = { :git => 'https://github.com/facebook/react-native.git' }
11
+ source = { :git => 'https://github.com/react/react-native.git' }
12
12
  if version == '1000.0.0'
13
13
  # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
14
14
  source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
@@ -143,9 +143,13 @@ int InspectorImpl::addPage(
143
143
  pageId,
144
144
  Page{pageId, description, vm, std::move(connectFunc), capabilities});
145
145
 
146
- for (const auto& listenerWeak : listeners_) {
147
- if (auto listener = listenerWeak.lock()) {
148
- listener->unstable_onHostTargetAdded();
146
+ // Strong assumption: If prefersFuseboxFrontend is set, the page added is a
147
+ // HostTarget and not a legacy Hermes runtime target.
148
+ if (capabilities.prefersFuseboxFrontend) {
149
+ for (const auto& listenerWeak : listeners_) {
150
+ if (auto listener = listenerWeak.lock()) {
151
+ listener->unstable_onHostTargetAdded();
152
+ }
149
153
  }
150
154
  }
151
155
 
@@ -8,7 +8,7 @@ require "json"
8
8
  package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json")))
9
9
  version = package['version']
10
10
 
11
- source = { :git => 'https://github.com/facebook/react-native.git' }
11
+ source = { :git => 'https://github.com/react/react-native.git' }
12
12
  if version == '1000.0.0'
13
13
  # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
14
14
  source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
@@ -26,12 +26,8 @@ const uint16_t TRACE_EVENT_CHUNK_SIZE = 1000;
26
26
  /**
27
27
  * The maximum number of ProfileChunk trace events
28
28
  * that will be sent in a single CDP Tracing.dataCollected message.
29
- * TODO(T219394401): Increase the size once we manage the queue on OkHTTP
30
- side
31
- * properly and avoid WebSocket disconnections when sending a message larger
32
- * than 16MB.
33
29
  */
34
- const uint16_t PROFILE_TRACE_EVENT_CHUNK_SIZE = 1;
30
+ const uint16_t PROFILE_TRACE_EVENT_CHUNK_SIZE = 10;
35
31
 
36
32
  } // namespace
37
33
 
@@ -8,7 +8,7 @@ require "json"
8
8
  package = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "package.json")))
9
9
  version = package['version']
10
10
 
11
- source = { :git => 'https://github.com/facebook/react-native.git' }
11
+ source = { :git => 'https://github.com/react/react-native.git' }
12
12
  if version == '1000.0.0'
13
13
  # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
14
14
  source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
@@ -8,7 +8,7 @@ require "json"
8
8
  package = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "package.json")))
9
9
  version = package['version']
10
10
 
11
- source = { :git => 'https://github.com/facebook/react-native.git' }
11
+ source = { :git => 'https://github.com/react/react-native.git' }
12
12
  if version == '1000.0.0'
13
13
  # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
14
14
  source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
@@ -8,7 +8,7 @@ require "json"
8
8
  package = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "package.json")))
9
9
  version = package['version']
10
10
 
11
- source = { :git => 'https://github.com/facebook/react-native.git' }
11
+ source = { :git => 'https://github.com/react/react-native.git' }
12
12
  if version == '1000.0.0'
13
13
  # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
14
14
  source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
@@ -8,7 +8,7 @@ require "json"
8
8
  package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json")))
9
9
  version = package['version']
10
10
 
11
- source = { :git => 'https://github.com/facebook/react-native.git' }
11
+ source = { :git => 'https://github.com/react/react-native.git' }
12
12
  if version == '1000.0.0'
13
13
  # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
14
14
  source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
@@ -9,7 +9,7 @@ require "json"
9
9
  package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json")))
10
10
  version = package['version']
11
11
 
12
- source = { :git => 'https://github.com/facebook/react-native.git' }
12
+ source = { :git => 'https://github.com/react/react-native.git' }
13
13
  if version == '1000.0.0'
14
14
  # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
15
15
  source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
@@ -8,7 +8,7 @@ require "json"
8
8
  package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json")))
9
9
  version = package['version']
10
10
 
11
- source = { :git => 'https://github.com/facebook/react-native.git' }
11
+ source = { :git => 'https://github.com/react/react-native.git' }
12
12
  if version == '1000.0.0'
13
13
  # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
14
14
  source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
@@ -9,7 +9,8 @@ set(CMAKE_VERBOSE_MAKEFILE on)
9
9
  include(${REACT_COMMON_DIR}/cmake-utils/react-native-flags.cmake)
10
10
 
11
11
  file(GLOB react_debug_SRC CONFIGURE_DEPENDS *.cpp)
12
- add_library(react_debug OBJECT ${react_debug_SRC})
12
+ file(GLOB react_debug_redbox_SRC CONFIGURE_DEPENDS redbox/*.cpp)
13
+ add_library(react_debug OBJECT ${react_debug_SRC} ${react_debug_redbox_SRC})
13
14
 
14
15
  target_include_directories(react_debug PUBLIC ${REACT_COMMON_DIR})
15
16
 
@@ -8,7 +8,7 @@ require "json"
8
8
  package = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "package.json")))
9
9
  version = package['version']
10
10
 
11
- source = { :git => 'https://github.com/facebook/react-native.git' }
11
+ source = { :git => 'https://github.com/react/react-native.git' }
12
12
  if version == '1000.0.0'
13
13
  # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
14
14
  source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
@@ -25,10 +25,16 @@ Pod::Spec.new do |s|
25
25
  s.author = "Meta Platforms, Inc. and its affiliates"
26
26
  s.platforms = min_supported_versions
27
27
  s.source = source
28
- s.source_files = podspec_sources("**/*.{cpp,h}", "**/*.h")
28
+ s.source_files = podspec_sources("*.{cpp,h}", "*.h")
29
29
  s.header_dir = "react/debug"
30
30
  s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
31
31
  "DEFINES_MODULE" => "YES" }
32
32
 
33
33
  resolve_use_frameworks(s, header_mappings_dir: "../..", module_name: "React_debug")
34
+
35
+ s.subspec "redbox" do |ss|
36
+ ss.source_files = podspec_sources("redbox/*.{cpp,h}", "redbox/*.h")
37
+ ss.exclude_files = "redbox/tests/**/*.{cpp,h}"
38
+ ss.header_dir = "react/debug/redbox"
39
+ end
34
40
  end
@@ -0,0 +1,139 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #include "AnsiParser.h"
9
+
10
+ #include <optional>
11
+
12
+ #include <regex> // NOLINT(facebook-hte-BadInclude-regex)
13
+
14
+ // @lint-ignore-every CLANGTIDY facebook-hte-StdRegexIsAwful
15
+ namespace facebook::react::unstable_redbox {
16
+
17
+ namespace {
18
+
19
+ // Afterglow theme colors (matching AnsiHighlight.js)
20
+ std::optional<AnsiColor> ansiColor(int code) {
21
+ switch (code) {
22
+ case 30:
23
+ return AnsiColor{.r = 27, .g = 27, .b = 27}; // black
24
+ case 31:
25
+ return AnsiColor{.r = 187, .g = 86, .b = 83}; // red
26
+ case 32:
27
+ return AnsiColor{.r = 144, .g = 157, .b = 98}; // green
28
+ case 33:
29
+ return AnsiColor{.r = 234, .g = 193, .b = 121}; // yellow
30
+ case 34:
31
+ return AnsiColor{.r = 125, .g = 169, .b = 199}; // blue
32
+ case 35:
33
+ return AnsiColor{.r = 176, .g = 101, .b = 151}; // magenta
34
+ case 36:
35
+ return AnsiColor{.r = 140, .g = 220, .b = 216}; // cyan
36
+ case 37:
37
+ return std::nullopt; // white = default
38
+ case 90:
39
+ return AnsiColor{.r = 98, .g = 98, .b = 98}; // bright black
40
+ case 91:
41
+ return AnsiColor{.r = 187, .g = 86, .b = 83}; // bright red
42
+ case 92:
43
+ return AnsiColor{.r = 144, .g = 157, .b = 98}; // bright green
44
+ case 93:
45
+ return AnsiColor{.r = 234, .g = 193, .b = 121}; // bright yellow
46
+ case 94:
47
+ return AnsiColor{.r = 125, .g = 169, .b = 199}; // bright blue
48
+ case 95:
49
+ return AnsiColor{.r = 176, .g = 101, .b = 151}; // bright magenta
50
+ case 96:
51
+ return AnsiColor{.r = 140, .g = 220, .b = 216}; // bright cyan
52
+ case 97:
53
+ return AnsiColor{.r = 247, .g = 247, .b = 247}; // bright white
54
+ default:
55
+ return std::nullopt;
56
+ }
57
+ }
58
+
59
+ const std::regex& ansiRegex() {
60
+ static const std::regex re(R"(\x1b\[([0-9;]*)m)");
61
+ return re;
62
+ }
63
+
64
+ int parseSgrCode(const std::string& params, size_t& pos) {
65
+ size_t next = params.find(';', pos);
66
+ if (next == std::string::npos) {
67
+ next = params.size();
68
+ }
69
+ int code = 0;
70
+ for (size_t i = pos; i < next; ++i) {
71
+ code = code * 10 + (params[i] - '0');
72
+ }
73
+ pos = next + 1;
74
+ return code;
75
+ }
76
+
77
+ } // namespace
78
+
79
+ std::vector<AnsiSpan> parseAnsi(const std::string& text) {
80
+ std::vector<AnsiSpan> spans;
81
+ std::optional<AnsiColor> currentFg;
82
+ std::optional<AnsiColor> currentBg;
83
+ auto it = std::sregex_iterator(text.begin(), text.end(), ansiRegex());
84
+ auto end = std::sregex_iterator();
85
+ size_t lastEnd = 0;
86
+
87
+ for (; it != end; ++it) {
88
+ const auto& match = *it;
89
+ auto matchStart = static_cast<size_t>(match.position());
90
+
91
+ if (matchStart > lastEnd) {
92
+ spans.push_back(
93
+ AnsiSpan{
94
+ .text = text.substr(lastEnd, matchStart - lastEnd),
95
+ .foregroundColor = currentFg,
96
+ .backgroundColor = currentBg});
97
+ }
98
+ lastEnd = matchStart + match.length();
99
+
100
+ std::string params = match[1].str();
101
+ // ESC[m (no params) is equivalent to ESC[0m (reset all attributes)
102
+ if (params.empty()) {
103
+ currentFg = std::nullopt;
104
+ currentBg = std::nullopt;
105
+ }
106
+ size_t pos = 0;
107
+ while (pos < params.size()) {
108
+ int code = parseSgrCode(params, pos);
109
+ if (code == 0) {
110
+ currentFg = std::nullopt;
111
+ currentBg = std::nullopt;
112
+ } else if ((code >= 30 && code <= 37) || (code >= 90 && code <= 97)) {
113
+ currentFg = ansiColor(code);
114
+ } else if ((code >= 40 && code <= 47) || (code >= 100 && code <= 107)) {
115
+ currentBg = ansiColor(code - 10);
116
+ } else if (code == 39) {
117
+ currentFg = std::nullopt;
118
+ } else if (code == 49) {
119
+ currentBg = std::nullopt;
120
+ }
121
+ }
122
+ }
123
+
124
+ if (lastEnd < text.size()) {
125
+ spans.push_back(
126
+ AnsiSpan{
127
+ .text = text.substr(lastEnd),
128
+ .foregroundColor = currentFg,
129
+ .backgroundColor = currentBg});
130
+ }
131
+
132
+ return spans;
133
+ }
134
+
135
+ std::string stripAnsi(const std::string& text) {
136
+ return std::regex_replace(text, ansiRegex(), "");
137
+ }
138
+
139
+ } // namespace facebook::react::unstable_redbox
@@ -0,0 +1,35 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include <optional>
11
+ #include <string>
12
+ #include <vector>
13
+
14
+ namespace facebook::react::unstable_redbox {
15
+
16
+ struct AnsiColor {
17
+ uint8_t r, g, b;
18
+ };
19
+
20
+ struct AnsiSpan {
21
+ std::string text;
22
+ std::optional<AnsiColor> foregroundColor;
23
+ std::optional<AnsiColor> backgroundColor;
24
+ };
25
+
26
+ /**
27
+ * Parse ANSI escape sequences in text and produce a list of styled spans.
28
+ * Uses the Afterglow color theme (matching LogBox's AnsiHighlight.js).
29
+ */
30
+ std::vector<AnsiSpan> parseAnsi(const std::string &text);
31
+
32
+ /** Strip all ANSI escape sequences from text. */
33
+ std::string stripAnsi(const std::string &text);
34
+
35
+ } // namespace facebook::react::unstable_redbox
@@ -0,0 +1,179 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #include "JscSafeUrl.h"
9
+
10
+ #include <cassert>
11
+ #include <regex> // NOLINT(facebook-hte-BadInclude-regex)
12
+ #include <stdexcept>
13
+ #include <string_view>
14
+
15
+ // @lint-ignore-every CLANGTIDY facebook-hte-StdRegexIsAwful
16
+
17
+ namespace facebook::react::unstable_redbox {
18
+
19
+ namespace {
20
+
21
+ // We use regex-based URL parsing as defined in RFC 3986 because it's easier to
22
+ // determine whether the input is a complete URI, a path-absolute or a
23
+ // path-rootless (as defined in the spec), and be as faithful to the input as
24
+ // possible. This will match any string, and does not imply validity.
25
+ //
26
+ // https://www.rfc-editor.org/rfc/rfc3986#appendix-B
27
+ const std::regex& uriRegex() {
28
+ static const std::regex re(
29
+ R"(^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?)");
30
+ return re;
31
+ }
32
+
33
+ struct ParsedUri {
34
+ std::string_view schemeAndAuthority;
35
+ std::string_view path;
36
+ bool hasQueryPart = false;
37
+ std::string_view queryWithoutQuestionMark;
38
+ std::string_view fragmentWithHash;
39
+ };
40
+
41
+ ParsedUri rfc3986Parse(std::string_view url) {
42
+ std::cmatch match;
43
+ if (!std::regex_match(
44
+ url.data(), url.data() + url.size(), match, uriRegex())) {
45
+ throw std::runtime_error("Unexpected error - failed to regex-match URL");
46
+ }
47
+
48
+ // match[1] = scheme with colon (e.g. "http:")
49
+ // match[3] = authority with slashes (e.g. "//host")
50
+ // match[5] = path
51
+ // match[6] = query with question mark (e.g. "?key=val")
52
+ // match[7] = query without question mark
53
+ // match[8] = fragment with hash (e.g. "#frag")
54
+
55
+ auto viewOf = [&](int group) -> std::string_view {
56
+ if (!match[group].matched) {
57
+ return {};
58
+ }
59
+ return {match[group].first, static_cast<size_t>(match[group].length())};
60
+ };
61
+
62
+ // schemeAndAuthority = (match[1] || "") + (match[3] || "")
63
+ // These are contiguous when both present, but may be individually absent.
64
+ std::string_view schemeAndAuthority;
65
+ if (match[1].matched && match[3].matched) {
66
+ assert(match[1].second == match[3].first);
67
+ schemeAndAuthority = {
68
+ match[1].first, static_cast<size_t>(match[3].second - match[1].first)};
69
+ } else if (match[1].matched) {
70
+ schemeAndAuthority = viewOf(1);
71
+ } else if (match[3].matched) {
72
+ schemeAndAuthority = viewOf(3);
73
+ }
74
+
75
+ return ParsedUri{
76
+ .schemeAndAuthority = schemeAndAuthority,
77
+ .path = viewOf(5),
78
+ .hasQueryPart = match[6].matched,
79
+ .queryWithoutQuestionMark = viewOf(7),
80
+ .fragmentWithHash = viewOf(8),
81
+ };
82
+ }
83
+
84
+ } // namespace
85
+
86
+ bool isJscSafeUrl(std::string_view url) {
87
+ return !rfc3986Parse(url).hasQueryPart;
88
+ }
89
+
90
+ std::string toNormalUrl(std::string url) {
91
+ auto parsed = rfc3986Parse(url);
92
+ auto markerPos = parsed.path.find("//&");
93
+ if (markerPos == std::string_view::npos) {
94
+ return url;
95
+ }
96
+
97
+ // path before //&, then ?, then path after //&
98
+ std::string_view pathBefore = parsed.path.substr(0, markerPos);
99
+ std::string_view pathAfter = parsed.path.substr(markerPos + 3);
100
+
101
+ // We don't expect JSC urls to also have query strings, but interpret
102
+ // liberally and append them.
103
+ bool hasExistingQuery = !parsed.queryWithoutQuestionMark.empty();
104
+
105
+ // Likewise, JSC URLs will usually have their fragments stripped, but
106
+ // preserve if we find one.
107
+ size_t totalSize = parsed.schemeAndAuthority.size() + pathBefore.size() +
108
+ 1 /* ? */ + pathAfter.size() +
109
+ (hasExistingQuery ? 1 + parsed.queryWithoutQuestionMark.size() : 0) +
110
+ parsed.fragmentWithHash.size();
111
+
112
+ std::string result;
113
+ result.reserve(totalSize);
114
+ result += parsed.schemeAndAuthority;
115
+ result += pathBefore;
116
+ result += '?';
117
+ result += pathAfter;
118
+ if (hasExistingQuery) {
119
+ result += '&';
120
+ result += parsed.queryWithoutQuestionMark;
121
+ }
122
+ result += parsed.fragmentWithHash;
123
+ assert(result.size() == totalSize);
124
+ return result;
125
+ }
126
+
127
+ std::string toJscSafeUrl(std::string url) {
128
+ if (!rfc3986Parse(url).hasQueryPart) {
129
+ return url;
130
+ }
131
+ url = toNormalUrl(std::move(url));
132
+ auto parsed = rfc3986Parse(url);
133
+ if (!parsed.queryWithoutQuestionMark.empty() &&
134
+ (parsed.path.empty() || parsed.path == "/")) {
135
+ throw std::invalid_argument(
136
+ "The given URL \"" + url +
137
+ "\" has an empty path and cannot be converted to a JSC-safe format.");
138
+ }
139
+
140
+ // Query strings may contain '?' (e.g. in key or value names) - these
141
+ // must be percent-encoded to form a valid path, and not be stripped.
142
+ // Count them first so we can preallocate exactly.
143
+ bool hasQuery = !parsed.queryWithoutQuestionMark.empty();
144
+ size_t questionMarks = 0;
145
+ if (hasQuery) {
146
+ for (char c : parsed.queryWithoutQuestionMark) {
147
+ if (c == '?') {
148
+ questionMarks++;
149
+ }
150
+ }
151
+ }
152
+
153
+ // Each '?' becomes "%3F" (+2 bytes), plus "//&" delimiter (+3 bytes)
154
+ size_t totalSize = parsed.schemeAndAuthority.size() + parsed.path.size() +
155
+ (hasQuery ? 3 + parsed.queryWithoutQuestionMark.size() + questionMarks * 2
156
+ : 0) +
157
+ // We expect JSC to strip this - we don't handle fragments for now.
158
+ parsed.fragmentWithHash.size();
159
+
160
+ std::string result;
161
+ result.reserve(totalSize);
162
+ result += parsed.schemeAndAuthority;
163
+ result += parsed.path;
164
+ if (hasQuery) {
165
+ result += "//&";
166
+ for (char c : parsed.queryWithoutQuestionMark) {
167
+ if (c == '?') {
168
+ result += "%3F";
169
+ } else {
170
+ result += c;
171
+ }
172
+ }
173
+ }
174
+ result += parsed.fragmentWithHash;
175
+ assert(result.size() == totalSize);
176
+ return result;
177
+ }
178
+
179
+ } // namespace facebook::react::unstable_redbox
@@ -0,0 +1,27 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include <string>
11
+ #include <string_view>
12
+
13
+ namespace facebook::react::unstable_redbox {
14
+
15
+ /**
16
+ * These functions are for handling of query-string free URLs, necessitated
17
+ * by query string stripping of URLs in JavaScriptCore stack traces
18
+ * introduced in iOS 16.4. This is a direct port of https://www.npmjs.com/package/jsc-safe-url.
19
+ *
20
+ * See https://github.com/react/react-native/issues/36794 for context.
21
+ */
22
+
23
+ bool isJscSafeUrl(std::string_view url);
24
+ std::string toNormalUrl(std::string url);
25
+ std::string toJscSafeUrl(std::string url);
26
+
27
+ } // namespace facebook::react::unstable_redbox