@office-iss/react-native-win32 0.74.4 → 0.75.0-preview.2

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 (214) hide show
  1. package/.flowconfig +9 -4
  2. package/CHANGELOG.json +569 -51
  3. package/CHANGELOG.md +173 -30
  4. package/Libraries/Animated/AnimatedImplementation.js +2 -0
  5. package/Libraries/Animated/NativeAnimatedHelper.js +4 -0
  6. package/Libraries/Animated/NativeAnimatedHelper.win32.js +4 -0
  7. package/Libraries/Animated/createAnimatedComponent.js +10 -4
  8. package/Libraries/Animated/useAnimatedProps.js +56 -28
  9. package/Libraries/BatchedBridge/MessageQueue.js +1 -0
  10. package/Libraries/Components/Button.js +10 -5
  11. package/Libraries/Components/Button.win32.js +1 -0
  12. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +11 -2
  13. package/Libraries/Components/Pressable/Pressable.js +13 -6
  14. package/Libraries/Components/Pressable/Pressable.win32.js +13 -6
  15. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +4 -0
  16. package/Libraries/Components/ScrollView/ScrollView.js +109 -29
  17. package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +6 -0
  18. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +13 -1
  19. package/Libraries/Components/StatusBar/StatusBar.js +1 -21
  20. package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +0 -15
  21. package/Libraries/Components/TextInput/InputAccessoryView.js +10 -1
  22. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +0 -12
  23. package/Libraries/Components/TextInput/TextInput.d.ts +0 -19
  24. package/Libraries/Components/TextInput/TextInput.js +14 -70
  25. package/Libraries/Components/TextInput/TextInput.win32.js +15 -72
  26. package/Libraries/Components/Touchable/Touchable.js +2 -2
  27. package/Libraries/Components/Touchable/TouchableHighlight.d.ts +4 -10
  28. package/Libraries/Components/Touchable/TouchableHighlight.js +3 -1
  29. package/Libraries/Components/Touchable/TouchableOpacity.d.ts +4 -32
  30. package/Libraries/Components/Touchable/TouchableOpacity.js +3 -1
  31. package/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts +8 -0
  32. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +117 -111
  33. package/Libraries/Components/View/ReactNativeStyleAttributes.js +6 -0
  34. package/Libraries/Components/View/ReactNativeViewAttributes.js +1 -0
  35. package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +1 -0
  36. package/Libraries/Components/View/View.js +0 -11
  37. package/Libraries/Components/View/View.win32.js +0 -11
  38. package/Libraries/Components/View/ViewAccessibility.js +4 -4
  39. package/Libraries/Components/View/ViewAccessibility.win32.js +6 -6
  40. package/Libraries/Components/View/ViewPropTypes.d.ts +7 -49
  41. package/Libraries/Components/View/ViewPropTypes.js +7 -0
  42. package/Libraries/Components/View/ViewPropTypes.win32.js +7 -0
  43. package/Libraries/Core/Devtools/loadBundleFromServer.js +3 -3
  44. package/Libraries/Core/Devtools/loadBundleFromServer.win32.js +153 -0
  45. package/Libraries/Core/Devtools/parseErrorStack.js +5 -5
  46. package/Libraries/Core/Devtools/parseHermesStack.js +22 -16
  47. package/Libraries/Core/ErrorHandlers.js +116 -0
  48. package/Libraries/Core/ExceptionsManager.js +2 -2
  49. package/Libraries/Core/ReactNativeVersion.js +3 -3
  50. package/Libraries/Core/setUpDeveloperTools.js +3 -1
  51. package/Libraries/Core/setUpPerformance.js +6 -4
  52. package/Libraries/Core/setUpReactDevTools.js +70 -10
  53. package/Libraries/Core/setUpTimers.js +50 -31
  54. package/Libraries/Debugging/DebuggingOverlayRegistry.js +1 -1
  55. package/Libraries/Image/Image.android.js +23 -13
  56. package/Libraries/Image/Image.d.ts +14 -15
  57. package/Libraries/Image/Image.ios.js +21 -11
  58. package/Libraries/Image/Image.win32.js +5 -3
  59. package/Libraries/Image/ImageProps.js +16 -5
  60. package/Libraries/Image/ImageTypes.flow.js +7 -2
  61. package/Libraries/Image/ImageUtils.js +1 -0
  62. package/Libraries/Image/ImageViewNativeComponent.js +2 -1
  63. package/Libraries/Inspector/ElementBox.js +6 -3
  64. package/Libraries/Inspector/ElementProperties.js +1 -1
  65. package/Libraries/Interaction/TouchHistoryMath.js +4 -4
  66. package/Libraries/IntersectionObserver/IntersectionObserverManager.js +6 -26
  67. package/Libraries/JSInspector/NetworkAgent.js +1 -1
  68. package/Libraries/LogBox/Data/LogBoxData.js +39 -29
  69. package/Libraries/LogBox/Data/LogBoxLog.js +114 -2
  70. package/Libraries/LogBox/Data/parseLogBoxLog.js +168 -53
  71. package/Libraries/LogBox/LogBox.js +29 -12
  72. package/Libraries/LogBox/LogBoxNotificationContainer.js +4 -0
  73. package/Libraries/LogBox/UI/LogBoxInspector.js +8 -70
  74. package/Libraries/LogBox/UI/LogBoxInspectorBody.js +87 -0
  75. package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +6 -42
  76. package/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js +58 -0
  77. package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +5 -66
  78. package/Libraries/LogBox/UI/LogBoxInspectorHeader.win32.js +8 -52
  79. package/Libraries/LogBox/UI/LogBoxInspectorHeaderButton.js +76 -0
  80. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +8 -5
  81. package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.win32.js +8 -5
  82. package/Libraries/LogBox/UI/LogBoxNotification.js +13 -152
  83. package/Libraries/LogBox/UI/LogBoxNotificationCountBadge.js +63 -0
  84. package/Libraries/LogBox/UI/LogBoxNotificationDismissButton.js +67 -0
  85. package/Libraries/LogBox/UI/LogBoxNotificationMessage.js +57 -0
  86. package/Libraries/NativeComponent/BaseViewConfig.android.js +5 -0
  87. package/Libraries/NativeComponent/BaseViewConfig.ios.js +5 -0
  88. package/Libraries/NativeComponent/BaseViewConfig.win32.js +5 -0
  89. package/Libraries/NativeComponent/NativeComponentRegistry.js +12 -5
  90. package/Libraries/NativeComponent/StaticViewConfigValidator.js +3 -0
  91. package/Libraries/Network/XMLHttpRequest.js +5 -1
  92. package/Libraries/NewAppScreen/components/LearnMoreLinks.js +3 -3
  93. package/Libraries/Pressability/Pressability.js +3 -51
  94. package/Libraries/Pressability/Pressability.win32.js +3 -51
  95. package/Libraries/ReactNative/AppContainer-dev.js +3 -2
  96. package/Libraries/ReactNative/AppContainer-prod.js +2 -1
  97. package/Libraries/ReactNative/AppContainer.js +2 -0
  98. package/Libraries/ReactNative/AppRegistry.d.ts +7 -0
  99. package/Libraries/ReactNative/AppRegistry.js +10 -4
  100. package/Libraries/ReactNative/BridgelessUIManager.js +1 -21
  101. package/Libraries/ReactNative/FabricUIManager.js +0 -51
  102. package/Libraries/ReactNative/ReactFabricPublicInstance/warnForStyleProps.js +1 -0
  103. package/Libraries/ReactNative/RendererImplementation.js +20 -2
  104. package/Libraries/ReactNative/UIManager.d.ts +0 -21
  105. package/Libraries/ReactNative/UIManagerProperties.js +0 -3
  106. package/Libraries/ReactNative/__mocks__/FabricUIManager.js +5 -341
  107. package/Libraries/ReactNative/getNativeComponentAttributes.js +8 -8
  108. package/Libraries/ReactNative/renderApplication.js +3 -0
  109. package/Libraries/Renderer/implementations/ReactFabric-dev.js +15682 -27088
  110. package/Libraries/Renderer/implementations/ReactFabric-prod.js +5082 -4381
  111. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3480 -2571
  112. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +15943 -27543
  113. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +5303 -4606
  114. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +3450 -2572
  115. package/Libraries/Renderer/shims/ReactFabric.js +2 -2
  116. package/Libraries/Renderer/shims/ReactFeatureFlags.js +2 -2
  117. package/Libraries/Renderer/shims/ReactNative.js +2 -3
  118. package/Libraries/Renderer/shims/ReactNativeTypes.js +24 -3
  119. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +2 -2
  120. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -2
  121. package/Libraries/Share/Share.d.ts +16 -10
  122. package/Libraries/Share/Share.js +14 -15
  123. package/Libraries/StyleSheet/StyleSheet.d.ts +1 -1
  124. package/Libraries/StyleSheet/StyleSheet.js +3 -10
  125. package/Libraries/StyleSheet/StyleSheet.win32.js +3 -10
  126. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +21 -21
  127. package/Libraries/StyleSheet/StyleSheetTypes.js +24 -18
  128. package/Libraries/StyleSheet/flattenStyle.js +1 -0
  129. package/Libraries/StyleSheet/processFilter.js +132 -0
  130. package/Libraries/StyleSheet/processTransform.js +18 -3
  131. package/Libraries/Text/Text.js +151 -128
  132. package/Libraries/Text/Text.win32.js +163 -138
  133. package/Libraries/Text/TextNativeComponent.js +5 -4
  134. package/Libraries/Text/TextNativeComponent.win32.js +5 -4
  135. package/Libraries/Text/TextProps.js +6 -6
  136. package/Libraries/Text/TextProps.win32.js +6 -6
  137. package/Libraries/TurboModule/TurboModuleRegistry.js +2 -1
  138. package/Libraries/Types/CodegenTypes.js +3 -0
  139. package/Libraries/Utilities/{LoadingView.android.js → DevLoadingView.js} +33 -11
  140. package/Libraries/Utilities/Dimensions.js +1 -0
  141. package/Libraries/Utilities/Dimensions.win32.js +1 -0
  142. package/Libraries/Utilities/HMRClient.js +36 -8
  143. package/Libraries/Utilities/HMRClientProdShim.js +1 -0
  144. package/Libraries/Utilities/Platform.android.js +5 -5
  145. package/Libraries/Utilities/Platform.d.ts +1 -1
  146. package/Libraries/Utilities/Platform.flow.js +2 -2
  147. package/Libraries/Utilities/Platform.flow.win32.js +3 -3
  148. package/Libraries/Utilities/Platform.ios.js +1 -1
  149. package/Libraries/Utilities/Platform.win32.js +1 -1
  150. package/Libraries/Utilities/RCTLog.js +1 -0
  151. package/Libraries/Utilities/ReactNativeTestTools.js +12 -24
  152. package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +11 -6
  153. package/Libraries/__tests__/ButtonWin32-test.js +7 -6
  154. package/Libraries/promiseRejectionTrackingOptions.js +1 -0
  155. package/jest/mockComponent.js +7 -0
  156. package/jest/renderer.js +25 -14
  157. package/jest/setup.js +19 -13
  158. package/jest.config.js +2 -1
  159. package/overrides.json +32 -31
  160. package/package.json +27 -25
  161. package/rn-get-polyfills.js +1 -0
  162. package/src/private/core/composeStyles.js +27 -0
  163. package/src/private/featureflags/ReactNativeFeatureFlags.js +93 -33
  164. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +23 -4
  165. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +56 -0
  166. package/src/private/fusebox/setUpFuseboxReactDevToolsDispatcher.js +108 -0
  167. package/src/private/specs/modules/NativeBlobModule.js +4 -2
  168. package/src/private/specs/modules/NativeDevSettings.js +1 -0
  169. package/src/private/specs/modules/NativePlatformConstantsAndroid.js +1 -1
  170. package/src/private/specs/modules/NativePlatformConstantsIOS.js +1 -1
  171. package/src/private/specs/modules/NativePlatformConstantsWin.js +1 -1
  172. package/src/private/specs/modules/NativePushNotificationManagerIOS.js +0 -4
  173. package/src/private/specs/modules/NativeUIManager.js +0 -7
  174. package/src/private/webapis/dom/geometry/DOMRectReadOnly.js +24 -24
  175. package/src/private/webapis/dom/nodes/ReactNativeElement.js +11 -14
  176. package/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js +2 -3
  177. package/src/private/webapis/dom/nodes/ReadOnlyElement.js +24 -54
  178. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +5 -13
  179. package/src/private/webapis/dom/nodes/specs/NativeDOM.js +468 -0
  180. package/src/private/webapis/dom/nodes/specs/__mocks__/NativeDOMMock.js +413 -0
  181. package/src/private/webapis/dom/oldstylecollections/DOMRectList.js +4 -4
  182. package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +4 -4
  183. package/src/private/webapis/dom/oldstylecollections/NodeList.js +5 -5
  184. package/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js +34 -0
  185. package/src/private/webapis/microtasks/specs/NativeMicrotasks.js +21 -0
  186. package/src/private/webapis/performance/EventCounts.js +1 -1
  187. package/src/private/webapis/performance/MemoryInfo.js +9 -9
  188. package/src/private/webapis/performance/Performance.js +10 -56
  189. package/src/private/webapis/performance/PerformanceObserver.js +30 -22
  190. package/src/private/webapis/performance/RawPerformanceEntry.js +2 -7
  191. package/src/private/webapis/performance/ReactNativeStartupTiming.js +18 -18
  192. package/src/private/webapis/performance/UserTiming.js +63 -0
  193. package/src/private/webapis/performance/{NativePerformance.js → specs/NativePerformance.js} +3 -2
  194. package/src/private/webapis/performance/{NativePerformanceObserver.js → specs/NativePerformanceObserver.js} +2 -2
  195. package/src/private/webapis/performance/{__mocks__ → specs/__mocks__}/NativePerformance.js +1 -1
  196. package/src/private/webapis/performance/{__mocks__ → specs/__mocks__}/NativePerformanceObserver.js +3 -4
  197. package/src-win/Libraries/Components/View/ViewPropTypes.d.ts +7 -49
  198. package/types/modules/globals.d.ts +4 -0
  199. package/Libraries/Components/ScrollView/ScrollView.win32.js +0 -1915
  200. package/Libraries/NativeModules/specs/NativeAnimationsDebugModule.js +0 -13
  201. package/Libraries/Utilities/LoadingView.ios.js +0 -50
  202. package/Libraries/Utilities/LoadingView.js +0 -16
  203. package/jest/ReactNativeInternalFeatureFlagsMock.js +0 -13
  204. package/src/private/featureflags/NativeReactNativeFeatureFlags.js +0 -44
  205. package/src/private/featureflags/__tests__/ReactNativeFeatureFlags-test.js +0 -92
  206. package/src/private/specs/modules/NativeAnimationsDebugModule.js +0 -20
  207. package/src/private/webapis/dom/oldstylecollections/__tests__/DOMRectList-test.js +0 -85
  208. package/src/private/webapis/dom/oldstylecollections/__tests__/HTMLCollection-test.js +0 -80
  209. package/src/private/webapis/dom/oldstylecollections/__tests__/NodeList-test.js +0 -161
  210. package/src/private/webapis/performance/__tests__/EventCounts-test.js +0 -116
  211. package/src/private/webapis/performance/__tests__/NativePerformanceMock-test.js +0 -82
  212. package/src/private/webapis/performance/__tests__/NativePerformanceObserverMock-test.js +0 -108
  213. package/src/private/webapis/performance/__tests__/Performance-test.js +0 -117
  214. package/src/private/webapis/performance/__tests__/PerformanceObserver-test.js +0 -208
