peachsim 0.1.2439 → 0.1.2441

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 (143) 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 +8180 -8397
  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 +2 -2
  25. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  26. package/dist-lib/esm-chunks/{acorn-FGE4PYDJ.mjs → acorn-FRQNHKFC.mjs} +3 -3
  27. package/dist-lib/esm-chunks/{chunk-HIDNO3RP.mjs → chunk-4BZ3Z3IQ.mjs} +18 -18
  28. package/dist-lib/esm-chunks/{chunk-5T4XBUJP.mjs → chunk-4HEUXQGM.mjs} +4 -4
  29. package/dist-lib/esm-chunks/{chunk-7HANEMO4.mjs → chunk-4ZRMJ5YO.mjs} +1 -1
  30. package/dist-lib/esm-chunks/{chunk-4ZFNH7TU.mjs → chunk-6A6JEVIF.mjs} +1 -1
  31. package/dist-lib/esm-chunks/{chunk-KVTIDLBK.mjs → chunk-ABMB3G7I.mjs} +3 -3
  32. package/dist-lib/esm-chunks/{chunk-C3WBGYP6.mjs → chunk-BAYRN7ZL.mjs} +1 -1
  33. package/dist-lib/esm-chunks/{chunk-KSQ5KM5Y.mjs → chunk-DJMWTW2B.mjs} +1 -1
  34. package/dist-lib/esm-chunks/{chunk-DADGQELM.mjs → chunk-IRMC5BCX.mjs} +1 -1
  35. package/dist-lib/esm-chunks/{chunk-YB27R6JG.mjs → chunk-NPLEBOWJ.mjs} +1 -1
  36. package/dist-lib/esm-chunks/{chunk-HSADZOVN.mjs → chunk-O4EOBXAP.mjs} +1 -1
  37. package/dist-lib/esm-chunks/{chunk-JCKI3VZ6.mjs → chunk-ORYS5CC4.mjs} +1 -1
  38. package/dist-lib/esm-chunks/{chunk-2NPABFPN.mjs → chunk-PMGJ7FLI.mjs} +1 -1
  39. package/dist-lib/esm-chunks/{chunk-6VY6HTJC.mjs → chunk-QUBR7LHU.mjs} +2036 -1918
  40. package/dist-lib/esm-chunks/{chunk-IWJUYJQO.mjs → chunk-QYYJESMK.mjs} +1 -1
  41. package/dist-lib/esm-chunks/{chunk-CVGDRROP.mjs → chunk-VAQJQDWI.mjs} +1 -1
  42. package/dist-lib/esm-chunks/{chunk-DEGYKHN7.mjs → chunk-VCAJFWZD.mjs} +1 -1
  43. package/dist-lib/esm-chunks/{chunk-2EUHEBIJ.mjs → chunk-XO5GX4PI.mjs} +1 -1
  44. package/dist-lib/esm-chunks/{chunk-MIQSRBVU.mjs → chunk-ZCMAKWHN.mjs} +1 -1
  45. package/dist-lib/esm-chunks/{metro-layout-parser-MVUAXRUJ.mjs → metro-layout-parser-AUAVE5VL.mjs} +3 -3
  46. package/dist-lib/expo-swift-bundle.cjs +5580 -5768
  47. package/dist-lib/expo-swift-metadata.cjs +1 -1
  48. package/dist-lib/expo-swift-metadata.mjs +7 -7
  49. package/dist-lib/home-paths.cjs +1 -1
  50. package/dist-lib/host/bridge-host.cjs +6332 -6500
  51. package/dist-lib/host/fetch-proxy-handler.cjs +13891 -13919
  52. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  53. package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
  54. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  55. package/dist-lib/host/websocket-proxy.cjs +1 -1
  56. package/dist-lib/index.cjs +1 -1
  57. package/dist-lib/jump-to-source-babel.cjs +1 -1
  58. package/dist-lib/jump-to-source-native.cjs +1 -1
  59. package/dist-lib/kotlin-host.cjs +1 -1
  60. package/dist-lib/menu.cjs +1 -1
  61. package/dist-lib/menu.mjs +3 -3
  62. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  63. package/dist-lib/metro-fingerprint-registry.mjs +3 -3
  64. package/dist-lib/metro-production-bundle.cjs +1 -1
  65. package/dist-lib/metro-production-bundle.mjs +4 -4
  66. package/dist-lib/native-app-identity-project.cjs +784 -536
  67. package/dist-lib/native-app-identity-project.mjs +543 -408
  68. package/dist-lib/native-app-identity.cjs +1 -1
  69. package/dist-lib/native-app-identity.mjs +6 -6
  70. package/dist-lib/native-firebase-metadata.cjs +1 -1
  71. package/dist-lib/native-firebase-metadata.mjs +3 -3
  72. package/dist-lib/pdfium-raster.cjs +1 -1
  73. package/dist-lib/pdfium-raster.mjs +2 -2
  74. package/dist-lib/plist.cjs +1 -1
  75. package/dist-lib/plist.mjs +3 -3
  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 +81 -79
  79. package/dist-lib/public-origins-lib.json +185 -195
  80. package/dist-lib/react-native-host-modules.cjs +1 -1
  81. package/dist-lib/react-native-host-modules.mjs +2 -2
  82. package/dist-lib/reap-browser.cjs +1 -1
  83. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  84. package/dist-lib/sdk.cjs +1 -1
  85. package/dist-lib/sdk.mjs +7 -7
  86. package/dist-lib/skills.cjs +7579 -7758
  87. package/dist-lib/swift-compile.cjs +1978 -1922
  88. package/dist-lib/swift-compile.mjs +8 -8
  89. package/dist-lib/swift-package.cjs +1 -1
  90. package/dist-lib/swift-package.mjs +3 -3
  91. package/dist-lib/swift-submit.cjs +1 -1
  92. package/dist-lib/swift-submit.mjs +5 -5
  93. package/dist-lib/swift-toolchain.cjs +3 -1
  94. package/dist-lib/swift.cjs +1 -1
  95. package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
  96. package/dist-lib/vendor/acorn.cjs +1 -1
  97. package/dist-lib/vendor/bplist-parser.cjs +1 -1
  98. package/dist-lib/vendor/ignore.cjs +1 -1
  99. package/dist-lib/vendor/magic-string.cjs +1 -1
  100. package/dist-lib/vendor/plist.cjs +17 -17
  101. package/dist-lib/vendor/smol-toml.cjs +1 -1
  102. package/dist-lib/vendor/stream-json.cjs +1 -1
  103. package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
  104. package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
  105. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
  106. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
  107. package/dist-lib/vendor/sucrase.cjs +1 -1
  108. package/dist-lib/vendor/terser.cjs +1 -1
  109. package/dist-lib/vendor/valibot.cjs +1 -1
  110. package/dist-lib/vendor/zod.cjs +1 -1
  111. package/dist-lib/worklet-executable.cjs +1 -1
  112. package/dist-lib/worklet-executable.mjs +3 -3
  113. package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-cookies.d.ts +4 -0
  114. package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +2 -2
  115. package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +9 -0
  116. package/package.json +1 -1
  117. package/runtime-companion.json +1 -1
  118. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSDateComponentsFormatter.h +1 -1
  119. package/src/expo-discovery-cache.ts +9 -45
  120. package/src/expo-native-compiler-digest.ts +8 -0
  121. package/src/expo-native-prebuilt.ts +1 -10
  122. package/src/expo-native-workspace.ts +5 -120
  123. package/src/expo-pod-prebuilt.ts +1 -1
  124. package/src/expo-swift-host.ts +48 -35
  125. package/src/host/bridge-host.ts +2 -0
  126. package/src/installed-native-libraries.ts +10 -20
  127. package/src/native-slices.ts +1 -1
  128. package/src/pod-graph-specifications.ts +11 -0
  129. package/src/pods-install.ts +10 -7
  130. package/src/podspec-cocoapods.ts +8 -3
  131. package/src/podspec-sources.ts +19 -15
  132. package/src/swift-clang-type-ownership.ts +118 -0
  133. package/src/swift-compile.ts +20 -12
  134. package/src/swift-guest-image-ledger.ts +48 -0
  135. package/src/swift-guest-link.ts +11 -1
  136. package/src/swift-host.ts +7 -8
  137. package/src/swift-package-manifest.ts +13 -8
  138. package/src/swift-packages.ts +0 -5
  139. package/src/swift-toolchain.ts +1 -1
  140. package/src/xcode-project.ts +64 -46
  141. package/src/portable-expo-contract.ts +0 -108
  142. package/src/portable-expo-workspace.ts +0 -100
  143. package/src/prepared-xcode-phases.ts +0 -194
