react-native-tvos 0.83.0-0rc2 → 0.83.1-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.
Files changed (26) hide show
  1. package/Libraries/Core/ReactNativeVersion.js +2 -2
  2. package/README.md +16 -54
  3. package/React/Base/RCTVersion.m +2 -2
  4. package/ReactAndroid/gradle.properties +1 -1
  5. package/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkEventUtil.kt +11 -1
  6. package/ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressRequestBody.kt +5 -0
  7. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +2 -2
  8. package/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/PackagerConnectionSettings.kt +13 -0
  9. package/ReactAndroid/src/main/jni/CMakeLists.txt +7 -0
  10. package/ReactAndroid/src/main/jni/react/devsupport/CMakeLists.txt +7 -0
  11. package/ReactCommon/cxxreact/ReactNativeVersion.h +3 -3
  12. package/ReactCommon/jsinspector-modern/HostAgent.cpp +2 -2
  13. package/ReactCommon/jsinspector-modern/InspectorInterfaces.cpp +10 -5
  14. package/ReactCommon/jsinspector-modern/InspectorInterfaces.h +2 -2
  15. package/ReactCommon/jsinspector-modern/TracingAgent.cpp +1 -1
  16. package/ReactCommon/react/networking/CMakeLists.txt +7 -0
  17. package/package.json +8 -8
  18. package/react-native.config.js +17 -0
  19. package/scripts/cocoapods/rncore.rb +14 -1
  20. package/scripts/cocoapods/utils.rb +4 -0
  21. package/scripts/codegen/generate-artifacts-executor/generateReactCodegenPodspec.js +7 -3
  22. package/scripts/codegen/generate-artifacts-executor/index.js +48 -29
  23. package/scripts/codegen/generate-artifacts-executor/utils.js +17 -4
  24. package/sdks/.hermesv1version +1 -1
  25. package/sdks/hermes-engine/hermes-engine.podspec +1 -4
  26. package/sdks/hermes-engine/version.properties +1 -1
