peachsim 0.1.1813 → 0.1.1815

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 (136) hide show
  1. package/README.md +2 -1
  2. package/cli/cloud-client.ts +5 -4
  3. package/cli/cloud-session.ts +14 -1
  4. package/cli/commands/compat.ts +12 -2
  5. package/cli/commands/control.ts +10 -2
  6. package/cli/commands/flow.ts +10 -5
  7. package/cli/commands/inspect/env.ts +3 -2
  8. package/cli/commands/inspect/wait-selector.ts +30 -9
  9. package/cli/commands/inspect.ts +43 -385
  10. package/cli/commands/package.ts +6 -1
  11. package/cli/commands/runtime.ts +2 -2
  12. package/cli/outbound-endpoints.ts +1 -1
  13. package/dist-lib/agent-daemon-client.cjs +1 -1
  14. package/dist-lib/agent-events.cjs +1 -1
  15. package/dist-lib/attached-projects.cjs +1 -1
  16. package/dist-lib/auth/shared-session.cjs +1 -1
  17. package/dist-lib/backend-origin.cjs +1 -1
  18. package/dist-lib/beta.cjs +1 -1
  19. package/dist-lib/beta.mjs +1 -1
  20. package/dist-lib/bridge-constants.cjs +1 -1
  21. package/dist-lib/bridge-contract-input.cjs +1 -1
  22. package/dist-lib/bridge-contract-input.mjs +1 -1
  23. package/dist-lib/bridge-contract.cjs +1 -1
  24. package/dist-lib/bridge-contract.mjs +1 -1
  25. package/dist-lib/bundle-channel.cjs +769 -512
  26. package/dist-lib/capture-contract.cjs +1 -1
  27. package/dist-lib/capture-contract.mjs +1 -1
  28. package/dist-lib/cloud-contract.cjs +1 -1
  29. package/dist-lib/cloud-contract.mjs +1 -1
  30. package/dist-lib/cloud-test-args.cjs +1 -1
  31. package/dist-lib/cloud-test-args.mjs +1 -1
  32. package/dist-lib/cloud.cjs +1 -1
  33. package/dist-lib/cloud.mjs +1 -1
  34. package/dist-lib/config.cjs +1 -1
  35. package/dist-lib/config.mjs +1 -1
  36. package/dist-lib/detox/index.cjs +89 -14
  37. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  38. package/dist-lib/expo-swift-bundle.cjs +125 -57
  39. package/dist-lib/expo-swift-metadata.cjs +1 -17
  40. package/dist-lib/expo-swift-metadata.mjs +1 -16
  41. package/dist-lib/home-paths.cjs +1 -1
  42. package/dist-lib/host/bridge-host.cjs +2490 -2290
  43. package/dist-lib/host/fetch-proxy-handler.cjs +14 -14
  44. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  45. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  46. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  47. package/dist-lib/host/websocket-proxy.cjs +1 -1
  48. package/dist-lib/index.cjs +19 -21
  49. package/dist-lib/jump-to-source-babel.cjs +1 -1
  50. package/dist-lib/jump-to-source-native.cjs +1 -1
  51. package/dist-lib/kotlin-host.cjs +1 -1
  52. package/dist-lib/menu.cjs +1 -1
  53. package/dist-lib/menu.mjs +1 -1
  54. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  55. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  56. package/dist-lib/metro-production-bundle.cjs +1 -1
  57. package/dist-lib/metro-production-bundle.mjs +1 -1
  58. package/dist-lib/metro.cjs +16 -17
  59. package/dist-lib/native-app-identity-project.cjs +5 -4
  60. package/dist-lib/native-app-identity-project.mjs +8 -7
  61. package/dist-lib/native-app-identity.cjs +1 -1
  62. package/dist-lib/native-app-identity.mjs +1 -1
  63. package/dist-lib/native-firebase-metadata.cjs +1 -1
  64. package/dist-lib/native-firebase-metadata.mjs +1 -1
  65. package/dist-lib/pdfium-raster.cjs +1 -1
  66. package/dist-lib/pdfium-raster.mjs +1 -1
  67. package/dist-lib/plist.cjs +1 -1
  68. package/dist-lib/plist.mjs +1 -1
  69. package/dist-lib/profiles.cjs +1 -1
  70. package/dist-lib/public-brand.cjs +1 -1
  71. package/dist-lib/public-origins-lib-esm.json +24 -24
  72. package/dist-lib/public-origins-lib.json +77 -77
  73. package/dist-lib/react-native-host-modules.cjs +1 -1
  74. package/dist-lib/react-native-host-modules.mjs +1 -1
  75. package/dist-lib/reap-browser.cjs +1 -1
  76. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  77. package/dist-lib/sdk.cjs +1 -1
  78. package/dist-lib/sdk.mjs +1 -1
  79. package/dist-lib/skills.cjs +851 -541
  80. package/dist-lib/swift-compile.cjs +29 -27
  81. package/dist-lib/swift-compile.mjs +36 -34
  82. package/dist-lib/swift-package.cjs +1 -1
  83. package/dist-lib/swift-package.mjs +1 -1
  84. package/dist-lib/swift-submit.cjs +2 -2
  85. package/dist-lib/swift-submit.mjs +2 -2
  86. package/dist-lib/swift-toolchain.cjs +5 -3
  87. package/dist-lib/swift.cjs +1 -1
  88. package/dist-lib/vite-swift.cjs +100 -46
  89. package/dist-lib/vite.cjs +14 -14
  90. package/dist-lib/worklet-executable.cjs +1 -1
  91. package/dist-lib/worklet-executable.mjs +1 -1
  92. package/dist-types/packages/peach-engine/src/engine/nativeReplayContract.d.ts +2 -0
  93. package/dist-types/packages/peach-engine/src/react-native/host-services.d.ts +7 -0
  94. package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +14 -2
  95. package/install.mjs +21 -8
  96. package/package.json +1 -1
  97. package/runtime-companion.json +1 -1
  98. package/sdk/ios/System/Library/Frameworks/SafariServices.framework/Headers/SFSafariViewController.h +17 -0
  99. package/sdk/ios/usr/lib/swift/Dispatch.swiftmodule/arm64-apple-ios-simulator.swiftinterface +5 -0
  100. package/sdk/ios/usr/lib/swift/Foundation.swiftmodule/arm64-apple-ios-simulator.swiftinterface +6 -0
  101. package/sdk/ios/usr/lib/swift/ObjectiveC.swiftmodule/arm64-apple-ios-simulator.swiftinterface +10 -1
  102. package/sdk/ios/usr/lib/swift/SwiftUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +4 -0
  103. package/sdk/ios/usr/lib/swift/SwiftUICore.swiftmodule/arm64-apple-ios-simulator.swiftinterface +11 -0
  104. package/sdk/ios/usr/lib/swift/UIKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +13 -0
  105. package/sdk/ios/wasm/include/string.h +1 -0
  106. package/src/cli-runtime.ts +32 -4
  107. package/src/expo-kotlin-host.ts +69 -35
  108. package/src/expo-swift-host.ts +45 -9
  109. package/src/expo-swift-ready.ts +16 -2
  110. package/src/expoSwiftContract.ts +2 -20
  111. package/src/installed-native-libraries.ts +79 -18
  112. package/src/nitro-adapter.lock.json +251 -251
  113. package/src/nitro-bundle.ts +2 -8
  114. package/src/nitro-compile.ts +6 -3
  115. package/src/nitro-dependencies.ts +8 -2
  116. package/src/nitro-source.ts +34 -3
  117. package/src/nitro-superset.lock.json +14 -14
  118. package/src/nitro-superset.ts +2 -3
  119. package/src/nitroContract.ts +26 -32
  120. package/src/react-native-bridge-modules.ts +2 -9
  121. package/src/runtime-delivery.ts +2 -2
  122. package/src/swift-compile.ts +4 -1
  123. package/src/swift-distribution.lock.json +9 -8
  124. package/src/swift-distribution.ts +1 -0
  125. package/src/swift-icu.ts +21 -27
  126. package/src/swift-installed-targets.ts +13 -0
  127. package/src/swift-project-user.ts +5 -0
  128. package/src/swift-shared-sdk.ts +4 -0
  129. package/src/swift-standins.ts +14 -3
  130. package/src/swift-submit.ts +2 -1
  131. package/src/swift-toolchain.ts +5 -2
  132. package/src/swift-wasm-prune.ts +10 -2
  133. package/src/turbo-bundle.ts +20 -1
  134. package/src/turbo-compile.ts +6 -12
  135. package/src/turbo-runtime.lock.json +18 -18
  136. package/src/turbo-source.ts +176 -37
