peachsim 0.1.1817 → 0.1.1818

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 (140) hide show
  1. package/cli/commands/agent-indicator-mode.ts +2 -1
  2. package/cli/commands/coverage-swift.ts +4 -3
  3. package/cli/commands/flow.ts +7 -0
  4. package/cli/commands/inspect/core.ts +1 -1
  5. package/cli/commands/maestro-compare.ts +7 -0
  6. package/cli/commands/package.ts +5 -0
  7. package/cli/commands/screenshot-mode.ts +2 -1
  8. package/cli/commands/shell-boolean-mode.ts +7 -3
  9. package/cli/commands/shell-url.ts +4 -0
  10. package/cli/commands/show-touches-mode.ts +2 -1
  11. package/cli/commands/test.ts +3 -2
  12. package/cli/commands/three-mode.ts +2 -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 +2823 -3829
  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 +2 -2
  37. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  38. package/dist-lib/expo-swift-bundle.cjs +1703 -1579
  39. package/dist-lib/expo-swift-metadata.cjs +1 -1
  40. package/dist-lib/expo-swift-metadata.mjs +1 -1
  41. package/dist-lib/home-paths.cjs +1 -1
  42. package/dist-lib/host/bridge-host.cjs +2781 -3793
  43. package/dist-lib/host/fetch-proxy-handler.cjs +2 -2
  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 +29 -8
  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 +28 -7
  59. package/dist-lib/native-app-identity-project.cjs +31 -6
  60. package/dist-lib/native-app-identity-project.mjs +295 -259
  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 +29 -24
  72. package/dist-lib/public-origins-lib.json +100 -80
  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 +2 -2
  78. package/dist-lib/sdk.mjs +2 -2
  79. package/dist-lib/skills.cjs +3166 -4142
  80. package/dist-lib/swift-compile.cjs +118 -29
  81. package/dist-lib/swift-compile.mjs +125 -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 +1 -1
  85. package/dist-lib/swift-submit.mjs +1 -1
  86. package/dist-lib/swift-toolchain.cjs +52 -6
  87. package/dist-lib/swift.cjs +1 -1
  88. package/dist-lib/vite-swift.cjs +2188 -2060
  89. package/dist-lib/vite.cjs +2 -2
  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/render-worker/compositor-protocol.d.ts +5 -0
  93. package/dist-types/packages/peach-engine/src/render-worker/map-command-channel.d.ts +41 -0
  94. package/dist-types/packages/peach-engine/src/render-worker/mapServicesContract.d.ts +45 -0
  95. package/package.json +2 -1
  96. package/runtime-companion.json +1 -1
  97. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes +1 -1
  98. package/sdk/ios/usr/include/module.modulemap +3 -0
  99. package/sdk/ios/usr/include/notify.modulemap +9 -0
  100. package/sdk/ios/usr/lib/swift/Darwin.swiftmodule/arm64-apple-ios-simulator.swiftinterface +4 -0
  101. package/sdk/ios/usr/lib/swift/Dispatch.swiftmodule/arm64-apple-ios-simulator.swiftinterface +1 -1
  102. package/sdk/ios/usr/lib/swift/Foundation.swiftmodule/arm64-apple-ios-simulator.swiftinterface +7 -1
  103. package/sdk/ios/usr/lib/swift/ObjectiveC.swiftmodule/arm64-apple-ios-simulator.swiftinterface +1 -0
  104. package/sdk/ios/usr/lib/swift/SwiftUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +21 -0
  105. package/sdk/ios/usr/lib/swift/SwiftUICore.swiftmodule/arm64-apple-ios-simulator.swiftinterface +6 -1
  106. package/sdk/ios/wasm/include/__header_time.h +4 -0
  107. package/sdk/ios/wasm/include/pthread.h +2 -0
  108. package/sdk/ios/wasm/include/sys/mman.h +1 -1
  109. package/sdk/ios/wasm/include/sys/resource.h +31 -0
  110. package/sdk/ios/wasm/include/unistd.h +4 -0
  111. package/src/answeredNativePackages.ts +11 -9
  112. package/src/expo-discovery-cache.ts +69 -52
  113. package/src/expo-swift-host.ts +45 -7
  114. package/src/installed-native-libraries.ts +103 -20
  115. package/src/native-static-libraries.ts +69 -33
  116. package/src/nitro-adapter.ts +0 -9
  117. package/src/nitro-compile.ts +45 -16
  118. package/src/nitro-superset.ts +4 -5
  119. package/src/plist-bytes.ts +9 -0
  120. package/src/portable-expo-workspace.ts +4 -3
  121. package/src/react-native-bridge-modules.ts +11 -15
  122. package/src/swift-compile.ts +124 -18
  123. package/src/swift-cxx-reachable.ts +13 -0
  124. package/src/swift-distribution.ts +3 -4
  125. package/src/swift-host.ts +5 -3
  126. package/src/swift-installed-targets.ts +32 -14
  127. package/src/swift-native-pin.ts +45 -0
  128. package/src/swift-objc-compile.ts +23 -1
  129. package/src/swift-objc-standin.ts +4 -1
  130. package/src/swift-package-manifest.ts +2 -2
  131. package/src/swift-root-lock.ts +4 -3
  132. package/src/swift-standins.ts +5 -26
  133. package/src/swift-toolchain.ts +69 -12
  134. package/src/swift-wasm-prune.ts +1 -0
  135. package/src/swift-xcframework.ts +23 -12
  136. package/src/swiftContract.ts +2 -0
  137. package/src/swiftNativePinContract.ts +68 -0
  138. package/src/turbo-bundle.ts +14 -6
  139. package/src/turbo-compile.ts +76 -11
  140. package/src/turbo-source.ts +91 -15
