react-native 0.88.0-rc.0 → 0.88.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 (61) hide show
  1. package/Libraries/Core/ReactNativeVersion.js +1 -1
  2. package/Libraries/Renderer/implementations/ReactFabric-dev.js +3056 -1531
  3. package/Libraries/Renderer/implementations/ReactFabric-prod.js +2239 -1011
  4. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +2451 -1124
  5. package/React/Base/RCTVersion.m +1 -1
  6. package/React/FBReactNativeSpec/FBReactNativeSpec/FBReactNativeSpec.h +3 -4
  7. package/React/FBReactNativeSpec/FBReactNativeSpecJSI.h +8 -0
  8. package/ReactAndroid/gradle.properties +1 -1
  9. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +7 -1
  10. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +11 -1
  11. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +3 -1
  12. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +3 -1
  13. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +12 -1
  14. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsOverrides_RNOSS_Canary_Android.kt +3 -1
  15. package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +3 -1
  16. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
  17. package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +15 -1
  18. package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +4 -1
  19. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  20. package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +5 -1
  21. package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +6 -1
  22. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +74 -56
  23. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +4 -2
  24. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +5 -1
  25. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +10 -1
  26. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsOverridesOSSCanary.h +5 -1
  27. package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +2 -1
  28. package/ReactCommon/react/nativemodule/core/iostests/RCTTurboModuleTests.mm +18 -65
  29. package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTInteropTurboModule.h +1 -2
  30. package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTInteropTurboModule.mm +1 -2
  31. package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.h +2 -9
  32. package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm +33 -71
  33. package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +6 -1
  34. package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +3 -1
  35. package/ReactCommon/react/nativemodule/samples/platform/ios/ReactCommon/RCTSampleTurboModule.mm +8 -19
  36. package/package.json +16 -13
  37. package/scripts/codegen/generate-artifacts-executor/generateRCTThirdPartyComponents.js +18 -4
  38. package/scripts/setup-apple-spm.js +82 -4
  39. package/scripts/spm/autolinking-plugins.js +8 -5
  40. package/scripts/spm/expand-spm-dependencies.js +217 -156
  41. package/scripts/spm/generate-spm-autolinking.js +114 -88
  42. package/scripts/spm/generate-spm-xcodeproj.js +67 -22
  43. package/scripts/spm/ios-deployment-target.js +378 -0
  44. package/scripts/spm/read-podspec.js +156 -8
  45. package/scripts/spm/scaffold-package-swift.js +272 -105
  46. package/scripts/spm/spm-pbxproj.js +36 -21
  47. package/scripts/spm/spm-types.js +25 -8
  48. package/scripts/spm/spm-utils.js +26 -0
  49. package/scripts/spm/swiftpm-config.js +245 -0
  50. package/scripts/spm/sync-spm-autolinking.js +11 -2
  51. package/sdks/hermes-engine/version.properties +1 -1
  52. package/src/private/featureflags/ReactNativeFeatureFlags.js +10 -5
  53. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +2 -1
  54. package/src/private/webapis/dom/nodes/ReactNativeElement.js +6 -4
  55. package/src/private/webapis/dom/nodes/ReadOnlyText.js +6 -4
  56. package/src/react-private-interface.js +4 -0
  57. package/src/react-private-interface.js.flow +2 -0
  58. package/types_generated/Libraries/ReactNative/FabricUIManager.d.ts +47 -0
  59. package/types_generated/src/react-private-interface.d.ts +4 -1
  60. package/React/Base/RCTArrayBuffer.h +0 -64
  61. package/React/Base/RCTArrayBuffer.mm +0 -127
@@ -99,10 +99,18 @@ const {
99
99
  findInjectedXcodeproj,
100
100
  injectSpmIntoExistingXcodeproj,
101
101
  readArtifactsVersionOverride,
102
+ readMarker,
102
103
  readPinnedConfigCommand,
103
104
  removeSpmInjection,
104
105
  } = require('./spm/generate-spm-xcodeproj');