@@ -33,7 +33,6 @@ import {
33
33
  } from './nitro-dependencies'
34
34
  import { iosAutolinkedDependencies } from './nitro-source'
35
35
  import { TURBO_RUNTIME_HEADER } from './nitroAdapterContract'
36
- import { COMPILED_TURBO_NATIVE_PACKAGES } from './nitroContract'
37
36
  import {
38
37
  loadPodspec,
39
38
  podspecLinksBinaries,
@@ -141,6 +140,8 @@ const REACT_NATIVE_INCLUDE_ROOTS = [
141
140
  'ReactCommon',
142
141
  'ReactCommon/callinvoker',
143
142
  'ReactCommon/jsiexecutor',
143
+ // React-jsitooling's header_dir is react/runtime under its own root
144
+ 'ReactCommon/jsitooling',
144
145
  'ReactCommon/react/nativemodule/core',
145
146
  'ReactCommon/react/nativemodule/core/platform/ios',
146
147
  'ReactCommon/runtimeexecutor',
@@ -325,20 +326,25 @@ function podspecList(text: string, attribute: string): string[] | 'computed' | n
325
326
  return items
326
327
  }
327
328
 
328
- function podspecDependencies(text: string): { name: string; version?: string }[] {
329
- const deps: { name: string; version?: string }[] = []
330
- const seen = new Set<string>()
329
+ /** the external pods a podspec depends on; "subspecs" holds every requested subspec path across its dependency lines, "" for the pod itself. */
330
+ function podspecDependencies(
331
+ text: string,
332
+ ): { name: string; requirements: string[]; subspecs: string[] }[] {
333
+ const deps = new Map<
334
+ string,
335
+ { name: string; requirements: string[]; subspecs: string[] }
336
+ >()
331
337
  for (const match of text.matchAll(
332
- /^\s*\w+\.dependency\s+['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?/gm,
338
+ /^\s*\w+\.dependency\s+['"]([^'"]+)['"]((?:\s*,\s*['"][^'"]+['"])*)/gm,
333
339
  )) {
334
- const root = match[1]!.split('/')[0]!
340
+ const requirements = [...match[2]!.matchAll(/['"]([^'"]+)['"]/g)].map((m) => m[1]!)
341
+ const [root, ...subspec] = match[1]!.split('/')
335
342
  if (
336
- seen.has(root) ||
337
343
  root === 'React' ||
338
344
  root === 'React-Core' ||
339
345
  root === 'ReactCommon' ||
340
- root.startsWith('React-') ||
341
- root.startsWith('RCT') ||
346
+ root!.startsWith('React-') ||
347
+ root!.startsWith('RCT') ||
342
348
  root === 'FBLazyVector' ||
343
349
  root === 'DoubleConversion' ||
344
350
  root === 'glog' ||
@@ -348,10 +354,56 @@ function podspecDependencies(text: string): { name: string; version?: string }[]
348
354
  root === 'Yoga'
349
355
  )
350
356
  continue
351
- seen.add(root)
352
- deps.push({ name: root, ...(match[2] ? { version: match[2] } : {}) })
357
+ // every declaration of a pod must hold: CocoaPods intersects their requirements
358
+ const dep = deps.get(root!) ?? { name: root!, requirements: [], subspecs: [] }
359
+ dep.requirements.push(...requirements)
360
+ dep.subspecs.push(subspec.join('/'))
361
+ deps.set(root!, dep)
362
+ }
363
+ return [...deps.values()]
364
+ }
365
+
366
+ const versionParts = (version: string) => version.split(/[.-]/).map((p) => Number(p) || 0)
367
+
368
+ function compareVersions(a: string, b: string): number {
369
+ const left = versionParts(a)
370
+ const right = versionParts(b)
371
+ for (let i = 0; i < Math.max(left.length, right.length); i++) {
372
+ const diff = (left[i] ?? 0) - (right[i] ?? 0)
373
+ if (diff !== 0) return diff
353
374
  }
354
- return deps
375
+ return 0
376
+ }
377
+
378
+ /** the highest published version that satisfies every CocoaPods requirement ("~> 3", ">= 1.2", "2.0"), stable before prerelease; undefined when one cannot be read. */
379
+ function satisfyingPodVersion(versions: string[], requirements: string[]) {
380
+ const parsed = requirements.map((requirement) => {
381
+ const match = /^\s*(~>|>=|<=|>|<|=|!=)?\s*(\d+(?:\.\d+)*)\s*$/.exec(requirement)
382
+ return match ? { operator: match[1] ?? '=', bound: match[2]! } : null
383
+ })
384
+ if (parsed.some((requirement) => !requirement)) return undefined
385
+ const admits = (version: string) =>
386
+ parsed.every((requirement) =>
387
+ admitsOne(version, requirement!.operator, requirement!.bound),
388
+ )
389
+ const candidates = versions.filter(admits).sort(compareVersions)
390
+ const stable = candidates.filter((version) => !version.includes('-'))
391
+ return (stable.length > 0 ? stable : candidates).at(-1)
392
+ }
393
+
394
+ function admitsOne(version: string, operator: string, bound: string) {
395
+ const order = compareVersions(version, bound)
396
+ if (operator === '=') return order === 0
397
+ if (operator === '!=') return order !== 0
398
+ if (operator === '>') return order > 0
399
+ if (operator === '>=') return order >= 0
400
+ if (operator === '<') return order < 0
401
+ if (operator === '<=') return order <= 0
402
+ // pessimistic: at least the bound, below the bound with its last part dropped and the one before it raised
403
+ const segments = bound.split('.')
404
+ const ceiling = segments.length > 1 ? segments.slice(0, -1) : segments
405
+ ceiling[ceiling.length - 1] = String(Number(ceiling[ceiling.length - 1]) + 1)
406
+ return order >= 0 && compareVersions(version, ceiling.join('.')) < 0
355
407
  }
356
408
 
357
409
  function stringList(value: unknown): string[] {
@@ -361,20 +413,71 @@ function stringList(value: unknown): string[] {
361
413
  return []
362
414
  }
363
415
 
416
+ /**
417
+ * the spec JSON members CocoaPods compiles for a dependency: each requested subspec ("" is the
418
+ * pod itself) with its ancestors, the subspecs it activates (Specification#subspec_dependencies:
419
+ * default_subspecs, none, else every child) and the sibling subspecs its dependencies name,
420
+ * followed until nothing new is selected.
421
+ */
422
+ function externalSpecMembers(
423
+ root: Record<string, unknown>,
424
+ requested: string[],
425
+ ): Record<string, unknown>[] {
426
+ const children = (spec: Record<string, unknown>) =>
427
+ Array.isArray(spec.subspecs) ? spec.subspecs.filter(object) : []
428
+ const chains = new Map<string, Record<string, unknown>[]>()
429
+ const select = (path: string[]) => {
430
+ const key = path.join('/')
431
+ if (chains.has(key)) return
432
+ const chain = [root]
433
+ for (const part of path) {
434
+ const child = children(chain.at(-1)!).find((sub) => sub.name === part)
435
+ if (!child) throw new Error(`${String(root.name)} has no subspec ${key}`)
436
+ chain.push(child)
437
+ }
438
+ chains.set(key, chain)
439
+ const spec = chain.at(-1)!
440
+ const defaults = stringList(spec.default_subspecs ?? spec.default_subspec)
441
+ const activated =
442
+ defaults[0] === 'none'
443
+ ? []
444
+ : defaults.length > 0
445
+ ? defaults
446
+ : children(spec).map((sub) => String(sub.name))
447
+ for (const name of activated) select([...path, ...name.split('/')])
448
+ for (const member of chain)
449
+ for (const dependencies of [member.dependencies, iosOf(member)?.dependencies])
450
+ for (const dependency of object(dependencies) ? Object.keys(dependencies) : []) {
451
+ const [pod, ...rest] = dependency.split('/')
452
+ if (pod === root.name) select(rest)
453
+ }
454
+ }
455
+ for (const name of requested) select(name ? name.split('/') : [])
456
+ return [...new Set([...chains.values()].flat())]
457
+ }
458
+
459
+ const iosOf = (member: Record<string, unknown>) =>
460
+ object(member.ios) ? member.ios : null
461
+
364
462
  async function resolveExternalTurboPod(
365
463
  name: string,
366
- versionHint: string | undefined,
464
+ requirements: string[],
465
+ requestedSubspecs: string[],
367
466
  ): Promise<{
368
467
  name: string
369
468
  moduleName: string
370
469
  root: string
371
470
  files: string[]
471
+ /** the pod's own GCC_PREPROCESSOR_DEFINITIONS, which CocoaPods builds it with */
472
+ defines: string[]
372
473
  } | null> {
373
474
  const shard = createHash('md5').update(name).digest('hex').slice(0, 3).split('')
374
475
  const baseDir = path.join(rnxHomeDir(), 'turbo-pods')
476
+ const [only] = requirements
375
477
  let version =
376
- versionHint && /^\d+\.\d+(?:\.\d+)*(?:-[0-9A-Za-z.-]+)?$/.test(versionHint.trim())
377
- ? versionHint.trim()
478
+ requirements.length === 1 &&
479
+ /^\d+\.\d+(?:\.\d+)*(?:-[0-9A-Za-z.-]+)?$/.test(only!.trim())
480
+ ? only!.trim()
378
481
  : undefined
379
482
  if (!version) {
380
483
  const versionsFile = path.join(baseDir, 'versions', `${shard.join('_')}.txt`)
@@ -392,12 +495,13 @@ async function resolveExternalTurboPod(
392
495
  }
393
496
  const line = versionsText.split('\n').find((entry) => entry.startsWith(`${name}/`))
394
497
  if (!line) return null
395
- const allVersions = line
396
- .slice(name.length + 1)
397
- .split('/')
398
- .filter(Boolean)
399
- const stable = allVersions.filter((v) => !v.includes('-'))
400
- version = (stable.length > 0 ? stable : allVersions).at(-1)
498
+ version = satisfyingPodVersion(
499
+ line
500
+ .slice(name.length + 1)
501
+ .split('/')
502
+ .filter(Boolean),
503
+ requirements,
504
+ )
401
505
  if (!version) return null
402
506
  }
403
507
  const specFile = path.join(baseDir, 'specs', `${name}-${version}.podspec.json`)
@@ -444,15 +548,15 @@ async function resolveExternalTurboPod(
444
548
  fs.rmSync(staging, { recursive: true, force: true })
445
549
  fs.writeFileSync(marker, version)
446
550
  }
447
- const iosSpec = object(spec.ios) ? spec.ios : null
448
- const sourceGlobs = [
449
- ...stringList(spec.source_files),
450
- ...stringList(iosSpec?.source_files),
451
- ]
452
- const excludeGlobs = [
453
- ...stringList(spec.exclude_files),
454
- ...stringList(iosSpec?.exclude_files),
455
- ]
551
+ const members = externalSpecMembers(spec, requestedSubspecs)
552
+ const sourceGlobs = members.flatMap((member) => [
553
+ ...stringList(member.source_files),
554
+ ...stringList(iosOf(member)?.source_files),
555
+ ])
556
+ const excludeGlobs = members.flatMap((member) => [
557
+ ...stringList(member.exclude_files),
558
+ ...stringList(iosOf(member)?.exclude_files),
559
+ ])
456
560
  if (sourceGlobs.length === 0) return null
457
561
  const candidates = new Set<string>()
458
562
  for (const glob of sourceGlobs) walkFiles(treeDir, globBase(glob), candidates)
@@ -465,13 +569,22 @@ async function resolveExternalTurboPod(
465
569
  !excluded.some((glob) => glob.test(file)),
466
570
  )
467
571
  .sort()
572
+ const iosSpec = iosOf(spec)
468
573
  const moduleName =
469
574
  typeof spec.module_name === 'string'
470
575
  ? spec.module_name
471
576
  : typeof iosSpec?.module_name === 'string'
472
577
  ? iosSpec.module_name
473
578
  : name
474
- return { name, moduleName, root: treeDir, files }
579
+ const defines = members.flatMap((member) =>
580
+ [member.pod_target_xcconfig, iosOf(member)?.pod_target_xcconfig].flatMap((config) => {
581
+ const value = object(config) ? config.GCC_PREPROCESSOR_DEFINITIONS : undefined
582
+ return typeof value === 'string'
583
+ ? value.split(/\s+/).filter((token) => token && token !== '$(inherited)')
584
+ : []
585
+ }),
586
+ )
587
+ return { name, moduleName, root: treeDir, files, defines }
475
588
  }
476
589
 
477
590
  type Pod = {
@@ -772,10 +885,8 @@ function registers(root: string, files: Iterable<string>, objc = true): boolean
772
885
  export async function discoverTurboProviders(appRoot: string): Promise<TurboProvider[]> {
773
886
  const providers: TurboProvider[] = []
774
887
  for (const { name, root, podspecPath } of await iosAutolinkedDependencies(appRoot)) {
775
- // a package peach-compat answers keeps its answer, Fabric views included,
776
- // until COMPILED_TURBO_NATIVE_PACKAGES moves it to its original source.
777
- if (answeredPackages.has(name) && !COMPILED_TURBO_NATIVE_PACKAGES.includes(name))
778
- continue
888
+ // a package peach-compat answers keeps its answer, Fabric views included.
889
+ if (answeredPackages.has(name)) continue
779
890
  // a pod can register Nitro objects and Fabric components independently.
780
891
  const fabric = fabricComponents(root)
781
892
  if (!podspecPath) continue
@@ -785,7 +896,7 @@ export async function discoverTurboProviders(appRoot: string): Promise<TurboProv
785
896
  if (fabric || (files !== null && registers(pod.root, files))) {
786
897
  const dependencies = await Promise.all(
787
898
  podspecDependencies(pod.text).map((dep) =>
788
- resolveExternalTurboPod(dep.name, dep.version),
899
+ resolveExternalTurboPod(dep.name, dep.requirements, dep.subspecs),
789
900
  ),
790
901
  )
791
902
  if (!dependencies.some((dep) => dep?.files.some((file) => file.endsWith('.swift'))))
@@ -1075,6 +1186,7 @@ export async function collectTurboSources(options: {
1075
1186
  // an include a file names, resolved as clang would against the pod's own
1076
1187
  // directory, then the search paths CocoaPods gives a module pod. unresolved
1077
1188
  // names are the SDK's own headers.
1189
+ const podFileLists = new Map<string, Set<string>>()
1078
1190
  const resolve = (from: Scan, include: string, quoted: boolean) => {
1079
1191
  if (quoted) {
1080
1192
  const relative = path.posix.normalize(
@@ -1150,6 +1262,21 @@ export async function collectTurboSources(options: {
1150
1262
  )
1151
1263
  return
1152
1264
  }
1265
+ if (quoted && from.root) {
1266
+ // a pod's private headers share one flattened header map, so a quoted
1267
+ // include reaches a sibling in another directory of the same pod
1268
+ let files = podFileLists.get(from.root)
1269
+ if (!files) {
1270
+ files = new Set()
1271
+ walkFiles(from.root, '', files)
1272
+ podFileLists.set(from.root, files)
1273
+ }
1274
+ const found = [...files].find((file) => file.endsWith(`/${include}`))
1275
+ if (found) {
1276
+ alias(own, original(from.targetName, from.label, from.root, found, false))
1277
+ return
1278
+ }
1279
+ }
1153
1280
  if (codegen && HEADER.test(include)) {
1154
1281
  const generated = codegenSpecRoot(codegen)
1155
1282
  const relative = path.posix.normalize(include.replace(/^ReactCodegen\//, ''))
@@ -1453,6 +1580,7 @@ export async function collectTurboSources(options: {
1453
1580
  root: string
1454
1581
  files: string[]
1455
1582
  }[] = []
1583
+ const externalDefines: string[] = []
1456
1584
  for (const dep of podspecDependencies(pod.text)) {
1457
1585
  const installed = installedHeaderPods.find(
1458
1586
  (candidate) => candidate.name === dep.name,
@@ -1466,9 +1594,11 @@ export async function collectTurboSources(options: {
1466
1594
  moduleName: moduleNames?.[0] ?? installed.name,
1467
1595
  root: installed.root,
1468
1596
  files: podFiles(installed),
1597
+ defines: [],
1469
1598
  }
1470
- : await resolveExternalTurboPod(dep.name, dep.version)
1599
+ : await resolveExternalTurboPod(dep.name, dep.requirements, dep.subspecs)
1471
1600
  if (!resolved) continue
1601
+ externalDefines.push(...resolved.defines)
1472
1602
  const mappings = installed ? podHeaderMappings(installed) : []
1473
1603
  const swiftFilesForDep: string[] = []
1474
1604
  for (const file of resolved.files) {
@@ -1521,6 +1651,15 @@ export async function collectTurboSources(options: {
1521
1651
  })
1522
1652
  }
1523
1653
  }
1654
+ // an external pod's units compile inside the provider target with the defines its podspec sets
1655
+ if (externalDefines.length > 0) {
1656
+ const flags = [...new Set(externalDefines)].map((define) => `-D${define}`)
1657
+ providerTargetInput.clangSettings = [
1658
+ ...(providerTargetInput.clangSettings ?? []),
1659
+ { tool: 'c', flags },
1660
+ { tool: 'cxx', flags },
1661
+ ]
1662
+ }
1524
1663
  for (const depPod of depSwiftPods) {
1525
1664
  if (!result.targets.some((t) => t.name === depPod.moduleName)) {
1526
1665
  result.targets.push(target(depPod.moduleName, []))