@@ -136,11 +136,11 @@ export type AccessibilityActionEvent = SyntheticEvent<
136
136
  >;
137
137
 
138
138
  export type AccessibilityState = {
139
- disabled?: boolean,
140
- selected?: boolean,
139
+ disabled?: ?boolean,
140
+ selected?: ?boolean,
141
141
  checked?: ?boolean | 'mixed',
142
- busy?: boolean,
143
- expanded?: boolean,
142
+ busy?: ?boolean,
143
+ expanded?: ?boolean,
144
144
  ...
145
145
  };
146
146
 
@@ -147,13 +147,13 @@ export type AccessibilityActionEvent = SyntheticEvent<
147
147
  >;
148
148
 
149
149
  export type AccessibilityState = {
150
- disabled?: boolean,
151
- selected?: boolean,
150
+ disabled?: ?boolean,
151
+ selected?: ?boolean,
152
152
  checked?: ?boolean | 'mixed',
153
- busy?: boolean,
154
- expanded?: boolean,
155
- multiselectable?: boolean, // Win32
156
- required?: boolean, // Win32
153
+ busy?: ?boolean,
154
+ expanded?: ?boolean,
155
+ multiselectable?: ?boolean, // Win32
156
+ required?: ?boolean, // Win32
157
157
  ...
158
158
  };
