react-native 0.87.0-rc.1 → 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 (51) hide show
  1. package/Libraries/Core/InitializeCore.js +8 -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/React/Base/RCTVersion.m +1 -1
  6. package/React/I18n/RCTLocalizedString.mm +38 -2
  7. package/React-Core-prebuilt.podspec +45 -17
  8. package/React-Core.podspec +9 -2
  9. package/ReactAndroid/external-artifacts/build.gradle.kts +49 -0
  10. package/ReactAndroid/gradle.properties +1 -1
  11. package/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/SynchronousMountItem.kt +8 -2
  12. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
  13. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  14. package/package.json +10 -8
  15. package/react-native.config.js +81 -0
  16. package/scripts/cocoapods/fabric.rb +1 -1
  17. package/scripts/cocoapods/rncore.rb +35 -78
  18. package/scripts/cocoapods/rncore_facades.rb +232 -0
  19. package/scripts/cocoapods/rndependencies.rb +64 -3
  20. package/scripts/cocoapods/rndeps_facades.rb +193 -0
  21. package/scripts/cocoapods/spm.rb +78 -11
  22. package/scripts/codegen/templates/Package.swift.spm-template +97 -0
  23. package/scripts/react-native-xcode.sh +20 -0
  24. package/scripts/react_native_pods.rb +65 -16
  25. package/scripts/replace-rncore-version.js +53 -6
  26. package/scripts/setup-apple-spm.js +1165 -0
  27. package/scripts/spm/__doc__/rfc-spm-xcframework.md +707 -0
  28. package/scripts/spm/__doc__/spm-autolinking-plugins.md +244 -0
  29. package/scripts/spm/__doc__/spm-header-paths-contract.md +97 -0
  30. package/scripts/spm/__doc__/spm-plugins-assessment.md +128 -0
  31. package/scripts/spm/__doc__/spm-scripts.md +451 -0
  32. package/scripts/spm/autolinking-plugins.js +331 -0
  33. package/scripts/spm/download-spm-artifacts.js +1409 -0
  34. package/scripts/spm/expand-spm-dependencies.js +216 -0
  35. package/scripts/spm/flavored-frameworks.js +1008 -0
  36. package/scripts/spm/generate-spm-autolinking-config.js +161 -0
  37. package/scripts/spm/generate-spm-autolinking.js +1888 -0
  38. package/scripts/spm/generate-spm-package.js +302 -0
  39. package/scripts/spm/generate-spm-xcodeproj.js +2224 -0
  40. package/scripts/spm/read-podspec.js +695 -0
  41. package/scripts/spm/scaffold-package-swift.js +1206 -0
  42. package/scripts/spm/spm-pbxproj.js +654 -0
  43. package/scripts/spm/spm-types.js +517 -0
  44. package/scripts/spm/spm-utils.js +645 -0
  45. package/scripts/spm/sync-spm-autolinking.js +160 -0
  46. package/sdks/.hermesv1version +1 -0
  47. package/sdks/hermes-engine/utils/replace_hermes_version.js +18 -4
  48. package/sdks/hermes-engine/version.properties +1 -1
  49. package/third-party-podspecs/ReactNativeDependencies.podspec +2 -2
  50. package/types_generated/Libraries/ReactNative/AppRegistry.flow.d.ts +2 -2
  51. package/Libraries/Utilities/SceneTracker.js +0 -42