@@ -20,7 +20,6 @@ import { requireNativeGit } from './native-git.ts'
20
20
  import { prepareOneSDKSources } from './one-sdk-preparation.ts'
21
21
  import { installPods } from './pods-install.ts'
22
22
  import { readInstalledPodspecs } from './podspec-sources.ts'
23
- import { portableExpoWorkspace } from './portable-expo-workspace.ts'
24
23
  import {
25
24
  reapRetiredCacheDirectory,
26
25
  removeRetiredDirectory,
@@ -98,22 +97,11 @@ const NATIVE_PACKAGE_ENTRY =
98
97
  // node_modules stays out: the js install reconciles it with the hashed
99
98
  // lockfiles, and the discovery cache keys the live native inventory separately.
100
99
  export async function hashExpoWorkspace(app: string, signal?: AbortSignal) {
101
- if (process.platform !== 'darwin' || process.env.PEACH_PREPARED_NATIVE_WORKSPACES) {
102
- const source = await hashExpoSourceWorkspace(app, signal)
103
- const prepared = await portableExpoWorkspace(app, source.hash, signal)
104
- return {
105
- root: source.root,
106
- hash: createHash('sha256')
107
- .update(`${source.hash}\0${prepared.identity}`)
108
- .digest('hex'),
109
- }
110
- }
111
100
  const { root, hash } = await hashWorkspaceInputs(app, true, signal)
112
101
  return { root, hash }
113
102
  }
114
103
 
115
- // the portable producer records the app inputs separately from its Mac
116
- // toolchain, so a Linux consumer can verify the same source without Xcode.
104
+ // published artifacts key the app inputs separately from the host toolchain.
117
105
  export async function hashExpoSourceWorkspace(app: string, signal?: AbortSignal) {
118
106
  const { root, hash } = await hashWorkspaceInputs(app, true, signal, true)
119
107
  return { root, hash }
@@ -123,45 +111,6 @@ export async function hashExpoNativeWorkspaceInputs(app: string) {
123
111
  return (await hashWorkspaceInputs(app, false, undefined, true)).nativeHash
124
112
  }
125
113
 
126
- // a portable producer cannot claim the live app's hash unless the prepared
127
- // copy actually holds those bytes, including files outside the native graph.
128
- export async function verifyExpoWorkspaceCopy(app: string, work: string) {
129
- const root = findWorkspaceRoot(app)
130
- const excluded = await workspaceExclusion(
131
- root,
132
- true,
133
- linkedPackageDirectories(root, app),
134
- )
135
- const walk = (directory: string) => {
136
- for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
137
- const file = path.join(directory, entry.name)
138
- const relative = path.relative(root, file)
139
- if (excluded(relative, entry.isDirectory())) continue
140
- const copy = path.join(work, relative)
141
- if (entry.isDirectory()) walk(file)
142
- else if (entry.isSymbolicLink()) {
143
- const target = fs.realpathSync(file)
144
- const within = path.relative(root, target)
145
- if (
146
- within === '..' ||
147
- within.startsWith(`..${path.sep}`) ||
148
- path.isAbsolute(within)
149
- )
150
- throw new Error(`Expo source link escapes the workspace: ${relative}`)
151
- if (
152
- !fs.lstatSync(copy).isSymbolicLink() ||
153
- fs.readlinkSync(file) !== fs.readlinkSync(copy)
154
- )
155
- throw new Error(`Expo source link differs from preparation: ${relative}`)
156
- } else if (entry.isFile()) {
157
- if (!fs.existsSync(copy) || !fs.readFileSync(file).equals(fs.readFileSync(copy)))
158
- throw new Error(`Expo source differs from preparation: ${relative}`)
159
- }
160
- }
161
- }
162
- walk(root)
163
- }
164
-
165
114
  function pnpmStoreArgs(root: string) {
166
115
  const modules = path.join(root, 'node_modules', '.modules.yaml')
167
116
  if (!fs.existsSync(modules)) return []
@@ -426,7 +375,7 @@ async function walkWorkspaceInputs(
426
375
  ),
427
376
  ])
