@depup/react-native 0.86.2-depup.0 → 0.87.1-depup.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.
- package/Libraries/ActionSheetIOS/ActionSheetIOS.js +19 -24
- package/Libraries/ActionSheetIOS/React-RCTActionSheet.podspec +1 -1
- package/Libraries/Alert/Alert.js +38 -1
- package/Libraries/Animated/AnimatedEvent.js +1 -1
- package/Libraries/Animated/AnimatedExports.js +22 -0
- package/Libraries/Animated/AnimatedExports.js.flow +1 -1
- package/Libraries/Animated/AnimatedImplementation.js +126 -5
- package/Libraries/Animated/Easing.js +4 -3
- package/Libraries/Animated/NativeAnimatedAllowlist.js +37 -0
- package/Libraries/Animated/animations/Animation.js +14 -5
- package/Libraries/Animated/animations/DecayAnimation.js +1 -0
- package/Libraries/Animated/animations/SpringAnimation.js +1 -0
- package/Libraries/Animated/animations/TimingAnimation.js +9 -0
- package/Libraries/Animated/components/AnimatedScrollView.js +1 -1
- package/Libraries/Animated/createAnimatedComponent.js +3 -3
- package/Libraries/Animated/nodes/AnimatedColor.js +8 -8
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +106 -0
- package/Libraries/Animated/nodes/AnimatedNode.js +1 -1
- package/Libraries/Animated/nodes/AnimatedProps.js +27 -3
- package/Libraries/Animated/nodes/AnimatedValue.js +10 -2
- package/Libraries/Animated/nodes/AnimatedValueXY.js +2 -2
- package/Libraries/AppDelegate/RCTAppDelegate.h +5 -9
- package/Libraries/AppDelegate/RCTAppDelegate.mm +0 -20
- package/Libraries/AppDelegate/RCTAppSetupUtils.h +0 -18
- package/Libraries/AppDelegate/RCTAppSetupUtils.mm +0 -78
- package/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm +18 -21
- package/Libraries/AppDelegate/RCTReactNativeFactory.h +5 -41
- package/Libraries/AppDelegate/RCTReactNativeFactory.mm +0 -82
- package/Libraries/AppDelegate/RCTRootViewFactory.h +4 -1
- package/Libraries/AppDelegate/RCTRootViewFactory.mm +3 -101
- package/Libraries/AppDelegate/React-RCTAppDelegate.podspec +2 -1
- package/Libraries/AppState/AppState.d.ts +4 -1
- package/Libraries/AppState/AppState.js +32 -17
- package/Libraries/BatchedBridge/MessageQueue.js +42 -51
- package/Libraries/BatchedBridge/NativeModules.js +7 -0
- package/Libraries/Blob/Blob.js +7 -1
- package/Libraries/Blob/FileReader.js +6 -0
- package/Libraries/Blob/React-RCTBlob.podspec +1 -1
- package/Libraries/Blob/URLSearchParams.js.flow +1 -1
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +20 -9
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +30 -43
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +59 -49
- package/Libraries/Components/ActivityIndicator/ActivityIndicatorViewNativeComponent.js +2 -2
- package/Libraries/Components/Button.js +98 -183
- package/Libraries/Components/Clipboard/Clipboard.js +5 -0
- package/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js +2 -2
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +8 -69
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts +10 -1
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.ios.js +2 -0
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +26 -31
- package/Libraries/Components/Keyboard/Keyboard.js +23 -60
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +15 -7
- package/Libraries/Components/Pressable/Pressable.js +39 -17
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +5 -6
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +4 -4
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidNativeComponent.js +2 -2
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +17 -0
- package/Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutNativeComponent.js +2 -2
- package/Libraries/Components/RefreshControl/PullToRefreshViewNativeComponent.js +2 -2
- package/Libraries/Components/RefreshControl/RefreshControl.js +40 -50
- package/Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js +2 -2
- package/Libraries/Components/SafeAreaView/SafeAreaView.js +8 -8
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollContentViewNativeComponent.js +2 -2
- package/Libraries/Components/ScrollView/ScrollView.d.ts +55 -43
- package/Libraries/Components/ScrollView/ScrollView.js +205 -118
- package/Libraries/Components/ScrollView/ScrollViewCommands.js +4 -4
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +1 -1
- package/Libraries/Components/StatusBar/StatusBar.d.ts +7 -54
- package/Libraries/Components/StatusBar/StatusBar.js +84 -160
- package/Libraries/Components/Switch/AndroidSwitchNativeComponent.js +2 -2
- package/Libraries/Components/Switch/Switch.js +76 -75
- package/Libraries/Components/Switch/SwitchNativeComponent.js +2 -2
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +1 -1
- package/Libraries/Components/TextInput/InputAccessoryView.js +13 -61
- package/Libraries/Components/TextInput/RCTInputAccessoryViewNativeComponent.js +2 -2
- package/Libraries/Components/TextInput/TextInput.d.ts +9 -2
- package/Libraries/Components/TextInput/TextInput.flow.js +20 -3
- package/Libraries/Components/TextInput/TextInput.js +116 -111
- package/Libraries/Components/TextInput/TextInputNativeCommands.js +3 -3
- package/Libraries/Components/ToastAndroid/ToastAndroid.android.js +25 -19
- package/Libraries/Components/Touchable/Touchable.d.ts +1 -1
- package/Libraries/Components/Touchable/Touchable.js +94 -95
- package/Libraries/Components/Touchable/TouchableHighlight.js +45 -112
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +13 -25
- package/Libraries/Components/Touchable/TouchableOpacity.js +14 -84
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +4 -3
- package/Libraries/Components/UnimplementedViews/UnimplementedNativeViewNativeComponent.js +2 -2
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +1 -0
- package/Libraries/Components/View/View.js +83 -86
- package/Libraries/Components/View/ViewAccessibility.d.ts +12 -2
- package/Libraries/Components/View/ViewAccessibility.js +17 -6
- package/Libraries/Components/View/ViewNativeComponent.js +4 -6
- package/Libraries/Components/View/ViewPropTypes.js +65 -13
- package/Libraries/Core/InitializeCore.js +9 -1
- package/Libraries/Core/ReactFiberErrorDialog.js +3 -3
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/Core/Timers/JSTimers.js +53 -52
- package/Libraries/Core/setUpGlobals.js +9 -4
- package/Libraries/Core/setUpNavigator.js +7 -2
- package/Libraries/Core/setUpReactDevTools.js +0 -118
- package/Libraries/Core/setUpXHR.js +6 -2
- package/Libraries/Debugging/DebuggingOverlay.js +2 -2
- package/Libraries/Debugging/DebuggingOverlayNativeComponent.js +2 -2
- package/Libraries/EventEmitter/NativeEventEmitter.js +29 -0
- package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +7 -7
- package/Libraries/EventEmitter/RCTNativeAppEventEmitter.d.ts +1 -1
- package/Libraries/EventEmitter/RCTNativeAppEventEmitter.js +3 -0
- package/Libraries/FBLazyVector/FBLazyVector.podspec +1 -1
- package/Libraries/Image/AssetSourceResolver.js +18 -27
- package/Libraries/Image/Image.android.js +13 -2
- package/Libraries/Image/Image.ios.js +3 -1
- package/Libraries/Image/ImageBackground.js +30 -18
- package/Libraries/Image/ImageProps.js +116 -117
- package/Libraries/Image/ImageSource.d.ts +1 -1
- package/Libraries/Image/ImageSource.js +9 -9
- package/Libraries/Image/ImageSourceUtils.js +10 -7
- package/Libraries/Image/ImageTypes.flow.js +2 -0
- package/Libraries/Image/ImageViewNativeComponent.js +1 -1
- package/Libraries/Image/RCTImageLoader.mm +61 -64
- package/Libraries/Image/RCTImageStoreManager.h +0 -2
- package/Libraries/Image/React-RCTImage.podspec +1 -1
- package/Libraries/Image/RelativeImageStub.js +1 -1
- package/Libraries/Image/resolveAssetSource.js +1 -1
- package/Libraries/Interaction/PanResponder.js +102 -97
- package/Libraries/LayoutAnimation/LayoutAnimation.js +22 -6
- package/Libraries/Linking/Linking.js +24 -23
- package/Libraries/LinkingIOS/React-RCTLinking.podspec +1 -1
- package/Libraries/Lists/FlatList.d.ts +6 -17
- package/Libraries/Lists/FlatList.js +7 -8
- package/Libraries/Lists/SectionList.js +7 -0
- package/Libraries/Lists/VirtualizedList.js +3 -0
- package/Libraries/Lists/VirtualizedSectionList.js +4 -0
- package/Libraries/LogBox/LogBox.js +3 -3
- package/Libraries/LogBox/UI/AnsiHighlight.js +2 -1
- package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +2 -2
- package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +4 -1
- package/Libraries/LogBox/UI/LogBoxInspectorFooterButton.js +3 -1
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +8 -2
- package/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js +9 -2
- package/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +17 -4
- package/Libraries/LogBox/UI/LogBoxInspectorSection.js +3 -1
- package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +3 -1
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +2 -0
- package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +4 -2
- package/Libraries/LogBox/UI/LogBoxMessage.js +18 -5
- package/Libraries/LogBox/UI/LogBoxNotificationCountBadge.js +4 -1
- package/Libraries/LogBox/UI/LogBoxNotificationMessage.js +1 -0
- package/Libraries/LogBox/UI/LogBoxStyle.js +0 -4
- package/Libraries/Modal/Modal.d.ts +5 -4
- package/Libraries/Modal/Modal.js +71 -37
- package/Libraries/Modal/RCTModalHostViewNativeComponent.js +2 -2
- package/Libraries/NativeAnimation/React-RCTAnimation.podspec +1 -1
- package/Libraries/NativeComponent/BaseViewConfig.android.js +17 -0
- package/Libraries/NativeComponent/ViewConfig.js +3 -3
- package/Libraries/NativeComponent/ViewConfigIgnore.js +1 -1
- package/Libraries/Network/RCTHTTPRequestHandler.h +1 -1
- package/Libraries/Network/React-RCTNetwork.podspec +1 -1
- package/Libraries/Performance/Systrace.js +36 -0
- package/Libraries/PermissionsAndroid/PermissionsAndroid.d.ts +4 -2
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +29 -17
- package/Libraries/Pressability/Pressability.js +1 -1
- package/Libraries/PushNotificationIOS/PushNotificationIOS.js +4 -0
- package/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec +1 -1
- package/Libraries/ReactNative/AppContainer-dev.js +3 -1
- package/Libraries/ReactNative/AppRegistry.flow.js +1 -0
- package/Libraries/ReactNative/AppRegistry.js +15 -11
- package/Libraries/ReactNative/AppRegistryImpl.js +57 -11
- package/Libraries/ReactNative/DisplayMode.js +1 -1
- package/Libraries/ReactNative/FabricUIManager.js +29 -26
- package/Libraries/ReactNative/I18nManager.js +20 -0
- package/Libraries/ReactNative/UIManager.js +53 -0
- package/Libraries/ReactNative/renderApplication.js +1 -1
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +5 -126
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js.flow +5 -41
- package/Libraries/Renderer/README.md +2 -2
- package/Libraries/Renderer/shims/ReactNativeTypes.js +36 -36
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +4 -4
- package/Libraries/Required/RCTRequired.podspec +1 -1
- package/Libraries/Settings/React-RCTSettings.podspec +1 -1
- package/Libraries/Settings/Settings.ios.js +22 -0
- package/Libraries/Share/Share.js +25 -28
- package/Libraries/StyleSheet/PlatformColorValueTypes.js.flow +6 -0
- package/Libraries/StyleSheet/StyleSheet.js +42 -2
- package/Libraries/StyleSheet/StyleSheet.js.flow +1 -1
- package/Libraries/StyleSheet/StyleSheetExports.js +7 -5
- package/Libraries/StyleSheet/StyleSheetExports.js.flow +1 -1
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +24 -3
- package/Libraries/StyleSheet/StyleSheetTypes.js +34 -6
- package/Libraries/StyleSheet/flattenStyle.js +28 -13
- package/Libraries/StyleSheet/private/_TransformStyle.js +16 -14
- package/Libraries/Text/React-RCTText.podspec +1 -1
- package/Libraries/Text/Text.js +12 -9
- package/Libraries/Text/TextEffectNativeComponent.js +31 -0
- package/Libraries/Text/TextInput/Multiline/RCTUITextView.mm +0 -1
- package/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h +0 -1
- package/Libraries/Text/TextInput/Singleline/RCTUITextField.mm +0 -1
- package/Libraries/Text/TextProps.js +59 -93
- package/Libraries/Text/requireNativeTextEffect.js +28 -0
- package/Libraries/TurboModule/RCTExport.js +1 -1
- package/Libraries/TypeSafety/RCTTypeSafety.podspec +1 -1
- package/Libraries/Types/CoreEventTypes.d.ts +8 -0
- package/Libraries/Types/CoreEventTypes.js +32 -29
- package/Libraries/Types/UIManagerJSInterface.js +2 -2
- package/Libraries/Utilities/Appearance.d.ts +32 -17
- package/Libraries/Utilities/Appearance.js +35 -18
- package/Libraries/Utilities/BackHandler.android.js +13 -28
- package/Libraries/Utilities/BackHandler.js.flow +18 -2
- package/Libraries/Utilities/DevSettings.js +8 -1
- package/Libraries/Utilities/Dimensions.js +18 -12
- package/Libraries/Utilities/PixelRatio.js +5 -2
- package/Libraries/Utilities/Platform.js.flow +4 -0
- package/Libraries/Utilities/PlatformTypes.js +77 -0
- package/Libraries/Utilities/PolyfillFunctions.js +1 -1
- package/Libraries/Utilities/differ/deepDiffer.js +5 -2
- package/Libraries/Utilities/useColorScheme.js +11 -1
- package/Libraries/Utilities/useWindowDimensions.js +6 -0
- package/Libraries/Vibration/React-RCTVibration.podspec +1 -1
- package/Libraries/Vibration/Vibration.js +14 -11
- package/Libraries/vendor/emitter/EventEmitter.js +3 -3
- package/README.md +7 -9
- package/React/Base/RCTBridge+Private.h +0 -22
- package/React/Base/RCTBridge.h +10 -8
- package/React/Base/RCTBridge.mm +5 -447
- package/React/Base/RCTBridgeDelegate.h +1 -56
- package/React/Base/RCTBridgeModule.h +0 -9
- package/React/Base/RCTBridgeProxy.h +8 -0
- package/React/Base/RCTBridgeProxy.mm +3 -20
- package/React/Base/RCTBundleManager.h +0 -3
- package/React/Base/RCTBundleManager.m +0 -31
- package/React/Base/RCTBundleURLProvider.mm +4 -4
- package/React/Base/RCTCallableJSModules.m +0 -18
- package/React/Base/RCTConstants.h +1 -0
- package/React/Base/RCTConstants.m +1 -0
- package/React/Base/RCTConvert.mm +3 -0
- package/React/Base/RCTDisplayLink.h +3 -1
- package/React/Base/RCTJavaScriptExecutor.h +0 -69
- package/React/Base/RCTModuleData.mm +2 -483
- package/React/Base/RCTModuleRegistry.m +0 -25
- package/React/Base/RCTRootView.m +3 -374
- package/React/Base/RCTUtils.h +0 -3
- package/React/Base/RCTUtils.mm +17 -27
- package/React/Base/RCTVersion.m +2 -2
- package/React/Base/RCTViewRegistry.m +1 -29
- package/React/Base/Surface/RCTSurface.mm +1 -582
- package/React/Base/Surface/RCTSurfaceRootShadowView.m +0 -89
- package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm +0 -1
- package/React/CoreModules/PlatformStubs/RCTStatusBarManager.mm +0 -2
- package/React/CoreModules/RCTAlertController.mm +1 -0
- package/React/CoreModules/RCTAlertManager.mm +0 -5
- package/React/CoreModules/RCTLogBox.mm +0 -11
- package/React/CoreModules/RCTLogBoxView.h +0 -3
- package/React/CoreModules/RCTLogBoxView.mm +0 -31
- package/React/CoreModules/RCTPerfMonitor.mm +0 -2
- package/React/CoreModules/RCTStatusBarManager.mm +0 -11
- package/React/CoreModules/React-CoreModules.podspec +1 -1
- package/React/CxxModule/RCTCxxUtils.h +0 -8
- package/React/CxxModule/RCTCxxUtils.mm +0 -17
- package/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec-generated.mm +179 -7
- package/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h +100 -2
- package/React/FBReactNativeSpec/FBReactNativeSpecJSI.h +373 -119
- package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/ComponentDescriptors.cpp +1 -1
- package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/ComponentDescriptors.h +1 -1
- package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/EventEmitters.cpp +71 -71
- package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/EventEmitters.h +96 -96
- package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/Props.cpp +357 -363
- package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/Props.h +211 -212
- package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/RCTComponentViewHelpers.h +107 -107
- package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/ShadowNodes.cpp +1 -1
- package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/ShadowNodes.h +11 -11
- package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/States.h +2 -2
- package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.h +4 -0
- package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm +4 -0
- package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.h +4 -0
- package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.mm +5 -0
- package/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm +0 -1
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm +14 -0
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +13 -4
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTVirtualViewContainerState.mm +12 -26
- package/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +39 -4
- package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +1 -1
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +5 -5
- package/React/Fabric/Mounting/ComponentViews/VirtualView/RCTVirtualViewComponentView.mm +0 -18
- package/React/Fabric/Mounting/RCTComponentViewFactory.mm +9 -5
- package/React/Fabric/RCTSurfacePresenter.mm +86 -5
- package/React/Fabric/RCTSurfacePresenterBridgeAdapter.h +2 -0
- package/React/I18n/RCTLocalizedString.mm +38 -2
- package/React/Modules/RCTEventEmitter.m +30 -10
- package/React/Modules/RCTI18nUtil.m +3 -1
- package/React/Modules/RCTUIManager.mm +0 -1501
- package/React/React-RCTFBReactNativeSpec.podspec +2 -2
- package/React/React-RCTFabric.podspec +1 -1
- package/React/Runtime/React-RCTRuntime.podspec +1 -1
- package/React/Tests/Text/RCTAttributedTextUtilsTest.mm +27 -0
- package/React/Views/RCTModalHostViewController.h +0 -15
- package/React/Views/RCTModalHostViewManager.h +0 -24
- package/React/Views/RCTShadowView.h +0 -2
- package/React/Views/RCTShadowView.m +0 -723
- package/React/Views/ScrollView/RCTScrollView.h +0 -81
- package/React/Views/ScrollView/RCTScrollableProtocol.h +0 -4
- package/React-Core-prebuilt.podspec +45 -17
- package/React-Core.podspec +10 -3
- package/React.podspec +1 -1
- package/ReactAndroid/api/ReactAndroid.api +128 -142
- package/ReactAndroid/build.gradle.kts +27 -22
- package/ReactAndroid/external-artifacts/build.gradle.kts +49 -0
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/hermes-engine/build.gradle.kts +14 -14
- package/ReactAndroid/publish.gradle +5 -5
- package/ReactAndroid/src/debug/AndroidManifest.xml +6 -0
- package/ReactAndroid/src/debugOptimized/AndroidManifest.xml +22 -0
- package/ReactAndroid/src/main/java/com/facebook/react/BaseReactPackage.kt +3 -7
- package/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java +4 -2
- package/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.kt +4 -6
- package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +0 -3
- package/ReactAndroid/src/main/java/com/facebook/react/ReactNativeHost.kt +212 -0
- package/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java +0 -16
- package/ReactAndroid/src/main/java/com/facebook/react/animated/PropsAnimatedNode.kt +6 -1
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/Arguments.kt +1 -0
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/BridgeReactContext.kt +287 -0
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/ColorPropConverter.kt +16 -0
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java +15 -2
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/interop/InteropModuleRegistry.kt +1 -3
- package/ReactAndroid/src/main/java/com/facebook/react/common/build/ReactBuildConfig.kt +4 -0
- package/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/MapBuffer.kt +50 -2
- package/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/ReadableMapBuffer.kt +63 -22
- package/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/WritableMapBuffer.kt +33 -0
- package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt +4 -12
- package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactActivityDelegate.kt +14 -10
- package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactNativeHost.kt +6 -6
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.kt +50 -47
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/CxxInspectorPackagerConnection.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.kt +0 -4
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerFactory.kt +10 -10
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/LocalNetworkPermissionUtil.kt +49 -0
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/MultipartStreamReader.kt +101 -26
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +40 -38
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManagerBinding.kt +1 -10
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManagerProviderImpl.kt +0 -3
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/ViewTransitionSnapshotManager.kt +15 -11
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountItemDispatcher.kt +4 -4
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.kt +7 -13
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.kt +160 -187
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/SynchronousMountItem.kt +12 -8
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +30 -66
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +51 -111
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +11 -23
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +12 -24
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +57 -123
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsOverrides_RNOSS_Canary_Android.kt +7 -5
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsOverrides_RNOSS_Experimental_Android.kt +3 -5
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +11 -23
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeNewArchitectureFeatureFlags.kt +0 -24
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeNewArchitectureFeatureFlagsDefaults.kt +0 -4
- package/ReactAndroid/src/main/java/com/facebook/react/modules/appearance/AppearanceModule.kt +1 -0
- package/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.kt +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/modules/core/TimingModule.kt +3 -0
- package/ReactAndroid/src/main/java/com/facebook/react/modules/image/ImageLoaderModule.kt +50 -0
- package/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.kt +8 -4
- package/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkEventUtil.kt +53 -3
- package/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.kt +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.kt +2 -77
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/modules/websocket/WebSocketModule.kt +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessCatalystInstance.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessReactContext.kt +9 -4
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.kt +4 -19
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.kt +2 -6
- package/ReactAndroid/src/main/java/com/facebook/react/touch/ReactInterceptingViewGroup.kt +4 -4
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java +47 -10
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/DisplayMetricsHolder.kt +1 -49
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/HasChildPressedStateDelay.kt +29 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSPointerDispatcher.kt +796 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSTouchDispatcher.kt +2 -4
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.kt +27 -27
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.kt +184 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNode.kt +486 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNodeImpl.java +8 -8
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ShadowNodeRegistry.kt +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/SkewMatrixHelper.kt +200 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ThemedReactContext.kt +3 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/TouchTargetHelper.kt +6 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/TransformHelper.kt +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIBlock.kt +7 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.kt +645 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstantsHelper.kt +2 -3
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.kt +142 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupManager.kt +0 -10
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java +3 -3
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagersPropertyCache.kt +527 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewProps.kt +3 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/BorderRadiusStyle.kt +6 -6
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/style/ColorStop.kt +6 -0
- package/ReactAndroid/src/main/java/com/facebook/react/util/AndroidVersion.kt +7 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/drawer/ReactDrawerLayout.kt +8 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostManager.kt +0 -3
- package/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.kt +2 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.kt +4 -4
- package/ReactAndroid/src/main/java/com/facebook/react/views/safeareaview/ReactSafeAreaView.kt +2 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.kt +1640 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollViewManager.kt +6 -6
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactNestedScrollView.kt +1317 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactNestedScrollViewManager.kt +8 -8
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.kt +1309 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewManager.kt +7 -7
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/VirtualViewContainer.kt +19 -33
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/VirtualViewContainerStateClassic.kt +8 -6
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/VirtualViewContainerStateExperimental.kt +4 -4
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/generate-nested-scroll-view.js +13 -20
- package/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/ReactSwipeRefreshLayout.kt +7 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/MutableSpannableLayout.kt +107 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/PreparedLayoutTextView.kt +122 -10
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java +92 -2
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.kt +3 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTypefaceUtils.kt +41 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.kt +48 -2
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextDecorationStyle.kt +200 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextEffectRegistry.kt +45 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextEffectSpanFactory.kt +17 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.kt +361 -15
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/AnimatedEffectSpan.kt +37 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/{DrawCommandSpan.kt → CanvasEffectSpan.kt} +3 -4
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/CustomStyleSpan.kt +23 -3
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactStrikethroughSpan.kt +30 -3
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/ReactUnderlineSpan.kt +25 -3
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/SetSpanOperation.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/StatefulSpan.kt +21 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/TextEffectSpan.kt +19 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/TouchableSpan.kt +29 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.kt +83 -11
- package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.kt +6 -2
- package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextSelectionWatcher.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.kt +3 -17
- package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.kt +8 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/view/WindowUtil.kt +2 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/virtual/VirtualViewRenderState.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/virtual/view/ReactVirtualView.kt +7 -8
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaAlign.kt +45 -0
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaBoxSizing.kt +27 -0
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfig.kt +15 -0
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfigJNIBase.kt +6 -0
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaDimension.kt +27 -0
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaDisplay.kt +31 -0
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaEdge.kt +41 -0
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaErrata.kt +37 -0
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaExperimentalFeature.kt +27 -0
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaFlexDirection.kt +31 -0
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaGridTrackType.kt +33 -0
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaGutter.kt +29 -0
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaJustify.kt +43 -0
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogLevel.kt +39 -0
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureMode.kt +29 -0
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaNative.kt +16 -0
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaNode.kt +12 -2
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIBase.kt +762 -0
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIFinalizer.kt +4 -4
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeType.kt +27 -0
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaOverflow.kt +29 -0
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaPositionType.kt +29 -0
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaProps.kt +24 -2
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaUnit.kt +37 -0
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaWrap.kt +29 -0
- package/ReactAndroid/src/main/jni/CMakeLists.txt +1 -2
- package/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNIVanilla.cpp +94 -0
- package/ReactAndroid/src/main/jni/react/devsupport/JCxxInspectorPackagerConnectionDelegateImpl.cpp +3 -0
- package/ReactAndroid/src/main/jni/react/fabric/AndroidAnimationChoreographer.h +10 -10
- package/ReactAndroid/src/main/jni/react/fabric/CoreComponentsRegistry.cpp +3 -0
- package/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp +12 -15
- package/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.h +1 -3
- package/ReactAndroid/src/main/jni/react/fabric/test/FabricMountingManagerTest.cpp +159 -0
- package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +69 -153
- package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +15 -33
- package/ReactAndroid/src/main/jni/react/jni/JReactMarker.cpp +10 -24
- package/ReactAndroid/src/main/jni/react/jni/JReactMarker.h +0 -2
- package/ReactAndroid/src/main/jni/react/mapbuffer/react/common/mapbuffer/JWritableMapBuffer.cpp +13 -0
- package/ReactAndroid/src/main/jni/react/runtime/jni/JReactInstance.cpp +4 -1
- package/ReactAndroid/src/main/jni/react/turbomodule/ReactCommon/TurboModuleManager.cpp +8 -0
- package/ReactAndroid/src/main/jni/react/turbomodule/ReactCommon/TurboModuleManager.h +4 -0
- package/ReactAndroid/src/main/res/views/uimanager/values/ids.xml +5 -0
- package/ReactAndroid/src/main/res/views/uimanager/values-zu/strings.xml +3 -0
- package/ReactApple/Libraries/RCTFoundation/RCTDeprecation/RCTDeprecation.podspec +1 -1
- package/ReactApple/RCTAnimatedModuleProvider/React-RCTAnimatedModuleProvider.podspec +63 -0
- package/ReactApple/RCTSwiftUI/RCTSwiftUI.podspec +1 -1
- package/ReactApple/RCTSwiftUIWrapper/RCTSwiftUIWrapper.podspec +1 -1
- package/ReactCommon/React-Fabric.podspec +3 -1
- package/ReactCommon/React-FabricComponents.podspec +1 -1
- package/ReactCommon/React-FabricImage.podspec +1 -1
- package/ReactCommon/React-Mapbuffer.podspec +1 -1
- package/ReactCommon/ReactCommon.podspec +3 -13
- package/ReactCommon/callinvoker/React-callinvoker.podspec +1 -1
- package/ReactCommon/cmake-utils/react-native-flags.cmake +1 -3
- package/ReactCommon/cxxreact/CMakeLists.txt +1 -0
- package/ReactCommon/cxxreact/ErrorUtils.h +2 -32
- package/ReactCommon/cxxreact/Instance.cpp +1 -26
- package/ReactCommon/cxxreact/Instance.h +0 -2
- package/ReactCommon/cxxreact/NativeToJsBridge.cpp +3 -2
- package/ReactCommon/cxxreact/RAMBundleRegistry.cpp +0 -12
- package/ReactCommon/cxxreact/RAMBundleRegistry.h +0 -5
- package/ReactCommon/cxxreact/React-cxxreact.podspec +3 -2
- package/ReactCommon/cxxreact/ReactMarker.cpp +4 -30
- package/ReactCommon/cxxreact/ReactMarker.h +38 -21
- package/ReactCommon/cxxreact/ReactNativeVersion.h +4 -4
- package/ReactCommon/cxxreact/TraceSection.h +1 -1
- package/ReactCommon/cxxreact/tests/methodcall.cpp +4 -0
- package/ReactCommon/hermes/React-hermes.podspec +1 -1
- package/ReactCommon/hermes/executor/HermesExecutorFactory.cpp +6 -79
- package/ReactCommon/hermes/executor/React-jsitracing.podspec +1 -1
- package/ReactCommon/jserrorhandler/ErrorUtils.cpp +42 -0
- package/{React/CxxLogUtils/RCTDefaultCxxLogFunction.h → ReactCommon/jserrorhandler/ErrorUtils.h} +2 -2
- package/ReactCommon/jserrorhandler/JsErrorHandler.cpp +1 -1
- package/ReactCommon/jserrorhandler/React-jserrorhandler.podspec +3 -4
- package/ReactCommon/jsi/React-jsi.podspec +1 -1
- package/ReactCommon/jsi/jsi/hermes-interfaces.h +53 -0
- package/ReactCommon/jsiexecutor/React-jsiexecutor.podspec +3 -2
- package/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp +3 -14
- package/ReactCommon/jsiexecutor/jsireact/JSINativeModules.cpp +4 -13
- package/ReactCommon/jsinspector-modern/HostAgent.cpp +54 -0
- package/ReactCommon/jsinspector-modern/HostTarget.h +0 -7
- package/ReactCommon/jsinspector-modern/HostTargetTraceRecording.cpp +10 -7
- package/ReactCommon/jsinspector-modern/InspectorPackagerConnection.cpp +4 -1
- package/ReactCommon/jsinspector-modern/React-jsinspector.podspec +1 -1
- package/ReactCommon/jsinspector-modern/RuntimeAgent.cpp +7 -0
- package/ReactCommon/jsinspector-modern/RuntimeTarget.cpp +20 -0
- package/ReactCommon/jsinspector-modern/RuntimeTarget.h +16 -0
- package/ReactCommon/jsinspector-modern/SessionState.h +31 -0
- package/ReactCommon/jsinspector-modern/cdp/React-jsinspectorcdp.podspec +1 -1
- package/ReactCommon/jsinspector-modern/network/React-jsinspectornetwork.podspec +1 -1
- package/ReactCommon/jsinspector-modern/tests/HostTargetTest.cpp +53 -0
- package/ReactCommon/jsinspector-modern/tracing/HostTracingProfile.h +14 -1
- package/ReactCommon/jsinspector-modern/tracing/React-jsinspectortracing.podspec +1 -1
- package/ReactCommon/jsinspector-modern/tracing/TraceRecordingState.h +11 -0
- package/ReactCommon/jsitooling/React-jsitooling.podspec +1 -1
- package/ReactCommon/logger/React-logger.podspec +1 -1
- package/ReactCommon/oscompat/React-oscompat.podspec +1 -1
- package/ReactCommon/react/bridging/ArrayBuffer.h +180 -0
- package/ReactCommon/react/bridging/Bridging.h +1 -0
- package/ReactCommon/react/bridging/Convert.h +12 -0
- package/ReactCommon/react/bridging/React-bridging.podspec +44 -0
- package/ReactCommon/react/bridging/tests/BridgingTest.cpp +185 -11
- package/ReactCommon/react/bridging/tests/ClassTest.cpp +22 -0
- package/ReactCommon/react/cxxstableapi/CMakeLists.txt +18 -0
- package/ReactCommon/react/cxxstableapi/FrameworksGuard.h +35 -0
- package/ReactCommon/react/cxxstableapi/PrivateGuard.h +34 -0
- package/ReactCommon/react/cxxstableapi/React-cxxstableapi.podspec +34 -0
- package/ReactCommon/react/cxxstableapi/UmbrellaGuard.h +53 -0
- package/ReactCommon/react/debug/React-debug.podspec +1 -1
- package/ReactCommon/react/debug/redbox/JscSafeUrl.h +1 -1
- package/ReactCommon/react/featureflags/React-featureflags.podspec +1 -1
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +21 -45
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +26 -56
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +134 -242
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +14 -26
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +20 -44
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +43 -97
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsOverridesOSSCanary.h +10 -6
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsOverridesOSSExperimental.h +3 -7
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsOverridesOSSStable.h +0 -8
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +7 -13
- package/ReactCommon/react/nativemodule/core/ReactCommon/TurboModule.h +1 -0
- package/ReactCommon/react/nativemodule/core/iostests/RCTTurboModuleTests.mm +49 -0
- package/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaInteropTurboModule.cpp +4 -0
- package/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaInteropTurboModule.h +4 -0
- package/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp +2 -2
- package/ReactCommon/react/nativemodule/core/platform/ios/React-NativeModulesApple.podspec +2 -2
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTInteropTurboModule.h +4 -0
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTInteropTurboModule.mm +5 -1
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm +61 -4
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModuleManager.h +0 -9
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModuleManager.mm +37 -139
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModuleWithJSIBindings.h +0 -3
- package/ReactCommon/react/nativemodule/defaults/DefaultTurboModules.cpp +6 -0
- package/ReactCommon/react/nativemodule/defaults/React-defaultsnativemodule.podspec +1 -1
- package/ReactCommon/react/nativemodule/dom/NativeDOM.cpp +10 -4
- package/ReactCommon/react/nativemodule/dom/React-domnativemodule.podspec +2 -1
- package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +25 -55
- package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +11 -23
- package/ReactCommon/react/nativemodule/featureflags/React-featureflagsnativemodule.podspec +1 -1
- package/ReactCommon/react/nativemodule/idlecallbacks/React-idlecallbacksnativemodule.podspec +2 -1
- package/ReactCommon/react/nativemodule/intersectionobserver/React-intersectionobservernativemodule.podspec +2 -1
- package/ReactCommon/react/nativemodule/microtasks/React-microtasksnativemodule.podspec +1 -1
- package/ReactCommon/react/nativemodule/mutationobserver/NativeMutationObserver.cpp +4 -0
- package/ReactCommon/react/nativemodule/mutationobserver/React-mutationobservernativemodule.podspec +2 -1
- package/ReactCommon/react/nativemodule/samples/ReactCommon-Samples.podspec +1 -1
- package/ReactCommon/react/nativemodule/samples/platform/ios/ReactCommon/RCTSampleTurboModule.h +1 -1
- package/ReactCommon/react/nativemodule/viewtransition/React-viewtransitionnativemodule.podspec +1 -1
- package/ReactCommon/react/nativemodule/webperformance/React-webperformancenativemodule.podspec +2 -1
- package/ReactCommon/react/networking/React-networking.podspec +1 -1
- package/ReactCommon/react/performance/cdpmetrics/React-performancecdpmetrics.podspec +1 -1
- package/ReactCommon/react/performance/timeline/React-performancetimeline.podspec +1 -1
- package/ReactCommon/react/renderer/animated/NativeAnimatedNodesManager.cpp +95 -63
- package/ReactCommon/react/renderer/animated/NativeAnimatedNodesManager.h +20 -1
- package/ReactCommon/react/renderer/animated/NativeAnimatedNodesManagerProvider.cpp +7 -10
- package/ReactCommon/react/renderer/animated/drivers/FrameAnimationDriver.cpp +20 -1
- package/ReactCommon/react/renderer/animated/drivers/FrameAnimationDriver.h +1 -0
- package/ReactCommon/react/renderer/animated/internal/primitives.h +1 -1
- package/ReactCommon/react/renderer/animated/nodes/InterpolationAnimatedNode.cpp +67 -6
- package/ReactCommon/react/renderer/animated/nodes/InterpolationAnimatedNode.h +12 -0
- package/ReactCommon/react/renderer/animated/nodes/PropsAnimatedNode.cpp +25 -13
- package/ReactCommon/react/renderer/animated/nodes/PropsAnimatedNode.h +7 -0
- package/ReactCommon/react/renderer/animated/tests/AnimationDriverTests.cpp +48 -0
- package/ReactCommon/react/renderer/animated/tests/DecayAnimationDriverTest.cpp +245 -0
- package/ReactCommon/react/renderer/animated/tests/ManagedPropsMountingOverrideTests.cpp +204 -0
- package/ReactCommon/react/renderer/animationbackend/AnimatedPropsRegistry.cpp +10 -1
- package/ReactCommon/react/renderer/animationbackend/AnimatedPropsRegistry.h +1 -0
- package/ReactCommon/react/renderer/animationbackend/AnimationBackend.cpp +17 -0
- package/ReactCommon/react/renderer/animations/tests/LayoutAnimationTest.cpp +0 -2
- package/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp +6 -2
- package/ReactCommon/react/renderer/attributedstring/TextAttributes.h +25 -1
- package/ReactCommon/react/renderer/attributedstring/conversions.h +29 -1
- package/ReactCommon/react/renderer/attributedstring/primitives.h +4 -2
- package/ReactCommon/react/renderer/attributedstring/tests/ParagraphAttributesTest.cpp +73 -0
- package/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +6 -0
- package/ReactCommon/react/renderer/components/image/ImageProps.cpp +79 -126
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropShadowNode.cpp +4 -0
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropShadowNode.h +4 -0
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropState.h +4 -0
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.cpp +5 -0
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.h +4 -0
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/UnstableLegacyViewManagerAutomaticComponentDescriptor.cpp +5 -0
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/UnstableLegacyViewManagerAutomaticComponentDescriptor.h +4 -0
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/UnstableLegacyViewManagerAutomaticShadowNode.cpp +4 -0
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/UnstableLegacyViewManagerAutomaticShadowNode.h +4 -0
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/UnstableLegacyViewManagerInteropComponentDescriptor.h +4 -0
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/platform/ios/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.h +4 -0
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/platform/ios/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm +5 -0
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/platform/ios/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h +4 -0
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/platform/ios/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm +5 -0
- package/ReactCommon/react/renderer/components/scrollview/BaseScrollViewProps.cpp +235 -352
- package/ReactCommon/react/renderer/components/scrollview/platform/android/react/renderer/components/scrollview/HostPlatformScrollViewProps.cpp +30 -46
- package/ReactCommon/react/renderer/components/text/BaseParagraphProps.cpp +17 -27
- package/ReactCommon/react/renderer/components/text/BaseTextProps.cpp +8 -10
- package/ReactCommon/react/renderer/components/text/BaseTextShadowNode.cpp +19 -0
- package/ReactCommon/react/renderer/components/text/TextEffectComponentDescriptor.h +17 -0
- package/ReactCommon/react/renderer/components/text/TextEffectProps.cpp +59 -0
- package/ReactCommon/react/renderer/components/text/TextEffectProps.h +30 -0
- package/{Libraries/Text/VirtualText/RCTVirtualTextView.mm → ReactCommon/react/renderer/components/text/TextEffectShadowNode.cpp} +4 -6
- package/ReactCommon/react/renderer/components/text/TextEffectShadowNode.h +26 -0
- package/ReactCommon/react/renderer/components/text/platform/android/react/renderer/components/text/HostPlatformParagraphProps.cpp +18 -28
- package/ReactCommon/react/renderer/components/text/tests/BaseTextShadowNodeTest.cpp +15 -0
- package/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp +42 -50
- package/ReactCommon/react/renderer/components/view/AccessibilityProps.cpp +168 -754
- package/ReactCommon/react/renderer/components/view/AccessibilityProps.h +0 -9
- package/ReactCommon/react/renderer/components/view/BaseViewProps.cpp +248 -312
- package/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp +0 -6
- package/ReactCommon/react/renderer/components/view/ViewShadowNode.h +2 -12
- package/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp +73 -27
- package/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.h +7 -9
- package/ReactCommon/react/renderer/components/view/YogaStylableProps.cpp +3 -11
- package/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.cpp +82 -162
- package/ReactCommon/react/renderer/components/view/primitives.h +5 -0
- package/ReactCommon/react/renderer/components/view/propsConversions.h +74 -42
- package/ReactCommon/react/renderer/components/view/tests/LayoutTest.cpp +5 -5
- package/ReactCommon/react/renderer/components/view/tests/ViewTest.cpp +353 -6
- package/ReactCommon/react/renderer/consistency/React-rendererconsistency.podspec +1 -1
- package/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h +41 -16
- package/ReactCommon/react/renderer/core/ConcreteShadowNode.h +19 -0
- package/ReactCommon/react/renderer/core/EventEmitter.cpp +20 -4
- package/ReactCommon/react/renderer/core/LayoutMetrics.h +3 -0
- package/ReactCommon/react/renderer/core/Props.cpp +8 -39
- package/ReactCommon/react/renderer/core/Props.h +63 -13
- package/ReactCommon/react/renderer/core/RawProps.cpp +20 -3
- package/ReactCommon/react/renderer/core/RawProps.h +44 -0
- package/ReactCommon/react/renderer/core/RawPropsKeyMap.cpp +11 -27
- package/ReactCommon/react/renderer/core/RawPropsKeyMap.h +3 -3
- package/ReactCommon/react/renderer/core/RawPropsParser.cpp +4 -6
- package/ReactCommon/react/renderer/core/RawPropsParser.h +3 -3
- package/ReactCommon/react/renderer/core/StateData.h +4 -4
- package/ReactCommon/react/renderer/core/propsConversions.h +3 -7
- package/ReactCommon/react/renderer/core/tests/ComponentDescriptorTest.cpp +8 -0
- package/ReactCommon/react/renderer/core/tests/FindNodeAtPointTest.cpp +7 -7
- package/ReactCommon/react/renderer/core/tests/LayoutableShadowNodeTest.cpp +19 -19
- package/ReactCommon/react/renderer/core/tests/PropsConceptsTest.cpp +135 -0
- package/ReactCommon/react/renderer/core/tests/RawPropsTest.cpp +43 -53
- package/ReactCommon/react/renderer/css/React-renderercss.podspec +1 -1
- package/ReactCommon/react/renderer/debug/React-rendererdebug.podspec +1 -1
- package/ReactCommon/react/renderer/element/tests/ElementTest.cpp +3 -3
- package/ReactCommon/react/renderer/graphics/React-graphics.podspec +1 -1
- package/ReactCommon/react/renderer/imagemanager/platform/android/react/renderer/imagemanager/conversions.h +17 -0
- package/ReactCommon/react/renderer/imagemanager/platform/ios/React-ImageManager.podspec +1 -1
- package/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/RCTSyncImageManager.mm +1 -1
- package/ReactCommon/react/renderer/mapbuffer/MapBuffer.cpp +123 -33
- package/ReactCommon/react/renderer/mapbuffer/MapBuffer.h +26 -14
- package/ReactCommon/react/renderer/mapbuffer/MapBufferBuilder.cpp +96 -53
- package/ReactCommon/react/renderer/mapbuffer/MapBufferBuilder.h +4 -0
- package/ReactCommon/react/renderer/mapbuffer/tests/MapBufferTest.cpp +96 -1
- package/ReactCommon/react/renderer/mounting/Differentiator.cpp +29 -318
- package/ReactCommon/react/renderer/mounting/ShadowTree.cpp +105 -33
- package/ReactCommon/react/renderer/mounting/ShadowTree.h +2 -0
- package/ReactCommon/react/renderer/mounting/internal/CullingContext.cpp +1 -1
- package/ReactCommon/react/renderer/mounting/tests/DifferentiatorUnflattenTest.cpp +11 -3
- package/ReactCommon/react/renderer/mounting/tests/OrderIndexTest.cpp +1 -1
- package/ReactCommon/react/renderer/mounting/tests/ShadowTreeLifeCycleTest.cpp +15 -250
- package/ReactCommon/react/renderer/mounting/tests/ShadowTreeReactBranchingTest.cpp +141 -0
- package/ReactCommon/react/renderer/mounting/tests/StackingContextTest.cpp +1 -1
- package/ReactCommon/react/renderer/runtimescheduler/CMakeLists.txt +1 -0
- package/ReactCommon/react/renderer/runtimescheduler/React-runtimescheduler.podspec +2 -1
- package/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.cpp +22 -2
- package/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.h +13 -2
- package/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler_Legacy.cpp +13 -0
- package/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler_Legacy.h +9 -0
- package/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler_Modern.cpp +43 -5
- package/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler_Modern.h +17 -1
- package/ReactCommon/react/renderer/runtimescheduler/Task.h +4 -0
- package/ReactCommon/react/renderer/runtimescheduler/tests/RuntimeSchedulerTest.cpp +113 -8
- package/ReactCommon/react/renderer/scheduler/Scheduler.cpp +14 -6
- package/ReactCommon/react/renderer/scheduler/Scheduler.h +3 -2
- package/ReactCommon/react/renderer/scheduler/SurfaceHandler.cpp +1 -85
- package/ReactCommon/react/renderer/scheduler/SurfaceHandler.h +0 -6
- package/ReactCommon/react/renderer/scheduler/tests/SchedulerDelegateInvalidationTest.cpp +671 -0
- package/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.h +22 -5
- package/ReactCommon/react/renderer/textlayoutmanager/platform/android/react/renderer/textlayoutmanager/TextLayoutManager.cpp +4 -2
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.h +11 -0
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm +65 -26
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTFontUtils.mm +1 -1
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm +193 -1
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextPrimitivesConversions.h +14 -2
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/TextLayoutManager.mm +2 -1
- package/ReactCommon/react/renderer/textlayoutmanager/tests/TextLayoutManagerTest.cpp +86 -5
- package/ReactCommon/react/renderer/uimanager/UIManager.cpp +31 -41
- package/ReactCommon/react/renderer/uimanager/UIManager.h +2 -2
- package/ReactCommon/react/renderer/uimanager/UIManagerDelegate.h +1 -1
- package/ReactCommon/react/renderer/uimanager/tests/FindShadowNodeByTagTest.cpp +1 -52
- package/ReactCommon/react/renderer/uimanager/tests/PointerEventsProcessorTest.cpp +4 -4
- package/ReactCommon/react/renderer/viewtransition/ViewTransitionModule.cpp +88 -39
- package/ReactCommon/react/renderer/viewtransition/ViewTransitionModule.h +12 -2
- package/ReactCommon/react/runtime/PlatformTimerRegistry.h +10 -0
- package/ReactCommon/react/runtime/React-RuntimeCore.podspec +1 -1
- package/ReactCommon/react/runtime/React-RuntimeHermes.podspec +1 -1
- package/ReactCommon/react/runtime/ReactInstance.cpp +79 -64
- package/ReactCommon/react/runtime/hermes/HermesInstance.cpp +0 -89
- package/ReactCommon/react/runtime/iostests/MainQueueCoordinatorTests.mm +99 -0
- package/ReactCommon/react/runtime/iostests/RCTInstanceTests.mm +244 -0
- package/ReactCommon/react/runtime/platform/ios/React-RuntimeApple.podspec +1 -1
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/ObjCTimerRegistry.h +1 -1
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm +47 -30
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTJscInstance.mm +3 -2
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTPerformanceLoggerUtils.mm +3 -2
- package/ReactCommon/react/runtime/tests/cxx/ReactInstanceTest.cpp +27 -3
- package/ReactCommon/react/runtime/tests/cxx/RuntimeExecutorShutdownTest.cpp +155 -0
- package/ReactCommon/react/timing/React-timing.podspec +1 -1
- package/ReactCommon/react/utils/React-utils.podspec +1 -1
- package/ReactCommon/react/utils/Telemetry.h +0 -13
- package/ReactCommon/react/utils/tests/Base64Tests.cpp +36 -0
- package/ReactCommon/reactperflogger/React-perflogger.podspec +1 -1
- package/ReactCommon/reactperflogger/reactperflogger/ReactPerfettoLogger.cpp +0 -1
- package/ReactCommon/runtimeexecutor/React-runtimeexecutor.podspec +1 -1
- package/ReactCommon/runtimeexecutor/platform/ios/ReactCommon/RuntimeExecutorSyncUIThreadUtils.mm +21 -38
- package/ReactCommon/yoga/Yoga.podspec +2 -2
- package/ReactCommon/yoga/yoga/YGEnums.cpp +2 -0
- package/ReactCommon/yoga/yoga/YGEnums.h +1 -0
- package/ReactCommon/yoga/yoga/YGNode.cpp +27 -0
- package/ReactCommon/yoga/yoga/YGNode.h +69 -0
- package/ReactCommon/yoga/yoga/YGNodeLayout.h +0 -2
- package/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp +283 -10
- package/ReactCommon/yoga/yoga/config/Config.h +1 -1
- package/ReactCommon/yoga/yoga/enums/Errata.h +1 -0
- package/ReactCommon/yoga/yoga/node/LayoutResults.h +8 -0
- package/ReactCommon/yoga/yoga/node/Node.cpp +32 -0
- package/ReactCommon/yoga/yoga/node/Node.h +33 -0
- package/changes.json +6 -14
- package/cli.js +3 -182
- package/flow/bom.js.flow +42 -42
- package/flow/cssom.js.flow +21 -21
- package/flow/dom.js.flow +128 -128
- package/flow/global.js +6 -0
- package/gradle/libs.versions.toml +7 -5
- package/index.js +53 -86
- package/index.js.flow +53 -23
- package/package.json +47 -66
- package/react-native.config.js +82 -1
- package/scripts/cocoapods/fabric.rb +1 -1
- package/scripts/cocoapods/jsengine.rb +1 -1
- package/scripts/cocoapods/new_architecture.rb +1 -1
- package/scripts/cocoapods/rncore.rb +36 -78
- package/scripts/cocoapods/rncore_facades.rb +232 -0
- package/scripts/cocoapods/rndependencies.rb +83 -16
- package/scripts/cocoapods/rndeps_facades.rb +193 -0
- package/scripts/cocoapods/spm.rb +79 -12
- package/scripts/cocoapods/utils.rb +7 -9
- package/scripts/codegen/generate-artifacts-executor/generateSchemaInfos.js +0 -1
- package/scripts/codegen/templates/Package.swift.spm-template +97 -0
- package/scripts/codegen/templates/ReactAppDependencyProvider.podspec.template +1 -1
- package/scripts/codegen/templates/ReactCodegen.podspec.template +2 -2
- package/scripts/hermes/hermes-utils.js +27 -58
- package/scripts/ios-configure-glog.sh +1 -1
- package/scripts/react-native-xcode.sh +20 -0
- package/scripts/react_native_pods.rb +71 -21
- package/scripts/react_native_pods_utils/script_phases.sh +4 -3
- package/scripts/replace-rncore-version.js +75 -88
- package/scripts/setup-apple-spm.js +1283 -0
- package/scripts/spm/autolinking-plugins.js +411 -0
- package/scripts/spm/download-spm-artifacts.js +1467 -0
- package/scripts/spm/expand-spm-dependencies.js +435 -0
- package/scripts/spm/flavored-frameworks.js +1008 -0
- package/scripts/spm/generate-spm-autolinking-config.js +221 -0
- package/scripts/spm/generate-spm-autolinking.js +2005 -0
- package/scripts/spm/generate-spm-package.js +314 -0
- package/scripts/spm/generate-spm-xcodeproj.js +2790 -0
- package/scripts/spm/read-podspec.js +695 -0
- package/scripts/spm/scaffold-package-swift.js +1247 -0
- package/scripts/spm/spm-pbxproj.js +784 -0
- package/scripts/spm/spm-types.js +546 -0
- package/scripts/spm/spm-utils.js +760 -0
- package/scripts/spm/sync-spm-autolinking.js +160 -0
- package/sdks/.hermesv1version +1 -1
- package/sdks/hermes-engine/hermes-engine.podspec +9 -39
- package/sdks/hermes-engine/hermes-utils.rb +19 -73
- package/sdks/hermes-engine/utils/replace_hermes_version.js +18 -4
- package/sdks/hermes-engine/version.properties +1 -2
- package/settings.gradle.kts +0 -43
- package/src/asset-registry.js +29 -0
- package/src/private/animated/NativeAnimatedHelper.js +45 -21
- package/src/private/assets/AssetRegistry.js +52 -0
- package/src/private/{specs_DEPRECATED/components → components/activityindicator/specs}/ActivityIndicatorViewNativeComponent.js +5 -5
- package/src/private/{specs_DEPRECATED/components → components/debuggingoverlay/specs}/DebuggingOverlayNativeComponent.js +8 -8
- package/src/private/{specs_DEPRECATED/components → components/drawerlayoutandroid/specs}/AndroidDrawerLayoutNativeComponent.js +8 -8
- package/src/private/{specs_DEPRECATED/components → components/inputaccessoryview/specs}/RCTInputAccessoryViewNativeComponent.js +4 -4
- package/src/private/{specs_DEPRECATED/components → components/modal/specs}/RCTModalHostViewNativeComponent.js +4 -9
- package/src/private/{specs_DEPRECATED/components → components/progressbarandroid/specs}/ProgressBarAndroidNativeComponent.js +5 -5
- package/src/private/{specs_DEPRECATED/components → components/refreshcontrol/specs}/AndroidSwipeRefreshLayoutNativeComponent.js +7 -7
- package/src/private/{specs_DEPRECATED/components → components/refreshcontrol/specs}/PullToRefreshViewNativeComponent.js +7 -7
- package/src/private/components/safeareaview/SafeAreaView_INTERNAL_DO_NOT_USE.js +2 -2
- package/src/private/{specs_DEPRECATED/components → components/safeareaview/specs}/RCTSafeAreaViewNativeComponent.js +3 -3
- package/src/private/components/scrollview/HScrollViewNativeComponents.js +1 -1
- package/src/private/{specs_DEPRECATED/components → components/scrollview/specs}/AndroidHorizontalScrollContentViewNativeComponent.js +3 -3
- package/src/private/{specs_DEPRECATED/components → components/switch/specs}/AndroidSwitchNativeComponent.js +7 -7
- package/src/private/{specs_DEPRECATED/components → components/switch/specs}/SwitchNativeComponent.js +10 -7
- package/src/private/{specs_DEPRECATED/components → components/unimplementedview/specs}/UnimplementedNativeViewNativeComponent.js +4 -4
- package/src/private/components/virtualcollection/Virtual.js +5 -5
- package/src/private/components/virtualcollection/VirtualCollectionView.js +2 -6
- package/src/private/components/virtualcollection/column/VirtualColumn.js +1 -1
- package/src/private/components/virtualcollection/row/VirtualRow.js +1 -1
- package/src/private/devsupport/devmenu/elementinspector/Inspector.js +3 -1
- package/src/private/devsupport/devmenu/specs/NativeDevMenu.js +4 -4
- package/src/private/devsupport/rndevtools/specs/NativeReactDevToolsRuntimeSettingsModule.js +4 -2
- package/src/private/devsupport/rndevtools/specs/NativeReactDevToolsSettingsManager.js +2 -2
- package/src/private/featureflags/ReactNativeFeatureFlags.js +46 -70
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +88 -94
- package/src/private/renderer/errorhandling/ErrorHandlers.js +2 -2
- package/src/private/renderer/events/ReactNativeResponder.js +49 -4
- package/src/private/renderer/events/ResponderTouchHistoryStore.js +11 -2
- package/src/private/renderer/events/dispatchNativeEvent.js +71 -36
- package/src/private/setup/setUpDOM.js +19 -9
- package/src/private/setup/setUpIntersectionObserver.js +7 -0
- package/src/private/setup/setUpMutationObserver.js +3 -1
- package/src/private/specs_DEPRECATED/modules/NativeAccessibilityInfo.js +9 -9
- package/src/private/specs_DEPRECATED/modules/NativeAccessibilityManager.js +24 -24
- package/src/private/specs_DEPRECATED/modules/NativeActionSheetManager.js +28 -28
- package/src/private/specs_DEPRECATED/modules/NativeAlertManager.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativeAnimatedModule.js +45 -25
- package/src/private/specs_DEPRECATED/modules/NativeAnimatedTurboModule.js +44 -24
- package/src/private/specs_DEPRECATED/modules/NativeAppState.js +4 -4
- package/src/private/specs_DEPRECATED/modules/NativeAppearance.js +8 -6
- package/src/private/specs_DEPRECATED/modules/NativeBlobModule.js +7 -7
- package/src/private/specs_DEPRECATED/modules/NativeClipboard.js +3 -3
- package/src/private/specs_DEPRECATED/modules/NativeDevLoadingView.js +2 -2
- package/src/private/specs_DEPRECATED/modules/NativeDevSettings.js +11 -11
- package/src/private/specs_DEPRECATED/modules/NativeDeviceEventManager.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativeDeviceInfo.js +4 -4
- package/src/private/specs_DEPRECATED/modules/NativeDialogManagerAndroid.js +7 -7
- package/src/private/specs_DEPRECATED/modules/NativeExceptionsManager.js +4 -4
- package/src/private/specs_DEPRECATED/modules/NativeFileReaderModule.js +2 -2
- package/src/private/specs_DEPRECATED/modules/NativeFrameRateLogger.js +4 -4
- package/src/private/specs_DEPRECATED/modules/NativeHeadlessJsTaskSupport.js +2 -2
- package/src/private/specs_DEPRECATED/modules/NativeI18nManager.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativeImageEditor.js +13 -13
- package/src/private/specs_DEPRECATED/modules/NativeImageLoaderAndroid.js +9 -6
- package/src/private/specs_DEPRECATED/modules/NativeImageLoaderIOS.js +6 -6
- package/src/private/specs_DEPRECATED/modules/NativeImageStoreAndroid.js +2 -2
- package/src/private/specs_DEPRECATED/modules/NativeImageStoreIOS.js +8 -5
- package/src/private/specs_DEPRECATED/modules/NativeIntentAndroid.js +5 -5
- package/src/private/specs_DEPRECATED/modules/NativeJSCHeapCapture.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativeKeyboardObserver.js +2 -2
- package/src/private/specs_DEPRECATED/modules/NativeLinkingManager.js +6 -6
- package/src/private/specs_DEPRECATED/modules/NativeLogBox.js +2 -2
- package/src/private/specs_DEPRECATED/modules/NativeModalManager.js +2 -2
- package/src/private/specs_DEPRECATED/modules/NativeNetworkingAndroid.js +5 -5
- package/src/private/specs_DEPRECATED/modules/NativeNetworkingIOS.js +6 -6
- package/src/private/specs_DEPRECATED/modules/NativePermissionsAndroid.js +6 -4
- package/src/private/specs_DEPRECATED/modules/NativePlatformConstantsAndroid.js +2 -2
- package/src/private/specs_DEPRECATED/modules/NativePlatformConstantsIOS.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativePushNotificationManagerIOS.js +35 -31
- package/src/private/specs_DEPRECATED/modules/NativeRedBox.js +2 -2
- package/src/private/specs_DEPRECATED/modules/NativeSampleTurboModule.js +24 -24
- package/src/private/specs_DEPRECATED/modules/NativeSegmentFetcher.js +2 -2
- package/src/private/specs_DEPRECATED/modules/NativeSettingsManager.js +3 -3
- package/src/private/specs_DEPRECATED/modules/NativeShareModule.js +2 -2
- package/src/private/specs_DEPRECATED/modules/NativeSoundManager.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativeSourceCode.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativeStatusBarManagerAndroid.js +5 -17
- package/src/private/specs_DEPRECATED/modules/NativeStatusBarManagerIOS.js +10 -15
- package/src/private/specs_DEPRECATED/modules/NativeTiming.js +3 -3
- package/src/private/specs_DEPRECATED/modules/NativeToastAndroid.js +4 -4
- package/src/private/specs_DEPRECATED/modules/NativeUIManager.js +35 -22
- package/src/private/specs_DEPRECATED/modules/NativeVibration.js +4 -4
- package/src/private/specs_DEPRECATED/modules/NativeWebSocketModule.js +7 -7
- package/src/private/types/HostInstance.js +38 -80
- package/src/private/viewtransition/specs/NativeViewTransition.js +6 -4
- package/src/private/webapis/dom/abort-api/AbortController.js +92 -0
- package/src/private/webapis/dom/abort-api/AbortSignal.js +243 -0
- package/src/private/webapis/dom/events/CustomEvent.js +1 -1
- package/src/private/webapis/dom/events/Event.js +12 -12
- package/src/private/webapis/dom/events/EventTarget.js +146 -37
- package/src/private/webapis/dom/events/internals/EventInternals.js +36 -0
- package/src/private/webapis/dom/events/internals/EventTargetInternals.js +38 -3
- package/src/private/webapis/dom/nodes/ReactNativeDocument.js +11 -0
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +105 -4
- package/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js +11 -0
- package/src/private/webapis/dom/nodes/ReadOnlyElement.js +9 -0
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +34 -7
- package/src/private/webapis/dom/nodes/ReadOnlyText.js +33 -0
- package/src/private/webapis/dom/nodes/specs/NativeDOM.js +46 -42
- package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +12 -0
- package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js.flow +4 -2
- package/src/private/webapis/dom/oldstylecollections/NodeList.js +10 -0
- package/src/private/webapis/dom/oldstylecollections/NodeList.js.flow +4 -3
- package/src/private/webapis/errors/DOMException.js +50 -50
- package/src/private/webapis/geometry/DOMRectList.js +12 -0
- package/src/private/webapis/geometry/DOMRectList.js.flow +3 -1
- package/src/private/webapis/html/events/MessageEvent.js +3 -3
- package/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js +2 -2
- package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +13 -0
- package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +3 -7
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +5 -5
- package/src/private/webapis/microtasks/specs/NativeMicrotasks.js +1 -1
- package/src/private/webapis/mutationobserver/MutationObserver.js +7 -7
- package/src/private/webapis/mutationobserver/MutationRecord.js +12 -0
- package/src/private/webapis/mutationobserver/internals/MutationObserverManager.js +5 -7
- package/src/private/webapis/mutationobserver/specs/NativeMutationObserver.js +5 -5
- package/src/private/webapis/performance/EventTiming.js +3 -3
- package/src/private/webapis/performance/PerformanceEntry.js +3 -3
- package/src/private/webapis/performance/PerformanceObserver.js +4 -4
- package/src/private/webapis/performance/ResourceTiming.js +13 -13
- package/src/private/webapis/performance/UserTiming.js +3 -3
- package/src/private/webapis/performance/internals/Utilities.js +1 -1
- package/src/private/webapis/performance/specs/NativePerformance.js +26 -20
- package/src/private/webapis/utils/ArrayLikeUtils.js +1 -1
- package/src/private/webapis/websockets/events/CloseEvent.js +3 -3
- package/src/private/webapis/xhr/events/ProgressEvent.js +3 -3
- package/src/react-private-interface.js +145 -0
- package/src/react-private-interface.js.flow +48 -0
- package/src/setup-env.js +22 -0
- package/src/types/globals.d.ts +35 -3
- package/src/unstable-internals-do-not-use.d.ts +214 -0
- package/src/unstable-internals-do-not-use.js +76 -0
- package/third-party-podspecs/RCT-Folly.podspec +1 -1
- package/third-party-podspecs/ReactNativeDependencies.podspec +3 -3
- package/third-party-podspecs/glog.podspec +1 -1
- package/types/index.d.ts +0 -1
- package/types/public/DeprecatedPropertiesAlias.d.ts +0 -4
- package/types/public/ReactNativeTypes.d.ts +6 -4
- package/types_generated/Libraries/ActionSheetIOS/ActionSheetIOS.d.ts +26 -31
- package/types_generated/Libraries/Alert/Alert.d.ts +44 -7
- package/types_generated/Libraries/Animated/AnimatedEvent.d.ts +2 -2
- package/types_generated/Libraries/Animated/AnimatedExports.d.ts +2 -2
- package/types_generated/Libraries/Animated/AnimatedImplementation.d.ts +108 -4
- package/types_generated/Libraries/Animated/Easing.d.ts +5 -4
- package/types_generated/Libraries/Animated/animations/Animation.d.ts +7 -7
- package/types_generated/Libraries/Animated/animations/DecayAnimation.d.ts +5 -5
- package/types_generated/Libraries/Animated/animations/SpringAnimation.d.ts +49 -49
- package/types_generated/Libraries/Animated/animations/TimingAnimation.d.ts +13 -13
- package/types_generated/Libraries/Animated/components/AnimatedFlatList.d.ts +3 -3
- package/types_generated/Libraries/Animated/components/AnimatedScrollView.d.ts +2 -2
- package/types_generated/Libraries/Animated/components/AnimatedSectionList.d.ts +3 -3
- package/types_generated/Libraries/Animated/createAnimatedComponent.d.ts +4 -4
- package/types_generated/Libraries/Animated/nodes/AnimatedColor.d.ts +2 -2
- package/types_generated/Libraries/Animated/nodes/AnimatedInterpolation.d.ts +9 -9
- package/types_generated/Libraries/Animated/nodes/AnimatedNode.d.ts +6 -3
- package/types_generated/Libraries/Animated/nodes/AnimatedValue.d.ts +3 -3
- package/types_generated/Libraries/AppState/AppState.d.ts +41 -22
- package/types_generated/Libraries/BatchedBridge/NativeModules.d.ts +8 -1
- package/types_generated/Libraries/Blob/BlobTypes.d.ts +4 -4
- package/types_generated/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +37 -46
- package/types_generated/Libraries/Components/ActivityIndicator/ActivityIndicator.d.ts +92 -43
- package/types_generated/Libraries/Components/Button.d.ts +118 -197
- package/types_generated/Libraries/Components/Clipboard/Clipboard.d.ts +6 -1
- package/types_generated/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.d.ts +44 -63
- package/types_generated/Libraries/Components/Keyboard/Keyboard.d.ts +30 -61
- package/types_generated/Libraries/Components/Keyboard/KeyboardAvoidingView.d.ts +30 -21
- package/types_generated/Libraries/Components/Pressable/Pressable.d.ts +41 -17
- package/types_generated/Libraries/Components/Pressable/useAndroidRippleForView.d.ts +6 -6
- package/types_generated/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.d.ts +5 -5
- package/types_generated/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.d.ts +18 -1
- package/types_generated/Libraries/Components/RefreshControl/RefreshControl.d.ts +35 -52
- package/types_generated/Libraries/Components/SafeAreaView/SafeAreaView.d.ts +9 -11
- package/types_generated/Libraries/Components/ScrollView/ScrollView.d.ts +212 -88
- package/types_generated/Libraries/Components/ScrollView/ScrollViewStickyHeader.d.ts +4 -4
- package/types_generated/Libraries/Components/StatusBar/StatusBar.d.ts +29 -62
- package/types_generated/Libraries/Components/Switch/Switch.d.ts +75 -70
- package/types_generated/Libraries/Components/TextInput/InputAccessoryView.d.ts +16 -65
- package/types_generated/Libraries/Components/TextInput/TextInput.d.ts +118 -3
- package/types_generated/Libraries/Components/TextInput/TextInput.flow.d.ts +24 -9
- package/types_generated/Libraries/Components/ToastAndroid/ToastAndroid.d.ts +18 -18
- package/types_generated/Libraries/Components/Touchable/TouchableHighlight.d.ts +24 -13
- package/types_generated/Libraries/Components/Touchable/TouchableNativeFeedback.d.ts +27 -64
- package/types_generated/Libraries/Components/Touchable/TouchableOpacity.d.ts +18 -6
- package/types_generated/Libraries/Components/Touchable/TouchableWithoutFeedback.d.ts +28 -28
- package/types_generated/Libraries/Components/View/View.d.ts +13 -9
- package/types_generated/Libraries/Components/View/ViewAccessibility.d.ts +31 -20
- package/types_generated/Libraries/Components/View/ViewNativeComponent.d.ts +1 -2
- package/types_generated/Libraries/Components/View/ViewPropTypes.d.ts +75 -24
- package/types_generated/Libraries/Core/ExtendedError.d.ts +10 -10
- package/types_generated/Libraries/EventEmitter/NativeEventEmitter.d.ts +34 -1
- package/types_generated/Libraries/EventEmitter/RCTNativeAppEventEmitter.d.ts +4 -1
- package/types_generated/Libraries/Image/AssetSourceResolver.d.ts +2 -13
- package/types_generated/Libraries/Image/ImageBackground.d.ts +33 -22
- package/types_generated/Libraries/Image/ImageProps.d.ts +201 -251
- package/types_generated/Libraries/Image/ImageTypes.flow.d.ts +6 -5
- package/types_generated/Libraries/Interaction/PanResponder.d.ts +103 -97
- package/types_generated/Libraries/LayoutAnimation/LayoutAnimation.d.ts +18 -7
- package/types_generated/Libraries/Linking/Linking.d.ts +28 -20
- package/types_generated/Libraries/Lists/FlatList.d.ts +17 -18
- package/types_generated/Libraries/Lists/SectionList.d.ts +10 -5
- package/types_generated/Libraries/Lists/VirtualizedList.d.ts +3 -1
- package/types_generated/Libraries/Lists/VirtualizedSectionList.d.ts +3 -1
- package/types_generated/Libraries/LogBox/Data/LogBoxData.d.ts +2 -2
- package/types_generated/Libraries/LogBox/Data/LogBoxLog.d.ts +2 -2
- package/types_generated/Libraries/LogBox/Data/parseLogBoxLog.d.ts +2 -2
- package/types_generated/Libraries/LogBox/LogBox.d.ts +4 -1
- package/types_generated/Libraries/Modal/Modal.d.ts +70 -35
- package/types_generated/Libraries/Network/FormData.d.ts +5 -5
- package/types_generated/Libraries/Performance/Systrace.d.ts +11 -1
- package/types_generated/Libraries/PermissionsAndroid/PermissionsAndroid.d.ts +31 -21
- package/types_generated/Libraries/Pressability/Pressability.d.ts +5 -5
- package/types_generated/Libraries/PushNotificationIOS/PushNotificationIOS.d.ts +15 -11
- package/types_generated/Libraries/ReactNative/AppRegistry.flow.d.ts +5 -5
- package/types_generated/Libraries/ReactNative/AppRegistryImpl.d.ts +56 -9
- package/types_generated/Libraries/ReactNative/I18nManager.d.ts +20 -1
- package/types_generated/Libraries/ReactNative/IPerformanceLogger.flow.d.ts +5 -5
- package/types_generated/Libraries/ReactPrivate/ReactNativePrivateInterface.d.ts +6 -22
- package/types_generated/Libraries/Renderer/shims/ReactNativeTypes.d.ts +34 -34
- package/types_generated/Libraries/Share/Share.d.ts +36 -39
- package/types_generated/Libraries/StyleSheet/PlatformColorValueTypes.d.ts +7 -1
- package/types_generated/Libraries/StyleSheet/PlatformColorValueTypesIOS.d.ts +3 -3
- package/types_generated/Libraries/StyleSheet/StyleSheetTypes.d.ts +202 -181
- package/types_generated/Libraries/StyleSheet/private/_TransformStyle.d.ts +3 -3
- package/types_generated/Libraries/Text/Text.d.ts +10 -6
- package/types_generated/Libraries/Text/TextProps.d.ts +57 -102
- package/types_generated/Libraries/TurboModule/RCTExport.d.ts +2 -2
- package/types_generated/Libraries/Types/CoreEventTypes.d.ts +14 -8
- package/types_generated/Libraries/Utilities/Appearance.d.ts +25 -13
- package/types_generated/Libraries/Utilities/BackHandler.d.ts +17 -1
- package/types_generated/Libraries/Utilities/DevSettings.d.ts +9 -2
- package/types_generated/Libraries/Utilities/Dimensions.d.ts +19 -13
- package/types_generated/Libraries/Utilities/PixelRatio.d.ts +6 -3
- package/types_generated/Libraries/Utilities/Platform.d.ts +5 -1
- package/types_generated/Libraries/Utilities/PlatformTypes.d.ts +65 -6
- package/types_generated/Libraries/Utilities/codegenNativeComponent.d.ts +5 -5
- package/types_generated/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.d.ts +2 -2
- package/types_generated/Libraries/Utilities/differ/deepDiffer.d.ts +2 -2
- package/types_generated/Libraries/Utilities/useColorScheme.d.ts +12 -2
- package/types_generated/Libraries/Utilities/useWindowDimensions.d.ts +7 -1
- package/types_generated/Libraries/Vibration/Vibration.d.ts +14 -6
- package/types_generated/index.d.ts +31 -25
- package/types_generated/src/private/assets/AssetRegistry.d.ts +42 -0
- package/types_generated/src/private/components/virtualcollection/VirtualCollectionView.d.ts +5 -5
- package/types_generated/src/private/components/virtualcollection/column/VirtualColumn.d.ts +3 -3
- package/types_generated/src/private/components/virtualcollection/row/VirtualRow.d.ts +3 -3
- package/types_generated/src/private/components/virtualview/VirtualView.d.ts +7 -7
- package/types_generated/src/private/components/virtualview/VirtualViewExperimentalNativeComponent.d.ts +5 -5
- package/types_generated/src/private/components/virtualview/VirtualViewNativeComponent.d.ts +5 -5
- package/types_generated/src/private/renderer/events/dispatchNativeEvent.d.ts +26 -0
- package/types_generated/src/private/specs_DEPRECATED/modules/NativeAppearance.d.ts +6 -5
- package/types_generated/src/private/specs_DEPRECATED/modules/NativeDeviceInfo.d.ts +7 -7
- package/types_generated/src/private/specs_DEPRECATED/modules/NativeExceptionsManager.d.ts +5 -5
- package/types_generated/src/private/specs_DEPRECATED/modules/NativeUIManager.d.ts +8 -8
- package/types_generated/src/private/types/HostComponent.d.ts +3 -3
- package/types_generated/src/private/types/HostInstance.d.ts +39 -74
- package/types_generated/src/private/webapis/dom/events/CustomEvent.d.ts +2 -2
- package/types_generated/src/private/webapis/dom/events/Event.d.ts +4 -4
- package/types_generated/src/private/webapis/dom/events/EventTarget.d.ts +8 -8
- package/types_generated/src/private/webapis/dom/nodes/ReactNativeDocument.d.ts +3 -1
- package/types_generated/src/private/webapis/dom/nodes/ReactNativeElement.d.ts +57 -4
- package/types_generated/src/private/webapis/dom/nodes/ReadOnlyCharacterData.d.ts +3 -1
- package/types_generated/src/private/webapis/dom/nodes/ReadOnlyElement.d.ts +3 -1
- package/types_generated/src/private/webapis/dom/nodes/ReadOnlyNode.d.ts +4 -2
- package/types_generated/src/private/webapis/dom/nodes/ReadOnlyText.d.ts +3 -1
- package/types_generated/src/private/webapis/dom/nodes/specs/NativeDOM.d.ts +3 -3
- package/types_generated/src/private/webapis/dom/oldstylecollections/HTMLCollection.d.ts +3 -1
- package/types_generated/src/private/webapis/dom/oldstylecollections/NodeList.d.ts +3 -1
- package/types_generated/src/react-private-interface.d.ts +33 -0
- package/Libraries/AppDelegate/RCTArchConfiguratorProtocol.h +0 -38
- package/Libraries/Image/AssetRegistry.js +0 -14
- package/Libraries/Image/RCTImageShadowView.h +0 -17
- package/Libraries/Image/RCTImageShadowView.mm +0 -28
- package/Libraries/Image/RCTImageView.h +0 -32
- package/Libraries/Image/RCTImageView.mm +0 -508
- package/Libraries/Image/RCTImageViewManager.h +0 -17
- package/Libraries/Image/RCTImageViewManager.mm +0 -115
- package/Libraries/Interaction/InteractionManager.d.ts +0 -87
- package/Libraries/Interaction/InteractionManager.js +0 -189
- package/Libraries/Text/BaseText/RCTBaseTextShadowView.h +0 -35
- package/Libraries/Text/BaseText/RCTBaseTextShadowView.mm +0 -162
- package/Libraries/Text/BaseText/RCTBaseTextViewManager.h +0 -21
- package/Libraries/Text/BaseText/RCTBaseTextViewManager.mm +0 -64
- package/Libraries/Text/RCTTextAttributes.h +0 -107
- package/Libraries/Text/RCTTextAttributes.mm +0 -358
- package/Libraries/Text/RawText/RCTRawTextShadowView.h +0 -23
- package/Libraries/Text/RawText/RCTRawTextShadowView.mm +0 -38
- package/Libraries/Text/RawText/RCTRawTextViewManager.h +0 -21
- package/Libraries/Text/RawText/RCTRawTextViewManager.mm +0 -32
- package/Libraries/Text/Text/RCTTextShadowView.h +0 -33
- package/Libraries/Text/Text/RCTTextShadowView.mm +0 -469
- package/Libraries/Text/Text/RCTTextView.h +0 -34
- package/Libraries/Text/Text/RCTTextView.mm +0 -298
- package/Libraries/Text/Text/RCTTextViewManager.h +0 -19
- package/Libraries/Text/Text/RCTTextViewManager.mm +0 -97
- package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.h +0 -21
- package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.mm +0 -67
- package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.h +0 -21
- package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.mm +0 -28
- package/Libraries/Text/TextInput/RCTBaseTextInputShadowView.h +0 -30
- package/Libraries/Text/TextInput/RCTBaseTextInputShadowView.mm +0 -367
- package/Libraries/Text/TextInput/RCTBaseTextInputView.h +0 -68
- package/Libraries/Text/TextInput/RCTBaseTextInputView.mm +0 -849
- package/Libraries/Text/TextInput/RCTBaseTextInputViewManager.h +0 -17
- package/Libraries/Text/TextInput/RCTBaseTextInputViewManager.mm +0 -181
- package/Libraries/Text/TextInput/RCTInputAccessoryShadowView.h +0 -17
- package/Libraries/Text/TextInput/RCTInputAccessoryShadowView.mm +0 -24
- package/Libraries/Text/TextInput/RCTInputAccessoryView.h +0 -22
- package/Libraries/Text/TextInput/RCTInputAccessoryView.mm +0 -82
- package/Libraries/Text/TextInput/RCTInputAccessoryViewContent.h +0 -17
- package/Libraries/Text/TextInput/RCTInputAccessoryViewContent.mm +0 -78
- package/Libraries/Text/TextInput/RCTInputAccessoryViewManager.h +0 -17
- package/Libraries/Text/TextInput/RCTInputAccessoryViewManager.mm +0 -33
- package/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputView.h +0 -21
- package/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputView.mm +0 -43
- package/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.h +0 -21
- package/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.mm +0 -35
- package/Libraries/Text/VirtualText/RCTVirtualTextShadowView.h +0 -17
- package/Libraries/Text/VirtualText/RCTVirtualTextShadowView.mm +0 -42
- package/Libraries/Text/VirtualText/RCTVirtualTextView.h +0 -28
- package/Libraries/Text/VirtualText/RCTVirtualTextViewManager.h +0 -17
- package/Libraries/Text/VirtualText/RCTVirtualTextViewManager.mm +0 -30
- package/Libraries/Utilities/SceneTracker.js +0 -42
- package/Libraries/Wrapper/Example/RCTWrapperExampleView.h +0 -21
- package/Libraries/Wrapper/Example/RCTWrapperExampleView.m +0 -57
- package/Libraries/Wrapper/Example/RCTWrapperExampleViewController.h +0 -21
- package/Libraries/Wrapper/Example/RCTWrapperExampleViewController.m +0 -27
- package/Libraries/Wrapper/Example/RCTWrapperReactRootViewController.h +0 -25
- package/Libraries/Wrapper/Example/RCTWrapperReactRootViewController.m +0 -50
- package/Libraries/Wrapper/Example/RCTWrapperReactRootViewManager.h +0 -23
- package/Libraries/Wrapper/Example/RCTWrapperReactRootViewManager.m +0 -35
- package/Libraries/Wrapper/RCTWrapper.h +0 -73
- package/Libraries/Wrapper/RCTWrapperShadowView.h +0 -27
- package/Libraries/Wrapper/RCTWrapperShadowView.m +0 -138
- package/Libraries/Wrapper/RCTWrapperView.h +0 -42
- package/Libraries/Wrapper/RCTWrapperView.m +0 -99
- package/Libraries/Wrapper/RCTWrapperViewControllerHostingView.h +0 -30
- package/Libraries/Wrapper/RCTWrapperViewControllerHostingView.m +0 -137
- package/Libraries/Wrapper/RCTWrapperViewManager.h +0 -25
- package/Libraries/Wrapper/RCTWrapperViewManager.m +0 -31
- package/React/Base/RCTRootContentView.h +0 -43
- package/React/Base/RCTRootContentView.m +0 -111
- package/React/Base/RCTRootViewInternal.h +0 -28
- package/React/CxxBridge/RCTCxxBridge.mm +0 -1572
- package/React/CxxBridge/RCTJSIExecutorRuntimeInstaller.h +0 -25
- package/React/CxxBridge/RCTJSIExecutorRuntimeInstaller.mm +0 -34
- package/React/CxxBridge/RCTObjcExecutor.h +0 -34
- package/React/CxxBridge/RCTObjcExecutor.mm +0 -150
- package/React/CxxLogUtils/RCTDefaultCxxLogFunction.mm +0 -34
- package/React/CxxModule/DispatchMessageQueueThread.h +0 -50
- package/React/CxxModule/RCTCxxMethod.h +0 -17
- package/React/CxxModule/RCTCxxMethod.mm +0 -147
- package/React/CxxModule/RCTNativeModule.h +0 -34
- package/React/CxxModule/RCTNativeModule.mm +0 -241
- package/React/Fabric/RCTSurfacePresenterBridgeAdapter.mm +0 -205
- package/React/Tests/Text/RCTTextAttributesTest.mm +0 -49
- package/React/Views/RCTActivityIndicatorView.h +0 -16
- package/React/Views/RCTActivityIndicatorView.m +0 -26
- package/React/Views/RCTActivityIndicatorViewManager.h +0 -23
- package/React/Views/RCTActivityIndicatorViewManager.m +0 -65
- package/React/Views/RCTDebuggingOverlayManager.h +0 -17
- package/React/Views/RCTDebuggingOverlayManager.m +0 -68
- package/React/Views/RCTModalHostView.h +0 -64
- package/React/Views/RCTModalHostView.m +0 -264
- package/React/Views/RCTModalHostViewController.m +0 -74
- package/React/Views/RCTModalHostViewManager.m +0 -131
- package/React/Views/RCTModalManager.h +0 -22
- package/React/Views/RCTModalManager.m +0 -46
- package/React/Views/RCTRootShadowView.h +0 -35
- package/React/Views/RCTRootShadowView.m +0 -53
- package/React/Views/RCTShadowView+Internal.h +0 -18
- package/React/Views/RCTShadowView+Internal.m +0 -23
- package/React/Views/RCTSwitch.h +0 -22
- package/React/Views/RCTSwitch.m +0 -24
- package/React/Views/RCTSwitchManager.h +0 -17
- package/React/Views/RCTSwitchManager.m +0 -70
- package/React/Views/RefreshControl/RCTRefreshControl.h +0 -24
- package/React/Views/RefreshControl/RCTRefreshControl.m +0 -230
- package/React/Views/RefreshControl/RCTRefreshControlManager.h +0 -17
- package/React/Views/RefreshControl/RCTRefreshControlManager.m +0 -47
- package/React/Views/SafeAreaView/RCTSafeAreaShadowView.h +0 -21
- package/React/Views/SafeAreaView/RCTSafeAreaShadowView.m +0 -57
- package/React/Views/SafeAreaView/RCTSafeAreaView.h +0 -27
- package/React/Views/SafeAreaView/RCTSafeAreaView.m +0 -79
- package/React/Views/SafeAreaView/RCTSafeAreaViewLocalData.h +0 -25
- package/React/Views/SafeAreaView/RCTSafeAreaViewLocalData.m +0 -25
- package/React/Views/SafeAreaView/RCTSafeAreaViewManager.h +0 -21
- package/React/Views/SafeAreaView/RCTSafeAreaViewManager.m +0 -32
- package/React/Views/ScrollView/RCTScrollContentShadowView.h +0 -19
- package/React/Views/ScrollView/RCTScrollContentShadowView.m +0 -35
- package/React/Views/ScrollView/RCTScrollContentView.h +0 -19
- package/React/Views/ScrollView/RCTScrollContentView.m +0 -36
- package/React/Views/ScrollView/RCTScrollContentViewManager.h +0 -17
- package/React/Views/ScrollView/RCTScrollContentViewManager.m +0 -31
- package/React/Views/ScrollView/RCTScrollView.m +0 -1168
- package/React/Views/ScrollView/RCTScrollViewManager.h +0 -25
- package/React/Views/ScrollView/RCTScrollViewManager.m +0 -202
- package/ReactAndroid/src/main/java/com/facebook/react/ReactNativeHost.java +0 -251
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/BridgeReactContext.java +0 -315
- package/ReactAndroid/src/main/java/com/facebook/react/common/ClearableSynchronizedPool.kt +0 -51
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/AnimationBackendChoreographer.kt +0 -89
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSPointerDispatcher.java +0 -736
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java +0 -221
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNode.java +0 -399
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactZIndexedViewGroup.kt +0 -35
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java +0 -346
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java +0 -666
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java +0 -147
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupDrawingOrderHelper.kt +0 -113
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagersPropertyCache.java +0 -614
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +0 -1838
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactNestedScrollView.java +0 -1646
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java +0 -1638
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaAlign.java +0 -51
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaBoxSizing.java +0 -33
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaDimension.java +0 -33
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaDisplay.java +0 -37
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaEdge.java +0 -47
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaErrata.java +0 -41
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaExperimentalFeature.java +0 -33
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaFlexDirection.java +0 -37
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaGridTrackType.java +0 -39
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaGutter.java +0 -35
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaJustify.java +0 -49
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogLevel.java +0 -45
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureMode.java +0 -35
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIBase.java +0 -928
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeType.java +0 -33
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaOverflow.java +0 -35
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaPositionType.java +0 -35
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaUnit.java +0 -43
- package/ReactAndroid/src/main/java/com/facebook/yoga/YogaWrap.java +0 -35
- package/ReactAndroid/src/main/jni/react/fabric/JAnimationBackendChoreographer.cpp +0 -23
- package/ReactAndroid/src/main/jni/react/fabric/JAnimationBackendChoreographer.h +0 -37
- package/ReactCommon/cxxreact/JSIndexedRAMBundle.cpp +0 -135
- package/ReactCommon/cxxreact/JSIndexedRAMBundle.h +0 -72
- package/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.cpp +0 -143
- package/ReactCommon/hermes/inspector-modern/chrome/ConnectionDemux.h +0 -55
- package/ReactCommon/hermes/inspector-modern/chrome/Registration.cpp +0 -78
- package/ReactCommon/hermes/inspector-modern/chrome/Registration.h +0 -39
- package/ReactCommon/hermes/inspector-modern/chrome/tests/ConnectionDemuxTests.cpp +0 -148
- package/ReactCommon/react/nativemodule/samples/platform/android/NativeSampleTurboModuleSpec.java +0 -168
- package/ReactCommon/react/nativemodule/samples/platform/android/ReactCommon/SampleTurboModuleSpec.cpp +0 -416
- package/ReactCommon/react/nativemodule/samples/platform/android/ReactCommon/SampleTurboModuleSpec.h +0 -31
- package/ReactCommon/react/nativemodule/samples/platform/ios/ReactCommon/RCTNativeSampleTurboModuleSpec.h +0 -134
- package/ReactCommon/react/nativemodule/samples/platform/ios/ReactCommon/RCTNativeSampleTurboModuleSpec.mm +0 -290
- package/ReactCommon/react/renderer/core/RawPropsKey.cpp +0 -62
- package/ReactCommon/react/renderer/core/RawPropsKey.h +0 -39
- package/ReactCommon/react/renderer/mounting/internal/DiffMap.h +0 -170
- package/ReactCommon/react/renderer/mounting/internal/LongestIncreasingSubsequence.h +0 -95
- package/ReactCommon/react/renderer/mounting/internal/TinyMap.h +0 -147
- package/ReactCommon/react/renderer/mounting/tests/LongestIncreasingSubsequenceTest.cpp +0 -154
- package/interface.js +0 -21
- package/jest-preset.js +0 -26
- package/rn-get-polyfills.js +0 -13
- package/sdks/.hermesversion +0 -1
- package/src/private/components/virtualcollection/debug/FlingItemOverlay.js +0 -13
- package/types/tsconfig.json +0 -15
- package/types_generated/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidNativeComponent.d.ts +0 -14
- package/types_generated/Libraries/Components/ScrollView/ScrollViewNativeComponent.d.ts +0 -21
- package/types_generated/Libraries/Components/ScrollView/ScrollViewNativeComponentType.d.ts +0 -134
- package/types_generated/Libraries/Components/Switch/AndroidSwitchNativeComponent.d.ts +0 -14
- package/types_generated/Libraries/Components/Switch/SwitchNativeComponent.d.ts +0 -14
- package/types_generated/Libraries/Components/Touchable/Touchable.d.ts +0 -262
- package/types_generated/Libraries/Interaction/InteractionManager.d.ts +0 -117
- package/types_generated/Libraries/NativeModules/specs/NativeDialogManagerAndroid.d.ts +0 -17
- package/types_generated/src/private/specs_DEPRECATED/components/AndroidSwitchNativeComponent.d.ts +0 -53
- package/types_generated/src/private/specs_DEPRECATED/components/ProgressBarAndroidNativeComponent.d.ts +0 -36
- package/types_generated/src/private/specs_DEPRECATED/components/SwitchNativeComponent.d.ts +0 -51
- package/types_generated/src/private/specs_DEPRECATED/modules/NativeDialogManagerAndroid.d.ts +0 -37
- package/types_generated/tsconfig.test.json +0 -16
- /package/ReactCommon/{cxxreact → react/utils}/MoveWrapper.h +0 -0
|
@@ -0,0 +1,2005 @@
|
|
|
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
|
+
*/
|
|
10
|
+
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
/*:: import type {
|
|
14
|
+
AggregatorInput,
|
|
15
|
+
AutolinkedDep,
|
|
16
|
+
AutolinkingArgs,
|
|
17
|
+
DiscoveredPlugin,
|
|
18
|
+
NpmDepRef,
|
|
19
|
+
PluginFlavoredFramework,
|
|
20
|
+
PluginPackageDep,
|
|
21
|
+
PluginProductDep,
|
|
22
|
+
PluginScriptPhase,
|
|
23
|
+
ReactDescriptor,
|
|
24
|
+
RawAutolinkingJson,
|
|
25
|
+
SpmModuleConfig,
|
|
26
|
+
SpmTarget,
|
|
27
|
+
SynthPackageSpec,
|
|
28
|
+
TargetEntry,
|
|
29
|
+
} from './spm-types'; */
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* generate-spm-autolinking.js – Generates autolinked/Package.swift, the SPM
|
|
33
|
+
* equivalent of CocoaPods' `use_native_modules!`.
|
|
34
|
+
*
|
|
35
|
+
* Usage:
|
|
36
|
+
* node generate-spm-autolinking.js [options]
|
|
37
|
+
*
|
|
38
|
+
* Options:
|
|
39
|
+
* --app-root <path> Path to the app directory (default: cwd)
|
|
40
|
+
* --react-native-root <path> Path to react-native package root
|
|
41
|
+
* --autolinking-json <path> Path to autolinking.json (default: build/generated/autolinking/autolinking.json)
|
|
42
|
+
* --output <path> Output dir (default: autolinked/)
|
|
43
|
+
*
|
|
44
|
+
* Reads:
|
|
45
|
+
* - build/generated/autolinking/autolinking.json (produced by react-native codegen)
|
|
46
|
+
* - react-native.config.js (for spm.modules extra modules, optional)
|
|
47
|
+
*
|
|
48
|
+
* Generates:
|
|
49
|
+
* - autolinked/Package.swift
|
|
50
|
+
*
|
|
51
|
+
* V1 behavior:
|
|
52
|
+
* - Processes npm-package native modules with platforms.ios != null from autolinking.json
|
|
53
|
+
* - Also processes any `spm.modules` entries from react-native.config.js for local modules
|
|
54
|
+
* - Targets resolve React headers via SPM product dependencies (no flags)
|
|
55
|
+
*
|
|
56
|
+
* V2 behavior (future):
|
|
57
|
+
* - npm packages with their own Package.swift use .package(url: ...) instead of inline targets
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
const {discoverPlugins, invokePlugins} = require('./autolinking-plugins');
|
|
61
|
+
const {
|
|
62
|
+
SpmNameCollisionError,
|
|
63
|
+
assertSwiftNameNotReserved,
|
|
64
|
+
defaultReadConfig,
|
|
65
|
+
defaultResolveDep,
|
|
66
|
+
expandSpmDependencies,
|
|
67
|
+
isValidSwiftName,
|
|
68
|
+
} = require('./expand-spm-dependencies');
|
|
69
|
+
const {readPodspec} = require('./read-podspec');
|
|
70
|
+
const {
|
|
71
|
+
AUTOLINKED_PACKAGE_NAME,
|
|
72
|
+
REACT_CODEGEN_PACKAGE_NAME,
|
|
73
|
+
REACT_CODEGEN_PRODUCTS,
|
|
74
|
+
REACT_NATIVE_PACKAGE_NAME,
|
|
75
|
+
REACT_NATIVE_PRODUCTS,
|
|
76
|
+
RemoteVersionError,
|
|
77
|
+
findProjectRoot,
|
|
78
|
+
makeLogger,
|
|
79
|
+
remotePackageConfig,
|
|
80
|
+
} = require('./spm-utils');
|
|
81
|
+
const fs = require('fs');
|
|
82
|
+
const path = require('path');
|
|
83
|
+
const yargs = require('yargs');
|
|
84
|
+
|
|
85
|
+
const {log, warn} = makeLogger('generate-spm-autolinking');
|
|
86
|
+
|
|
87
|
+
// Targets compiling against React get all headers via SPM product
|
|
88
|
+
// dependencies — no search-path flags: the React module from the invariant
|
|
89
|
+
// ReactHeaders Clang target, every other RN namespace from ReactNativeHeaders
|
|
90
|
+
// binaryTarget (pure-RN), the third-party deps namespaces (folly/glog/
|
|
91
|
+
// boost/...) from the ReactNativeDependenciesHeaders sidecar, and the app's
|
|
92
|
+
// generated headers from the ReactAppHeaders target in the codegen package.
|
|
93
|
+
//
|
|
94
|
+
// Remote mode (remotePackageConfig): the ReactNative-family products come
|
|
95
|
+
// from the single remote package identity instead of the local path-based
|
|
96
|
+
// package, so app + every library unify on one SPM-resolved version.
|
|
97
|
+
let remoteCfg /*: ?{url: string, version: string, identity: string} */ = null;
|
|
98
|
+
|
|
99
|
+
function reactNativePackageLabel() /*: string */ {
|
|
100
|
+
return remoteCfg != null ? remoteCfg.identity : REACT_NATIVE_PACKAGE_NAME;
|
|
101
|
+
}
|
|
102
|
+
// In remote mode the RN package is labelled with the remote identity, so that
|
|
103
|
+
// name is reserved for this run too.
|
|
104
|
+
function reservedNamesForRun() /*: ?Array<string> */ {
|
|
105
|
+
return remoteCfg != null ? [remoteCfg.identity] : undefined;
|
|
106
|
+
}
|
|
107
|
+
function reactNativePackageDecl(localDecl /*: string */) /*: string */ {
|
|
108
|
+
return remoteCfg != null
|
|
109
|
+
? `.package(url: "${remoteCfg.url}", exact: "${remoteCfg.version}")`
|
|
110
|
+
: localDecl;
|
|
111
|
+
}
|
|
112
|
+
// The React product set — single source of truth shared by reactProductDeps()
|
|
113
|
+
// (the emitted string) and the plugin ReactDescriptor. The invariant ReactNative
|
|
114
|
+
// products come from the RN package (identity varies local vs remote);
|
|
115
|
+
// ReactAppHeaders is in the separate, per-app React-GeneratedCode package
|
|
116
|
+
// (easy to miss when hand-rolling — hence exposing it to plugins).
|
|
117
|
+
function reactProducts() /*: Array<{name: string, package: string}> */ {
|
|
118
|
+
const rn = reactNativePackageLabel();
|
|
119
|
+
return [
|
|
120
|
+
...REACT_NATIVE_PRODUCTS.map(name => ({name, package: rn})),
|
|
121
|
+
...REACT_CODEGEN_PRODUCTS.map(name => ({
|
|
122
|
+
name,
|
|
123
|
+
package: REACT_CODEGEN_PACKAGE_NAME,
|
|
124
|
+
})),
|
|
125
|
+
];
|
|
126
|
+
}
|
|
127
|
+
function reactProductDeps() /*: string */ {
|
|
128
|
+
return reactProducts()
|
|
129
|
+
.map(p => `.product(name: "${p.name}", package: "${p.package}")`)
|
|
130
|
+
.join(', ');
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Structured React descriptor handed to autolinking plugins: how to depend on
|
|
134
|
+
// React through one source of truth, so a plugin's own Package.swift doesn't
|
|
135
|
+
// re-derive RN's package path / identity / product names.
|
|
136
|
+
//
|
|
137
|
+
// `packageRef` is local or remote (distinguished by which keys are present):
|
|
138
|
+
// - local: {name, path (ABSOLUTE), relPath (relative to outputDir)}
|
|
139
|
+
// - remote: {name, url, version}
|
|
140
|
+
// The canonical `path` is ABSOLUTE because a plugin may write its manifests in
|
|
141
|
+
// arbitrary subdirs of outputDir, for which an outputDir-relative path would be
|
|
142
|
+
// wrong; the generated manifests are gitignored + regenerated every sync, so an
|
|
143
|
+
// absolute path carries no portability cost. `relPath` is a convenience for the
|
|
144
|
+
// common case. `products` derives from the SAME reactProducts() RN wires into
|
|
145
|
+
// its own autolinked targets (parity: a plugin's target gets exactly RN's React
|
|
146
|
+
// surface), filtered to only products whose package is resolvable this run —
|
|
147
|
+
// the invariant is that any listed product can be depended on without guarding.
|
|
148
|
+
// Returns null when there is no resolvable React dependency.
|
|
149
|
+
function reactDescriptor(
|
|
150
|
+
absXcframeworks /*: ?string */,
|
|
151
|
+
xcframeworksRelPath /*: ?string */,
|
|
152
|
+
codegenPackageExists /*: boolean */,
|
|
153
|
+
) /*: ?ReactDescriptor */ {
|
|
154
|
+
let packageRef;
|
|
155
|
+
if (remoteCfg != null) {
|
|
156
|
+
packageRef = {
|
|
157
|
+
name: remoteCfg.identity,
|
|
158
|
+
url: remoteCfg.url,
|
|
159
|
+
version: remoteCfg.version,
|
|
160
|
+
};
|
|
161
|
+
} else if (absXcframeworks != null) {
|
|
162
|
+
packageRef = {
|
|
163
|
+
name: REACT_NATIVE_PACKAGE_NAME,
|
|
164
|
+
path: toPosix(absXcframeworks),
|
|
165
|
+
relPath:
|
|
166
|
+
xcframeworksRelPath != null ? toPosix(xcframeworksRelPath) : undefined,
|
|
167
|
+
};
|
|
168
|
+
} else {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
const products = reactProducts().filter(
|
|
172
|
+
p => p.package !== REACT_CODEGEN_PACKAGE_NAME || codegenPackageExists,
|
|
173
|
+
);
|
|
174
|
+
return {packageRef, products};
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Normalize a (possibly Windows) path to posix separators for embedding in
|
|
178
|
+
// a Package.swift `.package(path:)` literal — SPM expects forward slashes.
|
|
179
|
+
function toPosix(p /*: string */) /*: string */ {
|
|
180
|
+
return p.split(path.sep).join('/');
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function parseArgs(argv /*: Array<string> */) /*: AutolinkingArgs */ {
|
|
184
|
+
const parsed = yargs(argv)
|
|
185
|
+
.option('app-root', {
|
|
186
|
+
type: 'string',
|
|
187
|
+
default: process.cwd(),
|
|
188
|
+
describe: 'Path to the app directory',
|
|
189
|
+
})
|
|
190
|
+
.option('react-native-root', {
|
|
191
|
+
type: 'string',
|
|
192
|
+
describe: 'Path to react-native package root',
|
|
193
|
+
})
|
|
194
|
+
.option('autolinking-json', {
|
|
195
|
+
type: 'string',
|
|
196
|
+
describe:
|
|
197
|
+
'Path to autolinking.json (default: build/generated/autolinking/autolinking.json)',
|
|
198
|
+
})
|
|
199
|
+
.option('output', {
|
|
200
|
+
type: 'string',
|
|
201
|
+
describe: 'Output dir (default: autolinked/)',
|
|
202
|
+
})
|
|
203
|
+
.option('xcframeworks-path', {
|
|
204
|
+
type: 'string',
|
|
205
|
+
describe:
|
|
206
|
+
'Path to the xcframeworks sub-package (absolute or relative to appRoot)',
|
|
207
|
+
})
|
|
208
|
+
.usage(
|
|
209
|
+
'Usage: $0 [options]\n\nGenerates autolinked/Package.swift for SPM autolinking.',
|
|
210
|
+
)
|
|
211
|
+
.help()
|
|
212
|
+
.parseSync();
|
|
213
|
+
|
|
214
|
+
return {
|
|
215
|
+
appRoot: parsed['app-root'],
|
|
216
|
+
reactNativeRoot: parsed['react-native-root'] ?? null,
|
|
217
|
+
autolinkingJson: parsed['autolinking-json'] ?? null,
|
|
218
|
+
output: parsed.output ?? null,
|
|
219
|
+
xcframeworksPath: parsed['xcframeworks-path'] ?? null,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Reads autolinking.json and returns dependencies with iOS platform support.
|
|
225
|
+
*/
|
|
226
|
+
function readAutolinkingJson(
|
|
227
|
+
filePath /*: string */,
|
|
228
|
+
) /*: RawAutolinkingJson | null */ {
|
|
229
|
+
if (!fs.existsSync(filePath)) {
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Attempts to read react-native.config.js to find spm.modules entries.
|
|
237
|
+
* These are extra modules not discoverable via autolinking.json.
|
|
238
|
+
*
|
|
239
|
+
* Expected structure in react-native.config.js:
|
|
240
|
+
* module.exports = {
|
|
241
|
+
* ...
|
|
242
|
+
* spm: {
|
|
243
|
+
* modules: [
|
|
244
|
+
* {
|
|
245
|
+
* name: "MyNativeModule",
|
|
246
|
+
* path: "ios/MyNativeModule", // relative to appRoot
|
|
247
|
+
* exclude: ["*.js", "*.podspec"], // optional
|
|
248
|
+
* }
|
|
249
|
+
* ]
|
|
250
|
+
* }
|
|
251
|
+
* }
|
|
252
|
+
*/
|
|
253
|
+
function readSpmModulesFromConfig(
|
|
254
|
+
appRoot /*: string */,
|
|
255
|
+
) /*: Array<SpmModuleConfig> */ {
|
|
256
|
+
const configPath = path.join(appRoot, 'react-native.config.js');
|
|
257
|
+
if (!fs.existsSync(configPath)) {
|
|
258
|
+
return [];
|
|
259
|
+
}
|
|
260
|
+
try {
|
|
261
|
+
// $FlowFixMe[unsupported-syntax] dynamic require by computed path
|
|
262
|
+
const config = require(configPath);
|
|
263
|
+
return config.spm?.modules ?? [];
|
|
264
|
+
} catch (e) {
|
|
265
|
+
// Config might use Ruby interop or other patterns – skip
|
|
266
|
+
return [];
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Validates one app-local `spm.modules` name against the same rules a library's
|
|
272
|
+
* `spm.name` gets: a usable Swift identifier, not a name React Native reserves,
|
|
273
|
+
* and not one already taken by another module or an autolinked dep.
|
|
274
|
+
* `taken` maps lower-cased name → the name as written.
|
|
275
|
+
*/
|
|
276
|
+
function assertSpmModuleName(
|
|
277
|
+
name /*: unknown */,
|
|
278
|
+
taken /*: Map<string, string> */,
|
|
279
|
+
) /*: void */ {
|
|
280
|
+
const remedy =
|
|
281
|
+
"Rename it in this app's react-native.config.js 'spm.modules'.";
|
|
282
|
+
if (typeof name !== 'string' || !isValidSwiftName(name)) {
|
|
283
|
+
throw new Error(
|
|
284
|
+
`react-native autolinking: invalid 'spm.modules' name ${JSON.stringify(name) ?? 'undefined'}: must start with a letter or underscore and contain only letters, digits, underscores, or hyphens.`,
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
const moduleName = name;
|
|
288
|
+
assertSwiftNameNotReserved(moduleName, {
|
|
289
|
+
label: `the 'spm.modules' entry '${moduleName}'`,
|
|
290
|
+
remedy,
|
|
291
|
+
extraReservedNames: reservedNamesForRun(),
|
|
292
|
+
});
|
|
293
|
+
const clash = taken.get(moduleName.toLowerCase());
|
|
294
|
+
if (clash != null) {
|
|
295
|
+
throw new SpmNameCollisionError(
|
|
296
|
+
`react-native autolinking: SPM Swift name collision: the 'spm.modules' entry '${moduleName}' ` +
|
|
297
|
+
(clash === moduleName
|
|
298
|
+
? `is already the name of another autolinked target.`
|
|
299
|
+
: `differs from the existing target '${clash}' only in case, which collides on case-insensitive filesystems.`) +
|
|
300
|
+
` ${remedy}`,
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Reads the app's `spm.denyPlugins` — npm names of autolinking plugins to
|
|
307
|
+
* skip. The escape hatch for the transitive plugin discovery (an app opts a
|
|
308
|
+
* framework's plugin OUT); no allowlist is required.
|
|
309
|
+
*/
|
|
310
|
+
function readDenyPluginsFromConfig(appRoot /*: string */) /*: Array<string> */ {
|
|
311
|
+
const configPath = path.join(appRoot, 'react-native.config.js');
|
|
312
|
+
if (!fs.existsSync(configPath)) {
|
|
313
|
+
return [];
|
|
314
|
+
}
|
|
315
|
+
try {
|
|
316
|
+
// $FlowFixMe[unsupported-syntax] dynamic require by computed path
|
|
317
|
+
const config = require(configPath);
|
|
318
|
+
return config.spm?.denyPlugins ?? [];
|
|
319
|
+
} catch (e) {
|
|
320
|
+
return [];
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Returns "." if the source directory has .h/.hpp files directly at its root
|
|
326
|
+
* AND no subdirectories exist at that root (adjacent subdirectories would cause
|
|
327
|
+
* Clang to reject the umbrella header).
|
|
328
|
+
* Returns null otherwise.
|
|
329
|
+
*/
|
|
330
|
+
function inferPublicHeadersPath(sourcePath /*: string */) /*: string | null */ {
|
|
331
|
+
if (!fs.existsSync(sourcePath)) return null;
|
|
332
|
+
const entries /*: Array<{name: string, isDirectory(): boolean, isFile(): boolean, isSymbolicLink(): boolean}> */ =
|
|
333
|
+
// $FlowFixMe[incompatible-type] Dirent typing
|
|
334
|
+
fs.readdirSync(sourcePath, {withFileTypes: true});
|
|
335
|
+
const hasHeaders = entries.some(
|
|
336
|
+
e =>
|
|
337
|
+
(e.isFile() || e.isSymbolicLink()) &&
|
|
338
|
+
(e.name.endsWith('.h') || e.name.endsWith('.hpp')),
|
|
339
|
+
);
|
|
340
|
+
const hasSubdirs = entries.some(e => e.isDirectory());
|
|
341
|
+
// Only use "." if headers at root AND no adjacent subdirectories.
|
|
342
|
+
// If both headers and subdirectories exist, Clang rejects the module map
|
|
343
|
+
// (umbrella header + adjacent directories = error).
|
|
344
|
+
return hasHeaders && !hasSubdirs ? '.' : null;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/*::
|
|
348
|
+
type ExtensionFilter = ReadonlySet<string>;
|
|
349
|
+
*/
|
|
350
|
+
|
|
351
|
+
const HEADER_EXTENSIONS /*: ExtensionFilter */ = new Set(['.h', '.hpp']);
|
|
352
|
+
const IMPL_EXTENSIONS /*: ExtensionFilter */ = new Set([
|
|
353
|
+
'.m',
|
|
354
|
+
'.mm',
|
|
355
|
+
'.c',
|
|
356
|
+
'.cpp',
|
|
357
|
+
'.swift',
|
|
358
|
+
]);
|
|
359
|
+
const ALL_SOURCE_EXTENSIONS /*: ExtensionFilter */ = new Set([
|
|
360
|
+
...HEADER_EXTENSIONS,
|
|
361
|
+
...IMPL_EXTENSIONS,
|
|
362
|
+
]);
|
|
363
|
+
|
|
364
|
+
// Directory names whose contents should never be included in an SPM target —
|
|
365
|
+
// test fixtures, Android sources, vendored modules. Shared between the source
|
|
366
|
+
// walker and the header linker so they agree on what to skip.
|
|
367
|
+
const SKIP_DIRS_DEFAULT /*: ReadonlySet<string> */ = new Set([
|
|
368
|
+
'android',
|
|
369
|
+
'tests',
|
|
370
|
+
'__tests__',
|
|
371
|
+
'__mocks__',
|
|
372
|
+
'test',
|
|
373
|
+
'jest',
|
|
374
|
+
'node_modules',
|
|
375
|
+
]);
|
|
376
|
+
|
|
377
|
+
// Name of the dir-symlink inside each wrapper that points at the dep's real
|
|
378
|
+
// source dir. With target.path = "." (the wrapper), SPM resolves source paths
|
|
379
|
+
// like "<WRAPPER_ROOT_NAME>/Foo.mm" by following this link.
|
|
380
|
+
const WRAPPER_ROOT_NAME = 'root';
|
|
381
|
+
|
|
382
|
+
// The config-gated C++ defines the prebuilt React.framework is built with (see
|
|
383
|
+
// packages/react-native/Package.swift). Autolinked Fabric C++ must compile with
|
|
384
|
+
// the same NDEBUG state, else DebugStringConvertible's vtable / ShadowNode
|
|
385
|
+
// layout diverges from a Release React.framework and the link fails.
|
|
386
|
+
const REACT_CXX_CONFIG_DEFINES = [
|
|
387
|
+
'.define("DEBUG", .when(configuration: .debug))',
|
|
388
|
+
'.define("NDEBUG", .when(configuration: .release))',
|
|
389
|
+
];
|
|
390
|
+
|
|
391
|
+
// Marker the autolinker stamps onto every synth Package.swift it writes.
|
|
392
|
+
// Files lacking this marker are treated as user-managed (self-managed) and
|
|
393
|
+
// are referenced directly rather than wrapped — see findSelfManagedPackageDir.
|
|
394
|
+
const AUTOGEN_MARKER =
|
|
395
|
+
'// AUTO-GENERATED by scripts/generate-spm-autolinking.js';
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* A dep is "self-managed" when it ships a hand-written Package.swift
|
|
399
|
+
* (i.e. one that lacks our AUTOGEN_MARKER). The autolinker skips wrapping
|
|
400
|
+
* it and references the manifest's directory directly — useful for
|
|
401
|
+
* libraries that want to ship a real SPM manifest and have full control
|
|
402
|
+
* over their target settings.
|
|
403
|
+
*
|
|
404
|
+
* Two layouts are recognized:
|
|
405
|
+
* 1. <dep>/Package.swift — manifest at the npm-package root
|
|
406
|
+
* 2. <dep>/ios/Package.swift — manifest co-located with ObjC
|
|
407
|
+
* sources, keeping the npm-package
|
|
408
|
+
* root free of SPM artifacts
|
|
409
|
+
* (.build/, .swiftpm/, Package.resolved)
|
|
410
|
+
*
|
|
411
|
+
* Returns the directory that contains the hand-authored manifest, or null
|
|
412
|
+
* when no candidate exists. That directory is what the aggregator hands to
|
|
413
|
+
* SPM as `.package(path:)` — for layout 2 that means `<dep>/ios`.
|
|
414
|
+
*/
|
|
415
|
+
function findSelfManagedPackageDir(absSource /*: string */) /*: ?string */ {
|
|
416
|
+
for (const sub of ['', 'ios']) {
|
|
417
|
+
const dir = sub === '' ? absSource : path.join(absSource, sub);
|
|
418
|
+
try {
|
|
419
|
+
const content = fs.readFileSync(path.join(dir, 'Package.swift'), 'utf8');
|
|
420
|
+
if (!content.includes(AUTOGEN_MARKER)) {
|
|
421
|
+
return dir;
|
|
422
|
+
}
|
|
423
|
+
} catch {
|
|
424
|
+
// candidate does not exist; try the next one
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return null;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Does this dep ship a CocoaPods podspec? (Checked at the dep root and under
|
|
432
|
+
* ios/.) A missing manifest is auto-scaffoldable only when a podspec exists —
|
|
433
|
+
* the scaffolder translates the podspec into a Package.swift.
|
|
434
|
+
*/
|
|
435
|
+
function hasPodspec(absSource /*: string */) /*: boolean */ {
|
|
436
|
+
for (const sub of ['', 'ios']) {
|
|
437
|
+
const dir = sub === '' ? absSource : path.join(absSource, sub);
|
|
438
|
+
try {
|
|
439
|
+
if (
|
|
440
|
+
fs
|
|
441
|
+
.readdirSync(dir)
|
|
442
|
+
.some(e => e.endsWith('.podspec') && !e.startsWith('.spm-scaffold-'))
|
|
443
|
+
) {
|
|
444
|
+
return true;
|
|
445
|
+
}
|
|
446
|
+
} catch {
|
|
447
|
+
// dir does not exist; try the next candidate
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
return false;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* True when a dep has BOTH Swift and C-family (.m/.mm/.c/.cpp) sources. SPM
|
|
455
|
+
* cannot compile mixed-language sources in a single target, and RN libs that
|
|
456
|
+
* mix them are typically bidirectionally coupled (ObjC↔Swift) — which can't be
|
|
457
|
+
* split into two targets either (it would be a circular dependency). So such a
|
|
458
|
+
* dep is unsupportable by the scaffolder; we surface a clear, distinct error
|
|
459
|
+
* instead of emitting a manifest that fails with a cryptic SPM resolve error.
|
|
460
|
+
* Heuristic filesystem scan (bounded depth; skips examples/tests/build noise).
|
|
461
|
+
*/
|
|
462
|
+
function hasMixedLanguageSources(absSource /*: string */) /*: boolean */ {
|
|
463
|
+
const SKIP /*: Set<string> */ = new Set([
|
|
464
|
+
'node_modules',
|
|
465
|
+
'Pods',
|
|
466
|
+
'build',
|
|
467
|
+
'.git',
|
|
468
|
+
'__tests__',
|
|
469
|
+
'example',
|
|
470
|
+
'Example',
|
|
471
|
+
'examples',
|
|
472
|
+
]);
|
|
473
|
+
let hasSwift = false;
|
|
474
|
+
let hasClang = false;
|
|
475
|
+
const walk = (dir /*: string */, depth /*: number */) => {
|
|
476
|
+
if (depth > 6 || (hasSwift && hasClang)) return;
|
|
477
|
+
let entries /*: Array<{name: string, isDirectory(): boolean}> */ = [];
|
|
478
|
+
try {
|
|
479
|
+
// $FlowFixMe[incompatible-type] Dirent typing
|
|
480
|
+
entries = fs.readdirSync(dir, {withFileTypes: true});
|
|
481
|
+
} catch {
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
for (const e of entries) {
|
|
485
|
+
// $FlowFixMe[incompatible-type] Dirent.name is string|Buffer in stubs
|
|
486
|
+
const name /*: string */ = e.name;
|
|
487
|
+
if (e.isDirectory()) {
|
|
488
|
+
if (!name.startsWith('.') && !SKIP.has(name)) {
|
|
489
|
+
walk(path.join(dir, name), depth + 1);
|
|
490
|
+
}
|
|
491
|
+
} else if (/\.swift$/i.test(name)) {
|
|
492
|
+
hasSwift = true;
|
|
493
|
+
} else if (/\.(mm?|c|cc|cpp|cxx)$/i.test(name)) {
|
|
494
|
+
hasClang = true;
|
|
495
|
+
}
|
|
496
|
+
if (hasSwift && hasClang) return;
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
walk(absSource, 0);
|
|
500
|
+
return hasSwift && hasClang;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Error thrown when one or more autolinked community npm deps have no Swift
|
|
505
|
+
* Package Manager manifest (neither a shipped Package.swift nor a scaffolded
|
|
506
|
+
* one). The autolinker no longer silently synthesizes a manifest for these —
|
|
507
|
+
* that hid the gap and duplicated the scaffolder. Carries the dep list so the
|
|
508
|
+
* CLI can surface a precise, actionable message and set a distinct exit code
|
|
509
|
+
* (the Xcode build phase keys off it to fail the build).
|
|
510
|
+
*/
|
|
511
|
+
class MissingManifestError extends Error {
|
|
512
|
+
/*:: missingManifests: Array<{name: string, npmName: string, hasPodspec: boolean, mixed?: boolean}>; */
|
|
513
|
+
constructor(
|
|
514
|
+
deps /*: Array<{name: string, npmName: string, hasPodspec: boolean, mixed?: boolean}> */,
|
|
515
|
+
) {
|
|
516
|
+
super(
|
|
517
|
+
`${deps.length} autolinked native module(s) have no Package.swift. ` +
|
|
518
|
+
'Run `npx react-native spm scaffold` to generate them.',
|
|
519
|
+
);
|
|
520
|
+
this.name = 'MissingManifestError';
|
|
521
|
+
this.missingManifests = deps;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Prints one `error:`-prefixed line per missing-manifest dep so Xcode surfaces
|
|
527
|
+
* each as a build error (Xcode parses lines beginning with `error: `), then
|
|
528
|
+
* returns the MissingManifestError to throw. Kept together so the message and
|
|
529
|
+
* the thrown error never drift.
|
|
530
|
+
*/
|
|
531
|
+
function reportMissingManifests(
|
|
532
|
+
deps /*: Array<{name: string, npmName: string, hasPodspec: boolean, mixed?: boolean}> */,
|
|
533
|
+
) /*: MissingManifestError */ {
|
|
534
|
+
for (const d of deps) {
|
|
535
|
+
if (d.mixed === true) {
|
|
536
|
+
console.error(
|
|
537
|
+
`error: "${d.npmName}" has mixed Swift + Objective-C/C++ sources, which Swift Package Manager cannot compile in a single target (and its Swift↔ObjC interop typically can't be split into two targets without a circular dependency).\n` +
|
|
538
|
+
` • Opt it out of SPM autolinking in your app's react-native.config.js:\n` +
|
|
539
|
+
` module.exports = { dependencies: { '${d.npmName}': { platforms: { ios: null } } } };\n` +
|
|
540
|
+
` • Or consume ${d.npmName} as a prebuilt binary (xcframework) instead.`,
|
|
541
|
+
);
|
|
542
|
+
continue;
|
|
543
|
+
}
|
|
544
|
+
if (d.hasPodspec) {
|
|
545
|
+
console.error(
|
|
546
|
+
`error: Package.swift is missing for library "${d.npmName}" — it ships no Swift Package Manager support.\n` +
|
|
547
|
+
` 1. Run \`npx react-native spm scaffold\` to generate a Package.swift for ${d.npmName}.\n` +
|
|
548
|
+
` 2. Persist it with a patch: \`npx patch-package ${d.npmName}\`, and commit the patch (node_modules is not committed).\n` +
|
|
549
|
+
` 3. Ask ${d.npmName}'s maintainer to ship a Package.swift upstream (or contribute one).\n` +
|
|
550
|
+
' 4. Without a committed patch, this same error returns whenever node_modules is reset (fresh install / CI).',
|
|
551
|
+
);
|
|
552
|
+
} else {
|
|
553
|
+
console.error(
|
|
554
|
+
`error: Package.swift is missing for library "${d.npmName}", and it ships no podspec so it cannot be scaffolded automatically.\n` +
|
|
555
|
+
` • It needs Swift Package Manager support added manually — ask ${d.npmName}'s maintainer to ship a Package.swift upstream (or contribute one).`,
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
return new MissingManifestError(deps);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Mirrors every header file under `srcDir` as a relative symlink at the same
|
|
564
|
+
* relative location under `destDir`. Used for the centralized cross-package
|
|
565
|
+
* headers tree at `<outputDir>/headers/<SwiftName>/` so consumers can resolve
|
|
566
|
+
* `#import <SwiftName/Header.h>` via a single `-I <outputDir>/headers` flag.
|
|
567
|
+
*
|
|
568
|
+
* Idempotent: existing symlinks pointing at the right target are left alone;
|
|
569
|
+
* stale entries are pruned. Header symlinks here are inert to Xcode (it
|
|
570
|
+
* doesn't navigate them as editable source — they're compiler-only).
|
|
571
|
+
*/
|
|
572
|
+
function linkHeaderTree(
|
|
573
|
+
srcDir /*: string */,
|
|
574
|
+
destDir /*: string */,
|
|
575
|
+
skipDirNames /*: Set<string> */ = new Set(),
|
|
576
|
+
) /*: void */ {
|
|
577
|
+
if (!srcDir || !path.isAbsolute(srcDir)) {
|
|
578
|
+
throw new Error(
|
|
579
|
+
`linkHeaderTree: srcDir must be a non-empty absolute path, got: "${srcDir}"`,
|
|
580
|
+
);
|
|
581
|
+
}
|
|
582
|
+
if (!destDir || !path.isAbsolute(destDir)) {
|
|
583
|
+
throw new Error(
|
|
584
|
+
`linkHeaderTree: destDir must be a non-empty absolute path, got: "${destDir}"`,
|
|
585
|
+
);
|
|
586
|
+
}
|
|
587
|
+
if (!fs.existsSync(srcDir)) {
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
/*:: type HeaderEntry = {relSrc: string, absSrc: string}; */
|
|
592
|
+
const headers /*: Array<HeaderEntry> */ = [];
|
|
593
|
+
function collect(dir /*: string */, relBase /*: string */) /*: void */ {
|
|
594
|
+
const entries /*: Array<{name: string, isDirectory(): boolean, isFile(): boolean}> */ =
|
|
595
|
+
// $FlowFixMe[incompatible-type] Dirent typing
|
|
596
|
+
fs.readdirSync(dir, {withFileTypes: true});
|
|
597
|
+
for (const entry of entries) {
|
|
598
|
+
const {name} = entry;
|
|
599
|
+
if (entry.isDirectory()) {
|
|
600
|
+
if (SKIP_DIRS_DEFAULT.has(name) || skipDirNames.has(name)) continue;
|
|
601
|
+
collect(path.join(dir, name), path.join(relBase, name));
|
|
602
|
+
} else if (entry.isFile() && HEADER_EXTENSIONS.has(path.extname(name))) {
|
|
603
|
+
headers.push({
|
|
604
|
+
relSrc: path.join(relBase, name),
|
|
605
|
+
absSrc: path.join(dir, name),
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
collect(srcDir, '');
|
|
611
|
+
|
|
612
|
+
if (headers.length === 0) {
|
|
613
|
+
try {
|
|
614
|
+
if (fs.lstatSync(destDir).isDirectory()) {
|
|
615
|
+
fs.rmSync(destDir, {recursive: true, force: true});
|
|
616
|
+
}
|
|
617
|
+
} catch {
|
|
618
|
+
// destDir does not exist – fine
|
|
619
|
+
}
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
fs.mkdirSync(destDir, {recursive: true});
|
|
624
|
+
|
|
625
|
+
const expected /*: Set<string> */ = new Set();
|
|
626
|
+
for (const {relSrc, absSrc} of headers) {
|
|
627
|
+
const linkPath = path.join(destDir, relSrc);
|
|
628
|
+
expected.add(relSrc);
|
|
629
|
+
fs.mkdirSync(path.dirname(linkPath), {recursive: true});
|
|
630
|
+
const desiredTarget = path.relative(path.dirname(linkPath), absSrc);
|
|
631
|
+
try {
|
|
632
|
+
const existing = fs.lstatSync(linkPath);
|
|
633
|
+
if (
|
|
634
|
+
existing.isSymbolicLink() &&
|
|
635
|
+
fs.readlinkSync(linkPath) === desiredTarget
|
|
636
|
+
) {
|
|
637
|
+
continue;
|
|
638
|
+
}
|
|
639
|
+
fs.unlinkSync(linkPath);
|
|
640
|
+
} catch {
|
|
641
|
+
// nothing to remove
|
|
642
|
+
}
|
|
643
|
+
fs.symlinkSync(desiredTarget, linkPath);
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
// Prune stale entries: walk destDir and delete anything not in `expected`.
|
|
647
|
+
function pruneWalk(dir /*: string */, relBase /*: string */) /*: void */ {
|
|
648
|
+
if (!fs.existsSync(dir)) return;
|
|
649
|
+
const entries /*: Array<{name: string, isDirectory(): boolean, isFile(): boolean, isSymbolicLink(): boolean}> */ =
|
|
650
|
+
// $FlowFixMe[incompatible-type] Dirent typing
|
|
651
|
+
fs.readdirSync(dir, {withFileTypes: true});
|
|
652
|
+
for (const entry of entries) {
|
|
653
|
+
const rel = path.join(relBase, entry.name);
|
|
654
|
+
const abs = path.join(dir, entry.name);
|
|
655
|
+
if (entry.isDirectory()) {
|
|
656
|
+
pruneWalk(abs, rel);
|
|
657
|
+
if (fs.readdirSync(abs).length === 0) {
|
|
658
|
+
fs.rmdirSync(abs);
|
|
659
|
+
}
|
|
660
|
+
} else {
|
|
661
|
+
if (!expected.has(rel)) {
|
|
662
|
+
fs.unlinkSync(abs);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
pruneWalk(destDir, '');
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* Searches sourcePath for a PrivacyInfo.xcprivacy file (at root or one level deep).
|
|
672
|
+
* Returns the relative path from sourcePath if found, null otherwise.
|
|
673
|
+
*/
|
|
674
|
+
function findPrivacyManifest(sourcePath /*: string */) /*: string | null */ {
|
|
675
|
+
if (!fs.existsSync(sourcePath)) return null;
|
|
676
|
+
// Check root level
|
|
677
|
+
if (fs.existsSync(path.join(sourcePath, 'PrivacyInfo.xcprivacy'))) {
|
|
678
|
+
return 'PrivacyInfo.xcprivacy';
|
|
679
|
+
}
|
|
680
|
+
// Check one level deep (e.g. ios/PrivacyInfo.xcprivacy)
|
|
681
|
+
const entries /*: Array<{name: string, isDirectory(): boolean}> */ =
|
|
682
|
+
// $FlowFixMe[incompatible-type] Dirent typing
|
|
683
|
+
fs.readdirSync(sourcePath, {withFileTypes: true});
|
|
684
|
+
for (const entry of entries) {
|
|
685
|
+
if (entry.isDirectory()) {
|
|
686
|
+
const nested = path.join(sourcePath, entry.name, 'PrivacyInfo.xcprivacy');
|
|
687
|
+
if (fs.existsSync(nested)) {
|
|
688
|
+
return path.join(entry.name, 'PrivacyInfo.xcprivacy');
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
return null;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* Recursively yields forward-slash paths (relative to sourcePath) for every
|
|
697
|
+
* regular file under sourcePath, skipping directories whose name is in
|
|
698
|
+
* SKIP_DIRS_DEFAULT. Used as the building block for both the auto-discovery
|
|
699
|
+
* (collectSpmSources) and explicit-glob (expandSpmSourceGlobs) paths so they
|
|
700
|
+
* agree on what's a candidate before extension/glob filtering applies.
|
|
701
|
+
*/
|
|
702
|
+
function walkSourceFiles(sourcePath /*: string */) /*: Array<string> */ {
|
|
703
|
+
const out /*: Array<string> */ = [];
|
|
704
|
+
if (!fs.existsSync(sourcePath)) {
|
|
705
|
+
return out;
|
|
706
|
+
}
|
|
707
|
+
function walk(dir /*: string */, rel /*: string */) /*: void */ {
|
|
708
|
+
const entries /*: Array<{name: string, isDirectory(): boolean, isFile(): boolean, isSymbolicLink(): boolean}> */ =
|
|
709
|
+
// $FlowFixMe[incompatible-type] Dirent typing
|
|
710
|
+
fs.readdirSync(dir, {withFileTypes: true});
|
|
711
|
+
for (const entry of entries) {
|
|
712
|
+
const {name} = entry;
|
|
713
|
+
const childRel = rel === '' ? name : `${rel}/${name}`;
|
|
714
|
+
if (entry.isDirectory()) {
|
|
715
|
+
if (SKIP_DIRS_DEFAULT.has(name)) continue;
|
|
716
|
+
walk(path.join(dir, name), childRel);
|
|
717
|
+
} else if (entry.isFile() || entry.isSymbolicLink()) {
|
|
718
|
+
out.push(childRel);
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
walk(sourcePath, '');
|
|
723
|
+
return out;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* Idempotent symlink: ensure `linkPath` is a symlink to `target`. If it
|
|
728
|
+
* already is, leave it untouched (preserves inode). If it points elsewhere
|
|
729
|
+
* or is a real file/directory, replace it. Returns true when the symlink
|
|
730
|
+
* was created or replaced, false when it was already correct.
|
|
731
|
+
*/
|
|
732
|
+
function ensureSymlink(
|
|
733
|
+
linkPath /*: string */,
|
|
734
|
+
target /*: string */,
|
|
735
|
+
) /*: boolean */ {
|
|
736
|
+
try {
|
|
737
|
+
const stat = fs.lstatSync(linkPath);
|
|
738
|
+
if (stat.isSymbolicLink() && fs.readlinkSync(linkPath) === target) {
|
|
739
|
+
return false;
|
|
740
|
+
}
|
|
741
|
+
if (stat.isSymbolicLink() || !stat.isDirectory()) {
|
|
742
|
+
fs.unlinkSync(linkPath);
|
|
743
|
+
} else {
|
|
744
|
+
fs.rmSync(linkPath, {recursive: true, force: true});
|
|
745
|
+
}
|
|
746
|
+
} catch {
|
|
747
|
+
// linkPath does not exist – fine
|
|
748
|
+
}
|
|
749
|
+
fs.symlinkSync(target, linkPath);
|
|
750
|
+
return true;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
// Default sources allowlist when no explicit glob is provided — analog of
|
|
754
|
+
// CocoaPods' `s.source_files` auto-discovery.
|
|
755
|
+
function collectSpmSources(sourcePath /*: string */) /*: Array<string> */ {
|
|
756
|
+
return walkSourceFiles(sourcePath)
|
|
757
|
+
.filter(p => ALL_SOURCE_EXTENSIONS.has(path.extname(p)))
|
|
758
|
+
.sort();
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
// Filters walkSourceFiles output through CocoaPods-style globs via micromatch.
|
|
762
|
+
// Skip-dir filtering applies before matching, so `**/*.{h,mm}` never returns
|
|
763
|
+
// paths under `tests/`, `android/`, etc. — even if the pattern would match.
|
|
764
|
+
function expandSpmSourceGlobs(
|
|
765
|
+
sourcePath /*: string */,
|
|
766
|
+
patterns /*: Array<string> */,
|
|
767
|
+
) /*: Array<string> */ {
|
|
768
|
+
if (patterns.length === 0) {
|
|
769
|
+
return [];
|
|
770
|
+
}
|
|
771
|
+
// $FlowFixMe[untyped-import] micromatch ships no types
|
|
772
|
+
const micromatch = require('micromatch');
|
|
773
|
+
return micromatch(walkSourceFiles(sourcePath), patterns).sort();
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* Converts an autolinking.json dependency to an SPM target spec.
|
|
778
|
+
* Returns null if the dependency doesn't have iOS support.
|
|
779
|
+
*
|
|
780
|
+
* `swiftNameByNpm` maps each autolinked dep's npm name to its resolved Swift
|
|
781
|
+
* name (populated by expandSpmDependencies, honoring the dep's `spm.name`
|
|
782
|
+
* config and scope disambiguation). Every name this function emits comes from
|
|
783
|
+
* there — see requireSwiftName.
|
|
784
|
+
*/
|
|
785
|
+
/**
|
|
786
|
+
* Read the dep's podspec (if any) and extract its declared
|
|
787
|
+
* `pod_target_xcconfig` HEADER_SEARCH_PATHS, substituted relative to the dep
|
|
788
|
+
* source dir. Returns paths suitable for an SPM `.headerSearchPath()`
|
|
789
|
+
* directive whose target.path is the dep root (entries are NOT yet prefixed
|
|
790
|
+
* with the synth wrapper's `root/` — the emission site adds that prefix
|
|
791
|
+
* because the wrapper's target.path is `.`, not the source dir).
|
|
792
|
+
*
|
|
793
|
+
* Without these, path-style angle includes like
|
|
794
|
+
* `<react/renderer/components/safeareacontext/X.h>` (used by
|
|
795
|
+
* react-native-safe-area-context, reanimated, screens, etc.) fail to resolve
|
|
796
|
+
* because the headers live under the dep's `common/cpp/` rather than under
|
|
797
|
+
* the framework-imported xcframework headers.
|
|
798
|
+
*/
|
|
799
|
+
function extractPodspecHeaderSearchPaths(
|
|
800
|
+
sourceDir /*: string */,
|
|
801
|
+
) /*: Array<string> */ {
|
|
802
|
+
let podspecPath /*: ?string */ = null;
|
|
803
|
+
try {
|
|
804
|
+
const entries = fs.readdirSync(sourceDir);
|
|
805
|
+
// Skip a crashed run's leftover `.spm-scaffold-<pid>-<name>.podspec` copy.
|
|
806
|
+
const candidate = entries.find(
|
|
807
|
+
e => e.endsWith('.podspec') && !e.startsWith('.spm-scaffold-'),
|
|
808
|
+
);
|
|
809
|
+
if (candidate != null) {
|
|
810
|
+
podspecPath = path.join(sourceDir, candidate);
|
|
811
|
+
}
|
|
812
|
+
} catch {
|
|
813
|
+
return [];
|
|
814
|
+
}
|
|
815
|
+
if (podspecPath == null) return [];
|
|
816
|
+
|
|
817
|
+
let model;
|
|
818
|
+
try {
|
|
819
|
+
model = readPodspec(podspecPath);
|
|
820
|
+
} catch {
|
|
821
|
+
return [];
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
const out /*: Array<string> */ = [];
|
|
825
|
+
for (const raw of model.headerSearchPaths) {
|
|
826
|
+
const substituted = raw
|
|
827
|
+
.replace(/\$\(PODS_TARGET_SRCROOT\)/g, '.')
|
|
828
|
+
.replace(/\$\{PODS_TARGET_SRCROOT\}/g, '.');
|
|
829
|
+
// Drop entries still containing unresolved Xcode tokens — emitting them
|
|
830
|
+
// verbatim would surface as clang "no such file" failures.
|
|
831
|
+
if (/\$[({]/.test(substituted)) continue;
|
|
832
|
+
const cleaned = substituted.replace(/^\.\//, '').replace(/^\//, '');
|
|
833
|
+
if (cleaned.length > 0 && !out.includes(cleaned)) {
|
|
834
|
+
out.push(cleaned);
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
return out;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
* The Swift name expandSpmDependencies resolved for `npmName`, or a hard error:
|
|
842
|
+
* re-deriving one here would emit a reference nothing in the graph matches.
|
|
843
|
+
*/
|
|
844
|
+
function requireSwiftName(
|
|
845
|
+
npmName /*: string */,
|
|
846
|
+
resolved /*: ?string */,
|
|
847
|
+
) /*: string */ {
|
|
848
|
+
if (resolved == null) {
|
|
849
|
+
throw new Error(
|
|
850
|
+
`react-native autolinking: no resolved Swift name for '${npmName}'. expandSpmDependencies must resolve every autolinked dep's name before SPM targets are generated.`,
|
|
851
|
+
);
|
|
852
|
+
}
|
|
853
|
+
return resolved;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
function autolinkingDepToSpmTarget(
|
|
857
|
+
depName /*: string */,
|
|
858
|
+
dep /*: AutolinkedDep */,
|
|
859
|
+
outputDir /*: string */,
|
|
860
|
+
swiftNameByNpm /*: Map<string, string> */,
|
|
861
|
+
) /*: SpmTarget | null */ {
|
|
862
|
+
const iosPlatform = dep.platforms.ios;
|
|
863
|
+
const sourceDir = iosPlatform.sourceDir ?? dep.root;
|
|
864
|
+
if (sourceDir == null) {
|
|
865
|
+
return null;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
// target.path is stored relative to the autolinker's outputDir so main()'s
|
|
869
|
+
// `path.resolve(outputDir, target.path)` recovers the absolute source dir —
|
|
870
|
+
// same convention the spmModule branch in main() follows.
|
|
871
|
+
const relSourcePath = path.relative(outputDir, sourceDir);
|
|
872
|
+
|
|
873
|
+
const targetName = requireSwiftName(depName, dep.swiftName);
|
|
874
|
+
|
|
875
|
+
// No exclude inference — main()'s emission loop emits `sources:` (an
|
|
876
|
+
// explicit allowlist). User-supplied excludes still work.
|
|
877
|
+
|
|
878
|
+
// Detect PrivacyInfo.xcprivacy
|
|
879
|
+
const privacyManifest = findPrivacyManifest(sourceDir);
|
|
880
|
+
const resources = privacyManifest != null ? [privacyManifest] : undefined;
|
|
881
|
+
|
|
882
|
+
// Map declared spm.dependencies (npm names) to Swift target names so the
|
|
883
|
+
// synth's .product(...) deps list reaches the consuming target.
|
|
884
|
+
const spmDeps /*: Array<string> */ = dep.spmDependencies ?? [];
|
|
885
|
+
const spmTargetDependencies =
|
|
886
|
+
spmDeps.length > 0
|
|
887
|
+
? spmDeps.map(n => requireSwiftName(n, swiftNameByNpm.get(n)))
|
|
888
|
+
: undefined;
|
|
889
|
+
|
|
890
|
+
const headerSearchPaths = extractPodspecHeaderSearchPaths(sourceDir);
|
|
891
|
+
|
|
892
|
+
return {
|
|
893
|
+
name: targetName,
|
|
894
|
+
path: relSourcePath,
|
|
895
|
+
exclude: [],
|
|
896
|
+
publicHeadersPath: inferPublicHeadersPath(sourceDir),
|
|
897
|
+
resources,
|
|
898
|
+
spmTargetDependencies,
|
|
899
|
+
headerSearchPaths:
|
|
900
|
+
headerSearchPaths.length > 0 ? headerSearchPaths : undefined,
|
|
901
|
+
};
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* Generates the full autolinked/Package.swift content.
|
|
906
|
+
*
|
|
907
|
+
* xcframeworksRelPath – path to the xcframeworks sub-package relative to the
|
|
908
|
+
* autolinked/ directory (e.g. "../build/xcframeworks"). When non-null a
|
|
909
|
+
* React dependency is declared. Headers need no search paths — React/react
|
|
910
|
+
* come from the ReactHeaders target, every other RN namespace from
|
|
911
|
+
* ReactNativeHeaders, folly/glog/boost from ReactNativeDependenciesHeaders,
|
|
912
|
+
* and the app's generated headers from the ReactAppHeaders product — so
|
|
913
|
+
* <React/...>, <ReactCommon/...>, <react/renderer/...>, folly/glog/boost,
|
|
914
|
+
* and <ReactCodegen/...> all resolve.
|
|
915
|
+
*/
|
|
916
|
+
/**
|
|
917
|
+
* Top-level autolinked/Package.swift — a thin aggregator that references each
|
|
918
|
+
* autolinked dep as its own sub-package (under packages/<SwiftName>) and
|
|
919
|
+
* re-exports them through a single AutolinkedAggregate target. Per-dep
|
|
920
|
+
* settings (header paths, cFlags, link order) live in each synth sub-package;
|
|
921
|
+
* see generateSynthPackageSwift below.
|
|
922
|
+
*
|
|
923
|
+
* input: { deps: Array<{swiftName: string}> }
|
|
924
|
+
*/
|
|
925
|
+
function generateAutolinkedPackageSwift(
|
|
926
|
+
input /*: AggregatorInput */,
|
|
927
|
+
) /*: string */ {
|
|
928
|
+
const npmDeps /*: ReadonlyArray<NpmDepRef> */ = input.npmDeps ?? [];
|
|
929
|
+
const inlineTargets /*: ReadonlyArray<SpmTarget> */ =
|
|
930
|
+
input.inlineTargets ?? [];
|
|
931
|
+
const hasReactDep /*: boolean */ = input.hasReactDep !== false;
|
|
932
|
+
// Relative path from autolinked/ to build/xcframeworks/, e.g. "../build/xcframeworks".
|
|
933
|
+
const xcframeworksRelPath /*: ?string */ = input.xcframeworksRelPath;
|
|
934
|
+
// Autolinking-plugin contributions (Expo & other frameworks).
|
|
935
|
+
const pluginPackageDeps /*: ReadonlyArray<PluginPackageDep> */ =
|
|
936
|
+
input.pluginPackageDeps ?? [];
|
|
937
|
+
const pluginProductDeps /*: ReadonlyArray<PluginProductDep> */ =
|
|
938
|
+
input.pluginProductDeps ?? [];
|
|
939
|
+
|
|
940
|
+
// Package-level dependencies: one .package(path:) per autolinked dep,
|
|
941
|
+
// plus ReactNative if any inline target needs to import React headers.
|
|
942
|
+
const packageDeps /*: Array<string> */ = npmDeps.map(d => {
|
|
943
|
+
const pkgPath = d.packagePath ?? `packages/${d.swiftName}`;
|
|
944
|
+
return `.package(name: "${d.swiftName}", path: "${pkgPath}")`;
|
|
945
|
+
});
|
|
946
|
+
// Framework plugin packages: local (path) or remote (url + exact version).
|
|
947
|
+
for (const p of pluginPackageDeps) {
|
|
948
|
+
packageDeps.push(
|
|
949
|
+
p.path != null
|
|
950
|
+
? `.package(name: "${p.name}", path: "${p.path}")`
|
|
951
|
+
: `.package(url: "${p.url ?? ''}", exact: "${p.version ?? ''}")`,
|
|
952
|
+
);
|
|
953
|
+
}
|
|
954
|
+
if (
|
|
955
|
+
inlineTargets.length > 0 &&
|
|
956
|
+
hasReactDep &&
|
|
957
|
+
typeof xcframeworksRelPath === 'string'
|
|
958
|
+
) {
|
|
959
|
+
packageDeps.push(
|
|
960
|
+
reactNativePackageDecl(
|
|
961
|
+
`.package(name: "${REACT_NATIVE_PACKAGE_NAME}", path: "${xcframeworksRelPath}")`,
|
|
962
|
+
),
|
|
963
|
+
);
|
|
964
|
+
// Per-app generated headers come from the ReactAppHeaders product in
|
|
965
|
+
// the codegen package (sibling of the autolinking dir).
|
|
966
|
+
packageDeps.push(
|
|
967
|
+
`.package(name: "${REACT_CODEGEN_PACKAGE_NAME}", path: "../ios")`,
|
|
968
|
+
);
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
// AutolinkedAggregate's target dependencies: .product(...) for npm sub-package
|
|
972
|
+
// products and .target(...) for inline spmModule targets in the same package.
|
|
973
|
+
const aggregateDeps /*: Array<string> */ = [
|
|
974
|
+
...npmDeps.map(
|
|
975
|
+
d => `.product(name: "${d.swiftName}", package: "${d.swiftName}")`,
|
|
976
|
+
),
|
|
977
|
+
...inlineTargets.map(t => `.target(name: "${t.name}")`),
|
|
978
|
+
...pluginProductDeps.map(
|
|
979
|
+
p => `.product(name: "${p.name}", package: "${p.package}")`,
|
|
980
|
+
),
|
|
981
|
+
];
|
|
982
|
+
|
|
983
|
+
const inlineDecls = inlineTargets.map(t => {
|
|
984
|
+
const excludeLine =
|
|
985
|
+
t.exclude && t.exclude.length > 0
|
|
986
|
+
? `\n exclude: [${t.exclude.map(e => `"${e}"`).join(', ')}],`
|
|
987
|
+
: '';
|
|
988
|
+
const publicHeadersLine =
|
|
989
|
+
t.publicHeadersPath != null
|
|
990
|
+
? `\n publicHeadersPath: "${t.publicHeadersPath}",`
|
|
991
|
+
: '';
|
|
992
|
+
const resourcesLine =
|
|
993
|
+
t.resources && t.resources.length > 0
|
|
994
|
+
? `\n resources: [${t.resources.map(r => `.copy("${r}")`).join(', ')}],`
|
|
995
|
+
: '';
|
|
996
|
+
return ` .target(
|
|
997
|
+
name: "${t.name}",
|
|
998
|
+
dependencies: [${reactProductDeps()}],
|
|
999
|
+
path: "${t.path}",${excludeLine}${publicHeadersLine}${resourcesLine}
|
|
1000
|
+
cxxSettings: [${REACT_CXX_CONFIG_DEFINES.join(', ')}],
|
|
1001
|
+
linkerSettings: [.linkedFramework("UIKit"), .linkedFramework("Foundation"), .linkedFramework("CoreGraphics")]
|
|
1002
|
+
)`;
|
|
1003
|
+
});
|
|
1004
|
+
|
|
1005
|
+
const packageDepsBlock =
|
|
1006
|
+
packageDeps.length > 0
|
|
1007
|
+
? ` dependencies: [\n ${packageDeps.join(',\n ')},\n ],\n`
|
|
1008
|
+
: '';
|
|
1009
|
+
const aggregateDepsLine =
|
|
1010
|
+
aggregateDeps.length > 0
|
|
1011
|
+
? `\n dependencies: [${aggregateDeps.join(', ')}],`
|
|
1012
|
+
: '';
|
|
1013
|
+
|
|
1014
|
+
const inlineDeclsBlock =
|
|
1015
|
+
inlineDecls.length > 0 ? `,\n${inlineDecls.join(',\n')}` : '';
|
|
1016
|
+
|
|
1017
|
+
// Eval-time missing-manifest guard. SwiftPM resolves the package graph BEFORE
|
|
1018
|
+
// the Xcode "Sync SPM Autolinking" build phase runs, so a community library
|
|
1019
|
+
// whose Package.swift is absent at resolution time (e.g. a scaffolded manifest
|
|
1020
|
+
// wiped by a node_modules reset without a committed patch) fails resolution
|
|
1021
|
+
// with an opaque "package manifest cannot be accessed" error — and the
|
|
1022
|
+
// actionable sync-phase message never prints. Manifest evaluation may READ the
|
|
1023
|
+
// filesystem (only writes are sandboxed), so the aggregator checks each
|
|
1024
|
+
// referenced library here and explains the cause + fix at resolution time.
|
|
1025
|
+
const guardEntries = npmDeps.map(d => {
|
|
1026
|
+
const pkgPath = d.packagePath ?? `packages/${d.swiftName}`;
|
|
1027
|
+
return ` (path: "${pkgPath}", npm: "${d.npmName ?? d.swiftName}")`;
|
|
1028
|
+
});
|
|
1029
|
+
const guardBlock =
|
|
1030
|
+
guardEntries.length > 0
|
|
1031
|
+
? `// Eval-time guard: surface a wiped/absent library Package.swift here (at
|
|
1032
|
+
// resolution) instead of the opaque SwiftPM "manifest cannot be accessed".
|
|
1033
|
+
let __rnAutolinkedLibs: [(path: String, npm: String)] = [
|
|
1034
|
+
${guardEntries.join(',\n')},
|
|
1035
|
+
]
|
|
1036
|
+
do {
|
|
1037
|
+
let __here = URL(fileURLWithPath: #filePath).deletingLastPathComponent()
|
|
1038
|
+
let __missing = __rnAutolinkedLibs.filter {
|
|
1039
|
+
!FileManager.default.fileExists(
|
|
1040
|
+
atPath: __here.appendingPathComponent($0.path)
|
|
1041
|
+
.appendingPathComponent("Package.swift").path)
|
|
1042
|
+
}
|
|
1043
|
+
if !__missing.isEmpty {
|
|
1044
|
+
var __msg = ""
|
|
1045
|
+
for lib in __missing {
|
|
1046
|
+
__msg += "error: Package.swift is missing for library \\"\\(lib.npm)\\" — its Swift Package Manager manifest is not present (a scaffolded manifest wiped by a node_modules reset without a committed patch, or the library ships none).\\n"
|
|
1047
|
+
__msg += " 1. Run \`npx react-native spm scaffold\` to (re)generate it.\\n"
|
|
1048
|
+
__msg += " 2. Persist it with \`npx patch-package \\(lib.npm)\` and commit the patch (node_modules is not committed).\\n"
|
|
1049
|
+
__msg += " 3. Ask \\(lib.npm)'s maintainer to ship a Package.swift upstream.\\n"
|
|
1050
|
+
__msg += " 4. Without a committed patch, this error returns on every fresh install / CI.\\n"
|
|
1051
|
+
}
|
|
1052
|
+
FileHandle.standardError.write(Data(__msg.utf8))
|
|
1053
|
+
fatalError("Missing Package.swift for: \\(__missing.map { $0.npm }.joined(separator: ", ")). See the message above.")
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
`
|
|
1058
|
+
: '';
|
|
1059
|
+
|
|
1060
|
+
return `// swift-tools-version: 6.0
|
|
1061
|
+
// AUTO-GENERATED by scripts/generate-spm-autolinking.js – do not edit manually.
|
|
1062
|
+
// Top-level Autolinked package. Every autolinked dep (npm or spmModule) is
|
|
1063
|
+
// referenced as .package(path: <dep-source-dir>) — each has its own synth
|
|
1064
|
+
// Package.swift written in-place. AutolinkedAggregate depends on every dep's
|
|
1065
|
+
// product so the app build pulls them all in.
|
|
1066
|
+
|
|
1067
|
+
import PackageDescription
|
|
1068
|
+
import Foundation
|
|
1069
|
+
|
|
1070
|
+
${guardBlock}let package = Package(
|
|
1071
|
+
name: "${AUTOLINKED_PACKAGE_NAME}",
|
|
1072
|
+
platforms: [.iOS(.v15)],
|
|
1073
|
+
products: [
|
|
1074
|
+
.library(name: "${AUTOLINKED_PACKAGE_NAME}", targets: ["AutolinkedAggregate"]),
|
|
1075
|
+
],
|
|
1076
|
+
${packageDepsBlock} targets: [
|
|
1077
|
+
.target(
|
|
1078
|
+
name: "AutolinkedAggregate",${aggregateDepsLine}
|
|
1079
|
+
path: "AutolinkedAggregate"
|
|
1080
|
+
)${inlineDeclsBlock}
|
|
1081
|
+
],
|
|
1082
|
+
cxxLanguageStandard: .cxx20
|
|
1083
|
+
)
|
|
1084
|
+
`;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
/**
|
|
1088
|
+
* Per-dep synthesized Package.swift, written at
|
|
1089
|
+
* <outputDir>/packages/<SwiftName>/Package.swift. `targetPath` points at a
|
|
1090
|
+
* `root` directory symlink to the real source dir, so source files stay real
|
|
1091
|
+
* (Xcode atomic-save works).
|
|
1092
|
+
*
|
|
1093
|
+
* The React + codegen package references are plain relative paths supplied by
|
|
1094
|
+
* the caller (`reactNativePackagePath` / `codegenPackagePath`), computed from
|
|
1095
|
+
* the synth's fixed location under the autolinking dir — the manifest holds no
|
|
1096
|
+
* runtime discovery and no absolute paths. Headers are served by the
|
|
1097
|
+
* ReactHeaders/ReactNativeHeaders/ReactNativeDependenciesHeaders targets and
|
|
1098
|
+
* the ReactAppHeaders product, so no
|
|
1099
|
+
* search-path flags are needed. Siblings use their absolute synth path from
|
|
1100
|
+
* `siblingSynthAbsolutePaths` (production) or a `siblingPackageBaseRelative`
|
|
1101
|
+
* fallback (tests).
|
|
1102
|
+
*/
|
|
1103
|
+
function generateSynthPackageSwift(spec /*: SynthPackageSpec */) /*: string */ {
|
|
1104
|
+
const swiftName /*: string */ = spec.swiftName;
|
|
1105
|
+
const exclude /*: Array<string> */ = spec.exclude ?? [];
|
|
1106
|
+
const sources /*: ?Array<string> */ = spec.sources;
|
|
1107
|
+
const publicHeadersPath /*: ?string */ = spec.publicHeadersPath ?? null;
|
|
1108
|
+
// Per-dep header search paths from the podspec's
|
|
1109
|
+
// pod_target_xcconfig HEADER_SEARCH_PATHS — already prefixed by the caller
|
|
1110
|
+
// with the synth wrapper's `root/` so they resolve relative to target.path.
|
|
1111
|
+
// Emitted as `.headerSearchPath()` directives, which SPM accepts on
|
|
1112
|
+
// cSettings / cxxSettings without needing absolute paths.
|
|
1113
|
+
const headerSearchPaths /*: Array<string> */ = spec.headerSearchPaths ?? [];
|
|
1114
|
+
const spmDependencies /*: Array<{swiftName: string}> */ =
|
|
1115
|
+
spec.spmDependencies ?? [];
|
|
1116
|
+
const hasReactDep /*: boolean */ = spec.hasReactDep !== false;
|
|
1117
|
+
const resources /*: ?Array<string> */ = spec.resources;
|
|
1118
|
+
const isDynamic /*: boolean */ = spec.isDynamic !== false;
|
|
1119
|
+
const targetPath /*: string */ = spec.targetPath ?? `Sources/${swiftName}`;
|
|
1120
|
+
const siblingSynthAbsolutePaths /*: {[string]: string} */ =
|
|
1121
|
+
spec.siblingSynthAbsolutePaths ?? {};
|
|
1122
|
+
|
|
1123
|
+
// Package dependencies — ReactNative + each spm sibling synth package.
|
|
1124
|
+
// The React + codegen package paths are plain relative strings computed by
|
|
1125
|
+
// the caller at generation time (the synth always lives at a fixed depth
|
|
1126
|
+
// under the autolinking dir, and is regenerated on every `react-native
|
|
1127
|
+
// spm` run), so the manifest holds no runtime discovery. Siblings use their
|
|
1128
|
+
// absolute synth path when the caller provides one (production); else a
|
|
1129
|
+
// relative fallback.
|
|
1130
|
+
const packageDeps /*: Array<string> */ = [];
|
|
1131
|
+
if (hasReactDep) {
|
|
1132
|
+
const reactNativePackagePath /*: string */ =
|
|
1133
|
+
spec.reactNativePackagePath ?? '../../../../xcframeworks';
|
|
1134
|
+
const codegenPackagePath /*: string */ =
|
|
1135
|
+
spec.codegenPackagePath ?? '../../../ios';
|
|
1136
|
+
packageDeps.push(
|
|
1137
|
+
reactNativePackageDecl(
|
|
1138
|
+
`.package(name: "${REACT_NATIVE_PACKAGE_NAME}", path: "${reactNativePackagePath}")`,
|
|
1139
|
+
),
|
|
1140
|
+
);
|
|
1141
|
+
// Per-app generated headers come from the ReactAppHeaders product in
|
|
1142
|
+
// the codegen package.
|
|
1143
|
+
packageDeps.push(
|
|
1144
|
+
`.package(name: "${REACT_CODEGEN_PACKAGE_NAME}", path: "${codegenPackagePath}")`,
|
|
1145
|
+
);
|
|
1146
|
+
}
|
|
1147
|
+
for (const dep of spmDependencies) {
|
|
1148
|
+
const absPath = siblingSynthAbsolutePaths[dep.swiftName];
|
|
1149
|
+
if (absPath != null) {
|
|
1150
|
+
packageDeps.push(
|
|
1151
|
+
`.package(name: "${dep.swiftName}", path: "${absPath}")`,
|
|
1152
|
+
);
|
|
1153
|
+
} else {
|
|
1154
|
+
const siblingRel /*: string */ = spec.siblingPackageBaseRelative ?? '..';
|
|
1155
|
+
packageDeps.push(
|
|
1156
|
+
`.package(name: "${dep.swiftName}", path: "${siblingRel}/${dep.swiftName}")`,
|
|
1157
|
+
);
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
// Target dependencies — products from each declared package dep.
|
|
1162
|
+
const targetDeps /*: Array<string> */ = [];
|
|
1163
|
+
if (hasReactDep) {
|
|
1164
|
+
targetDeps.push(reactProductDeps());
|
|
1165
|
+
}
|
|
1166
|
+
for (const dep of spmDependencies) {
|
|
1167
|
+
targetDeps.push(
|
|
1168
|
+
`.product(name: "${dep.swiftName}", package: "${dep.swiftName}")`,
|
|
1169
|
+
);
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
const excludeLine =
|
|
1173
|
+
exclude.length > 0
|
|
1174
|
+
? `\n exclude: [${exclude.map(e => `"${e}"`).join(', ')}],`
|
|
1175
|
+
: '';
|
|
1176
|
+
// sources: explicit allowlist. One file per line because lists can run to
|
|
1177
|
+
// dozens of entries and an unbroken array becomes unreadable in diffs.
|
|
1178
|
+
const sourcesLine =
|
|
1179
|
+
sources != null && sources.length > 0
|
|
1180
|
+
? `\n sources: [\n${sources.map(s => ` "${s}",`).join('\n')}\n ],`
|
|
1181
|
+
: '';
|
|
1182
|
+
const publicHeadersLine =
|
|
1183
|
+
publicHeadersPath != null
|
|
1184
|
+
? `\n publicHeadersPath: "${publicHeadersPath}",`
|
|
1185
|
+
: '';
|
|
1186
|
+
const resourcesLine =
|
|
1187
|
+
resources != null && resources.length > 0
|
|
1188
|
+
? `\n resources: [${resources.map(r => `.copy("${r}")`).join(', ')}],`
|
|
1189
|
+
: '';
|
|
1190
|
+
|
|
1191
|
+
const packageDepsBlock =
|
|
1192
|
+
packageDeps.length > 0
|
|
1193
|
+
? ` dependencies: [\n ${packageDeps.join(',\n ')},\n ],\n`
|
|
1194
|
+
: '';
|
|
1195
|
+
// `.headerSearchPath(...)` entries from the podspec — first-class
|
|
1196
|
+
// directives keep SPM's diagnostics meaningful (clang reports the
|
|
1197
|
+
// dep-relative path on miss). React headers need no paths at all.
|
|
1198
|
+
const headerSearchPathList = headerSearchPaths.map(
|
|
1199
|
+
p => `.headerSearchPath("${p}")`,
|
|
1200
|
+
);
|
|
1201
|
+
const cSettingsLine =
|
|
1202
|
+
headerSearchPathList.length > 0
|
|
1203
|
+
? `\n cSettings: [${headerSearchPathList.join(', ')}],`
|
|
1204
|
+
: '';
|
|
1205
|
+
// ALWAYS emit the config-gated C++ defines (even with no header paths): a
|
|
1206
|
+
// Fabric C++ target must compile with the same NDEBUG state as the prebuilt
|
|
1207
|
+
// React.framework, else DebugStringConvertible's vtable / ShadowNode layout
|
|
1208
|
+
// diverges and a Release build fails to link. Mirrors Package.swift.
|
|
1209
|
+
const cxxEntries = [...REACT_CXX_CONFIG_DEFINES, ...headerSearchPathList];
|
|
1210
|
+
const cxxSettingsLine = `\n cxxSettings: [${cxxEntries.join(', ')}],`;
|
|
1211
|
+
|
|
1212
|
+
return `// swift-tools-version: 6.0
|
|
1213
|
+
// AUTO-GENERATED by scripts/generate-spm-autolinking.js – do not edit manually.
|
|
1214
|
+
// Synth Package.swift for autolinked dep "${swiftName}".
|
|
1215
|
+
|
|
1216
|
+
import PackageDescription
|
|
1217
|
+
|
|
1218
|
+
let package = Package(
|
|
1219
|
+
name: "${swiftName}",
|
|
1220
|
+
platforms: [.iOS(.v15)],
|
|
1221
|
+
products: [
|
|
1222
|
+
.library(name: "${swiftName}"${isDynamic ? ', type: .dynamic' : ''}, targets: ["${swiftName}"]),
|
|
1223
|
+
],
|
|
1224
|
+
${packageDepsBlock} targets: [
|
|
1225
|
+
.target(
|
|
1226
|
+
name: "${swiftName}",
|
|
1227
|
+
dependencies: [${targetDeps.join(', ')}],
|
|
1228
|
+
path: "${targetPath}",${excludeLine}${sourcesLine}${publicHeadersLine}${resourcesLine}${cSettingsLine}${cxxSettingsLine}
|
|
1229
|
+
linkerSettings: [.linkedFramework("UIKit"), .linkedFramework("Foundation"), .linkedFramework("CoreGraphics")]
|
|
1230
|
+
),
|
|
1231
|
+
],
|
|
1232
|
+
cxxLanguageStandard: .cxx20
|
|
1233
|
+
)
|
|
1234
|
+
`;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
function main(argv /*:: ?: Array<string> */) /*: void */ {
|
|
1238
|
+
const args = parseArgs(argv ?? process.argv.slice(2));
|
|
1239
|
+
// Resolve to absolute so path.join() produces absolute paths everywhere —
|
|
1240
|
+
// entryAbsDirs, the headers farm, etc. all assume an absolute appRoot.
|
|
1241
|
+
const appRoot = path.resolve(args.appRoot);
|
|
1242
|
+
remoteCfg = remotePackageConfig(appRoot);
|
|
1243
|
+
if (remoteCfg != null) {
|
|
1244
|
+
log(`Remote ReactNative package: ${remoteCfg.url} @ ${remoteCfg.version}`);
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
let rnRoot = args.reactNativeRoot;
|
|
1248
|
+
if (rnRoot == null) {
|
|
1249
|
+
rnRoot = path.join(appRoot, 'node_modules', 'react-native');
|
|
1250
|
+
if (!fs.existsSync(rnRoot)) {
|
|
1251
|
+
// Monorepo: try walking up
|
|
1252
|
+
let dir = appRoot;
|
|
1253
|
+
for (let i = 0; i < 5; i++) {
|
|
1254
|
+
const parent = path.dirname(dir);
|
|
1255
|
+
if (parent === dir) break;
|
|
1256
|
+
dir = parent;
|
|
1257
|
+
const c = path.join(dir, 'node_modules', 'react-native');
|
|
1258
|
+
if (fs.existsSync(c)) {
|
|
1259
|
+
rnRoot = c;
|
|
1260
|
+
break;
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
if (rnRoot == null || !fs.existsSync(rnRoot)) {
|
|
1265
|
+
console.error(
|
|
1266
|
+
'[generate-spm-autolinking] Could not find react-native. Pass --react-native-root.',
|
|
1267
|
+
);
|
|
1268
|
+
process.exitCode = 1;
|
|
1269
|
+
return;
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
const autolinkingJsonPath =
|
|
1274
|
+
args.autolinkingJson ??
|
|
1275
|
+
path.join(appRoot, 'build', 'generated', 'autolinking', 'autolinking.json');
|
|
1276
|
+
|
|
1277
|
+
// Output lands under <appRoot>/build/generated/autolinking/ — co-located
|
|
1278
|
+
// with autolinking.json (written by generate-spm-autolinking-config.js) and
|
|
1279
|
+
// alongside the iOS-conventional build/ tree (Pods/, build/xcframeworks/…).
|
|
1280
|
+
const outputDir =
|
|
1281
|
+
args.output != null
|
|
1282
|
+
? path.resolve(appRoot, args.output)
|
|
1283
|
+
: path.join(appRoot, 'build', 'generated', 'autolinking');
|
|
1284
|
+
|
|
1285
|
+
// Collect all targets along with their routing metadata.
|
|
1286
|
+
const entries /*: Array<TargetEntry> */ = [];
|
|
1287
|
+
// Autolinking plugins discovered from deps' react-native.config.js
|
|
1288
|
+
// (populated during the dep walk below; invoked before the aggregator write).
|
|
1289
|
+
let discoveredPlugins /*: Array<DiscoveredPlugin> */ = [];
|
|
1290
|
+
|
|
1291
|
+
// 1. From autolinking.json (npm packages with iOS native modules), expanded
|
|
1292
|
+
// with transitive deps declared via `spm.dependencies` in each package's
|
|
1293
|
+
// react-native.config.js (analog of podspec `s.dependency`).
|
|
1294
|
+
const autolinkingData = readAutolinkingJson(autolinkingJsonPath);
|
|
1295
|
+
const depsMap = autolinkingData?.dependencies;
|
|
1296
|
+
if (depsMap != null) {
|
|
1297
|
+
// Narrow each on-disk AutolinkingDepJson into the validated AutolinkedDep
|
|
1298
|
+
// shape expected by expandSpmDependencies and autolinkingDepToSpmTarget.
|
|
1299
|
+
const directDeps /*: Array<AutolinkedDep> */ = [];
|
|
1300
|
+
for (const name of Object.keys(depsMap)) {
|
|
1301
|
+
const dep = depsMap[name];
|
|
1302
|
+
if (dep == null) continue;
|
|
1303
|
+
const iosPlatform = dep.platforms?.ios;
|
|
1304
|
+
const root = dep.root;
|
|
1305
|
+
if (iosPlatform == null || root == null) continue;
|
|
1306
|
+
directDeps.push({
|
|
1307
|
+
name,
|
|
1308
|
+
root,
|
|
1309
|
+
platforms: {ios: iosPlatform},
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
const allDeps = expandSpmDependencies(directDeps, {
|
|
1313
|
+
readConfig: defaultReadConfig,
|
|
1314
|
+
resolveDep: defaultResolveDep,
|
|
1315
|
+
extraReservedNames: reservedNamesForRun(),
|
|
1316
|
+
log,
|
|
1317
|
+
});
|
|
1318
|
+
|
|
1319
|
+
// Map every autolinked npm name to its resolved Swift name so transitive
|
|
1320
|
+
// references inside autolinkingDepToSpmTarget find the right target
|
|
1321
|
+
// identifier.
|
|
1322
|
+
const swiftNameByNpm /*: Map<string, string> */ = new Map();
|
|
1323
|
+
for (const dep of allDeps) {
|
|
1324
|
+
if (dep.swiftName != null) {
|
|
1325
|
+
swiftNameByNpm.set(dep.name, dep.swiftName);
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
// Discover framework autolinking plugins (Expo & others) from the same
|
|
1330
|
+
// dep set — invoked before the aggregator is written (below).
|
|
1331
|
+
discoveredPlugins = discoverPlugins(
|
|
1332
|
+
allDeps,
|
|
1333
|
+
defaultReadConfig,
|
|
1334
|
+
readDenyPluginsFromConfig(appRoot),
|
|
1335
|
+
);
|
|
1336
|
+
for (const p of discoveredPlugins) {
|
|
1337
|
+
log(`Found SPM autolinking plugin: ${p.depName}`);
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
// A dep that declares an autolinking plugin OWNS its native contribution:
|
|
1341
|
+
// the plugin (invoked below) returns its package/product/generated-source
|
|
1342
|
+
// deps. RN must not also try to source-build that package through the
|
|
1343
|
+
// community-lib path — it typically has no Package.swift and may be mixed
|
|
1344
|
+
// Swift/ObjC (e.g. expo → ExpoModulesCore), which would throw before the
|
|
1345
|
+
// plugin ever runs. Mirrors CocoaPods: `use_expo_modules!` owns Expo's
|
|
1346
|
+
// pods; podspec autolinking doesn't also build Expo as a community lib.
|
|
1347
|
+
// Skipping here also keeps the dep out of `entries` → out of the
|
|
1348
|
+
// missing-manifest scan and the aggregator's package refs.
|
|
1349
|
+
const pluginHostDeps /*: Set<string> */ = new Set(
|
|
1350
|
+
discoveredPlugins.map(p => p.depName),
|
|
1351
|
+
);
|
|
1352
|
+
|
|
1353
|
+
// Skipped means no sibling package is created for the host either, so a
|
|
1354
|
+
// dep declaring it in `spm.dependencies` gets a package reference to a
|
|
1355
|
+
// path this run never writes — SPM then reports only the missing path.
|
|
1356
|
+
// Only manifests React Native emits can carry that reference: a dep
|
|
1357
|
+
// shipping its own Package.swift declares its package references itself,
|
|
1358
|
+
// and the classification loop below would treat it as self-managed.
|
|
1359
|
+
const pluginHostDependents /*: Map<string, Array<string>> */ = new Map();
|
|
1360
|
+
for (const dep of allDeps) {
|
|
1361
|
+
const declaredHosts = (dep.spmDependencies ?? []).filter(name =>
|
|
1362
|
+
pluginHostDeps.has(name),
|
|
1363
|
+
);
|
|
1364
|
+
if (declaredHosts.length === 0) {
|
|
1365
|
+
continue;
|
|
1366
|
+
}
|
|
1367
|
+
const sourceDir = dep.platforms.ios.sourceDir ?? dep.root;
|
|
1368
|
+
if (sourceDir == null || findSelfManagedPackageDir(sourceDir) != null) {
|
|
1369
|
+
continue;
|
|
1370
|
+
}
|
|
1371
|
+
for (const host of declaredHosts) {
|
|
1372
|
+
const dependents = pluginHostDependents.get(host) ?? [];
|
|
1373
|
+
dependents.push(dep.name);
|
|
1374
|
+
pluginHostDependents.set(host, dependents);
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
for (const dep of allDeps) {
|
|
1379
|
+
if (pluginHostDeps.has(dep.name)) {
|
|
1380
|
+
const dependents = pluginHostDependents.get(dep.name);
|
|
1381
|
+
if (dependents != null) {
|
|
1382
|
+
throw new Error(
|
|
1383
|
+
`react-native autolinking: '${dep.name}' ships an SPM autolinking plugin, which owns its native contribution — so React Native does not build it as a sibling target for anything to depend on. It is declared in 'spm.dependencies' by ${dependents.map(name => `'${name}'`).join(', ')}. Remove it there; nothing is lost. Its plugin links its products into the app and resolves its own ecosystem's dependencies, so a library that builds against it does not declare it here.`,
|
|
1384
|
+
);
|
|
1385
|
+
}
|
|
1386
|
+
log(
|
|
1387
|
+
`Skipping ${dep.name} target generation — provided by its SPM autolinking plugin`,
|
|
1388
|
+
);
|
|
1389
|
+
continue;
|
|
1390
|
+
}
|
|
1391
|
+
const target = autolinkingDepToSpmTarget(
|
|
1392
|
+
dep.name,
|
|
1393
|
+
dep,
|
|
1394
|
+
outputDir,
|
|
1395
|
+
swiftNameByNpm,
|
|
1396
|
+
);
|
|
1397
|
+
if (target != null) {
|
|
1398
|
+
entries.push({
|
|
1399
|
+
target,
|
|
1400
|
+
origin: 'npm',
|
|
1401
|
+
npmName: dep.name,
|
|
1402
|
+
root: dep.root,
|
|
1403
|
+
});
|
|
1404
|
+
log(`Found npm native module: ${target.name} → ${target.path}`);
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
} else {
|
|
1408
|
+
log(
|
|
1409
|
+
`No autolinking.json found at ${path.relative(appRoot, autolinkingJsonPath)} or no dependencies. Using only built-in modules.`,
|
|
1410
|
+
);
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
// 2. From react-native.config.js spm.modules (user-defined extra modules).
|
|
1414
|
+
// If the module declares `sources: [glob, ...]` (CocoaPods-style), expand
|
|
1415
|
+
// the globs now relative to its dir and attach the file list to the target
|
|
1416
|
+
// so the emission loop below renders `sources: [...]` literally.
|
|
1417
|
+
const configModules = readSpmModulesFromConfig(appRoot);
|
|
1418
|
+
// Module names land in the manifest exactly as written, so they get the same
|
|
1419
|
+
// checks a dep's Swift name gets. Seeded with the dep target names already
|
|
1420
|
+
// emitted so a module can't shadow an autolinked library either.
|
|
1421
|
+
const takenSwiftNames /*: Map<string, string> */ = new Map(
|
|
1422
|
+
entries.map(entry => [entry.target.name.toLowerCase(), entry.target.name]),
|
|
1423
|
+
);
|
|
1424
|
+
for (const mod of configModules) {
|
|
1425
|
+
assertSpmModuleName(mod.name, takenSwiftNames);
|
|
1426
|
+
takenSwiftNames.set(mod.name.toLowerCase(), mod.name);
|
|
1427
|
+
const absPath = path.resolve(appRoot, mod.path);
|
|
1428
|
+
const relPath = path.relative(outputDir, absPath);
|
|
1429
|
+
const userSources =
|
|
1430
|
+
Array.isArray(mod.sources) && mod.sources.length > 0
|
|
1431
|
+
? expandSpmSourceGlobs(absPath, mod.sources)
|
|
1432
|
+
: null;
|
|
1433
|
+
entries.push({
|
|
1434
|
+
target: {
|
|
1435
|
+
name: mod.name,
|
|
1436
|
+
path: relPath,
|
|
1437
|
+
exclude: mod.exclude ?? [],
|
|
1438
|
+
// The synth wrapper owns the module's public interface: it declares
|
|
1439
|
+
// publicHeadersPath: "include", a symlink to the module's header tree.
|
|
1440
|
+
publicHeadersPath: null,
|
|
1441
|
+
sources: userSources,
|
|
1442
|
+
},
|
|
1443
|
+
origin: 'spmModule',
|
|
1444
|
+
});
|
|
1445
|
+
log(`Config module: ${mod.name} → ${relPath}`);
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
// Resolve xcframeworks package path relative to outputDir (autolinked/).
|
|
1449
|
+
// When provided this causes each target to declare a React dependency so
|
|
1450
|
+
// Xcode adds the xcframework's header search paths (needed for <React/...>).
|
|
1451
|
+
// Always set xcframeworksRelPath to the default even if the directory doesn't
|
|
1452
|
+
// exist yet — on first run, step 2 (autolinking) runs before step 4
|
|
1453
|
+
// (xcframework symlinks), but the generated Swift code resolves paths at
|
|
1454
|
+
// Xcode build time, not generation time.
|
|
1455
|
+
let xcframeworksRelPath /*: string | null */ = null;
|
|
1456
|
+
const absXcframeworks /*: string */ =
|
|
1457
|
+
args.xcframeworksPath != null
|
|
1458
|
+
? path.resolve(appRoot, args.xcframeworksPath)
|
|
1459
|
+
: path.join(appRoot, 'build', 'xcframeworks');
|
|
1460
|
+
xcframeworksRelPath = path.relative(outputDir, absXcframeworks);
|
|
1461
|
+
|
|
1462
|
+
if (xcframeworksRelPath != null) {
|
|
1463
|
+
log(
|
|
1464
|
+
`React xcframeworks → ${xcframeworksRelPath} (relative to autolinked/)`,
|
|
1465
|
+
);
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
// Whether autolinked targets declare a React dependency at all. Headers are
|
|
1469
|
+
// served by the ReactHeaders/ReactNativeHeaders/ReactNativeDependenciesHeaders
|
|
1470
|
+
// binaryTargets and the ReactAppHeaders product — no `-I` flags anywhere.
|
|
1471
|
+
const hasReactDep = xcframeworksRelPath != null;
|
|
1472
|
+
|
|
1473
|
+
// Each entry gets a wrapper dir at <outputDir>/packages/<SwiftName>/ that
|
|
1474
|
+
// contains the synth Package.swift and a `root` directory symlink pointing
|
|
1475
|
+
// at the dep's real source dir. SPM derives package identity from the path
|
|
1476
|
+
// basename, so the wrapper's unique name (SwiftName) sidesteps the basename
|
|
1477
|
+
// collision that in-place at the source dir would have. Files inside the
|
|
1478
|
+
// source dir stay real, so Xcode's atomic-save works through the dir
|
|
1479
|
+
// symlink (intermediate path components — even symlinks — resolve cleanly;
|
|
1480
|
+
// the issue was only file-symlinks as the final path component).
|
|
1481
|
+
const entryAbsDirs /*: Map<string, string> */ = new Map();
|
|
1482
|
+
for (const entry of entries) {
|
|
1483
|
+
entryAbsDirs.set(
|
|
1484
|
+
entry.target.name,
|
|
1485
|
+
path.resolve(outputDir, entry.target.path),
|
|
1486
|
+
);
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
const packagesDir = path.join(outputDir, 'packages');
|
|
1490
|
+
const headersDir = path.join(outputDir, 'headers');
|
|
1491
|
+
// libs/<SwiftName>/ symlinks for self-managed deps. The symlink basename
|
|
1492
|
+
// is the Swift module name (guaranteed unique per dep), so SPM's
|
|
1493
|
+
// path-basename-based package identity never collides — even when two
|
|
1494
|
+
// libs ship their own Package.swift inside `ios/` (a common convention).
|
|
1495
|
+
// Wiped on every run; populated below as self-managed deps are visited.
|
|
1496
|
+
const libsDir = path.join(outputDir, 'libs');
|
|
1497
|
+
fs.mkdirSync(packagesDir, {recursive: true});
|
|
1498
|
+
fs.mkdirSync(headersDir, {recursive: true});
|
|
1499
|
+
fs.rmSync(libsDir, {recursive: true, force: true});
|
|
1500
|
+
fs.mkdirSync(libsDir, {recursive: true});
|
|
1501
|
+
|
|
1502
|
+
const wrapperDirs /*: Map<string, string> */ = new Map();
|
|
1503
|
+
const selfManagedDirs /*: Map<string, string> */ = new Map();
|
|
1504
|
+
const aggregatorPackageDeps /*: Array<NpmDepRef> */ = [];
|
|
1505
|
+
// Community npm deps that autolink but ship/scaffold no Package.swift. We no
|
|
1506
|
+
// longer silently synthesize one for them (that duplicated the scaffolder and
|
|
1507
|
+
// hid the gap from the developer and the library author) — collect them and
|
|
1508
|
+
// fail with an actionable message after the classification pass. spmModules
|
|
1509
|
+
// (app-local, explicitly declared in react-native.config.js) keep their synth
|
|
1510
|
+
// wrappers: an app-local dir has no npm identity, so there is no package for
|
|
1511
|
+
// the aggregator to reference until one is written for it.
|
|
1512
|
+
const missingManifests /*: Array<{name: string, npmName: string, hasPodspec: boolean, mixed?: boolean}> */ =
|
|
1513
|
+
[];
|
|
1514
|
+
|
|
1515
|
+
for (const entry of entries) {
|
|
1516
|
+
const {target} = entry;
|
|
1517
|
+
const absSource /*: string */ = entryAbsDirs.get(target.name) ?? '';
|
|
1518
|
+
if (!fs.existsSync(absSource)) {
|
|
1519
|
+
log(`Skipping ${target.name}: source dir missing (${absSource})`);
|
|
1520
|
+
continue;
|
|
1521
|
+
}
|
|
1522
|
+
const selfManagedDir = findSelfManagedPackageDir(absSource);
|
|
1523
|
+
if (selfManagedDir != null) {
|
|
1524
|
+
// Record the manifest's actual directory — for the nested layout this
|
|
1525
|
+
// is <dep>/ios, not <dep>. SPM resolves `.package(path:)` against that
|
|
1526
|
+
// directory expecting Package.swift to live alongside.
|
|
1527
|
+
selfManagedDirs.set(target.name, selfManagedDir);
|
|
1528
|
+
// If a wrapper exists from a prior synth-mode run (i.e. the dep WAS
|
|
1529
|
+
// autolinker-wrapped, then later transitioned to self-managed via
|
|
1530
|
+
// `spm scaffold` or shipping its own Package.swift), remove the
|
|
1531
|
+
// wrapper now. Without this, the pruning loop below preserves it
|
|
1532
|
+
// (because the dep is "active" via selfManagedDirs) and Xcode's
|
|
1533
|
+
// SwiftPM cache picks up the stale wrapper Package.swift instead of
|
|
1534
|
+
// the self-managed one.
|
|
1535
|
+
const staleWrapper = path.join(packagesDir, target.name);
|
|
1536
|
+
if (fs.existsSync(staleWrapper)) {
|
|
1537
|
+
fs.rmSync(staleWrapper, {recursive: true, force: true});
|
|
1538
|
+
log(`Removed stale wrapper: packages/${target.name}/`);
|
|
1539
|
+
}
|
|
1540
|
+
log(
|
|
1541
|
+
`Self-managed: ${target.name} → ${path.relative(appRoot, selfManagedDir)} (using its own Package.swift)`,
|
|
1542
|
+
);
|
|
1543
|
+
continue;
|
|
1544
|
+
}
|
|
1545
|
+
if (entry.origin === 'npm') {
|
|
1546
|
+
// No shipped or scaffolded manifest — this is the gap we now surface.
|
|
1547
|
+
// A mixed-language dep is reported distinctly (it can't be scaffolded at
|
|
1548
|
+
// all, so "run spm scaffold" would be misleading).
|
|
1549
|
+
missingManifests.push({
|
|
1550
|
+
name: target.name,
|
|
1551
|
+
npmName: entry.npmName ?? target.name,
|
|
1552
|
+
hasPodspec: hasPodspec(absSource),
|
|
1553
|
+
mixed: hasMixedLanguageSources(absSource),
|
|
1554
|
+
});
|
|
1555
|
+
// Drop any stale wrapper from a previous synth-mode run so SPM doesn't
|
|
1556
|
+
// resolve against it.
|
|
1557
|
+
const staleWrapper = path.join(packagesDir, target.name);
|
|
1558
|
+
if (fs.existsSync(staleWrapper)) {
|
|
1559
|
+
fs.rmSync(staleWrapper, {recursive: true, force: true});
|
|
1560
|
+
}
|
|
1561
|
+
continue;
|
|
1562
|
+
}
|
|
1563
|
+
// spmModule: the synth wrapper is the mechanism, not a fallback — an
|
|
1564
|
+
// app-local dir has no npm identity, so the wrapper is the only package the
|
|
1565
|
+
// aggregator can reference. No podspec is read on this route by design:
|
|
1566
|
+
// app-local native code isn't required to carry one. (A hand-written
|
|
1567
|
+
// Package.swift still wins — the self-managed check above claims it first.)
|
|
1568
|
+
// But a mixed-language module can't be wrapped either — SPM can't compile
|
|
1569
|
+
// Swift + C-family sources in one target, and a synth wrapper would fail
|
|
1570
|
+
// with a cryptic SPM resolve error. Surface the same friendly diagnostic the
|
|
1571
|
+
// community-dep path uses instead of letting SPM emit the cryptic one.
|
|
1572
|
+
if (hasMixedLanguageSources(absSource)) {
|
|
1573
|
+
throw new Error(
|
|
1574
|
+
`react-native autolinking: the spm.module "${target.name}" mixes Swift ` +
|
|
1575
|
+
`and C-family (.m/.mm/.c/.cpp) sources, which SwiftPM cannot compile ` +
|
|
1576
|
+
`in a single target. Split it into separate single-language modules, ` +
|
|
1577
|
+
`or ship a hand-written Package.swift with multiple targets.`,
|
|
1578
|
+
);
|
|
1579
|
+
}
|
|
1580
|
+
const wrapperDir = path.join(packagesDir, target.name);
|
|
1581
|
+
wrapperDirs.set(target.name, wrapperDir);
|
|
1582
|
+
fs.mkdirSync(wrapperDir, {recursive: true});
|
|
1583
|
+
ensureSymlink(path.join(wrapperDir, WRAPPER_ROOT_NAME), absSource);
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
// Fail before writing any wrappers/aggregator: a missing community-lib
|
|
1587
|
+
// manifest is a hard error the developer must resolve by scaffolding (or the
|
|
1588
|
+
// library shipping its own). reportMissingManifests prints one `error:` line
|
|
1589
|
+
// per dep so Xcode renders them as build errors.
|
|
1590
|
+
if (missingManifests.length > 0) {
|
|
1591
|
+
throw reportMissingManifests(missingManifests);
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
// Sibling refs: each synth Package.swift declares its sibling deps via the
|
|
1595
|
+
// dep's actual package root — wrapper dir for autolinker-managed deps,
|
|
1596
|
+
// source dir for self-managed ones. SPM identity stays unique either way
|
|
1597
|
+
// (wrapper basename = SwiftName; self-managed manifests declare the same
|
|
1598
|
+
// package name).
|
|
1599
|
+
const siblingPackagePaths /*: {[string]: string} */ = {};
|
|
1600
|
+
for (const [name, wrapper] of wrapperDirs.entries()) {
|
|
1601
|
+
siblingPackagePaths[name] = wrapper;
|
|
1602
|
+
}
|
|
1603
|
+
for (const [name, sourceDir] of selfManagedDirs.entries()) {
|
|
1604
|
+
siblingPackagePaths[name] = sourceDir;
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
for (const entry of entries) {
|
|
1608
|
+
const {target} = entry;
|
|
1609
|
+
const absSource /*: string */ = entryAbsDirs.get(target.name) ?? '';
|
|
1610
|
+
|
|
1611
|
+
// Self-managed deps: skip the synth step entirely. The dep's own
|
|
1612
|
+
// Package.swift handles its targets, headers, and React framework
|
|
1613
|
+
// wiring. We just register it with the aggregator so the app pulls it
|
|
1614
|
+
// in alongside autolinker-managed deps. The central headers/<SwiftName>/
|
|
1615
|
+
// tree still gets populated so consumers (host app + sibling synths
|
|
1616
|
+
// that hit -I autolinking/headers) can resolve `<SwiftName/Header.h>`
|
|
1617
|
+
// by file path — synth packages use `-fno-implicit-module-maps`, so
|
|
1618
|
+
// we can't rely on SPM's auto-generated module map alone.
|
|
1619
|
+
if (selfManagedDirs.has(target.name)) {
|
|
1620
|
+
// Centralized headers tree walks the WHOLE dep root, not just the
|
|
1621
|
+
// manifest's directory — headers may live anywhere (e.g. common/cpp/
|
|
1622
|
+
// outside of ios/), and cross-package consumers should still resolve
|
|
1623
|
+
// them via the centralized -I path.
|
|
1624
|
+
linkHeaderTree(absSource, path.join(headersDir, target.name));
|
|
1625
|
+
// Route the manifest reference through a uniquely-named symlink at
|
|
1626
|
+
// libs/<SwiftName>/ so SPM derives the package identity from the
|
|
1627
|
+
// alias basename. Two libs that both ship Package.swift inside their
|
|
1628
|
+
// own `ios/` subdir would otherwise collide with identity "ios".
|
|
1629
|
+
const realPackageDir = selfManagedDirs.get(target.name) ?? absSource;
|
|
1630
|
+
const aliasPath = path.join(libsDir, target.name);
|
|
1631
|
+
ensureSymlink(aliasPath, realPackageDir);
|
|
1632
|
+
aggregatorPackageDeps.push({
|
|
1633
|
+
swiftName: target.name,
|
|
1634
|
+
packagePath: `libs/${target.name}`,
|
|
1635
|
+
npmName: entry.npmName ?? target.name,
|
|
1636
|
+
});
|
|
1637
|
+
continue;
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
const wrapperDir = wrapperDirs.get(target.name);
|
|
1641
|
+
if (wrapperDir == null) continue;
|
|
1642
|
+
const skipDirNames = new Set(
|
|
1643
|
+
(target.exclude || [])
|
|
1644
|
+
.filter(e => e.endsWith('/'))
|
|
1645
|
+
.map(e => e.slice(0, -1)),
|
|
1646
|
+
);
|
|
1647
|
+
|
|
1648
|
+
const siblingSynthAbsolutePaths /*: {[string]: string} */ = {};
|
|
1649
|
+
for (const sibling of target.spmTargetDependencies ?? []) {
|
|
1650
|
+
const sibPath = siblingPackagePaths[sibling];
|
|
1651
|
+
if (sibPath != null) {
|
|
1652
|
+
siblingSynthAbsolutePaths[sibling] = sibPath;
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
// target.path = "." (the wrapper dir) so SPM sees an empty `include/`
|
|
1657
|
+
// sibling of `root/` for its required `publicHeadersPath`. Without that,
|
|
1658
|
+
// SPM defaults publicHeadersPath to "include" and errors out when no
|
|
1659
|
+
// such dir exists inside the dep's source tree. Sources come from
|
|
1660
|
+
// `root/<...>` via the dir symlink — paths from auto-discovery or
|
|
1661
|
+
// user globs are relative to the dep's source dir, so we prefix with
|
|
1662
|
+
// `root/` to keep them inside target.path.
|
|
1663
|
+
const withRoot = (p /*: string */) => `${WRAPPER_ROOT_NAME}/${p}`;
|
|
1664
|
+
const prefixedExclude /*: Array<string> */ = (target.exclude ?? []).map(
|
|
1665
|
+
withRoot,
|
|
1666
|
+
);
|
|
1667
|
+
const prefixedResources /*: ?Array<string> */ =
|
|
1668
|
+
target.resources != null ? target.resources.map(withRoot) : undefined;
|
|
1669
|
+
|
|
1670
|
+
// sources: explicit allowlist. Pre-resolved on the target (spmModule
|
|
1671
|
+
// glob expansion) or auto-collected here. We always emit `sources:` so
|
|
1672
|
+
// SPM never falls back to scanning the source dir verbatim (which would
|
|
1673
|
+
// pick up tests/, *.js, *.podspec, etc.).
|
|
1674
|
+
const rawSources /*: Array<string> */ =
|
|
1675
|
+
target.sources != null && target.sources.length > 0
|
|
1676
|
+
? target.sources
|
|
1677
|
+
: collectSpmSources(absSource);
|
|
1678
|
+
const prefixedSources /*: ?Array<string> */ =
|
|
1679
|
+
rawSources.length > 0 ? rawSources.map(withRoot) : null;
|
|
1680
|
+
|
|
1681
|
+
// Podspec HEADER_SEARCH_PATHS were captured relative to the dep's source
|
|
1682
|
+
// dir. The wrapper exposes the source dir under `root/` (target.path is
|
|
1683
|
+
// `.`, the wrapper dir), so each entry must be prefixed with `root/` so
|
|
1684
|
+
// clang sees the real subtree.
|
|
1685
|
+
const prefixedHeaderSearchPaths /*: ?Array<string> */ =
|
|
1686
|
+
target.headerSearchPaths != null && target.headerSearchPaths.length > 0
|
|
1687
|
+
? target.headerSearchPaths.map(withRoot)
|
|
1688
|
+
: null;
|
|
1689
|
+
|
|
1690
|
+
const synthContent = generateSynthPackageSwift({
|
|
1691
|
+
swiftName: target.name,
|
|
1692
|
+
exclude: prefixedExclude,
|
|
1693
|
+
sources: prefixedSources,
|
|
1694
|
+
// Stub include/ subdir lives in the wrapper dir; satisfies SPM's
|
|
1695
|
+
// publicHeadersPath requirement without exposing anything. Cross-pkg
|
|
1696
|
+
// angle includes resolve through the merged header tree (the autolinking
|
|
1697
|
+
// header farm at <outputDir>/headers is folded into it).
|
|
1698
|
+
publicHeadersPath: 'include',
|
|
1699
|
+
resources: prefixedResources,
|
|
1700
|
+
headerSearchPaths: prefixedHeaderSearchPaths,
|
|
1701
|
+
spmDependencies: (target.spmTargetDependencies ?? []).map(swiftName => ({
|
|
1702
|
+
swiftName,
|
|
1703
|
+
})),
|
|
1704
|
+
hasReactDep,
|
|
1705
|
+
// Relative paths from the synth dir (<outputDir>/packages/<Name>) to the
|
|
1706
|
+
// app's React xcframeworks + codegen packages. Computed here because the
|
|
1707
|
+
// synth's depth is fixed and it is regenerated every run — no runtime
|
|
1708
|
+
// discovery needed in the manifest.
|
|
1709
|
+
reactNativePackagePath: toPosix(
|
|
1710
|
+
path.relative(wrapperDir, absXcframeworks),
|
|
1711
|
+
),
|
|
1712
|
+
codegenPackagePath: toPosix(
|
|
1713
|
+
path.relative(
|
|
1714
|
+
wrapperDir,
|
|
1715
|
+
path.join(appRoot, 'build', 'generated', 'ios'),
|
|
1716
|
+
),
|
|
1717
|
+
),
|
|
1718
|
+
isDynamic: false,
|
|
1719
|
+
targetPath: '.',
|
|
1720
|
+
siblingSynthAbsolutePaths,
|
|
1721
|
+
});
|
|
1722
|
+
|
|
1723
|
+
fs.writeFileSync(
|
|
1724
|
+
path.join(wrapperDir, 'Package.swift'),
|
|
1725
|
+
synthContent,
|
|
1726
|
+
'utf8',
|
|
1727
|
+
);
|
|
1728
|
+
// Centralized headers tree at <outputDir>/headers/<SwiftName>/<relpath>.h.
|
|
1729
|
+
// Used two ways:
|
|
1730
|
+
// * SPM-internal: cFlags add `-I <outputDir>/headers`, so cross-package
|
|
1731
|
+
// angle includes like <SwiftName/Header.h> resolve.
|
|
1732
|
+
// * Host app + sibling consumers: each wrapper's `include/` is a dir
|
|
1733
|
+
// symlink to its slice of this tree, so `#import <RelPath/Header.h>`
|
|
1734
|
+
// (e.g. <ReactCommon/RCTSampleTurboModule.h>) resolves through SPM's
|
|
1735
|
+
// publicHeadersPath propagation (-I .../packages/<SwiftName>/include).
|
|
1736
|
+
const pkgHeadersDir = path.join(headersDir, target.name);
|
|
1737
|
+
linkHeaderTree(absSource, pkgHeadersDir, skipDirNames);
|
|
1738
|
+
|
|
1739
|
+
const includePath = path.join(wrapperDir, 'include');
|
|
1740
|
+
if (fs.existsSync(pkgHeadersDir)) {
|
|
1741
|
+
ensureSymlink(includePath, pkgHeadersDir);
|
|
1742
|
+
} else {
|
|
1743
|
+
// Header-less package (rare): keep an empty dir so SPM's
|
|
1744
|
+
// publicHeadersPath: "include" requirement is still satisfied.
|
|
1745
|
+
fs.mkdirSync(includePath, {recursive: true});
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
log(
|
|
1749
|
+
`Synth: packages/${target.name}/ → ${path.relative(appRoot, absSource)}`,
|
|
1750
|
+
);
|
|
1751
|
+
|
|
1752
|
+
aggregatorPackageDeps.push({
|
|
1753
|
+
swiftName: target.name,
|
|
1754
|
+
packagePath: `packages/${target.name}`,
|
|
1755
|
+
});
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
// Prune stale wrappers + header dirs for entries no longer autolinked.
|
|
1759
|
+
// Preserve both wrapper-managed and self-managed names; only entries that
|
|
1760
|
+
// are no longer autolinked at all get removed. Note: `packages/` only has
|
|
1761
|
+
// wrapper-managed names (self-managed deps live in their own source dirs),
|
|
1762
|
+
// but `headers/` has both since we populate the central tree for everyone.
|
|
1763
|
+
const activeNames /*: Set<string> */ = new Set([
|
|
1764
|
+
...wrapperDirs.keys(),
|
|
1765
|
+
...selfManagedDirs.keys(),
|
|
1766
|
+
]);
|
|
1767
|
+
for (const subdir of ['packages', 'headers']) {
|
|
1768
|
+
const dir = path.join(outputDir, subdir);
|
|
1769
|
+
try {
|
|
1770
|
+
const existing /*: Array<{name: string, isSymbolicLink(): boolean, isDirectory(): boolean}> */ =
|
|
1771
|
+
// $FlowFixMe[incompatible-type] Dirent typing
|
|
1772
|
+
fs.readdirSync(dir, {withFileTypes: true});
|
|
1773
|
+
for (const entry of existing) {
|
|
1774
|
+
if (activeNames.has(entry.name)) continue;
|
|
1775
|
+
const stale = path.join(dir, entry.name);
|
|
1776
|
+
if (entry.isSymbolicLink() || !entry.isDirectory()) {
|
|
1777
|
+
fs.unlinkSync(stale);
|
|
1778
|
+
} else {
|
|
1779
|
+
fs.rmSync(stale, {recursive: true, force: true});
|
|
1780
|
+
}
|
|
1781
|
+
log(`Removed stale ${subdir}/${entry.name}`);
|
|
1782
|
+
}
|
|
1783
|
+
} catch {
|
|
1784
|
+
// dir doesn't exist – fine
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
// Invoke discovered framework plugins now that the RN dep graph + autolinking
|
|
1789
|
+
// data are final. Their package/product contributions merge into the
|
|
1790
|
+
// aggregator below; this runs in add/update AND every build-time sync (both
|
|
1791
|
+
// call main), so a plugin's contribution survives every regeneration.
|
|
1792
|
+
let pluginPackageDeps /*: Array<PluginPackageDep> */ = [];
|
|
1793
|
+
let pluginProductDeps /*: Array<PluginProductDep> */ = [];
|
|
1794
|
+
let pluginGeneratedSources /*: Array<{path: string}> */ = [];
|
|
1795
|
+
let pluginFlavoredFrameworks /*: Array<PluginFlavoredFramework> */ = [];
|
|
1796
|
+
let pluginWatchPaths /*: Array<string> */ = [];
|
|
1797
|
+
let pluginScriptPhases /*: Array<PluginScriptPhase> */ = [];
|
|
1798
|
+
if (discoveredPlugins.length > 0) {
|
|
1799
|
+
// React-GeneratedCode is the per-app codegen package (referenced as
|
|
1800
|
+
// `../ios` from outputDir). It may be absent (no codegen this run), so the
|
|
1801
|
+
// descriptor only lists its products when it actually resolves.
|
|
1802
|
+
const codegenPackageExists = fs.existsSync(
|
|
1803
|
+
path.join(outputDir, '..', 'ios', 'Package.swift'),
|
|
1804
|
+
);
|
|
1805
|
+
const result = invokePlugins(
|
|
1806
|
+
discoveredPlugins,
|
|
1807
|
+
{
|
|
1808
|
+
appRoot,
|
|
1809
|
+
projectRoot: findProjectRoot(appRoot),
|
|
1810
|
+
reactNativeRoot: rnRoot,
|
|
1811
|
+
autolinking: autolinkingData ?? {},
|
|
1812
|
+
outputDir,
|
|
1813
|
+
react: reactDescriptor(
|
|
1814
|
+
absXcframeworks,
|
|
1815
|
+
xcframeworksRelPath,
|
|
1816
|
+
codegenPackageExists,
|
|
1817
|
+
),
|
|
1818
|
+
},
|
|
1819
|
+
{warn},
|
|
1820
|
+
);
|
|
1821
|
+
pluginPackageDeps = result.packageDependencies;
|
|
1822
|
+
pluginProductDeps = result.productDependencies;
|
|
1823
|
+
pluginGeneratedSources = result.generatedSources;
|
|
1824
|
+
pluginFlavoredFrameworks = result.flavoredFrameworks;
|
|
1825
|
+
pluginWatchPaths = result.watchPaths;
|
|
1826
|
+
pluginScriptPhases = result.scriptPhases;
|
|
1827
|
+
log(
|
|
1828
|
+
`SPM plugins contributed ${pluginPackageDeps.length} package(s), ` +
|
|
1829
|
+
`${pluginProductDeps.length} product(s), ` +
|
|
1830
|
+
`${pluginGeneratedSources.length} generated source(s), ` +
|
|
1831
|
+
`${pluginFlavoredFrameworks.length} flavored framework(s), ` +
|
|
1832
|
+
`${pluginScriptPhases.length} script phase(s)`,
|
|
1833
|
+
);
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1836
|
+
// Plugin sidecars. All are ALWAYS written — even `[]` — so removing a
|
|
1837
|
+
// plugin (or dropping its declaration) clears stale entries. Machine-local
|
|
1838
|
+
// absolute paths; gitignored + regenerated every sync.
|
|
1839
|
+
fs.mkdirSync(outputDir, {recursive: true});
|
|
1840
|
+
// Generated-source registration (e.g. Expo's ExpoModulesProvider.swift),
|
|
1841
|
+
// consumed by the injector at add/update time — the provider ordering
|
|
1842
|
+
// contract is still Preview and co-designed with the first consumer.
|
|
1843
|
+
fs.writeFileSync(
|
|
1844
|
+
path.join(outputDir, '.spm-plugin-generated-sources.json'),
|
|
1845
|
+
JSON.stringify(pluginGeneratedSources, null, 2) + '\n',
|
|
1846
|
+
'utf8',
|
|
1847
|
+
);
|
|
1848
|
+
// Flavored-framework sidecar consumed by `spm add` / `spm update` when it
|
|
1849
|
+
// regenerates the app's linker settings and sole embed phase.
|
|
1850
|
+
fs.writeFileSync(
|
|
1851
|
+
path.join(outputDir, '.spm-plugin-flavored-frameworks.json'),
|
|
1852
|
+
JSON.stringify(pluginFlavoredFrameworks, null, 2) + '\n',
|
|
1853
|
+
'utf8',
|
|
1854
|
+
);
|
|
1855
|
+
fs.writeFileSync(
|
|
1856
|
+
path.join(outputDir, '.spm-plugin-script-phases.json'),
|
|
1857
|
+
JSON.stringify(pluginScriptPhases, null, 2) + '\n',
|
|
1858
|
+
'utf8',
|
|
1859
|
+
);
|
|
1860
|
+
|
|
1861
|
+
// Top-level aggregator: references every entry as .package(path:) and
|
|
1862
|
+
// depends on each via .product(...). No more inline targets — every
|
|
1863
|
+
// autolinked dep is a real SPM package in its own source dir.
|
|
1864
|
+
const aggregatorContent = generateAutolinkedPackageSwift({
|
|
1865
|
+
npmDeps: aggregatorPackageDeps,
|
|
1866
|
+
hasReactDep,
|
|
1867
|
+
xcframeworksRelPath,
|
|
1868
|
+
pluginPackageDeps,
|
|
1869
|
+
pluginProductDeps,
|
|
1870
|
+
});
|
|
1871
|
+
fs.mkdirSync(outputDir, {recursive: true});
|
|
1872
|
+
const outputPath = path.join(outputDir, 'Package.swift');
|
|
1873
|
+
fs.writeFileSync(outputPath, aggregatorContent, 'utf8');
|
|
1874
|
+
log(`Generated: ${path.relative(appRoot, outputPath)}`);
|
|
1875
|
+
|
|
1876
|
+
// .spm-sync-watch-paths: absolute paths (dirs OR files) the Xcode auto-sync
|
|
1877
|
+
// build phase watches for staleness. Three kinds of input, mixed freely:
|
|
1878
|
+
// 1. Each module's source dir (entryAbsDirs) — a dir; adding/removing a
|
|
1879
|
+
// child bumps its mtime so `find -newer` trips and the `sources:`
|
|
1880
|
+
// allowlist regenerates.
|
|
1881
|
+
// 2. Each npm dep's checked-in root `Package.swift` (a file) and its
|
|
1882
|
+
// `.react-native/` metadata dir. Editing a manifest does NOT bump the
|
|
1883
|
+
// source dir's mtime, so without these a manifest edit stays silently
|
|
1884
|
+
// stale until an unrelated install triggers a sync. The dep ROOT is
|
|
1885
|
+
// threaded through the entry (entry.root, from the autolinking model),
|
|
1886
|
+
// not derived by walking up from the (possibly nested) source dir.
|
|
1887
|
+
// 3. Plugin-contributed paths (e.g. Expo's own Package.swift / per-module
|
|
1888
|
+
// manifests) — already validated absolute in invokePlugins.
|
|
1889
|
+
// The phase distinguishes dir vs file with `-d`/`-f` at build time (no
|
|
1890
|
+
// markers). The existsSync filter here is safe: these paths come from a
|
|
1891
|
+
// successful sync so they exist now; a path that later VANISHES is caught at
|
|
1892
|
+
// phase time against this file and forces a re-sync.
|
|
1893
|
+
const watchCandidates /*: Array<string> */ = [...entryAbsDirs.values()];
|
|
1894
|
+
for (const entry of entries) {
|
|
1895
|
+
const root = entry.root;
|
|
1896
|
+
if (entry.origin !== 'npm' || root == null) {
|
|
1897
|
+
continue;
|
|
1898
|
+
}
|
|
1899
|
+
watchCandidates.push(path.join(root, 'Package.swift'));
|
|
1900
|
+
watchCandidates.push(path.join(root, '.react-native'));
|
|
1901
|
+
}
|
|
1902
|
+
watchCandidates.push(...pluginWatchPaths);
|
|
1903
|
+
const watchPaths = Array.from(new Set(watchCandidates))
|
|
1904
|
+
.filter(p => p.length > 0 && fs.existsSync(p))
|
|
1905
|
+
.sort();
|
|
1906
|
+
fs.writeFileSync(
|
|
1907
|
+
path.join(outputDir, '.spm-sync-watch-paths'),
|
|
1908
|
+
watchPaths.join('\n') + (watchPaths.length > 0 ? '\n' : ''),
|
|
1909
|
+
'utf8',
|
|
1910
|
+
);
|
|
1911
|
+
|
|
1912
|
+
// AutolinkedAggregate is glue; needs at least one source file (Swift, so we
|
|
1913
|
+
// sidestep the Obj-C public-headers-dir requirement).
|
|
1914
|
+
const aggregateDir = path.join(outputDir, 'AutolinkedAggregate');
|
|
1915
|
+
fs.mkdirSync(aggregateDir, {recursive: true});
|
|
1916
|
+
const stubPath = path.join(aggregateDir, 'AutolinkedAggregate.swift');
|
|
1917
|
+
if (!fs.existsSync(stubPath)) {
|
|
1918
|
+
fs.writeFileSync(
|
|
1919
|
+
stubPath,
|
|
1920
|
+
'// Placeholder. Real native modules live in transitively-referenced sub-packages.\n',
|
|
1921
|
+
'utf8',
|
|
1922
|
+
);
|
|
1923
|
+
}
|
|
1924
|
+
const legacyStub = path.join(aggregateDir, 'AutolinkedAggregate.m');
|
|
1925
|
+
if (fs.existsSync(legacyStub)) {
|
|
1926
|
+
fs.unlinkSync(legacyStub);
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1929
|
+
// One-time migration cleanup: remove the legacy <appRoot>/autolinked/ tree
|
|
1930
|
+
// and any stale in-source `Package.swift` / `include/<Name>/` from the
|
|
1931
|
+
// prior in-place layout (those files lived in user source dirs and have
|
|
1932
|
+
// been replaced by the wrapper layout under outputDir).
|
|
1933
|
+
const legacyAutolinkedDir = path.join(appRoot, 'autolinked');
|
|
1934
|
+
if (
|
|
1935
|
+
fs.existsSync(legacyAutolinkedDir) &&
|
|
1936
|
+
path.resolve(legacyAutolinkedDir) !== path.resolve(outputDir)
|
|
1937
|
+
) {
|
|
1938
|
+
fs.rmSync(legacyAutolinkedDir, {recursive: true, force: true});
|
|
1939
|
+
log(`Removed legacy autolinked/ tree`);
|
|
1940
|
+
}
|
|
1941
|
+
for (const absSource of entryAbsDirs.values()) {
|
|
1942
|
+
const legacyPkg = path.join(absSource, 'Package.swift');
|
|
1943
|
+
let removedLegacyPkg = false;
|
|
1944
|
+
try {
|
|
1945
|
+
const content = fs.readFileSync(legacyPkg, 'utf8');
|
|
1946
|
+
if (content.includes(AUTOGEN_MARKER)) {
|
|
1947
|
+
fs.unlinkSync(legacyPkg);
|
|
1948
|
+
removedLegacyPkg = true;
|
|
1949
|
+
log(
|
|
1950
|
+
`Removed legacy in-place synth: ${path.relative(appRoot, legacyPkg)}`,
|
|
1951
|
+
);
|
|
1952
|
+
}
|
|
1953
|
+
} catch {
|
|
1954
|
+
// not present – fine
|
|
1955
|
+
}
|
|
1956
|
+
// Only treat include/ as a legacy leftover when the in-place synth
|
|
1957
|
+
// manifest was just removed alongside it: a SCAFFOLDED dep legitimately
|
|
1958
|
+
// owns include/<SwiftName>/ (the namespaced shim headers behind its
|
|
1959
|
+
// publicHeadersPath: "include") — nuking it unconditionally would break
|
|
1960
|
+
// every dependent's `#import <SwiftName/Header.h>` on the next sync.
|
|
1961
|
+
if (removedLegacyPkg) {
|
|
1962
|
+
const legacyInclude = path.join(absSource, 'include');
|
|
1963
|
+
try {
|
|
1964
|
+
if (fs.lstatSync(legacyInclude).isDirectory()) {
|
|
1965
|
+
fs.rmSync(legacyInclude, {recursive: true, force: true});
|
|
1966
|
+
log(
|
|
1967
|
+
`Removed legacy in-place include/: ${path.relative(appRoot, legacyInclude)}`,
|
|
1968
|
+
);
|
|
1969
|
+
}
|
|
1970
|
+
} catch {
|
|
1971
|
+
// not present – fine
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
if (require.main === module) {
|
|
1978
|
+
try {
|
|
1979
|
+
main();
|
|
1980
|
+
} catch (e) {
|
|
1981
|
+
if (e instanceof RemoteVersionError) {
|
|
1982
|
+
log(e.message);
|
|
1983
|
+
process.exitCode = 2;
|
|
1984
|
+
} else {
|
|
1985
|
+
throw e;
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
module.exports = {
|
|
1991
|
+
main,
|
|
1992
|
+
autolinkingDepToSpmTarget,
|
|
1993
|
+
generateAutolinkedPackageSwift,
|
|
1994
|
+
generateSynthPackageSwift,
|
|
1995
|
+
reactDescriptor,
|
|
1996
|
+
linkHeaderTree,
|
|
1997
|
+
collectSpmSources,
|
|
1998
|
+
expandSpmSourceGlobs,
|
|
1999
|
+
findSelfManagedPackageDir,
|
|
2000
|
+
hasPodspec,
|
|
2001
|
+
hasMixedLanguageSources,
|
|
2002
|
+
MissingManifestError,
|
|
2003
|
+
reportMissingManifests,
|
|
2004
|
+
AUTOGEN_MARKER,
|
|
2005
|
+
};
|