@@ -0,0 +1,160 @@
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
+ * sync-spm-autolinking.js – Lightweight script invoked by the Xcode pre-build
15
+ * phase to re-run invariant codegen and autolinking output when dependency
16
+ * inputs have changed.
17
+ *
18
+ * Usage (called from the Xcode build phase shell script):
19
+ * node sync-spm-autolinking.js --app-root <path> --react-native-root <path>
20
+ *
21
+ * The autolinking config (autolinking.json) is generated by the caller
22
+ * (setup-apple-spm.js) BEFORE this script runs, so codegen below can reuse it
23
+ * (findCodegenEnabledLibraries short-circuits on a present autolinking.json)
24
+ * and the slow `@react-native-community/cli config` runs exactly once per sync.
25
+ *
26
+ * This script:
27
+ * 0. Runs react-native codegen → build/generated/ios/ (reuses autolinking.json)
28
+ * 1. Installs the codegen template into build/generated/ios/Package.swift,
29
+ * replacing codegen's mis-rooted default (done immediately, before any
30
+ * step below that can throw — see the failure-atomicity comment at the
31
+ * call site)
32
+ * 2. Calls generate-spm-autolinking.js → build/generated/autolinking/Package.swift
33
+ * 3. Rebuilds the generated-headers farm
34
+ * 4. Writes build/generated/autolinking/.spm-sync-stamp
35
+ *
36
+ * Runtime frameworks are deliberately not downloaded or regenerated from an
37
+ * Xcode build. `spm add` / `spm update` own the immutable dual-flavor slots and
38
+ * the app target's linker/embed configuration.
39
+ */
40
+
41
+ const {main: generateAutolinking} = require('./generate-spm-autolinking');
42
+ const {
43
+ RemoteVersionError,
44
+ buildPerAppHeaderTree,
45
+ findProjectRoot,
46
+ installSpmCodegenTemplate,
47
+ makeLogger,
48
+ runCodegenAndInstallTemplate,
49
+ } = require('./spm-utils');
50
+ const fs = require('fs');
51
+ const path = require('path');
52
+ const yargs = require('yargs');
53
+
54
+ const {log} = makeLogger('sync-spm-autolinking');
55
+
56
+ // Collaborators are injected (with these real implementations as defaults) so
57
+ // main() can be exercised end-to-end in tests without mocking the module
58
+ // system. Tests pass fakes that record calls and point defaultCacheDir at a
59
+ // tempdir; everything fs-based runs for real against that tempdir.
60
+ const defaultDeps = {
61
+ runCodegenAndInstallTemplate,
62
+ generateAutolinking,
63
+ installSpmCodegenTemplate,
64
+ buildPerAppHeaderTree,
65
+ findProjectRoot,
66
+ };
67
+
68
+ async function main(
69
+ argv /*:: ?: Array<string> */,
70
+ overrides /*:: ?: Partial<typeof defaultDeps> */,
71
+ ) /*: Promise<void> */ {
72
+ const deps = {...defaultDeps, ...(overrides ?? {})};
73
+ const parsed = yargs(argv ?? process.argv.slice(2))
74
+ .version(false)
75
+ .option('app-root', {
76
+ type: 'string',
77
+ demandOption: true,
78
+ describe: 'Path to the app directory',
79
+ })
80
+ .option('react-native-root', {
81
+ type: 'string',
82
+ demandOption: true,
83
+ describe: 'Path to react-native package root',
84
+ })
85
+ .help()
86
+ .parseSync();
87
+
88
+ const appRoot = path.resolve(parsed['app-root']);
89
+ const reactNativeRoot = path.resolve(parsed['react-native-root']);
90
+ const projectRoot = deps.findProjectRoot(appRoot);
91
+
92
+ // The caller (setup-apple-spm.js) already generated autolinking.json before
93
+ // invoking this script, so codegen reuses it here.
94
+ try {
95
+ deps.runCodegenAndInstallTemplate(
96
+ projectRoot,
97
+ appRoot,
98
+ reactNativeRoot,
99
+ {log},
100
+ {
101
+ installTemplate: false,
102
+ },
103
+ );
104
+ } catch {
105
+ log('Codegen failed — continuing with existing output');
106
+ }
107
+
108
+ // Install the codegen template right away, before artifact download and
109
+ // autolinking-plugin execution below. Failure-atomicity: generateAutolinking
110
+ // runs fail-closed plugins that can throw, and if that happens before the
111
+ // template is installed, codegen's mis-rooted default manifest is left in
112
+ // build/generated/ios/Package.swift — breaking every subsequent Xcode
113
+ // "Resolve Package Graph". Installing it immediately after codegen means a
114
+ // later throw can never leave that broken manifest in place.
115
+ deps.installSpmCodegenTemplate(appRoot, reactNativeRoot, {log});
116
+
117
+ log('Re-generating build/generated/autolinking/Package.swift...');
118
+ deps.generateAutolinking([
119
+ '--app-root',
120
+ appRoot,
121
+ '--react-native-root',
122
+ reactNativeRoot,
123
+ ]);
124
+
125
+ // Rebuild the per-app generated-headers farm (vended as the ReactAppHeaders
126
+ // SPM target inside the codegen package). React core headers need no trees
127
+ // — they are vended by the invariant ReactHeaders/ReactNativeHeaders products.
128
+ // The
129
+ // generated manifests are fully declarative (fixed-relative package paths),
130
+ // so no path-locator JSON is written.
131
+ deps.buildPerAppHeaderTree(appRoot, {log});
132
+
133
+ const stampPath = path.join(
134
+ appRoot,
135
+ 'build',
136
+ 'generated',
137
+ 'autolinking',
138
+ '.spm-sync-stamp',
139
+ );
140
+ fs.mkdirSync(path.dirname(stampPath), {recursive: true});
141
+ fs.writeFileSync(stampPath, new Date().toISOString() + '\n', 'utf8');
142
+ log('SPM autolinking sync complete.');
143
+ }
144
+
145
+ if (require.main === module) {
146
+ main().catch(e => {
147
+ if (e instanceof RemoteVersionError) {
148
+ // Clean message + exit 2 (the build phase hard-fails on it) instead of a
149
+ // stack trace, matching how setup-apple-spm.js surfaces remote-mode
150
+ // version errors.
151
+ log(e.message);
152
+ process.exitCode = 2;
153
+ return;
154
+ }
155
+ console.error(e);
156
+ process.exitCode = 1;
157
+ });
158
+ }
159
+
160
+ module.exports = {main};
@@ -0,0 +1 @@
1
+ hermes-v250829098.0.16
@@ -14,7 +14,7 @@ const {spawnSync} = require('child_process');
14
14
  const fs = require('fs');
