react-native 0.87.0-rc.0 → 0.87.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/Libraries/Core/InitializeCore.js +9 -1
  2. package/Libraries/Core/ReactNativeVersion.js +1 -1
  3. package/Libraries/ReactNative/AppRegistry.flow.js +1 -0
  4. package/Libraries/ReactNative/AppRegistryImpl.js +2 -3
  5. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +5 -116
  6. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js.flow +5 -31
  7. package/React/Base/RCTVersion.m +1 -1
  8. package/React/I18n/RCTLocalizedString.mm +38 -2
  9. package/React-Core-prebuilt.podspec +45 -17
  10. package/React-Core.podspec +9 -2
  11. package/ReactAndroid/external-artifacts/build.gradle.kts +49 -0
  12. package/ReactAndroid/gradle.properties +1 -1
  13. package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/SynchronousMountItem.kt +8 -2
  14. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
  15. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  16. package/index.js +15 -3
  17. package/index.js.flow +0 -2
  18. package/package.json +27 -29
  19. package/react-native.config.js +81 -0
  20. package/scripts/cocoapods/fabric.rb +1 -1
  21. package/scripts/cocoapods/rncore.rb +35 -78
  22. package/scripts/cocoapods/rncore_facades.rb +232 -0
  23. package/scripts/cocoapods/rndependencies.rb +64 -3
  24. package/scripts/cocoapods/rndeps_facades.rb +193 -0
  25. package/scripts/cocoapods/spm.rb +78 -11
  26. package/scripts/codegen/templates/Package.swift.spm-template +97 -0
  27. package/scripts/react-native-xcode.sh +20 -0
  28. package/scripts/react_native_pods.rb +65 -16
  29. package/scripts/replace-rncore-version.js +53 -6
  30. package/scripts/setup-apple-spm.js +1165 -0
  31. package/scripts/spm/__doc__/rfc-spm-xcframework.md +707 -0
  32. package/scripts/spm/__doc__/spm-autolinking-plugins.md +244 -0
  33. package/scripts/spm/__doc__/spm-header-paths-contract.md +97 -0
  34. package/scripts/spm/__doc__/spm-plugins-assessment.md +128 -0
  35. package/scripts/spm/__doc__/spm-scripts.md +451 -0
  36. package/scripts/spm/autolinking-plugins.js +331 -0
  37. package/scripts/spm/download-spm-artifacts.js +1409 -0
  38. package/scripts/spm/expand-spm-dependencies.js +216 -0
  39. package/scripts/spm/flavored-frameworks.js +1008 -0
  40. package/scripts/spm/generate-spm-autolinking-config.js +161 -0
  41. package/scripts/spm/generate-spm-autolinking.js +1888 -0
  42. package/scripts/spm/generate-spm-package.js +302 -0
  43. package/scripts/spm/generate-spm-xcodeproj.js +2224 -0
  44. package/scripts/spm/read-podspec.js +695 -0
  45. package/scripts/spm/scaffold-package-swift.js +1206 -0
  46. package/scripts/spm/spm-pbxproj.js +654 -0
  47. package/scripts/spm/spm-types.js +517 -0
  48. package/scripts/spm/spm-utils.js +645 -0
  49. package/scripts/spm/sync-spm-autolinking.js +160 -0
  50. package/sdks/.hermesv1version +1 -0
  51. package/sdks/hermes-engine/utils/replace_hermes_version.js +18 -4
  52. package/sdks/hermes-engine/version.properties +1 -1
  53. package/src/asset-registry.js +1 -1
  54. package/src/react-private-interface.js +145 -0
  55. package/src/react-private-interface.js.flow +48 -0
  56. package/src/setup-env.js +22 -0
  57. package/src/unstable-internals-do-not-use.d.ts +214 -0
  58. package/src/unstable-internals-do-not-use.js +76 -0
  59. package/third-party-podspecs/ReactNativeDependencies.podspec +2 -2
  60. package/types_generated/Libraries/ReactNative/AppRegistry.flow.d.ts +2 -2
  61. package/types_generated/Libraries/ReactPrivate/ReactNativePrivateInterface.d.ts +6 -21
  62. package/types_generated/index.d.ts +1 -2
  63. package/types_generated/src/private/renderer/events/dispatchNativeEvent.d.ts +26 -0
  64. package/types_generated/src/react-private-interface.d.ts +33 -0
  65. package/Libraries/Utilities/SceneTracker.js +0 -42
  66. package/jest-preset.js +0 -26
  67. package/rn-get-polyfills.js +0 -13
  68. package/types/tsconfig.json +0 -17
  69. package/types_generated/Libraries/Components/Touchable/Touchable.d.ts +0 -261
  70. package/types_generated/tsconfig.test.json +0 -17
