peachsim 0.1.2667 → 0.1.2669

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 (135) hide show
  1. package/dist-lib/agent-daemon-client.cjs +1 -1
  2. package/dist-lib/agent-events.cjs +1 -1
  3. package/dist-lib/attached-projects.cjs +1 -1
  4. package/dist-lib/auth/shared-session.cjs +1 -1
  5. package/dist-lib/backend-origin.cjs +1 -1
  6. package/dist-lib/beta.cjs +1 -1
  7. package/dist-lib/beta.mjs +2 -2
  8. package/dist-lib/bridge-constants.cjs +1 -1
  9. package/dist-lib/bridge-contract-input.cjs +1 -1
  10. package/dist-lib/bridge-contract-input.mjs +5 -5
  11. package/dist-lib/bridge-contract.cjs +1 -1
  12. package/dist-lib/bridge-contract.mjs +3 -3
  13. package/dist-lib/bundle-channel.cjs +2900 -2673
  14. package/dist-lib/capture-contract.cjs +1 -1
  15. package/dist-lib/capture-contract.mjs +3 -3
  16. package/dist-lib/cloud-contract.cjs +1 -1
  17. package/dist-lib/cloud-contract.mjs +3 -3
  18. package/dist-lib/cloud-test-args.cjs +1 -1
  19. package/dist-lib/cloud-test-args.mjs +2 -2
  20. package/dist-lib/cloud.cjs +1 -1
  21. package/dist-lib/cloud.mjs +7 -7
  22. package/dist-lib/config.cjs +1 -1
  23. package/dist-lib/config.mjs +5 -5
  24. package/dist-lib/detox/index.cjs +1 -1
  25. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  26. package/dist-lib/esm-chunks/{acorn-J2VGYYCT.mjs → acorn-Y2ITHAGD.mjs} +3 -3
  27. package/dist-lib/esm-chunks/{chunk-OSJ75JCB.mjs → chunk-4S7ECHE6.mjs} +1 -1
  28. package/dist-lib/esm-chunks/{chunk-WITE6BFN.mjs → chunk-4W7RCQWJ.mjs} +6 -6
  29. package/dist-lib/esm-chunks/{chunk-VSYHDZ2D.mjs → chunk-7ETYLWJJ.mjs} +1 -1
  30. package/dist-lib/esm-chunks/{chunk-F3JFCSDZ.mjs → chunk-AFSFMJA7.mjs} +1 -1
  31. package/dist-lib/esm-chunks/{chunk-6PSCPUCQ.mjs → chunk-AX6M4YRZ.mjs} +1 -1
  32. package/dist-lib/esm-chunks/{chunk-IT7ZFZIA.mjs → chunk-B5WRW52W.mjs} +2 -2
  33. package/dist-lib/esm-chunks/{chunk-ZLHZX5X6.mjs → chunk-B6X5HYFY.mjs} +1 -1
  34. package/dist-lib/esm-chunks/{chunk-TLH4N2KQ.mjs → chunk-GXUOR7YU.mjs} +5 -5
  35. package/dist-lib/esm-chunks/{chunk-B6NELRM4.mjs → chunk-HIMY4MTQ.mjs} +1 -1
  36. package/dist-lib/esm-chunks/{chunk-KPGS7SQZ.mjs → chunk-HW24JXXU.mjs} +1 -1
  37. package/dist-lib/esm-chunks/{chunk-BWXEVKR6.mjs → chunk-LEXTFQ2S.mjs} +1 -1
  38. package/dist-lib/esm-chunks/{chunk-MPIJBEFV.mjs → chunk-LSDUP5I2.mjs} +3 -3
  39. package/dist-lib/esm-chunks/{chunk-7TKLIZ4U.mjs → chunk-LYLYHVST.mjs} +1 -1
  40. package/dist-lib/esm-chunks/{chunk-4OTQNJPC.mjs → chunk-N2C5JS22.mjs} +1 -1
  41. package/dist-lib/esm-chunks/{chunk-LV55OM2O.mjs → chunk-NB762DTK.mjs} +6 -6
  42. package/dist-lib/esm-chunks/{chunk-SY5PY7EC.mjs → chunk-NEGUR24D.mjs} +1 -1
  43. package/dist-lib/esm-chunks/{chunk-HIEV7BTG.mjs → chunk-NZ3KVB7N.mjs} +1 -1
  44. package/dist-lib/esm-chunks/{chunk-KUEFCCUR.mjs → chunk-OG5WWF6M.mjs} +5 -5
  45. package/dist-lib/esm-chunks/{chunk-IAPMXQWB.mjs → chunk-Q34ZCWHC.mjs} +1 -1
  46. package/dist-lib/esm-chunks/{chunk-N32UXW4F.mjs → chunk-QF5PBPBI.mjs} +1 -1
  47. package/dist-lib/esm-chunks/{chunk-PMZC73PE.mjs → chunk-RSMSSTAS.mjs} +17 -16
  48. package/dist-lib/esm-chunks/{chunk-TIBC4TF4.mjs → chunk-UPMM3HMR.mjs} +1 -1
  49. package/dist-lib/esm-chunks/{chunk-WDFZNT6D.mjs → chunk-XBCYEXXL.mjs} +1 -1
  50. package/dist-lib/esm-chunks/{chunk-4VGAYJQJ.mjs → chunk-YTLFSE7V.mjs} +1 -1
  51. package/dist-lib/esm-chunks/{metro-layout-parser-YV6U3SF2.mjs → metro-layout-parser-5LPEMNZ7.mjs} +3 -3
  52. package/dist-lib/esm-chunks/{swift-package-prebuilt-LU6YZSXI.mjs → swift-package-prebuilt-WBV6QKTU.mjs} +12 -12
  53. package/dist-lib/esm-chunks/{swift-sdk-app-module-LCQK2ZV7.mjs → swift-sdk-app-module-UKNPNJ5G.mjs} +16 -16
  54. package/dist-lib/esm-chunks/{swift-sdk-image-UTTTLU5C.mjs → swift-sdk-image-5WMX2RSY.mjs} +16 -16
  55. package/dist-lib/esm-chunks/{swift-sdk-image-producer-RI26IQDN.mjs → swift-sdk-image-producer-72GQDJX2.mjs} +5 -5
  56. package/dist-lib/expo-swift-bundle.cjs +4665 -4438
  57. package/dist-lib/expo-swift-metadata.cjs +1 -1
  58. package/dist-lib/expo-swift-metadata.mjs +7 -7
  59. package/dist-lib/home-paths.cjs +1 -1
  60. package/dist-lib/host/bridge-host.cjs +5036 -4809
  61. package/dist-lib/host/fetch-proxy-handler.cjs +509 -463
  62. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  63. package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
  64. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  65. package/dist-lib/host/websocket-proxy.cjs +1 -1
  66. package/dist-lib/index.cjs +1 -1
  67. package/dist-lib/kotlin-host.cjs +1 -1
  68. package/dist-lib/menu.cjs +1 -1
  69. package/dist-lib/menu.mjs +3 -3
  70. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  71. package/dist-lib/metro-fingerprint-registry.mjs +3 -3
  72. package/dist-lib/metro-production-bundle.cjs +1 -1
  73. package/dist-lib/metro-production-bundle.mjs +4 -4
  74. package/dist-lib/native-app-identity-project.cjs +3 -3
  75. package/dist-lib/native-app-identity-project.mjs +16 -16
  76. package/dist-lib/native-app-identity.cjs +2 -2
  77. package/dist-lib/native-app-identity.mjs +6 -6
  78. package/dist-lib/native-firebase-metadata.cjs +1 -1
  79. package/dist-lib/native-firebase-metadata.mjs +3 -3
  80. package/dist-lib/pdfium-raster.cjs +1 -1
  81. package/dist-lib/pdfium-raster.mjs +2 -2
  82. package/dist-lib/plist.cjs +1 -1
  83. package/dist-lib/plist.mjs +3 -3
  84. package/dist-lib/profiles.cjs +1 -1
  85. package/dist-lib/public-brand.cjs +1 -1
  86. package/dist-lib/public-origins-lib-esm.json +85 -85
  87. package/dist-lib/public-origins-lib.json +93 -93
  88. package/dist-lib/react-native-host-modules.cjs +1 -1
  89. package/dist-lib/react-native-host-modules.mjs +2 -2
  90. package/dist-lib/reap-browser.cjs +1 -1
  91. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  92. package/dist-lib/sdk.cjs +1 -1
  93. package/dist-lib/sdk.mjs +8 -8
  94. package/dist-lib/skills.cjs +4661 -4434
  95. package/dist-lib/swift-compile.cjs +4 -3
  96. package/dist-lib/swift-compile.mjs +12 -12
  97. package/dist-lib/swift-package.cjs +1 -1
  98. package/dist-lib/swift-package.mjs +3 -3
  99. package/dist-lib/swift-submit.cjs +1 -1
  100. package/dist-lib/swift-submit.mjs +6 -6
  101. package/dist-lib/swift-svg-raster.cjs +1 -1
  102. package/dist-lib/swift-svg-raster.mjs +2 -2
  103. package/dist-lib/swift-toolchain.cjs +1 -1
  104. package/dist-lib/swift.cjs +1 -1
  105. package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
  106. package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +1 -1
  107. package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +1 -1
  108. package/dist-lib/vendor/acorn.cjs +1 -1
  109. package/dist-lib/vendor/magic-string.cjs +1 -1
  110. package/dist-lib/vendor/stream-json.cjs +1 -1
  111. package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
  112. package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
  113. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
  114. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
  115. package/dist-lib/vendor/sucrase.cjs +1 -1
  116. package/dist-lib/vendor/terser.cjs +1 -1
  117. package/dist-lib/vendor/valibot.cjs +1 -1
  118. package/dist-lib/vendor/ws.cjs +1 -1
  119. package/dist-lib/vendor/zod.cjs +1 -1
  120. package/dist-lib/worklet-executable.cjs +1 -1
  121. package/dist-lib/worklet-executable.mjs +3 -3
  122. package/package.json +1 -1
  123. package/src/core-data-model.ts +5 -1
  124. package/src/expo-native-workspace.ts +45 -16
  125. package/src/pod-sources.ts +54 -0
  126. package/src/podfile-cocoapods.ts +72 -15
  127. package/src/pods-analysis.ts +1 -0
  128. package/src/pods-install.ts +2 -1
  129. package/src/pods-post-install.ts +35 -0
  130. package/src/pods-project.ts +59 -6
  131. package/src/podspec-cocoapods.ts +39 -0
  132. package/src/podspec-ruby.ts +1 -1
  133. package/src/swift-wasm-prune.ts +3 -2
  134. package/src/turbo-source.ts +53 -68
  135. package/src/xcode-target-members.ts +5 -1