105
- const {scaffoldAll} = require('./spm/scaffold-package-swift');
106
+ const {
107
+ MIN_IOS_VERSION_SUPPORTED,
108
+ resolveIosDeploymentTarget,
109
+ } = require('./spm/ios-deployment-target');
110
+ const {
111
+ refreshScaffoldedPlatformFloors,
112
+ scaffoldAll,
113
+ } = require('./spm/scaffold-package-swift');
106
114
  const {
107
115
  RemoteVersionError,
108
116
  buildPerAppHeaderTree,
@@ -452,6 +460,7 @@ async function runScaffold(
452
460
  appRoot /*: string */,
453
461
  projectRoot /*: string */,
454
462
  reactNativeRoot /*: string */,
463
+ iosDeploymentTarget /*: string */,
455
464
  ) /*: Promise<void> */ {
456
465
  // Resolve the cache slot identifier so the scaffolded files carry it as
457
466
  // a comment — that's how SPM's manifest hash bumps on slot transitions.
@@ -472,6 +481,7 @@ async function runScaffold(
472
481
  projectRoot,
473
482
  reactNativeRoot,
474
483
  cacheSlotLabel,
484
+ iosDeploymentTarget,
475
485
  // Always force a re-render so re-running after editing a podspec picks
476
486
  // up the new content.
477
487
  force: true,
@@ -490,15 +500,27 @@ async function runScaffold(
490
500
 
491
501
  if (written.length > 0) {
492
502
  log(`Scaffolded Package.swift for ${written.length} dep(s):`);
503
+ // Silent for the outcomes that changed nothing ('already-set', 'skipped').
504
+ const nameOutcome = (outcome /*: ?string */) /*: string */ => {
505
+ if (outcome === 'created' || outcome === 'inserted') {
506
+ return " — also recorded 'swiftpmConfig.name' in its package.json";
507
+ }
508
+ if (outcome === 'failed') {
509
+ return " — could NOT record 'swiftpmConfig.name'; the manifest is written, the name is not";
510
+ }
511
+ return '';
512
+ };
493
513
  for (const r of written) {
494
- log(` • ${r.depName}`);
514
+ log(` • ${r.depName}${nameOutcome(r.swiftpmName)}`);
495
515
  }
496
516
  log('');
497
517
  log(
498
518
  'node_modules is NOT committed and is wiped by `npm install`. To keep\n' +
499
519
  'these manifests, create and commit a patch with a tool like patch-package:\n' +
500
520
  ' • `npx patch-package <dep>` for each scaffolded dep, then commit the patch.\n' +
501
- 'Also consider asking the maintainer to ship a Package.swift upstream.\n' +
521
+ 'The patch also captures any recorded `swiftpmConfig.name`, which is what\n' +
522
+ 'lets the library be named without reading its podspec. Better still, ask the\n' +
523
+ 'maintainer to ship both upstream.\n' +
502
524
  'Without a committed patch the build will hard-error again after a fresh install.',
503
525
  );
504
526
  log('');
@@ -776,6 +798,29 @@ function resolveInjectionTarget(
776
798
  return {path: path.join(appRoot, names[0])};
777
799
  }
778
800
 
801
+ /** The app's own floor for every manifest this run generates, logged once. */
802
+ function resolveAppIosDeploymentTarget(
803
+ args /*: SetupArgs */,
804
+ appRoot /*: string */,
805
+ ) /*: string */ {
806
+ const target = resolveInjectionTarget(args, appRoot);
807
+ const xcodeprojPath = target.path ?? null;
808
+ const read = resolveIosDeploymentTarget({
809
+ xcodeprojPath,
810
+ targetUuid:
811
+ xcodeprojPath != null ? readMarker(xcodeprojPath)?.targetUuid : null,
812
+ targetName: args.productName,
813
+ });
814
+ const value = read ?? MIN_IOS_VERSION_SUPPORTED;
815
+ const origin =
816
+ read != null && xcodeprojPath != null
817
+ ? `from ${path.basename(xcodeprojPath)}`
818
+ : // `sync` and `scaffold` don't otherwise surface why no project was picked.
819
+ `react-native default${target.error != null ? `; ${target.error}` : ''}`;
820
+ log(`iOS deployment target: ${value} (${origin})`);
821
+ return value;
822
+ }
823
+
779
824
  /**
780
825
  * Inject SPM packages into the user's existing .xcodeproj, in place — the only
781
826
  * xcodeproj strategy (`add` and `update` both run this; there is no
@@ -1105,6 +1150,9 @@ async function main(argv /*:: ?: Array<string> */) /*: Promise<void> */ {
1105
1150
  }
1106
1151
  log(`Wrote ${path.relative(appRoot, autolinkingConfigResult.outputPath)}`);
1107
1152
  }
1153
+ const iosDeploymentTarget /*: string */ = needsCliConfig
1154
+ ? resolveAppIosDeploymentTarget(args, appRoot)
1155
+ : MIN_IOS_VERSION_SUPPORTED;
1108
1156
  const reactNativeRoot = resolveReactNativeRoot(
1109
1157
  autolinkingConfigResult,
1110
1158
  projectRoot,
@@ -1148,6 +1196,8 @@ async function main(argv /*:: ?: Array<string> */) /*: Promise<void> */ {
1148
1196
  appRoot,
1149
1197
  '--react-native-root',
1150
1198
  reactNativeRoot,
1199
+ '--ios-deployment-target',
1200
+ iosDeploymentTarget,
1151
1201
  ]);
1152
1202
  } catch (e) {
1153
1203
  if (e instanceof MissingManifestError) {
@@ -1181,10 +1231,35 @@ async function main(argv /*:: ?: Array<string> */) /*: Promise<void> */ {
1181
1231
  // visible and fixed deliberately (scaffold + patch-package, or upstream).
1182
1232
  // Auto-scaffolding would silently hide that real error.
1183
1233
  if (action === 'scaffold') {
1184
- await runScaffold(args, appRoot, projectRoot, reactNativeRoot);
1234
+ await runScaffold(
1235
+ args,
1236
+ appRoot,
1237
+ projectRoot,
1238
+ reactNativeRoot,
1239
+ iosDeploymentTarget,
1240
+ );
1185
1241
  }
1186
1242
 
1187
1243
  runCodegenStep(projectRoot, appRoot, reactNativeRoot, args.skipCodegen);
1244
+
1245
+ // A manifest scaffolded before the app's deployment target changed (or by a
1246
+ // pre-v20 scaffolder) would pin a floor SwiftPM then refuses to link against.
1247
+ if (
1248
+ (action === 'add' || action === 'update') &&
1249
+ autolinkingConfigResult != null
1250
+ ) {
1251
+ for (const refreshed of refreshScaffoldedPlatformFloors({
1252
+ appRoot,
1253
+ autolinkingJsonPath: autolinkingConfigResult.outputPath,
1254
+ iosDeploymentTarget,
1255
+ })) {
1256
+ log(
1257
+ `Refreshed platform floor in ${path.relative(appRoot, refreshed.path)}: ` +
1258
+ `${refreshed.from} → ${refreshed.to}`,
1259
+ );
1260
+ }
1261
+ }
1262
+
1188
1263
  log('Generating build/generated/autolinking/Package.swift...');
1189
1264
  try {
1190
1265
  generateAutolinking([
@@ -1192,6 +1267,8 @@ async function main(argv /*:: ?: Array<string> */) /*: Promise<void> */ {
1192
1267
  appRoot,
1193
1268
  '--react-native-root',
1194
1269
  reactNativeRoot,
1270
+ '--ios-deployment-target',
1271
+ iosDeploymentTarget,
1195
1272
  ]);
1196
1273
  } catch (e) {
1197
1274
  if (e instanceof MissingManifestError) {
@@ -1276,6 +1353,7 @@ module.exports = {
1276
1353
  generateAutolinkingConfigOrFailClosed,
1277
1354
  parseArgs,
1278
1355
  resolveAction,
1356
+ resolveAppIosDeploymentTarget,
1279
1357
  resolveConfigCommandToPin,
1280
1358
  resolveExplicitConfigCommand,
1281
1359
  shouldAutoDeintegrate,
@@ -85,6 +85,7 @@
85
85
  */
86
86
 
87
87
  const {isValidScriptPhaseId, isValidScriptPhaseName} = require('./spm-utils');
88
+ const {readSwiftpmConfig} = require('./swiftpm-config');
88
89
  const path = require('node:path');
89
90
 
90
91
  /*:: import type {
@@ -98,8 +99,8 @@ const path = require('node:path');
98
99
 
99
100
  /**
100
101
  * Discover plugins declared by autolinked deps. `readConfig(root)` returns the
101
- * dep's parsed react-native.config.js (or null). `denyList` is the app's
102
- * `spm.denyPlugins` (npm names to skip). Fail-closed: a declared-but-missing
102
+ * dep's parsed react-native.config.js (or null), which is one of the two homes
103
+ * the plugin may be declared in. `denyList` is the app's `denyPlugins`. Fail-closed: a declared-but-missing
103
104
  * or unloadable plugin throws, naming the dep — a framework silently dropping
104
105
  * its modules is worse than a loud stop.
105
106
  */
@@ -114,15 +115,17 @@ function discoverPlugins(
114
115
  if (denied.has(dep.name)) {
115
116
  continue;
116
117
  }
117
- const config = readConfig(dep.root);
118
118
  // $FlowFixMe[incompatible-use] config has a dynamic shape
119
- const rel = config?.spm?.autolinkingPlugin;
119
+ const rel = readSwiftpmConfig(
120
+ dep.root,
121
+ readConfig(dep.root),
122
+ )?.autolinkingPlugin;
120
123
  if (rel == null) {
121
124
  continue;
122
125
  }
123
126
  if (typeof rel !== 'string' || rel.length === 0) {
124
127
  throw new Error(
125
- `react-native spm: '${dep.name}' declares an invalid spm.autolinkingPlugin ` +
128
+ `react-native spm: '${dep.name}' declares an invalid 'swiftpmConfig.autolinkingPlugin' ` +
126
129
  `(expected a module path string).`,
127
130
  );
128
131
  }