react-native-macos 0.76.8 → 0.76.10

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 (85) hide show
  1. package/Libraries/AppDelegate/RCTAppSetupUtils.mm +1 -1
  2. package/Libraries/AppDelegate/React-RCTAppDelegate.podspec +1 -0
  3. package/Libraries/Blob/React-RCTBlob.podspec +3 -1
  4. package/Libraries/Components/TextInput/TextInput.d.ts +16 -0
  5. package/Libraries/Components/TextInput/TextInput.flow.js +2 -0
  6. package/Libraries/Components/TextInput/TextInput.js +4 -0
  7. package/Libraries/Components/TextInput/TextInputState.js +5 -1
  8. package/Libraries/Core/ReactNativeVersion.js +1 -1
  9. package/Libraries/Inspector/NetworkOverlay.js +1 -1
  10. package/Libraries/Lists/FillRateHelper.js +3 -3
  11. package/Libraries/Lists/FlatList.d.ts +1 -1
  12. package/Libraries/Lists/FlatList.js +2 -2
  13. package/Libraries/Lists/SectionList.d.ts +1 -1
  14. package/Libraries/Lists/SectionList.js +2 -2
  15. package/Libraries/Lists/SectionListModern.js +2 -2
  16. package/Libraries/Lists/ViewabilityHelper.js +3 -3
  17. package/Libraries/Lists/VirtualizeUtils.js +2 -2
  18. package/Libraries/Lists/VirtualizedList.js +3 -3
  19. package/Libraries/Lists/VirtualizedListContext.js +2 -2
  20. package/Libraries/Lists/VirtualizedSectionList.js +3 -3
  21. package/Libraries/Modal/Modal.js +1 -1
  22. package/Libraries/Network/FormData.js +11 -3
  23. package/Libraries/Network/RCTDataRequestHandler.mm +17 -3
  24. package/Libraries/Network/RCTFileRequestHandler.mm +17 -3
  25. package/Libraries/Text/Text.d.ts +1 -0
  26. package/Libraries/Text/TextInput/Singleline/RCTUITextField.mm +1 -1
  27. package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
  28. package/React/Base/RCTVersion.m +1 -1
  29. package/React/CoreModules/React-CoreModules.podspec +9 -10
  30. package/React/CxxModule/RCTCxxMethod.mm +10 -2
  31. package/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm +2354 -0
  32. package/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h +2820 -0
  33. package/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.h +1 -1
  34. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +1 -5
  35. package/React/Fabric/Surface/RCTFabricSurface.mm +1 -0
  36. package/React/React-RCTFabric.podspec +1 -0
  37. package/React/Views/RCTViewKeyboardEvent.m +24 -0
  38. package/React/third-party.xcconfig +1 -1
  39. package/React-Core.podspec +2 -1
  40. package/ReactAndroid/api/ReactAndroid.api +1 -1
  41. package/ReactAndroid/build.gradle.kts +24 -0
  42. package/ReactAndroid/gradle.properties +1 -1
  43. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java +3 -1
  44. package/ReactAndroid/src/main/java/com/facebook/react/devsupport/HMRClient.java +4 -1
  45. package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +13 -8
  46. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  47. package/ReactAndroid/src/main/jni/CMakeLists.txt +1 -0
  48. package/ReactAndroid/src/main/jni/third-party/fast_float/CMakeLists.txt +13 -0
  49. package/ReactAndroid/src/main/jni/third-party/folly/CMakeLists.txt +5 -6
  50. package/ReactCommon/React-Fabric.podspec +2 -1
  51. package/ReactCommon/React-FabricComponents.podspec +3 -1
  52. package/ReactCommon/React-FabricImage.podspec +7 -5
  53. package/ReactCommon/ReactCommon.podspec +9 -8
  54. package/ReactCommon/cxxreact/CxxNativeModule.cpp +6 -3
  55. package/ReactCommon/cxxreact/React-cxxreact.podspec +11 -10
  56. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  57. package/ReactCommon/hermes/React-hermes.podspec +7 -6
  58. package/ReactCommon/jsi/React-jsi.podspec +4 -3
  59. package/ReactCommon/jsiexecutor/React-jsiexecutor.podspec +7 -6
  60. package/ReactCommon/jsinspector-modern/React-jsinspector.podspec +4 -4
  61. package/ReactCommon/react/nativemodule/core/platform/ios/React-NativeModulesApple.podspec +1 -1
  62. package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm +24 -13
  63. package/ReactCommon/react/nativemodule/samples/ReactCommon-Samples.podspec +3 -1
  64. package/ReactCommon/react/renderer/debug/React-rendererdebug.podspec +4 -2
  65. package/ReactCommon/react/renderer/graphics/React-graphics.podspec +4 -2
  66. package/ReactCommon/react/renderer/imagemanager/platform/ios/React-ImageManager.podspec +1 -0
  67. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.h +24 -3
  68. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm +1 -41
  69. package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm +4 -5
  70. package/ReactCommon/reactperflogger/React-perflogger.podspec +1 -0
  71. package/cli.js +11 -2
  72. package/gradle/libs.versions.toml +3 -2
  73. package/package.json +10 -9
  74. package/react-native.config.js +24 -23
  75. package/scripts/cocoapods/codegen_utils.rb +1 -2
  76. package/scripts/cocoapods/helpers.rb +13 -1
  77. package/scripts/cocoapods/new_architecture.rb +1 -0
  78. package/scripts/cocoapods/utils.rb +13 -5
  79. package/scripts/react_native_pods.rb +14 -0
  80. package/sdks/hermes-engine/hermes-engine.podspec +3 -4
  81. package/sdks/hermes-engine/hermes-utils.rb +70 -18
  82. package/third-party-podspecs/RCT-Folly.podspec +16 -7
  83. package/third-party-podspecs/fast_float.podspec +29 -0
  84. package/third-party-podspecs/fmt.podspec +2 -2
  85. package/types/index.d.ts +1 -1