@@ -7,7 +7,7 @@ import path from 'node:path'
7
7
  import { sourceSpecificationFile, sourceVersions, specRepoKey } from './cocoapods-trunk'
8
8
  import { isRecord } from './is-record'
9
9
  import { lockedPodResolution } from './pod-lockfile'
10
- import { checkoutGitPod } from './pod-sources'
10
+ import { checkoutGitPod, checkoutHttpPod, downloadExternalPodspec } from './pod-sources'
11
11
  import { cocoapodsInterpreter, rubyFailures } from './podspec-cocoapods'
12
12
  import {
13
13
  type Frame,
@@ -1117,6 +1117,8 @@ module Pod
1117
1117
  PathSource.new(name, params, podfile_path)
1118
1118
  elsif params.key?(:git)
1119
1119
  GitSource.new(name, params, podfile_path)
1120
+ elsif params.key?(:http)
1121
+ HttpSource.new(name, params, podfile_path)
1120
1122
  else
1121
1123
  raise Informative, "Peach does not fetch the external source of '#{name}': #{params}"
1122
1124
  end
@@ -1169,7 +1171,7 @@ module Pod
1169
1171
 
1170
1172
  class PodspecSource < AbstractExternalSource
1171
1173
  def fetch(sandbox)
1172
- podspec_path = Pathname(podspec_uri)
1174
+ podspec_path = Pathname(Resolver::Trunk.remote_podspec(name) || podspec_uri)
1173
1175
  raise Informative, "Peach does not download the podspec of '#{name}' from #{podspec_uri}" unless podspec_path.exist?
1174
1176
  store_podspec(sandbox, podspec_path, podspec_path.extname == '.json')
1175
1177
  end
@@ -1190,6 +1192,15 @@ module Pod
1190
1192
  sandbox.checkout_sources[name] = source
1191
1193
  end
1192
1194
  end
1195
+
1196
+ class HttpSource < AbstractExternalSource
1197
+ def fetch(sandbox)
1198
+ podspec = Resolver::Trunk.http_checkout(name)
1199
+ raise Informative, "No HTTP archive prepared for '#{name}'" unless podspec
1200
+ podspec_path = Pathname(podspec)
1201
+ store_podspec(sandbox, podspec_path, podspec_path.extname == '.json')
1202
+ end
1203
+ end
1193
1204
  end
1194
1205
 
1195
1206
  class Resolver
@@ -1401,6 +1412,7 @@ export interface ResolvedPodfile extends EvaluatedPodfile {
1401
1412
  installer: RObject
1402
1413
  resolver: RObject
1403
1414
  gitCheckouts: ReadonlyMap<string, Awaited<ReturnType<typeof checkoutGitPod>>>
1415
+ httpCheckouts: ReadonlyMap<string, Awaited<ReturnType<typeof checkoutHttpPod>>>
1404
1416
  }
1405
1417
 
1406
1418
  const send = (interp: Interpreter, receiver: Value, name: string, args: Value[] = []) =>
@@ -1469,6 +1481,8 @@ export async function resolvePodfile(
1469
1481
  if (!Array.isArray(sources) || !sources.every((source) => typeof source === 'string'))
1470
1482
  throw new Error(`${file}: Podfile sources are ${JSON.stringify(sources)}`)
1471
1483
  const gitCheckouts = new Map<string, Awaited<ReturnType<typeof checkoutGitPod>>>()
1484
+ const httpCheckouts = new Map<string, Awaited<ReturnType<typeof checkoutHttpPod>>>()
1485
+ const remotePodspecs = new Map<string, string>()
1472
1486
  const resolution = rubyFailures(file, () => {
1473
1487
  interp.evalString(RESOLVER, 'cocoapods/resolver')
1474
1488
  const pathname = interp.object.consts.get('Pathname') ?? null
@@ -1522,6 +1536,24 @@ export async function resolvePodfile(
1522
1536
  },
1523
1537
  true,
1524
1538
  )
1539
+ interp.defineNative(
1540
+ trunk,
1541
+ 'http_checkout',
1542
+ (c) => {
1543
+ const checkout = httpCheckouts.get(arg(c.args, 0))
1544
+ return checkout ? str(checkout.podspec) : null
1545
+ },
1546
+ true,
1547
+ )
1548
+ interp.defineNative(
1549
+ trunk,
1550
+ 'remote_podspec',
1551
+ (c) => {
1552
+ const podspec = remotePodspecs.get(arg(c.args, 0))
1553
+ return podspec ? str(podspec) : null
1554
+ },
1555
+ true,
1556
+ )
1525
1557
  const sandbox = send(interp, podClass(interp, 'Sandbox'), 'new', [
1526
1558
  str(path.join(path.dirname(file), 'Pods')),
1527
1559
  ])
@@ -1529,15 +1561,18 @@ export async function resolvePodfile(
1529
1561
  if (!Array.isArray(declarations))
1530
1562
  throw new Error('Podfile#dependencies returned no list')
1531
1563
  const gitSources = new Map<string, Record<string, unknown>>()
1564
+ const httpSources = new Map<string, Record<string, unknown>>()
1565
+ const remotePodspecUrls = new Map<string, string>()
1532
1566
  for (const declaration of declarations) {
1533
1567
  const source = toJson(interp, send(interp, declaration, 'external_source'))
1534
- if (
1535
- isRecord(source) &&
1536
- 'git' in source &&
1537
- !('path' in source) &&
1538
- !('podspec' in source)
1539
- )
1540
- gitSources.set(interp.toS(send(interp, declaration, 'root_name')), source)
1568
+ if (!isRecord(source)) continue
1569
+ const rootName = interp.toS(send(interp, declaration, 'root_name'))
1570
+ if (typeof source.podspec === 'string' && /^https?:\/\//.test(source.podspec))
1571
+ remotePodspecUrls.set(rootName, source.podspec)
1572
+ else if ('git' in source && !('path' in source) && !('podspec' in source))
1573
+ gitSources.set(rootName, source)
1574
+ else if ('http' in source && !('path' in source) && !('podspec' in source))
1575
+ httpSources.set(rootName, source)
1541
1576
  }
1542
1577
  const locked = lockedPodResolution(
1543
1578
  path.join(path.dirname(file), 'Podfile.lock'),
@@ -1558,17 +1593,39 @@ export async function resolvePodfile(
1558
1593
  ])
1559
1594
  if (!(installer instanceof RObject))
1560
1595
  throw new Error('Pod::Installer.new returned no object')
1561
- return { sandbox, installer, resolver, gitSources, gitCommits: locked.gitCommits }
1596
+ return {
1597
+ sandbox,
1598
+ installer,
1599
+ resolver,
1600
+ gitSources,
1601
+ httpSources,
1602
+ remotePodspecUrls,
1603
+ gitCommits: locked.gitCommits,
1604
+ }
1562
1605
  })
1563
- const { sandbox, installer, resolver, gitSources, gitCommits } = resolution
1564
- const fetched = await Promise.allSettled(
1565
- [...gitSources].map(async ([name, source]) => {
1606
+ const {
1607
+ sandbox,
1608
+ installer,
1609
+ resolver,
1610
+ gitSources,
1611
+ httpSources,
1612
+ remotePodspecUrls,
1613
+ gitCommits,
1614
+ } = resolution
1615
+ const fetched = await Promise.allSettled([
1616
+ ...[...gitSources].map(async ([name, source]) => {
1566
1617
  gitCheckouts.set(
1567
1618
  name,
1568
1619
  await checkoutGitPod(name, source, staging, gitCommits.get(name)),
1569
1620
  )
1570
1621
  }),
1571
- )
1622
+ ...[...httpSources].map(async ([name, source]) => {
1623
+ httpCheckouts.set(name, await checkoutHttpPod(name, source))
1624
+ }),
1625
+ ...[...remotePodspecUrls].map(async ([name, url]) => {
1626
+ remotePodspecs.set(name, await downloadExternalPodspec(name, url))
1627
+ }),
1628
+ ])
1572
1629
  for (const checkout of fetched)
1573
1630
  if (checkout.status === 'rejected') throw checkout.reason
1574
1631
  // podfile wrappers run once. only the resolver resumes after each CDN fetch.
@@ -1578,7 +1635,7 @@ export async function resolvePodfile(
1578
1635
  for (;;) {
1579
1636
  if (!Array.isArray(missing)) throw new Error('Pod::Resolver#resolve returned no list')
1580
1637
  if (missing.length === 0)
1581
- return { ...evaluated, sandbox, installer, resolver, gitCheckouts }
1638
+ return { ...evaluated, sandbox, installer, resolver, gitCheckouts, httpCheckouts }
1582
1639
  await Promise.all(
1583
1640
  missing.map(async (entry: unknown) => {
1584
1641
  if (!Array.isArray(entry) || typeof entry[0] !== 'string')
@@ -107,6 +107,7 @@ module Pod
107
107
  end
108
108
  def root_spec; @root_spec ||= specs.first.root; end
109
109
  def pod_name; root_spec.name; end
110
+ def version; root_spec.version.version; end
110
111
  def product_module_name; root_spec.module_name; end
111
112
  def podfile; target_definitions.first.podfile; end
112
113
  def spec_consumers; specs.map { |spec| spec.consumer(platform) }; end
@@ -436,7 +436,8 @@ async function preparePodInstallation(
436
436
  if (!isRecord(spec))
437
437
  throw new Error(`${name}: the specification is no JSON object`)
438
438
  downloaded.set(name, spec)
439
- const checkout = resolved.gitCheckouts.get(name)
439
+ const checkout =
440
+ resolved.gitCheckouts.get(name) ?? resolved.httpCheckouts.get(name)
440
441
  const destination = path.join(podsRoot, name)
441
442
  fs.cpSync(
442
443
  checkout?.root ?? (await podSourceRoot(spec, prepareEnv)),
@@ -18,6 +18,7 @@ import {
18
18
  type TargetToIntegrate,
19
19
  UserProject,
20
20
  } from './pods-integration'
21
+ import { projectDefaultBuildSettings } from './pods-project'
21
22
  import { XcodeConfig } from './pods-xcconfig'
22
23
  import { rubyFailures } from './podspec-cocoapods'
23
24
  import {
@@ -287,6 +288,18 @@ module Xcodeproj
287
288
  root_object.build_configuration_list.build_settings(name)
288
289
  end
289
290
 
291
+ def add_build_configuration(name, type)
292
+ if (existing = build_configuration_list[name])
293
+ existing
294
+ else
295
+ config = new(Object::XCBuildConfiguration)
296
+ config.name = name
297
+ config.build_settings = Peach::Xcode.project_build_settings(type.to_s)
298
+ build_configuration_list.build_configurations << config
299
+ config
300
+ end
301
+ end
302
+
290
303
  def files
291
304
  objects.select { |o| o.is_a?(Object::PBXFileReference) }
292
305
  end
@@ -1276,6 +1289,24 @@ module Pod
1276
1289
  def pod_group(pod_name)
1277
1290
  pod_groups.find { |group| group.name == pod_name }
1278
1291
  end
1292
+
1293
+ def add_build_configuration(name, type)
1294
+ config = super
1295
+ settings = config.build_settings
1296
+ existing = settings['GCC_PREPROCESSOR_DEFINITIONS']
1297
+ definitions = existing.is_a?(Array) ? existing.dup : ['$(inherited)']
1298
+ pod_config_define = "POD_CONFIGURATION_#{name.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').gsub(/([a-z\d])([A-Z])/, '\1_\2').tr('-', '_').gsub(/[^a-zA-Z0-9_]/, '_').upcase}"
1299
+ defines = [pod_config_define]
1300
+ is_debug = type == :debug || type.to_s == 'debug'
1301
+ defines << 'DEBUG' if is_debug
1302
+ defines.each do |define|
1303
+ definitions.unshift("#{define}=1") unless definitions.include?("#{define}=1")
1304
+ end
1305
+ settings['GCC_PREPROCESSOR_DEFINITIONS'] = definitions
1306
+ settings['SWIFT_ACTIVE_COMPILATION_CONDITIONS'] = 'DEBUG' if is_debug
1307
+ config.mark_project_as_dirty!
1308
+ config
1309
+ end
1279
1310
  end
1280
1311
  end
1281
1312
  `
@@ -1525,6 +1556,10 @@ function loadFacade(interp: Interpreter) {
1525
1556
  def('file_type', (c) => own(FILE_TYPES_BY_EXTENSION, text(c.args[0])))
1526
1557
  def('product_extension', (c) => own(PRODUCT_UTI_EXTENSIONS, text(c.args[0])))
1527
1558
  def('header?', (c) => isHeader(text(c.args[0])))
1559
+ def('project_build_settings', (c) => {
1560
+ const type = text(c.args[0]) === 'debug' ? 'debug' : 'release'
1561
+ return fromJson(projectDefaultBuildSettings(type))
1562
+ })
1528
1563
  interp.defineNative(
1529
1564
  interp.defineModule('Pods', peach),
1530
1565
  'integrate_user_targets',
@@ -11,6 +11,7 @@ import {
11
11
  type PlistDict,
12
12
  type PlistValue,
13
13
  } from './pbx-table'
14
+ import { parsePlistSource } from './plist'
14
15
  import { type PodsBuildSettings } from './pods-build-settings'
15
16
  import {
16
17
  HEADER_EXTENSIONS,
@@ -108,6 +109,13 @@ const COMPATIBILITY_VERSION: Record<number, string> = {
108
109
  46: 'Xcode 3.2',
109
110
  }
110
111
 
112
+ export function projectDefaultBuildSettings(type: ConfigurationType): PlistDict {
113
+ return {
114
+ ...deepCopy(PROJECT_DEFAULT_BUILD_SETTINGS.all),
115
+ ...deepCopy(PROJECT_DEFAULT_BUILD_SETTINGS[type]),
116
+ }
117
+ }
118
+
111
119
  const PROJECT_DEFAULT_BUILD_SETTINGS: Record<'all' | ConfigurationType, PlistDict> = {
112
120
  all: {
113
121
  ALWAYS_SEARCH_USER_PATHS: 'NO',
@@ -447,7 +455,7 @@ class PodsProject {
447
455
  if (own !== undefined) return path.basename(own)
448
456
  return ''
449
457
  }
450
- if (isa === 'PBXGroup' || isa === 'PBXVariantGroup') {
458
+ if (isa === 'PBXGroup' || isa === 'PBXVariantGroup' || isa === 'XCVersionGroup') {
451
459
  if (name !== undefined) return name
452
460
  if (own !== undefined) return path.basename(own)
453
461
  return id === this.mainGroup ? 'Main Group' : ''
@@ -497,10 +505,51 @@ class PodsProject {
497
505
  return group
498
506
  }
499
507
 
508
+ /** FileReferencesFactory.new_xcdatamodeld: an XCVersionGroup with its child .xcdatamodel refs. */
509
+ newXcDataModeld(group: Id, filePath: string, tree = '<group>'): Id {
510
+ const versionGroup = this.#add(group, `version group ${filePath}`, {
511
+ isa: 'XCVersionGroup',
512
+ children: [],
513
+ sourceTree: tree,
514
+ versionGroupType: 'wrapper.xcdatamodel',
515
+ })
516
+ this.children(group).push(versionGroup)
517
+ this.#parents.set(versionGroup, group)
518
+ this.setPathWithSourceTree(versionGroup, filePath, tree)
519
+ const own = this.string(versionGroup, 'path')!
520
+ if (own.includes('/')) this.get(versionGroup).name = own.split('/').at(-1)!
521
+ if (fs.existsSync(filePath) && fs.statSync(filePath).isDirectory()) {
522
+ const entries = fs
523
+ .readdirSync(filePath)
524
+ .filter((entry) => extname(entry).toLowerCase() === '.xcdatamodel')
525
+ .sort(compareBytes)
526
+ const byName = new Map<string, Id>()
527
+ for (const entry of entries) {
528
+ const child = this.newFile(versionGroup, path.join(filePath, entry), '<group>')
529
+ byName.set(entry, child)
530
+ }
531
+ const versionFile = path.join(filePath, '.xccurrentversion')
532
+ if (fs.existsSync(versionFile)) {
533
+ const parsed = parsePlistSource(fs.readFileSync(versionFile, 'utf8'))
534
+ const currentName =
535
+ typeof parsed === 'object' &&
536
+ parsed !== null &&
537
+ '_XCCurrentVersionName' in parsed &&
538
+ typeof parsed._XCCurrentVersionName === 'string'
539
+ ? parsed._XCCurrentVersionName
540
+ : undefined
541
+ const currentRef = currentName ? byName.get(currentName) : undefined
542
+ if (currentRef) this.get(versionGroup).currentVersion = currentRef
543
+ }
544
+ }
545
+ return versionGroup
546
+ }
547
+
500
548
  /** FileReferencesFactory.new_reference: a file reference with its type and defaults. */
501
549
  newFile(group: Id, filePath: string, tree = '<group>'): Id {
502
- const extension = extname(filePath)
503
- if (extension === '.xcdatamodeld' || extension === '.xcodeproj')
550
+ const extension = extname(filePath).toLowerCase()
551
+ if (extension === '.xcdatamodeld') return this.newXcDataModeld(group, filePath, tree)
552
+ if (extension === '.xcodeproj')
504
553
  throw new Error(`adding ${filePath} to the Pods project is not supported`)
505
554
  const ref = this.#add(group, `file ${filePath}`, {
506
555
  isa: 'PBXFileReference',
@@ -2312,7 +2361,11 @@ export function finalizePodsProject(table: PbxTable, objectVersion: string): voi
2312
2361
  }
2313
2362
  visit(table.rootObject)
2314
2363
  for (const id of reachable)
2315
- if (table.get(id).isa === 'PBXGroup' || table.get(id).isa === 'PBXVariantGroup')
2364
+ if (
2365
+ table.get(id).isa === 'PBXGroup' ||
2366
+ table.get(id).isa === 'PBXVariantGroup' ||
2367
+ table.get(id).isa === 'XCVersionGroup'
2368
+ )
2316
2369
  for (const child of table.list(id, 'children')) parents.set(child, id)
2317
2370
 
2318
2371
  const name = (id: Id) => table.string(id, 'name')
@@ -2326,7 +2379,7 @@ export function finalizePodsProject(table: PbxTable, objectVersion: string): voi
2326
2379
  return ownPath(id)!
2327
2380
  return ownPath(id) === undefined ? '' : path.basename(ownPath(id)!)
2328
2381
  }
2329
- if (isa === 'PBXGroup' || isa === 'PBXVariantGroup') {
2382
+ if (isa === 'PBXGroup' || isa === 'PBXVariantGroup' || isa === 'XCVersionGroup') {
2330
2383
  if (name(id) !== undefined) return name(id)!
2331
2384
  if (ownPath(id) !== undefined) return path.basename(ownPath(id)!)
2332
2385
  return id === mainGroup ? 'Main Group' : ''
@@ -2371,7 +2424,7 @@ export function finalizePodsProject(table: PbxTable, objectVersion: string): voi
2371
2424
  for (const id of reachable) {
2372
2425
  const object = table.get(id)
2373
2426
  const isa = String(object.isa)
2374
- if (isa === 'PBXGroup' || isa === 'PBXVariantGroup')
2427
+ if (isa === 'PBXGroup' || isa === 'PBXVariantGroup' || isa === 'XCVersionGroup')
2375
2428
  table.list(id, 'children').sort((a, b) => {
2376
2429
  const groupA = table.get(a).isa === 'PBXGroup'
2377
2430
  const groupB = table.get(b).isa === 'PBXGroup'
@@ -20,13 +20,16 @@ import {
20
20
  RubyError,
21
21
  RSymbol,
22
22
  SCRIPT_RUNNERS,
23
+ shellWords,
23
24
  str,
24
25
  sym,
25
26
  UnsupportedRuby,
26
27
  type Value,
27
28
  } from './podspec-ruby'
28
29
  import { defineVersionClass, installStdlib, toJson } from './podspec-ruby-stdlib'
30
+ import { swiftNativePin } from './swift-native-pin'
29
31
  import { NATIVE_GRAPH_SDK_VERSION } from './swift-objc-standin'
32
+ import { swiftToolchainBin } from './swift-toolchain'
30
33
 
31
34
  const PRELUDE = String.raw`
32
35
  module Pod
@@ -1063,6 +1066,41 @@ function xcodeToolchainCommand(
1063
1066
  return { stdout: '', status: 1 }
1064
1067
  }
1065
1068
 
1069
+ /** `nm <file> | grep <pattern>`, which podspecs such as react-native-skia's run to read a
1070
+ * vendored archive's symbols. Xcode's nm is llvm-nm, and the pinned toolchain's reads the
1071
+ * same Mach-O archives on every host. */
1072
+ function nmGrep(command: string, cwd: string): { stdout: string; status: number } | null {
1073
+ const match = /^nm\s+(.+?)(?:\s+2>\/dev\/null)?\s*\|\s*grep\s+(.+)$/.exec(
1074
+ command.trim(),
1075
+ )
1076
+ if (!match) return null
1077
+ const nmArgs = shellWords(match[1]!)
1078
+ const grepArgs = shellWords(match[2]!)
1079
+ if (!nmArgs || !grepArgs) return null
1080
+ const nm = path.join(
1081
+ swiftToolchainBin(swiftNativePin().distribution.release),
1082
+ 'llvm-nm',
1083
+ )
1084
+ if (!fs.existsSync(nm))
1085
+ throw new UnsupportedRuby(
1086
+ `shell command \`${command}\` before the Swift toolchain is installed`,
1087
+ )
1088
+ const symbols = spawnSync(nm, nmArgs, {
1089
+ cwd,
1090
+ encoding: 'utf8',
1091
+ maxBuffer: 512 * 1024 * 1024,
1092
+ stdio: ['ignore', 'pipe', 'ignore'],
1093
+ })
1094
+ const grep = spawnSync('grep', grepArgs, {
1095
+ cwd,
1096
+ input: symbols.stdout ?? '',
1097
+ encoding: 'utf8',
1098
+ maxBuffer: 512 * 1024 * 1024,
1099
+ stdio: ['pipe', 'pipe', 'ignore'],
1100
+ })
1101
+ return { stdout: grep.stdout ?? '', status: grep.status ?? 1 }
1102
+ }
1103
+
1066
1104
  /** `find <dir> -name "<file>"`, which React Native's post_install runs for the app's Info.plist files. */
1067
1105
  function findNamed(command: string, cwd: string): string | null {
1068
1106
  const match = /^find (\S+) -name "([^"*?[\]\\]+)"$/.exec(command.trim())
@@ -1101,6 +1139,7 @@ export function cocoapodsInterpreter(
1101
1139
  if (probe !== null) return { stdout: probe, status: 0 }
1102
1140
  return (
1103
1141
  xcodeToolchainCommand(command, cwd) ??
1142
+ nmGrep(command, cwd) ??
1104
1143
  nodeShell(command, cwd, interp.host.env, interp.host.writable)
1105
1144
  )
1106
1145
  },
@@ -5398,7 +5398,7 @@ export function nodeShell(
5398
5398
  }
5399
5399
 
5400
5400
  /** splits one simple command into words as sh does, or null when it uses any other shell syntax. */
5401
- function shellWords(command: string): string[] | null {
5401
+ export function shellWords(command: string): string[] | null {
5402
5402
  const words: string[] = []
5403
5403
  let word: string | null = null
5404
5404
  let quote: "'" | '"' | null = null
@@ -1551,12 +1551,13 @@ const SWIFTUI_WRAPPER_HOST_PROTOCOLS = new Set(
1551
1551
  ].map((name) => `$s7SwiftUI${name.length}${name}Mp`),
1552
1552
  )
1553
1553
 
1554
- /** SwiftUI and Combine own the wrappers; any other object keeps its field descriptors when its conformance records reference a protocol whose conformers hold them. */
1554
+ /** Keep field descriptors for the wrapper owners and for objects conforming to wrapper-hosting protocols. */
1555
1555
  export function keepsSwiftUIReflection(
1556
1556
  file: string,
1557
1557
  undefinedSymbols: Iterable<string>,
1558
1558
  ): boolean {
1559
- if (/^(SwiftUI|Combine|_[A-Za-z0-9]+_SwiftUI)-/.test(path.basename(file))) return true
1559
+ if (/^(SwiftUI(?:Core)?|Combine|_[A-Za-z0-9]+_SwiftUI)-/.test(path.basename(file)))
1560
+ return true
1560
1561
  for (const name of undefinedSymbols) {
1561
1562
  if (SWIFTUI_WRAPPER_HOST_PROTOCOLS.has(name)) return true
1562
1563
  }
@@ -171,17 +171,6 @@ export function registersReactModule(source: string): boolean {
171
171
  return OBJC_BRIDGE.test(stripped) && !/-Swift\.h\b/.test(stripped)
172
172
  }
173
173
 
174
- function fabricComponents(root: string): boolean {
175
- // an app-local Expo module has no manifest, so no codegen config
176
- const manifestPath = path.join(root, 'package.json')
177
- if (!fs.existsSync(manifestPath)) return false
178
- const manifest: unknown = JSON.parse(fs.readFileSync(manifestPath, 'utf8'))
179
- if (!object(manifest) || !object(manifest.codegenConfig)) return false
180
- // codegen's third-party component generator excludes only module libraries;
181
- // component classes may come from ios.components or native annotations.
182
- return manifest.codegenConfig.type !== 'modules'
183
- }
184
-
185
174
  // the TurboModule core every module pod links (ReactCommon/turbomodule/core
186
175
  // and the pods it depends on), and the header search roots CocoaPods exposes
187
176
  // for them: jsi, ReactCommon's header_dir, callinvoker, perflogger.
@@ -304,6 +293,22 @@ function packageManifest(root: string): Record<string, unknown> | null {
304
293
  return value
305
294
  }
306
295
 
296
+ function packageCodegenLibraries(root: string) {
297
+ const config = packageManifest(root)?.codegenConfig
298
+ if (!object(config)) return []
299
+ const libraries = config.libraries ?? [config]
300
+ if (!Array.isArray(libraries))
301
+ throw new Error(`${root}: invalid codegenConfig.libraries`)
302
+ return libraries.map((library: unknown) => {
303
+ if (!object(library)) throw new Error(`${root}: invalid codegen library`)
304
+ const components = library.type !== 'modules'
305
+ if (library.includesGeneratedCode === true) return { spec: null, components }
306
+ if (typeof library.name !== 'string' || library.name === '')
307
+ throw new Error(`${root}: codegen library has no name`)
308
+ return { spec: library.name, components }
309
+ })
310
+ }
311
+
307
312
  function packageInfo(root: string): TurboPackage {
308
313
  root = fs.realpathSync(root)
309
314
  const value = packageManifest(root)
@@ -978,8 +983,8 @@ export async function turboProviderCandidates(
978
983
  // a package peach-compat answers keeps its answer, Fabric views included.
979
984
  if (answered.has(name)) continue
980
985
  // a pod can register Nitro objects and Fabric components independently.
981
- const fabric = fabricComponents(root)
982
986
  if (!podspecPath) continue
987
+ const fabric = packageCodegenLibraries(root).some((library) => library.components)
983
988
  candidates.push({
984
989
  provider: { name, root, podspecPath },
985
990
  fabric,
@@ -1122,7 +1127,11 @@ export async function collectTurboSources(options: {
1122
1127
  if (reactNative.name !== 'react-native')
1123
1128
  throw new Error(`${options.reactNativeRoot} is not react-native`)
1124
1129
  const rawProviders = options.providers
1125
- .map((provider) => ({ ...provider, info: packageInfo(provider.root) }))
1130
+ .map((provider) => ({
1131
+ ...provider,
1132
+ info: packageInfo(provider.root),
1133
+ libraries: packageCodegenLibraries(provider.root),
1134
+ }))
1126
1135
  .sort((a, b) => a.info.name.localeCompare(b.info.name))
1127
1136
  const installedHeaderPods = (
1128
1137
  options.reactNativeProvider || options.reactNativeCore
@@ -1159,23 +1168,11 @@ export async function collectTurboSources(options: {
1159
1168
  }
1160
1169
  const providers: ((typeof rawProviders)[number] & { providerFabric: boolean })[] = []
1161
1170
  for (const provider of rawProviders) {
1162
- if (!fabricComponents(provider.root)) {
1171
+ const componentLibraries = provider.libraries.filter((library) => library.components)
1172
+ if (componentLibraries.length === 0) {
1163
1173
  providers.push({ ...provider, providerFabric: false })
1164
1174
  continue
1165
1175
  }
1166
- const manifest = packageManifest(provider.root)
1167
- const codegenConfig =
1168
- manifest && object(manifest.codegenConfig) ? manifest.codegenConfig : null
1169
- const spec =
1170
- codegenConfig && codegenConfig.includesGeneratedCode !== true
1171
- ? codegenConfig.name
1172
- : null
1173
- if (
1174
- codegenConfig &&
1175
- codegenConfig.includesGeneratedCode !== true &&
1176
- typeof spec !== 'string'
1177
- )
1178
- throw new Error(`${provider.info.name}: codegenConfig has no name`)
1179
1176
  const cg = await loadCodegen()
1180
1177
  const pod = readPod(
1181
1178
  provider,
@@ -1183,14 +1180,22 @@ export async function collectTurboSources(options: {
1183
1180
  options.installedPods?.get(provider.name),
1184
1181
  )
1185
1182
  const allPodFiles = podFiles(pod)
1186
- let providerFabric =
1183
+ const providerFabric =
1187
1184
  cg.thirdPartyComponentOwners.has(provider.info.name) ||
1188
- cg.thirdPartyComponentOwners.has(provider.name)
1189
- if (!providerFabric) {
1190
- if (typeof spec === 'string') {
1185
+ cg.thirdPartyComponentOwners.has(provider.name) ||
1186
+ componentLibraries.some(({ spec }) => {
1187
+ if (spec === null)
1188
+ return allPodFiles.some(
1189
+ (file) =>
1190
+ file.includes('react/renderer/components/') ||
1191
+ (OBJC.test(file) &&
1192
+ /\bRCTComponentViewProtocol\b/.test(
1193
+ fs.readFileSync(path.join(pod.root, file), 'utf8'),
1194
+ )),
1195
+ )
1191
1196
  const shadowNodesFile = `react/renderer/components/${spec}/ShadowNodes.cpp`
1192
1197
  const descriptorsFile = `react/renderer/components/${spec}/ComponentDescriptors.cpp`
1193
- providerFabric =
1198
+ return (
1194
1199
  (cg.owned.has(shadowNodesFile) &&
1195
1200
  definedFacebookReactComponentNames(
1196
1201
  fs.readFileSync(path.join(cg.generated, shadowNodesFile), 'utf8'),
@@ -1201,17 +1206,8 @@ export async function collectTurboSources(options: {
1201
1206
  fs.readFileSync(path.join(cg.generated, descriptorsFile), 'utf8'),
1202
1207
  ),
1203
1208
  ))
1204
- } else {
1205
- providerFabric = allPodFiles.some(
1206
- (file) =>
1207
- file.includes('react/renderer/components/') ||
1208
- (OBJC.test(file) &&
1209
- /\bRCTComponentViewProtocol\b/.test(
1210
- fs.readFileSync(path.join(pod.root, file), 'utf8'),
1211
- )),
1212
1209
  )
1213
- }
1214
- }
1210
+ })
1215
1211
  if (!providerFabric) {
1216
1212
  const filteredFiles = allPodFiles.filter((file) => {
1217
1213
  if (!provider.reactModulesOnly || HEADER.test(file)) return true
@@ -1228,14 +1224,9 @@ export async function collectTurboSources(options: {
1228
1224
  providers.push({ ...provider, providerFabric })
1229
1225
  }
1230
1226
  const installedCodegenNames = new Set(
1231
- installedHeaderPods.flatMap((pod) => {
1232
- const manifest = packageManifest(pod.packageRoot)
1233
- if (!manifest || !object(manifest.codegenConfig)) return []
1234
- const config = manifest.codegenConfig
1235
- return typeof config.name === 'string' && config.includesGeneratedCode !== true
1236
- ? [config.name]
1237
- : []
1238
- }),
1227
+ installedHeaderPods.flatMap((pod) =>
1228
+ packageCodegenLibraries(pod.packageRoot).flatMap(({ spec }) => spec ?? []),
1229
+ ),
1239
1230
  )
1240
1231
  const installedHeaders = new Map<
1241
1232
  string,
@@ -1963,9 +1954,6 @@ export async function collectTurboSources(options: {
1963
1954
  }
1964
1955
  for (const [name, relative] of pod.installed?.mappedHeaders ?? [])
1965
1956
  header([name], { label, root, relative })
1966
- const manifest = packageManifest(provider.root)
1967
- const codegenConfig =
1968
- manifest && object(manifest.codegenConfig) ? manifest.codegenConfig : null
1969
1957
  const sources: string[] = []
1970
1958
  const codegenObjCSources: string[] = []
1971
1959
  const swiftSources: string[] = []
@@ -2214,15 +2202,9 @@ export async function collectTurboSources(options: {
2214
2202
  )
2215
2203
  throw new Error(`${label}: its pod sources register no TurboModule`)
2216
2204
  objc ||= providerObjC
2217
- if (codegenConfig && codegenConfig.includesGeneratedCode !== true) {
2218
- if (typeof codegenConfig.name !== 'string')
2219
- throw new Error(`${label}: codegenConfig has no name`)
2220
- codegen ??= (await runInstalledTurboCodegen(options.appRoot, options.codegenDir))
2221
- .generatedRoot
2222
- const generated = codegenSpecRoot(codegen)
2223
- const owned = new Set<string>()
2224
- walkFiles(generated, '', owned)
2225
- const spec = codegenConfig.name
2205
+ const specs = provider.libraries.flatMap(({ spec }) => spec ?? [])
2206
+ if (specs.length > 0) {
2207
+ const { generated, owned } = await loadCodegen()
2226
2208
  let definedComponentNames: Set<string> | undefined
2227
2209
  const getDefinedComponentNames = () => {
2228
2210
  if (definedComponentNames) return definedComponentNames
@@ -2240,12 +2222,15 @@ export async function collectTurboSources(options: {
2240
2222
  }
2241
2223
  for (const file of [...owned].sort()) {
2242
2224
  const base = path.posix.basename(file)
2243
- // the Objective-C spec classes only an Objective-C module reaches
2244
- const objcSpec = providerObjC && file.startsWith(`${spec}/`)
2245
- // the Fabric component sources, named by the path codegen gives them
2246
- const component =
2247
- provider.providerFabric && file.startsWith(`react/renderer/components/${spec}/`)
2248
- if (!base.startsWith(`${spec}JSI`) && !objcSpec && !component) continue
2225
+ const spec = specs.find(
2226
+ (name) =>
2227
+ base.startsWith(`${name}JSI`) ||
2228
+ (providerObjC && file.startsWith(`${name}/`)) ||
2229
+ (provider.providerFabric &&
2230
+ file.startsWith(`react/renderer/components/${name}/`)),
2231
+ )
2232
+ if (!spec) continue
2233
+ const component = file.startsWith(`react/renderer/components/${spec}/`)
2249
2234
  // CocoaPods searches a pod's own mapped headers before ReactCodegen.
2250
2235
  if (component && HEADER.test(base) && headers.has(file)) continue
2251
2236
  if (HEADER.test(base))
@@ -19,7 +19,11 @@ function groupParentsOf(objects: PlistDict): Map<string, string> {
19
19
  for (const [id, entry] of Object.entries(objects)) {
20
20
  if (!isDict(entry)) continue
21
21
  if (entry.isa === 'PBXProject') mainGroup = str(entry.mainGroup)
22
- if (entry.isa === 'PBXGroup' || entry.isa === 'PBXVariantGroup') {
22
+ if (
23
+ entry.isa === 'PBXGroup' ||
24
+ entry.isa === 'PBXVariantGroup' ||
25
+ entry.isa === 'XCVersionGroup'
26
+ ) {
23
27
  for (const child of list(entry.children)) parents.set(child, id)
24
28
  }
25
29
  }