@@ -21,6 +21,8 @@ require_relative './cocoapods/helpers.rb'
21
21
  require_relative './cocoapods/privacy_manifest_utils.rb'
22
22
  require_relative './cocoapods/spm.rb'
23
23
  require_relative './cocoapods/rncore.rb'
24
+ require_relative './cocoapods/rncore_facades.rb'
25
+ require_relative './cocoapods/rndeps_facades.rb'
24
26
  # Importing to expose use_native_modules!
25
27
  require_relative './cocoapods/autolinking.rb'
26
28
 
@@ -52,6 +54,28 @@ def prepare_react_native_project!
52
54
  ReactNativePodsUtils.create_xcode_env_if_missing
53
55
  end
54
56
 
57
+ # Declares a React core pod, choosing source vs prebuilt facade. In prebuilt
58
+ # mode, pods in the RNCoreFacades manifest are installed as dependency-only
59
+ # facades (no source/headers) so they can't shadow the prebuilt artifact; their
60
+ # code + headers come from React-Core-prebuilt. Everything else (and the whole
61
+ # source build) is unaffected. See cocoapods/rncore_facades.rb.
62
+ def rncore_pod(name, **opts)
63
+ base = name.split('/').first
64
+ if !ReactNativeCoreUtils.build_rncore_from_source() && RNCoreFacades.facade?(base)
65
+ # Install as a LOCAL pod (`:path`) from the generated facade directory, so
66
+ # CocoaPods never fetches the placeholder git source (a `:podspec` external
67
+ # source would). Both the pod and any subspec declaration point at the SAME
68
+ # directory, so CocoaPods sees one consistent source for the name (a bare
69
+ # subspec declaration would otherwise default to the spec repo and conflict).
70
+ # Preserve the caller's options (e.g. :modular_headers) but replace :path with
71
+ # the facade directory.
72
+ facade_opts = opts.reject { |k, _| k == :path }
73
+ pod name, **facade_opts, :path => RNCoreFacades.facade_path(base)
74
+ else
75
+ pod name, **opts
76
+ end
77
+ end
78
+
55
79
  # Function that setup all the react native dependencies
56
80
 
57
81
  # Parameters