428
377
  const toolchain = JSON.stringify({
429
- preparation: 9,
378
+ preparation: 11,
430
379
  appRelative,
431
380
  xcode,
432
381
  node: node.stdout.trim(),
@@ -643,28 +592,13 @@ export async function prepareExpoNativeWorkspace(
643
592
  return { ...prepared, workspace }
644
593
  }
645
594
 
646
- // cocoapods runs only on a Mac. elsewhere the real pod graph exists only when a
647
- // prepared workspace is supplied; without one, installed modules compile from
648
- // their own sources as app-local modules do.
649
- export function nativeWorkspaceAvailable(): boolean {
650
- return (
651
- process.platform === 'darwin' || Boolean(process.env.PEACH_PREPARED_NATIVE_WORKSPACES)
652
- )
653
- }
654
-
655
- /** the app root whose ios directory the native compilers read: with the
656
- * installed CocoaPods workspace where one can exist, otherwise the prebuilt
657
- * Xcode project alone, which still declares the app's deployment target. */
595
+ /** the app root whose installed iOS workspace the native compilers read. */
658
596
  export async function prepareNativeAppRoot(
659
597
  app: string,
660
598
  signal?: AbortSignal,
661
599
  target?: string,
662
600
  ) {
663
- return (
664
- nativeWorkspaceAvailable()
665
- ? await prepareExpoNativeWorkspace(app, signal, target)
666
- : await prepareExpoNativeProject(app, signal)
667
- ).app
601
+ return (await prepareExpoNativeWorkspace(app, signal, target)).app
668
602
  }
669
603
 
670
604
  // resource target membership is generated by prebuild, before CocoaPods runs.
@@ -813,46 +747,6 @@ export function preparedExpoWorkspacesDir(app: string): string {
813
747
  return nativeWorkspacesDir(findWorkspaceRoot(app))
814
748
  }
815
749
 
816
- // release producers prepare the already installed app. this preserves the
817
- // exact dependency tree selected by a replay, including a staged package.
818
- export async function prepareInstalledExpoWorkspace(app: string, work: string) {
819
- if (process.platform !== 'darwin')
820
- throw new Error('Expo workspace production requires a Mac')
821
- const root = findWorkspaceRoot(app)
822
- const excluded = await workspaceExclusion(
823
- root,
824
- true,
825
- linkedPackageDirectories(root, app),
826
- )
827
- const appRelative = path.relative(root, app)
828
- if (fs.existsSync(work))
829
- throw new Error(`prepared Expo workspace already exists: ${work}`)
830
- fs.mkdirSync(path.dirname(work), { recursive: true })
831
- return withSwiftRootLock(work, async (lease) => {
832
- await copyInstalledWorkspace(root, work, excluded)
833
- initializeWorkspaceGit(root, work)
834
- const preparedApp = path.join(work, appRelative)
835
- const manifest = JSON.parse(
836
- fs.readFileSync(path.join(preparedApp, 'package.json'), 'utf8'),
837
- )
838
- const execute: NativeExecute = (args, cwd, env = {}) =>
839
- runAdmitted(lease, args[0]!, args.slice(1), cwd, env)
840
- await prepareNativeProject(
841
- preparedApp,
842
- work,
843
- manifest,
844
- 'workspace',
845
- execute,
846
- (message) => console.error(`[expo-native-workspace] ${message}`),
847
- )
848
- fs.writeFileSync(path.join(work, '.peach-complete'), 'complete\n')
849
- const ios = path.join(preparedApp, 'ios')
850
- const workspaces = fs.readdirSync(ios).filter((name) => name.endsWith('.xcworkspace'))
851
- if (workspaces.length !== 1) throw new Error(`expected one Expo workspace in ${ios}`)
852
- return { app: preparedApp, workspace: path.join(ios, workspaces[0]!), work }
853
- })
854
- }
855
-
856
750
  // the copy's index lists the files its source checkout tracks, including ignored ones
857
751
  // the project commits, so a postinstall that marks them with `git update-index` finds
858
752
  // them. the entries reuse the source index's object ids: hashing or storing a monorepo's
@@ -910,13 +804,6 @@ async function prepareWorkspace(
910
804
  key: string,
911
805
  podsEnvironment: ReturnType<typeof reactNativePodsEnvironment>,
912
806
  ) {
913
- if (
914
- (process.platform !== 'darwin' || process.env.PEACH_PREPARED_NATIVE_WORKSPACES) &&
915
- (stage === 'workspace' || nativeWorkspaceAvailable())
916
- ) {
917
- const source = await hashExpoSourceWorkspace(app)
918
- return portableExpoWorkspace(app, source.hash)
919
- }
920
807
  const started = performance.now()
921
808
  const report = (message: string) =>
922
809
  console.error(
@@ -1109,9 +996,7 @@ async function prepareWorkspace(
1109
996
  fs.utimesSync(work, now, now)
1110
997
  return { app: preparedApp, work }
1111
998
  })
1112
- if (stage === 'workspace') {
1113
- for (const root of [app, result.app]) readInstalledPodspecs(root, result.app)
1114
- }
999
+ if (stage === 'workspace') readInstalledPodspecs(app, result.app)
1115
1000
  // retirement scans and renames other workspaces; it keeps this one by name
1116
1001
  // and takes their locks without waiting, so it needs no place inside this
1117
1002
  // workspace's lock, where it only lengthens the wait of the next prepare.
@@ -8,7 +8,7 @@ import fs from 'node:fs'
8
8
  import path from 'node:path'
9
9
  import { peachAnsweredNativePackages } from './answeredNativePackages'
10
10
  import { expoAutolinkedPackages } from './expo-autolinking'
11
- import { expoNativeCompilerDigestValue } from './expo-native-prebuilt'
11
+ import { expoNativeCompilerDigestValue } from './expo-native-compiler-digest'
12
12
  import { collectExpoSwiftSources } from './expo-swift-host'
13
13
  import {
14
14
  isExpoSwiftCompilationResult,
@@ -24,7 +24,6 @@ import {
24
24
  import { prebuiltExpoNative, prebuiltExpoSwiftResult } from './expo-native-prebuilt'
25
25
  import {
26
26
  hashExpoWorkspace,
27
- nativeWorkspaceAvailable,
28
27
  prepareExpoNativeWorkspace,
29
28
  preparedExpoWorkspacesDir,
30
29
  } from './expo-native-workspace'
@@ -41,13 +40,13 @@ import {
41
40
  NATIVE_PREPARE_QUERY_PARAM,
42
41
  NATIVE_PREPARED_QUERY_PARAM,
43
42
  } from './nativePreparationContract'
44
- import { preparedXcodeInterfaces } from './prepared-xcode-phases'
45
43
  import {
46
44
  BRIDGE_MODULE_FILE_PREFIX,
47
45
  collectBridgeModuleSources,
48
46
  } from './react-native-bridge-modules'
49
47
  import { prebuiltReactNativeCore } from './react-native-core'
50
48
  import { swiftBinaryModules } from './swift-binary-modules'
49
+ import { clangTypeOwnership } from './swift-clang-type-ownership'
51
50
  import {
52
51
  swiftAvailableModules,
53
52
  swiftCodeMask,
@@ -452,8 +451,7 @@ async function discoveryKey(
452
451
  iosTarget: string | undefined,
453
452
  moduleRoot?: string,
454
453
  ): Promise<string> {
455
- const preparesWorkspace =
456
- prepareNative && !installedWorkspace && nativeWorkspaceAvailable()
454
+ const preparesWorkspace = prepareNative && !installedWorkspace
457
455
  const [config, expoConfig, workspace] = await Promise.all([
458
456
  loadRNXAppConfig(resolveAppProject(root)),
459
457
  readExpoConfigAsync(root),
@@ -719,7 +717,6 @@ function enrichInstalledUnits(
719
717
  moduleRoot: string,
720
718
  appRoot: string,
721
719
  bridgeNamespaces: ReadonlySet<string> = new Set(),
722
- interfaceRoot?: string,
723
720
  ): void {
724
721
  const { input, binaryFrameworks } = installed
725
722
  // each unit generates its own binary stand-ins, so the workspace's are not re-mapped
@@ -769,6 +766,44 @@ function enrichInstalledUnits(
769
766
  : `Sources/${target.name}/${file.slice(target.path.length + 1).replace(/^(?:.*\/)?node_modules\//, '')}`
770
767
  : file
771
768
  }
769
+ const supportFiles = Object.fromEntries(
770
+ Object.entries(swiftNativeSupportFiles(input.files, installedTargets)).map(
771
+ ([file, source]) => [map(file), source],
772
+ ),
773
+ )
774
+ const headerAliases = Object.fromEntries(
775
+ Object.entries(input.headerAliases ?? {}).map(([alias, file]) => [
776
+ map(alias),
777
+ map(file),
778
+ ]),
779
+ )
780
+ // frameworks supplied by the runtime or the React Native provider still publish headers.
781
+ for (const target of input.nativeTargets ?? []) {
782
+ const runtimeModule = provided.has(target.name)
783
+ if (!runtimeModule && !reactTargets.has(target.name)) continue
784
+ const swift = runtimeModule ? swiftModuleInterface(moduleRoot, target.name) : null
785
+ const refineClangTypes = clangTypeOwnership(moduleRoot, target.name)
786
+ const interfaceName = `${target.name}-Swift.h`
787
+ for (const [product, file] of Object.entries(target.productHeaders)) {
788
+ if (!product.includes('.framework/Headers/')) continue
789
+ const original = map(file)
790
+ const source = supportFiles[original]
791
+ if (source === undefined) continue
792
+ const alias = map(product)
793
+ if (alias !== original) headerAliases[alias] = original
794
+ if (!swift) continue
795
+ const refined = refineClangTypes(source)
796
+ const contents = withoutSwiftDeclarations(
797
+ refined,
798
+ swift.declared,
799
+ `#import <${target.name}/${interfaceName}>`,
800
+ )
801
+ supportFiles[original] = contents
802
+ if (contents !== refined)
803
+ supportFiles[path.posix.join(path.posix.dirname(alias), interfaceName)] =
804
+ swift.header
805
+ }
806
+ }
772
807
  for (const unit of units) {
773
808
  if (bridgeNamespaces.size > 0 && !bridgeNamespaces.has(unit.namespace)) continue
774
809
  // native modules resolve the installed workspace resource products through Bundle.
@@ -873,23 +908,8 @@ function enrichInstalledUnits(
873
908
  )
874
909
  delete unit.files[file]
875
910
  }
876
- unit.nativeFiles = {
877
- ...unit.nativeFiles,
878
- ...Object.fromEntries(
879
- Object.entries(swiftNativeSupportFiles(input.files, installedTargets)).map(
880
- ([file, source]) => [map(file), source],
881
- ),
882
- ),
883
- }
884
- unit.headerAliases = {
885
- ...unit.headerAliases,
886
- ...Object.fromEntries(
887
- Object.entries(input.headerAliases ?? {}).map(([alias, file]) => [
888
- map(alias),
889
- map(file),
890
- ]),
891
- ),
892
- }
911
+ unit.nativeFiles = { ...unit.nativeFiles, ...supportFiles }
912
+ unit.headerAliases = { ...unit.headerAliases, ...headerAliases }
893
913
  const podspecTargets = unit.nativeTargets ?? []
894
914
  unit.nativeTargets = (input.nativeTargets ?? [])
895
915
  .filter((native) => included.has(native.name))
@@ -989,7 +1009,7 @@ function enrichInstalledUnits(
989
1009
  }
990
1010
  for (const map of maps) {
991
1011
  if (!map.reached.size) continue
992
- const swift = swiftModuleInterface(moduleRoot, map.name, interfaceRoot)
1012
+ const swift = swiftModuleInterface(moduleRoot, map.name)
993
1013
  const mapDirectory = path.posix.dirname(map.file)
994
1014
  if (swift) {
995
1015
  const header = `${map.name}-Swift.h`
@@ -1382,8 +1402,6 @@ async function collectExpoSwiftSourcesUncached(
1382
1402
  moduleRoot = module.root
1383
1403
  provided = new Set(swiftPeachModules(module.root))
1384
1404
  await prepareXcodeSwiftPackages(installedWorkspace, iosTarget, undefined, signal)
1385
- moduleRoot = module.root
1386
- provided = new Set(swiftPeachModules(module.root))
1387
1405
  const snapshot = await withXcodeProject(
1388
1406
  installedWorkspace,
1389
1407
  {
@@ -1560,8 +1578,7 @@ async function collectExpoSwiftSourcesUncached(
1560
1578
  // pod source membership comes from CocoaPods, including packages whose
1561
1579
  // Apple sources live outside an ios directory or exclude sibling sources.
1562
1580
  if (deferredToWorkspace) {
1563
- // every selected pod uses its real prepared graph. non-Mac hosts intake
1564
- // the portable workspace instead of silently dropping its registration.
1581
+ // each selected pod uses the generated workspace's target membership.
1565
1582
  needsNativeWorkspace = true
1566
1583
  continue
1567
1584
  }
@@ -1573,7 +1590,7 @@ async function collectExpoSwiftSourcesUncached(
1573
1590
  if (!prepareNative) {
1574
1591
  if (!answered)
1575
1592
  report(
1576
- `${packageName}: ${namespaces.join(', ')} need CocoaPods target membership, which only a Mac prepares; not compiled`,
1593
+ `${packageName}: ${namespaces.join(', ')} need prepared pod target membership`,
1577
1594
  )
1578
1595
  continue
1579
1596
  }
@@ -2045,7 +2062,6 @@ async function collectExpoSwiftSourcesUncached(
2045
2062
  moduleRoot,
2046
2063
  appRoot,
2047
2064
  new Set(),
2048
- installedWorkspace ? preparedXcodeInterfaces(installedWorkspace) : undefined,
2049
2065
  )
2050
2066
  const allFiles: Record<string, string> = Object.assign(
2051
2067
  {},
@@ -2468,7 +2484,7 @@ async function compileExpoSwiftModulesTraced(
2468
2484
  root,
2469
2485
  signal,
2470
2486
  options.installedWorkspace,
2471
- nativeWorkspaceAvailable() && !options.only,
2487
+ !options.only,
2472
2488
  options.iosTarget,
2473
2489
  { moduleRoot: options.moduleRoot },
2474
2490
  )
@@ -2496,7 +2512,6 @@ async function compileExpoSwiftModulesTraced(
2496
2512
  ? null
2497
2513
  : await collectBridgeModuleSources(fs.realpathSync(root), signal)
2498
2514
  if (
2499
- nativeWorkspaceAvailable() &&
2500
2515
  fs.existsSync(path.join(root, 'ios', 'Podfile')) &&
2501
2516
  bridge?.units.some((unit) =>
2502
2517
  unit.nativeTargets?.some((target) => target.bridgingHeader),
@@ -2518,8 +2533,7 @@ async function compileExpoSwiftModulesTraced(
2518
2533
  bridge &&
2519
2534
  (bridge.installedNamespaces.length > 0 ||
2520
2535
  (bridge.units.length > 0 &&
2521
- (options.installedWorkspace ||
2522
- (nativeWorkspaceAvailable() && fs.existsSync(path.join(ios, 'Podfile'))))))
2536
+ (options.installedWorkspace || fs.existsSync(path.join(ios, 'Podfile')))))
2523
2537
  ) {
2524
2538
  const workspace =
2525
2539
  options.installedWorkspace ??
@@ -2558,7 +2572,6 @@ async function compileExpoSwiftModulesTraced(
2558
2572
  module.root,
2559
2573
  root,
2560
2574
  new Set(bridge.units.map((unit) => unit.namespace)),
2561
- preparedXcodeInterfaces(workspace),
2562
2575
  )
2563
2576
  },
2564
2577
  )
@@ -3085,7 +3098,7 @@ async function compileExpoSwiftModulesTraced(
3085
3098
  )
3086
3099
  const diagnostic = [
3087
3100
  error instanceof SwiftMissingModulesError && unit.workspaceSources?.length
3088
- ? `${unit.workspaceSources.map((name) => `${name} needs a Mac-prepared workspace`).join('; ')}; unresolved imports: ${missingImports.join(', ')}`
3101
+ ? `${unit.workspaceSources.map((name) => `${name} needs a prepared workspace`).join('; ')}; unresolved imports: ${missingImports.join(', ')}`
3089
3102
  : message,
3090
3103
  ...(gaps.get(unit) ?? []),
3091
3104
  ].join('\n')
@@ -307,6 +307,8 @@ const HTTP_MIME_TYPES: Record<string, string> = {
307
307
  '.jpg': 'image/jpeg',
308
308
  '.jpeg': 'image/jpeg',
309
309
  '.gif': 'image/gif',
310
+ '.heic': 'image/heic',
311
+ '.heif': 'image/heif',
310
312
  '.svg': 'image/svg+xml',
311
313
  '.webp': 'image/webp',
312
314
  '.avif': 'image/avif',
@@ -98,12 +98,9 @@ export function installedNativeLibraries(
98
98
  if (providers.length === 0) return result
99
99
  projectRoot = fs.realpathSync(projectRoot)
100
100
  const { app, targets } = installedProviderTargets(providers, projectRoot, iosTarget)
101
- const podsRoot = app.cocoapods && path.dirname(app.cocoapods.manifestLock)
102
- const localPods = new Set(
103
- (app.cocoapods?.localPodspecs ?? []).map((file) =>
104
- path.basename(file, '.podspec.json'),
105
- ),
106
- )
101
+ if (!app.cocoapods) throw new Error(`${projectRoot}: no installed pod graph`)
102
+ const podsRoot = path.dirname(app.cocoapods.manifestLock)
103
+ const localPods = app.cocoapods.localPodspecs
107
104
  const reactNativeRoot = path.dirname(
108
105
  createRequire(path.join(projectRoot, 'package.json')).resolve(
109
106
  'react-native/package.json',
@@ -125,13 +122,11 @@ export function installedNativeLibraries(
125
122
  : combineNativeStaticLibraries([firstShared, ...otherShared], moduleRoot)
126
123
  for (const provider of providers) {
127
124
  const name = path.basename(provider.podspecPath, '.podspec')
128
- const specFile = app.cocoapods?.localPodspecs.find(
129
- (file) => path.basename(file) === `${name}.podspec.json`,
130
- )
131
- if (!specFile) throw new Error(`${name}: no installed CocoaPods specification`)
132
- const spec: unknown = JSON.parse(fs.readFileSync(specFile, 'utf8'))
125
+ const json = localPods.get(name)
126
+ if (!json) throw new Error(`${name}: no installed pod specification`)
127
+ const spec: unknown = JSON.parse(json)
133
128
  if (!isRecord(spec) || spec.name !== name)
134
- throw new Error(`${specFile}: invalid installed specification`)
129
+ throw new Error(`${name}: invalid installed pod specification`)
135
130
  const platform = isRecord(spec.ios) ? spec.ios : {}
136
131
  const paths = [
137
132
  spec.vendored_libraries,
@@ -143,7 +138,7 @@ export function installedNativeLibraries(
143
138
  if (typeof value === 'string') return [value]
144
139
  if (Array.isArray(value) && value.every((item) => typeof item === 'string'))
145
140
  return value
146
- throw new Error(`${specFile}: invalid vendored native paths`)
141
+ throw new Error(`${name}: invalid vendored native paths`)
147
142
  })
148
143
  const target = targets.get(provider.name)!
149
144
  const { root, files } = installedTargetSources(target)
@@ -172,7 +167,7 @@ export function installedNativeLibraries(
172
167
  ...(isRecord(platform.dependencies) ? platform.dependencies : {}),
173
168
  }).flatMap((dependency) => {
174
169
  const pod = dependency.split('/')[0]!
175
- if (!podsRoot || localPods.has(pod)) return []
170
+ if (localPods.has(pod)) return []
176
171
  return installedPodBinaries(path.join(podsRoot, pod)).map((file) =>
177
172
  path.relative(path.dirname(podsRoot), file),
178
173
  )
@@ -205,12 +200,7 @@ export function installedNativeLibraries(
205
200
  )
206
201
  const published: { file: string; relative: string }[] = []
207
202
  for (const visibility of ['Public', 'Private']) {
208
- const directory = path.join(
209
- path.dirname(path.dirname(specFile)),
210
- 'Headers',
211
- visibility,
212
- name,
213
- )
203
+ const directory = path.join(podsRoot, 'Headers', visibility, name)
214
204
  if (!fs.existsSync(directory)) continue
215
205
  for (const entry of fs.readdirSync(directory, {
216
206
  recursive: true,
@@ -6,7 +6,7 @@ export const NATIVE_SLICE_RECIPES = {
6
6
  GhosttyKit: {
7
7
  name: 'GhosttyKit',
8
8
  upstream: 'cf8edc23f3a6a87a96e41a90013e89e987d34980',
9
- source: '8092fa9cc2677618c811fc58d6c8f2d01d59da38',
9
+ source: '6aa8c2a90bff8845e4b5f802842e72d62f2b46b9',
10
10
  port: 'f4f9162f713b9ab15e0e44499e6878608e48b23e75d7833012aecf0a61ac83ba',
11
11
  repository: 'https://github.com/natew/ghostty.git',
12
12
  zig: '0.16.0',
@@ -0,0 +1,11 @@
1
+ import fs from 'node:fs'
2
+ import { isRecord } from './is-record'
3
+
4
+ export const POD_GRAPH_SPECIFICATIONS = '.peach-podspecs.json'
5
+
6
+ export function readPodGraphSpecifications(file: string): Map<string, string> {
7
+ const value: unknown = JSON.parse(fs.readFileSync(file, 'utf8'))
8
+ if (!isRecord(value) || !Object.values(value).every((item) => typeof item === 'string'))
9
+ throw new Error(`${file}: invalid pod graph specifications`)
10
+ return new Map(Object.entries(value).map(([name, json]) => [name, String(json)]))
11
+ }
@@ -1,12 +1,14 @@
1
1
  // what `pod install` leaves in an app's ios directory, made without CocoaPods or Ruby: the Podfile
2
2
  // is evaluated and resolved on Peach's Ruby interpreter, pod sources come from Peach's cache, and
3
- // the Pods project, support files, header links, integrated app project, workspace, Local Podspecs
3
+ // the Pods project, support files, header links, integrated app project, workspace
4
4
  // and lockfiles are written as CocoaPods 1.17 writes them. the lockfile writer follows
5
5
  // cocoapods-core's YAMLHelper (MIT).
6
6
  import fs from 'node:fs'
7
7
  import path from 'node:path'
8
8
  import { isDict, list, parseOpenStepPlist, str, type PlistDict } from './openstep-plist'
9
9
  import { PbxTable, serializePbxproj } from './pbx-table'
10
+ import { POD_GRAPH_SPECIFICATIONS } from './pod-graph-specifications'
11
+ import { podPrepareEnvironment } from './pod-prepare-toolchain'
10
12
  import { cleanInstalledPod, podSourceRoot } from './pod-sources'
11
13
  import { evaluatePodfile, resolvePodfile } from './podfile-cocoapods'
12
14
  import { analyzePods } from './pods-analysis'
@@ -341,7 +343,8 @@ export async function installPods(
341
343
  timings[label] = Math.round(now - started)
342
344
  started = now
343
345
  }
344
- const resolved = await resolvePodfile(evaluatePodfile(app, env, workspace))
346
+ const prepareEnv = await podPrepareEnvironment({ ...process.env, ...env })
347
+ const resolved = await resolvePodfile(evaluatePodfile(app, prepareEnv, workspace))
345
348
  const { interp, file, podfile, sandbox: rubySandbox, resolver } = resolved
346
349
  const iosRoot = path.dirname(file)
347
350
  const call = (source: string, label: string) =>
@@ -370,17 +373,17 @@ export async function installPods(
370
373
  const spec: unknown = JSON.parse(json)
371
374
  if (!isRecord(spec)) throw new Error(`${name}: the specification is no JSON object`)
372
375
  downloaded.set(name, spec)
373
- fs.cpSync(await podSourceRoot(spec), path.join(podsRoot, name), {
376
+ fs.cpSync(await podSourceRoot(spec, prepareEnv), path.join(podsRoot, name), {
374
377
  recursive: true,
375
378
  mode: fs.constants.COPYFILE_FICLONE,
376
379
  verbatimSymlinks: true,
377
380
  })
378
381
  }),
379
382
  )
380
- const specifications = path.join(podsRoot, 'Local Podspecs')
381
- fs.mkdirSync(specifications, { recursive: true })
382
- for (const [name, json] of inputs.stored)
383
- fs.writeFileSync(path.join(specifications, `${name}.podspec.json`), json)
383
+ fs.writeFileSync(
384
+ path.join(podsRoot, POD_GRAPH_SPECIFICATIONS),
385
+ JSON.stringify(Object.fromEntries(inputs.stored)),
386
+ )
384
387
  lap('download')
385
388
 
386
389
  const [definition, ...others] = inputs.definitions
@@ -1184,14 +1184,19 @@ export function evaluatePodspec(
1184
1184
  app: string,
1185
1185
  writable: string,
1186
1186
  env: Host,
1187
+ installed?: string,
1187
1188
  ): unknown {
1188
1189
  return rubyFailures(file, () => {
1189
1190
  const { interp, pod } = cocoapodsInterpreter(app, [writable], env)
1190
1191
  const call = (receiver: Value, name: string, args: Value[] = []) =>
1191
1192
  interp.callMethod(receiver, name, args, null, null, null, null)
1192
- const spec = call(interp.constIn(pod, 'Specification', null, '-'), 'from_file', [
1193
- str(file),
1194
- ])
1193
+ const specification = interp.constIn(pod, 'Specification', null, '-')
1194
+ const spec =
1195
+ installed === undefined
1196
+ ? call(specification, 'from_file', [str(file)])
1197
+ : call(specification, 'from_hash', [
1198
+ call(interp.object.consts.get('JSON') ?? null, 'parse', [str(installed)]),
1199
+ ])
1195
1200
  return toJson(interp, call(pod, 'peach_evaluated', [spec]))
1196
1201
  })
1197
1202
  }
@@ -1,11 +1,15 @@
1
1
  // native membership comes from evaluating each podspec with CocoaPods' own DSL
2
2
  // in Peach's Ruby interpreter, the same on every host. evaluations restored
3
- // from a compiled key artifact or a prepared workspace manifest skip it.
3
+ // from a compiled key artifact skip it.
4
4
  import { createHash, randomUUID } from 'node:crypto'
5
5
  import fs from 'node:fs'
6
6
  import path from 'node:path'
7
7
  import { z } from 'zod'
8
8
  import { cacheDir } from './home-paths'
9
+ import {
10
+ POD_GRAPH_SPECIFICATIONS,
11
+ readPodGraphSpecifications,
12
+ } from './pod-graph-specifications'
9
13
  import { evaluatePodspec } from './podspec-cocoapods'
10
14
  import { findWorkspaceRoot } from './workspace-root'
11
15
 
@@ -51,17 +55,11 @@ const packageContexts = new Map<string, Map<string, string>>()
51
55
  const installedSpecs = new Map<string, Map<string, string>>()
52
56
 
53
57
  export function readInstalledPodspecs(appRoot: string, projectRoot: string) {
54
- const directory = path.join(projectRoot, 'ios/Pods/Local Podspecs')
55
- const files = fs.readdirSync(directory).filter((name) => name.endsWith('.podspec.json'))
56
- installedSpecs.set(
57
- fs.realpathSync(appRoot),
58
- new Map(
59
- files.map((name) => [
60
- name.slice(0, -'.podspec.json'.length),
61
- path.join(directory, name),
62
- ]),
63
- ),
58
+ const specifications = readPodGraphSpecifications(
59
+ path.join(projectRoot, 'ios/Pods', POD_GRAPH_SPECIFICATIONS),
64
60
  )
61
+ installedSpecs.set(fs.realpathSync(appRoot), specifications)
62
+ installedSpecs.set(fs.realpathSync(projectRoot), specifications)
65
63
  }
66
64
 
67
65
  export function beginPodspecEvaluation(appRoot: string) {
@@ -139,7 +137,7 @@ interface PodspecPlan {
139
137
  app: string
140
138
  key: string
141
139
  environment: string
142
- source: string
140
+ installed?: string
143
141
  receipt?: PodspecReceipt
144
142
  }
145
143
 
@@ -232,7 +230,7 @@ export function podspecReceiptIdentity(file: string, appRoot: string | null = nu
232
230
  const installed = reactNative
233
231
  ? undefined
234
232
  : installedSpecs.get(app)?.get(path.basename(file, '.podspec'))
235
- if (installed) environmentHash.update(fs.readFileSync(installed))
233
+ if (installed) environmentHash.update(installed)
236
234
  const environment = environmentHash.digest('hex')
237
235
  return { file, app, ios, env, installed, key, environment }
238
236
  }
@@ -259,7 +257,7 @@ function planPodspec(podspec: string, appRoot: string | null): PodspecPlan {
259
257
  receipts.set(key, receipt)
260
258
  }
261
259
  }
262
- return { file, app, key, environment, source: installed ?? file, receipt }
260
+ return { file, app, key, environment, installed, receipt }
263
261
  }
264
262
 
265
263
  function podspecEnv(): NodeJS.ProcessEnv {
@@ -295,7 +293,13 @@ export function loadPodspecs(
295
293
  environment: plan.environment,
296
294
  app: appIdentity(plan.app),
297
295
  spec: evaluatedSpecSchema.parse(
298
- evaluatePodspec(plan.source, plan.app, packageRoot(plan.file), podspecEnv()),
296
+ evaluatePodspec(
297
+ plan.file,
298
+ plan.app,
299
+ packageRoot(plan.file),
300
+ podspecEnv(),
301
+ plan.installed,
302
+ ),
299
303
  ),
300
304
  }
301
305
  receipts.set(plan.key, plan.receipt)