@depup/react-native 0.86.0-depup.49 → 0.87.0-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/Alert/Alert.js +38 -1
- package/Libraries/Animated/AnimatedExports.js +22 -0
- package/Libraries/Animated/AnimatedExports.js.flow +1 -1
- package/Libraries/Animated/AnimatedImplementation.js +120 -3
- 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/createAnimatedComponent.js +3 -3
- package/Libraries/Animated/nodes/AnimatedColor.js +8 -8
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +106 -0
- package/Libraries/Animated/nodes/AnimatedProps.js +27 -3
- package/Libraries/Animated/nodes/AnimatedValue.js +8 -0
- 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 +1 -0
- 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/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/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 +19 -2
- 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.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 +11 -1
- package/Libraries/Components/View/ViewAccessibility.js +16 -5
- 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 +1 -1
- package/Libraries/Core/Timers/JSTimers.js +53 -52
- package/Libraries/Core/setUpGlobals.js +9 -4
- package/Libraries/Core/setUpNavigator.js +6 -1
- 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.js +3 -0
- 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 +60 -63
- package/Libraries/Image/RCTImageStoreManager.h +0 -2
- 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/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/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/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/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/shims/ReactNativeTypes.js +36 -36
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +4 -4
- 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/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/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/differ/deepDiffer.js +5 -2
- package/Libraries/Utilities/useColorScheme.js +11 -1
- package/Libraries/Utilities/useWindowDimensions.js +6 -0
- 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 +1 -1
- 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/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 +12 -3
- 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/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 +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 +9 -2
- package/ReactAndroid/api/ReactAndroid.api +128 -142
- package/ReactAndroid/build.gradle.kts +26 -21
- 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/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 +5 -7
- 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/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 +195 -194
- 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/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/network/NetworkEventUtil.kt +53 -3
- 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 +1 -1
- 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 +1 -5
- package/ReactAndroid/src/main/java/com/facebook/react/touch/ReactInterceptingViewGroup.kt +4 -4
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java +46 -9
- 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 +7 -7
- 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 +6 -6
- 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 +91 -1
- 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 +81 -9
- package/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.kt +4 -0
- 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/RCTAnimatedModuleProvider/React-RCTAnimatedModuleProvider.podspec +63 -0
- package/ReactCommon/React-Fabric.podspec +2 -0
- package/ReactCommon/ReactCommon.podspec +2 -12
- 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 +2 -1
- package/ReactCommon/cxxreact/ReactMarker.cpp +4 -30
- package/ReactCommon/cxxreact/ReactMarker.h +38 -21
- package/ReactCommon/cxxreact/ReactNativeVersion.h +2 -2
- package/ReactCommon/cxxreact/TraceSection.h +1 -1
- package/ReactCommon/cxxreact/tests/methodcall.cpp +4 -0
- package/ReactCommon/hermes/executor/HermesExecutorFactory.cpp +6 -79
- 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 +2 -3
- package/ReactCommon/jsi/jsi/hermes-interfaces.h +53 -0
- package/ReactCommon/jsiexecutor/React-jsiexecutor.podspec +2 -1
- 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/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/tests/HostTargetTest.cpp +53 -0
- package/ReactCommon/jsinspector-modern/tracing/HostTracingProfile.h +14 -1
- package/ReactCommon/jsinspector-modern/tracing/TraceRecordingState.h +11 -0
- 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/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 +1 -1
- package/ReactCommon/react/nativemodule/core/platform/ios/React-NativeModulesApple.podspec +1 -1
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTInteropTurboModule.h +4 -0
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTInteropTurboModule.mm +4 -0
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm +60 -3
- 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/dom/NativeDOM.cpp +10 -4
- package/ReactCommon/react/nativemodule/dom/React-domnativemodule.podspec +1 -0
- package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +25 -55
- package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +11 -23
- package/ReactCommon/react/nativemodule/idlecallbacks/React-idlecallbacksnativemodule.podspec +1 -0
- package/ReactCommon/react/nativemodule/intersectionobserver/React-intersectionobservernativemodule.podspec +1 -0
- package/ReactCommon/react/nativemodule/mutationobserver/NativeMutationObserver.cpp +4 -0
- package/ReactCommon/react/nativemodule/mutationobserver/React-mutationobservernativemodule.podspec +1 -0
- package/ReactCommon/react/nativemodule/samples/platform/ios/ReactCommon/RCTSampleTurboModule.h +1 -1
- package/ReactCommon/react/nativemodule/webperformance/React-webperformancenativemodule.podspec +1 -0
- 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/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/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/ShadowNode.cpp +27 -19
- package/ReactCommon/react/renderer/core/ShadowNodeFamily.h +2 -0
- 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/element/tests/ElementTest.cpp +3 -3
- package/ReactCommon/react/renderer/imagemanager/platform/android/react/renderer/imagemanager/conversions.h +17 -0
- 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/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 +1 -0
- 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/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 +89 -94
- package/ReactCommon/react/renderer/uimanager/UIManager.h +2 -2
- package/ReactCommon/react/renderer/uimanager/UIManagerDelegate.h +1 -1
- package/ReactCommon/react/renderer/uimanager/tests/FabricUIManagerTest.cpp +144 -3
- 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/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/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/utils/Telemetry.h +0 -13
- package/ReactCommon/react/utils/tests/Base64Tests.cpp +36 -0
- package/ReactCommon/reactperflogger/reactperflogger/ReactPerfettoLogger.cpp +0 -1
- package/ReactCommon/runtimeexecutor/platform/ios/ReactCommon/RuntimeExecutorSyncUIThreadUtils.mm +21 -38
- package/ReactCommon/yoga/Yoga.podspec +1 -1
- 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/AbsoluteLayout.cpp +2 -1
- package/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp +294 -17
- package/ReactCommon/yoga/yoga/algorithm/CalculateLayout.h +1 -1
- 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 +49 -68
- 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 +64 -3
- package/scripts/cocoapods/rndeps_facades.rb +193 -0
- package/scripts/cocoapods/spm.rb +78 -11
- package/scripts/cocoapods/utils.rb +5 -7
- package/scripts/codegen/generate-artifacts-executor/generateSchemaInfos.js +0 -1
- package/scripts/codegen/templates/Package.swift.spm-template +97 -0
- package/scripts/codegen/templates/ReactCodegen.podspec.template +1 -1
- package/scripts/hermes/hermes-utils.js +27 -58
- 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 +57 -86
- package/scripts/setup-apple-spm.js +1267 -0
- package/scripts/spm/__doc__/rfc-spm-xcframework.md +707 -0
- package/scripts/spm/__doc__/spm-autolinking-plugins.md +244 -0
- package/scripts/spm/__doc__/spm-header-paths-contract.md +97 -0
- package/scripts/spm/__doc__/spm-plugins-assessment.md +128 -0
- package/scripts/spm/__doc__/spm-scripts.md +486 -0
- package/scripts/spm/autolinking-plugins.js +331 -0
- package/scripts/spm/download-spm-artifacts.js +1409 -0
- package/scripts/spm/expand-spm-dependencies.js +216 -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 +1888 -0
- package/scripts/spm/generate-spm-package.js +302 -0
- package/scripts/spm/generate-spm-xcodeproj.js +2266 -0
- package/scripts/spm/read-podspec.js +695 -0
- package/scripts/spm/scaffold-package-swift.js +1206 -0
- package/scripts/spm/spm-pbxproj.js +654 -0
- package/scripts/spm/spm-types.js +520 -0
- package/scripts/spm/spm-utils.js +645 -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 +33 -1
- 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/ReactNativeDependencies.podspec +2 -2
- package/types/index.d.ts +0 -1
- package/types/public/DeprecatedPropertiesAlias.d.ts +0 -4
- package/types/public/ReactNativeTypes.d.ts +4 -2
- 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 +107 -3
- 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/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 +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 +23 -8
- 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 +28 -17
- 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,2266 @@
|
|
|
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
|
+
/**
|
|
14
|
+
* generate-spm-xcodeproj.js – Surgical, in-place Swift Package Manager
|
|
15
|
+
* integration toolkit for an existing `<App>.xcodeproj`.
|
|
16
|
+
*
|
|
17
|
+
* `injectSpmIntoExistingXcodeproj` adds the SPM package references, React build
|
|
18
|
+
* settings, the "Sync SPM Autolinking" build phase, and a scheme pre-action to
|
|
19
|
+
* a user's existing project — purely additively, recording every edit in a
|
|
20
|
+
* `.spm-injected.json` marker. `removeSpmInjection` is the exact inverse (used
|
|
21
|
+
* by `spm deinit`). Consumed as a library by setup-apple-spm.js; not a CLI.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
const {readFlavoredFrameworksManifest} = require('./flavored-frameworks');
|
|
25
|
+
const {parseConfigCommandJson} = require('./generate-spm-autolinking-config');
|
|
26
|
+
const {
|
|
27
|
+
addArrayMembers,
|
|
28
|
+
addArrayStringValues,
|
|
29
|
+
ensureScalarField,
|
|
30
|
+
findApplicationTargets,
|
|
31
|
+
findField,
|
|
32
|
+
findObjectByUuid,
|
|
33
|
+
findProjectObject,
|
|
34
|
+
insertObjectsIntoSection,
|
|
35
|
+
namespacedUUID,
|
|
36
|
+
quoteIfNeeded,
|
|
37
|
+
removeArrayMembersByUuid,
|
|
38
|
+
removeArrayStringValues,
|
|
39
|
+
removeDanglingJavaScriptCoreRef,
|
|
40
|
+
removeEmptyPodsGroup,
|
|
41
|
+
removeField,
|
|
42
|
+
removeObjectByUuid,
|
|
43
|
+
serializeEntry,
|
|
44
|
+
setScalarField,
|
|
45
|
+
} = require('./spm-pbxproj');
|
|
46
|
+
const {makeLogger, remotePackageConfig} = require('./spm-utils');
|
|
47
|
+
const fs = require('fs');
|
|
48
|
+
const path = require('path');
|
|
49
|
+
|
|
50
|
+
/*:: import type {
|
|
51
|
+
FlavoredFrameworkManifestEntry,
|
|
52
|
+
XcframeworkSlice,
|
|
53
|
+
} from './spm-types'; */
|
|
54
|
+
|
|
55
|
+
const {log} = makeLogger('generate-spm-xcodeproj');
|
|
56
|
+
|
|
57
|
+
// Sidecar inside a USER-OWNED xcodeproj that SPM packages were injected into in
|
|
58
|
+
// place. Records the host project's root UUID + every edit so `spm deinit`
|
|
59
|
+
// (removeSpmInjection) can surgically revert and re-runs stay idempotent.
|
|
60
|
+
const SPM_INJECTED_MARKER = '.spm-injected.json';
|
|
61
|
+
|
|
62
|
+
// Manifest of plugin-contributed sources that must COMPILE INTO THE APP TARGET
|
|
63
|
+
// (e.g. Expo's ExpoModulesProvider.swift — an `@objc` class only reaches the
|
|
64
|
+
// ObjC classlist, and so is discoverable via NSClassFromString, when it
|
|
65
|
+
// compiles into the app target, NOT the static Autolinked aggregate). Written
|
|
66
|
+
// by generate-spm-autolinking.js (the plugin merge) BEFORE setupXcodeproj runs
|
|
67
|
+
// on both `add` and `update`, so the injector reads it synchronously. Path is
|
|
68
|
+
// relative to the app root (== SRCROOT / the .xcodeproj's dir).
|
|
69
|
+
const SPM_GENERATED_SOURCES_MANIFEST = path.join(
|
|
70
|
+
'build',
|
|
71
|
+
'generated',
|
|
72
|
+
'autolinking',
|
|
73
|
+
'.spm-plugin-generated-sources.json',
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
// The single navigator group all injected generated sources are parented under
|
|
77
|
+
// (created on first use). Its namespacedUUID id + display name.
|
|
78
|
+
const SPM_GENERATED_SOURCES_GROUP_ID = 'SPMGeneratedSources';
|
|
79
|
+
const SPM_GENERATED_SOURCES_GROUP_NAME = 'SPM Generated Sources';
|
|
80
|
+
|
|
81
|
+
// pbxproj `lastKnownFileType` per source extension. v1 plugins emit Swift only;
|
|
82
|
+
// .m/.mm are mapped as future-proofing (the plugin contract permits ObjC/ObjC++
|
|
83
|
+
// sources). An unmapped extension is skipped with a loud log.
|
|
84
|
+
const GENERATED_SOURCE_FILE_TYPES /*: {[string]: string} */ = {
|
|
85
|
+
'.swift': 'sourcecode.swift',
|
|
86
|
+
'.m': 'sourcecode.c.objc',
|
|
87
|
+
'.mm': 'sourcecode.cpp.objcpp',
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// Maps each SPM product to its sub-package path (relative to app root).
|
|
91
|
+
// The xcodeproj must reference each sub-package directly so Xcode can
|
|
92
|
+
// resolve the product dependencies — SPM doesn't expose transitive products.
|
|
93
|
+
const SPM_PRODUCT_PACKAGES /*: Array<{product: string, packagePath: string, packageName: string}> */ =
|
|
94
|
+
[
|
|
95
|
+
{
|
|
96
|
+
product: 'ReactHeaders',
|
|
97
|
+
packagePath: 'build/xcframeworks',
|
|
98
|
+
packageName: 'ReactNative',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
product: 'ReactNativeHeaders',
|
|
102
|
+
packagePath: 'build/xcframeworks',
|
|
103
|
+
packageName: 'ReactNative',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
product: 'ReactNativeDependenciesHeaders',
|
|
107
|
+
packagePath: 'build/xcframeworks',
|
|
108
|
+
packageName: 'ReactNative',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
product: 'Autolinked',
|
|
112
|
+
packagePath: 'build/generated/autolinking',
|
|
113
|
+
packageName: 'Autolinked',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
product: 'ReactCodegen',
|
|
117
|
+
packagePath: 'build/generated/ios',
|
|
118
|
+
packageName: 'React-GeneratedCode',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
product: 'ReactAppDependencyProvider',
|
|
122
|
+
packagePath: 'build/generated/ios',
|
|
123
|
+
packageName: 'React-GeneratedCode',
|
|
124
|
+
},
|
|
125
|
+
];
|
|
126
|
+
|
|
127
|
+
/*::
|
|
128
|
+
type RemoteCfg = {url: string, version: string, identity: string};
|
|
129
|
+
// Precise record of the build-setting edits injection made to ONE build config,
|
|
130
|
+
// so deinit can reverse exactly those (and nothing the user already had).
|
|
131
|
+
type BuildSettingChange = {
|
|
132
|
+
configUuid: string,
|
|
133
|
+
createdArrayKeys: Array<string>,
|
|
134
|
+
appendedArrayValues: {[string]: Array<string>},
|
|
135
|
+
createdScalars: Array<string>,
|
|
136
|
+
// Scalars whose pre-injection value was replaced (key → original raw
|
|
137
|
+
// value), e.g. a ${PODS_ROOT}-anchored REACT_NATIVE_PATH that dangles once
|
|
138
|
+
// CocoaPods is deintegrated. Deinit restores the original.
|
|
139
|
+
replacedScalars?: {[string]: string},
|
|
140
|
+
};
|
|
141
|
+
// A plugin-contributed source, normalized for pbxproj emission. `path` is
|
|
142
|
+
// SRCROOT-relative when under the app root, else absolute; `sourceTree` is the
|
|
143
|
+
// matching pbxproj token ('SOURCE_ROOT' or '"<absolute>"').
|
|
144
|
+
type GeneratedSource = {path: string, name: string, sourceTree: string, fileType: string};
|
|
145
|
+
type SpmGraph = {
|
|
146
|
+
uniquePackages: Array<{packagePath: string, packageName: string}>,
|
|
147
|
+
localPkgRefs: Array<{uuid: string, packagePath: string, comment: string}>,
|
|
148
|
+
remotePkgRef: ?{uuid: string, url: string, version: string, identity: string, comment: string},
|
|
149
|
+
products: Array<{product: string, depUuid: string, buildFileUuid: string, pkgRefUuid: string, refComment: string}>,
|
|
150
|
+
};
|
|
151
|
+
*/
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Resolve the SPM dependency graph (package references + product
|
|
155
|
+
* dependencies + their frameworks build files) from SPM_PRODUCT_PACKAGES.
|
|
156
|
+
* `mkUuid(section, id)` supplies UUIDs, seeded with the host project's root
|
|
157
|
+
* UUID so injected IDs are stable across re-runs and collision-safe.
|
|
158
|
+
*/
|
|
159
|
+
function buildSpmDependencyGraph(
|
|
160
|
+
mkUuid /*: (section: string, id: string) => string */,
|
|
161
|
+
remote /*: ?RemoteCfg */,
|
|
162
|
+
) /*: SpmGraph */ {
|
|
163
|
+
// Remote mode: ReactNative-family products move to the remote package.
|
|
164
|
+
const productPackages = SPM_PRODUCT_PACKAGES.map(e =>
|
|
165
|
+
remote != null && e.packagePath === 'build/xcframeworks'
|
|
166
|
+
? {...e, packagePath: 'REMOTE', packageName: remote.identity}
|
|
167
|
+
: e,
|
|
168
|
+
);
|
|
169
|
+
const uniquePackages = Array.from(
|
|
170
|
+
new Map(
|
|
171
|
+
productPackages
|
|
172
|
+
.filter(e => e.packagePath !== 'REMOTE')
|
|
173
|
+
.map(e => [
|
|
174
|
+
e.packagePath,
|
|
175
|
+
{packagePath: e.packagePath, packageName: e.packageName},
|
|
176
|
+
]),
|
|
177
|
+
).values(),
|
|
178
|
+
);
|
|
179
|
+
const localPkgRefs = uniquePackages.map(pkg => ({
|
|
180
|
+
uuid: mkUuid('XCLocalSwiftPackageReference', pkg.packagePath),
|
|
181
|
+
packagePath: pkg.packagePath,
|
|
182
|
+
comment: `XCLocalSwiftPackageReference "${pkg.packagePath}"`,
|
|
183
|
+
}));
|
|
184
|
+
const remotePkgRef =
|
|
185
|
+
remote != null
|
|
186
|
+
? {
|
|
187
|
+
uuid: mkUuid('XCRemoteSwiftPackageReference', remote.url),
|
|
188
|
+
url: remote.url,
|
|
189
|
+
version: remote.version,
|
|
190
|
+
identity: remote.identity,
|
|
191
|
+
comment: `XCRemoteSwiftPackageReference "${remote.identity}"`,
|
|
192
|
+
}
|
|
193
|
+
: null;
|
|
194
|
+
const localByPath = new Map(localPkgRefs.map(r => [r.packagePath, r]));
|
|
195
|
+
const products = productPackages.map(entry => {
|
|
196
|
+
const {product, packagePath} = entry;
|
|
197
|
+
const isRemote = packagePath === 'REMOTE' && remotePkgRef != null;
|
|
198
|
+
const pkgRefUuid = isRemote
|
|
199
|
+
? // $FlowFixMe[incompatible-use] guarded by isRemote
|
|
200
|
+
remotePkgRef.uuid
|
|
201
|
+
: // $FlowFixMe[incompatible-use] every non-REMOTE path is in localByPath
|
|
202
|
+
localByPath.get(packagePath).uuid;
|
|
203
|
+
const refComment = isRemote
|
|
204
|
+
? // $FlowFixMe[incompatible-use] guarded by isRemote
|
|
205
|
+
`XCRemoteSwiftPackageReference "${remotePkgRef.identity}"`
|
|
206
|
+
: `XCLocalSwiftPackageReference "${packagePath}"`;
|
|
207
|
+
return {
|
|
208
|
+
product,
|
|
209
|
+
depUuid: mkUuid('XCSwiftPackageProductDependency', product),
|
|
210
|
+
buildFileUuid: mkUuid('PBXBuildFile', `spm:${product}`),
|
|
211
|
+
pkgRefUuid,
|
|
212
|
+
refComment,
|
|
213
|
+
};
|
|
214
|
+
});
|
|
215
|
+
return {uniquePackages, localPkgRefs, remotePkgRef, products};
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Render the SPM graph into pbxproj section entry objects the in-place injector
|
|
220
|
+
* splices into an existing project.
|
|
221
|
+
*/
|
|
222
|
+
/*:: type PbxEntryT = {uuid: string, comment: string, fields: {[string]: string}}; */
|
|
223
|
+
|
|
224
|
+
function spmGraphToEntries(
|
|
225
|
+
graph /*: SpmGraph */,
|
|
226
|
+
) /*: {localRefs: Array<PbxEntryT>, remoteRef: ?PbxEntryT, productDeps: Array<PbxEntryT>, buildFiles: Array<PbxEntryT>} */ {
|
|
227
|
+
const localRefs /*: Array<PbxEntryT> */ = graph.localPkgRefs.map(ref => ({
|
|
228
|
+
uuid: ref.uuid,
|
|
229
|
+
comment: ref.comment,
|
|
230
|
+
fields: {
|
|
231
|
+
isa: 'XCLocalSwiftPackageReference',
|
|
232
|
+
relativePath: quoteIfNeeded(ref.packagePath),
|
|
233
|
+
},
|
|
234
|
+
}));
|
|
235
|
+
const remote = graph.remotePkgRef;
|
|
236
|
+
const remoteRef /*: ?PbxEntryT */ =
|
|
237
|
+
remote != null
|
|
238
|
+
? {
|
|
239
|
+
uuid: remote.uuid,
|
|
240
|
+
comment: remote.comment,
|
|
241
|
+
fields: {
|
|
242
|
+
isa: 'XCRemoteSwiftPackageReference',
|
|
243
|
+
repositoryURL: quoteIfNeeded(remote.url),
|
|
244
|
+
requirement: `{\n\t\t\t\tkind = exactVersion;\n\t\t\t\tversion = "${remote.version}";\n\t\t\t}`,
|
|
245
|
+
},
|
|
246
|
+
}
|
|
247
|
+
: null;
|
|
248
|
+
const productDeps /*: Array<PbxEntryT> */ = graph.products.map(p => ({
|
|
249
|
+
uuid: p.depUuid,
|
|
250
|
+
comment: p.product,
|
|
251
|
+
fields: {
|
|
252
|
+
isa: 'XCSwiftPackageProductDependency',
|
|
253
|
+
package: `${p.pkgRefUuid} /* ${p.refComment} */`,
|
|
254
|
+
productName: quoteIfNeeded(p.product),
|
|
255
|
+
},
|
|
256
|
+
}));
|
|
257
|
+
const buildFiles /*: Array<PbxEntryT> */ = graph.products.map(p => ({
|
|
258
|
+
uuid: p.buildFileUuid,
|
|
259
|
+
comment: `${p.product} in Frameworks`,
|
|
260
|
+
fields: {
|
|
261
|
+
isa: 'PBXBuildFile',
|
|
262
|
+
productRef: `${p.depUuid} /* ${p.product} */`,
|
|
263
|
+
},
|
|
264
|
+
}));
|
|
265
|
+
return {localRefs, remoteRef, productDeps, buildFiles};
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// Sync SPM Autolinking: timestamp check + conditional node re-run. Shared by
|
|
269
|
+
// the build phase (safety net) and the scheme pre-action (the one that
|
|
270
|
+
// actually fires before SPM resolution, so a single build picks up
|
|
271
|
+
// dep-graph changes from `npm install`).
|
|
272
|
+
// Build a PBXShellScriptBuildPhase entry (the "Sync SPM Autolinking" phase).
|
|
273
|
+
function shellScriptPhase(
|
|
274
|
+
phaseUUID /*: string */,
|
|
275
|
+
name /*: string */,
|
|
276
|
+
script /*: string */,
|
|
277
|
+
options /*: {inputPaths?: string, outputPaths?: string} */ = {},
|
|
278
|
+
) /*: {uuid: string, comment: string, fields: {[string]: string}} */ {
|
|
279
|
+
const empty = '(\n\t\t\t)';
|
|
280
|
+
return {
|
|
281
|
+
uuid: phaseUUID,
|
|
282
|
+
comment: name,
|
|
283
|
+
fields: {
|
|
284
|
+
isa: 'PBXShellScriptBuildPhase',
|
|
285
|
+
buildActionMask: '2147483647',
|
|
286
|
+
files: empty,
|
|
287
|
+
inputFileListPaths: empty,
|
|
288
|
+
inputPaths: options.inputPaths ?? empty,
|
|
289
|
+
name: quoteIfNeeded(name),
|
|
290
|
+
outputFileListPaths: empty,
|
|
291
|
+
outputPaths: options.outputPaths ?? empty,
|
|
292
|
+
runOnlyForDeploymentPostprocessing: '0',
|
|
293
|
+
shellPath: '/bin/sh',
|
|
294
|
+
shellScript: quoteIfNeeded(script),
|
|
295
|
+
},
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function frameworkSettingPrefix(id /*: string */) /*: string */ {
|
|
300
|
+
return `RN_SPM_${id.replace(/[^A-Za-z0-9]/g, '_').toUpperCase()}`;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
function flavorForBuildConfiguration(
|
|
304
|
+
configurationName /*: string */,
|
|
305
|
+
) /*: 'debug' | 'release' */ {
|
|
306
|
+
const lower = configurationName.toLowerCase();
|
|
307
|
+
return lower.includes('debug') || lower.includes('development')
|
|
308
|
+
? 'debug'
|
|
309
|
+
: 'release';
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
function buildConfigurationName(
|
|
313
|
+
text /*: string */,
|
|
314
|
+
configUuid /*: string */,
|
|
315
|
+
) /*: string */ {
|
|
316
|
+
const config = findObjectByUuid(text, configUuid);
|
|
317
|
+
const name = config != null ? findField(text, config, 'name') : null;
|
|
318
|
+
if (name == null) {
|
|
319
|
+
throw new Error(`pbxproj: build configuration ${configUuid} has no name`);
|
|
320
|
+
}
|
|
321
|
+
return name.value.replace(/^"|"$/g, '');
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function frameworkConditionalSettings(
|
|
325
|
+
frameworks /*: ReadonlyArray<FlavoredFrameworkManifestEntry> */,
|
|
326
|
+
) /*: Array<{key: string, value: string}> */ {
|
|
327
|
+
const settings /*: Array<{key: string, value: string}> */ = [];
|
|
328
|
+
for (const framework of frameworks) {
|
|
329
|
+
const prefix = frameworkSettingPrefix(framework.id);
|
|
330
|
+
const bySdk /*: Map<string, Array<XcframeworkSlice>> */ = new Map();
|
|
331
|
+
// The injected target is an Apple mobile/Catalyst application. Native
|
|
332
|
+
// macOS slices share `sdk=macosx*` with Catalyst and cannot be
|
|
333
|
+
// distinguished by an XCBuildConfiguration condition, so use the Catalyst
|
|
334
|
+
// slice and leave native-mac packaging out of this iOS integration.
|
|
335
|
+
for (const slice of framework.slices.filter(
|
|
336
|
+
candidate => candidate.platform !== 'macos',
|
|
337
|
+
)) {
|
|
338
|
+
const existing = bySdk.get(slice.sdk) ?? [];
|
|
339
|
+
existing.push(slice);
|
|
340
|
+
bySdk.set(slice.sdk, existing);
|
|
341
|
+
}
|
|
342
|
+
for (const [sdk, slices] of bySdk) {
|
|
343
|
+
const emit = (slice /*: XcframeworkSlice */, condition /*: string */) => {
|
|
344
|
+
const root =
|
|
345
|
+
`$(SRCROOT)/build/xcframeworks/$(RN_SPM_FLAVOR)/` +
|
|
346
|
+
`${framework.artifactRelativePath}/${slice.libraryIdentifier}`;
|
|
347
|
+
settings.push(
|
|
348
|
+
{
|
|
349
|
+
key: quoteIfNeeded(`${prefix}_FRAMEWORK${condition}`),
|
|
350
|
+
value: quoteIfNeeded(`${root}/${slice.libraryPath}`),
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
key: quoteIfNeeded(`${prefix}_BINARY${condition}`),
|
|
354
|
+
value: quoteIfNeeded(`${root}/${slice.binaryPath}`),
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
key: quoteIfNeeded(`${prefix}_SEARCH_PATH${condition}`),
|
|
358
|
+
value: quoteIfNeeded(root),
|
|
359
|
+
},
|
|
360
|
+
);
|
|
361
|
+
};
|
|
362
|
+
if (slices.length === 1) {
|
|
363
|
+
emit(slices[0], `[sdk=${sdk}]`);
|
|
364
|
+
continue;
|
|
365
|
+
}
|
|
366
|
+
const seenArchitectures /*: Set<string> */ = new Set();
|
|
367
|
+
for (const slice of slices) {
|
|
368
|
+
for (const architecture of slice.architectures) {
|
|
369
|
+
if (seenArchitectures.has(architecture)) {
|
|
370
|
+
throw new Error(
|
|
371
|
+
`${framework.frameworkName} has ambiguous ${sdk}/${architecture} slices`,
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
seenArchitectures.add(architecture);
|
|
375
|
+
emit(slice, `[sdk=${sdk}][arch=${architecture}]`);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
return settings;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
function frameworkArrayBuildSettings(
|
|
384
|
+
frameworks /*: ReadonlyArray<FlavoredFrameworkManifestEntry> */,
|
|
385
|
+
) /*: Array<{key: string, values: Array<string>}> */ {
|
|
386
|
+
return [
|
|
387
|
+
{
|
|
388
|
+
key: 'OTHER_LDFLAGS',
|
|
389
|
+
values: [
|
|
390
|
+
'"-ObjC"',
|
|
391
|
+
...frameworks.map(
|
|
392
|
+
framework => `"$(${frameworkSettingPrefix(framework.id)}_BINARY)"`,
|
|
393
|
+
),
|
|
394
|
+
],
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
key: 'FRAMEWORK_SEARCH_PATHS',
|
|
398
|
+
values: frameworks.map(
|
|
399
|
+
framework => `"$(${frameworkSettingPrefix(framework.id)}_SEARCH_PATH)"`,
|
|
400
|
+
),
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
key: 'LD_RUNPATH_SEARCH_PATHS',
|
|
404
|
+
values: ['"@executable_path/Frameworks"'],
|
|
405
|
+
},
|
|
406
|
+
];
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
function pbxPathList(paths /*: ReadonlyArray<string> */) /*: string */ {
|
|
410
|
+
if (paths.length === 0) {
|
|
411
|
+
return '(\n\t\t\t)';
|
|
412
|
+
}
|
|
413
|
+
return `(\n${paths
|
|
414
|
+
.map(value => `\t\t\t\t${quoteIfNeeded(value)},\n`)
|
|
415
|
+
.join('')}\t\t\t)`;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
function buildEmbedFrameworksScript(
|
|
419
|
+
frameworks /*: ReadonlyArray<FlavoredFrameworkManifestEntry> */,
|
|
420
|
+
) /*: string */ {
|
|
421
|
+
const validations = frameworks
|
|
422
|
+
.map(framework => {
|
|
423
|
+
const variable = `${frameworkSettingPrefix(framework.id)}_FRAMEWORK`;
|
|
424
|
+
return `validate_framework "\${${variable}:-}" "${framework.frameworkName}.framework"`;
|
|
425
|
+
})
|
|
426
|
+
.join('\n');
|
|
427
|
+
const copies = frameworks
|
|
428
|
+
.map(framework => {
|
|
429
|
+
const variable = `${frameworkSettingPrefix(framework.id)}_FRAMEWORK`;
|
|
430
|
+
return `copy_and_sign "\${${variable}:-}" "${framework.frameworkName}.framework"`;
|
|
431
|
+
})
|
|
432
|
+
.join('\n');
|
|
433
|
+
return `set -euo pipefail
|
|
434
|
+
|
|
435
|
+
destination="$TARGET_BUILD_DIR/$FRAMEWORKS_FOLDER_PATH"
|
|
436
|
+
mkdir -p "$destination"
|
|
437
|
+
|
|
438
|
+
validate_framework() {
|
|
439
|
+
source="$1"
|
|
440
|
+
name="$2"
|
|
441
|
+
if [ -z "$source" ] || [ ! -d "$source" ]; then
|
|
442
|
+
echo "error: React Native SwiftPM framework '$name' is unavailable for configuration '$CONFIGURATION' and SDK '$SDK_NAME': $source"
|
|
443
|
+
exit 1
|
|
444
|
+
fi
|
|
445
|
+
binary="\${name%.framework}"
|
|
446
|
+
if [ ! -e "$source/$binary" ] && [ ! -e "$source/Versions/Current/$binary" ]; then
|
|
447
|
+
echo "error: React Native SwiftPM framework '$name' is invalid for configuration '$CONFIGURATION': expected $source/$binary or $source/Versions/Current/$binary"
|
|
448
|
+
exit 1
|
|
449
|
+
fi
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
copy_and_sign() {
|
|
453
|
+
source="$1"
|
|
454
|
+
name="$2"
|
|
455
|
+
/usr/bin/rsync -a --delete "$source/" "$destination/$name/"
|
|
456
|
+
if [ "\${CODE_SIGNING_ALLOWED:-YES}" != "NO" ]; then
|
|
457
|
+
identity="\${EXPANDED_CODE_SIGN_IDENTITY:--}"
|
|
458
|
+
if [ "$identity" = "-" ]; then
|
|
459
|
+
/usr/bin/codesign --force --sign - --timestamp=none --preserve-metadata=identifier,entitlements,flags "$destination/$name"
|
|
460
|
+
else
|
|
461
|
+
/usr/bin/codesign --force --sign "$identity" --preserve-metadata=identifier,entitlements,flags "$destination/$name"
|
|
462
|
+
fi
|
|
463
|
+
fi
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
${validations}
|
|
467
|
+
${copies}
|
|
468
|
+
`;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
function addBuildPhaseAfter(
|
|
472
|
+
text /*: string */,
|
|
473
|
+
target /*: {bodyOpen: number, bodyClose: number, ...} */,
|
|
474
|
+
afterUuid /*: string */,
|
|
475
|
+
member /*: {uuid: string, comment: string} */,
|
|
476
|
+
) /*: string */ {
|
|
477
|
+
const field = findField(text, target, 'buildPhases');
|
|
478
|
+
if (field == null || field.value.includes(member.uuid)) {
|
|
479
|
+
return text;
|
|
480
|
+
}
|
|
481
|
+
const after = new RegExp(`(^|\\n)([\\t ]*)${afterUuid}\\b[^\\n]*,`).exec(
|
|
482
|
+
field.value,
|
|
483
|
+
);
|
|
484
|
+
if (after == null) {
|
|
485
|
+
return addArrayMembers(text, target, 'buildPhases', [member]);
|
|
486
|
+
}
|
|
487
|
+
const absoluteStart = field.valueStart + after.index;
|
|
488
|
+
const lineEnd = text.indexOf('\n', absoluteStart + after[0].length);
|
|
489
|
+
const indent = after[2];
|
|
490
|
+
const line = `\n${indent}${member.uuid} /* ${member.comment} */,`;
|
|
491
|
+
return text.slice(0, lineEnd) + line + text.slice(lineEnd);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// The node + react-native-dir resolution preamble shared by the sync build
|
|
495
|
+
// phase and scheme pre-action. Both dispatch DIRECTLY into react-native's
|
|
496
|
+
// scripts rather than through 'npx react-native' — that CLI requires
|
|
497
|
+
// @react-native-community/cli (absent in e.g. Expo apps), so it would exit
|
|
498
|
+
// non-zero and the failure would be silently swallowed.
|
|
499
|
+
function nodeAndRnDirPreamble(reactNativePath /*: string */) /*: string */ {
|
|
500
|
+
return `set -euo pipefail
|
|
501
|
+
|
|
502
|
+
# ---------------------------------------------------------------------------
|
|
503
|
+
# Resolve a node binary and the react-native package dir at BUILD TIME.
|
|
504
|
+
# ---------------------------------------------------------------------------
|
|
505
|
+
NODE_BINARY="\${NODE_BINARY:-}"
|
|
506
|
+
if [ -z "$NODE_BINARY" ]; then
|
|
507
|
+
# Source RN's standard app-local node-path files. They reference vars that
|
|
508
|
+
# may be unset and may return non-zero, so relax nounset AND errexit while
|
|
509
|
+
# sourcing — a buggy user .xcode.env must degrade to PATH-based node
|
|
510
|
+
# resolution below, not silently abort every build.
|
|
511
|
+
set +eu
|
|
512
|
+
if [ -f "$SRCROOT/.xcode.env" ]; then
|
|
513
|
+
. "$SRCROOT/.xcode.env"
|
|
514
|
+
fi
|
|
515
|
+
if [ -f "$SRCROOT/.xcode.env.local" ]; then
|
|
516
|
+
. "$SRCROOT/.xcode.env.local"
|
|
517
|
+
fi
|
|
518
|
+
set -eu
|
|
519
|
+
NODE_BINARY="\${NODE_BINARY:-}"
|
|
520
|
+
fi
|
|
521
|
+
if [ -z "$NODE_BINARY" ]; then
|
|
522
|
+
NODE_BINARY="$(command -v node 2>/dev/null || true)"
|
|
523
|
+
fi
|
|
524
|
+
|
|
525
|
+
# Resolve react-native's dir FROM THE APP (require.resolve), not a
|
|
526
|
+
# generation-time baked path — the baked path goes stale in pnpm / hoisted
|
|
527
|
+
# stores. Fall back to the baked path if resolution fails or the resolved dir
|
|
528
|
+
# has no setup-apple-spm.js.
|
|
529
|
+
RN_DIR=""
|
|
530
|
+
if [ -n "$NODE_BINARY" ]; then
|
|
531
|
+
RN_DIR="$(cd "$SRCROOT" && "$NODE_BINARY" --print "require('path').dirname(require.resolve('react-native/package.json'))" 2>/dev/null || true)"
|
|
532
|
+
fi
|
|
533
|
+
if [ -z "$RN_DIR" ] || [ ! -f "$RN_DIR/scripts/setup-apple-spm.js" ]; then
|
|
534
|
+
RN_DIR="${reactNativePath}"
|
|
535
|
+
fi`;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
// Shared: the STALE-input check + conditional codegen/autolinking sync dispatch.
|
|
539
|
+
// Runtime framework slots are never touched here; add/update owns them.
|
|
540
|
+
function syncStaleCheckAndDispatch() /*: string */ {
|
|
541
|
+
return `STAMP="$SRCROOT/build/generated/autolinking/.spm-sync-stamp"
|
|
542
|
+
STALE=0
|
|
543
|
+
|
|
544
|
+
# Find project root (where package.json lives — may be an ancestor of SRCROOT)
|
|
545
|
+
PROJECT_ROOT="$SRCROOT"
|
|
546
|
+
while [ "$PROJECT_ROOT" != "/" ] && [ ! -f "$PROJECT_ROOT/package.json" ]; do
|
|
547
|
+
PROJECT_ROOT="$(dirname "$PROJECT_ROOT")"
|
|
548
|
+
done
|
|
549
|
+
if [ ! -f "$PROJECT_ROOT/package.json" ]; then
|
|
550
|
+
PROJECT_ROOT="$SRCROOT"
|
|
551
|
+
fi
|
|
552
|
+
|
|
553
|
+
# Check 1: dependency inputs (covers app projects after any package manager install)
|
|
554
|
+
for INPUT in \\
|
|
555
|
+
"$PROJECT_ROOT/package.json" \\
|
|
556
|
+
"$PROJECT_ROOT/react-native.config.js"; do
|
|
557
|
+
if [ -f "$INPUT" ] && [ "$INPUT" -nt "$STAMP" ]; then
|
|
558
|
+
STALE=1
|
|
559
|
+
break
|
|
560
|
+
fi
|
|
561
|
+
done
|
|
562
|
+
|
|
563
|
+
# Check workspace lockfiles and package-manager metadata. These cover package
|
|
564
|
+
# managers that do not reliably bump node_modules mtimes, and Yarn PnP projects
|
|
565
|
+
# that do not have node_modules at all.
|
|
566
|
+
if [ "$STALE" -eq 0 ]; then
|
|
567
|
+
DIR="$PROJECT_ROOT"
|
|
568
|
+
while [ "$DIR" != "/" ]; do
|
|
569
|
+
for INPUT in \\
|
|
570
|
+
"$DIR/package-lock.json" \\
|
|
571
|
+
"$DIR/npm-shrinkwrap.json" \\
|
|
572
|
+
"$DIR/yarn.lock" \\
|
|
573
|
+
"$DIR/pnpm-lock.yaml" \\
|
|
574
|
+
"$DIR/bun.lock" \\
|
|
575
|
+
"$DIR/bun.lockb" \\
|
|
576
|
+
"$DIR/.pnp.cjs" \\
|
|
577
|
+
"$DIR/.pnp.loader.mjs"; do
|
|
578
|
+
if [ -f "$INPUT" ] && [ "$INPUT" -nt "$STAMP" ]; then
|
|
579
|
+
STALE=1
|
|
580
|
+
break
|
|
581
|
+
fi
|
|
582
|
+
done
|
|
583
|
+
if [ "$STALE" -eq 1 ]; then
|
|
584
|
+
break
|
|
585
|
+
fi
|
|
586
|
+
DIR="$(dirname "$DIR")"
|
|
587
|
+
done
|
|
588
|
+
fi
|
|
589
|
+
|
|
590
|
+
# Check node_modules mtime. In monorepos, node_modules may be hoisted to any
|
|
591
|
+
# ancestor between the app package and the workspace root.
|
|
592
|
+
if [ "$STALE" -eq 0 ]; then
|
|
593
|
+
DIR="$PROJECT_ROOT"
|
|
594
|
+
while [ "$DIR" != "/" ]; do
|
|
595
|
+
NM_DIR="$DIR/node_modules"
|
|
596
|
+
if [ -d "$NM_DIR" ] && [ "$NM_DIR" -nt "$STAMP" ]; then
|
|
597
|
+
STALE=1
|
|
598
|
+
break
|
|
599
|
+
fi
|
|
600
|
+
DIR="$(dirname "$DIR")"
|
|
601
|
+
done
|
|
602
|
+
fi
|
|
603
|
+
|
|
604
|
+
# Also check the app root directly when SRCROOT is not the package root.
|
|
605
|
+
if [ "$STALE" -eq 0 ] && [ "$SRCROOT" != "$PROJECT_ROOT" ]; then
|
|
606
|
+
if [ -d "$SRCROOT/node_modules" ] && [ "$SRCROOT/node_modules" -nt "$STAMP" ]; then
|
|
607
|
+
STALE=1
|
|
608
|
+
fi
|
|
609
|
+
fi
|
|
610
|
+
|
|
611
|
+
# Check 1.5: watched paths (mixed dirs AND files). Dirs catch add/remove of
|
|
612
|
+
# source files in spm.modules and autolinked deps (dir mtime updates on both);
|
|
613
|
+
# files catch edits to a dep's checked-in Package.swift / plugin manifests that
|
|
614
|
+
# would not bump any parent dir mtime. A path that has VANISHED (renamed/moved
|
|
615
|
+
# module root) forces a re-sync so the autolinker surfaces the real, actionable
|
|
616
|
+
# config error rather than the build failing later on dangling-symlink noise.
|
|
617
|
+
WATCH_FILE="$SRCROOT/build/generated/autolinking/.spm-sync-watch-paths"
|
|
618
|
+
if [ "$STALE" -eq 0 ] && [ -f "$WATCH_FILE" ]; then
|
|
619
|
+
while IFS= read -r P; do
|
|
620
|
+
[ -z "$P" ] && continue
|
|
621
|
+
if [ -d "$P" ]; then
|
|
622
|
+
if [ -n "$(find "$P" -newer "$STAMP" -print -quit 2>/dev/null)" ]; then
|
|
623
|
+
STALE=1
|
|
624
|
+
break
|
|
625
|
+
fi
|
|
626
|
+
elif [ -f "$P" ]; then
|
|
627
|
+
if [ "$P" -nt "$STAMP" ]; then
|
|
628
|
+
STALE=1
|
|
629
|
+
break
|
|
630
|
+
fi
|
|
631
|
+
else
|
|
632
|
+
STALE=1
|
|
633
|
+
break
|
|
634
|
+
fi
|
|
635
|
+
done < "$WATCH_FILE"
|
|
636
|
+
fi
|
|
637
|
+
|
|
638
|
+
# Check 2: codegen spec files changed via git (covers monorepo after git pull)
|
|
639
|
+
if [ "$STALE" -eq 0 ] && [ -f "$STAMP" ]; then
|
|
640
|
+
STAMP_TIME=$(stat -f %m "$STAMP" 2>/dev/null || stat -c %Y "$STAMP" 2>/dev/null || echo 0)
|
|
641
|
+
LATEST_SPEC_COMMIT=$(git -C "$SRCROOT" log -1 --format=%ct -- '*.js' '*.ts' 2>/dev/null || echo 0)
|
|
642
|
+
if [ "$LATEST_SPEC_COMMIT" -gt "$STAMP_TIME" ]; then
|
|
643
|
+
STALE=1
|
|
644
|
+
fi
|
|
645
|
+
fi
|
|
646
|
+
|
|
647
|
+
if [ ! -f "$STAMP" ]; then
|
|
648
|
+
STALE=1
|
|
649
|
+
fi
|
|
650
|
+
|
|
651
|
+
# Re-sync codegen + autolinking when a dependency input changed. Runtime
|
|
652
|
+
# framework slots and Xcode linker settings are only changed by spm update.
|
|
653
|
+
if [ "$STALE" -eq 1 ]; then
|
|
654
|
+
echo "SPM sync inputs changed — re-syncing (codegen + autolinking)..."
|
|
655
|
+
|
|
656
|
+
WITH_ENVIRONMENT="$RN_DIR/scripts/xcode/with-environment.sh"
|
|
657
|
+
|
|
658
|
+
if [ -f "$WITH_ENVIRONMENT" ]; then
|
|
659
|
+
# with-environment.sh references PODS_ROOT and $1, which may be unset.
|
|
660
|
+
# Temporarily disable nounset to avoid failures when sourcing.
|
|
661
|
+
export PODS_ROOT="\${PODS_ROOT:-$SRCROOT}"
|
|
662
|
+
set +u
|
|
663
|
+
. "$WITH_ENVIRONMENT"
|
|
664
|
+
set -u
|
|
665
|
+
fi
|
|
666
|
+
|
|
667
|
+
cd "$SRCROOT"
|
|
668
|
+
# \`|| RC=$?\` so a non-zero exit is CAPTURED rather than aborting the phase
|
|
669
|
+
# under \`set -e\` — the whole point is to branch on the code below (2 = fail
|
|
670
|
+
# the build with a scaffold hint; other non-zero = warn but don't break).
|
|
671
|
+
RC=0
|
|
672
|
+
if [ -n "$NODE_BINARY" ] && [ -f "$RN_DIR/scripts/setup-apple-spm.js" ]; then
|
|
673
|
+
# Direct, dependency-free dispatch (no \`npx react-native\`, which needs
|
|
674
|
+
# @react-native-community/cli).
|
|
675
|
+
"$NODE_BINARY" "$RN_DIR/scripts/setup-apple-spm.js" sync || RC=$?
|
|
676
|
+
elif command -v npx >/dev/null 2>&1; then
|
|
677
|
+
npx react-native spm sync || RC=$?
|
|
678
|
+
else
|
|
679
|
+
echo "warning: node/npx not found — skipping SPM sync"
|
|
680
|
+
fi
|
|
681
|
+
if [ "$RC" -eq 2 ]; then
|
|
682
|
+
# Exit 2 = an autolinked community dependency has no Package.swift. The
|
|
683
|
+
# autolinker already printed an \`error:\` line per dep (so Xcode shows them
|
|
684
|
+
# and the fix). Fail the build — the developer must run
|
|
685
|
+
# \`npx react-native spm scaffold\` from a terminal to generate the manifest.
|
|
686
|
+
exit 1
|
|
687
|
+
elif [ "$RC" -ne 0 ]; then
|
|
688
|
+
echo "warning: SPM sync failed — build may use stale codegen/autolinking"
|
|
689
|
+
fi
|
|
690
|
+
fi
|
|
691
|
+
`;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
// Scheme pre-action: re-run codegen + autolinking before package resolution.
|
|
695
|
+
function buildSchemePreActionScript(
|
|
696
|
+
reactNativePath /*: string */,
|
|
697
|
+
) /*: string */ {
|
|
698
|
+
return `${nodeAndRnDirPreamble(reactNativePath)}
|
|
699
|
+
|
|
700
|
+
${syncStaleCheckAndDispatch()}
|
|
701
|
+
`;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
// The in-target phase is only an autolinking safety net. Runtime framework
|
|
705
|
+
// selection is expressed entirely through build settings and the independent
|
|
706
|
+
// Embed React Native Flavored Frameworks phase.
|
|
707
|
+
function buildSyncAutolinkingScript(
|
|
708
|
+
reactNativePath /*: string */,
|
|
709
|
+
) /*: string */ {
|
|
710
|
+
return `${nodeAndRnDirPreamble(reactNativePath)}
|
|
711
|
+
|
|
712
|
+
${syncStaleCheckAndDispatch()}
|
|
713
|
+
`;
|
|
714
|
+
}
|
|
715
|
+
// XML-attribute escape (the five named entities). The sync script uses `>`
|
|
716
|
+
// and `&` for redirection and bg/and chains, plus `<` for heredocs and
|
|
717
|
+
// comparisons — all of which break Xcode's scheme parser if left raw.
|
|
718
|
+
function escapeXmlAttribute(s /*: string */) /*: string */ {
|
|
719
|
+
return s
|
|
720
|
+
.replace(/&/g, '&')
|
|
721
|
+
.replace(/</g, '<')
|
|
722
|
+
.replace(/>/g, '>')
|
|
723
|
+
.replace(/"/g, '"')
|
|
724
|
+
.replace(/'/g, ''');
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
function generateXcscheme(
|
|
728
|
+
appName /*: string */,
|
|
729
|
+
targetUUID /*: string */,
|
|
730
|
+
projName /*: string */,
|
|
731
|
+
syncScript /*: string */,
|
|
732
|
+
) /*: string */ {
|
|
733
|
+
const escapedSync = escapeXmlAttribute(syncScript);
|
|
734
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
735
|
+
<Scheme
|
|
736
|
+
LastUpgradeVersion = "1600"
|
|
737
|
+
version = "1.7">
|
|
738
|
+
<BuildAction
|
|
739
|
+
parallelizeBuildables = "YES"
|
|
740
|
+
buildImplicitDependencies = "YES">
|
|
741
|
+
<PreActions>
|
|
742
|
+
<ExecutionAction
|
|
743
|
+
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
|
|
744
|
+
<ActionContent
|
|
745
|
+
title = "Sync SPM Autolinking"
|
|
746
|
+
scriptText = "${escapedSync}">
|
|
747
|
+
<EnvironmentBuildable>
|
|
748
|
+
<BuildableReference
|
|
749
|
+
BuildableIdentifier = "primary"
|
|
750
|
+
BlueprintIdentifier = "${targetUUID}"
|
|
751
|
+
BuildableName = "${appName}.app"
|
|
752
|
+
BlueprintName = "${appName}"
|
|
753
|
+
ReferencedContainer = "container:${projName}.xcodeproj">
|
|
754
|
+
</BuildableReference>
|
|
755
|
+
</EnvironmentBuildable>
|
|
756
|
+
</ActionContent>
|
|
757
|
+
</ExecutionAction>
|
|
758
|
+
</PreActions>
|
|
759
|
+
<BuildActionEntries>
|
|
760
|
+
<BuildActionEntry
|
|
761
|
+
buildForTesting = "YES"
|
|
762
|
+
buildForRunning = "YES"
|
|
763
|
+
buildForProfiling = "YES"
|
|
764
|
+
buildForArchiving = "YES"
|
|
765
|
+
buildForAnalyzing = "YES">
|
|
766
|
+
<BuildableReference
|
|
767
|
+
BuildableIdentifier = "primary"
|
|
768
|
+
BlueprintIdentifier = "${targetUUID}"
|
|
769
|
+
BuildableName = "${appName}.app"
|
|
770
|
+
BlueprintName = "${appName}"
|
|
771
|
+
ReferencedContainer = "container:${projName}.xcodeproj">
|
|
772
|
+
</BuildableReference>
|
|
773
|
+
</BuildActionEntry>
|
|
774
|
+
</BuildActionEntries>
|
|
775
|
+
</BuildAction>
|
|
776
|
+
<TestAction
|
|
777
|
+
buildConfiguration = "Debug"
|
|
778
|
+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
779
|
+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
780
|
+
shouldUseLaunchSchemeArgsEnv = "YES"
|
|
781
|
+
shouldAutocreateTestPlan = "YES">
|
|
782
|
+
</TestAction>
|
|
783
|
+
<LaunchAction
|
|
784
|
+
buildConfiguration = "Debug"
|
|
785
|
+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
|
786
|
+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
|
787
|
+
launchStyle = "0"
|
|
788
|
+
useCustomWorkingDirectory = "NO"
|
|
789
|
+
ignoresPersistentStateOnLaunch = "NO"
|
|
790
|
+
debugDocumentVersioning = "YES"
|
|
791
|
+
debugServiceExtension = "internal"
|
|
792
|
+
allowLocationSimulation = "YES">
|
|
793
|
+
<BuildableProductRunnable
|
|
794
|
+
runnableDebuggingMode = "0">
|
|
795
|
+
<BuildableReference
|
|
796
|
+
BuildableIdentifier = "primary"
|
|
797
|
+
BlueprintIdentifier = "${targetUUID}"
|
|
798
|
+
BuildableName = "${appName}.app"
|
|
799
|
+
BlueprintName = "${appName}"
|
|
800
|
+
ReferencedContainer = "container:${projName}.xcodeproj">
|
|
801
|
+
</BuildableReference>
|
|
802
|
+
</BuildableProductRunnable>
|
|
803
|
+
</LaunchAction>
|
|
804
|
+
<ProfileAction
|
|
805
|
+
buildConfiguration = "Release"
|
|
806
|
+
shouldUseLaunchSchemeArgsEnv = "YES"
|
|
807
|
+
savedToolIdentifier = ""
|
|
808
|
+
useCustomWorkingDirectory = "NO"
|
|
809
|
+
debugDocumentVersioning = "YES">
|
|
810
|
+
<BuildableProductRunnable
|
|
811
|
+
runnableDebuggingMode = "0">
|
|
812
|
+
<BuildableReference
|
|
813
|
+
BuildableIdentifier = "primary"
|
|
814
|
+
BlueprintIdentifier = "${targetUUID}"
|
|
815
|
+
BuildableName = "${appName}.app"
|
|
816
|
+
BlueprintName = "${appName}"
|
|
817
|
+
ReferencedContainer = "container:${projName}.xcodeproj">
|
|
818
|
+
</BuildableReference>
|
|
819
|
+
</BuildableProductRunnable>
|
|
820
|
+
</ProfileAction>
|
|
821
|
+
<AnalyzeAction
|
|
822
|
+
buildConfiguration = "Debug">
|
|
823
|
+
</AnalyzeAction>
|
|
824
|
+
<ArchiveAction
|
|
825
|
+
buildConfiguration = "Release"
|
|
826
|
+
revealArchiveInOrganizer = "YES">
|
|
827
|
+
</ArchiveAction>
|
|
828
|
+
</Scheme>
|
|
829
|
+
`;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
// When the xcodeproj is generated, the referenced SPM package directories
|
|
833
|
+
// (build/xcframeworks, autolinked, build/generated/ios) may not exist yet.
|
|
834
|
+
// Xcode resolves packages before any build phase runs, so we write minimal
|
|
835
|
+
// stub Package.swift files to let resolution succeed. The real generators
|
|
836
|
+
// (sync-spm-autolinking.js) overwrite these during the first build.
|
|
837
|
+
|
|
838
|
+
/*::
|
|
839
|
+
type StubPackageDef = {
|
|
840
|
+
packageName: string,
|
|
841
|
+
products: Array<string>,
|
|
842
|
+
};
|
|
843
|
+
*/
|
|
844
|
+
|
|
845
|
+
function generateStubPackageSwift(def /*: StubPackageDef */) /*: string */ {
|
|
846
|
+
const {packageName, products} = def;
|
|
847
|
+
const stubTarget = `${packageName.replace(/[^a-zA-Z0-9]/g, '')}Stub`;
|
|
848
|
+
const productLines = products
|
|
849
|
+
.map(p => ` .library(name: "${p}", targets: ["${stubTarget}"]),`)
|
|
850
|
+
.join('\n');
|
|
851
|
+
return `// swift-tools-version: 5.9
|
|
852
|
+
// GENERATED STUB — will be overwritten by sync-spm-autolinking.js during build.
|
|
853
|
+
import PackageDescription
|
|
854
|
+
|
|
855
|
+
let package = Package(
|
|
856
|
+
name: "${packageName}",
|
|
857
|
+
products: [
|
|
858
|
+
${productLines}
|
|
859
|
+
],
|
|
860
|
+
targets: [
|
|
861
|
+
.target(name: "${stubTarget}", path: "_stub", sources: ["Stub.swift"]),
|
|
862
|
+
]
|
|
863
|
+
)
|
|
864
|
+
`;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* Ensures each referenced SPM sub-package directory has a valid Package.swift
|
|
869
|
+
* so Xcode can resolve packages before any build phase runs.
|
|
870
|
+
* Skips directories that already contain a Package.swift (from a previous build).
|
|
871
|
+
*/
|
|
872
|
+
function ensureStubPackages(appRoot /*: string */) /*: void */ {
|
|
873
|
+
// Derive stub definitions from SPM_PRODUCT_PACKAGES
|
|
874
|
+
const byPath = new Map /*:: <string, StubPackageDef> */();
|
|
875
|
+
for (const entry of SPM_PRODUCT_PACKAGES) {
|
|
876
|
+
const existing = byPath.get(entry.packagePath);
|
|
877
|
+
if (existing != null) {
|
|
878
|
+
existing.products.push(entry.product);
|
|
879
|
+
} else {
|
|
880
|
+
byPath.set(entry.packagePath, {
|
|
881
|
+
packageName: entry.packageName,
|
|
882
|
+
products: [entry.product],
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
for (const [relPath, def] of byPath) {
|
|
888
|
+
const pkgDir = path.join(appRoot, relPath);
|
|
889
|
+
const pkgSwiftPath = path.join(pkgDir, 'Package.swift');
|
|
890
|
+
|
|
891
|
+
if (fs.existsSync(pkgSwiftPath)) {
|
|
892
|
+
continue;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
fs.mkdirSync(pkgDir, {recursive: true});
|
|
896
|
+
fs.writeFileSync(pkgSwiftPath, generateStubPackageSwift(def), 'utf8');
|
|
897
|
+
|
|
898
|
+
// Create minimal stub source file required by SPM
|
|
899
|
+
const stubDir = path.join(pkgDir, '_stub');
|
|
900
|
+
fs.mkdirSync(stubDir, {recursive: true});
|
|
901
|
+
const stubSwift = path.join(stubDir, 'Stub.swift');
|
|
902
|
+
if (!fs.existsSync(stubSwift)) {
|
|
903
|
+
fs.writeFileSync(
|
|
904
|
+
stubSwift,
|
|
905
|
+
'// Placeholder — replaced during first build.\n',
|
|
906
|
+
'utf8',
|
|
907
|
+
);
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
log(`Wrote stub Package.swift: ${relPath}/Package.swift`);
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
// ---------------------------------------------------------------------------
|
|
915
|
+
// In-place injection: add SPM packages to a user's EXISTING xcodeproj.
|
|
916
|
+
//
|
|
917
|
+
// This never creates a target or scans sources — it splices the SPM dependency
|
|
918
|
+
// graph, the React build settings, and the sync build phase / scheme pre-action
|
|
919
|
+
// into the project the user already owns, leaving everything else
|
|
920
|
+
// byte-identical. The whole `spm add` / `spm update` xcodeproj strategy, so
|
|
921
|
+
// hand-tuned signing / capabilities / extra targets survive. Fails loud (the
|
|
922
|
+
// caller surfaces the error) when the project is CocoaPods-integrated or its
|
|
923
|
+
// shape can't be safely anchored.
|
|
924
|
+
// ---------------------------------------------------------------------------
|
|
925
|
+
|
|
926
|
+
// The React build settings the app target needs to compile against the SPM
|
|
927
|
+
// products.
|
|
928
|
+
const INJECTED_ARRAY_SETTINGS = [
|
|
929
|
+
{
|
|
930
|
+
key: 'HEADER_SEARCH_PATHS',
|
|
931
|
+
values: ['"$(SRCROOT)/build/generated/autolinking/headers"'],
|
|
932
|
+
},
|
|
933
|
+
];
|
|
934
|
+
|
|
935
|
+
/** The XCBuildConfiguration UUIDs of a target (via its buildConfigurationList). */
|
|
936
|
+
function targetBuildConfigUuids(
|
|
937
|
+
text /*: string */,
|
|
938
|
+
targetObj /*: {bodyOpen: number, bodyClose: number, ...} */,
|
|
939
|
+
) /*: Array<string> */ {
|
|
940
|
+
const listField = findField(text, targetObj, 'buildConfigurationList');
|
|
941
|
+
if (listField == null) {
|
|
942
|
+
return [];
|
|
943
|
+
}
|
|
944
|
+
const listMatch = listField.value.match(/[0-9A-Fa-f]{24}/);
|
|
945
|
+
if (listMatch == null) {
|
|
946
|
+
return [];
|
|
947
|
+
}
|
|
948
|
+
const listObj = findObjectByUuid(text, listMatch[0]);
|
|
949
|
+
if (listObj == null) {
|
|
950
|
+
return [];
|
|
951
|
+
}
|
|
952
|
+
const configs = findField(text, listObj, 'buildConfigurations');
|
|
953
|
+
if (configs == null) {
|
|
954
|
+
return [];
|
|
955
|
+
}
|
|
956
|
+
const matches = configs.value.match(/[0-9A-Fa-f]{24}/g);
|
|
957
|
+
return matches != null ? Array.from(matches) : [];
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
/** True when a build config layers a CocoaPods `Pods-*.xcconfig`. */
|
|
961
|
+
function configUsesPods(
|
|
962
|
+
text /*: string */,
|
|
963
|
+
configUuid /*: string */,
|
|
964
|
+
) /*: boolean */ {
|
|
965
|
+
const obj = findObjectByUuid(text, configUuid);
|
|
966
|
+
if (obj == null) {
|
|
967
|
+
return false;
|
|
968
|
+
}
|
|
969
|
+
const base = findField(text, obj, 'baseConfigurationReference');
|
|
970
|
+
return base != null && /Pods[-/]/.test(base.value);
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
/**
|
|
974
|
+
* Inspect an existing pbxproj and decide whether it can be injected. Returns
|
|
975
|
+
* the chosen app target + its config/frameworks anchors, or a refusal reason
|
|
976
|
+
* the caller surfaces (fail-loud).
|
|
977
|
+
*/
|
|
978
|
+
function planInjection(text /*: string */, opts /*: {appName?: ?string} */) /*:
|
|
979
|
+
| {ok: true, rootUuid: string, target: {uuid: string, name: string, bodyOpen: number, bodyClose: number}, configUuids: Array<string>, frameworksPhaseUuid: string, sourcesPhaseUuid: ?string}
|
|
980
|
+
| {ok: false, reason: string} */ {
|
|
981
|
+
const project = findProjectObject(text);
|
|
982
|
+
if (project == null) {
|
|
983
|
+
return {ok: false, reason: 'no PBXProject object found'};
|
|
984
|
+
}
|
|
985
|
+
const apps = findApplicationTargets(text);
|
|
986
|
+
if (apps.length === 0) {
|
|
987
|
+
return {ok: false, reason: 'no application target found'};
|
|
988
|
+
}
|
|
989
|
+
let target;
|
|
990
|
+
if (apps.length === 1) {
|
|
991
|
+
target = apps[0];
|
|
992
|
+
} else {
|
|
993
|
+
const appName = opts.appName;
|
|
994
|
+
if (appName == null) {
|
|
995
|
+
return {
|
|
996
|
+
ok: false,
|
|
997
|
+
reason: `multiple application targets (${apps
|
|
998
|
+
.map(a => a.name)
|
|
999
|
+
.join(', ')}); pass --app-name to disambiguate`,
|
|
1000
|
+
};
|
|
1001
|
+
}
|
|
1002
|
+
target = apps.find(a => a.name === appName);
|
|
1003
|
+
if (target == null) {
|
|
1004
|
+
return {
|
|
1005
|
+
ok: false,
|
|
1006
|
+
reason: `no application target named "${appName}"`,
|
|
1007
|
+
};
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
const configUuids = targetBuildConfigUuids(text, target);
|
|
1011
|
+
if (configUuids.length === 0) {
|
|
1012
|
+
return {ok: false, reason: 'could not resolve target build configurations'};
|
|
1013
|
+
}
|
|
1014
|
+
if (configUuids.some(c => configUsesPods(text, c))) {
|
|
1015
|
+
return {
|
|
1016
|
+
ok: false,
|
|
1017
|
+
reason:
|
|
1018
|
+
'target uses CocoaPods (Pods-*.xcconfig) — in-place injection only ' +
|
|
1019
|
+
'supports SPM-only targets',
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
// The target's own Frameworks build phase (where product build files link).
|
|
1023
|
+
const buildPhases = findField(text, target, 'buildPhases');
|
|
1024
|
+
const phaseUuids =
|
|
1025
|
+
buildPhases != null
|
|
1026
|
+
? (buildPhases.value.match(/[0-9A-Fa-f]{24}/g) ?? [])
|
|
1027
|
+
: [];
|
|
1028
|
+
let frameworksPhaseUuid = null;
|
|
1029
|
+
// Also capture the Sources phase — plugin generated sources compile into it
|
|
1030
|
+
// (see injectSpmIntoPbxproj step 8). Nullable: a target may legitimately
|
|
1031
|
+
// lack one, in which case generated-source wiring is skipped (not fatal).
|
|
1032
|
+
let sourcesPhaseUuid = null;
|
|
1033
|
+
for (const pu of phaseUuids) {
|
|
1034
|
+
const po = findObjectByUuid(text, pu);
|
|
1035
|
+
if (po == null) {
|
|
1036
|
+
continue;
|
|
1037
|
+
}
|
|
1038
|
+
const isa = findField(text, po, 'isa');
|
|
1039
|
+
if (isa == null) {
|
|
1040
|
+
continue;
|
|
1041
|
+
}
|
|
1042
|
+
if (
|
|
1043
|
+
frameworksPhaseUuid == null &&
|
|
1044
|
+
/PBXFrameworksBuildPhase/.test(isa.value)
|
|
1045
|
+
) {
|
|
1046
|
+
frameworksPhaseUuid = pu;
|
|
1047
|
+
} else if (
|
|
1048
|
+
sourcesPhaseUuid == null &&
|
|
1049
|
+
/PBXSourcesBuildPhase/.test(isa.value)
|
|
1050
|
+
) {
|
|
1051
|
+
sourcesPhaseUuid = pu;
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
if (frameworksPhaseUuid == null) {
|
|
1055
|
+
return {ok: false, reason: 'target has no Frameworks build phase'};
|
|
1056
|
+
}
|
|
1057
|
+
return {
|
|
1058
|
+
ok: true,
|
|
1059
|
+
rootUuid: project.uuid,
|
|
1060
|
+
target,
|
|
1061
|
+
configUuids,
|
|
1062
|
+
frameworksPhaseUuid,
|
|
1063
|
+
sourcesPhaseUuid,
|
|
1064
|
+
};
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
/**
|
|
1068
|
+
* Splice the SPM dependency graph + React build settings + sync build phase
|
|
1069
|
+
* into `text` and return the modified pbxproj. Pure string transform (no I/O),
|
|
1070
|
+
* idempotent: objects already present (by UUID) and array members / settings
|
|
1071
|
+
* already applied are skipped, so a second run is a no-op.
|
|
1072
|
+
*/
|
|
1073
|
+
function injectSpmIntoPbxproj(
|
|
1074
|
+
input /*: string */,
|
|
1075
|
+
plan /*: {rootUuid: string, targetUuid: string, configUuids: Array<string>, frameworksPhaseUuid: string, sourcesPhaseUuid?: ?string} */,
|
|
1076
|
+
reactNativePath /*: string */,
|
|
1077
|
+
remote /*: ?RemoteCfg */,
|
|
1078
|
+
hermesCliPath /*: ?string */ = null,
|
|
1079
|
+
generatedSources /*: ReadonlyArray<GeneratedSource> */ = [],
|
|
1080
|
+
flavoredFrameworks /*: ReadonlyArray<FlavoredFrameworkManifestEntry> */ = [],
|
|
1081
|
+
) /*: {text: string, injectedUuids: Array<string>, createdArrayFields: Array<{container: 'project' | 'target', key: string}>, buildSettingChanges: Array<BuildSettingChange>, generatedSourceUuids: {[string]: Array<string>}} */ {
|
|
1082
|
+
let text = input;
|
|
1083
|
+
const mkUuid = (section /*: string */, id /*: string */) =>
|
|
1084
|
+
namespacedUUID(plan.rootUuid, section, id);
|
|
1085
|
+
const graph = buildSpmDependencyGraph(mkUuid, remote);
|
|
1086
|
+
const entries = spmGraphToEntries(graph);
|
|
1087
|
+
const injectedUuids /*: Array<string> */ = [];
|
|
1088
|
+
|
|
1089
|
+
// 1. Insert the new objects (skip any UUID already present — idempotency).
|
|
1090
|
+
const insertObjects = (
|
|
1091
|
+
sectionName /*: string */,
|
|
1092
|
+
objs /*: ReadonlyArray<{readonly uuid: string, readonly comment?: ?string, readonly fields: {readonly [string]: string}, ...}> */,
|
|
1093
|
+
) => {
|
|
1094
|
+
const fresh = objs.filter(o => !text.includes(o.uuid));
|
|
1095
|
+
for (const o of objs) {
|
|
1096
|
+
injectedUuids.push(o.uuid);
|
|
1097
|
+
}
|
|
1098
|
+
if (fresh.length === 0) {
|
|
1099
|
+
return;
|
|
1100
|
+
}
|
|
1101
|
+
text = insertObjectsIntoSection(
|
|
1102
|
+
text,
|
|
1103
|
+
sectionName,
|
|
1104
|
+
fresh.map(serializeEntry).join('\n'),
|
|
1105
|
+
);
|
|
1106
|
+
};
|
|
1107
|
+
insertObjects('XCLocalSwiftPackageReference', entries.localRefs);
|
|
1108
|
+
if (entries.remoteRef != null) {
|
|
1109
|
+
insertObjects('XCRemoteSwiftPackageReference', [entries.remoteRef]);
|
|
1110
|
+
}
|
|
1111
|
+
insertObjects('XCSwiftPackageProductDependency', entries.productDeps);
|
|
1112
|
+
insertObjects('PBXBuildFile', entries.buildFiles);
|
|
1113
|
+
|
|
1114
|
+
// Track array fields we CREATE (vs. append to a pre-existing one) so deinit
|
|
1115
|
+
// can remove the whole field and land byte-identical to the original.
|
|
1116
|
+
const createdArrayFields /*: Array<{container: 'project' | 'target', key: string}> */ =
|
|
1117
|
+
[];
|
|
1118
|
+
|
|
1119
|
+
// 2. packageReferences on the PBXProject.
|
|
1120
|
+
const pkgRefMembers = [
|
|
1121
|
+
...(graph.remotePkgRef != null
|
|
1122
|
+
? [{uuid: graph.remotePkgRef.uuid, comment: graph.remotePkgRef.comment}]
|
|
1123
|
+
: []),
|
|
1124
|
+
...graph.localPkgRefs.map(r => ({uuid: r.uuid, comment: r.comment})),
|
|
1125
|
+
];
|
|
1126
|
+
const project = findProjectObject(text);
|
|
1127
|
+
if (project != null) {
|
|
1128
|
+
if (findField(text, project, 'packageReferences') == null) {
|
|
1129
|
+
createdArrayFields.push({container: 'project', key: 'packageReferences'});
|
|
1130
|
+
}
|
|
1131
|
+
text = addArrayMembers(text, project, 'packageReferences', pkgRefMembers);
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
// 3. packageProductDependencies on the app target.
|
|
1135
|
+
const productMembers = graph.products.map(p => ({
|
|
1136
|
+
uuid: p.depUuid,
|
|
1137
|
+
comment: p.product,
|
|
1138
|
+
}));
|
|
1139
|
+
if (
|
|
1140
|
+
findField(
|
|
1141
|
+
text,
|
|
1142
|
+
findApplicationTargetByUuid(text, plan.targetUuid),
|
|
1143
|
+
'packageProductDependencies',
|
|
1144
|
+
) == null
|
|
1145
|
+
) {
|
|
1146
|
+
createdArrayFields.push({
|
|
1147
|
+
container: 'target',
|
|
1148
|
+
key: 'packageProductDependencies',
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
1151
|
+
text = addArrayMembers(
|
|
1152
|
+
text,
|
|
1153
|
+
findApplicationTargetByUuid(text, plan.targetUuid),
|
|
1154
|
+
'packageProductDependencies',
|
|
1155
|
+
productMembers,
|
|
1156
|
+
);
|
|
1157
|
+
|
|
1158
|
+
// 4. product build files into the target's Frameworks phase.
|
|
1159
|
+
const phase = findObjectByUuid(text, plan.frameworksPhaseUuid);
|
|
1160
|
+
if (phase != null) {
|
|
1161
|
+
text = addArrayMembers(
|
|
1162
|
+
text,
|
|
1163
|
+
phase,
|
|
1164
|
+
'files',
|
|
1165
|
+
graph.products.map(p => ({
|
|
1166
|
+
uuid: p.buildFileUuid,
|
|
1167
|
+
comment: `${p.product} in Frameworks`,
|
|
1168
|
+
})),
|
|
1169
|
+
);
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
// 5. React build settings into every build config (Debug + Release).
|
|
1173
|
+
const buildSettingChanges /*: Array<BuildSettingChange> */ = [];
|
|
1174
|
+
for (const configUuid of plan.configUuids) {
|
|
1175
|
+
const merged = mergeReactBuildSettings(
|
|
1176
|
+
text,
|
|
1177
|
+
configUuid,
|
|
1178
|
+
buildConfigurationName(text, configUuid),
|
|
1179
|
+
reactNativePath,
|
|
1180
|
+
hermesCliPath,
|
|
1181
|
+
flavoredFrameworks,
|
|
1182
|
+
);
|
|
1183
|
+
text = merged.text;
|
|
1184
|
+
buildSettingChanges.push(merged.change);
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
// 6. The Sync SPM Autolinking build phase (safety net; the scheme pre-action
|
|
1188
|
+
// is what fires before SPM resolution). Prepended so it runs before
|
|
1189
|
+
// Sources. We do NOT add a JS-bundle phase — an existing app already
|
|
1190
|
+
// bundles JS via its own phase.
|
|
1191
|
+
const syncScript = buildSyncAutolinkingScript(reactNativePath);
|
|
1192
|
+
const syncPhaseUuid = mkUuid('PBXShellScriptBuildPhase', 'SyncAutolinking');
|
|
1193
|
+
if (!text.includes(syncPhaseUuid)) {
|
|
1194
|
+
text = insertObjectsIntoSection(
|
|
1195
|
+
text,
|
|
1196
|
+
'PBXShellScriptBuildPhase',
|
|
1197
|
+
serializeEntry(
|
|
1198
|
+
shellScriptPhase(syncPhaseUuid, 'Sync SPM Autolinking', syncScript),
|
|
1199
|
+
),
|
|
1200
|
+
);
|
|
1201
|
+
} else {
|
|
1202
|
+
// Already injected on a prior run — the phase object owns its
|
|
1203
|
+
// shellScript, so refresh it in place (same quoting used at creation) in
|
|
1204
|
+
// case the generated script changed since. Byte-identical when it
|
|
1205
|
+
// didn't; field order and every other byte of the phase are untouched.
|
|
1206
|
+
const existingPhase = findObjectByUuid(text, syncPhaseUuid);
|
|
1207
|
+
if (existingPhase != null) {
|
|
1208
|
+
text = setScalarField(
|
|
1209
|
+
text,
|
|
1210
|
+
existingPhase,
|
|
1211
|
+
'shellScript',
|
|
1212
|
+
quoteIfNeeded(syncScript),
|
|
1213
|
+
);
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
injectedUuids.push(syncPhaseUuid);
|
|
1217
|
+
text = addArrayMembers(
|
|
1218
|
+
text,
|
|
1219
|
+
findApplicationTargetByUuid(text, plan.targetUuid),
|
|
1220
|
+
'buildPhases',
|
|
1221
|
+
[{uuid: syncPhaseUuid, comment: 'Sync SPM Autolinking'}],
|
|
1222
|
+
{prepend: true},
|
|
1223
|
+
);
|
|
1224
|
+
|
|
1225
|
+
// 7. The sole writer of flavored frameworks under the final app bundle.
|
|
1226
|
+
// SwiftPM owns only invariant header/source products, so no implicit SPM
|
|
1227
|
+
// embed task competes with this phase.
|
|
1228
|
+
const embedPhaseUuid = mkUuid(
|
|
1229
|
+
'PBXShellScriptBuildPhase',
|
|
1230
|
+
'EmbedFlavoredFrameworks',
|
|
1231
|
+
);
|
|
1232
|
+
const embedScript = buildEmbedFrameworksScript(flavoredFrameworks);
|
|
1233
|
+
const embedInputs = [
|
|
1234
|
+
'$(SRCROOT)/build/xcframeworks/.artifact-stamp',
|
|
1235
|
+
...flavoredFrameworks.map(
|
|
1236
|
+
framework => `$(${frameworkSettingPrefix(framework.id)}_FRAMEWORK)`,
|
|
1237
|
+
),
|
|
1238
|
+
];
|
|
1239
|
+
const embedOutputs = flavoredFrameworks.map(
|
|
1240
|
+
framework =>
|
|
1241
|
+
`$(TARGET_BUILD_DIR)/$(FRAMEWORKS_FOLDER_PATH)/${framework.frameworkName}.framework`,
|
|
1242
|
+
);
|
|
1243
|
+
const embedEntry = shellScriptPhase(
|
|
1244
|
+
embedPhaseUuid,
|
|
1245
|
+
'Embed React Native Flavored Frameworks',
|
|
1246
|
+
embedScript,
|
|
1247
|
+
{
|
|
1248
|
+
inputPaths: pbxPathList(embedInputs),
|
|
1249
|
+
outputPaths: pbxPathList(embedOutputs),
|
|
1250
|
+
},
|
|
1251
|
+
);
|
|
1252
|
+
if (!text.includes(embedPhaseUuid)) {
|
|
1253
|
+
text = insertObjectsIntoSection(
|
|
1254
|
+
text,
|
|
1255
|
+
'PBXShellScriptBuildPhase',
|
|
1256
|
+
serializeEntry(embedEntry),
|
|
1257
|
+
);
|
|
1258
|
+
} else {
|
|
1259
|
+
const existingPhase = findObjectByUuid(text, embedPhaseUuid);
|
|
1260
|
+
if (existingPhase != null) {
|
|
1261
|
+
for (const key of ['shellScript', 'inputPaths', 'outputPaths']) {
|
|
1262
|
+
const current = findObjectByUuid(text, embedPhaseUuid);
|
|
1263
|
+
if (current != null) {
|
|
1264
|
+
text = setScalarField(text, current, key, embedEntry.fields[key]);
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
injectedUuids.push(embedPhaseUuid);
|
|
1270
|
+
text = addBuildPhaseAfter(
|
|
1271
|
+
text,
|
|
1272
|
+
findApplicationTargetByUuid(text, plan.targetUuid),
|
|
1273
|
+
plan.frameworksPhaseUuid,
|
|
1274
|
+
{
|
|
1275
|
+
uuid: embedPhaseUuid,
|
|
1276
|
+
comment: 'Embed React Native Flavored Frameworks',
|
|
1277
|
+
},
|
|
1278
|
+
);
|
|
1279
|
+
|
|
1280
|
+
// 8. Plugin generated sources compiled INTO THE APP TARGET (e.g. Expo's
|
|
1281
|
+
// ExpoModulesProvider.swift). An `@objc` class only reaches the ObjC
|
|
1282
|
+
// classlist — required for NSClassFromString discovery — when it compiles
|
|
1283
|
+
// into the app target, not the static Autolinked aggregate. Each source
|
|
1284
|
+
// gets a PBXFileReference + PBXBuildFile + a Sources-phase entry, parented
|
|
1285
|
+
// under a single "SPM Generated Sources" group. Every UUID is keyed on the
|
|
1286
|
+
// normalized path (deterministic → idempotent) and recorded so `deinit`
|
|
1287
|
+
// reverts it and `update` reconciles it (removal is done by the caller,
|
|
1288
|
+
// which owns the prior marker; emission here is purely additive).
|
|
1289
|
+
const generatedSourceUuids /*: {[string]: Array<string>} */ = {};
|
|
1290
|
+
const sourcesPhaseUuid = plan.sourcesPhaseUuid;
|
|
1291
|
+
if (generatedSources.length > 0) {
|
|
1292
|
+
if (sourcesPhaseUuid == null) {
|
|
1293
|
+
log(
|
|
1294
|
+
'warning: the app target has no Sources build phase — cannot compile ' +
|
|
1295
|
+
`${generatedSources.length} SPM plugin generated source(s) into the ` +
|
|
1296
|
+
'app target; skipping. Any @objc classes they define will not be ' +
|
|
1297
|
+
'discoverable via NSClassFromString.',
|
|
1298
|
+
);
|
|
1299
|
+
} else {
|
|
1300
|
+
const fileRefs = [];
|
|
1301
|
+
const buildFiles = [];
|
|
1302
|
+
const sourcesMembers = [];
|
|
1303
|
+
const groupChildren = [];
|
|
1304
|
+
for (const src of generatedSources) {
|
|
1305
|
+
const fileRefUuid = mkUuid('PBXFileReference', `gensrc:${src.path}`);
|
|
1306
|
+
const buildFileUuid = mkUuid('PBXBuildFile', `gensrc:${src.path}`);
|
|
1307
|
+
generatedSourceUuids[src.path] = [fileRefUuid, buildFileUuid];
|
|
1308
|
+
fileRefs.push({
|
|
1309
|
+
uuid: fileRefUuid,
|
|
1310
|
+
comment: src.name,
|
|
1311
|
+
fields: {
|
|
1312
|
+
isa: 'PBXFileReference',
|
|
1313
|
+
lastKnownFileType: src.fileType,
|
|
1314
|
+
name: quoteIfNeeded(src.name),
|
|
1315
|
+
path: quoteIfNeeded(src.path),
|
|
1316
|
+
sourceTree: src.sourceTree,
|
|
1317
|
+
},
|
|
1318
|
+
});
|
|
1319
|
+
buildFiles.push({
|
|
1320
|
+
uuid: buildFileUuid,
|
|
1321
|
+
comment: `${src.name} in Sources`,
|
|
1322
|
+
fields: {
|
|
1323
|
+
isa: 'PBXBuildFile',
|
|
1324
|
+
fileRef: `${fileRefUuid} /* ${src.name} */`,
|
|
1325
|
+
},
|
|
1326
|
+
});
|
|
1327
|
+
sourcesMembers.push({
|
|
1328
|
+
uuid: buildFileUuid,
|
|
1329
|
+
comment: `${src.name} in Sources`,
|
|
1330
|
+
});
|
|
1331
|
+
groupChildren.push({uuid: fileRefUuid, comment: src.name});
|
|
1332
|
+
}
|
|
1333
|
+
insertObjects('PBXFileReference', fileRefs);
|
|
1334
|
+
insertObjects('PBXBuildFile', buildFiles);
|
|
1335
|
+
|
|
1336
|
+
// Compile membership — the actual reason these are wired into the app.
|
|
1337
|
+
const sourcesPhase = findObjectByUuid(text, sourcesPhaseUuid);
|
|
1338
|
+
if (sourcesPhase != null) {
|
|
1339
|
+
text = addArrayMembers(text, sourcesPhase, 'files', sourcesMembers);
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
// The "SPM Generated Sources" group (created on first use, then reused).
|
|
1343
|
+
// Insert with empty children so the ONE population path (addArrayMembers)
|
|
1344
|
+
// handles both create and reconcile, keeping formatting identical.
|
|
1345
|
+
const groupUuid = mkUuid('PBXGroup', SPM_GENERATED_SOURCES_GROUP_ID);
|
|
1346
|
+
if (!text.includes(groupUuid)) {
|
|
1347
|
+
text = insertObjectsIntoSection(
|
|
1348
|
+
text,
|
|
1349
|
+
'PBXGroup',
|
|
1350
|
+
serializeEntry({
|
|
1351
|
+
uuid: groupUuid,
|
|
1352
|
+
comment: SPM_GENERATED_SOURCES_GROUP_NAME,
|
|
1353
|
+
fields: {
|
|
1354
|
+
isa: 'PBXGroup',
|
|
1355
|
+
children: '(\n\t\t\t)',
|
|
1356
|
+
name: quoteIfNeeded(SPM_GENERATED_SOURCES_GROUP_NAME),
|
|
1357
|
+
sourceTree: '"<group>"',
|
|
1358
|
+
},
|
|
1359
|
+
}),
|
|
1360
|
+
);
|
|
1361
|
+
}
|
|
1362
|
+
injectedUuids.push(groupUuid);
|
|
1363
|
+
const groupObj = findObjectByUuid(text, groupUuid);
|
|
1364
|
+
if (groupObj != null) {
|
|
1365
|
+
text = addArrayMembers(text, groupObj, 'children', groupChildren);
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
// Parent the group under the project's main group (idempotent). Appends
|
|
1369
|
+
// to a pre-existing children array, so no createdArrayField is recorded —
|
|
1370
|
+
// deinit removes the group's membership via removeArrayMembersByUuid and
|
|
1371
|
+
// the group object itself via removeObjectByUuid (groupUuid is injected).
|
|
1372
|
+
const proj = findProjectObject(text);
|
|
1373
|
+
const mainGroupField =
|
|
1374
|
+
proj != null ? findField(text, proj, 'mainGroup') : null;
|
|
1375
|
+
const mainGroupMatch =
|
|
1376
|
+
mainGroupField != null
|
|
1377
|
+
? mainGroupField.value.match(/[0-9A-Fa-f]{24}/)
|
|
1378
|
+
: null;
|
|
1379
|
+
const mainGroupObj =
|
|
1380
|
+
mainGroupMatch != null
|
|
1381
|
+
? findObjectByUuid(text, mainGroupMatch[0])
|
|
1382
|
+
: null;
|
|
1383
|
+
if (mainGroupObj != null) {
|
|
1384
|
+
text = addArrayMembers(text, mainGroupObj, 'children', [
|
|
1385
|
+
{uuid: groupUuid, comment: SPM_GENERATED_SOURCES_GROUP_NAME},
|
|
1386
|
+
]);
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
return {
|
|
1392
|
+
text,
|
|
1393
|
+
injectedUuids,
|
|
1394
|
+
createdArrayFields,
|
|
1395
|
+
buildSettingChanges,
|
|
1396
|
+
generatedSourceUuids,
|
|
1397
|
+
};
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
/** Re-locate an application target by UUID against the current text. */
|
|
1401
|
+
function findApplicationTargetByUuid(
|
|
1402
|
+
text /*: string */,
|
|
1403
|
+
targetUuid /*: string */,
|
|
1404
|
+
) /*: {uuid: string, bodyOpen: number, bodyClose: number} */ {
|
|
1405
|
+
const obj = findObjectByUuid(text, targetUuid);
|
|
1406
|
+
if (obj == null) {
|
|
1407
|
+
throw new Error(`pbxproj: app target ${targetUuid} disappeared mid-edit`);
|
|
1408
|
+
}
|
|
1409
|
+
return obj;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
/**
|
|
1413
|
+
* Merge the React build settings into one XCBuildConfiguration's dict. Returns
|
|
1414
|
+
* the modified text plus a precise record of what was actually added — so
|
|
1415
|
+
* `deinit` (removeSpmInjection) can reverse exactly these edits, never touching
|
|
1416
|
+
* a value the user already had (key insight: ensureScalarField/
|
|
1417
|
+
* addArrayStringValues are no-ops / dedupe when a value is already present).
|
|
1418
|
+
*/
|
|
1419
|
+
/**
|
|
1420
|
+
* Resolves the host `hermesc` from the `hermes-compiler` npm package and returns
|
|
1421
|
+
* its ABSOLUTE path as the HERMES_CLI_PATH value, or null when it can't be found
|
|
1422
|
+
* (e.g. USE_HERMES=false apps without the package). require.resolve (anchored at
|
|
1423
|
+
* reactNativeRoot) follows Node's lookup, so a hoisted monorepo layout — where
|
|
1424
|
+
* hermes-compiler sits in the workspace-root node_modules, NOT next to
|
|
1425
|
+
* react-native — resolves correctly.
|
|
1426
|
+
*
|
|
1427
|
+
* The value is intentionally ABSOLUTE, not `$(REACT_NATIVE_PATH)/../...`: when
|
|
1428
|
+
* react-native is a symlink (the monorepo default, and common in real apps), a
|
|
1429
|
+
* `..` after it resolves — kernel-side — to the symlink TARGET's parent, not the
|
|
1430
|
+
* node_modules dir, so the relative form points at a non-existent
|
|
1431
|
+
* `<rn-target>/../hermes-compiler`. An absolute path sidesteps that entirely
|
|
1432
|
+
* (and matches how the CocoaPods hermes-engine pod sets HERMES_CLI_PATH). It is
|
|
1433
|
+
* regenerated on every `spm add`, so machine-specificity is a non-issue.
|
|
1434
|
+
*/
|
|
1435
|
+
function resolveHermesCliPathSetting(
|
|
1436
|
+
reactNativeRoot /*: string */,
|
|
1437
|
+
) /*: ?string */ {
|
|
1438
|
+
try {
|
|
1439
|
+
const pkg = require.resolve('hermes-compiler/package.json', {
|
|
1440
|
+
paths: [reactNativeRoot],
|
|
1441
|
+
});
|
|
1442
|
+
const hermesc = path.join(
|
|
1443
|
+
path.dirname(pkg),
|
|
1444
|
+
'hermesc',
|
|
1445
|
+
'osx-bin',
|
|
1446
|
+
'hermesc',
|
|
1447
|
+
);
|
|
1448
|
+
return fs.existsSync(hermesc) ? hermesc : null;
|
|
1449
|
+
} catch {
|
|
1450
|
+
return null;
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
function mergeReactBuildSettings(
|
|
1455
|
+
input /*: string */,
|
|
1456
|
+
configUuid /*: string */,
|
|
1457
|
+
configurationName /*: string */,
|
|
1458
|
+
reactNativePath /*: string */,
|
|
1459
|
+
hermesCliPath /*: ?string */ = null,
|
|
1460
|
+
flavoredFrameworks /*: ReadonlyArray<FlavoredFrameworkManifestEntry> */ = [],
|
|
1461
|
+
) /*: {text: string, change: BuildSettingChange} */ {
|
|
1462
|
+
let text = input;
|
|
1463
|
+
const scalars = [
|
|
1464
|
+
{key: 'CLANG_CXX_LANGUAGE_STANDARD', value: '"c++20"'},
|
|
1465
|
+
{key: 'REACT_NATIVE_PATH', value: quoteIfNeeded(reactNativePath)},
|
|
1466
|
+
// Under SwiftPM there is no hermes-engine pod, so react-native-xcode.sh's
|
|
1467
|
+
// fallback ($PODS_ROOT/hermes-engine/destroot/bin/hermesc) resolves to a
|
|
1468
|
+
// non-existent "/hermes-engine/..." and the Release JS→Hermes bundling
|
|
1469
|
+
// fails. Point HERMES_CLI_PATH at the hermes-compiler npm package's host
|
|
1470
|
+
// hermesc (an ABSOLUTE path resolved by the caller — see
|
|
1471
|
+
// resolveHermesCliPathSetting). react-native-xcode.sh honors an already-set
|
|
1472
|
+
// HERMES_CLI_PATH before its pod fallback; ensureScalarField leaves any
|
|
1473
|
+
// user-provided value untouched.
|
|
1474
|
+
...(hermesCliPath != null
|
|
1475
|
+
? [{key: 'HERMES_CLI_PATH', value: quoteIfNeeded(hermesCliPath)}]
|
|
1476
|
+
: []),
|
|
1477
|
+
];
|
|
1478
|
+
// Re-locate the buildSettings dict before each edit (offsets shift).
|
|
1479
|
+
const dict = () => {
|
|
1480
|
+
const cfg = findObjectByUuid(text, configUuid);
|
|
1481
|
+
if (cfg == null) {
|
|
1482
|
+
return null;
|
|
1483
|
+
}
|
|
1484
|
+
const bs = findField(text, cfg, 'buildSettings');
|
|
1485
|
+
if (bs == null) {
|
|
1486
|
+
return null;
|
|
1487
|
+
}
|
|
1488
|
+
return {
|
|
1489
|
+
uuid: configUuid,
|
|
1490
|
+
bodyOpen: bs.valueStart,
|
|
1491
|
+
bodyClose: bs.tokenEnd - 1,
|
|
1492
|
+
};
|
|
1493
|
+
};
|
|
1494
|
+
const createdArrayKeys /*: Array<string> */ = [];
|
|
1495
|
+
const appendedArrayValues /*: {[string]: Array<string>} */ = {};
|
|
1496
|
+
const createdScalars /*: Array<string> */ = [];
|
|
1497
|
+
const arraySettings = [
|
|
1498
|
+
...INJECTED_ARRAY_SETTINGS,
|
|
1499
|
+
...frameworkArrayBuildSettings(flavoredFrameworks),
|
|
1500
|
+
];
|
|
1501
|
+
for (const {key, values} of arraySettings) {
|
|
1502
|
+
const d = dict();
|
|
1503
|
+
if (d == null) {
|
|
1504
|
+
continue;
|
|
1505
|
+
}
|
|
1506
|
+
const existing = findField(text, d, key);
|
|
1507
|
+
if (existing == null) {
|
|
1508
|
+
createdArrayKeys.push(key);
|
|
1509
|
+
} else {
|
|
1510
|
+
const fresh = values.filter(v => !existing.value.includes(v));
|
|
1511
|
+
if (fresh.length > 0) {
|
|
1512
|
+
appendedArrayValues[key] = fresh;
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
text = addArrayStringValues(text, d, key, values);
|
|
1516
|
+
}
|
|
1517
|
+
const replacedScalars /*: {[string]: string} */ = {};
|
|
1518
|
+
for (const {key, value} of scalars) {
|
|
1519
|
+
const d = dict();
|
|
1520
|
+
if (d == null) {
|
|
1521
|
+
continue;
|
|
1522
|
+
}
|
|
1523
|
+
const existing = findField(text, d, key);
|
|
1524
|
+
if (existing == null) {
|
|
1525
|
+
createdScalars.push(key);
|
|
1526
|
+
} else if (
|
|
1527
|
+
key === 'REACT_NATIVE_PATH' &&
|
|
1528
|
+
existing.value.includes('PODS_ROOT')
|
|
1529
|
+
) {
|
|
1530
|
+
// A ${PODS_ROOT}-anchored REACT_NATIVE_PATH (the CocoaPods template
|
|
1531
|
+
// default) dangles once CocoaPods is deintegrated: PODS_ROOT resolves
|
|
1532
|
+
// empty at build time, so the Bundle React Native code and images
|
|
1533
|
+
// phase looks for "/../…/scripts/xcode/with-environment.sh". Replace
|
|
1534
|
+
// it with the SPM-computed path, recording the original for deinit.
|
|
1535
|
+
replacedScalars[key] = existing.value;
|
|
1536
|
+
text = removeField(text, d, key);
|
|
1537
|
+
const d2 = dict();
|
|
1538
|
+
if (d2 == null) {
|
|
1539
|
+
continue;
|
|
1540
|
+
}
|
|
1541
|
+
text = ensureScalarField(text, d2, key, value);
|
|
1542
|
+
continue;
|
|
1543
|
+
}
|
|
1544
|
+
text = ensureScalarField(text, d, key, value);
|
|
1545
|
+
}
|
|
1546
|
+
const ownedScalars = [
|
|
1547
|
+
{
|
|
1548
|
+
key: 'RN_SPM_FLAVOR',
|
|
1549
|
+
value: flavorForBuildConfiguration(configurationName),
|
|
1550
|
+
},
|
|
1551
|
+
...frameworkConditionalSettings(flavoredFrameworks),
|
|
1552
|
+
];
|
|
1553
|
+
for (const {key, value} of ownedScalars) {
|
|
1554
|
+
const d = dict();
|
|
1555
|
+
if (d == null) {
|
|
1556
|
+
continue;
|
|
1557
|
+
}
|
|
1558
|
+
const existing = findField(text, d, key);
|
|
1559
|
+
if (existing == null) {
|
|
1560
|
+
createdScalars.push(key);
|
|
1561
|
+
} else if (existing.value !== value) {
|
|
1562
|
+
replacedScalars[key] = existing.value;
|
|
1563
|
+
}
|
|
1564
|
+
text = setScalarField(text, d, key, value);
|
|
1565
|
+
}
|
|
1566
|
+
return {
|
|
1567
|
+
text,
|
|
1568
|
+
change: {
|
|
1569
|
+
configUuid,
|
|
1570
|
+
createdArrayKeys,
|
|
1571
|
+
appendedArrayValues,
|
|
1572
|
+
createdScalars,
|
|
1573
|
+
replacedScalars,
|
|
1574
|
+
},
|
|
1575
|
+
};
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
// Write only when content changed (avoids spurious Xcode reloads / git churn).
|
|
1579
|
+
function writeIfChanged(
|
|
1580
|
+
filePath /*: string */,
|
|
1581
|
+
content /*: string */,
|
|
1582
|
+
) /*: boolean */ {
|
|
1583
|
+
fs.mkdirSync(path.dirname(filePath), {recursive: true});
|
|
1584
|
+
try {
|
|
1585
|
+
if (fs.readFileSync(filePath, 'utf8') === content) {
|
|
1586
|
+
return false;
|
|
1587
|
+
}
|
|
1588
|
+
} catch {
|
|
1589
|
+
/* file doesn't exist yet */
|
|
1590
|
+
}
|
|
1591
|
+
fs.writeFileSync(filePath, content, 'utf8');
|
|
1592
|
+
return true;
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
/**
|
|
1596
|
+
* Add the "Sync SPM Autolinking" pre-action to an existing scheme's
|
|
1597
|
+
* BuildAction, reusing the scheme's own primary BuildableReference. Returns
|
|
1598
|
+
* the XML unchanged when the pre-action is already present.
|
|
1599
|
+
*/
|
|
1600
|
+
function addPreActionToScheme(
|
|
1601
|
+
xml /*: string */,
|
|
1602
|
+
targetUuid /*: string */,
|
|
1603
|
+
syncScript /*: string */,
|
|
1604
|
+
) /*: string */ {
|
|
1605
|
+
const titleIdx = xml.indexOf('title = "Sync SPM Autolinking"');
|
|
1606
|
+
if (titleIdx >= 0) {
|
|
1607
|
+
// Already injected on a prior run — refresh a possibly-stale scriptText
|
|
1608
|
+
// in place (same escaping used at creation) rather than leaving it
|
|
1609
|
+
// forever. Splice by index (not a regex/string replace) since the script
|
|
1610
|
+
// itself may contain `$`-sequences that String.replace's replacement-
|
|
1611
|
+
// pattern syntax would otherwise misinterpret. Byte-identical when the
|
|
1612
|
+
// script is unchanged; every other byte of the scheme is untouched.
|
|
1613
|
+
const scriptTextMarker = 'scriptText = "';
|
|
1614
|
+
const stIdx = xml.indexOf(scriptTextMarker, titleIdx);
|
|
1615
|
+
if (stIdx < 0) {
|
|
1616
|
+
return xml; // malformed — leave untouched rather than guess
|
|
1617
|
+
}
|
|
1618
|
+
const valueStart = stIdx + scriptTextMarker.length;
|
|
1619
|
+
// escapeXmlAttribute maps a literal `"` to `"`, so the attribute
|
|
1620
|
+
// value itself never contains one — the next `"` is always the closing
|
|
1621
|
+
// delimiter.
|
|
1622
|
+
const valueEnd = xml.indexOf('"', valueStart);
|
|
1623
|
+
return (
|
|
1624
|
+
xml.slice(0, valueStart) +
|
|
1625
|
+
escapeXmlAttribute(syncScript) +
|
|
1626
|
+
xml.slice(valueEnd)
|
|
1627
|
+
);
|
|
1628
|
+
}
|
|
1629
|
+
const refMatch = xml.match(
|
|
1630
|
+
new RegExp(
|
|
1631
|
+
`<BuildableReference\\b[^>]*BlueprintIdentifier = "${targetUuid}"[^>]*>`,
|
|
1632
|
+
),
|
|
1633
|
+
);
|
|
1634
|
+
const attr = (name /*: string */) => {
|
|
1635
|
+
const m =
|
|
1636
|
+
refMatch != null
|
|
1637
|
+
? refMatch[0].match(new RegExp(`${name} = "([^"]*)"`))
|
|
1638
|
+
: null;
|
|
1639
|
+
return m != null ? m[1] : '';
|
|
1640
|
+
};
|
|
1641
|
+
const cleanRef =
|
|
1642
|
+
`<BuildableReference\n` +
|
|
1643
|
+
` BuildableIdentifier = "primary"\n` +
|
|
1644
|
+
` BlueprintIdentifier = "${targetUuid}"\n` +
|
|
1645
|
+
` BuildableName = "${attr('BuildableName')}"\n` +
|
|
1646
|
+
` BlueprintName = "${attr('BlueprintName')}"\n` +
|
|
1647
|
+
` ReferencedContainer = "${attr('ReferencedContainer')}">\n` +
|
|
1648
|
+
` </BuildableReference>`;
|
|
1649
|
+
const executionAction =
|
|
1650
|
+
` <ExecutionAction\n` +
|
|
1651
|
+
` ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">\n` +
|
|
1652
|
+
` <ActionContent\n` +
|
|
1653
|
+
` title = "Sync SPM Autolinking"\n` +
|
|
1654
|
+
` scriptText = "${escapeXmlAttribute(syncScript)}">\n` +
|
|
1655
|
+
` <EnvironmentBuildable>\n` +
|
|
1656
|
+
` ${cleanRef}\n` +
|
|
1657
|
+
` </EnvironmentBuildable>\n` +
|
|
1658
|
+
` </ActionContent>\n` +
|
|
1659
|
+
` </ExecutionAction>`;
|
|
1660
|
+
|
|
1661
|
+
if (/<PreActions>/.test(xml)) {
|
|
1662
|
+
return xml.replace(
|
|
1663
|
+
'</PreActions>',
|
|
1664
|
+
`${executionAction}\n </PreActions>`,
|
|
1665
|
+
);
|
|
1666
|
+
}
|
|
1667
|
+
const openEnd = xml.indexOf('>', xml.indexOf('<BuildAction'));
|
|
1668
|
+
if (openEnd < 0) {
|
|
1669
|
+
return xml; // no BuildAction — leave the scheme untouched
|
|
1670
|
+
}
|
|
1671
|
+
const block = `\n <PreActions>\n${executionAction}\n </PreActions>`;
|
|
1672
|
+
return xml.slice(0, openEnd + 1) + block + xml.slice(openEnd + 1);
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
/**
|
|
1676
|
+
* Ensure the app target's shared scheme runs the sync pre-action before SPM
|
|
1677
|
+
* resolution. Updates the scheme that builds the target if one exists,
|
|
1678
|
+
* otherwise creates a fresh shared scheme. Returns 'updated' | 'created' |
|
|
1679
|
+
* 'unchanged'.
|
|
1680
|
+
*/
|
|
1681
|
+
function injectOrCreateScheme(
|
|
1682
|
+
xcodeprojDir /*: string */,
|
|
1683
|
+
opts /*: {appName: string, targetUuid: string, projName: string, syncScript: string} */,
|
|
1684
|
+
) /*: {status: 'updated' | 'unchanged' | 'created', file: string} */ {
|
|
1685
|
+
const schemesDir = path.join(xcodeprojDir, 'xcshareddata', 'xcschemes');
|
|
1686
|
+
let schemeFiles /*: Array<string> */ = [];
|
|
1687
|
+
try {
|
|
1688
|
+
schemeFiles = fs
|
|
1689
|
+
.readdirSync(schemesDir)
|
|
1690
|
+
.filter(f => f.endsWith('.xcscheme'));
|
|
1691
|
+
} catch {
|
|
1692
|
+
/* no shared schemes dir yet */
|
|
1693
|
+
}
|
|
1694
|
+
for (const f of schemeFiles) {
|
|
1695
|
+
const p = path.join(schemesDir, f);
|
|
1696
|
+
const xml = fs.readFileSync(p, 'utf8');
|
|
1697
|
+
if (xml.includes(`BlueprintIdentifier = "${opts.targetUuid}"`)) {
|
|
1698
|
+
const updated = addPreActionToScheme(
|
|
1699
|
+
xml,
|
|
1700
|
+
opts.targetUuid,
|
|
1701
|
+
opts.syncScript,
|
|
1702
|
+
);
|
|
1703
|
+
return {
|
|
1704
|
+
status: writeIfChanged(p, updated) ? 'updated' : 'unchanged',
|
|
1705
|
+
file: f,
|
|
1706
|
+
};
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
const file = `${opts.appName}.xcscheme`;
|
|
1710
|
+
const xml = generateXcscheme(
|
|
1711
|
+
opts.appName,
|
|
1712
|
+
opts.targetUuid,
|
|
1713
|
+
opts.projName,
|
|
1714
|
+
opts.syncScript,
|
|
1715
|
+
);
|
|
1716
|
+
writeIfChanged(path.join(schemesDir, file), xml);
|
|
1717
|
+
return {status: 'created', file};
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1720
|
+
/**
|
|
1721
|
+
* Strip the empty `Pods` group `pod deintegrate` leaves in the navigator.
|
|
1722
|
+
* Called by `add --deintegrate` after deintegration so the converted project is
|
|
1723
|
+
* visually clean. No-op when absent or when the group still has children.
|
|
1724
|
+
*/
|
|
1725
|
+
function cleanupLeftoverPodsGroup(xcodeprojPath /*: string */) /*: boolean */ {
|
|
1726
|
+
const pbxprojPath = path.join(xcodeprojPath, 'project.pbxproj');
|
|
1727
|
+
if (!fs.existsSync(pbxprojPath)) {
|
|
1728
|
+
return false;
|
|
1729
|
+
}
|
|
1730
|
+
const original = fs.readFileSync(pbxprojPath, 'utf8');
|
|
1731
|
+
const cleaned = removeEmptyPodsGroup(original);
|
|
1732
|
+
return cleaned !== original ? writeIfChanged(pbxprojPath, cleaned) : false;
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
/**
|
|
1736
|
+
* Strip the dangling `JavaScriptCore.framework` file reference the community
|
|
1737
|
+
* template has carried since RN 0.60 (navigator-only, meaningless under
|
|
1738
|
+
* Hermes) — see `removeDanglingJavaScriptCoreRef` for the full rationale and
|
|
1739
|
+
* the safety gate that leaves a still-linked reference untouched. No-op when
|
|
1740
|
+
* absent or when the pbxproj is missing.
|
|
1741
|
+
*/
|
|
1742
|
+
function cleanupDanglingJavaScriptCoreRef(
|
|
1743
|
+
xcodeprojPath /*: string */,
|
|
1744
|
+
) /*: boolean */ {
|
|
1745
|
+
const pbxprojPath = path.join(xcodeprojPath, 'project.pbxproj');
|
|
1746
|
+
if (!fs.existsSync(pbxprojPath)) {
|
|
1747
|
+
return false;
|
|
1748
|
+
}
|
|
1749
|
+
const original = fs.readFileSync(pbxprojPath, 'utf8');
|
|
1750
|
+
const cleaned = removeDanglingJavaScriptCoreRef(original);
|
|
1751
|
+
return cleaned !== original ? writeIfChanged(pbxprojPath, cleaned) : false;
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
/**
|
|
1755
|
+
* Normalize one plugin generated-source path into the fields a PBXFileReference
|
|
1756
|
+
* needs. Stores an SRCROOT-relative path (`sourceTree = SOURCE_ROOT`) when the
|
|
1757
|
+
* source lives under the app root — the typical case (build/generated/…) — and
|
|
1758
|
+
* an absolute path (`sourceTree = "<absolute>"`) otherwise. Returns null (with a
|
|
1759
|
+
* loud log) for an extension the pbxproj can't compile.
|
|
1760
|
+
*/
|
|
1761
|
+
function normalizeGeneratedSource(
|
|
1762
|
+
appRoot /*: string */,
|
|
1763
|
+
srcPath /*: string */,
|
|
1764
|
+
) /*: ?GeneratedSource */ {
|
|
1765
|
+
const ext = path.extname(srcPath).toLowerCase();
|
|
1766
|
+
const fileType = GENERATED_SOURCE_FILE_TYPES[ext];
|
|
1767
|
+
if (fileType == null) {
|
|
1768
|
+
log(
|
|
1769
|
+
`warning: unsupported generated-source extension "${ext}" for ` +
|
|
1770
|
+
`${srcPath}; skipping (SPM plugin sources must be .swift/.m/.mm).`,
|
|
1771
|
+
);
|
|
1772
|
+
return null;
|
|
1773
|
+
}
|
|
1774
|
+
const abs = path.isAbsolute(srcPath)
|
|
1775
|
+
? srcPath
|
|
1776
|
+
: path.resolve(appRoot, srcPath);
|
|
1777
|
+
const rel = path.relative(appRoot, abs);
|
|
1778
|
+
const underAppRoot =
|
|
1779
|
+
rel !== '' &&
|
|
1780
|
+
rel !== '..' &&
|
|
1781
|
+
!rel.startsWith('..' + path.sep) &&
|
|
1782
|
+
!path.isAbsolute(rel);
|
|
1783
|
+
return {
|
|
1784
|
+
path: underAppRoot ? rel : abs,
|
|
1785
|
+
name: path.basename(abs),
|
|
1786
|
+
sourceTree: underAppRoot ? 'SOURCE_ROOT' : '"<absolute>"',
|
|
1787
|
+
fileType,
|
|
1788
|
+
};
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1791
|
+
/**
|
|
1792
|
+
* Read + normalize the plugin generated-sources manifest at
|
|
1793
|
+
* `<appRoot>/build/generated/autolinking/.spm-plugin-generated-sources.json`.
|
|
1794
|
+
* Absent, empty, or malformed → `[]` (the feature stays inert for non-plugin
|
|
1795
|
+
* apps and never breaks injection). The file need not exist yet at inject time:
|
|
1796
|
+
* the build-time sync regenerates it before compile, and a PBXFileReference to a
|
|
1797
|
+
* not-yet-created path is valid.
|
|
1798
|
+
*/
|
|
1799
|
+
function readGeneratedSourcesManifest(
|
|
1800
|
+
appRoot /*: string */,
|
|
1801
|
+
) /*: Array<GeneratedSource> */ {
|
|
1802
|
+
const manifestPath = path.join(appRoot, SPM_GENERATED_SOURCES_MANIFEST);
|
|
1803
|
+
let raw /*: string */ = '';
|
|
1804
|
+
try {
|
|
1805
|
+
raw = fs.readFileSync(manifestPath, 'utf8');
|
|
1806
|
+
} catch {
|
|
1807
|
+
return [];
|
|
1808
|
+
}
|
|
1809
|
+
let entries /*: unknown */ = null;
|
|
1810
|
+
try {
|
|
1811
|
+
entries = JSON.parse(raw);
|
|
1812
|
+
} catch {
|
|
1813
|
+
log(
|
|
1814
|
+
`warning: could not parse ${SPM_GENERATED_SOURCES_MANIFEST}; ` +
|
|
1815
|
+
'skipping generated sources.',
|
|
1816
|
+
);
|
|
1817
|
+
return [];
|
|
1818
|
+
}
|
|
1819
|
+
if (!Array.isArray(entries)) {
|
|
1820
|
+
return [];
|
|
1821
|
+
}
|
|
1822
|
+
const out /*: Array<GeneratedSource> */ = [];
|
|
1823
|
+
for (const entry of entries) {
|
|
1824
|
+
if (
|
|
1825
|
+
entry == null ||
|
|
1826
|
+
typeof entry !== 'object' ||
|
|
1827
|
+
typeof entry.path !== 'string'
|
|
1828
|
+
) {
|
|
1829
|
+
continue;
|
|
1830
|
+
}
|
|
1831
|
+
const normalized = normalizeGeneratedSource(appRoot, entry.path);
|
|
1832
|
+
// Dedupe by normalized path — a duplicate manifest entry would otherwise
|
|
1833
|
+
// double-insert identical-UUID pbxproj objects.
|
|
1834
|
+
if (normalized != null && !out.some(s => s.path === normalized.path)) {
|
|
1835
|
+
out.push(normalized);
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
return out;
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
/**
|
|
1842
|
+
* Read the `.spm-injected.json` marker of a previously-injected project, or
|
|
1843
|
+
* null when absent/unreadable. Used to reconcile generated sources on `update`
|
|
1844
|
+
* and to read back a pinned `artifactsVersionOverride` (see below).
|
|
1845
|
+
*/
|
|
1846
|
+
function readMarker(
|
|
1847
|
+
xcodeprojPath /*: string */,
|
|
1848
|
+
) /*: ?{generatedSources?: {[string]: Array<string>}, artifactsVersionOverride?: ?string, configCommand?: ?Array<string>, buildSettingChanges?: Array<BuildSettingChange>, ...} */ {
|
|
1849
|
+
const markerPath = path.join(xcodeprojPath, SPM_INJECTED_MARKER);
|
|
1850
|
+
try {
|
|
1851
|
+
// $FlowFixMe[incompatible-return] JSON.parse returns any
|
|
1852
|
+
return JSON.parse(fs.readFileSync(markerPath, 'utf8'));
|
|
1853
|
+
} catch {
|
|
1854
|
+
return null;
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
|
|
1858
|
+
// Returns the `*.xcodeproj` under `appRoot` carrying a `.spm-injected.json`
|
|
1859
|
+
// marker (the user-owned project SPM packages were injected into in place),
|
|
1860
|
+
// or null when none has been injected yet. Pure fs reads — safe for the
|
|
1861
|
+
// marker readers below, and for callers that only locate the project (setup-
|
|
1862
|
+
// apple-spm.js's action defaulting and `deinit`), to call without exercising
|
|
1863
|
+
// any pbxproj-editing machinery.
|
|
1864
|
+
function findInjectedXcodeproj(appRoot /*: string */) /*: string | null */ {
|
|
1865
|
+
let entries /*: Array<{name: string, isDirectory(): boolean}> */ = [];
|
|
1866
|
+
try {
|
|
1867
|
+
// $FlowFixMe[incompatible-type] Dirent typing
|
|
1868
|
+
entries = fs.readdirSync(appRoot, {withFileTypes: true});
|
|
1869
|
+
} catch {
|
|
1870
|
+
return null;
|
|
1871
|
+
}
|
|
1872
|
+
for (const entry of entries) {
|
|
1873
|
+
if (!entry.isDirectory()) continue;
|
|
1874
|
+
// $FlowFixMe[incompatible-type] Dirent.name is string|Buffer in Flow stubs
|
|
1875
|
+
const name /*: string */ = entry.name;
|
|
1876
|
+
if (!name.endsWith('.xcodeproj')) continue;
|
|
1877
|
+
if (fs.existsSync(path.join(appRoot, name, SPM_INJECTED_MARKER))) {
|
|
1878
|
+
return path.join(appRoot, name);
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
return null;
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1884
|
+
/**
|
|
1885
|
+
* Read the `artifactsVersionOverride` a previous `spm add --version` / `spm
|
|
1886
|
+
* update --version` pinned into the injected xcodeproj's `.spm-injected.json`
|
|
1887
|
+
* marker (see the field's doc comment in injectSpmIntoExistingXcodeproj
|
|
1888
|
+
* below), or null when no project is injected yet, no override is pinned, or
|
|
1889
|
+
* the marker can't be read (never throws). Pure fs reads.
|
|
1890
|
+
*
|
|
1891
|
+
* Nothing in production calls this yet: the pin is written but never read
|
|
1892
|
+
* back, so the build-time sync (sync-spm-autolinking.js) still derives the
|
|
1893
|
+
* version from node_modules/react-native/package.json and can heal against a
|
|
1894
|
+
* different artifact slot than the explicit `--version` selected. Only the
|
|
1895
|
+
* tests cover it.
|
|
1896
|
+
*/
|
|
1897
|
+
function readArtifactsVersionOverride(appRoot /*: string */) /*: ?string */ {
|
|
1898
|
+
const xcodeprojPath = findInjectedXcodeproj(appRoot);
|
|
1899
|
+
if (xcodeprojPath == null) {
|
|
1900
|
+
return null;
|
|
1901
|
+
}
|
|
1902
|
+
const override = readMarker(xcodeprojPath)?.artifactsVersionOverride;
|
|
1903
|
+
return typeof override === 'string' && override.length > 0 ? override : null;
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
/**
|
|
1907
|
+
* Read the autolinking config command a previous `spm add`/`update` pinned into
|
|
1908
|
+
* the injected xcodeproj's `.spm-injected.json` marker, or null when nothing
|
|
1909
|
+
* usable is pinned. Pure fs reads, like readArtifactsVersionOverride above, but
|
|
1910
|
+
* this one IS wired: setup-apple-spm.js's resolveExplicitConfigCommand reads it
|
|
1911
|
+
* on add/update/scaffold and on the build-time `sync`. Re-validated through the
|
|
1912
|
+
* same parseConfigCommandJson the flag goes through, and never throws, so a
|
|
1913
|
+
* hand-edited marker degrades to the env-var/default command instead of
|
|
1914
|
+
* injecting a bogus argv into the build.
|
|
1915
|
+
*/
|
|
1916
|
+
function readPinnedConfigCommand(appRoot /*: string */) /*: ?Array<string> */ {
|
|
1917
|
+
const xcodeprojPath = findInjectedXcodeproj(appRoot);
|
|
1918
|
+
if (xcodeprojPath == null) {
|
|
1919
|
+
return null;
|
|
1920
|
+
}
|
|
1921
|
+
const pinned = readMarker(xcodeprojPath)?.configCommand;
|
|
1922
|
+
if (pinned == null) {
|
|
1923
|
+
return null;
|
|
1924
|
+
}
|
|
1925
|
+
try {
|
|
1926
|
+
return parseConfigCommandJson(JSON.stringify(pinned), SPM_INJECTED_MARKER);
|
|
1927
|
+
} catch {
|
|
1928
|
+
return null;
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
/**
|
|
1933
|
+
* Add SPM packages to a user's EXISTING xcodeproj in place. Returns
|
|
1934
|
+
* {status: 'injected', target} on success, or {status: 'refused', reason}
|
|
1935
|
+
* when the project can't be safely edited (caller surfaces it; fail-loud).
|
|
1936
|
+
*/
|
|
1937
|
+
function injectSpmIntoExistingXcodeproj(
|
|
1938
|
+
opts /*: {appRoot: string, reactNativeRoot: string, xcodeprojPath: string, appName?: ?string, artifactsVersionOverride?: ?string, configCommand?: ?Array<string>} */,
|
|
1939
|
+
) /*: {status: 'injected', target: string} | {status: 'refused', reason: string} */ {
|
|
1940
|
+
const {appRoot, reactNativeRoot, xcodeprojPath} = opts;
|
|
1941
|
+
const pbxprojPath = path.join(xcodeprojPath, 'project.pbxproj');
|
|
1942
|
+
if (!fs.existsSync(pbxprojPath)) {
|
|
1943
|
+
return {
|
|
1944
|
+
status: 'refused',
|
|
1945
|
+
reason: `no project.pbxproj at ${xcodeprojPath}`,
|
|
1946
|
+
};
|
|
1947
|
+
}
|
|
1948
|
+
const original = fs.readFileSync(pbxprojPath, 'utf8');
|
|
1949
|
+
const plan = planInjection(original, {appName: opts.appName});
|
|
1950
|
+
if (!plan.ok) {
|
|
1951
|
+
return {status: 'refused', reason: plan.reason};
|
|
1952
|
+
}
|
|
1953
|
+
const reactNativePath = path.relative(appRoot, reactNativeRoot);
|
|
1954
|
+
const remote = remotePackageConfig(appRoot);
|
|
1955
|
+
const hermesCliPath = resolveHermesCliPathSetting(reactNativeRoot);
|
|
1956
|
+
const generatedSources = readGeneratedSourcesManifest(appRoot);
|
|
1957
|
+
const flavoredFrameworks = readFlavoredFrameworksManifest(appRoot).frameworks;
|
|
1958
|
+
|
|
1959
|
+
const prevMarker = readMarker(xcodeprojPath);
|
|
1960
|
+
|
|
1961
|
+
// Reconcile generated sources injected on a PRIOR run that are no longer in
|
|
1962
|
+
// the manifest (a plugin's entry was dropped, or the plugin was removed).
|
|
1963
|
+
// Diff the marker's `generatedSources` map against the current manifest and
|
|
1964
|
+
// delete only the stale UUIDs — the additive injection below re-emits (and
|
|
1965
|
+
// idempotently skips) everything that remains, so an unchanged run stays
|
|
1966
|
+
// byte-identical. deinit needs none of this: the removed objects live in
|
|
1967
|
+
// `injectedUuids`.
|
|
1968
|
+
const prevGeneratedSources /*: {[string]: Array<string>} */ =
|
|
1969
|
+
prevMarker?.generatedSources ?? {};
|
|
1970
|
+
const currentPaths = new Set(generatedSources.map(s => s.path));
|
|
1971
|
+
const staleUuids /*: Array<string> */ = [];
|
|
1972
|
+
for (const p of Object.keys(prevGeneratedSources)) {
|
|
1973
|
+
if (!currentPaths.has(p)) {
|
|
1974
|
+
staleUuids.push(...prevGeneratedSources[p]);
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
// When the last generated source is gone, retire the now-empty group too.
|
|
1978
|
+
if (
|
|
1979
|
+
generatedSources.length === 0 &&
|
|
1980
|
+
Object.keys(prevGeneratedSources).length > 0
|
|
1981
|
+
) {
|
|
1982
|
+
staleUuids.push(
|
|
1983
|
+
namespacedUUID(plan.rootUuid, 'PBXGroup', SPM_GENERATED_SOURCES_GROUP_ID),
|
|
1984
|
+
);
|
|
1985
|
+
}
|
|
1986
|
+
// Re-apply generated settings from a clean recorded baseline. This removes
|
|
1987
|
+
// linker entries for plugin frameworks that disappeared and keeps the new
|
|
1988
|
+
// marker a complete inverse after an idempotent update.
|
|
1989
|
+
let base = removeRecordedBuildSettings(
|
|
1990
|
+
original,
|
|
1991
|
+
prevMarker?.buildSettingChanges ?? [],
|
|
1992
|
+
);
|
|
1993
|
+
if (staleUuids.length > 0) {
|
|
1994
|
+
base = removeArrayMembersByUuid(base, staleUuids);
|
|
1995
|
+
for (const u of staleUuids) {
|
|
1996
|
+
base = removeObjectByUuid(base, u);
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
const {
|
|
2001
|
+
text,
|
|
2002
|
+
injectedUuids,
|
|
2003
|
+
createdArrayFields,
|
|
2004
|
+
buildSettingChanges,
|
|
2005
|
+
generatedSourceUuids,
|
|
2006
|
+
} = injectSpmIntoPbxproj(
|
|
2007
|
+
base,
|
|
2008
|
+
{
|
|
2009
|
+
rootUuid: plan.rootUuid,
|
|
2010
|
+
targetUuid: plan.target.uuid,
|
|
2011
|
+
configUuids: plan.configUuids,
|
|
2012
|
+
frameworksPhaseUuid: plan.frameworksPhaseUuid,
|
|
2013
|
+
sourcesPhaseUuid: plan.sourcesPhaseUuid,
|
|
2014
|
+
},
|
|
2015
|
+
reactNativePath,
|
|
2016
|
+
remote,
|
|
2017
|
+
hermesCliPath,
|
|
2018
|
+
generatedSources,
|
|
2019
|
+
flavoredFrameworks,
|
|
2020
|
+
);
|
|
2021
|
+
|
|
2022
|
+
const changed = writeIfChanged(pbxprojPath, text);
|
|
2023
|
+
log(
|
|
2024
|
+
changed
|
|
2025
|
+
? `Injected SPM packages into ${path.relative(appRoot, pbxprojPath)}`
|
|
2026
|
+
: `${path.relative(appRoot, pbxprojPath)} already up to date`,
|
|
2027
|
+
);
|
|
2028
|
+
|
|
2029
|
+
const projName = path.basename(xcodeprojPath, '.xcodeproj');
|
|
2030
|
+
const schemeResult = injectOrCreateScheme(xcodeprojPath, {
|
|
2031
|
+
appName: plan.target.name,
|
|
2032
|
+
targetUuid: plan.target.uuid,
|
|
2033
|
+
projName,
|
|
2034
|
+
// The scheme pre-action is SYNC-ONLY (no flavor swap). A pre-action swap
|
|
2035
|
+
// could win its race and mask a mismatch from the in-target detector.
|
|
2036
|
+
syncScript: buildSchemePreActionScript(reactNativePath),
|
|
2037
|
+
});
|
|
2038
|
+
log(`Scheme sync pre-action: ${schemeResult.status}`);
|
|
2039
|
+
|
|
2040
|
+
// The RN version this app's xcframework artifact-cache slot should be
|
|
2041
|
+
// pinned to, when `add`/`update` was given an EXPLICIT `--version` — SETS
|
|
2042
|
+
// the pin. Omitting `--version` (opts.artifactsVersionOverride is null)
|
|
2043
|
+
// PRESERVES whatever was recorded on a prior run, since it's an
|
|
2044
|
+
// intentional pin, not something to silently re-derive from
|
|
2045
|
+
// node_modules/react-native/package.json. There is no "clear" verb yet;
|
|
2046
|
+
// `deinit` (removeSpmInjection) drops the whole marker, including this
|
|
2047
|
+
// field. Read back by readArtifactsVersionOverride (above) so the
|
|
2048
|
+
// build-time sync (sync-spm-autolinking.js) heals against the SAME slot
|
|
2049
|
+
// `add`/`update` selected, even on a version-mismatched setup.
|
|
2050
|
+
const artifactsVersionOverride =
|
|
2051
|
+
opts.artifactsVersionOverride ??
|
|
2052
|
+
prevMarker?.artifactsVersionOverride ??
|
|
2053
|
+
null;
|
|
2054
|
+
|
|
2055
|
+
// Same set-or-preserve contract as the version pin above, for the autolinking
|
|
2056
|
+
// config command `add`/`update` resolved (`--config-command` or
|
|
2057
|
+
// RCT_SPM_AUTOLINKING_CONFIG_COMMAND) — the build-time sync sees neither the
|
|
2058
|
+
// flag nor the developer's shell environment, so without the pin it
|
|
2059
|
+
// re-derives autolinking.json with the default @react-native-community/cli
|
|
2060
|
+
// command and breaks apps that replace it. Read back by
|
|
2061
|
+
// readPinnedConfigCommand (above). No "clear" verb yet either; `deinit` drops
|
|
2062
|
+
// the whole marker, this field with it.
|
|
2063
|
+
const configCommand = opts.configCommand ?? prevMarker?.configCommand ?? null;
|
|
2064
|
+
|
|
2065
|
+
// Marker: idempotency signal + the exact, reversible record of every edit so
|
|
2066
|
+
// `deinit` (removeSpmInjection) can undo precisely what was added.
|
|
2067
|
+
writeIfChanged(
|
|
2068
|
+
path.join(xcodeprojPath, SPM_INJECTED_MARKER),
|
|
2069
|
+
JSON.stringify(
|
|
2070
|
+
{
|
|
2071
|
+
rootUuid: plan.rootUuid,
|
|
2072
|
+
target: plan.target.name,
|
|
2073
|
+
targetUuid: plan.target.uuid,
|
|
2074
|
+
injectedUuids: Array.from(new Set(injectedUuids)).sort(),
|
|
2075
|
+
createdArrayFields,
|
|
2076
|
+
buildSettingChanges,
|
|
2077
|
+
// Normalized path → [fileRefUuid, buildFileUuid]. Read back on the next
|
|
2078
|
+
// `update` to reconcile away entries that left the manifest.
|
|
2079
|
+
generatedSources: generatedSourceUuids,
|
|
2080
|
+
artifactsVersionOverride,
|
|
2081
|
+
configCommand,
|
|
2082
|
+
scheme: {
|
|
2083
|
+
file: schemeResult.file,
|
|
2084
|
+
created: schemeResult.status === 'created',
|
|
2085
|
+
},
|
|
2086
|
+
},
|
|
2087
|
+
null,
|
|
2088
|
+
2,
|
|
2089
|
+
) + '\n',
|
|
2090
|
+
);
|
|
2091
|
+
|
|
2092
|
+
ensureStubPackages(appRoot);
|
|
2093
|
+
return {status: 'injected', target: plan.target.name};
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
/**
|
|
2097
|
+
* Remove the "Sync SPM Autolinking" pre-action that addPreActionToScheme added
|
|
2098
|
+
* to a scheme, and drop the `<PreActions>` wrapper if it is left empty (the
|
|
2099
|
+
* byte-identical inverse for the common case where injection created it).
|
|
2100
|
+
*/
|
|
2101
|
+
function removePreActionFromScheme(xml /*: string */) /*: string */ {
|
|
2102
|
+
const withoutAction = xml.replace(
|
|
2103
|
+
/[ \t]*<ExecutionAction\b(?:(?!<\/ExecutionAction>)[\s\S])*?title = "Sync SPM Autolinking"(?:(?!<\/ExecutionAction>)[\s\S])*?<\/ExecutionAction>\n?/,
|
|
2104
|
+
'',
|
|
2105
|
+
);
|
|
2106
|
+
return withoutAction.replace(/\n[ \t]*<PreActions>\s*<\/PreActions>/, '');
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
function removeRecordedBuildSettings(
|
|
2110
|
+
input /*: string */,
|
|
2111
|
+
changes /*: ReadonlyArray<BuildSettingChange> */,
|
|
2112
|
+
) /*: string */ {
|
|
2113
|
+
let text = input;
|
|
2114
|
+
for (const change of changes) {
|
|
2115
|
+
const dict = () => {
|
|
2116
|
+
const config = findObjectByUuid(text, change.configUuid);
|
|
2117
|
+
if (config == null) {
|
|
2118
|
+
return null;
|
|
2119
|
+
}
|
|
2120
|
+
const buildSettings = findField(text, config, 'buildSettings');
|
|
2121
|
+
if (buildSettings == null) {
|
|
2122
|
+
return null;
|
|
2123
|
+
}
|
|
2124
|
+
return {
|
|
2125
|
+
uuid: change.configUuid,
|
|
2126
|
+
bodyOpen: buildSettings.valueStart,
|
|
2127
|
+
bodyClose: buildSettings.tokenEnd - 1,
|
|
2128
|
+
};
|
|
2129
|
+
};
|
|
2130
|
+
for (const key of Object.keys(change.appendedArrayValues ?? {})) {
|
|
2131
|
+
const current = dict();
|
|
2132
|
+
if (current != null) {
|
|
2133
|
+
text = removeArrayStringValues(
|
|
2134
|
+
text,
|
|
2135
|
+
current,
|
|
2136
|
+
key,
|
|
2137
|
+
change.appendedArrayValues[key],
|
|
2138
|
+
);
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
for (const key of change.createdArrayKeys ?? []) {
|
|
2142
|
+
const current = dict();
|
|
2143
|
+
if (current != null) {
|
|
2144
|
+
text = removeField(text, current, key);
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
for (const key of change.createdScalars ?? []) {
|
|
2148
|
+
const current = dict();
|
|
2149
|
+
if (current != null) {
|
|
2150
|
+
text = removeField(text, current, key);
|
|
2151
|
+
}
|
|
2152
|
+
}
|
|
2153
|
+
const replacedScalars /*: {[string]: string} */ =
|
|
2154
|
+
change.replacedScalars ?? {};
|
|
2155
|
+
for (const key of Object.keys(replacedScalars)) {
|
|
2156
|
+
const current = dict();
|
|
2157
|
+
if (current != null) {
|
|
2158
|
+
text = removeField(text, current, key);
|
|
2159
|
+
const replacement = dict();
|
|
2160
|
+
if (replacement != null) {
|
|
2161
|
+
const originalValue = replacedScalars[key];
|
|
2162
|
+
if (typeof originalValue === 'string') {
|
|
2163
|
+
text = ensureScalarField(text, replacement, key, originalValue);
|
|
2164
|
+
}
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
return text;
|
|
2170
|
+
}
|
|
2171
|
+
|
|
2172
|
+
/**
|
|
2173
|
+
* The exact inverse of `add` (injectSpmIntoExistingXcodeproj): using the
|
|
2174
|
+
* `.spm-injected.json` marker's precise record of every edit, remove only what
|
|
2175
|
+
* injection added — leaving any other (user) edits made afterwards intact. No
|
|
2176
|
+
* `git checkout`, no prompt. Returns {status:'absent'} when the project was
|
|
2177
|
+
* never injected.
|
|
2178
|
+
*/
|
|
2179
|
+
function removeSpmInjection(
|
|
2180
|
+
opts /*: {appRoot: string, xcodeprojPath: string} */,
|
|
2181
|
+
) /*: {status: 'removed', target: string} | {status: 'absent'} */ {
|
|
2182
|
+
const {appRoot, xcodeprojPath} = opts;
|
|
2183
|
+
const markerPath = path.join(xcodeprojPath, SPM_INJECTED_MARKER);
|
|
2184
|
+
if (!fs.existsSync(markerPath)) {
|
|
2185
|
+
return {status: 'absent'};
|
|
2186
|
+
}
|
|
2187
|
+
// $FlowFixMe[incompatible-type] JSON.parse returns any
|
|
2188
|
+
const marker = JSON.parse(fs.readFileSync(markerPath, 'utf8'));
|
|
2189
|
+
const pbxprojPath = path.join(xcodeprojPath, 'project.pbxproj');
|
|
2190
|
+
let text = fs.readFileSync(pbxprojPath, 'utf8');
|
|
2191
|
+
|
|
2192
|
+
const injectedUuids /*: Array<string> */ = marker.injectedUuids ?? [];
|
|
2193
|
+
|
|
2194
|
+
// 1. Drop our array members, then the array fields we created (now empty),
|
|
2195
|
+
// then the injected object definitions.
|
|
2196
|
+
text = removeArrayMembersByUuid(text, injectedUuids);
|
|
2197
|
+
for (const f of marker.createdArrayFields ?? []) {
|
|
2198
|
+
const obj =
|
|
2199
|
+
f.container === 'project'
|
|
2200
|
+
? findProjectObject(text)
|
|
2201
|
+
: findObjectByUuid(text, marker.targetUuid);
|
|
2202
|
+
if (obj != null) {
|
|
2203
|
+
text = removeField(text, obj, f.key);
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2206
|
+
for (const uuid of injectedUuids) {
|
|
2207
|
+
text = removeObjectByUuid(text, uuid);
|
|
2208
|
+
}
|
|
2209
|
+
// Drop any section that injection created and we just emptied (e.g.
|
|
2210
|
+
// XCLocalSwiftPackageReference) — a well-formed pbxproj never carries an
|
|
2211
|
+
// empty `/* Begin X */ /* End X */` section, so this lands byte-identical.
|
|
2212
|
+
text = text.replace(
|
|
2213
|
+
/\/\* Begin (\w+) section \*\/\n\/\* End \1 section \*\/\n\n/g,
|
|
2214
|
+
'',
|
|
2215
|
+
);
|
|
2216
|
+
|
|
2217
|
+
// 2. Reverse the per-config build-setting edits (only what we added).
|
|
2218
|
+
text = removeRecordedBuildSettings(text, marker.buildSettingChanges ?? []);
|
|
2219
|
+
writeIfChanged(pbxprojPath, text);
|
|
2220
|
+
log(`Removed SPM injection from ${path.relative(appRoot, pbxprojPath)}`);
|
|
2221
|
+
|
|
2222
|
+
// 3. Scheme: delete it if injection created it, else strip the pre-action.
|
|
2223
|
+
const scheme = marker.scheme;
|
|
2224
|
+
if (scheme != null && scheme.file != null) {
|
|
2225
|
+
const schemePath = path.join(
|
|
2226
|
+
xcodeprojPath,
|
|
2227
|
+
'xcshareddata',
|
|
2228
|
+
'xcschemes',
|
|
2229
|
+
scheme.file,
|
|
2230
|
+
);
|
|
2231
|
+
if (scheme.created === true) {
|
|
2232
|
+
fs.rmSync(schemePath, {force: true});
|
|
2233
|
+
} else if (fs.existsSync(schemePath)) {
|
|
2234
|
+
const xml = fs.readFileSync(schemePath, 'utf8');
|
|
2235
|
+
writeIfChanged(schemePath, removePreActionFromScheme(xml));
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
|
|
2239
|
+
// 4. Drop the marker — the project is no longer SPM-injected.
|
|
2240
|
+
fs.rmSync(markerPath, {force: true});
|
|
2241
|
+
return {status: 'removed', target: marker.target};
|
|
2242
|
+
}
|
|
2243
|
+
|
|
2244
|
+
module.exports = {
|
|
2245
|
+
generateXcscheme,
|
|
2246
|
+
buildSyncAutolinkingScript,
|
|
2247
|
+
buildSchemePreActionScript,
|
|
2248
|
+
buildEmbedFrameworksScript,
|
|
2249
|
+
flavorForBuildConfiguration,
|
|
2250
|
+
frameworkConditionalSettings,
|
|
2251
|
+
ensureStubPackages,
|
|
2252
|
+
buildSpmDependencyGraph,
|
|
2253
|
+
spmGraphToEntries,
|
|
2254
|
+
planInjection,
|
|
2255
|
+
injectSpmIntoPbxproj,
|
|
2256
|
+
injectSpmIntoExistingXcodeproj,
|
|
2257
|
+
removeSpmInjection,
|
|
2258
|
+
cleanupLeftoverPodsGroup,
|
|
2259
|
+
cleanupDanglingJavaScriptCoreRef,
|
|
2260
|
+
addPreActionToScheme,
|
|
2261
|
+
removePreActionFromScheme,
|
|
2262
|
+
findInjectedXcodeproj,
|
|
2263
|
+
readArtifactsVersionOverride,
|
|
2264
|
+
readPinnedConfigCommand,
|
|
2265
|
+
SPM_INJECTED_MARKER,
|
|
2266
|
+
};
|