15
15
  const yargs = require('yargs');
16
16
 
17
- const LAST_BUILD_FILENAME = '.last_build_configuration';
17
+ const LAST_BUILD_FILENAME = 'hermes-engine/.last_build_configuration';
18
18
 
19
19
  function validateBuildConfiguration(configuration) {
20
20
  if (!['Debug', 'Release'].includes(configuration)) {
@@ -56,15 +56,29 @@ function shouldReplaceHermesConfiguration(configuration) {
56
56
  function replaceHermesConfiguration(configuration, version, podsRoot) {
57
57
  const tarballURLPath = `${podsRoot}/hermes-engine-artifacts/hermes-ios-${version.toLowerCase()}-${configuration.toLowerCase()}.tar.gz`;
58
58
 
59
+ if (!fs.existsSync(tarballURLPath)) {
60
+ throw new Error(`Hermes tarball not found at ${tarballURLPath}`);
61
+ }
62
+
59
63
  const finalLocation = 'hermes-engine';
60
64
  console.log('Preparing the final location');
61
65
  fs.rmSync(finalLocation, {force: true, recursive: true});
62
66
  fs.mkdirSync(finalLocation, {recursive: true});
63
67
 
64
68
  console.log('Extracting the tarball');
65
- spawnSync('tar', ['-xf', tarballURLPath, '-C', finalLocation], {
66
- stdio: 'inherit',
67
- });
69
+ const result = spawnSync(
70
+ 'tar',
71
+ ['-xf', tarballURLPath, '-C', finalLocation],
72
+ {
73
+ stdio: 'inherit',
74
+ },
75
+ );
76
+ if (result.status !== 0) {
77
+ fs.rmSync(finalLocation, {force: true, recursive: true});
78
+ throw new Error(
79
+ `Failed to extract ${tarballURLPath}: ${result.error?.message ?? `tar exited with status ${result.status}`}`,
80
+ );
81
+ }
68
82
  }
69
83
 
70
84
  function updateLastBuildConfiguration(configuration) {
@@ -1 +1 @@
1
- HERMES_VERSION_NAME=250829098.0.13
1
+ HERMES_VERSION_NAME=250829098.0.16
@@ -53,13 +53,13 @@ Pod::Spec.new do |spec|
53
53
  # Check if XCFRAMEWORK_PATH is empty
54
54
  if [ -z "$XCFRAMEWORK_PATH" ]; then
55
55
  echo "ERROR: XCFRAMEWORK_PATH is empty."
56
- exit 0
56
+ exit 1
57
57
  fi
58
58
 
59
59
  # Check if HEADERS_PATH is empty
60
60
  if [ -z "$HEADERS_PATH" ]; then
61
61
  echo "ERROR: HEADERS_PATH is empty."
62
- exit 0
62
+ exit 1
63
63
  fi
64
64
 
65
65
  cp -R "$HEADERS_PATH/." Headers
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<ccf8d135ed3ff1cceb054f570091639a>>
7
+ * @generated SignedSource<<35a87be1231250402e878ae18738792b>>
8
8
  *
9
9
  * This file was translated from Flow by scripts/js-api/build-types/index.js.
10
10
  * Original file: packages/react-native/Libraries/ReactNative/AppRegistry.flow.js
@@ -39,5 +39,5 @@ export type Registry = {
39
39
  sections: ReadonlyArray<string>;
40
40
  runnables: Runnables;
41
41
  };
42
- export type WrapperComponentProvider = (appParameters: Object) => React.ComponentType<any>;
42
+ export type WrapperComponentProvider = (appParameters: Object, appKey?: string) => React.ComponentType<any>;
43
43
  export type RootViewStyleProvider = (appParameters: Object) => ViewStyleProp;
@@ -1,42 +0,0 @@
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
8
- * @format
9
- */
10
-
11
- 'use strict';
12
-
13
- export type Scene = {name: string, [string]: unknown, ...};
14
-
15
- let _listeners: Array<(scene: Scene) => void> = [];
16
-
17
- let _activeScene: Scene = {name: 'default'};
18
-
19
- const SceneTracker = {
20
- setActiveScene(scene: Scene) {
21
- _activeScene = scene;
22
- _listeners.forEach(listener => listener(_activeScene));
23
- },
24
-
25
- getActiveScene(): Scene {
26
- return _activeScene;
27
- },
28
-
29
- addActiveSceneChangedListener(callback: (scene: Scene) => void): {
30
- remove: () => void,
31
- ...
32
- } {
33
- _listeners.push(callback);
34
- return {
35
- remove: () => {
36
- _listeners = _listeners.filter(listener => callback !== listener);
37
- },
38
- };
39
- },
40
- };
41
-
42
- export default SceneTracker;