peachsim 0.1.2411 → 0.1.2421

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 (146) hide show
  1. package/README.md +1 -1
  2. package/cli/catalog/content.ts +6 -3
  3. package/cli/catalog/meta.ts +63 -17
  4. package/cli/catalog/routes.ts +4 -0
  5. package/cli/cloud-box-artifact.ts +45 -24
  6. package/cli/cloud-client.ts +6 -2
  7. package/cli/command-registry.ts +3 -1
  8. package/cli/commands/control.ts +74 -55
  9. package/cli/commands/desktop.ts +3 -3
  10. package/cli/commands/electron.ts +7 -5
  11. package/cli/commands/kotlin.ts +8 -1
  12. package/cli/commands/platform.ts +5 -7
  13. package/cli/commands/profile.ts +2 -2
  14. package/cli/commands/settings.ts +90 -0
  15. package/cli/commands/shell-url.ts +18 -10
  16. package/cli/commands/swift.ts +3 -1
  17. package/cli/main.ts +6 -0
  18. package/cli/outbound-endpoints.ts +17 -15
  19. package/cli/settings-flags.ts +115 -0
  20. package/dist-lib/agent-daemon-client.cjs +1 -1
  21. package/dist-lib/agent-events.cjs +1 -1
  22. package/dist-lib/attached-projects.cjs +1 -1
  23. package/dist-lib/auth/shared-session.cjs +1 -1
  24. package/dist-lib/backend-origin.cjs +1 -1
  25. package/dist-lib/beta.cjs +1 -1
  26. package/dist-lib/beta.mjs +1 -1
  27. package/dist-lib/bridge-constants.cjs +1 -1
  28. package/dist-lib/bridge-contract-input.cjs +1 -1
  29. package/dist-lib/bridge-contract-input.mjs +1 -1
  30. package/dist-lib/bridge-contract.cjs +1 -1
  31. package/dist-lib/bridge-contract.mjs +1 -1
  32. package/dist-lib/bundle-channel.cjs +3706 -1818
  33. package/dist-lib/capture-contract.cjs +1 -1
  34. package/dist-lib/capture-contract.mjs +1 -1
  35. package/dist-lib/cloud-contract.cjs +1 -1
  36. package/dist-lib/cloud-contract.mjs +1 -1
  37. package/dist-lib/cloud-test-args.cjs +1 -1
  38. package/dist-lib/cloud-test-args.mjs +1 -1
  39. package/dist-lib/cloud.cjs +1 -1
  40. package/dist-lib/cloud.mjs +1 -1
  41. package/dist-lib/config.cjs +3 -7
  42. package/dist-lib/config.mjs +3 -7
  43. package/dist-lib/detox/index.cjs +4 -4
  44. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  45. package/dist-lib/expo-swift-bundle.cjs +17144 -15295
  46. package/dist-lib/expo-swift-metadata.cjs +1 -1
  47. package/dist-lib/expo-swift-metadata.mjs +1 -1
  48. package/dist-lib/home-paths.cjs +1 -1
  49. package/dist-lib/host/bridge-host.cjs +63288 -62269
  50. package/dist-lib/host/fetch-proxy-handler.cjs +1598 -211
  51. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  52. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  53. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  54. package/dist-lib/host/websocket-proxy.cjs +1 -1
  55. package/dist-lib/index.cjs +3007 -1512
  56. package/dist-lib/jump-to-source-babel.cjs +1 -1
  57. package/dist-lib/jump-to-source-native.cjs +1 -1
  58. package/dist-lib/kotlin-host.cjs +972 -246
  59. package/dist-lib/menu.cjs +1 -1
  60. package/dist-lib/menu.mjs +1 -1
  61. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  62. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  63. package/dist-lib/metro-production-bundle.cjs +1 -1
  64. package/dist-lib/metro-production-bundle.mjs +1 -1
  65. package/dist-lib/metro.cjs +1742 -247
  66. package/dist-lib/native-app-identity-project.cjs +40 -204
  67. package/dist-lib/native-app-identity-project.mjs +40 -204
  68. package/dist-lib/native-app-identity.cjs +1 -1
  69. package/dist-lib/native-app-identity.mjs +1 -1
  70. package/dist-lib/native-firebase-metadata.cjs +1 -1
  71. package/dist-lib/native-firebase-metadata.mjs +1 -1
  72. package/dist-lib/pdfium-raster.cjs +1 -1
  73. package/dist-lib/pdfium-raster.mjs +1 -1
  74. package/dist-lib/plist.cjs +1 -1
  75. package/dist-lib/plist.mjs +1 -1
  76. package/dist-lib/profiles.cjs +1 -1
  77. package/dist-lib/public-brand.cjs +1 -1
  78. package/dist-lib/public-origins-lib-esm.json +26 -24
  79. package/dist-lib/public-origins-lib.json +198 -117
  80. package/dist-lib/react-native-host-modules.cjs +1 -1
  81. package/dist-lib/react-native-host-modules.mjs +1 -1
  82. package/dist-lib/reap-browser.cjs +1 -1
  83. package/dist-lib/scripts/dev-server-scanner.cjs +2 -2
  84. package/dist-lib/sdk.cjs +1 -1
  85. package/dist-lib/sdk.mjs +1 -1
  86. package/dist-lib/skills.cjs +21765 -20511
  87. package/dist-lib/swift-compile.cjs +48 -228
  88. package/dist-lib/swift-compile.mjs +48 -228
  89. package/dist-lib/swift-package.cjs +1 -1
  90. package/dist-lib/swift-package.mjs +1 -1
  91. package/dist-lib/swift-submit.cjs +1 -1
  92. package/dist-lib/swift-submit.mjs +1 -1
  93. package/dist-lib/swift-toolchain.cjs +1 -199
  94. package/dist-lib/swift.cjs +1 -1
  95. package/dist-lib/vite-swift.cjs +227 -251
  96. package/dist-lib/vite.cjs +5240 -3788
  97. package/dist-lib/worklet-executable.cjs +1 -1
  98. package/dist-lib/worklet-executable.mjs +1 -1
  99. package/dist-types/packages/peach-engine/src/config.d.ts +1 -4
  100. package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +1 -0
  101. package/dist-types/packages/peach-engine/src/render-worker/compositor-gpu.d.ts +1 -0
  102. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +4 -0
  103. package/dist-types/packages/peach-engine/src/render-worker/native-widgetContract.d.ts +5 -0
  104. package/kotlin/README.md +4 -3
  105. package/kotlin/sdk.tar.gz +0 -0
  106. package/kotlin/toolchain.json +3 -6
  107. package/package.json +1 -1
  108. package/runtime-companion.json +1 -1
  109. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CALayer.h +1 -43
  110. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/CALayerContents.h +55 -0
  111. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Modules/module.modulemap +3 -3
  112. package/sdk/ios/usr/include/ObjectiveC.apinotes +0 -24
  113. package/sdk/ios/usr/include/grp.h +93 -0
  114. package/sdk/ios/usr/include/netinet/tcp.h +299 -0
  115. package/sdk/ios/wasm/include/netinet/tcp.h +6 -0
  116. package/sdk/ios/wasm/include/stdlib.h +1 -0
  117. package/sdk/ios/wasm/include/unistd.h +2 -0
  118. package/skills/contrast/SKILL.md +1 -0
  119. package/skills/peach-setup/SKILL.md +11 -1
  120. package/src/android-bridge-dependencies.ts +1 -1
  121. package/src/app-config.ts +7 -0
  122. package/src/binaryen.lock.json +21 -0
  123. package/src/cocoapods-trunk.ts +52 -0
  124. package/src/config.ts +21 -31
  125. package/src/expo-native-workspace.ts +4 -0
  126. package/src/kotlin-host.ts +1 -1
  127. package/src/kotlin-sdk.ts +7 -7
  128. package/src/kotlin-toolchain.ts +28 -24
  129. package/src/kotlinSdkContract.ts +2 -2
  130. package/src/native-bundles.ts +5 -2
  131. package/src/native-static-libraries.ts +38 -5
  132. package/src/podfile-cocoapods.ts +1473 -0
  133. package/src/podspec-cocoapods.ts +331 -106
  134. package/src/podspec-ruby-stdlib.ts +134 -19
  135. package/src/podspec-ruby.ts +199 -46
  136. package/src/settingsContract.ts +74 -0
  137. package/src/swift-compile.ts +1 -1
  138. package/src/swift-compiler-digest.ts +1 -0
  139. package/src/swift-host.ts +107 -15
  140. package/src/swift-objc-compile.ts +5 -0
  141. package/src/swift-packages.ts +75 -0
  142. package/src/swift-shared-sdk.ts +19 -0
  143. package/src/swift-toolchain.ts +2 -201
  144. package/src/turbo-source.ts +7 -37
  145. package/src/wasm-optimize.ts +4 -27
  146. package/src/xcode-project.ts +22 -7