@@ -29,6 +29,10 @@ import { cacheDir } from './home-paths'
29
29
  import { isRecord } from './is-record'
30
30
  import { readExpoConfigAsync } from './native-firebase-config'
31
31
  import { NativePreparationReceipts } from './native-preparation'
32
+ import {
33
+ combineNativeStaticLibraries,
34
+ nonmodularFrameworkLibraries,
35
+ } from './native-static-libraries'
32
36
  import {
33
37
  NATIVE_PREPARE_QUERY_PARAM,
34
38
  NATIVE_PREPARED_QUERY_PARAM,
@@ -641,7 +645,10 @@ function enrichInstalledUnits(
641
645
  interfaceRoot?: string,
642
646
  ): void {
643
647
  const { input, binaryFrameworks } = installed
644
- const installedTargets = swiftManifestTargets(input.files['Package.swift'] ?? '')
648
+ // each unit generates its own binary stand-ins, so the workspace's are not re-mapped
649
+ const installedTargets = swiftManifestTargets(
650
+ input.files['Package.swift'] ?? '',
651
+ ).filter((target) => !target.path.startsWith(`${SWIFT_STANDINS_DIR}/`))
645
652
  const targetByName = new Map(installedTargets.map((target) => [target.name, target]))
646
653
  const importedTargets = swiftTargetDependencies(input.files, installedTargets)
647
654
  const byPath = [...installedTargets].sort((a, b) => b.path.length - a.path.length)
@@ -684,6 +691,12 @@ function enrichInstalledUnits(
684
691
  }
685
692
  for (const name of namespaceGroups.get(unit.namespace) ?? [unit.namespace])
686
693
  visit(name, true)
694
+ // a unit lays each included target out at Sources/<name>, where its Bundle.module accessor reads the assignment
695
+ unit.resourceBundles = input.resourceBundles?.map((bundle) =>
696
+ targetByName.has(bundle.target)
697
+ ? { ...bundle, sourcePath: `Sources/${bundle.target}` }
698
+ : bundle,
699
+ )
687
700
  for (const [file, source] of Object.entries(input.files)) {
688
701
  const owner = byPath.find((target) => file.startsWith(`${target.path}/`))
689
702
  if (
@@ -1018,6 +1031,7 @@ async function collectExpoSwiftSourcesUncached(
1018
1031
  {
1019
1032
  configuration: 'Debug',
1020
1033
  interfaceRoot: module.root,
1034
+ moduleRoot: module.root,
1021
1035
  nativeModules: resolutions.flatMap((resolution) =>
1022
1036
  isRecord(resolution) && Array.isArray(resolution.swiftModuleNames)
1023
1037
  ? resolution.swiftModuleNames.filter(
@@ -1637,7 +1651,7 @@ function expoManifest(
1637
1651
  ? [dependency.name]
1638
1652
  : [],
1639
1653
  )
1640
- return `.target(name: ${JSON.stringify(name)}, dependencies: ${JSON.stringify(dependencies)}, path: ${JSON.stringify(dir)}${configuration ? ', ' + swiftManifestSettings(configuration) : ''})`
1654
+ return `.target(name: ${JSON.stringify(name)}, dependencies: ${JSON.stringify(dependencies)}, path: ${JSON.stringify(dir)}${declared?.resources ? ', resources: []' : ''}${configuration ? ', ' + swiftManifestSettings(configuration) : ''})`
1641
1655
  })
1642
1656
  return `// swift-tools-version: 6.0\nimport PackageDescription\nlet package = Package(name: "PeachExpo", targets: [${declarations.join(', ')}, .executableTarget(name: "PeachExpoApp", path: "Sources/PeachExpoApp")])\n// stand-in inputs: ${generation}\n`
1643
1657
  }
@@ -1645,7 +1659,9 @@ function expoManifest(
1645
1659
  function targetSettings(units: ExpoSwiftSourceUnit[]) {
1646
1660
  const settings = new Map<
1647
1661
  string,
1648
- Parameters<typeof swiftManifestSettings>[0] & Pick<SwiftPackageTarget, 'dependencies'>
1662
+ Parameters<typeof swiftManifestSettings>[0] &
1663
+ Pick<SwiftPackageTarget, 'dependencies'> &
1664
+ Partial<Pick<SwiftPackageTarget, 'resources'>>
1649
1665
  >()
1650
1666
  for (const unit of units) {
1651
1667
  for (const target of swiftManifestTargets(unit.files['Package.swift'] ?? ''))
@@ -1937,8 +1953,25 @@ async function compileExpoSwiftModulesTraced(
1937
1953
  const generations = new Map<ExpoSwiftSourceUnit, string>()
1938
1954
  const gaps = new Map<ExpoSwiftSourceUnit, string[]>()
1939
1955
  const libraries = new Map<ExpoSwiftSourceUnit, Record<string, string>>()
1956
+ const [firstSharedLibrary, ...otherSharedLibraries] = nonmodularFrameworkLibraries(
1957
+ [...new Set(units.flatMap((unit) => unit.frameworks))],
1958
+ module.root,
1959
+ )
1960
+ const sharedLibrary =
1961
+ firstSharedLibrary === undefined
1962
+ ? undefined
1963
+ : fs
1964
+ .readFileSync(
1965
+ combineNativeStaticLibraries(
1966
+ [firstSharedLibrary, ...otherSharedLibraries],
1967
+ module.root,
1968
+ ),
1969
+ )
1970
+ .toString('base64')
1940
1971
  for (const unit of units) {
1941
1972
  signal.throwIfAborted()
1973
+ if (sharedLibrary !== undefined)
1974
+ libraries.set(unit, { [unit.namespace]: sharedLibrary })
1942
1975
  if (unit.absentFrameworks)
1943
1976
  gaps.set(
1944
1977
  unit,
@@ -2025,15 +2058,15 @@ async function compileExpoSwiftModulesTraced(
2025
2058
  unit.nativeTargets.push(standinNativeTarget(standin, deploymentTarget))
2026
2059
  }
2027
2060
  if (linkedLibraries.size > 0)
2028
- libraries.set(
2029
- unit,
2030
- Object.fromEntries(
2061
+ libraries.set(unit, {
2062
+ ...libraries.get(unit),
2063
+ ...Object.fromEntries(
2031
2064
  [...linkedLibraries].map(([library, [first]]) => [
2032
2065
  first!.module,
2033
2066
  fs.readFileSync(library).toString('base64'),
2034
2067
  ]),
2035
2068
  ),
2036
- )
2069
+ })
2037
2070
  generations.set(unit, generation)
2038
2071
  gaps.set(unit, [
2039
2072
  ...(gaps.get(unit) ?? []),
@@ -2114,8 +2147,13 @@ async function compileExpoSwiftModulesTraced(
2114
2147
  ),
2115
2148
  )
2116
2149
  const linkedLibraries = new Map<string, string>()
2150
+ let linkedSharedLibrary = false
2117
2151
  for (const unit of linked)
2118
2152
  for (const [name, library] of Object.entries(libraries.get(unit) ?? {})) {
2153
+ if (name === unit.namespace && library === sharedLibrary) {
2154
+ if (linkedSharedLibrary) continue
2155
+ linkedSharedLibrary = true
2156
+ }
2119
2157
  if (linkedLibraries.has(name) && linkedLibraries.get(name) !== library)
2120
2158
  throw new Error(`conflicting Expo Swift binary libraries for ${name}`)
2121
2159
  linkedLibraries.set(name, library)
@@ -9,22 +9,24 @@ import { isRecord } from './is-record'
9
9
  import {
10
10
  combineNativeStaticLibraries,
11
11
  nativeStaticLibrary,
12
+ nonmodularFrameworkLibraries,
12
13
  nativeStaticLibraryRecipe,
13
14
  } from './native-static-libraries'
14
15
  import { readPackageFile, relativeInside } from './swift-source-file'
15
- import { simulatorStaticArchive } from './swift-xcframework'
16
+ import { simulatorNativeLibrary } from './swift-xcframework'
16
17
  import { readXcodeAppTarget, requireInstalledXcodeWorkspace } from './xcode-project'
17
- import type { TurboInstalledPod, TurboProvider } from './turbo-source'
18
+ import type {
19
+ TurboInstalledPod,
20
+ TurboInstalledSources,
21
+ TurboProvider,
22
+ } from './turbo-source'
23
+ import type { XcodeModuleTarget } from './xcode-project'
18
24
 
19
- export function installedNativeLibraries(
25
+ function installedProviderTargets(
20
26
  providers: readonly Pick<TurboProvider, 'name' | 'podspecPath'>[],
21
27
  projectRoot: string,
22
- moduleRoot: string,
23
28
  iosTarget?: string,
24
- frameworkLinkOwner: 'workspace' | 'provider' = 'workspace',
25
- ): InstalledNativeLibraries {
26
- const result: InstalledNativeLibraries = { pods: new Map(), unavailable: new Map() }
27
- if (providers.length === 0) return result
29
+ ) {
28
30
  const workspace = requireInstalledXcodeWorkspace(projectRoot, 'native providers')
29
31
  const app = readXcodeAppTarget(workspace, iosTarget, 'Release', {
30
32
  installedPods: true,
@@ -34,6 +36,66 @@ export function installedNativeLibraries(
34
36
  path.basename(provider.podspecPath, '.podspec'),
35
37
  ),
36
38
  })
39
+ const targets = new Map<string, XcodeModuleTarget>()
40
+ for (const provider of providers) {
41
+ const name = path.basename(provider.podspecPath, '.podspec')
42
+ const target = app.frameworks.find((item) => item.name === name)
43
+ if (!target?.podRoot)
44
+ throw new Error(`${name}: installed target has no PODS_TARGET_SRCROOT`)
45
+ targets.set(provider.name, target)
46
+ }
47
+ return { app, targets }
48
+ }
49
+
50
+ function installedTargetSources(target: XcodeModuleTarget) {
51
+ const root = fs.realpathSync(target.podRoot!)
52
+ const files = new Set(
53
+ [
54
+ ...target.allSources,
55
+ ...(target.objc?.headers ?? []),
56
+ ...(target.objc?.publicHeaders ?? []),
57
+ ].map((file) => fs.realpathSync(file)),
58
+ )
59
+ return { root, files }
60
+ }
61
+
62
+ export function installedNativeSources(
63
+ providers: readonly Pick<TurboProvider, 'name' | 'podspecPath'>[],
64
+ projectRoot: string,
65
+ iosTarget?: string,
66
+ ): Map<string, TurboInstalledSources> {
67
+ if (providers.length === 0) return new Map()
68
+ const { targets } = installedProviderTargets(providers, projectRoot, iosTarget)
69
+ return new Map(
70
+ [...targets].map(([name, target]): [string, TurboInstalledSources] => {
71
+ const { root, files } = installedTargetSources(target)
72
+ return [
73
+ name,
74
+ {
75
+ root,
76
+ files: [...files]
77
+ .flatMap((file) => {
78
+ const relative = relativeInside(root, file)
79
+ return relative === null ? [] : [relative.split(path.sep).join('/')]
80
+ })
81
+ .sort(),
82
+ },
83
+ ]
84
+ }),
85
+ )
86
+ }
87
+
88
+ export function installedNativeLibraries(
89
+ providers: readonly Pick<TurboProvider, 'name' | 'podspecPath'>[],
90
+ projectRoot: string,
91
+ moduleRoot: string,
92
+ iosTarget?: string,
93
+ frameworkLinkOwner: 'workspace' | 'provider' = 'workspace',
94
+ ): InstalledNativeLibraries {
95
+ const result: InstalledNativeLibraries = { pods: new Map(), unavailable: new Map() }
96
+ if (providers.length === 0) return result
97
+ projectRoot = fs.realpathSync(projectRoot)
98
+ const { app, targets } = installedProviderTargets(providers, projectRoot, iosTarget)
37
99
  const podsRoot = app.cocoapods && path.dirname(app.cocoapods.manifestLock)
38
100
  const localPods = new Set(
39
101
  (app.cocoapods?.localPodspecs ?? []).map((file) =>
@@ -49,6 +111,16 @@ export function installedNativeLibraries(
49
111
  reactNativeRoot,
50
112
  path.join(projectRoot, 'node_modules/react-native'),
51
113
  ]
114
+ // nonmodular frameworks publish their headers through CocoaPods search
115
+ // roots. their verified implementations link once through the shared core.
116
+ const [firstShared, ...otherShared] = nonmodularFrameworkLibraries(
117
+ app.binaryFrameworks.flatMap(({ path: directory }) => (directory ? [directory] : [])),
118
+ moduleRoot,
119
+ )
120
+ const sharedLibrary =
121
+ firstShared === undefined
122
+ ? undefined
123
+ : combineNativeStaticLibraries([firstShared, ...otherShared], moduleRoot)
52
124
  for (const provider of providers) {
53
125
  const name = path.basename(provider.podspecPath, '.podspec')
54
126
  const specFile = app.cocoapods?.localPodspecs.find(
@@ -71,10 +143,8 @@ export function installedNativeLibraries(
71
143
  return value
72
144
  throw new Error(`${specFile}: invalid vendored native paths`)
73
145
  })
74
- const target = app.frameworks.find((item) => item.name === name)
75
- if (!target?.podRoot)
76
- throw new Error(`${name}: installed target has no PODS_TARGET_SRCROOT`)
77
- const root = fs.realpathSync(target.podRoot)
146
+ const target = targets.get(provider.name)!
147
+ const { root, files } = installedTargetSources(target)
78
148
  // a declared archive selects its WebAssembly slice by its original bytes;
79
149
  // one with no registered slice, or one CocoaPods selects through a
80
150
  // subspec or a pattern, has no build peach can link.
@@ -82,7 +152,7 @@ export function installedNativeLibraries(
82
152
  if (spec.subspecs || /[*?{]/.test(file)) return { file, recipe: null }
83
153
  const declared = path.resolve(root, file)
84
154
  const framework = declared.endsWith('.xcframework')
85
- ? simulatorStaticArchive(declared)
155
+ ? simulatorNativeLibrary(declared)
86
156
  : null
87
157
  if (declared.endsWith('.xcframework') && !framework) return { file, recipe: null }
88
158
  const native = framework?.file ?? declared
@@ -124,13 +194,6 @@ export function installedNativeLibraries(
124
194
  return framework && frameworkLinkOwner === 'workspace' ? [] : [library]
125
195
  })
126
196
  const [firstLibrary, ...otherLibraries] = ownedLibraries
127
- const files = new Set(
128
- [
129
- ...target.allSources,
130
- ...(target.objc?.headers ?? []),
131
- ...(target.objc?.publicHeaders ?? []),
132
- ].map((file) => fs.realpathSync(file)),
133
- )
134
197
  const publicHeaders = new Set(
135
198
  (target.objc?.publicHeaders ?? []).map((file) => fs.realpathSync(file)),
136
199
  )
@@ -188,11 +251,30 @@ export function installedNativeLibraries(
188
251
  return []
189
252
  }),
190
253
  })),
254
+ dependencyHeaderMaps: (target.objc?.headerMaps ?? []).map(({ flag, entries }) => ({
255
+ flag,
256
+ root: projectRoot,
257
+ entries: entries.flatMap(([name, file]): [string, string][] => {
258
+ if (reactNativeRoots.some((root) => relativeInside(root, file) !== null))
259
+ return []
260
+ const relative = relativeInside(projectRoot, file)
261
+ return relative === null ? [] : [[name, relative.split(path.sep).join('/')]]
262
+ }),
263
+ })),
191
264
  headerSearchPaths: (target.objc?.headerSearchPaths ?? []).flatMap((directory) => {
192
265
  if (!fs.existsSync(directory)) return []
193
266
  const relative = relativeInside(root, fs.realpathSync(directory))
194
267
  return relative === null ? [] : [relative.split(path.sep).join('/')]
195
268
  }),
269
+ dependencySearchPaths: [...new Set(target.objc?.headerSearchPaths ?? [])].flatMap(
270
+ (directory) => {
271
+ if (!fs.statSync(directory, { throwIfNoEntry: false })?.isDirectory()) return []
272
+ const canonical = fs.realpathSync(directory)
273
+ if (relativeInside(root, canonical) !== null) return []
274
+ const relative = relativeInside(projectRoot, canonical)
275
+ return relative === null ? [] : [{ root: projectRoot, directory: relative }]
276
+ },
277
+ ),
196
278
  publicHeaders: [...publicHeaders].flatMap((file) => {
197
279
  const relative = relativeInside(root, fs.realpathSync(file))
198
280
  return relative === null ? [] : [relative.split(path.sep).join('/')]
@@ -207,6 +289,7 @@ export function installedNativeLibraries(
207
289
  moduleRoot,
208
290
  ),
209
291
  }),
292
+ ...(sharedLibrary === undefined ? {} : { sharedLibrary }),
210
293
  files: [...files]
211
294
  .flatMap((file) => {
212
295
  const relative = relativeInside(root, file)
@@ -8,6 +8,29 @@ import { cacheDir as peachCacheDir } from './home-paths'
8
8
  import { fetchNativeEntry, nativeEntryKey } from './native-prebuilt'
9
9
  import { swiftDistributionAt } from './swift-compile'
10
10
  import { swiftModuleToolchain } from './swift-distribution'
11
+ import { simulatorNativeLibrary } from './swift-xcframework'
12
+
13
+ // nonmodular frameworks expose C++ declarations through header search paths.
14
+ // their implementations still link when no Swift import names the framework.
15
+ export function nonmodularFrameworkLibraries(
16
+ directories: readonly string[],
17
+ moduleRoot: string,
18
+ ): string[] {
19
+ return [
20
+ ...new Set(
21
+ directories.flatMap((directory) => {
22
+ const native = simulatorNativeLibrary(directory)
23
+ if (native?.kind !== 'framework') return []
24
+ if (
25
+ fs.existsSync(path.join(path.dirname(native.file), 'Modules/module.modulemap'))
26
+ )
27
+ return []
28
+ const recipe = nativeStaticLibraryRecipe(fs.readFileSync(native.file))
29
+ return recipe ? [nativeStaticLibrary(native.file, recipe, moduleRoot)] : []
30
+ }),
31
+ ),
32
+ ]
33
+ }
11
34
 
12
35
  export const NATIVE_STATIC_LIBRARY_RECIPES = [
13
36
  {
@@ -48,118 +71,131 @@ export const NATIVE_STATIC_LIBRARY_RECIPES = [
48
71
  recipe: '59ee230bd8bfde478605817c852c47e76f0c18d88d615bcc0a496b4accd69adf',
49
72
  archive: 'libratex_ffi.a',
50
73
  },
51
- // react-native-skia 2.14.0 (apple-ios 154.0.0), then 3.8.0 (157): installed apps pin either.
52
74
  {
53
75
  name: 'skia',
54
76
  nativeSha256: '5312f2b194b1f6b6721388028bf919e56400278245b039f47136aa98f0582333',
55
77
  upstream: '9f9e6beb751091ef69163d2b4fdcd1e711b594ac',
56
- recipe: 'a2642115a5eeb04559c9f1daaa4b4cbe4b1c211533b4cc80cb8339a4477af205',
78
+ recipe: '92d34cbb85796cedeb2e83f4c52ec47b349a92c5e66ecbbb328b76caa9921998',
57
79
  archive: 'libskia.a',
58
80
  },
59
81
  {
60
82
  name: 'skia_svg',
61
83
  nativeSha256: '77adc498cff85db7850fb713c306681c6337f9b4ec42991b3764c8f3eff9d8d0',
62
84
  upstream: '9f9e6beb751091ef69163d2b4fdcd1e711b594ac',
63
- recipe: 'a2642115a5eeb04559c9f1daaa4b4cbe4b1c211533b4cc80cb8339a4477af205',
85
+ recipe: '92d34cbb85796cedeb2e83f4c52ec47b349a92c5e66ecbbb328b76caa9921998',
64
86
  archive: 'libsvg.a',
65
87
  },
66
88
  {
67
89
  name: 'skia_skshaper',
68
90
  nativeSha256: '830bcf260bd24fd79ee5d323e26ec667638795e3a0e555f1093371b8342c345c',
69
91
  upstream: '9f9e6beb751091ef69163d2b4fdcd1e711b594ac',
70
- recipe: 'a2642115a5eeb04559c9f1daaa4b4cbe4b1c211533b4cc80cb8339a4477af205',
92
+ recipe: '92d34cbb85796cedeb2e83f4c52ec47b349a92c5e66ecbbb328b76caa9921998',
71
93
  archive: 'libskshaper.a',
72
94
  },
73
95
  {
74
96
  name: 'skia_skparagraph',
75
97
  nativeSha256: '26afd4e5b11d46b0820a2cd7fd9918eb5a041946e1a1c0d4b91a5d54877e9dda',
76
98
  upstream: '9f9e6beb751091ef69163d2b4fdcd1e711b594ac',
77
- recipe: 'a2642115a5eeb04559c9f1daaa4b4cbe4b1c211533b4cc80cb8339a4477af205',
99
+ recipe: '92d34cbb85796cedeb2e83f4c52ec47b349a92c5e66ecbbb328b76caa9921998',
78
100
  archive: 'libskparagraph.a',
79
101
  },
80
102
  {
81
103
  name: 'skia_skunicode_core',
82
104
  nativeSha256: '629f58c4e81157d42e353b2b255bebb2fd94d1f31d8f8157e982fa4367710526',
83
105
  upstream: '9f9e6beb751091ef69163d2b4fdcd1e711b594ac',
84
- recipe: 'a2642115a5eeb04559c9f1daaa4b4cbe4b1c211533b4cc80cb8339a4477af205',
106
+ recipe: '92d34cbb85796cedeb2e83f4c52ec47b349a92c5e66ecbbb328b76caa9921998',
85
107
  archive: 'libskunicode_core.a',
86
108
  },
87
109
  {
88
110
  name: 'skia_skunicode_libgrapheme',
89
111
  nativeSha256: '047bd82306ba688453a3ff9dc02e203cdf16f2084551cca54f5d2b099baf1895',
90
112
  upstream: '9f9e6beb751091ef69163d2b4fdcd1e711b594ac',
91
- recipe: 'a2642115a5eeb04559c9f1daaa4b4cbe4b1c211533b4cc80cb8339a4477af205',
113
+ recipe: '92d34cbb85796cedeb2e83f4c52ec47b349a92c5e66ecbbb328b76caa9921998',
92
114
  archive: 'libskunicode_libgrapheme.a',
93
115
  },
94
116
  {
95
117
  name: 'skia_skottie',
96
118
  nativeSha256: '75c0dfd82a256e761cddc45475b8109ed8c9a442767cf3a8bf8720eef0dd4af7',
97
119
  upstream: '9f9e6beb751091ef69163d2b4fdcd1e711b594ac',
98
- recipe: 'a2642115a5eeb04559c9f1daaa4b4cbe4b1c211533b4cc80cb8339a4477af205',
120
+ recipe: '92d34cbb85796cedeb2e83f4c52ec47b349a92c5e66ecbbb328b76caa9921998',
99
121
  archive: 'libskottie.a',
100
122
  },
101
123
  {
102
124
  name: 'skia_sksg',
103
125
  nativeSha256: 'df9652a46505d3c5c74d55b52295ef39218d2b5856e074117461fa2348312c8d',
104
126
  upstream: '9f9e6beb751091ef69163d2b4fdcd1e711b594ac',
105
- recipe: 'a2642115a5eeb04559c9f1daaa4b4cbe4b1c211533b4cc80cb8339a4477af205',
127
+ recipe: '92d34cbb85796cedeb2e83f4c52ec47b349a92c5e66ecbbb328b76caa9921998',
106
128
  archive: 'libsksg.a',
107
129
  },
108
130
  {
109
131
  name: 'skia',
110
132
  nativeSha256: 'c9b007c4da16f66d84b2f108af719b424ef91ee0759e58df0b76930bc6f82e31',
111
133
  upstream: 'b94213a11b3a2edadfae89f0c57a7f4ab72772c9',
112
- recipe: 'a2642115a5eeb04559c9f1daaa4b4cbe4b1c211533b4cc80cb8339a4477af205',
134
+ recipe: 'b8672031cf923619809b990af05bde7dd99a773b1fa482cfc982c97b99440f65',
113
135
  archive: 'libskia.a',
114
136
  },
115
137
  {
116
- name: 'skia_svg',
117
- nativeSha256: '159705737769610b60216b114a28ba833840aa1df7833424df99edec4405b86f',
118
- upstream: 'b94213a11b3a2edadfae89f0c57a7f4ab72772c9',
119
- recipe: 'a2642115a5eeb04559c9f1daaa4b4cbe4b1c211533b4cc80cb8339a4477af205',
120
- archive: 'libsvg.a',
121
- },
122
- {
123
- name: 'skia_skshaper',
124
- nativeSha256: '934f3dbf3f38bca87b463b664a17c1588840f86ec89cf6961fb2a89b6336b35b',
138
+ name: 'skia_skottie',
139
+ nativeSha256: '52ea2e046f45f51df6027d783e923864e8c4ef94a1fe4fc5971e436574d8ae57',
125
140
  upstream: 'b94213a11b3a2edadfae89f0c57a7f4ab72772c9',
126
- recipe: 'a2642115a5eeb04559c9f1daaa4b4cbe4b1c211533b4cc80cb8339a4477af205',
127
- archive: 'libskshaper.a',
141
+ recipe: 'b8672031cf923619809b990af05bde7dd99a773b1fa482cfc982c97b99440f65',
142
+ archive: 'libskottie.a',
128
143
  },
129
144
  {
130
145
  name: 'skia_skparagraph',
131
146
  nativeSha256: '29a48349fc9b75c252b22fc6ca5ade90636900f82beec58780f03fd66ab345b3',
132
147
  upstream: 'b94213a11b3a2edadfae89f0c57a7f4ab72772c9',
133
- recipe: 'a2642115a5eeb04559c9f1daaa4b4cbe4b1c211533b4cc80cb8339a4477af205',
148
+ recipe: 'b8672031cf923619809b990af05bde7dd99a773b1fa482cfc982c97b99440f65',
134
149
  archive: 'libskparagraph.a',
135
150
  },
151
+ {
152
+ name: 'skia_sksg',
153
+ nativeSha256: '541a74d8f83dc411efe8eeac377486a5054fab4c7710afe406a20a27efe8f627',
154
+ upstream: 'b94213a11b3a2edadfae89f0c57a7f4ab72772c9',
155
+ recipe: 'b8672031cf923619809b990af05bde7dd99a773b1fa482cfc982c97b99440f65',
156
+ archive: 'libsksg.a',
157
+ },
158
+ {
159
+ name: 'skia_skshaper',
160
+ nativeSha256: '934f3dbf3f38bca87b463b664a17c1588840f86ec89cf6961fb2a89b6336b35b',
161
+ upstream: 'b94213a11b3a2edadfae89f0c57a7f4ab72772c9',
162
+ recipe: 'b8672031cf923619809b990af05bde7dd99a773b1fa482cfc982c97b99440f65',
163
+ archive: 'libskshaper.a',
164
+ },
136
165
  {
137
166
  name: 'skia_skunicode_core',
138
167
  nativeSha256: '096e5139c4de528dbba5a9605895f4c725853e48225503bdfa9c1d70241e5f58',
139
168
  upstream: 'b94213a11b3a2edadfae89f0c57a7f4ab72772c9',
140
- recipe: 'a2642115a5eeb04559c9f1daaa4b4cbe4b1c211533b4cc80cb8339a4477af205',
169
+ recipe: 'b8672031cf923619809b990af05bde7dd99a773b1fa482cfc982c97b99440f65',
141
170
  archive: 'libskunicode_core.a',
142
171
  },
143
172
  {
144
173
  name: 'skia_skunicode_libgrapheme',
145
174
  nativeSha256: 'd1ec3c2d5ad6889eb4fbf4a6bab74f39946739501d40de903f7d8cb2181ac37d',
146
175
  upstream: 'b94213a11b3a2edadfae89f0c57a7f4ab72772c9',
147
- recipe: 'a2642115a5eeb04559c9f1daaa4b4cbe4b1c211533b4cc80cb8339a4477af205',
176
+ recipe: 'b8672031cf923619809b990af05bde7dd99a773b1fa482cfc982c97b99440f65',
148
177
  archive: 'libskunicode_libgrapheme.a',
149
178
  },
150
179
  {
151
- name: 'skia_skottie',
152
- nativeSha256: '52ea2e046f45f51df6027d783e923864e8c4ef94a1fe4fc5971e436574d8ae57',
180
+ name: 'skia_svg',
181
+ nativeSha256: '159705737769610b60216b114a28ba833840aa1df7833424df99edec4405b86f',
153
182
  upstream: 'b94213a11b3a2edadfae89f0c57a7f4ab72772c9',
154
- recipe: 'a2642115a5eeb04559c9f1daaa4b4cbe4b1c211533b4cc80cb8339a4477af205',
155
- archive: 'libskottie.a',
183
+ recipe: 'b8672031cf923619809b990af05bde7dd99a773b1fa482cfc982c97b99440f65',
184
+ archive: 'libsvg.a',
156
185
  },
157
186
  {
158
- name: 'skia_sksg',
159
- nativeSha256: '541a74d8f83dc411efe8eeac377486a5054fab4c7710afe406a20a27efe8f627',
160
- upstream: 'b94213a11b3a2edadfae89f0c57a7f4ab72772c9',
161
- recipe: 'a2642115a5eeb04559c9f1daaa4b4cbe4b1c211533b4cc80cb8339a4477af205',
162
- archive: 'libsksg.a',
187
+ name: 'webgpu_dawn',
188
+ nativeSha256: '781f701e5dfdcf73a6cbc1e2f0ab93dd1c98201073f6fd49cb4cdfd92ae64058',
189
+ upstream: 'ada567700e13aecf7989d78b21f7d330b522ea80',
190
+ recipe: 'b8672031cf923619809b990af05bde7dd99a773b1fa482cfc982c97b99440f65',
191
+ archive: 'libwebgpu_dawn.a',
192
+ },
193
+ {
194
+ name: 'webgpu_dawn',
195
+ nativeSha256: '95078993275bccc969b1dfa1ad0934cbacc05ae59e8aa2a6cc46ce93e97d4f69',
196
+ upstream: '3d786993a7ded64c4ebb4884b9b079db9ad0e580',
197
+ recipe: 'd9d74f464fb442b247446999019ed42f334ef703c425ebe63a8933b906e6ac9c',
198
+ archive: 'libwebgpu_dawn.a',
163
199
  },
164
200
  ]
165
201
 
@@ -9,7 +9,6 @@ import fs from 'node:fs'
9
9
  import path from 'node:path'
10
10
  import { installVerifiedTarball } from '@contrast/runtime-delivery'
11
11
  import { rnxHomeDir } from './home-paths'
12
- import nitroLockJson from './nitro-adapter.lock.json' with { type: 'json' }
13
12
  import {
14
13
  ADAPTER_FAMILIES,
15
14
  ADAPTER_MANIFEST,
@@ -17,7 +16,6 @@ import {
17
16
  adapterPin,
18
17
  digest,
19
18
  headerDigests,
20
- parseAdapterLock,
21
19
  parseAdapterManifest,
22
20
  publishedHeaderDigests,
23
21
  verifyInstalledAdapter,
@@ -31,13 +29,6 @@ import { NITRO_GUEST_PLATFORM } from './nitroContract'
31
29
  import { swiftDistributionAt, swiftModuleSdk, WASM_TRIPLE } from './swift-compile'
32
30
  import { swiftEndpoint } from './swift-distribution'
33
31
  import { privateSwiftDistributionRoot, sourceSwiftCheckout } from './swift-toolchain'
34
- import turboLockJson from './turbo-runtime.lock.json' with { type: 'json' }
35
-
36
- /** the verified archives this build ships, the only locks normal compiles use. */
37
- export const committedAdapterLocks: Record<AdapterFamily, AdapterLock> = {
38
- nitro: parseAdapterLock('nitro', nitroLockJson),
39
- turbo: parseAdapterLock('turbo', turboLockJson),
40
- }
41
32
 
42
33
  export interface AdapterArchive {
43
34
  manifest: AdapterManifest
@@ -4,11 +4,8 @@ import os from 'node:os'
4
4
  import path from 'node:path'
5
5
  import { installedNativeLibraries } from './installed-native-libraries'
6
6
  import { readIosAppTarget } from './native-app-identity-project'
7
- import {
8
- committedAdapterLocks,
9
- resolveAdapterArchive,
10
- type AdapterArchive,
11
- } from './nitro-adapter'
7
+ import { combineNativeStaticLibraries } from './native-static-libraries'
8
+ import { resolveAdapterArchive, type AdapterArchive } from './nitro-adapter'
12
9
  import {
13
10
  collectNitroSources,
14
11
  NITRO_VIEWS_TARGET,
@@ -34,13 +31,13 @@ import {
34
31
  prepareXcodeSwiftPackages,
35
32
  } from './swift-host'
36
33
  import { applyInstalledSwiftTargets } from './swift-installed-targets'
34
+ import { swiftNativePin } from './swift-native-pin'
37
35
  import {
38
36
  manifestCalls,
39
37
  swiftManifestCxxLanguageStandard,
40
38
  swiftManifestTargets,
41
39
  swiftManifestSettings,
42
40
  clangSettingEntries,
43
- swiftNativeSupportFiles,
44
41
  } from './swift-package'
45
42
  import { projectSourceKey } from './swift-source-file'
46
43
  import { appPodfileLock, collectSwiftSourcePods } from './swift-source-pods'
@@ -373,6 +370,22 @@ export async function compileNitroModule(
373
370
  },
374
371
  async (root) => {
375
372
  const snapshot = await installedWorkspaceInput(root, 'main.swift')
373
+ // react's registration and turbomodule implementations belong to its
374
+ // runtime, while this executable owns the selected Nitro providers.
375
+ const swiftFiles = Object.keys(snapshot.input.files).filter((file) =>
376
+ file.endsWith('.swift'),
377
+ )
378
+ const mixedTargets = new Set([
379
+ ...collection.targets.map(({ name }) => name),
380
+ ...swiftManifestTargets(snapshot.input.files['Package.swift']!)
381
+ .filter((target) =>
382
+ swiftFiles.some((file) => file.startsWith(`${target.path}/`)),
383
+ )
384
+ .map(({ name }) => name),
385
+ ])
386
+ snapshot.input.nativeTargets = snapshot.input.nativeTargets?.filter(({ name }) =>
387
+ mixedTargets.has(name),
388
+ )
376
389
  Object.assign(
377
390
  collection.aliases,
378
391
  applyInstalledSwiftTargets(
@@ -416,17 +429,18 @@ export async function compileNitroModule(
416
429
  throw new Error(
417
430
  `Nitro compilation needs the app's Xcode project to declare an iOS deployment target: ${options.projectRoot}`,
418
431
  )
432
+ const adapter = await resolveAdapterArchive(
433
+ 'nitro',
434
+ {
435
+ nitroModules: collection.nitro.root,
436
+ reactNative: collection.reactNative.root,
437
+ },
438
+ options.moduleRoot,
439
+ swiftNativePin().adapters.nitro,
440
+ )
419
441
  const input = collectNitroCompileInput(
420
442
  collection,
421
- await resolveAdapterArchive(
422
- 'nitro',
423
- {
424
- nitroModules: collection.nitro.root,
425
- reactNative: collection.reactNative.root,
426
- },
427
- options.moduleRoot,
428
- committedAdapterLocks.nitro,
429
- ),
443
+ adapter,
430
444
  dependencies,
431
445
  iosDeploymentTarget,
432
446
  options.configuration,
@@ -452,6 +466,20 @@ export async function compileNitroModule(
452
466
  // the same module directory, so processes compiling the module share one
453
467
  // warm build root without overwriting each other's staged sources.
454
468
  const packagePath = path.join(os.tmpdir(), 'peach-nitro-swift', key, `p${process.pid}`)
469
+ const sharedLibrary = [...nativeLibraries.values()].find(
470
+ (pod) => pod.sharedLibrary,
471
+ )?.sharedLibrary
472
+ if (sharedLibrary) {
473
+ fs.mkdirSync(packagePath, { recursive: true })
474
+ const core = path.join(packagePath, 'adapter.a')
475
+ fs.writeFileSync(core, Buffer.from(adapter.base64, 'base64'))
476
+ input.libraries ??= {}
477
+ input.libraries.NitroCore = fs
478
+ .readFileSync(
479
+ combineNativeStaticLibraries([core, sharedLibrary], options.moduleRoot),
480
+ )
481
+ .toString('base64')
482
+ }
455
483
  syncSwiftTree(
456
484
  packagePath,
457
485
  new Map(
@@ -467,7 +495,8 @@ export async function compileNitroModule(
467
495
  project.lazyDistribution = input.lazyDistribution
468
496
  project.nativeTargets = input.nativeTargets
469
497
  project.headerAliases = input.headerAliases
470
- project.nativeFiles = swiftNativeSupportFiles(input.files, collection.targets)
498
+ // retain the workspace's explicit membership through the package snapshot.
499
+ project.nativeFiles = input.files
471
500
  project.resourceBundles = input.resourceBundles
472
501
  project.bundleFiles = input.resources
473
502
  ? {