@@ -123,19 +147,25 @@ def use_react_native! (
123
147
  # Update ReactNativeCoreUtils so that we can easily switch between source and prebuilt
124
148
  ReactNativeCoreUtils.setup_rncore(prefix, react_native_version)
125
149
 
150
+ # In prebuilt mode, generate the facade podspecs the core pods are installed as
151
+ # (instead of their source podspecs) so they don't ship shadowing headers.
152
+ unless ReactNativeCoreUtils.build_rncore_from_source()
153
+ RNCoreFacades.generate(react_native_path, Pod::Config.instance.installation_root, react_native_version, min_ios_version_supported)
154
+ end
155
+
126
156
  Pod::UI.puts "Configuring the target with the New Architecture\n"
127
157
 
128
158
  # The Pods which should be included in all projects
129
- pod 'FBLazyVector', :path => "#{prefix}/Libraries/FBLazyVector"
130
- pod 'RCTRequired', :path => "#{prefix}/Libraries/Required"
159
+ rncore_pod 'FBLazyVector', :path => "#{prefix}/Libraries/FBLazyVector"
160
+ rncore_pod 'RCTRequired', :path => "#{prefix}/Libraries/Required"
131
161
  pod 'RCTTypeSafety', :path => "#{prefix}/Libraries/TypeSafety", :modular_headers => true
132
162
  pod 'React', :path => "#{prefix}/"
133
163
  if !ReactNativeCoreUtils.build_rncore_from_source()
134
164
  pod 'React-Core-prebuilt', :podspec => "#{prefix}/React-Core-prebuilt.podspec", :modular_headers => true
135
165
  end
136
- pod 'React-Core', :path => "#{prefix}/"
166
+ rncore_pod 'React-Core', :path => "#{prefix}/"
137
167
  pod 'React-CoreModules', :path => "#{prefix}/React/CoreModules"
138
- pod 'React-RCTRuntime', :path => "#{prefix}/React/Runtime"
168
+ rncore_pod 'React-RCTRuntime', :path => "#{prefix}/React/Runtime"
139
169
  pod 'React-RCTAppDelegate', :path => "#{prefix}/Libraries/AppDelegate"
140
170
  pod 'React-RCTActionSheet', :path => "#{prefix}/Libraries/ActionSheetIOS"
141
171
  pod 'React-RCTAnimation', :path => "#{prefix}/Libraries/NativeAnimation"
@@ -146,7 +176,7 @@ def use_react_native! (
146
176
  pod 'React-RCTSettings', :path => "#{prefix}/Libraries/Settings"
147
177
  pod 'React-RCTText', :path => "#{prefix}/Libraries/Text"
148
178
  pod 'React-RCTVibration', :path => "#{prefix}/Libraries/Vibration"
149
- pod 'React-Core/RCTWebSocket', :path => "#{prefix}/"
179
+ rncore_pod 'React-Core/RCTWebSocket', :path => "#{prefix}/"
150
180
  pod 'React-cxxreact', :path => "#{prefix}/ReactCommon/cxxreact"
151
181
  pod 'React-cxxstableapi', :path => "#{prefix}/ReactCommon/react/cxxstableapi"
152
182
  pod 'React-debug', :path => "#{prefix}/ReactCommon/react/debug"
@@ -164,7 +194,7 @@ def use_react_native! (
164
194
  pod 'React-Mapbuffer', :path => "#{prefix}/ReactCommon"
165
195
  pod 'React-bridging', :path => "#{prefix}/ReactCommon/react/bridging", :modular_headers => true
166
196
  pod 'React-jserrorhandler', :path => "#{prefix}/ReactCommon/jserrorhandler"
167
- pod 'RCTDeprecation', :path => "#{prefix}/ReactApple/Libraries/RCTFoundation/RCTDeprecation"
197
+ rncore_pod 'RCTDeprecation', :path => "#{prefix}/ReactApple/Libraries/RCTFoundation/RCTDeprecation"
168
198
  pod 'React-RCTFBReactNativeSpec', :path => "#{prefix}/React"
169
199
  pod 'React-jsi', :path => "#{prefix}/ReactCommon/jsi"
170
200
  pod 'RCTSwiftUI', :path => "#{prefix}/ReactApple/RCTSwiftUI"
@@ -197,7 +227,7 @@ def use_react_native! (
197
227
  pod 'React-logger', :path => "#{prefix}/ReactCommon/logger"
198
228
  pod 'ReactCommon/turbomodule/core', :path => "#{prefix}/ReactCommon", :modular_headers => true
199
229
  pod 'React-NativeModulesApple', :path => "#{prefix}/ReactCommon/react/nativemodule/core/platform/ios", :modular_headers => true
200
- pod 'Yoga', :path => "#{prefix}/ReactCommon/yoga", :modular_headers => true
230
+ rncore_pod 'Yoga', :path => "#{prefix}/ReactCommon/yoga", :modular_headers => true
201
231
  setup_fabric!(:react_native_path => prefix)
202
232
  setup_bridgeless!(:react_native_path => prefix, :use_hermes => hermes_enabled)
203
233
 
@@ -214,6 +244,17 @@ def use_react_native! (
214
244
  ReactNativeCoreUtils.rncore_log("Using React Native Core and React Native Dependencies prebuilt versions.")
215
245
  pod 'ReactNativeDependencies', :podspec => "#{prefix}/third-party-podspecs/ReactNativeDependencies.podspec", :modular_headers => true
216
246
 
247
+ # Facades: community pods' hardcoded s.dependency "RCT-Folly"/"glog"/... must
248
+ # resolve locally instead of from trunk. See __docs__/prebuilt-deps.md.
249
+ RNDepsFacades.generate(react_native_path, Pod::Config.instance.installation_root, min_ios_version_supported)
250
+ pod 'DoubleConversion', :path => RNDepsFacades.facade_path('DoubleConversion')
251
+ pod 'glog', :path => RNDepsFacades.facade_path('glog')
252
+ pod 'boost', :path => RNDepsFacades.facade_path('boost')
253
+ pod 'fast_float', :path => RNDepsFacades.facade_path('fast_float')
254
+ pod 'fmt', :path => RNDepsFacades.facade_path('fmt')
255
+ pod 'RCT-Folly', :path => RNDepsFacades.facade_path('RCT-Folly')
256
+ pod 'SocketRocket', :path => RNDepsFacades.facade_path('SocketRocket')
257
+
217
258
  if !ReactNativeCoreUtils.build_rncore_from_source()
218
259
  pod 'React-Core-prebuilt', :podspec => "#{prefix}/React-Core-prebuilt.podspec", :modular_headers => true
219
260
  end
@@ -569,18 +610,26 @@ def react_native_post_install(
569
610
  ReactNativePodsUtils.add_ndebug_flag_to_pods_in_release(installer)
570
611
 
571
612
  if !ReactNativeCoreUtils.build_rncore_from_source()
572
- # In XCode 26 we need to revert the new setting SWIFT_ENABLE_EXPLICIT_MODULES when building
573
- # with precompiled binaries.
574
- ReactNativePodsUtils.set_build_setting(installer, build_setting: "SWIFT_ENABLE_EXPLICIT_MODULES", value: "NO")
575
-
576
- # Process the VFS overlay for prebuilt React Native Core - this is done as part of the post install so
577
- # that we can update paths based on the final location of the Pods installation.
578
- ReactNativeCoreUtils.process_vfs_overlay()
579
-
580
- # Configure xcconfig for prebuilt usage (VFS overlay, header paths, cleanup redundant paths)
613
+ # The Xcode-26 SWIFT_ENABLE_EXPLICIT_MODULES=NO workaround (#53457) is removed:
614
+ # the modular ReactNativeHeaders layout + React-Core-prebuilt module-map
615
+ # activation + header-less facades let the React module precompile cleanly with
616
+ # explicit modules ON (verified cold-DD green), so the override is unnecessary.
617
+
618
+ # Make the prebuilt React.xcframework headers resolvable from aggregate (main app)
619
+ # and third-party pod targets that don't go through add_rncore_dependency. The headers
620
+ # are served directly from the xcframework's headers-spec layout — no clang VFS overlay.
581
621
  ReactNativeCoreUtils.configure_aggregate_xcconfig(installer)
582
622
  end
583
623
 
624
+ if !ReactNativeDependenciesUtils.build_react_native_deps_from_source()
625
+ # Prebuilt-deps mode: make the deps artifact headers (folly/glog/...)
626
+ # resolvable from the aggregate and every pod target, mirroring the rncore
627
+ # injection above. ReactNativeHeaders is pure-RN, so the flattened
628
+ # ReactNativeDependencies/Headers dir is the single global home of the
629
+ # third-party namespaces (see scripts/cocoapods/__docs__/prebuilt-deps.md).
630
+ ReactNativeDependenciesUtils.configure_aggregate_xcconfig(installer)
631
+ end
632
+
584
633
  SPM.apply_on_post_install(installer)
585
634
 
586
635
  if privacy_file_aggregation_enabled
@@ -99,17 +99,19 @@ function replaceRNCoreConfiguration(
99
99
  throw new Error(`tar extraction failed with exit code ${result.status}`);
100
100
  }
101
101
 
102
- // Verify extraction produced the expected xcframework structure
102
+ // Verify extraction produced the expected xcframework structure. The
103
+ // module map now lives per-slice inside React.framework, so check the
104
+ // xcframework's Info.plist instead of a root Modules/module.modulemap.
103
105
  const xcfwPath = path.join(tmpExtractDir, 'React.xcframework');
104
- const modulemapPath = path.join(xcfwPath, 'Modules', 'module.modulemap');
105
- if (!fs.existsSync(modulemapPath)) {
106
+ const infoPlistPath = path.join(xcfwPath, 'Info.plist');
107
+ if (!fs.existsSync(infoPlistPath)) {
106
108
  throw new Error(
107
- `Extraction verification failed: ${modulemapPath} not found`,
109
+ `Extraction verification failed: ${infoPlistPath} not found`,
108
110
  );
109
111
  }
110
112
 
111
- // Delete all directories in finalLocation - not files, since we want to
112
- // keep the React-VFS.yaml file
113
+ // Delete only directories in finalLocation (e.g. the React.xcframework) -
114
+ // not files, so any sibling files written during pod install are preserved.
113
115
  const dirs = fs
114
116
  .readdirSync(finalLocation, {withFileTypes: true})
115
117
  .filter(dirent => dirent.isDirectory());
@@ -144,6 +146,51 @@ function replaceRNCoreConfiguration(
144
146
  }
145
147
  }
146
148
  }
149
+
150
+ // The podspec prepare_command flattens ReactNativeHeaders' headers into a
151
+ // top-level Headers/ dir, but it does not re-run on a config swap. Mirror
152
+ // it here: re-flatten the headers (identical across slices) and drop the
153
+ // now-redundant xcframework so $(PODS_ROOT)/React-Core-prebuilt/Headers
154
+ // keeps resolving <react/...>, <yoga/...>, etc.
155
+ //
156
+ // Fail closed when the swapped-in tarball lacks ReactNativeHeaders: the
157
+ // directory purge above already deleted the previous Headers/, so
158
+ // continuing silently would leave the injected -fmodule-map-file flag
159
+ // dangling and break every <react/...> include only on a config switch —
160
+ // with no pointer to the version-skewed artifact that caused it.
161
+ const rnhXcfw = path.join(finalLocation, 'ReactNativeHeaders.xcframework');
162
+ if (!fs.existsSync(rnhXcfw)) {
163
+ throw new Error(
164
+ `ReactNativeHeaders.xcframework not found in the extracted tarball at ${finalLocation}. ` +
165
+ 'The downloaded artifact predates the headers-spec layout (or is incomplete); ' +
166
+ 'use a prebuilt tarball matching this react-native version.',
167
+ );
168
+ }
169
+ const slice = fs
170
+ .readdirSync(rnhXcfw, {withFileTypes: true})
171
+ .find(
172
+ dirent =>
173
+ dirent.isDirectory() &&
174
+ fs.existsSync(path.join(rnhXcfw, dirent.name.toString(), 'Headers')),
175
+ );
176
+ if (!slice) {
177
+ throw new Error(
178
+ `No slice with a Headers directory found inside ${rnhXcfw}.`,
179
+ );
180
+ }
181
+ const headersDest = path.join(finalLocation, 'Headers');
182
+ fs.rmSync(headersDest, {force: true, recursive: true});
183
+ const cpHeaders = spawnSync(
184
+ 'cp',
185
+ ['-R', path.join(rnhXcfw, slice.name.toString(), 'Headers'), headersDest],
186
+ {stdio: 'inherit'},
187
+ );
188
+ if (cpHeaders.status !== 0) {
189
+ throw new Error(
190
+ `Flattening ReactNativeHeaders failed with exit code ${cpHeaders.status}`,
191
+ );
192
+ }
193
+ fs.rmSync(rnhXcfw, {force: true, recursive: true});
147
194
  } finally {
148
195
  // Clean up temp directory
149
196
  fs.rmSync(tmpDir, {force: true, recursive: true});