package/src/swift-host.ts CHANGED
@@ -57,6 +57,7 @@ import { swiftDistributionRoot, swiftModuleToolchain } from './swift-distributio
57
57
  import { xcodeNativeFlags, xcodeObjCInputsAsync } from './swift-objc-compile'
58
58
  import {
59
59
  isSwiftNativeTranslationUnit,
60
+ moduleMapModules,
60
61
  swiftImplicitResourcePaths,
61
62
  swiftManifestSettings,
62
63
  swiftMetalSourceFiles,
@@ -789,11 +790,15 @@ function xcodeInputKey(
789
790
  relative: string,
790
791
  ): string {
791
792
  const owner = layout.targetDirs.get(file)
793
+ const checkouts = layout.checkouts
794
+ const checkoutPath = file.startsWith(`${checkouts}${path.sep}`)
795
+ ? path.relative(checkouts, file).split(path.sep).join('/')
796
+ : null
792
797
  if (owner) {
793
798
  // swiftpm ignores sources beneath hidden directories, including pnpm's
794
799
  // .pnpm store, even when xcode explicitly includes those files.
795
800
  const input = file.endsWith('.swift')
796
- ? relative
801
+ ? (checkoutPath ?? relative)
797
802
  .split('/')
798
803
  .map((part) =>
799
804
  part === '.' || part === '..'
@@ -801,15 +806,11 @@ function xcodeInputKey(
801
806
  : part.replaceAll('%', '%25').replace(/^\./, '%2E'),
802
807
  )
803
808
  .join('/')
804
- : relative
809
+ : (checkoutPath ?? relative)
805
810
  return path.posix.join(owner, input)
806
811
  }
807
- const checkouts = layout.checkouts
808
- return file.startsWith(`${checkouts}${path.sep}`)
809
- ? path.posix.join(
810
- XCODE_PACKAGES_DIR,
811
- path.relative(checkouts, file).split(path.sep).join('/'),
812
- )
812
+ return checkoutPath !== null
813
+ ? path.posix.join(XCODE_PACKAGES_DIR, checkoutPath)
813
814
  : relative === '..' || relative.startsWith('../')
814
815
  ? path.posix.join('external', file.split(path.sep).join('/'))
815
816
  : relative
@@ -869,7 +870,7 @@ function xcodeLayout(root: string): XcodeLayout | null {
869
870
  async function buildXcodeLayout(root: string): Promise<XcodeLayout | null> {
870
871
  const registered = xcodeProjects().get(root)
871
872
  if (!registered) return null
872
- const app = readXcodeAppTargetPrepared(
873
+ const appTarget = readXcodeAppTargetPrepared(
873
874
  registered.xcodeproj,
874
875
  registered.target,
875
876
  registered.configuration,
@@ -879,6 +880,79 @@ async function buildXcodeLayout(root: string): Promise<XcodeLayout | null> {
879
880
  nativeModules: registered.nativeModules,
880
881
  },
881
882
  )
883
+ const { packages, standins, projectGaps, binaries } = await swiftPackages(
884
+ registered,
885
+ appTarget,
886
+ )
887
+ const sourceFrameworks = new Map(
888
+ packages.sourceFrameworks.map(
889
+ ({
890
+ packageTarget,
891
+ project,
892
+ target,
893
+ module,
894
+ configuration,
895
+ machOType,
896
+ settings,
897
+ }) => {
898
+ const framework = readXcodeAppTarget(project, target, configuration, {
899
+ prepareGeneratedSources: true,
900
+ frameworkMachOType: machOType,
901
+ frameworkBuildSettings: settings,
902
+ })
903
+ if (framework.moduleName !== module || framework.allSources.length === 0)
904
+ throw new Error(`${project}: ${target} did not produce source module ${module}`)
905
+ if (
906
+ framework.linkedProducts.length > 0 ||
907
+ framework.binaryFrameworks.some(({ path }) => path)
908
+ )
909
+ throw new Error(
910
+ `${project}: ${target} has external dependencies outside the source framework build`,
911
+ )
912
+ return [packageTarget, framework] as const
913
+ },
914
+ ),
915
+ )
916
+ const frameworkTargets = [...sourceFrameworks.values()]
917
+ const packageFrameworkSearchPaths = frameworkTargets.flatMap(
918
+ ({ objc }) => objc?.frameworkSearchPaths.slice(0, 1) ?? [],
919
+ )
920
+ const withPackageFrameworks = <T extends XcodeModuleTarget>(target: T): T =>
921
+ target.objc && packageFrameworkSearchPaths.length > 0
922
+ ? {
923
+ ...target,
924
+ objc: {
925
+ ...target.objc,
926
+ frameworkSearchPaths: [
927
+ ...new Set([
928
+ ...target.objc.frameworkSearchPaths,
929
+ ...packageFrameworkSearchPaths,
930
+ ]),
931
+ ],
932
+ },
933
+ }
934
+ : target
935
+ const app = {
936
+ ...withPackageFrameworks(appTarget),
937
+ frameworks: [
938
+ ...appTarget.frameworks.map(withPackageFrameworks),
939
+ ...frameworkTargets.flatMap((framework) => [...framework.frameworks, framework]),
940
+ ],
941
+ projectFiles: [
942
+ ...appTarget.projectFiles,
943
+ ...frameworkTargets.flatMap((framework) => framework.projectFiles),
944
+ ],
945
+ resourceProducts: [
946
+ ...appTarget.resourceProducts,
947
+ ...frameworkTargets.flatMap((framework) => framework.resourceProducts),
948
+ ],
949
+ sdkFrameworks: [
950
+ ...new Set([
951
+ ...appTarget.sdkFrameworks,
952
+ ...frameworkTargets.flatMap((framework) => framework.sdkFrameworks),
953
+ ]),
954
+ ],
955
+ }
882
956
  const appSources = app.allSources
883
957
  const checkouts = remoteSwiftCheckouts(app.rootDir)
884
958
  const files = new Set([
@@ -894,10 +968,6 @@ async function buildXcodeLayout(root: string): Promise<XcodeLayout | null> {
894
968
  const resourceBundles: SwiftResourceBundle[] = [
895
969
  { target: app.moduleName, sourcePath: XCODE_APP_DIR, path: '.' },
896
970
  ]
897
- const { packages, standins, projectGaps, binaries } = await swiftPackages(
898
- registered,
899
- app,
900
- )
901
971
  const targets: XcodeLayout['targets'] = []
902
972
  const frameworkNames = new Map<XcodeModuleTarget, string>()
903
973
  const usedNames = new Set(
@@ -1519,7 +1589,16 @@ async function buildXcodeLayout(root: string): Promise<XcodeLayout | null> {
1519
1589
  ),
1520
1590
  })
1521
1591
  }
1522
- const graphTargets = [...app.sourceLinkGraph.targets, ...packages.sourceLinks.targets]
1592
+ const graphTargets = [
1593
+ ...app.sourceLinkGraph.targets,
1594
+ ...frameworkTargets.flatMap((framework) => framework.sourceLinkGraph.targets),
1595
+ ...packages.sourceLinks.targets.map((target) => {
1596
+ const source = sourceFrameworks.get(target.id)
1597
+ return source
1598
+ ? { ...target, dependencies: [{ target: source.id, attributes: [] }] }
1599
+ : target
1600
+ }),
1601
+ ]
1523
1602
  const applicationBuildVersion = app.sourceLinkGraph.targets.find(
1524
1603
  (target) => target.id === app.sourceLinkGraph.entry,
1525
1604
  )!.buildVersion
@@ -3052,11 +3131,24 @@ async function compile(
3052
3131
  // feature, exactly when its import compiles. longest path first, so a
3053
3132
  // nested target's files read its own settings.
3054
3133
  const byPath = [...parsed].sort((left, right) => right.path.length - left.path.length)
3134
+ const clangModulesByTarget = new Map(
3135
+ (input.nativeTargets ?? []).map(({ name, headerSearchPaths }) => [
3136
+ name,
3137
+ headerSearchPaths.flatMap((directory) => {
3138
+ const map = input.files[path.posix.join(directory, 'module.modulemap')]
3139
+ return map === undefined ? [] : moduleMapModules(map).map(({ name }) => name)
3140
+ }),
3141
+ ]),
3142
+ )
3055
3143
  const providedByFile = (file: string): readonly string[] => {
3056
3144
  const owner = byPath.find((target) =>
3057
3145
  target.path === '.' ? true : file.startsWith(`${target.path}/`),
3058
3146
  )
3059
- return owner?.experimentalFeatures?.includes('BuiltinModule') ? ['Builtin'] : []
3147
+ if (!owner) return []
3148
+ const clangModules = clangModulesByTarget.get(owner.name) ?? []
3149
+ return owner.experimentalFeatures?.includes('BuiltinModule')
3150
+ ? [...clangModules, 'Builtin']
3151
+ : clangModules
3060
3152
  }
3061
3153
  const missing = missingSwiftModules(
3062
3154
  input.files,
@@ -678,6 +678,11 @@ function* xcodeObjCInputSteps(
678
678
  }
679
679
  return regular ? source : null
680
680
  }
681
+ for (const directory of target.objc.headerSearchPaths) {
682
+ if (isSdkInclude(directory)) continue
683
+ const file = availableHeader(path.join(directory, 'module.modulemap'))
684
+ if (file) queue.push({ file, origin: directory })
685
+ }
681
686
  // a forced include on the search path is found like a quoted include; an
682
687
  // sdk header is no project input
683
688
  for (const name of forced) {
@@ -97,6 +97,16 @@ export interface SwiftPackages {
97
97
  guestTargets: SwiftManifestTarget[]
98
98
  }[]
99
99
  nativeProducts: { name: string; packageDir: string; source: string }[]
100
+ /** source framework producers for binary targets whose release builds are available. */
101
+ sourceFrameworks: {
102
+ packageTarget: string
103
+ project: string
104
+ target: string
105
+ module: string
106
+ configuration: string
107
+ machOType: 'staticlib' | 'mh_dylib'
108
+ settings?: Readonly<Record<string, string>>
109
+ }[]
100
110
  /** linked products peach cannot compile. */
101
111
  unavailable: Map<string, SwiftPackageGap>
102
112
  /** every module a reached package declares that does not compile. */
@@ -167,6 +177,47 @@ export const SWIFT_PLACEHOLDER_PACKAGES: ReadonlyMap<string, string> = new Map<
167
177
  const placeholderPackage = (pkg: LoadedPackage) =>
168
178
  SWIFT_PLACEHOLDER_PACKAGES.get(swiftPackageIdentity(pkg.manifest.dir))
169
179
 
180
+ // each archive is bound to the source revision and xcode target used by its release.
181
+ const sourceFrameworkRecipes = new Map<
182
+ string,
183
+ Omit<SwiftPackages['sourceFrameworks'][number], 'packageTarget'> & { revision: string }
184
+ >([
185
+ [
186
+ '438de2c5afb7dde20b640af35dd841961aa2aa4d2719e40c92d48bd2aa5dca56',
187
+ {
188
+ revision: 'a49e7c2148ac9e38bd35ef4f13bc9d6ea3ff0b81',
189
+ project: 'Sentry.xcodeproj',
190
+ target: 'Sentry',
191
+ module: 'Sentry',
192
+ configuration: 'Release',
193
+ machOType: 'staticlib',
194
+ },
195
+ ],
196
+ [
197
+ '780558374b95d370e8b604097f9ccb2cac328fdd18c4b8542a58ece83d2548d2',
198
+ {
199
+ revision: '5421f94cc859eb65f5ae3866165a053aa634431e',
200
+ project: 'Sentry.xcodeproj',
201
+ target: 'Sentry',
202
+ module: 'Sentry',
203
+ configuration: 'Release',
204
+ machOType: 'staticlib',
205
+ settings: { CARTHAGE: 'YES' },
206
+ },
207
+ ],
208
+ [
209
+ '159842b63ab14ed1615fcace752c57b2633b3d3be6fadd4f643a1c8323b70e48',
210
+ {
211
+ revision: '5561a15a4836efe5d068a366b60599b7b794af70',
212
+ project: 'Simperium.xcodeproj',
213
+ target: 'Simperium_iOS',
214
+ module: 'Simperium',
215
+ configuration: 'Release',
216
+ machOType: 'mh_dylib',
217
+ },
218
+ ],
219
+ ])
220
+
170
221
  /** dependency checkouts belong to peach, isolated by the canonical app root. */
171
222
  export function remoteSwiftCheckouts(root: string): string {
172
223
  const prepared = preparedSwiftCheckouts(root)
@@ -510,6 +561,7 @@ interface LoadedPackage {
510
561
  /** the url, or the local directory. */
511
562
  source: string
512
563
  remote: boolean
564
+ revision?: string
513
565
  manifest: SwiftPackageManifest
514
566
  }
515
567
 
@@ -583,6 +635,7 @@ export function resolveSwiftPackages(options: {
583
635
  targets: [],
584
636
  nativePackages: [],
585
637
  nativeProducts: [],
638
+ sourceFrameworks: [],
586
639
  unavailable: new Map(),
587
640
  modules: new Map(),
588
641
  binaries: [],
@@ -592,6 +645,7 @@ export function resolveSwiftPackages(options: {
592
645
  const checkouts = remoteSwiftCheckouts(rootDir)
593
646
 
594
647
  const packages = new Map<string, LoadedPackage | string>()
648
+ const sourceFrameworks = new Map<string, SwiftPackages['sourceFrameworks'][number]>()
595
649
  // swiftpm identifies a remote package by its identity (the url's last path
596
650
  // component, case-insensitive and without `.git`) and a local package by its
597
651
  // directory. two spellings of one repository are one package, with one
@@ -624,6 +678,7 @@ export function resolveSwiftPackages(options: {
624
678
  loaded = {
625
679
  source: source.url,
626
680
  remote: true,
681
+ revision: pin.revision,
627
682
  manifest: swiftPackageManifest(
628
683
  fetchedCheckout(checkouts, identity, pin),
629
684
  undefined,
@@ -696,6 +751,7 @@ export function resolveSwiftPackages(options: {
696
751
  const targetOutcomes = new Map<string, string[]>()
697
752
  const resolveTarget = (pkg: LoadedPackage, name: string): string[] => {
698
753
  const key = `${pkg.manifest.dir}\0${name}`
754
+ if (sourceFrameworks.has(key)) return []
699
755
  if (targetOutcomes.has(key)) return targetOutcomes.get(key)!
700
756
  // a dependency cycle resolves as compiling; swiftpm rejects real cycles
701
757
  targetOutcomes.set(key, [])
@@ -838,6 +894,22 @@ export function resolveSwiftPackages(options: {
838
894
  if (!binaryOnly && claimed.has(key)) return true
839
895
  const target = pkg.manifest.targets.get(name)
840
896
  if (target?.type === 'binary') {
897
+ const recipe = target.checksum
898
+ ? sourceFrameworkRecipes.get(target.checksum)
899
+ : undefined
900
+ if (recipe && pkg.revision === recipe.revision && name === recipe.module) {
901
+ sourceFrameworks.set(key, {
902
+ packageTarget: path.join(pkg.manifest.dir, '#target', name),
903
+ project: path.join(pkg.manifest.dir, recipe.project),
904
+ target: recipe.target,
905
+ module: recipe.module,
906
+ configuration: recipe.configuration,
907
+ machOType: recipe.machOType,
908
+ settings: recipe.settings,
909
+ })
910
+ providedTargets.delete(name)
911
+ return true
912
+ }
841
913
  const changed =
842
914
  !options.standinTargets?.has(name) && shippedBinaryDiffers(name, target.checksum)
843
915
  if (changed) providedTargets.delete(name)
@@ -907,6 +979,7 @@ export function resolveSwiftPackages(options: {
907
979
  for (const pkg of packages.values()) {
908
980
  if (typeof pkg === 'string') continue
909
981
  for (const [name, target] of pkg.manifest.targets) {
982
+ if (sourceFrameworks.has(`${pkg.manifest.dir}\0${name}`)) continue
910
983
  if (target.type === 'test' || target.type === 'plugin' || target.type === 'macro')
911
984
  continue
912
985
  if (target.type === 'executable') continue
@@ -1169,6 +1242,8 @@ export function resolveSwiftPackages(options: {
1169
1242
  const id = targetId(pkg, name)
1170
1243
  if (emitted.has(id)) return id
1171
1244
  emitted.add(id)
1245
+ const framework = sourceFrameworks.get(`${pkg.manifest.dir}\0${name}`)
1246
+ if (framework) result.sourceFrameworks.push(framework)
1172
1247
  const target = pkg.manifest.targets.get(name)
1173
1248
  if (!target) throw new Error(`missing resolved package target ${name}`)
1174
1249
  const dependencies =
@@ -261,6 +261,7 @@ export function swiftSharedSdkViewOptions(
261
261
  .filter((entry) => entry.isFile())
262
262
  .map((entry) => path.join(entry.parentPath, entry.name))
263
263
  .sort()
264
+ const hasDarwinTcp = overlayFiles.includes(path.join(overlay, 'netinet/tcp.h'))
264
265
  const key = JSON.stringify([
265
266
  // bump the recipe when the transformation changes; bundling changes function text.
266
267
  'v25',
@@ -270,6 +271,7 @@ export function swiftSharedSdkViewOptions(
270
271
  frameworks,
271
272
  overlayFiles,
272
273
  swiftSdkOptions(),
274
+ ...(hasDarwinTcp ? ['darwin-tcp-module'] : []),
273
275
  ])
274
276
  const cached = sdkViews.get(key)
275
277
  if (cached && fs.existsSync(cached.manifest)) return touchSdkView(cached.options)
@@ -390,6 +392,23 @@ export function swiftSharedSdkViewOptions(
390
392
  fs.mkdirSync(path.dirname(destination), { recursive: true })
391
393
  fs.symlinkSync(shared, destination)
392
394
  }
395
+ if (hasDarwinTcp) {
396
+ // older sdk maps load musl's incompatible tcphdr into SwiftWASILibc.
397
+ const moduleMap = path.join(
398
+ staging,
399
+ path.relative(realRoot, sysroot),
400
+ 'darwin/wasm/include/module.modulemap',
401
+ )
402
+ const original = fs.readFileSync(moduleMap, 'utf8')
403
+ const updated = original.replace(
404
+ '"../../../include/wasm64-wasip1/netinet/tcp.h"',
405
+ '"netinet/tcp.h"',
406
+ )
407
+ if (updated !== original) {
408
+ fs.unlinkSync(moduleMap)
409
+ fs.writeFileSync(moduleMap, updated)
410
+ }
411
+ }
393
412
  const foundationArchive = path.join(
394
413
  path.dirname(sysroot),
395
414
  'swift.xctoolchain/usr/lib/swift_static/wasi/libFoundation.a',
@@ -46,9 +46,8 @@ export interface SwiftHostCompilerPin {
46
46
  hosts: Record<string, { checksum: string; manifest: string }>
47
47
  }
48
48
 
49
- // retain qualification for the published distribution while source builds
50
- // advance. an installed CLI adds the compiler its runtime pins
51
- // (registerSwiftHostCompiler).
49
+ // keep the checkout, distribution lock, and live canary index compilers.
50
+ // installed CLIs register the compiler carried by their own runtime.
52
51
  const compilerArchives: Record<string, SwiftHostCompilerPin> = {
53
52
  'swift-6.4.0-RELEASE-custom-cbd9cef4b408cc96': {
54
53
  identity: 'cbd9cef4b408cc96',
@@ -86,24 +85,6 @@ const compilerArchives: Record<string, SwiftHostCompilerPin> = {
86
85
  },
87
86
  },
88
87
  },
89
- 'swift-6.4.0-RELEASE-custom-44ecd25f163bb359': {
90
- identity: '44ecd25f163bb359',
91
- archive: 'tar.zst',
92
- hosts: {
93
- 'darwin-arm64': {
94
- checksum: 'd06dda4435f99d8376179cc7a3804907aa7305513135ece6288fd8e6d4695ae6',
95
- manifest: 'bc0d8b955f923f096dda2aa8bbb1d56176a73f3d4a4df4cc9a1f59d31417061a',
96
- },
97
- 'linux-x64': {
98
- checksum: 'f95b56440693c5de7995f10ea14c57fc7e659a161018a17f17a74b61a98e88a4',
99
- manifest: 'c18a60b14d5c89a8b2e1dbb2b4b52342c5fb92c7f3069fdc55c985bce61683a7',
100
- },
101
- 'linux-arm64': {
102
- checksum: 'afb74ae60df2b5bd7792bfbcf29bcea03675a5c814b758dd6cb91a760c220cd2',
103
- manifest: 'ac037f6b0fdc4a6ae582eebc22bcf811fa2becdc30d083057137fc857f3c456a',
104
- },
105
- },
106
- },
107
88
  'swift-6.4.0-RELEASE-custom-11345d60dca47496': {
108
89
  identity: '11345d60dca47496',
109
90
  archive: 'tar.zst',
@@ -122,186 +103,6 @@ const compilerArchives: Record<string, SwiftHostCompilerPin> = {
122
103
  },
123
104
  },
124
105
  },
125
- 'swift-6.4.0-RELEASE-custom-45bb46301c86fe73': {
126
- identity: '45bb46301c86fe73',
127
- archive: 'tar.gz',
128
- hosts: {
129
- 'darwin-arm64': {
130
- checksum: '102dfbbb7b451be0685763b7a427284b75a8078874543f091b1c4b3db86e6565',
131
- manifest: 'fb6c4d75ef6f4b3c094ae5a4d5d1e6bdfd85431f3fe25d514f3e7a0b4add60ef',
132
- },
133
- 'linux-x64': {
134
- checksum: 'd3c040e042e12ff787b64bfde1d85238254365036ce093f3b20ff86e8ff996f0',
135
- manifest: '7c7144be591692e563396fe3c987c5aa56fbaea4faacaad62283c0c6e5c04ae2',
136
- },
137
- 'linux-arm64': {
138
- checksum: '604e6fc5fc0f5a93cee3ca6dfa9616244a2a49ef517caa3155a12ae4a0ecf72b',
139
- manifest: '075fd53d03ecf099954f1d023bb4bb67a5c5ee946537466d6c105022bdf8ecde',
140
- },
141
- },
142
- },
143
- 'swift-6.4.0-RELEASE-custom-0b2d0a9011c88e66': {
144
- identity: '0b2d0a9011c88e66',
145
- archive: 'tar.gz',
146
- hosts: {
147
- 'darwin-arm64': {
148
- checksum: 'dc6a494227297ea657e8e5f7c5b4a861cb5e142bdbcfcb028ace2aeb19db90cc',
149
- manifest: 'd8e9eee0fb9b847f1e9350525d6c68606df46101745f553332309ed026b3c26a',
150
- },
151
- 'linux-x64': {
152
- checksum: '85c04b4496aea1657c21a47f448e01d6ccc1c7920d130a566db37fb8350a7be2',
153
- manifest: '8451659e74235ad53b700c1afbe293512197900eb98cb1f79e36df2f5c85d511',
154
- },
155
- 'linux-arm64': {
156
- checksum: '196606ed62c5c926d18e6ef0769cb1ab21c9943f9084070ddf14a7bc696768b8',
157
- manifest: '85fb8d5b6527bd75003a6dbd25b68b22540665cf9df9b13f41f82e5d8acdbf1d',
158
- },
159
- },
160
- },
161
- 'swift-6.4.0-RELEASE-custom-f7c03c3f59ec5d83': {
162
- identity: 'f7c03c3f59ec5d83',
163
- archive: 'tar.gz',
164
- hosts: {
165
- 'darwin-arm64': {
166
- checksum: '8946a2d4716d3b0784cef7a85a35f66537bd319c4c5a48c63457d607260df5c5',
167
- manifest: '2a7754e6e365bf71ae6b6aefbbd810123795c73d43fb902a8a972d009d72790f',
168
- },
169
- 'linux-x64': {
170
- checksum: '5ffa3b54d54583c1d6a38b708693072db4d088ba4bf5966b17014c068b2db641',
171
- manifest: '1b23ea52c5570de4697481a54bd0b0a0bcd6b54feccb7b0bb940d3643dec82cb',
172
- },
173
- 'linux-arm64': {
174
- checksum: '29b0b97b7b0db4475dbe55f7011e57f493fed9f3482a6705becebd8b68c90bab',
175
- manifest: '3fdab1132715f5899de1bb1d7ddcd52cf540295ab86586c72f49502f37a403a1',
176
- },
177
- },
178
- },
179
- 'swift-6.4.0-RELEASE-custom-3e3dca8fd1d82975': {
180
- identity: '3e3dca8fd1d82975',
181
- archive: 'tar.gz',
182
- hosts: {
183
- 'darwin-arm64': {
184
- checksum: 'dfad56454f5e1e465071ff708bf485be65b438cf55d02b04d26d17d26df9f54a',
185
- manifest: '82c35e43ed81101bea500100356a555d8266e1987d5ca7605aaa4df747c38f81',
186
- },
187
- 'linux-x64': {
188
- checksum: 'd3f5908d097fdc1337ff979114e605bcc758052e32f9d5d760574153d58ce6db',
189
- manifest: 'a03caf181177f3d68a45b5246d0f0a26d8a5fa9ff33cf44c44e6942b73363bae',
190
- },
191
- 'linux-arm64': {
192
- checksum: '8fceafca152dd0692aa6bb51236fc362a4caeeef37fc22cb5ef6aa3d0d5b3df3',
193
- manifest: '3115bc496fd8e907a16992dfc5c85b3e0798d3b58ddf1d6dace63842aed8e53b',
194
- },
195
- },
196
- },
197
- 'swift-6.4.0-RELEASE-custom-b082ac5437336790': {
198
- identity: 'b082ac5437336790',
199
- archive: 'tar.gz',
200
- hosts: {
201
- 'darwin-arm64': {
202
- checksum: '85e601982321d3a6f81f05928bc9bbe7a61bc75b27ce24508e79f6b5b537254d',
203
- manifest: 'c889a70c6bba48eb0e5e218a5c0077eb557082fed5c5c58d10f07a941975080e',
204
- },
205
- 'linux-x64': {
206
- checksum: '54c7988622d201e4ba6c83ca75e7b28c658b39cf1ea8b95ea88807afe33aa465',
207
- manifest: 'bfd725c3b07a3624bb44c8e3a1b7ddf1eddde4fc9565e23740a9cee832c94583',
208
- },
209
- 'linux-arm64': {
210
- checksum: 'bd729fd73dc9953306eafd87eda79462b836b3cb127c73108327d7256b15f501',
211
- manifest: 'e7f8827cca0f249a5b4a4750f6324f75633b374985fa0b93e650ee8bfcabeb39',
212
- },
213
- },
214
- },
215
- 'swift-6.4.0-RELEASE-custom-9cdaffdb6b37fb47': {
216
- identity: '9cdaffdb6b37fb47',
217
- archive: 'tar.gz',
218
- hosts: {
219
- 'darwin-arm64': {
220
- checksum: 'fdd3f88cf76a8dc2083275d4253255030068a25b5ba68acbf59e0407c45677dd',
221
- manifest: 'f50c68faf91f7d2a6ea5bcd4da4573a49dd00ad9f334b27d3f9ddb08b65e46cc',
222
- },
223
- 'linux-x64': {
224
- checksum: 'f29f9efc598b17f33d802467676ba282441a8c3c6fa67e307c4a1e6130509d73',
225
- manifest: 'f907727c5a4af58ccad7ccbb043a21289d7eb37d166536a90b3c3848f95df816',
226
- },
227
- 'linux-arm64': {
228
- checksum: '7d4a8a1f90dd6c86804ceb43f8b9cf680b9778d4640a2eb6da5cb333a599f23a',
229
- manifest: 'a3224cd5c09a92f66cacd0395058b2c43fa103a92bb168280132bbd0febd1575',
230
- },
231
- },
232
- },
233
- 'swift-6.4.0-RELEASE-custom-bd49e2f77434e7b1': {
234
- identity: 'bd49e2f77434e7b1',
235
- archive: 'tar.gz',
236
- hosts: {
237
- 'darwin-arm64': {
238
- checksum: 'e815b06394566e8125475afc8f1807f7f465318c845549c5831043cdc28eca64',
239
- manifest: '6e3ae00102c67f2f9761b1462aab63580f2ca010469300a7c4a620765573e4e0',
240
- },
241
- 'linux-x64': {
242
- checksum: '9336e0b0aefaa0171799d4b5d4215c711a24c79ac9e91baa362ba100fc22534f',
243
- manifest: '3802c631f593eda1d79dc4af55a8667356eece954d2ea59b62b1f8f981fa538e',
244
- },
245
- 'linux-arm64': {
246
- checksum: '851b5a756472ad53d833e8f0ab3ae55c05d3e6b49871bb982c977b7582cc117f',
247
- manifest: '4162656192a2881e5ccc763e3e66ce46646a84ff42cdf2de50bd6424ebac5e34',
248
- },
249
- },
250
- },
251
- 'swift-6.4.0-RELEASE-custom-13450179a7e01c81': {
252
- identity: '13450179a7e01c81',
253
- archive: 'tar.gz',
254
- hosts: {
255
- 'darwin-arm64': {
256
- checksum: 'a29be6b722f15c7aafac26ba5703a7392f49ce7ea5e1c56548846b7e458290f7',
257
- manifest: '9d89bc39d80d13c8bdb93ad5c306bb87e83bac34090f9bcec57476fd90a6a115',
258
- },
259
- 'linux-x64': {
260
- checksum: 'b9e9e3ed855f6a8c85f5fe24016b83792a0088e2d0ea632482426c4dc6031b98',
261
- manifest: '5de3bb6bf131e68862539195fbb4fce9d4de2b528fa882495b27fd4bdd02e5ab',
262
- },
263
- 'linux-arm64': {
264
- checksum: '844f5ead2854d4ac2d1fc9fb13c366450a2ed4b8fa641719822d74f9150575b4',
265
- manifest: '1fcfb353679186a3e631b83085e5e8c3dde8cb32d25052b3c8b7896339a4378b',
266
- },
267
- },
268
- },
269
- 'swift-6.4.0-RELEASE-custom-f6868fa6054e83d6': {
270
- identity: 'f6868fa6054e83d6',
271
- archive: 'tar.gz',
272
- hosts: {
273
- 'darwin-arm64': {
274
- checksum: 'bd80c2f35864ec29883dd22001d0165821e80d78002fc12f92406c3c708694a4',
275
- manifest: 'daad0da2a296084307769b59719dbe83e45755871438fad129b20421b111657b',
276
- },
277
- 'linux-x64': {
278
- checksum: '39707ef599835ae2d9ce5aea026b7a96d43e51b4c4dcd2ca62d5fc11c520e871',
279
- manifest: '065405edd9b02a84ce01c09e68531834dbe190232e6387b056a481354c44fe81',
280
- },
281
- 'linux-arm64': {
282
- checksum: 'a91f2947d560b49b56334938d0efdcb22286557da63d65389129030b2a4e146d',
283
- manifest: '4dfbc167c96f30c7de19cc280948786fb79a888b666ca200b0788803902361ce',
284
- },
285
- },
286
- },
287
- 'swift-6.4.0-RELEASE-custom-a560ff35bf882b5c': {
288
- identity: 'a560ff35bf882b5c',
289
- archive: 'tar.zst',
290
- hosts: {
291
- 'darwin-arm64': {
292
- checksum: '36c50bcdfba88a4c0989af0bd60371497eb4403aa7b80644b479fa509a2187a9',
293
- manifest: '253e891527d2213f54eace768b902de89de5e9495a3c5f4018de1985516bd553',
294
- },
295
- 'linux-x64': {
296
- checksum: 'ba25da9182314fc7b7dd2fc041280e1c7b409f80a1fbccdfa5c342669d164c8e',
297
- manifest: '6f951cc4071dd0d6054d85711a7c5fe272273658847831b477a8b24be7254ca0',
298
- },
299
- 'linux-arm64': {
300
- checksum: '5f0f4456e9fe22b5486025db9f679c865841660797d71761245291c2c6811c20',
301
- manifest: 'b6f62fca2ec37593e274ee5bac474f21ffc5db14cd82f492ccbc774f8e9b75d8',
302
- },
303
- },
304
- },
305
106
  [SWIFT_HOST_COMPILER_RELEASE]: {
306
107
  identity: SWIFT_HOST_COMPILER_ID,
307
108
  archive: 'tar.gz',
@@ -12,6 +12,7 @@ import { createHash } from 'node:crypto'
12
12
  import fs from 'node:fs'
13
13
  import path from 'node:path'
14
14
  import { promisify } from 'node:util'
15
+ import { trunkSpecificationFile, trunkVersions } from './cocoapods-trunk'
15
16
  import { rnxHomeDir } from './home-paths'
16
17
  import { installedNativeSources } from './installed-native-libraries'
17
18
 
@@ -534,7 +535,6 @@ async function resolveExternalTurboPod(
534
535
  /** the pod's own GCC_PREPROCESSOR_DEFINITIONS, which CocoaPods builds it with */
535
536
  defines: string[]
536
537
  } | null> {
537
- const shard = createHash('md5').update(name).digest('hex').slice(0, 3).split('')
538
538
  const baseDir = path.join(rnxHomeDir(), 'turbo-pods')
539
539
  const [only] = requirements
540
540
  let version =
@@ -543,44 +543,14 @@ async function resolveExternalTurboPod(
543
543
  ? only!.trim()
544
544
  : undefined
545
545
  if (!version) {
546
- const versionsFile = path.join(baseDir, 'versions', `${shard.join('_')}.txt`)
547
- let versionsText: string
548
- if (fs.existsSync(versionsFile)) {
549
- versionsText = fs.readFileSync(versionsFile, 'utf8')
550
- } else {
551
- const res = await fetch(
552
- `https://cdn.cocoapods.org/all_pods_versions_${shard.join('_')}.txt`,
553
- )
554
- if (!res.ok) return null
555
- versionsText = await res.text()
556
- fs.mkdirSync(path.dirname(versionsFile), { recursive: true })
557
- fs.writeFileSync(versionsFile, versionsText)
558
- }
559
- const line = versionsText.split('\n').find((entry) => entry.startsWith(`${name}/`))
560
- if (!line) return null
561
- version = satisfyingPodVersion(
562
- line
563
- .slice(name.length + 1)
564
- .split('/')
565
- .filter(Boolean),
566
- requirements,
567
- )
546
+ const published = await trunkVersions(name)
547
+ if (!published) return null
548
+ version = satisfyingPodVersion(published, requirements)
568
549
  if (!version) return null
569
550
  }
570
- const specFile = path.join(baseDir, 'specs', `${name}-${version}.podspec.json`)
571
- let specText: string
572
- if (fs.existsSync(specFile)) {
573
- specText = fs.readFileSync(specFile, 'utf8')
574
- } else {
575
- const res = await fetch(
576
- `https://cdn.cocoapods.org/Specs/${shard.join('/')}/${name}/${version}/${name}.podspec.json`,
577
- )
578
- if (!res.ok) return null
579
- specText = await res.text()
580
- fs.mkdirSync(path.dirname(specFile), { recursive: true })
581
- fs.writeFileSync(specFile, specText)
582
- }
583
- const spec: unknown = JSON.parse(specText)
551
+ const spec: unknown = JSON.parse(
552
+ fs.readFileSync(await trunkSpecificationFile(name, version), 'utf8'),
553
+ )
584
554
  if (!object(spec)) return null
585
555
  const source = object(spec.source) ? spec.source : null
586
556
  const gitUrl = typeof source?.git === 'string' ? source.git : null