159
159
 
@@ -21,48 +21,6 @@ import {
21
21
  import {Touchable} from 'react-native/Libraries/Components/Touchable/Touchable';
22
22
  import {AccessibilityProps} from './ViewAccessibility';
23
23
 
24
- export type TVParallaxProperties = {
25
- /**
26
- * If true, parallax effects are enabled. Defaults to true.
27
- */
28
- enabled?: boolean | undefined;
29
-
30
- /**
31
- * Defaults to 2.0.
32
- */
33
- shiftDistanceX?: number | undefined;
34
-
35
- /**
36
- * Defaults to 2.0.
37
- */
38
- shiftDistanceY?: number | undefined;
39
-
40
- /**
41
- * Defaults to 0.05.
42
- */
43
- tiltAngle?: number | undefined;
44
-
45
- /**
46
- * Defaults to 1.0
47
- */
48
- magnification?: number | undefined;
49
-
50
- /**
51
- * Defaults to 1.0
52
- */
53
- pressMagnification?: number | undefined;
54
-
55
- /**
56
- * Defaults to 0.3
57
- */
58
- pressDuration?: number | undefined;
59
-
60
- /**
61
- * Defaults to 0.3
62
- */
63
- pressDelay?: number | undefined;
64
- };
65
-
66
24
  export interface TVViewPropsIOS {
67
25
  /**
68
26
  * *(Apple TV only)* When set to true, this view will be focusable
@@ -79,13 +37,6 @@ export interface TVViewPropsIOS {
79
37
  */
80
38
  hasTVPreferredFocus?: boolean | undefined;
81
39
 
82
- /**
83
- * *(Apple TV only)* Object with properties to control Apple TV parallax effects.
84
- *
85
- * @platform ios
86
- */
87
- tvParallaxProperties?: TVParallaxProperties | undefined;
88
-
89
40
  /**
90
41
  * *(Apple TV only)* May be used to change the appearance of the Apple TV parallax effect when this view goes in or out of focus. Defaults to 2.0.
91
42
  *
@@ -137,6 +88,13 @@ export interface ViewPropsAndroid {
137
88
  */
138
89
  collapsable?: boolean | undefined;
139
90
 
91
+ /**
92
+ * Setting to false prevents direct children of the view from being removed
93
+ * from the native view hierarchy, similar to the effect of setting
94
+ * `collapsable={false}` on each child.
95
+ */
96
+ collapsableChildren?: boolean | undefined;
97
+
140
98
  /**
141
99
  * Whether this view should render itself (and all of its children) into a single hardware texture on the GPU.
142
100
  *
@@ -560,6 +560,13 @@ export type ViewProps = $ReadOnly<{|
560
560
  */
561
561
  collapsable?: ?boolean,
562
562
 
563
+ /**
564
+ * Setting to false prevents direct children of the view from being removed
565
+ * from the native view hierarchy, similar to the effect of setting
566
+ * `collapsable={false}` on each child.
567
+ */
568
+ collapsableChildren?: ?boolean,
569
+
563
570
  /**
564
571
  * Contols whether this view, and its transitive children, are laid in a way
565
572
  * consistent with web browsers ('strict'), or consistent with existing
@@ -621,6 +621,13 @@ export type ViewProps = $ReadOnly<{|
621
621
  */
622
622
  collapsable?: ?boolean,
623
623
 
624
+ /**
625
+ * Setting to false prevents direct children of the view from being removed
626
+ * from the native view hierarchy, similar to the effect of setting
627
+ * `collapsable={false}` on each child.
628
+ */
629
+ collapsableChildren?: ?boolean,
630
+
624
631
  /**
625
632
  * Contols whether this view, and its transitive children, are laid in a way
626
633
  * consistent with web browsers ('strict'), or consistent with existing
@@ -10,8 +10,8 @@
10
10
  */
11
11
 
12
12
  import Networking from '../../Network/RCTNetworking';
13
+ import DevLoadingView from '../../Utilities/DevLoadingView';
13
14
  import HMRClient from '../../Utilities/HMRClient';
14
- import LoadingView from '../../Utilities/LoadingView';
15
15
  import getDevServer from './getDevServer';
16
16
 
17
17
  declare var global: {globalEvalWithSourceUrl?: (string, string) => mixed, ...};
@@ -110,7 +110,7 @@ module.exports = function (bundlePathAndQuery: string): Promise<void> {
110
110
  if (loadPromise) {
111
111
  return loadPromise;
112
112
  }
113
- LoadingView.showMessage('Downloading...', 'load');
113
+ DevLoadingView.showMessage('Downloading...', 'load');
114
114
  ++pendingRequests;
115
115
 
116
116
  loadPromise = asyncRequest(requestUrl)
@@ -143,7 +143,7 @@ module.exports = function (bundlePathAndQuery: string): Promise<void> {
143
143
  })
144
144
  .finally(() => {
145
145
  if (!--pendingRequests) {
146
- LoadingView.hide();
146
+ DevLoadingView.hide();
147
147
  }
148
148
  });
149
149
 
@@ -0,0 +1,153 @@
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
+ * @flow strict-local
8
+ * @format
9
+ * @oncall react_native
10
+ */
11
+
12
+ import Networking from '../../Network/RCTNetworking';
13
+ import DevLoadingView from '../../Utilities/DevLoadingView';
14
+ import HMRClient from '../../Utilities/HMRClient';
15
+ import getDevServer from './getDevServer';
16
+
17
+ declare var global: {globalEvalWithSourceUrl?: (string, string) => mixed, ...};
18
+
19
+ let pendingRequests = 0;
20
+
21
+ const cachedPromisesByUrl = new Map<string, Promise<void>>();
22
+
23
+ function asyncRequest(
24
+ url: string,
25
+ ): Promise<{body: string, headers: {[string]: string}}> {
26
+ let id = null;
27
+ let responseText = null;
28
+ let headers = null;
29
+ let dataListener;
30
+ let completeListener;
31
+ let responseListener;
32
+ let incrementalDataListener;
33
+ return new Promise<{body: string, headers: {[string]: string}}>(
34
+ (resolve, reject) => {
35
+ dataListener = Networking.addListener(
36
+ 'didReceiveNetworkData',
37
+ ([requestId, response]) => {
38
+ if (requestId === id) {
39
+ responseText = response;
40
+ }
41
+ },
42
+ );
43
+ incrementalDataListener = Networking.addListener(
44
+ 'didReceiveNetworkIncrementalData',
45
+ ([requestId, data]) => {
46
+ if (requestId === id) {
47
+ if (responseText != null) {
48
+ responseText += data;
49
+ } else {
50
+ responseText = data;
51
+ }
52
+ }
53
+ },
54
+ );
55
+ responseListener = Networking.addListener(
56
+ 'didReceiveNetworkResponse',
57
+ ([requestId, status, responseHeaders]) => {
58
+ if (requestId === id) {
59
+ headers = responseHeaders;
60
+ }
61
+ },
62
+ );
63
+ completeListener = Networking.addListener(
64
+ 'didCompleteNetworkResponse',
65
+ ([requestId, error]) => {
66
+ if (requestId === id) {
67
+ if (error) {
68
+ reject(error);
69
+ } else {
70
+ //$FlowFixMe[incompatible-call]
71
+ resolve({body: responseText, headers});
72
+ }
73
+ }
74
+ },
75
+ );
76
+ Networking.sendRequest(
77
+ 'GET',
78
+ 'asyncRequest',
79
+ url,
80
+ {},
81
+ '',
82
+ 'text',
83
+ true,
84
+ 0,
85
+ requestId => {
86
+ id = requestId;
87
+ },
88
+ true,
89
+ );
90
+ },
91
+ ).finally(() => {
92
+ dataListener?.remove();
93
+ completeListener?.remove();
94
+ responseListener?.remove();
95
+ incrementalDataListener?.remove();
96
+ });
97
+ }
98
+
99
+ function buildUrlForBundle(bundlePathAndQuery: string) {
100
+ const {url: serverUrl} = getDevServer();
101
+ return (
102
+ serverUrl.replace(/\/+$/, '') + '/' + bundlePathAndQuery.replace(/^\/+/, '')
103
+ );
104
+ }
105
+
106
+ module.exports = function (bundlePathAndQuery: string): Promise<void> {
107
+ const requestUrl = buildUrlForBundle(bundlePathAndQuery);
108
+ let loadPromise = cachedPromisesByUrl.get(requestUrl);
109
+
110
+ if (loadPromise) {
111
+ return loadPromise;
112
+ }
113
+ DevLoadingView.showMessage('Downloading...', 'load');
114
+ ++pendingRequests;
115
+
116
+ loadPromise = asyncRequest(requestUrl)
117
+ .then<void>(({body, headers}) => {
118
+ if (
119
+ headers['Content-Type'] != null &&
120
+ headers['Content-Type'].indexOf('application/json') >= 0
121
+ ) {
122
+ // Errors are returned as JSON.
123
+ throw new Error(
124
+ JSON.parse(body).message ||
125
+ `Unknown error fetching '${bundlePathAndQuery}'`,
126
+ );
127
+ }
128
+
129
+ HMRClient.registerBundle(requestUrl);
130
+
131
+ // Some engines do not support `sourceURL` as a comment. We expose a
132
+ // `globalEvalWithSourceUrl` function to handle updates in that case.
133
+ if (global.globalEvalWithSourceUrl) {
134
+ global.globalEvalWithSourceUrl(body, requestUrl);
135
+ } else {
136
+ // [Windows #12704 - CodeQL patch]
137
+ // eslint-disable-next-line no-eval
138
+ eval(body); // CodeQL [js/eval-usage] Debug only. Developer inner loop.
139
+ }
140
+ })
141
+ .catch<void>(e => {
142
+ cachedPromisesByUrl.delete(requestUrl);
143
+ throw e;
144
+ })
145
+ .finally(() => {
146
+ if (!--pendingRequests) {
147
+ DevLoadingView.hide();
148
+ }
149
+ });
150
+
151
+ cachedPromisesByUrl.set(requestUrl, loadPromise);
152
+ return loadPromise;
153
+ };
@@ -47,11 +47,11 @@ function parseErrorStack(errorStack?: string): Array<StackFrame> {
47
47
  const parsedStack = Array.isArray(errorStack)
48
48
  ? errorStack
49
49
  : global.HermesInternal
50
- ? convertHermesStack(parseHermesStack(errorStack))
51
- : stacktraceParser.parse(errorStack).map((frame): StackFrame => ({
52
- ...frame,
53
- column: frame.column != null ? frame.column - 1 : null,
54
- }));
50
+ ? convertHermesStack(parseHermesStack(errorStack))
51
+ : stacktraceParser.parse(errorStack).map((frame): StackFrame => ({
52
+ ...frame,
53
+ column: frame.column != null ? frame.column - 1 : null,
54
+ }));
55
55
 
56
56
  return parsedStack;
57
57
  }
@@ -72,6 +72,7 @@ const RE_FRAME =
72
72
  // Capturing groups:
73
73
  // 1. count of skipped frames
74
74
  const RE_SKIPPED = /^ {4}... skipping (\d+) frames$/;
75
+ const RE_COMPONENT_NO_STACK = /^ {4}at .*$/;
75
76
 
76
77
  function isInternalBytecodeSourceUrl(sourceUrl: string): boolean {
77
78
  // See https://github.com/facebook/hermes/blob/3332fa020cae0bab751f648db7c94e1d687eeec7/lib/VM/Runtime.cpp#L1100
@@ -88,25 +89,25 @@ function parseLine(line: string): ?HermesStackEntry {
88
89
  asFrame[2] === 'native'
89
90
  ? {type: 'NATIVE'}
90
91
  : asFrame[3] === 'address at '
91
- ? isInternalBytecodeSourceUrl(asFrame[4])
92
- ? {
93
- type: 'INTERNAL_BYTECODE',
94
- sourceUrl: asFrame[4],
95
- line1Based: Number.parseInt(asFrame[5], 10),
96
- virtualOffset0Based: Number.parseInt(asFrame[6], 10),
97
- }
92
+ ? isInternalBytecodeSourceUrl(asFrame[4])
93
+ ? {
94
+ type: 'INTERNAL_BYTECODE',
95
+ sourceUrl: asFrame[4],
96
+ line1Based: Number.parseInt(asFrame[5], 10),
97
+ virtualOffset0Based: Number.parseInt(asFrame[6], 10),
98
+ }
99
+ : {
100
+ type: 'BYTECODE',
101
+ sourceUrl: asFrame[4],
102
+ line1Based: Number.parseInt(asFrame[5], 10),
103
+ virtualOffset0Based: Number.parseInt(asFrame[6], 10),
104
+ }
98
105
  : {
99
- type: 'BYTECODE',
106
+ type: 'SOURCE',
100
107
  sourceUrl: asFrame[4],
101
108
  line1Based: Number.parseInt(asFrame[5], 10),
102
- virtualOffset0Based: Number.parseInt(asFrame[6], 10),
103
- }
104
- : {
105
- type: 'SOURCE',
106
- sourceUrl: asFrame[4],
107
- line1Based: Number.parseInt(asFrame[5], 10),
108
- column1Based: Number.parseInt(asFrame[6], 10),
109
- },
109
+ column1Based: Number.parseInt(asFrame[6], 10),
110
+ },
110
111
  };
111
112
  }
112
113
  const asSkipped = line.match(RE_SKIPPED);
@@ -132,6 +133,11 @@ module.exports = function parseHermesStack(stack: string): HermesParsedStack {
132
133
  entries.push(entry);
133
134
  continue;
134
135
  }
136
+ if (RE_COMPONENT_NO_STACK.test(line)) {
137
+ // Skip component stacks without source location.
138
+ // TODO: This will not be displayed, not sure how to handle it.
139
+ continue;
140
+ }
135
141
  // No match - we're still in the message
136
142
  lastMessageLine = i;
137
143
  entries = [];
@@ -0,0 +1,116 @@
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
+ * @format
8
+ * @flow strict
9
+ */
10
+
11
+ 'use strict';
12
+
13
+ import type {ExtendedError} from './ExtendedError';
14
+
15
+ import {SyntheticError, handleException} from './ExceptionsManager';
16
+
17
+ type ErrorInfo = {
18
+ +componentStack?: ?string,
19
+ // $FlowFixMe[unclear-type] unknown props and state.
20
+ +errorBoundary?: ?React$Component<any, any>,
21
+ };
22
+
23
+ export function onUncaughtError(errorValue: mixed, errorInfo: ErrorInfo): void {
24
+ let error;
25
+
26
+ // Typically, `errorValue` should be an error. However, other values such as
27
+ // strings (or even null) are sometimes thrown.
28
+ if (errorValue instanceof Error) {
29
+ /* $FlowFixMe[class-object-subtyping] added when improving typing for
30
+ * this parameters */
31
+ error = (errorValue: ExtendedError);
32
+ } else if (typeof errorValue === 'string') {
33
+ /* $FlowFixMe[class-object-subtyping] added when improving typing for
34
+ * this parameters */
35
+ error = (new SyntheticError(errorValue): ExtendedError);
36
+ } else {
37
+ /* $FlowFixMe[class-object-subtyping] added when improving typing for
38
+ * this parameters */
39
+ error = (new SyntheticError('Unspecified error'): ExtendedError);
40
+ }
41
+ try {
42
+ // $FlowFixMe[incompatible-use] this is in try/catch.
43
+ error.componentStack = errorInfo.componentStack;
44
+ error.isComponentError = true;
45
+ } catch {
46
+ // Ignored.
47
+ }
48
+
49
+ // Uncaught errors are fatal.
50
+ handleException(error, true);
51
+ }
52
+
53
+ export function onCaughtError(errorValue: mixed, errorInfo: ErrorInfo): void {
54
+ let error;
55
+
56
+ // Typically, `errorValue` should be an error. However, other values such as
57
+ // strings (or even null) are sometimes thrown.
58
+ if (errorValue instanceof Error) {
59
+ /* $FlowFixMe[class-object-subtyping] added when improving typing for
60
+ * this parameters */
61
+ error = (errorValue: ExtendedError);
62
+ } else if (typeof errorValue === 'string') {
63
+ /* $FlowFixMe[class-object-subtyping] added when improving typing for
64
+ * this parameters */
65
+ error = (new SyntheticError(errorValue): ExtendedError);
66
+ } else {
67
+ /* $FlowFixMe[class-object-subtyping] added when improving typing for
68
+ * this parameters */
69
+ error = (new SyntheticError('Unspecified error'): ExtendedError);
70
+ }
71
+ try {
72
+ // $FlowFixMe[incompatible-use] this is in try/catch.
73
+ error.componentStack = errorInfo.componentStack;
74
+ error.isComponentError = true;
75
+ } catch {
76
+ // Ignored.
77
+ }
78
+
79
+ // Caught errors are not fatal.
80
+ handleException(error, false);
81
+ }
82
+
83
+ export function onRecoverableError(
84
+ errorValue: mixed,
85
+ errorInfo: ErrorInfo,
86
+ ): void {
87
+ let error;
88
+
89
+ // Typically, `errorValue` should be an error. However, other values such as
90
+ // strings (or even null) are sometimes thrown.
91
+ if (errorValue instanceof Error) {
92
+ /* $FlowFixMe[class-object-subtyping] added when improving typing for
93
+ * this parameters */
94
+ error = (errorValue: ExtendedError);
95
+ } else if (typeof errorValue === 'string') {
96
+ /* $FlowFixMe[class-object-subtyping] added when improving typing for
97
+ * this parameters */
98
+ error = (new SyntheticError(errorValue): ExtendedError);
99
+ } else {
100
+ /* $FlowFixMe[class-object-subtyping] added when improving typing for
101
+ * this parameters */
102
+ error = (new SyntheticError('Unspecified error'): ExtendedError);
103
+ }
104
+ try {
105
+ // $FlowFixMe[incompatible-use] this is in try/catch.
106
+ error.componentStack = errorInfo.componentStack;
107
+ error.isComponentError = true;
108
+ } catch {
109
+ // Ignored.
110
+ }
111
+
112
+ // Recoverable errors should only be warnings.
113
+ // This will make it a soft error in LogBox.
114
+ // TODO: improve the logging for recoverable errors in prod.
115
+ console.warn(error);
116
+ }
@@ -126,8 +126,8 @@ function reportException(
126
126
  }
127
127
 
128
128
  declare var console: {
129
- error: typeof console.error,
130
- _errorOriginal: typeof console.error,
129
+ error: (...data: $ReadOnlyArray<mixed>) => void,
130
+ _errorOriginal: (...data: $ReadOnlyArray<mixed>) => void,
131
131
  reportErrorsAsExceptions: boolean,
132
132
  ...
133
133
  };
@@ -15,9 +15,9 @@ const version: $ReadOnly<{
15
15
  prerelease: string | null,
16
16
  }> = {
17
17
  major: 0,
18
- minor: 74,
19
- patch: 3,
20
- prerelease: null,
18
+ minor: 75,
19
+ patch: 0,
20
+ prerelease: 'rc.5',
21
21
  };
22
22
 
23
23
  module.exports = {version};
@@ -42,7 +42,9 @@ if (__DEV__) {
42
42
  if (!Platform.isTesting) {
43
43
  const HMRClient = require('../Utilities/HMRClient');
44
44
 
45
- if (console._isPolyfilled) {
45
+ if (global.__FUSEBOX_HAS_FULL_CONSOLE_SUPPORT__) {
46
+ HMRClient.unstable_notifyFuseboxConsoleEnabled();
47
+ } else if (console._isPolyfilled) {
46
48
  // We assume full control over the console and send JavaScript logs to Metro.
47
49
  [
48
50
  'trace',
@@ -8,8 +8,8 @@
8
8
  * @format
9
9
  */
10
10
 
11
- import NativePerformance from '../../src/private/webapis/performance/NativePerformance';
12
11
  import Performance from '../../src/private/webapis/performance/Performance';
12
+ import NativePerformance from '../../src/private/webapis/performance/specs/NativePerformance';
13
13
 
14
14
  // In case if the native implementation of the Performance API is available, use it,
15
15
  // otherwise fall back to the legacy/default one, which only defines 'Performance.now()'
@@ -19,11 +19,13 @@ if (NativePerformance) {
19
19
  } else {
20
20
  if (!global.performance) {
21
21
  // $FlowExpectedError[cannot-write]
22
- global.performance = ({
23
- now: function () {
22
+ global.performance = {
23
+ mark: () => {},
24
+ measure: () => {},
25
+ now: () => {
24
26
  const performanceNow = global.nativePerformanceNow || Date.now;
25
27
  return performanceNow();
26
28
  },
27
- }: {now?: () => number});
29
+ };
28
30
  }
29
31
  }