@@ -57,7 +57,7 @@ static jsi::Value convertNSNumberToJSINumber(jsi::Runtime &runtime, NSNumber *va
57
57
 
58
58
  static jsi::String convertNSStringToJSIString(jsi::Runtime &runtime, NSString *value)
59
59
  {
60
- return jsi::String::createFromUtf8(runtime, [value UTF8String] ?: "");
60
+ return jsi::String::createFromUtf8(runtime, [value UTF8String] ? [value UTF8String] : "");
61
61
  }
62
62
 
63
63
  static jsi::Object convertNSDictionaryToJSIObject(jsi::Runtime &runtime, NSDictionary *value)
@@ -195,7 +195,11 @@ static jsi::Value createJSRuntimeError(jsi::Runtime &runtime, const std::string
195
195
  /**
196
196
  * Creates JSError with current JS runtime and NSException stack trace.
197
197
  */
198
- static jsi::JSError convertNSExceptionToJSError(jsi::Runtime &runtime, NSException *exception)
198
+ static jsi::JSError convertNSExceptionToJSError(
199
+ jsi::Runtime &runtime,
200
+ NSException *exception,
201
+ const std::string &moduleName,
202
+ const std::string &methodName)
199
203
  {
200
204
  std::string reason = [exception.reason UTF8String];
201
205
 
@@ -206,7 +210,8 @@ static jsi::JSError convertNSExceptionToJSError(jsi::Runtime &runtime, NSExcepti
206
210
  cause.setProperty(
207
211
  runtime, "stackReturnAddresses", convertNSArrayToJSIArray(runtime, exception.callStackReturnAddresses));
208
212
 
209
- jsi::Value error = createJSRuntimeError(runtime, "Exception in HostFunction: " + reason);
213
+ std::string message = moduleName + "." + methodName + " raised an exception: " + reason;
214
+ jsi::Value error = createJSRuntimeError(runtime, message);
210
215
  error.asObject(runtime).setProperty(runtime, "cause", std::move(cause));
211
216
  return {runtime, std::move(error)};
212
217
  }
@@ -338,28 +343,34 @@ id ObjCTurboModule::performMethodInvocation(
338
343
  }
339
344
 
340
345
  if (isSync) {
341
- TurboModulePerfLogger::syncMethodCallExecutionStart(moduleName, methodNameStr.c_str());
346
+ TurboModulePerfLogger::syncMethodCallExecutionStart(moduleName, methodName);
342
347
  } else {
343
- TurboModulePerfLogger::asyncMethodCallExecutionStart(moduleName, methodNameStr.c_str(), asyncCallCounter);
348
+ TurboModulePerfLogger::asyncMethodCallExecutionStart(moduleName, methodName, asyncCallCounter);
344
349
  }
345
350
 
346
351
  @try {
347
352
  [inv invokeWithTarget:strongModule];
348
353
  } @catch (NSException *exception) {
349
- throw convertNSExceptionToJSError(runtime, exception);
354
+ if (isSync) {
355
+ // We can only convert NSException to JSError in sync method calls.
356
+ // See https://github.com/reactwg/react-native-new-architecture/discussions/276#discussioncomment-12567155
357
+ throw convertNSExceptionToJSError(runtime, exception, std::string{moduleName}, methodNameStr);
358
+ } else {
359
+ @throw exception;
360
+ }
350
361
  } @finally {
351
362
  [retainedObjectsForInvocation removeAllObjects];
352
363
  }
353
364
 
354
365
  if (!isSync) {
355
- TurboModulePerfLogger::asyncMethodCallExecutionEnd(moduleName, methodNameStr.c_str(), asyncCallCounter);
366
+ TurboModulePerfLogger::asyncMethodCallExecutionEnd(moduleName, methodName, asyncCallCounter);
356
367
  return;
357
368
  }
358
369
 
359
370
  void *rawResult;
360
371
  [inv getReturnValue:&rawResult];
361
372
  result = (__bridge id)rawResult;
362
- TurboModulePerfLogger::syncMethodCallExecutionEnd(moduleName, methodNameStr.c_str());
373
+ TurboModulePerfLogger::syncMethodCallExecutionEnd(moduleName, methodName);
363
374
  };
364
375
 
365
376
  if (isSync) {
@@ -401,23 +412,23 @@ void ObjCTurboModule::performVoidMethodInvocation(
401
412
  }
402
413
 
403
414
  if (shouldVoidMethodsExecuteSync_) {
404
- TurboModulePerfLogger::syncMethodCallExecutionStart(moduleName, methodNameStr.c_str());
415
+ TurboModulePerfLogger::syncMethodCallExecutionStart(moduleName, methodName);
405
416
  } else {
406
- TurboModulePerfLogger::asyncMethodCallExecutionStart(moduleName, methodNameStr.c_str(), asyncCallCounter);
417
+ TurboModulePerfLogger::asyncMethodCallExecutionStart(moduleName, methodName, asyncCallCounter);
407
418
  }
408
419
 
409
420
  @try {
410
421
  [inv invokeWithTarget:strongModule];
411
422
  } @catch (NSException *exception) {
412
- throw convertNSExceptionToJSError(runtime, exception);
423
+ throw convertNSExceptionToJSError(runtime, exception, std::string{moduleName}, methodNameStr);
413
424
  } @finally {
414
425
  [retainedObjectsForInvocation removeAllObjects];
415
426
  }
416
427
 
417
428
  if (shouldVoidMethodsExecuteSync_) {
418
- TurboModulePerfLogger::syncMethodCallExecutionEnd(moduleName, methodNameStr.c_str());
429
+ TurboModulePerfLogger::syncMethodCallExecutionEnd(moduleName, methodName);
419
430
  } else {
420
- TurboModulePerfLogger::asyncMethodCallExecutionEnd(moduleName, methodNameStr.c_str(), asyncCallCounter);
431
+ TurboModulePerfLogger::asyncMethodCallExecutionEnd(moduleName, methodName, asyncCallCounter);
421
432
  }
422
433
 
423
434
  return;
@@ -27,6 +27,7 @@ header_search_paths = [
27
27
  "\"$(PODS_ROOT)/boost\"",
28
28
  "\"$(PODS_ROOT)/RCT-Folly\"",
29
29
  "\"$(PODS_ROOT)/DoubleConversion\"",
30
+ "\"$(PODS_ROOT)/fast_float/include\"",
30
31
  "\"$(PODS_ROOT)/fmt/include\"",
31
32
  "\"$(PODS_ROOT)/Headers/Private/React-Core\"",
32
33
  ]
@@ -66,7 +67,8 @@ Pod::Spec.new do |s|
66
67
 
67
68
  s.dependency "RCT-Folly"
68
69
  s.dependency "DoubleConversion"
69
- s.dependency "fmt", "9.1.0"
70
+ s.dependency "fast_float"
71
+ s.dependency "fmt"
70
72
  s.dependency "React-Core"
71
73
  s.dependency "React-cxxreact"
72
74
  s.dependency "React-jsi"
@@ -24,6 +24,7 @@ header_search_paths = [
24
24
  "\"$(PODS_ROOT)/RCT-Folly\"",
25
25
  "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\"",
26
26
  "\"$(PODS_ROOT)/DoubleConversion\"",
27
+ "\"$(PODS_ROOT)/fast_float/include\"",
27
28
  "\"$(PODS_ROOT)/fmt/include\""
28
29
  ]
29
30
 
@@ -55,8 +56,9 @@ Pod::Spec.new do |s|
55
56
  s.header_mappings_dir = "../../.."
56
57
  end
57
58
 
58
- s.dependency "RCT-Folly", folly_version
59
+ s.dependency "RCT-Folly"
59
60
  s.dependency "DoubleConversion"
60
- s.dependency "fmt", "9.1.0"
61
+ s.dependency "fast_float"
62
+ s.dependency "fmt"
61
63
  add_dependency(s, "React-debug")
62
64
  end
@@ -29,6 +29,7 @@ Pod::Spec.new do |s|
29
29
  "\"$(PODS_TARGET_SRCROOT)/../../../\"",
30
30
  "\"$(PODS_ROOT)/RCT-Folly\"",
31
31
  "\"$(PODS_ROOT)/DoubleConversion\"",
32
+ "\"$(PODS_ROOT)/fast_float/include\"",
32
33
  "\"$(PODS_ROOT)/fmt/include\""
33
34
  ]
34
35
 
@@ -65,11 +66,12 @@ Pod::Spec.new do |s|
65
66
  "CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard() }
66
67
 
67
68
  s.dependency "glog"
68
- s.dependency "RCT-Folly/Fabric", folly_version
69
+ s.dependency "RCT-Folly/Fabric"
69
70
  s.dependency "React-jsi"
70
71
  s.dependency "React-jsiexecutor"
71
72
  s.dependency "React-utils"
72
73
  s.dependency "React-Core" # [macOS] Needed for RCTUIKit
73
74
  s.dependency "DoubleConversion"
74
- s.dependency "fmt", "9.1.0"
75
+ s.dependency "fast_float"
76
+ s.dependency "fmt"
75
77
  end
@@ -27,6 +27,7 @@ Pod::Spec.new do |s|
27
27
  "\"$(PODS_TARGET_SRCROOT)\"",
28
28
  "\"$(PODS_ROOT)/RCT-Folly\"",
29
29
  "\"$(PODS_ROOT)/DoubleConversion\"",
30
+ "\"$(PODS_ROOT)/fast_float/include\"",
30
31
  "\"$(PODS_ROOT)/fmt/include\"",
31
32
  ].join(" ")
32
33
 
@@ -52,8 +52,29 @@ BOOL RCTIsAttributedStringEffectivelySame(
52
52
  NSDictionary<NSAttributedStringKey, id> *insensitiveAttributes,
53
53
  const facebook::react::TextAttributes &baseTextAttributes);
54
54
 
55
- @interface RCTWeakEventEmitterWrapper : NSObject
56
- @property (nonatomic, assign) facebook::react::SharedEventEmitter eventEmitter;
57
- @end
55
+ static inline NSData *RCTWrapEventEmitter(const facebook::react::SharedEventEmitter &eventEmitter)
56
+ {
57
+ auto eventEmitterPtr = new std::weak_ptr<const facebook::react::EventEmitter>(eventEmitter);
58
+ return [[NSData alloc] initWithBytesNoCopy:eventEmitterPtr
59
+ length:sizeof(eventEmitterPtr)
60
+ deallocator:^(void *ptrToDelete, NSUInteger) {
61
+ delete (std::weak_ptr<facebook::react::EventEmitter> *)ptrToDelete;
62
+ }];
63
+ }
64
+
65
+ static inline facebook::react::SharedEventEmitter RCTUnwrapEventEmitter(NSData *data)
66
+ {
67
+ if (data.length == 0) {
68
+ return nullptr;
69
+ }
70
+
71
+ auto weakPtr = dynamic_cast<std::weak_ptr<const facebook::react::EventEmitter> *>(
72
+ (std::weak_ptr<const facebook::react::EventEmitter> *)data.bytes);
73
+ if (weakPtr) {
74
+ return weakPtr->lock();
75
+ }
76
+
77
+ return nullptr;
78
+ }
58
79
 
59
80
  NS_ASSUME_NONNULL_END
@@ -16,45 +16,6 @@
16
16
 
17
17
  using namespace facebook::react;
18
18
 
19
- @implementation RCTWeakEventEmitterWrapper {
20
- std::weak_ptr<const EventEmitter> _weakEventEmitter;
21
- }
22
-
23
- - (void)setEventEmitter:(SharedEventEmitter)eventEmitter
24
- {
25
- _weakEventEmitter = eventEmitter;
26
- }
27
-
28
- - (SharedEventEmitter)eventEmitter
29
- {
30
- return _weakEventEmitter.lock();
31
- }
32
-
33
- - (void)dealloc
34
- {
35
- _weakEventEmitter.reset();
36
- }
37
-
38
- - (BOOL)isEqual:(id)object
39
- {
40
- // We consider the underlying EventEmitter as the identity
41
- if (![object isKindOfClass:[self class]]) {
42
- return NO;
43
- }
44
-
45
- auto thisEventEmitter = [self eventEmitter];
46
- auto otherEventEmitter = [((RCTWeakEventEmitterWrapper *)object) eventEmitter];
47
- return thisEventEmitter == otherEventEmitter;
48
- }
49
-
50
- - (NSUInteger)hash
51
- {
52
- // We consider the underlying EventEmitter as the identity
53
- return (NSUInteger)_weakEventEmitter.lock().get();
54
- }
55
-
56
- @end
57
-
58
19
  inline static UIFontWeight RCTUIFontWeightFromInteger(NSInteger fontWeight)
59
20
  {
60
21
  assert(fontWeight > 50);
@@ -413,8 +374,7 @@ static NSMutableAttributedString *RCTNSAttributedStringFragmentWithAttributesFro
413
374
 
414
375
  #if !TARGET_OS_MACCATALYST
415
376
  if (fragment.parentShadowView.componentHandle) {
416
- RCTWeakEventEmitterWrapper *eventEmitterWrapper = [RCTWeakEventEmitterWrapper new];
417
- eventEmitterWrapper.eventEmitter = fragment.parentShadowView.eventEmitter;
377
+ auto eventEmitterWrapper = RCTWrapEventEmitter(fragment.parentShadowView.eventEmitter);
418
378
 
419
379
  NSDictionary<NSAttributedStringKey, id> *additionalTextAttributes =
420
380
  @{RCTAttributedStringEventEmitterKey : eventEmitterWrapper};
@@ -291,11 +291,10 @@ static NSLineBreakMode RCTNSLineBreakModeFromEllipsizeMode(EllipsizeMode ellipsi
291
291
  // after (fraction == 1.0) the last character, then the attribute is valid.
292
292
  if (textStorage.length > 0 && (fraction > 0 || characterIndex > 0) &&
293
293
  (fraction < 1 || characterIndex < textStorage.length - 1)) {
294
- RCTWeakEventEmitterWrapper *eventEmitterWrapper =
295
- (RCTWeakEventEmitterWrapper *)[textStorage attribute:RCTAttributedStringEventEmitterKey
296
- atIndex:characterIndex
297
- effectiveRange:NULL];
298
- return eventEmitterWrapper.eventEmitter;
294
+ NSData *eventEmitterWrapper = (NSData *)[textStorage attribute:RCTAttributedStringEventEmitterKey
295
+ atIndex:characterIndex
296
+ effectiveRange:NULL];
297
+ return RCTUnwrapEventEmitter(eventEmitterWrapper);
299
298
  }
300
299
 
301
300
  return nil;
@@ -24,6 +24,7 @@ header_search_paths = [
24
24
  "\"$(PODS_TARGET_SRCROOT)/..\"",
25
25
  "\"$(PODS_ROOT)/RCT-Folly\"",
26
26
  "\"$(PODS_ROOT)/DoubleConversion\"",
27
+ "\"$(PODS_ROOT)/fast_float/include\"",
27
28
  "\"$(PODS_ROOT)/fmt/include\""
28
29
  ]
29
30
 
package/cli.js CHANGED
@@ -23,6 +23,15 @@ const deprecated = () => {
23
23
  );
24
24
  };
25
25
 
26
+ function findCommunityCli(startDir = process.cwd()) {
27
+ // With isolated node_modules (eg pnpm), we won't be able to find
28
+ // `@react-native-community/cli` starting from the `react-native` directory.
29
+ // Instead, we should use the project root, which we assume to be the cwd.
30
+ const options = {paths: [startDir]};
31
+ const rncli = require.resolve('@react-native-community/cli', options);
32
+ return require(rncli);
33
+ }
34
+
26
35
  function isMissingCliDependency(error) {
27
36
  return (
28
37
  error.code === 'MODULE_NOT_FOUND' &&
@@ -217,7 +226,7 @@ async function main() {
217
226
  }
218
227
 
219
228
  try {
220
- return require('@react-native-community/cli').run(name);
229
+ return findCommunityCli().run(name);
221
230
  } catch (e) {
222
231
  if (isMissingCliDependency(e)) {
223
232
  warnWithExplicitDependency();
@@ -231,7 +240,7 @@ if (require.main === module) {
231
240
  main();
232
241
  } else {
233
242
  try {
234
- cli = require('@react-native-community/cli');
243
+ cli = findCommunityCli();
235
244
  } catch (e) {
236
245
  // We silence @react-native-community/cli missing as it is no
237
246
  // longer a dependency
@@ -35,8 +35,9 @@ yoga-proguard-annotations = "1.19.0"
35
35
  # Native Dependencies
36
36
  boost="1_83_0"
37
37
  doubleconversion="1.1.6"
38
- fmt="9.1.0"
39
- folly="2024.01.01.00"
38
+ fastFloat="6.1.4"
39
+ fmt="11.0.2"
40
+ folly="2024.10.14.00"
40
41
  glog="0.3.5"
41
42
  gtest="1.12.1"
42
43
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-macos",
3
- "version": "0.76.8",
3
+ "version": "0.76.10",
4
4
  "description": "React Native for macOS",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -102,7 +102,8 @@
102
102
  },
103
103
  "peerDependencies": {
104
104
  "@types/react": "^18.2.6",
105
- "react": "^18.2.0"
105
+ "react": "^18.2.0",
106
+ "react-native": "0.76.9"
106
107
  },
107
108
  "peerDependenciesMeta": {
108
109
  "@types/react": {
@@ -111,13 +112,13 @@
111
112
  },
112
113
  "dependencies": {
113
114
  "@jest/create-cache-key-function": "^29.6.3",
114
- "@react-native-mac/virtualized-lists": "0.76.7",
115
- "@react-native/assets-registry": "0.76.7",
116
- "@react-native/codegen": "0.76.7",
117
- "@react-native/community-cli-plugin": "0.76.7",
118
- "@react-native/gradle-plugin": "0.76.7",
119
- "@react-native/js-polyfills": "0.76.7",
120
- "@react-native/normalize-colors": "0.76.7",
115
+ "@react-native-macos/virtualized-lists": "0.76.10",
116
+ "@react-native/assets-registry": "0.76.9",
117
+ "@react-native/codegen": "0.76.9",
118
+ "@react-native/community-cli-plugin": "0.76.9",
119
+ "@react-native/gradle-plugin": "0.76.9",
120
+ "@react-native/js-polyfills": "0.76.9",
121
+ "@react-native/normalize-colors": "0.76.9",
121
122
  "abort-controller": "^3.0.0",
122
123
  "anser": "^1.4.9",
123
124
  "ansi-regex": "^5.0.0",
@@ -20,9 +20,24 @@
20
20
 
21
21
  const verbose = process.env.DEBUG && process.env.DEBUG.includes('react-native');
22
22
 
23
+ function findCommunityPlatformPackage(spec, startDir = process.cwd()) {
24
+ // In monorepos, we cannot make any assumptions on where
25
+ // `@react-native-community/*` gets installed. The safest way to find it
26
+ // (barring adding an optional peer dependency) is to start from the project
27
+ // root.
28
+ //
29
+ // Note that we're assuming that the current working directory is the project
30
+ // root. This is also what `@react-native-community/cli` assumes (see
31
+ // https://github.com/react-native-community/cli/blob/14.x/packages/cli-tools/src/findProjectRoot.ts).
32
+ const main = require.resolve(spec, {paths: [startDir]});
33
+ return require(main);
34
+ }
35
+
23
36
  let android;
24
37
  try {
25
- android = require('@react-native-community/cli-platform-android');
38
+ android = findCommunityPlatformPackage(
39
+ '@react-native-community/cli-platform-android',
40
+ );
26
41
  } catch {
27
42
  if (verbose) {
28
43
  console.warn(
@@ -33,7 +48,9 @@ try {
33
48
 
34
49
  let ios;
35
50
  try {
36
- ios = require('@react-native-community/cli-platform-ios');
51
+ ios = findCommunityPlatformPackage(
52
+ '@react-native-community/cli-platform-ios',
53
+ );
37
54
  } catch {
38
55
  if (verbose) {
39
56
  console.warn(
@@ -58,27 +75,11 @@ try {
58
75
  const macosCommands = require('./local-cli/runMacOS/runMacOS'); // [macOS]
59
76
  const commands = [];
60
77
 
61
- try {
62
- const {
63
- bundleCommand,
64
- startCommand,
65
- } = require('@react-native/community-cli-plugin');
66
- commands.push(bundleCommand, startCommand);
67
- } catch (e) {
68
- const known =
69
- e.code === 'MODULE_NOT_FOUND' &&
70
- e.message.includes('@react-native-community/cli-server-api');
71
-
72
- if (!known) {
73
- throw e;
74
- }
75
-
76
- if (verbose) {
77
- console.warn(
78
- '@react-native-community/cli-server-api not found, the react-native.config.js may be unusable.',
79
- );
80
- }
81
- }
78
+ const {
79
+ bundleCommand,
80
+ startCommand,
81
+ } = require('@react-native/community-cli-plugin');
82
+ commands.push(bundleCommand, startCommand);
82
83
 
83
84
  const codegenCommand = {
84
85
  name: 'codegen',
@@ -80,13 +80,12 @@ class CodegenUtils
80
80
  "\"$(PODS_ROOT)/boost\"",
81
81
  "\"$(PODS_ROOT)/RCT-Folly\"",
82
82
  "\"$(PODS_ROOT)/DoubleConversion\"",
83
+ "\"$(PODS_ROOT)/fast_float/include\"",
83
84
  "\"$(PODS_ROOT)/fmt/include\"",
84
85
  "\"${PODS_ROOT}/Headers/Public/ReactCodegen/react/renderer/components\"",
85
86
  "\"$(PODS_ROOT)/Headers/Private/React-Fabric\"",
86
87
  "\"$(PODS_ROOT)/Headers/Private/React-RCTFabric\"",
87
88
  "\"$(PODS_ROOT)/Headers/Private/Yoga\"",
88
- "\"$(PODS_ROOT)/DoubleConversion\"",
89
- "\"$(PODS_ROOT)/fmt/include\"",
90
89
  "\"$(PODS_TARGET_SRCROOT)\"",
91
90
  ]
92
91
  framework_search_paths = []
@@ -46,11 +46,15 @@ module Helpers
46
46
  }
47
47
 
48
48
  @@folly_config = {
49
- :version => '2024.01.01.00',
49
+ :version => '2024.10.14.00',
50
50
  :git => 'https://github.com/facebook/folly.git',
51
51
  :compiler_flags => '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -Wno-comma -Wno-shorten-64-to-32'
52
52
  }
53
53
 
54
+ @@fast_float_config = {
55
+ :git => "https://github.com/fastfloat/fast_float.git",
56
+ }
57
+
54
58
  @@fmt_config = {
55
59
  :git => "https://github.com/fmtlib/fmt.git",
56
60
  }
@@ -89,6 +93,14 @@ module Helpers
89
93
  @@folly_config.update(new_folly_config)
90
94
  end
91
95
 
96
+ def self.fast_float_config
97
+ return @@fast_float_config
98
+ end
99
+
100
+ def self.set_fast_float_config(new_fast_float_config)
101
+ @@fast_float_config.update(new_fast_float_config)
102
+ end
103
+
92
104
  def self.boost_config
93
105
  return @@boost_config
94
106
  end
@@ -83,6 +83,7 @@ class NewArchitectureHelper
83
83
  header_search_paths = ["\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/Headers/Private/Yoga\""]
84
84
  if ENV['USE_FRAMEWORKS']
85
85
  header_search_paths << "\"$(PODS_ROOT)/DoubleConversion\""
86
+ header_search_paths << "\"$(PODS_ROOT)/fast_float/include\""
86
87
  header_search_paths << "\"$(PODS_ROOT)/fmt/include\""
87
88
  ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-graphics", "React_graphics", ["react/renderer/graphics/platform/ios"])
88
89
  .concat(ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-Fabric", "React_Fabric", ["react/renderer/components/view/platform/cxx"]))
@@ -194,16 +194,22 @@ class ReactNativePodsUtils
194
194
  private
195
195
 
196
196
  def self.add_build_settings_to_pod(installer, settings_name, settings_value, target_pod_name, configuration_type)
197
+ # [macOS
198
+ # Since some RN projects might combine multiple platforms into the same Xcode project,
199
+ # we'll be much more forgiving with the pod name matching in react-native-macos.
200
+ # Could be upstreamed as part of https://github.com/microsoft/react-native-macos/issues/2526.
201
+ valid_suffixes = ["", "-iOS", "-macOS", "-visionOS"]
202
+ # macOS]
197
203
  installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
198
- if pod_name.to_s == target_pod_name
204
+ if valid_suffixes.any? { |suffix| pod_name.to_s == "#{target_pod_name}#{suffix}" } # [macOS]
199
205
  target_installation_result.native_target.build_configurations.each do |config|
200
- if configuration_type == nil || (configuration_type != nil && config.type == configuration_type)
201
- config.build_settings[settings_name] ||= '$(inherited) '
202
- config.build_settings[settings_name] << settings_value
203
- end
206
+ if configuration_type == nil || (configuration_type != nil && config.type == configuration_type)
207
+ config.build_settings[settings_name] ||= '$(inherited) '
208
+ config.build_settings[settings_name] << settings_value
204
209
  end
205
210
  end
206
211
  end
212
+ end
207
213
  end
208
214
 
209
215
  def self.fix_library_search_path(config)
@@ -576,6 +582,7 @@ class ReactNativePodsUtils
576
582
  ReactNativePodsUtils.update_header_paths_if_depends_on(target_installation_result, "RCT-Folly", [
577
583
  "\"$(PODS_ROOT)/RCT-Folly\"",
578
584
  "\"$(PODS_ROOT)/DoubleConversion\"",
585
+ "\"$(PODS_ROOT)/fast_float/include\"",
579
586
  "\"$(PODS_ROOT)/fmt/include\"",
580
587
  "\"$(PODS_ROOT)/boost\""
581
588
  ])
@@ -651,6 +658,7 @@ class ReactNativePodsUtils
651
658
  "ReactCommon",
652
659
  "Yoga",
653
660
  "boost",
661
+ "fast_float",
654
662
  "fmt",
655
663
  "glog",
656
664
  "hermes-engine",
@@ -168,6 +168,7 @@ def use_react_native! (
168
168
  pod 'DoubleConversion', :podspec => "#{prefix}/third-party-podspecs/DoubleConversion.podspec"
169
169
  pod 'glog', :podspec => "#{prefix}/third-party-podspecs/glog.podspec"
170
170
  pod 'boost', :podspec => "#{prefix}/third-party-podspecs/boost.podspec"
171
+ pod 'fast_float', :podspec => "#{prefix}/third-party-podspecs/fast_float.podspec"
171
172
  pod 'fmt', :podspec => "#{prefix}/third-party-podspecs/fmt.podspec"
172
173
  pod 'RCT-Folly', :podspec => "#{prefix}/third-party-podspecs/RCT-Folly.podspec", :modular_headers => true
173
174
  pod 'SocketRocket', :podspec => "#{prefix}/third-party-podspecs/SocketRocket.podspec", :modular_headers => true # [visionOS]
@@ -293,6 +294,13 @@ def get_glog_config()
293
294
  return Helpers::Constants.glog_config
294
295
  end
295
296
 
297
+ # This method returns an hash with the fast_float git url
298
+ # that can be used to configure libraries.
299
+ # @return an hash with the `:git` field.
300
+ def get_fast_float_config()
301
+ return Helpers::Constants.fast_float_config
302
+ end
303
+
296
304
  # This method returns an hash with the fmt git url
297
305
  # that can be used to configure libraries.
298
306
  # @return an hash with the `:git` field.
@@ -332,6 +340,12 @@ def set_glog_config(glog_config)
332
340
  Helpers::Constants.set_glog_config(glog_config)
333
341
  end
334
342
 
343
+ # This method can be used to set the fast_float config
344
+ # that can be used to configure libraries.
345
+ def set_fast_float_config(fmt_config)
346
+ Helpers::Constants.set_fast_float_config(fast_float_config)
347
+ end
348
+
335
349
  # This method can be used to set the fmt config
336
350
  # that can be used to configure libraries.
337
351
  def set_fmt_config(fmt_config)
@@ -16,14 +16,13 @@ react_native_path = File.dirname(Pod::Executable.execute_command('node', ['-p',
16
16
 
17
17
  # package.json
18
18
  package = JSON.parse(File.read(File.join(react_native_path, "package.json")))
19
- # [macOS
20
- rn_version = package['version']
21
- version = findLastestVersionWithArtifact(rn_version) || rn_version
22
- # macOS]
19
+ version = findMatchingHermesVersion(package) # [macOS] Use special logic instead of just package['version']
23
20
 
24
21
  source_type = hermes_source_type(version, react_native_path)
25
22
  source = podspec_source(source_type, version, react_native_path)
26
23
 
24
+ version = version || package['version'] # [macOS] If version is nil, fall back to package version so CocoaPods doesn't fail
25
+
27
26
  Pod::Spec.new do |spec|
28
27
  spec.name = "hermes-engine"
29
28
  spec.version = version