@@ -28,8 +28,8 @@
28
28
  export default class ReactNativeVersion {
29
29
  static major: number = 0;
30
30
  static minor: number = 83;
31
- static patch: number = 0;
32
- static prerelease: string | null = '0rc2';
31
+ static patch: number = 1;
32
+ static prerelease: string | null = '0';
33
33
 
34
34
  static getVersionString(): string {
35
35
  return `${this.major}.${this.minor}.${this.patch}${this.prerelease != null ? `-${this.prerelease}` : ''}`;
package/README.md CHANGED
@@ -94,64 +94,26 @@ See the [Building Expo apps for TV](https://docs.expo.dev/guides/building-for-tv
94
94
 
95
95
  Using Expo's [continuous native generation (CNG)](https://docs.expo.dev/workflow/continuous-native-generation/) model, projects created this way can be used to build either mobile or TV apps, taking advantage of the full support for both mobile and TV platforms in this repo.
96
96
 
97
- ### Project creation using the React Native Community CLI
97
+ ### Creating a new project with the Community CLI
98
98
 
99
- As of React Native 0.75.x, the template that used to reside in the `react-native` core package has been moved to a [new community repo](https://github.com/react-native-community/template) and will be maintained there. To support developers that wish to continue using the community CLI, we have created a [new TV template repository](https://github.com/react-native-tvos/template-tv) and will maintain a TV port of this template.
99
+ We maintain [template-tv](https://github.com/react-native-tvos/template-tv), a TV-specific template for developers using the React Native Community CLI. This project extends the Community CLI with `run-tvos`, `build-tvos`, and `log-tvos` commands for tvOS development.
100
100
 
101
- > _Note:_ The new TV template will only build apps for Apple TV and Android TV. Multiple platform targets are no longer supported in React Native app Podfiles.
102
-
103
- To create a new project for RNTV 0.81:
101
+ > [!NOTE]
102
+ > This template only supports Apple TV and Android TV. Multiple platform targets are no longer supported in React Native app Podfiles.
104
103
 
104
+ **Quick start:**
105
105
  ```sh
106
- #
107
- # Init an app called 'TVTest', note that you must not be in a node module (directory with node_modules sub-directory) for this to work
108
- $ npx @react-native-community/cli@latest init TVTest --template @react-native-tvos/template-tv
109
-
110
- ###### ######
111
- ### #### #### ###
112
- ## ### ### ##
113
- ## #### ##
114
- ## #### ##
115
- ## ## ## ##
116
- ## ### ### ##
117
- ## ######################## ##
118
- ###### ### ### ######
119
- ### ## ## ## ## ###
120
- ### ## ### #### ### ## ###
121
- ## #### ######## #### ##
122
- ## ### ########## ### ##
123
- ## #### ######## #### ##
124
- ### ## ### #### ### ## ###
125
- ### ## ## ## ## ###
126
- ###### ### ### ######
127
- ## ######################## ##
128
- ## ### ### ##
129
- ## ## ## ##
130
- ## #### ##
131
- ## #### ##
132
- ## ### ### ##
133
- ### #### #### ###
134
- ###### ######
135
-
136
-
137
- Welcome to React Native 0.81!
138
- Learn once, write anywhere
139
-
140
- ✔ Downloading template
141
- ✔ Copying template
142
- ✔ Processing template
143
- ✔ Installing dependencies
144
- ✔ Do you want to install CocoaPods now? Only needed if you run your project in Xcode directly … yes
145
- ✔ Installing Ruby Gems
146
- ✔ Installing CocoaPods dependencies (this may take a few minutes)
147
- .
148
- .
149
- .
150
- $ cd TVTest
151
- # Now build and start the app in the tvOS Simulator - this will only work on a macOS machine.
152
- npx react-native run-ios --simulator "Apple TV"
153
- # This command builds and starts the app in an Android TV emulator (needs to be created in advance).
154
- npx react-native run:android --device tv_api_31
106
+ # Initialize a new app called 'TVTest'
107
+ # This command should be run outside of any existing node project
108
+ npx @react-native-community/cli@latest init TVTest --template @react-native-tvos/template-tv
109
+
110
+ cd TVTest
111
+
112
+ # Build and run on tvOS Simulator (macOS only, requires Apple TV simulator)
113
+ npx react-native run-tvos --simulator "Apple TV"
114
+
115
+ # Build and run on Android TV emulator (requires Android TV emulator)
116
+ npx react-native run-android --device tv_api_31
155
117
  ```
156
118
 
157
119
  ## How to support TV specific file extensions
@@ -23,8 +23,8 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(83),
26
- RCTVersionPatch: @(0),
27
- RCTVersionPrerelease: @"0rc2",
26
+ RCTVersionPatch: @(1),
27
+ RCTVersionPrerelease: @"0",
28
28
  };
29
29
  });
30
30
  return __rnVersion;
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.83.0-0rc2
1
+ VERSION_NAME=0.83.1-0
2
2
  react.internal.publishingGroup=io.github.react-native-tvos
3
3
  react.internal.hermesPublishingGroup=com.facebook.hermes
4
4
 
@@ -15,6 +15,7 @@ import com.facebook.react.bridge.Arguments
15
15
  import com.facebook.react.bridge.ReactApplicationContext
16
16
  import com.facebook.react.bridge.WritableMap
17
17
  import com.facebook.react.bridge.buildReadableArray
18
+ import com.facebook.react.common.build.ReactBuildConfig
18
19
  import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
19
20
  import java.net.SocketTimeoutException
20
21
  import okhttp3.Headers
@@ -30,12 +31,21 @@ internal object NetworkEventUtil {
30
31
  fun onCreateRequest(devToolsRequestId: String, request: Request) {
31
32
  if (ReactNativeFeatureFlags.enableNetworkEventReporting()) {
32
33
  val headersMap = okHttpHeadersToMap(request.headers())
34
+ var requestBody = ""
35
+
36
+ if (ReactBuildConfig.DEBUG) {
37
+ // Debug build: Process request body for preview (CDP only)
38
+ requestBody =
39
+ (request.body() as? ProgressRequestBody)?.getBodyPreview()
40
+ ?: request.body()?.toString().orEmpty()
41
+ }
42
+
33
43
  InspectorNetworkReporter.reportRequestStart(
34
44
  devToolsRequestId,
35
45
  request.url().toString(),
36
46
  request.method(),
37
47
  headersMap,
38
- request.body()?.toString().orEmpty(),
48
+ requestBody,
39
49
  request.body()?.contentLength() ?: 0,
40
50
  )
41
51
  InspectorNetworkReporter.reportConnectionTiming(devToolsRequestId, headersMap)
@@ -78,4 +78,9 @@ internal class ProgressRequestBody(
78
78
  }
79
79
  )
80
80
  }
81
+
82
+ fun getBodyPreview(): String {
83
+ // TODO: Safely implement request body previews
84
+ return "[Preview unavailable]"
85
+ }
81
86
  }
@@ -14,7 +14,7 @@ public object ReactNativeVersion {
14
14
  public val VERSION: Map<String, Any?> = mapOf(
15
15
  "major" to 0,
16
16
  "minor" to 83,
17
- "patch" to 0,
18
- "prerelease" to "0rc2"
17
+ "patch" to 1,
18
+ "prerelease" to "0"
19
19
  )
20
20
  }
@@ -5,13 +5,19 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
+ @file:Suppress("DEPRECATION") // PreferenceManager should be migrated to androidx
9
+
8
10
  package com.facebook.react.packagerconnection
9
11
 
10
12
  import android.content.Context
13
+ import android.content.SharedPreferences
14
+ import android.preference.PreferenceManager
11
15
  import com.facebook.common.logging.FLog
12
16
  import com.facebook.react.modules.systeminfo.AndroidInfoHelpers
13
17
 
14
18
  public open class PackagerConnectionSettings(private val appContext: Context) {
19
+ private val preferences: SharedPreferences =
20
+ PreferenceManager.getDefaultSharedPreferences(appContext)
15
21
  public val packageName: String = appContext.packageName
16
22
  private val _additionalOptionsForPackager: MutableMap<String, String> = mutableMapOf()
17
23
  private var _packagerOptionsUpdater: (Map<String, String>) -> Map<String, String> = { it }
@@ -24,6 +30,12 @@ public open class PackagerConnectionSettings(private val appContext: Context) {
24
30
  cachedHost?.let {
25
31
  return it
26
32
  }
33
+
34
+ val hostFromSettings = preferences.getString(PREFS_DEBUG_SERVER_HOST_KEY, null)
35
+ if (!hostFromSettings.isNullOrEmpty()) {
36
+ return hostFromSettings
37
+ }
38
+
27
39
  val host = AndroidInfoHelpers.getServerHost(appContext)
28
40
  if (host == AndroidInfoHelpers.DEVICE_LOCALHOST) {
29
41
  FLog.w(
@@ -63,5 +75,6 @@ public open class PackagerConnectionSettings(private val appContext: Context) {
63
75
 
64
76
  private companion object {
65
77
  private val TAG = PackagerConnectionSettings::class.java.simpleName
78
+ private const val PREFS_DEBUG_SERVER_HOST_KEY = "debug_http_host"
66
79
  }
67
80
  }
@@ -338,3 +338,10 @@ target_include_directories(reactnative
338
338
  $<TARGET_PROPERTY:uimanagerjni,INTERFACE_INCLUDE_DIRECTORIES>
339
339
  $<TARGET_PROPERTY:yoga,INTERFACE_INCLUDE_DIRECTORIES>
340
340
  )
341
+
342
+ if(${CMAKE_BUILD_TYPE} MATCHES Debug OR REACT_NATIVE_DEBUG_OPTIMIZED)
343
+ target_compile_options(reactnative PRIVATE
344
+ -DREACT_NATIVE_DEBUGGER_ENABLED=1
345
+ -DREACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1
346
+ )
347
+ endif ()
@@ -23,3 +23,10 @@ target_link_libraries(react_devsupportjni
23
23
  react_networking)
24
24
 
25
25
  target_compile_reactnative_options(react_devsupportjni PRIVATE)
26
+
27
+ if(${CMAKE_BUILD_TYPE} MATCHES Debug OR REACT_NATIVE_DEBUG_OPTIMIZED)
28
+ target_compile_options(react_devsupportjni PRIVATE
29
+ -DREACT_NATIVE_DEBUGGER_ENABLED=1
30
+ -DREACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1
31
+ )
32
+ endif ()
@@ -14,15 +14,15 @@
14
14
 
15
15
  #define REACT_NATIVE_VERSION_MAJOR 0
16
16
  #define REACT_NATIVE_VERSION_MINOR 83
17
- #define REACT_NATIVE_VERSION_PATCH 0
17
+ #define REACT_NATIVE_VERSION_PATCH 1
18
18
 
19
19
  namespace facebook::react {
20
20
 
21
21
  constexpr struct {
22
22
  int32_t Major = 0;
23
23
  int32_t Minor = 83;
24
- int32_t Patch = 0;
25
- std::string_view Prerelease = "0rc2";
24
+ int32_t Patch = 1;
25
+ std::string_view Prerelease = "0";
26
26
  } ReactNativeVersion;
27
27
 
28
28
  } // namespace facebook::react
@@ -147,7 +147,7 @@ class HostAgent::Impl final {
147
147
  if (InspectorFlags::getInstance().getNetworkInspectionEnabled()) {
148
148
  if (req.method == "Network.enable") {
149
149
  auto& inspector = getInspectorInstance();
150
- if (inspector.getSystemState().registeredPagesCount > 1) {
150
+ if (inspector.getSystemState().registeredHostsCount > 1) {
151
151
  frontendChannel_(
152
152
  cdp::jsonError(
153
153
  req.id,
@@ -231,7 +231,7 @@ class HostAgent::Impl final {
231
231
  "ReactNativeApplication.metadataUpdated",
232
232
  createHostMetadataPayload(hostMetadata_)));
233
233
  auto& inspector = getInspectorInstance();
234
- bool isSingleHost = inspector.getSystemState().registeredPagesCount <= 1;
234
+ bool isSingleHost = inspector.getSystemState().registeredHostsCount <= 1;
235
235
  if (!isSingleHost) {
236
236
  emitSystemStateChanged(isSingleHost);
237
237
  }
@@ -67,8 +67,8 @@ class InspectorImpl : public IInspector {
67
67
  public:
68
68
  explicit SystemStateListener(InspectorSystemState& state) : state_(state) {}
69
69
 
70
- void onPageAdded(int /*pageId*/) override {
71
- state_.registeredPagesCount++;
70
+ void unstable_onHostTargetAdded() override {
71
+ state_.registeredHostsCount++;
72
72
  }
73
73
 
74
74
  private:
@@ -94,6 +94,7 @@ class InspectorImpl : public IInspector {
94
94
  ConnectFunc connectFunc_;
95
95
  InspectorTargetCapabilities capabilities_;
96
96
  };
97
+
97
98
  mutable std::mutex mutex_;
98
99
  int nextPageId_{1};
99
100
  std::map<int, Page> pages_;
@@ -142,9 +143,13 @@ int InspectorImpl::addPage(
142
143
  pageId,
143
144
  Page{pageId, description, vm, std::move(connectFunc), capabilities});
144
145
 
145
- for (const auto& listenerWeak : listeners_) {
146
- if (auto listener = listenerWeak.lock()) {
147
- listener->onPageAdded(pageId);
146
+ // Strong assumption: If prefersFuseboxFrontend is set, the page added is a
147
+ // HostTarget and not a legacy Hermes runtime target.
148
+ if (capabilities.prefersFuseboxFrontend) {
149
+ for (const auto& listenerWeak : listeners_) {
150
+ if (auto listener = listenerWeak.lock()) {
151
+ listener->unstable_onHostTargetAdded();
152
+ }
148
153
  }
149
154
  }
150
155
 
@@ -53,7 +53,7 @@ using InspectorPage = InspectorPageDescription;
53
53
 
54
54
  struct InspectorSystemState {
55
55
  /** The total count of pages registered during the app lifetime. */
56
- int registeredPagesCount;
56
+ int registeredHostsCount;
57
57
  };
58
58
 
59
59
  /// IRemoteConnection allows the VM to send debugger messages to the client.
@@ -83,7 +83,7 @@ class JSINSPECTOR_EXPORT ILocalConnection : public IDestructible {
83
83
  class JSINSPECTOR_EXPORT IPageStatusListener : public IDestructible {
84
84
  public:
85
85
  virtual ~IPageStatusListener() = 0;
86
- virtual void onPageAdded(int /*pageId*/) {}
86
+ virtual void unstable_onHostTargetAdded() {}
87
87
  virtual void onPageRemoved(int /*pageId*/) {}
88
88
  };
89
89
 
@@ -54,7 +54,7 @@ TracingAgent::~TracingAgent() {
54
54
  bool TracingAgent::handleRequest(const cdp::PreparsedRequest& req) {
55
55
  if (req.method == "Tracing.start") {
56
56
  auto& inspector = getInspectorInstance();
57
- if (inspector.getSystemState().registeredPagesCount > 1) {
57
+ if (inspector.getSystemState().registeredHostsCount > 1) {
58
58
  frontendChannel_(
59
59
  cdp::jsonError(
60
60
  req.id,
@@ -21,3 +21,10 @@ target_link_libraries(react_networking
21
21
  jsinspector_tracing
22
22
  react_performance_timeline
23
23
  react_timing)
24
+
25
+ if(${CMAKE_BUILD_TYPE} MATCHES Debug OR REACT_NATIVE_DEBUG_OPTIMIZED)
26
+ target_compile_options(react_networking PRIVATE
27
+ -DREACT_NATIVE_DEBUGGER_ENABLED=1
28
+ -DREACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1
29
+ )
30
+ endif ()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-tvos",
3
- "version": "0.83.0-0rc2",
3
+ "version": "0.83.1-0",
4
4
  "description": "A framework for building native apps using React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -164,12 +164,12 @@
164
164
  },
165
165
  "dependencies": {
166
166
  "@jest/create-cache-key-function": "^29.7.0",
167
- "@react-native/assets-registry": "0.83.0-rc.2",
168
- "@react-native/codegen": "0.83.0-rc.2",
169
- "@react-native/community-cli-plugin": "0.83.0-rc.2",
170
- "@react-native/gradle-plugin": "0.83.0-rc.2",
171
- "@react-native/js-polyfills": "0.83.0-rc.2",
172
- "@react-native/normalize-colors": "0.83.0-rc.2",
167
+ "@react-native/assets-registry": "0.83.1",
168
+ "@react-native/codegen": "0.83.1",
169
+ "@react-native/community-cli-plugin": "0.83.1",
170
+ "@react-native/gradle-plugin": "0.83.1",
171
+ "@react-native/js-polyfills": "0.83.1",
172
+ "@react-native/normalize-colors": "0.83.1",
173
173
  "abort-controller": "^3.0.0",
174
174
  "anser": "^1.4.9",
175
175
  "ansi-regex": "^5.0.0",
@@ -197,7 +197,7 @@
197
197
  "whatwg-fetch": "^3.0.0",
198
198
  "ws": "^7.5.10",
199
199
  "yargs": "^17.6.2",
200
- "@react-native-tvos/virtualized-lists": "0.83.0-0rc2"
200
+ "@react-native-tvos/virtualized-lists": "0.83.1-0"
201
201
  },
202
202
  "codegenConfig": {
203
203
  "libraries": [
@@ -136,4 +136,21 @@ if (android != null) {
136
136
  };
137
137
  }
138
138
 
139
+ try {
140
+ const apple = require('@react-native-community/cli-platform-apple');
141
+ const tvosCommands = require('./tvosCommands');
142
+
143
+ config.commands.push(...tvosCommands);
144
+ config.platforms.tvos = {
145
+ projectConfig: apple.getProjectConfig({platformName: 'tvos'}),
146
+ dependencyConfig: apple.getDependencyConfig({platformName: 'tvos'}),
147
+ };
148
+ } catch {
149
+ if (verbose) {
150
+ console.warn(
151
+ '@react-native-community/cli-platform-apple not found, the react-native.config.js may be unusable.',
152
+ );
153
+ }
154
+ }
155
+
139
156
  module.exports = config;
@@ -235,7 +235,16 @@ class ReactNativeCoreUtils
235
235
 
236
236
  # Add the dSYMs folder to the framework folder
237
237
  rncore_log(" Adding dSYMs to framework tarball")
238
- `(cd "$(dirname "#{dsyms_tmp_dir}")" && mkdir -p React.xcframework && cp -r "$(basename "#{dsyms_tmp_dir}")" React.xcframework/dSYMs && tar -rf "#{frameworkTarPath}" React.xcframework/dSYMs && rm -rf React.xcframework)`
238
+
239
+ # Move symbol bundles into each of the slices in the xcframework
240
+ # Example:
241
+ # move dSYMs/ios-arm64/. into React.xcframework/ios-arm64/React.framework/dSYMs/.
242
+ Dir.glob(File.join(dsyms_tmp_dir, "*")).each do |dsym_path|
243
+ slice_name = File.basename(dsym_path)
244
+ slice_dsym_dest = File.join("React.xcframework", slice_name, "React.framework", "dSYMs")
245
+ rncore_log(" Adding dSYM slice #{slice_name} into tarball at #{slice_dsym_dest}")
246
+ `(cd "#{File.dirname(frameworkTarPath)}" && mkdir -p "#{slice_dsym_dest}" && cp -R "#{dsym_path}/." "#{slice_dsym_dest}" && tar -rf "#{frameworkTarPath}" "#{slice_dsym_dest}")`
247
+ end
239
248
 
240
249
  # Now gzip the framework tarball again - remember to use the .tar file and not the .gz file
241
250
  rncore_log(" Packing #{Pathname.new(frameworkTarPath).relative_path_from(Pathname.pwd).to_s}")
@@ -248,6 +257,10 @@ class ReactNativeCoreUtils
248
257
  # Remove backup of original tarballs
249
258
  FileUtils.rm_f("#{frameworkTarball}.orig")
250
259
 
260
+ # Remove temp dSYMs folder and the temp Framework folder
261
+ FileUtils.rm_rf(dsyms_tmp_dir)
262
+ FileUtils.rm_rf(File.join(artifacts_dir, "React.xcframework"))
263
+
251
264
  rescue => e
252
265
  rncore_log("Failed to process dSYMs: #{e.message}", :error)
253
266
  # Restore the original tarballs
@@ -58,9 +58,13 @@ class ReactNativePodsUtils
58
58
 
59
59
  def self.set_gcc_preprocessor_definition_for_debugger(installer)
60
60
  self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED=1", "React-jsinspector", :debug)
61
+ self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED=1", "React-jsinspectornetwork", :debug)
61
62
  self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED=1", "React-RCTNetwork", :debug)
63
+ self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED=1", "React-networking", :debug)
62
64
  self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1", "React-jsinspector", :debug)
65
+ self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1", "React-jsinspectornetwork", :debug)
63
66
  self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1", "React-RCTNetwork", :debug)
67
+ self.add_build_settings_to_pod(installer, "GCC_PREPROCESSOR_DEFINITIONS", "REACT_NATIVE_DEBUGGER_ENABLED_DEVONLY=1", "React-networking", :debug)
64
68
  end
65
69
 
66
70
  def self.turn_off_resource_bundle_react_core(installer)
@@ -76,14 +76,18 @@ function getInputFiles(appPath /*: string */, appPkgJson /*: $FlowFixMe */) {
76
76
  return `[${list}]`;
77
77
  }
78
78
 
79
- function codegenScripts(appPath /*: string */, outputPath /*: string */) {
80
- const relativeAppPath = path.relative(outputPath, appPath);
79
+ function codegenScripts(appPath /*: string */, baseOutputPath /*: string */) {
80
+ const relativeAppPath = path.relative(baseOutputPath, appPath);
81
+ const relativeReactNativeRootFolder = path.relative(
82
+ baseOutputPath,
83
+ REACT_NATIVE_PACKAGE_ROOT_FOLDER,
84
+ );
81
85
  return `<<-SCRIPT
82
86
  pushd "$PODS_ROOT/../" > /dev/null
83
87
  RCT_SCRIPT_POD_INSTALLATION_ROOT=$(pwd)
84
88
  popd >/dev/null
85
89
 
86
- export RCT_SCRIPT_RN_DIR="$RCT_SCRIPT_POD_INSTALLATION_ROOT/${path.relative(outputPath, REACT_NATIVE_PACKAGE_ROOT_FOLDER)}"
90
+ export RCT_SCRIPT_RN_DIR="$RCT_SCRIPT_POD_INSTALLATION_ROOT/${relativeReactNativeRootFolder}"
87
91
  export RCT_SCRIPT_APP_PATH="$RCT_SCRIPT_POD_INSTALLATION_ROOT/${relativeAppPath.length === 0 ? '.' : relativeAppPath}"
88
92
  export RCT_SCRIPT_OUTPUT_DIR="$RCT_SCRIPT_POD_INSTALLATION_ROOT"
89
93
  export RCT_SCRIPT_TYPE="withCodegenDiscovery"
@@ -63,7 +63,7 @@ const path = require('path');
63
63
  function execute(
64
64
  projectRoot /*: string */,
65
65
  targetPlatform /*: string */,
66
- baseOutputPath /*: string */,
66
+ optionalBaseOutputPath /*: ?string */,
67
67
  source /*: string */,
68
68
  runReactNativeCodegen /*: boolean */ = true,
69
69
  ) {
@@ -88,32 +88,35 @@ function execute(
88
88
  buildCodegenIfNeeded();
89
89
  }
90
90
 
91
- const reactNativeConfig = readReactNativeConfig(
92
- projectRoot,
93
- // NOTE: Used to load `build/generated/autolinking/autolinking.json` generated by `scripts/cocoapods/autolinking.rb`
94
- // If we have RCT_SCRIPT_OUTPUT_DIR (set in `react_native_pods_utils/script_phases.sh`, it takes precedence, otherwise
95
- // we search for the `autolinking.json` output in the `baseOutputPath`
96
- process.env.RCT_SCRIPT_OUTPUT_DIR != null &&
97
- process.env.RCT_SCRIPT_OUTPUT_DIR.length > 0
98
- ? process.env.RCT_SCRIPT_OUTPUT_DIR
99
- : baseOutputPath,
100
- );
101
-
102
- const codegenEnabledLibraries = findCodegenEnabledLibraries(
103
- pkgJson,
104
- projectRoot,
105
- baseOutputPath,
106
- reactNativeConfig,
107
- );
108
-
109
- if (codegenEnabledLibraries.length === 0) {
110
- codegenLog('No codegen-enabled libraries found.', true);
111
- }
112
-
113
- let platforms =
91
+ const platforms =
114
92
  targetPlatform === 'all' ? supportedPlatforms : [targetPlatform];
115
93
 
94
+ // NOTE: We cache the external libraries search (which may not run) across platforms to not change previous behaviour
95
+ const externalLibrariesCache /*: { current?: ?Array<$FlowFixMe> } */ = {};
96
+
116
97
  for (const platform of platforms) {
98
+ // NOTE: This needs to be computed per-platform since `platform` can alter the path via a `package.json:codegenConfig.outputDir[platform]` override
99
+ const baseOutputPath = computeBaseOutputPath(
100
+ projectRoot,
101
+ optionalBaseOutputPath,
102
+ pkgJson,
103
+ platform,
104
+ );
105
+ const reactNativeConfig = readReactNativeConfig(
106
+ projectRoot,
107
+ baseOutputPath,
108
+ );
109
+ const codegenEnabledLibraries = findCodegenEnabledLibraries(
110
+ pkgJson,
111
+ projectRoot,
112
+ baseOutputPath,
113
+ reactNativeConfig,
114
+ externalLibrariesCache,
115
+ );
116
+ if (codegenEnabledLibraries.length === 0) {
117
+ codegenLog('No codegen-enabled libraries found.', true);
118
+ }
119
+
117
120
  const disabledLibraries = findDisabledLibrariesByPlatform(
118
121
  reactNativeConfig,
119
122
  platform,
@@ -209,22 +212,38 @@ function readOutputDirFromPkgJson(
209
212
  return null;
210
213
  }
211
214
 
212
- function computeOutputPath(
215
+ function computeBaseOutputPath(
213
216
  projectRoot /*: string */,
214
- baseOutputPath /*: string */,
217
+ optionalBaseOutputPath /*: ?string */,
215
218
  pkgJson /*: $FlowFixMe */,
216
219
  platform /*: string */,
217
220
  ) {
218
- if (baseOutputPath == null) {
221
+ if (
222
+ process.env.RCT_SCRIPT_OUTPUT_DIR != null &&
223
+ process.env.RCT_SCRIPT_OUTPUT_DIR.length > 0
224
+ ) {
225
+ return process.env.RCT_SCRIPT_OUTPUT_DIR;
226
+ }
227
+ let baseOutputPath /*: string */;
228
+ if (optionalBaseOutputPath == null) {
219
229
  const outputDirFromPkgJson = readOutputDirFromPkgJson(pkgJson, platform);
220
230
  if (outputDirFromPkgJson != null) {
221
- // $FlowFixMe[reassign-const]
222
231
  baseOutputPath = path.join(projectRoot, outputDirFromPkgJson);
223
232
  } else {
224
- // $FlowFixMe[reassign-const]
225
233
  baseOutputPath = projectRoot;
226
234
  }
235
+ } else {
236
+ baseOutputPath = optionalBaseOutputPath;
227
237
  }
238
+ return baseOutputPath;
239
+ }
240
+
241
+ function computeOutputPath(
242
+ projectRoot /*: string */,
243
+ baseOutputPath /*: string */,
244
+ pkgJson /*: $FlowFixMe */,
245
+ platform /*: string */,
246
+ ) /*: string */ {
228
247
  if (pkgJsonIncludesGeneratedCode(pkgJson)) {
229
248
  // Don't create nested directories for libraries to make importing generated headers easier.
230
249
  return baseOutputPath;
@@ -98,9 +98,11 @@ function cleanupEmptyFilesAndFolders(filepath /*: string */) {
98
98
  }
99
99
 
100
100
  function readGeneratedAutolinkingOutput(
101
+ projectRoot /*: string */,
101
102
  baseOutputPath /*: string */,
102
103
  ) /*: $FlowFixMe */ {
103
104
  // NOTE: Generated by scripts/cocoapods/autolinking.rb in list_native_modules (called by use_native_modules)
105
+ // The `baseOutputPath` is based on a CLI argument and optional
104
106
  const autolinkingGeneratedPath = path.resolve(
105
107
  baseOutputPath,
106
108
  'build/generated/autolinking/autolinking.json',
@@ -120,7 +122,10 @@ function readReactNativeConfig(
120
122
  projectRoot /*: string */,
121
123
  baseOutputPath /*: string */,
122
124
  ) /*: $FlowFixMe */ {
123
- const autolinkingOutput = readGeneratedAutolinkingOutput(baseOutputPath);
125
+ const autolinkingOutput = readGeneratedAutolinkingOutput(
126
+ projectRoot,
127
+ baseOutputPath,
128
+ );
124
129
  const rnConfigFilePath = path.resolve(projectRoot, 'react-native.config.js');
125
130
  if (autolinkingOutput) {
126
131
  return autolinkingOutput;
@@ -141,6 +146,7 @@ function findCodegenEnabledLibraries(
141
146
  projectRoot /*: string */,
142
147
  baseOutputPath /*: string */,
143
148
  reactNativeConfig /*: $FlowFixMe */,
149
+ externalLibrariesCache /*: { current?: ?Array<$FlowFixMe> } */ = {},
144
150
  ) /*: Array<$FlowFixMe> */ {
145
151
  const projectLibraries = findProjectRootLibraries(pkgJson, projectRoot);
146
152
  if (pkgJsonIncludesGeneratedCode(pkgJson)) {
@@ -149,8 +155,14 @@ function findCodegenEnabledLibraries(
149
155
  const libraries = [...projectLibraries];
150
156
  // If we ran autolinking, we shouldn't try to run our own "autolinking-like"
151
157
  // library discovery
152
- if (!readGeneratedAutolinkingOutput(baseOutputPath)) {
153
- libraries.push(...findExternalLibraries(pkgJson, projectRoot));
158
+ if (!readGeneratedAutolinkingOutput(projectRoot, baseOutputPath)) {
159
+ const externalLibraries =
160
+ externalLibrariesCache.current ??
161
+ (externalLibrariesCache.current = findExternalLibraries(
162
+ pkgJson,
163
+ projectRoot,
164
+ ));
165
+ libraries.push(...externalLibraries);
154
166
  }
155
167
  libraries.push(
156
168
  ...findLibrariesFromReactNativeConfig(projectRoot, reactNativeConfig),
@@ -266,7 +278,8 @@ function findExternalLibraries(
266
278
  pkgJson.dependencies[dependency],
267
279
  'package.json',
268
280
  );
269
- } else {
281
+ }
282
+ if (!configFilePath) {
270
283
  return [];
271
284
  }
272
285
  }
@@ -1 +1 @@
1
- hermes-v250829098.0.3
1
+ hermes-v250829098.0.4
@@ -72,10 +72,7 @@ Pod::Spec.new do |spec|
72
72
  # In other cases, when using Hermes V1, the prebuilt versioned binaries can be used.
73
73
  if source_type != HermesEngineSourceType::LOCAL_PREBUILT_TARBALL
74
74
  hermes_compiler_path = File.dirname(Pod::Executable.execute_command('node', ['-p',
75
- 'require.resolve(
76
- "hermes-compiler",
77
- {paths: [process.argv[1]]}
78
- )', __dir__]).strip
75
+ "require.resolve(\"hermes-compiler\", {paths: [\"#{react_native_path}\"]})", __dir__]).strip
79
76
  )
80
77
 
81
78
  spec.user_target_xcconfig = {
@@ -1,2 +1,2 @@
1
1
  HERMES_VERSION_NAME=0.14.0
2
- HERMES_V1_VERSION_NAME=250829098.0.3
2
+ HERMES_V1_VERSION_NAME=250829098.0.4