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,161 @@
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-autolinking-config.js — JS port of the autolinking.json
15
+ * generation step in packages/react-native/scripts/cocoapods/autolinking.rb.
16
+ *
17
+ * Invokes the React Native community CLI to produce its config and writes the
18
+ * raw JSON to <project.ios.sourceDir>/build/generated/autolinking/autolinking.json.
19
+ *
20
+ * No filtering or reshaping happens here — the downstream consumer
21
+ * (generate-spm-autolinking.js) does its own iOS-only filtering when reading
22
+ * the file.
23
+ *
24
+ * Removes the implicit `pod install` dependency the SPM flow has today for
25
+ * external dep discovery.
26
+ */
27
+
28
+ const {spawnSync} = require('child_process');
29
+ const fs = require('fs');
30
+ const path = require('path');
31
+
32
+ /*::
33
+ import type {CliConfigJson} from './spm-types';
34
+
35
+ type CliRunnerResult = {
36
+ stdout: string,
37
+ stderr: string,
38
+ exitCode: number,
39
+ };
40
+ type CliRunner = (
41
+ command: Array<string>,
42
+ opts: {cwd: string},
43
+ ) => CliRunnerResult;
44
+ type Options = {
45
+ projectRoot: string,
46
+ configCommand?: Array<string>,
47
+ cliRunner?: CliRunner,
48
+ };
49
+ type GenerateAutolinkingConfigResult = {
50
+ config: CliConfigJson,
51
+ outputPath: string,
52
+ rawJson: string,
53
+ };
54
+ */
55
+
56
+ const FALLBACK_CONFIG_COMMAND = [
57
+ 'npx',
58
+ '--no-install',
59
+ '@react-native-community/cli',
60
+ 'config',
61
+ ];
62
+
63
+ function resolveDefaultConfigCommand(
64
+ projectRoot /*: string */,
65
+ ) /*: Array<string> */ {
66
+ try {
67
+ const pkgJsonPath = require.resolve(
68
+ '@react-native-community/cli/package.json',
69
+ {paths: [projectRoot]},
70
+ );
71
+ // $FlowFixMe[unclear-type] package.json has dynamic shape
72
+ const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
73
+ const bin = pkgJson.bin;
74
+ const binPath =
75
+ typeof bin === 'string'
76
+ ? bin
77
+ : typeof bin?.['rnc-cli'] === 'string'
78
+ ? bin['rnc-cli']
79
+ : bin != null && typeof bin === 'object'
80
+ ? bin[Object.keys(bin)[0]]
81
+ : null;
82
+
83
+ if (typeof binPath === 'string' && binPath.length > 0) {
84
+ return [
85
+ process.execPath,
86
+ path.join(path.dirname(pkgJsonPath), binPath),
87
+ 'config',
88
+ ];
89
+ }
90
+ } catch {
91
+ // Fall through to a no-install npx invocation for older layouts.
92
+ }
93
+
94
+ return FALLBACK_CONFIG_COMMAND;
95
+ }
96
+
97
+ function defaultCliRunner(
98
+ command /*: Array<string> */,
99
+ opts /*: {cwd: string} */,
100
+ ) /*: CliRunnerResult */ {
101
+ const result = spawnSync(command[0], command.slice(1), {
102
+ cwd: opts.cwd,
103
+ encoding: 'utf8',
104
+ stdio: ['ignore', 'pipe', 'pipe'],
105
+ maxBuffer: 64 * 1024 * 1024,
106
+ });
107
+ return {
108
+ stdout: typeof result.stdout === 'string' ? result.stdout : '',
109
+ stderr: typeof result.stderr === 'string' ? result.stderr : '',
110
+ exitCode: typeof result.status === 'number' ? result.status : 1,
111
+ };
112
+ }
113
+
114
+ function generateAutolinkingConfig(
115
+ opts /*: Options */,
116
+ ) /*: GenerateAutolinkingConfigResult */ {
117
+ const {
118
+ projectRoot,
119
+ configCommand = resolveDefaultConfigCommand(projectRoot),
120
+ cliRunner = defaultCliRunner,
121
+ } = opts;
122
+
123
+ if (!Array.isArray(configCommand) || configCommand.length === 0) {
124
+ throw new Error(
125
+ 'generate-spm-autolinking-config: config command must be a non-empty array of strings',
126
+ );
127
+ }
128
+
129
+ const result = cliRunner(configCommand, {cwd: projectRoot});
130
+
131
+ if (result.exitCode !== 0) {
132
+ throw new Error(
133
+ `generate-spm-autolinking-config: '${configCommand.join(' ')}' exited with status ${result.exitCode}\n${result.stderr}`,
134
+ );
135
+ }
136
+
137
+ const rawJson = result.stdout;
138
+ const config /*: CliConfigJson */ = JSON.parse(rawJson);
139
+
140
+ const iosSourceDir = config?.project?.ios?.sourceDir;
141
+ if (typeof iosSourceDir !== 'string' || iosSourceDir.length === 0) {
142
+ throw new Error(
143
+ 'generate-spm-autolinking-config: CLI config did not provide project.ios.sourceDir',
144
+ );
145
+ }
146
+
147
+ const outPath = path.join(
148
+ iosSourceDir,
149
+ 'build',
150
+ 'generated',
151
+ 'autolinking',
152
+ 'autolinking.json',
153
+ );
154
+
155
+ fs.mkdirSync(path.dirname(outPath), {recursive: true});
156
+ fs.writeFileSync(outPath, rawJson);
157
+
158
+ return {config, outputPath: outPath, rawJson};
159
+ }
160
+
161
+ module.exports = {generateAutolinkingConfig, resolveDefaultConfigCommand};