peachsim 0.1.1692 → 0.1.1700

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 (245) hide show
  1. package/cli/bridge-flow-runner.ts +61 -39
  2. package/cli/commands/agent-wrapper.ts +21 -10
  3. package/cli/commands/control.ts +27 -7
  4. package/cli/commands/coverage.ts +1 -1
  5. package/cli/commands/detect.ts +17 -4
  6. package/cli/commands/maestro-compare.ts +25 -99
  7. package/cli/help-core.ts +3 -4
  8. package/cli/maestro-compare.ts +172 -4
  9. package/cli/outbound-endpoints.ts +2 -10
  10. package/detox/index.ts +15 -0
  11. package/detox/launch-permissions.ts +169 -0
  12. package/dist-lib/agent-daemon-client.cjs +2 -2
  13. package/dist-lib/agent-events.cjs +2 -2
  14. package/dist-lib/attached-projects.cjs +2 -2
  15. package/dist-lib/auth/shared-session.cjs +2 -2
  16. package/dist-lib/backend-origin.cjs +2 -2
  17. package/dist-lib/beta.cjs +2 -2
  18. package/dist-lib/beta.mjs +1 -1
  19. package/dist-lib/bridge-constants.cjs +2 -2
  20. package/dist-lib/bridge-contract-input.cjs +2 -2
  21. package/dist-lib/bridge-contract-input.mjs +1 -1
  22. package/dist-lib/bridge-contract.cjs +2 -2
  23. package/dist-lib/bridge-contract.mjs +1 -1
  24. package/dist-lib/bundle-channel.cjs +18273 -15925
  25. package/dist-lib/capture-contract.cjs +2 -2
  26. package/dist-lib/capture-contract.mjs +1 -1
  27. package/dist-lib/cloud-contract.cjs +2 -2
  28. package/dist-lib/cloud-contract.mjs +1 -1
  29. package/dist-lib/cloud-test-args.cjs +2 -2
  30. package/dist-lib/cloud-test-args.mjs +1 -1
  31. package/dist-lib/cloud.cjs +2 -2
  32. package/dist-lib/cloud.mjs +1 -1
  33. package/dist-lib/config.cjs +2 -2
  34. package/dist-lib/config.mjs +1 -1
  35. package/dist-lib/detox/index.cjs +104 -3
  36. package/dist-lib/dev-bundle-resolution.cjs +208 -44
  37. package/dist-lib/expo-swift-bundle.cjs +2349 -1778
  38. package/dist-lib/expo-swift-metadata.cjs +2 -2
  39. package/dist-lib/expo-swift-metadata.mjs +1 -1
  40. package/dist-lib/home-paths.cjs +2 -2
  41. package/dist-lib/host/bridge-host.cjs +7885 -3334
  42. package/dist-lib/host/fetch-proxy-handler.cjs +331 -39
  43. package/dist-lib/host/fetch-proxy-overrides.cjs +2 -2
  44. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  45. package/dist-lib/host/replacement-module-handler.cjs +2 -2
  46. package/dist-lib/host/websocket-proxy.cjs +2 -2
  47. package/dist-lib/index.cjs +297 -77
  48. package/dist-lib/jump-to-source-babel.cjs +2 -2
  49. package/dist-lib/jump-to-source-native.cjs +2 -2
  50. package/dist-lib/kotlin-host.cjs +2 -2
  51. package/dist-lib/menu.cjs +2 -2
  52. package/dist-lib/menu.mjs +1 -1
  53. package/dist-lib/metro-fingerprint-registry.cjs +2 -2
  54. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  55. package/dist-lib/metro-production-bundle.cjs +2 -2
  56. package/dist-lib/metro-production-bundle.mjs +1 -1
  57. package/dist-lib/metro.cjs +294 -74
  58. package/dist-lib/native-app-identity-project.cjs +48 -37
  59. package/dist-lib/native-app-identity-project.mjs +47 -36
  60. package/dist-lib/native-app-identity.cjs +2 -2
  61. package/dist-lib/native-app-identity.mjs +1 -1
  62. package/dist-lib/native-firebase-metadata.cjs +2 -2
  63. package/dist-lib/native-firebase-metadata.mjs +1 -1
  64. package/dist-lib/plist.cjs +2 -2
  65. package/dist-lib/plist.mjs +1 -1
  66. package/dist-lib/profiles.cjs +2 -2
  67. package/dist-lib/public-brand.cjs +2 -2
  68. package/dist-lib/public-origins-lib-esm.json +24 -23
  69. package/dist-lib/public-origins-lib.json +199 -79
  70. package/dist-lib/react-native-host-modules.cjs +2 -2
  71. package/dist-lib/react-native-host-modules.mjs +1 -1
  72. package/dist-lib/reap-browser.cjs +2 -2
  73. package/dist-lib/scripts/dev-server-scanner.cjs +206 -31
  74. package/dist-lib/sdk.cjs +2 -2
  75. package/dist-lib/sdk.mjs +1 -1
  76. package/dist-lib/skills.cjs +19600 -15992
  77. package/dist-lib/swift-compile.cjs +640 -402
  78. package/dist-lib/swift-compile.mjs +595 -357
  79. package/dist-lib/swift-package.cjs +24 -20
  80. package/dist-lib/swift-package.mjs +23 -19
  81. package/dist-lib/swift-submit.cjs +2 -2
  82. package/dist-lib/swift-submit.mjs +1 -1
  83. package/dist-lib/swift-toolchain.cjs +31 -4
  84. package/dist-lib/swift.cjs +2 -2
  85. package/dist-lib/vite-swift.cjs +1559 -1208
  86. package/dist-lib/vite.cjs +251 -42
  87. package/dist-lib/worklet-executable.cjs +2 -2
  88. package/dist-lib/worklet-executable.mjs +1 -1
  89. package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +1 -1
  90. package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -0
  91. package/dist-types/packages/peach-engine/src/engine/scroll-pan-contacts.d.ts +3 -1
  92. package/dist-types/packages/peach-engine/src/engine/scroll.d.ts +7 -0
  93. package/dist-types/packages/peach-engine/src/engine/types.d.ts +2 -1
  94. package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +2 -2
  95. package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +3 -0
  96. package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +1 -0
  97. package/dist-types/packages/peach-engine/src/render-worker/scroll-mirror.d.ts +17 -0
  98. package/dist-types/packages/peach-engine/src/render-worker/worker-input-runtime.d.ts +2 -1
  99. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +3 -0
  100. package/dist-types/packages/peach-globals/src/cameraBridgeContract.d.ts +1 -0
  101. package/dist-types/packages/peach-globals/src/replayBridgeContract.d.ts +1 -0
  102. package/dist-types/packages/peach-globals/src/shellHostBridgeContract.d.ts +3 -0
  103. package/dist-types/packages/peach-kit/src/materials/types.d.ts +1 -0
  104. package/package.json +1 -1
  105. package/runtime-companion.json +1 -1
  106. package/scripts/dev-server-scanner.ts +4 -0
  107. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Alpha.h +2282 -0
  108. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/BasicImageTypes.h +55 -0
  109. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Conversion.h +10551 -6
  110. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Convolution.h +4236 -3
  111. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Geometry.h +827 -8
  112. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Histogram.h +1369 -0
  113. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Morphology.h +1243 -0
  114. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Transform.h +1747 -0
  115. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage.h +291 -2
  116. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_CVUtilities.h +1283 -0
  117. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Types.h +811 -91
  118. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Utilities.h +1342 -25
  119. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns.h +2738 -0
  120. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_constants.h +1685 -0
  121. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_graph.h +913 -0
  122. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_structures.h +1917 -0
  123. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/LinearAlgebra.h +23 -0
  124. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/arithmetic.h +209 -0
  125. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/base.h +104 -0
  126. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/linear_systems.h +77 -0
  127. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/matrix.h +554 -0
  128. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/norms.h +58 -0
  129. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/object.h +186 -0
  130. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/splat.h +86 -0
  131. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/vector.h +364 -0
  132. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Integration.h +195 -0
  133. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Quadrature.h +44 -0
  134. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/BLAS.h +2330 -0
  135. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/Types.h +123 -0
  136. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Solve.h +8339 -0
  137. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementation.h +520 -0
  138. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementationTyped.h +1893 -0
  139. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Sparse.h +10 -0
  140. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/blas_new.h +1098 -0
  141. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas.h +859 -0
  142. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas_new.h +1134 -0
  143. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/clapack.h +10555 -0
  144. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/fortran_blas.h +695 -0
  145. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack.h +38526 -0
  146. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_types.h +60 -0
  147. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_version.h +20 -0
  148. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/thread_api.h +50 -0
  149. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBasicOps.h +1218 -0
  150. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBigNum.h +1458 -0
  151. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP.h +10377 -0
  152. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP_translate.h +167 -0
  153. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vForce.h +1243 -0
  154. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLib.h +114 -0
  155. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLibTypes.h +146 -0
  156. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vectorOps.h +1106 -0
  157. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vfp.h +294 -0
  158. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h +25 -1
  159. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFArray.h +673 -0
  160. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFAvailability.h +232 -0
  161. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h +827 -0
  162. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCalendar.h +121 -0
  163. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCharacterSet.h +387 -0
  164. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFData.h +79 -0
  165. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDate.h +122 -0
  166. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDictionary.h +674 -0
  167. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFError.h +182 -0
  168. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFLocale.h +213 -0
  169. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNotificationCenter.h +82 -0
  170. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNumber.h +129 -0
  171. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFSet.h +491 -0
  172. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h +883 -2
  173. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFTimeZone.h +98 -0
  174. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +11 -229
  175. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +2 -6
  176. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +2 -1
  177. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.h +1 -0
  178. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecBase.h +906 -3
  179. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecCertificate.h +613 -0
  180. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecItem.h +1284 -29
  181. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecPolicy.h +441 -0
  182. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecTrust.h +845 -0
  183. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/Security.h +4 -0
  184. package/sdk/ios/usr/include/AvailabilityMacros.h +3985 -0
  185. package/sdk/ios/usr/include/copyfile.h +143 -0
  186. package/sdk/ios/usr/include/malloc/_malloc.h +143 -0
  187. package/sdk/ios/usr/include/malloc/_malloc_type.h +153 -0
  188. package/sdk/ios/usr/include/malloc/_platform.h +80 -0
  189. package/sdk/ios/usr/include/malloc/_ptrcheck.h +43 -0
  190. package/sdk/ios/usr/include/malloc/malloc.h +768 -0
  191. package/sdk/ios/usr/include/os/availability.h +168 -6
  192. package/sdk/ios/usr/include/os/base.h +351 -0
  193. package/sdk/ios/usr/include/os/clock.h +18 -0
  194. package/sdk/ios/usr/include/os/lock.h +232 -10
  195. package/sdk/ios/usr/include/os/log.h +521 -38
  196. package/sdk/ios/usr/include/os/object.h +320 -3
  197. package/sdk/ios/usr/include/os/trace.h +492 -0
  198. package/sdk/ios/usr/include/os/trace_base.h +167 -0
  199. package/sdk/ios/usr/include/os/workgroup.h +37 -0
  200. package/sdk/ios/usr/include/os/workgroup_base.h +91 -0
  201. package/sdk/ios/usr/include/os/workgroup_interval.h +156 -0
  202. package/sdk/ios/usr/include/os/workgroup_object.h +359 -0
  203. package/sdk/ios/usr/include/os/workgroup_parallel.h +76 -0
  204. package/sdk/ios/usr/include/sys/cdefs.h +38 -0
  205. package/sdk/ios/wasm/include/unistd.h +3 -0
  206. package/skills/contrast/SKILL.md +3 -0
  207. package/src/codex-client.ts +11 -6
  208. package/src/dev-bundle-resolution.ts +124 -48
  209. package/src/expo-native-workspace.ts +176 -0
  210. package/src/expo-swift-host.ts +161 -26
  211. package/src/expo-swift-ready.ts +14 -28
  212. package/src/expoSwiftContract.ts +4 -1
  213. package/src/generated/swift-c-predefines.json +68 -12
  214. package/src/host/bridge-host.ts +5 -0
  215. package/src/installed-package-versions.ts +14 -1
  216. package/src/metro-project-root.ts +44 -33
  217. package/src/native-app-identity-project.ts +1 -0
  218. package/src/nitro-adapter.lock.json +916 -10
  219. package/src/nitro-adapter.ts +33 -24
  220. package/src/nitro-bundle.ts +108 -22
  221. package/src/nitro-compile.ts +32 -5
  222. package/src/nitro-source.ts +13 -3
  223. package/src/nitroAdapterContract.ts +100 -20
  224. package/src/node-http-fetch.ts +116 -0
  225. package/src/packageVersionsContract.ts +46 -0
  226. package/src/serverDiscoveryContract.ts +1 -0
  227. package/src/settingsContract.ts +0 -30
  228. package/src/swift-binary-modules.ts +20 -5
  229. package/src/swift-compile.ts +168 -48
  230. package/src/swift-coverage/xcode-assets.ts +4 -3
  231. package/src/swift-host.ts +14 -3
  232. package/src/swift-objc-compile.ts +32 -5
  233. package/src/swift-objc-metadata.ts +2 -2
  234. package/src/swift-objc-platform.ts +2 -2
  235. package/src/swift-objc-standin.ts +43 -13
  236. package/src/swift-package.ts +33 -26
  237. package/src/swift-source-pods.ts +126 -41
  238. package/src/swift-standin-digest.ts +77 -0
  239. package/src/swift-standin-emit.ts +40 -4
  240. package/src/swift-standins.ts +68 -19
  241. package/src/swift-toolchain.ts +38 -0
  242. package/src/swiftContract.ts +8 -0
  243. package/src/vite-plugin.ts +0 -10
  244. package/src/xcode-project.ts +62 -42
  245. package/src/settings-flags.ts +0 -107
@@ -1,8 +1,9 @@
1
1
  // the private Nitro adapter archive an installed peach links into every Nitro
2
- // compile: downloaded from PEACH_SWIFT_ENDPOINT, verified against the lock this
3
- // build carries, then checked against the app's own original headers and the
4
- // compiler, SDK and framework the module root compiles with
5
- // (docs/swift-distribution.md). the adapter source never reaches this machine.
2
+ // compile: the one built against the app's own original React Native JSI and
3
+ // Nitro headers, downloaded from PEACH_SWIFT_ENDPOINT, verified against the lock
4
+ // this build carries, then checked against the compiler, SDK and framework the
5
+ // module root compiles with (docs/swift-distribution.md). the adapter source
6
+ // never reaches this machine.
6
7
  import fs from 'node:fs'
7
8
  import path from 'node:path'
8
9
  import { installVerifiedTarball } from '@contrast/runtime-delivery'
@@ -12,17 +13,19 @@ import {
12
13
  headerDigests,
13
14
  NITRO_ADAPTER_MANIFEST,
14
15
  nitroAdapterArchiveKey,
16
+ nitroAdapterPin,
15
17
  parseNitroAdapterLock,
16
18
  verifyInstalledNitroAdapter,
17
19
  type NitroAdapterLock,
18
20
  type NitroAdapterManifest,
21
+ type NitroAdapterPin,
19
22
  } from './nitroAdapterContract'
20
23
  import { NITRO_GUEST_PLATFORM } from './nitroContract'
21
24
  import { swiftDistributionAt, swiftModuleSdk, WASM_TRIPLE } from './swift-compile'
22
25
  import { SWIFT_ENDPOINT_ENV } from './swift-distribution'
23
26
  import type { NitroSourceCollection } from './nitro-source'
24
27
 
25
- /** the verified adapter this build ships, the only lock normal compiles use. */
28
+ /** the verified adapters this build ships, the only lock normal compiles use. */
26
29
  export const committedNitroAdapterLock = parseNitroAdapterLock(lockJson)
27
30
 
28
31
  export interface NitroAdapterArchive {
@@ -31,30 +34,27 @@ export interface NitroAdapterArchive {
31
34
  base64: string
32
35
  }
33
36
 
34
- /** rejects a lock built for other guest platform, target, headers, compiler,
35
- * SDK or framework than this app's original headers and the module root
36
- * compiling it. the committed lock is the trust root and pins the whole
37
+ const installedVersion = (root: string) =>
38
+ String(JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8')).version)
39
+
40
+ /** the archive for this app's original headers, after rejecting a lock built for
41
+ * another guest platform, target, compiler, SDK or framework than the module
42
+ * root compiling it. the committed lock is the trust root and pins each whole
37
43
  * manifest. its wire ABI digest is producer provenance the reviewed lock
38
44
  * fixes; the consumer cannot recompute it and the framework distribution id
39
45
  * does not independently bind it. */
40
- function verifyIdentity(
46
+ function selectPin(
41
47
  lock: NitroAdapterLock,
42
48
  collection: NitroSourceCollection,
43
49
  moduleRoot: string,
44
- ) {
50
+ ): NitroAdapterPin {
45
51
  const { nitro, reactNative } = collection
46
52
  const distribution = swiftDistributionAt(moduleRoot)
47
53
  if (!distribution) throw new Error(`${moduleRoot} holds no Swift distribution`)
48
54
  const sdk = swiftModuleSdk(moduleRoot)
49
- const headers = headerDigests({
50
- nitroModules: nitro.root,
51
- reactNative: reactNative.root,
52
- })
53
55
  const mismatched = [
54
56
  lock.platform !== NITRO_GUEST_PLATFORM && 'guest platform',
55
57
  lock.target !== WASM_TRIPLE && 'target',
56
- lock.headers.reactNativeJsi !== headers.reactNativeJsi && 'React Native JSI headers',
57
- lock.headers.nitroModules !== headers.nitroModules && 'Nitro Modules headers',
58
58
  lock.compiler !== distribution.release && 'compiler',
59
59
  (lock.sdk.id !== sdk.wasmSdkId || lock.sdk.checksum !== sdk.wasmSdkChecksum) &&
60
60
  'Swift SDK',
@@ -62,8 +62,17 @@ function verifyIdentity(
62
62
  ].filter((name) => name !== false)
63
63
  if (mismatched.length > 0)
64
64
  throw new Error(
65
- `Nitro adapter archive does not match this app and toolchain: ${mismatched.join(', ')}`,
65
+ `Nitro adapter archives do not match this toolchain: ${mismatched.join(', ')}`,
66
+ )
67
+ const pin = nitroAdapterPin(
68
+ lock,
69
+ headerDigests({ nitroModules: nitro.root, reactNative: reactNative.root }),
70
+ )
71
+ if (!pin)
72
+ throw new Error(
73
+ `this peach has no Nitro adapter for react-native ${installedVersion(reactNative.root)} with react-native-nitro-modules ${installedVersion(nitro.root)}`,
66
74
  )
75
+ return pin
67
76
  }
68
77
 
69
78
  /** the verified adapter archive for a collection: identity first, then the
@@ -74,28 +83,28 @@ export async function resolveNitroAdapter(
74
83
  lock: NitroAdapterLock,
75
84
  signal?: AbortSignal,
76
85
  ): Promise<NitroAdapterArchive> {
77
- verifyIdentity(lock, collection, moduleRoot)
86
+ const pin = selectPin(lock, collection, moduleRoot)
78
87
  const endpoint = process.env[SWIFT_ENDPOINT_ENV]?.trim().replace(/\/+$/, '')
79
88
  if (!endpoint)
80
89
  throw new Error(
81
90
  `Nitro compilation needs ${SWIFT_ENDPOINT_ENV} for its adapter archive`,
82
91
  )
83
- const dir = path.join(rnxHomeDir(), 'swift', `nitro-adapter-${lock.archive.sha256}`)
92
+ const dir = path.join(rnxHomeDir(), 'swift', `nitro-adapter-${pin.archive.sha256}`)
84
93
  if (!fs.existsSync(path.join(dir, NITRO_ADAPTER_MANIFEST))) {
85
- process.stderr.write(`peach: downloading Nitro adapter ${lock.archive.sha256}…\n`)
94
+ process.stderr.write(`peach: downloading Nitro adapter ${pin.archive.sha256}…\n`)
86
95
  await installVerifiedTarball({
87
96
  signal,
88
- url: `${endpoint}/${nitroAdapterArchiveKey(lock)}`,
89
- digest: { algorithm: 'sha256', encoding: 'hex', value: lock.archive.sha256 },
97
+ url: `${endpoint}/${nitroAdapterArchiveKey(pin)}`,
98
+ digest: { algorithm: 'sha256', encoding: 'hex', value: pin.archive.sha256 },
90
99
  destDir: dir,
91
100
  installedMarker: NITRO_ADAPTER_MANIFEST,
92
101
  label: 'Nitro adapter archive',
93
102
  verify: (installed) => {
94
- verifyInstalledNitroAdapter(installed, lock)
103
+ verifyInstalledNitroAdapter(installed, pin)
95
104
  },
96
105
  })
97
106
  }
98
- const manifest = verifyInstalledNitroAdapter(dir, lock)
107
+ const manifest = verifyInstalledNitroAdapter(dir, pin)
99
108
  return {
100
109
  manifest,
101
110
  base64: fs.readFileSync(path.join(dir, manifest.archive.path)).toString('base64'),
@@ -1,31 +1,53 @@
1
+ import fs from 'node:fs'
2
+ import path from 'node:path'
3
+ import { PEACH_ANSWERED_NATIVE_PACKAGE_NAMES } from '../../peach-compat/src/generated/supported-native-packages'
1
4
  import { loadRNXAppConfig } from '../cli/app-config'
2
5
  import { resolveAppProject } from '../cli/app-project'
6
+ import { isLoopbackHost } from './backend-origin'
3
7
  import { compileNitroModule } from './nitro-compile'
4
8
  import { discoverNitroProviders, selectNitroProviders } from './nitro-source'
5
9
  import { SWIFT_ENDPOINT_ENV, swiftDistributionRoot } from './swift-distribution'
6
- import { icuUrl } from './swift-host'
10
+ import { icuUrl, type SwiftArtifact } from './swift-host'
7
11
  import type { NitroCompiledModule } from './nitroContract'
12
+ import type { IncomingMessage, ServerResponse } from 'node:http'
13
+
14
+ export const NITRO_ROUTE = '/__peach/nitro'
8
15
 
9
16
  export interface NitroBundle {
10
17
  metadata: NitroCompiledModule
11
18
  assets: { path: string; bytes: Buffer; contentType: string }[]
12
19
  }
13
20
 
21
+ const answeredPackages: ReadonlySet<string> = new Set(PEACH_ANSWERED_NATIVE_PACKAGE_NAMES)
22
+
14
23
  // every installed iOS Nitro provider the app declares compiles into one
15
24
  // executable with the same compiler and asset addresses as local native loads.
16
- // package javascript is carried verbatim by its bundler. a HybridObject the
17
- // app's config answers, a view or an unsupported or file-answered name, registers no
18
- // original constructor; a provider left with none is not compiled.
19
- export async function buildNitroBundle(
25
+ // package javascript is carried verbatim by its bundler. a provider Peach
26
+ // answers itself (a seam resolves before the original registration) is not
27
+ // compiled. a HybridObject the app's config answers, a view or an unsupported
28
+ // or file-answered name, registers no original constructor; a provider left
29
+ // with none is not compiled. asset urls are relative to `origin`.
30
+ export async function compileNitroApp(
20
31
  appRoot: string,
32
+ origin: string,
21
33
  moduleRoot?: string,
22
- ): Promise<NitroBundle | null> {
34
+ ): Promise<{ metadata: NitroCompiledModule; artifact: SwiftArtifact } | null> {
23
35
  const config = await loadRNXAppConfig(resolveAppProject(appRoot))
36
+ const providers = selectNitroProviders(discoverNitroProviders(appRoot)).filter(
37
+ ({ provider }) => !answeredPackages.has(provider.name),
38
+ )
39
+ const registered = new Set(
40
+ providers.flatMap(({ config }) => config.classes.map(({ name }) => name)),
41
+ )
24
42
  const answers = {
25
- hybridObjects: new Set(Object.keys(config?.nativeHybridObjects ?? {})),
43
+ hybridObjects: new Set(
44
+ Object.keys(config?.nativeHybridObjects ?? {}).filter((name) =>
45
+ registered.has(name),
46
+ ),
47
+ ),
26
48
  views: new Set(Object.keys(config?.nativeViews ?? {})),
27
49
  }
28
- const packageRoots = discoverNitroProviders(appRoot)
50
+ const packageRoots = providers.map(({ provider }) => provider.root)
29
51
  if (selectNitroProviders(packageRoots, answers).length === 0) return null
30
52
  // the adapter archive is built against the published distribution, so Nitro
31
53
  // compiles against it even in a source checkout; the checkout framework has
@@ -41,6 +63,30 @@ export async function buildNitroBundle(
41
63
  answers,
42
64
  moduleRoot: module,
43
65
  })
66
+ return {
67
+ artifact,
68
+ metadata: {
69
+ platform: 'ios',
70
+ packages: collection.providers.map(({ name, version, hybridObjects }) => ({
71
+ name,
72
+ version,
73
+ hybridObjects,
74
+ })),
75
+ url: `${origin}/__peach/swift/${artifact.hash}.wasm`,
76
+ hash: artifact.hash,
77
+ icuUrl: icuUrl(origin, artifact),
78
+ bundleFiles: artifact.package.bundleFiles.files,
79
+ },
80
+ }
81
+ }
82
+
83
+ export async function buildNitroBundle(
84
+ appRoot: string,
85
+ moduleRoot?: string,
86
+ ): Promise<NitroBundle | null> {
87
+ const compiled = await compileNitroApp(appRoot, '', moduleRoot)
88
+ if (!compiled) return null
89
+ const { artifact, metadata } = compiled
44
90
  const assets: NitroBundle['assets'] = [
45
91
  {
46
92
  path: `__peach/swift/${artifact.hash}.wasm`,
@@ -54,19 +100,59 @@ export async function buildNitroBundle(
54
100
  bytes: artifact.icu.gzip,
55
101
  contentType: 'application/gzip',
56
102
  })
57
- return {
58
- metadata: {
59
- platform: 'ios',
60
- packages: collection.providers.map(({ name, version, hybridObjects }) => ({
61
- name,
62
- version,
63
- hybridObjects,
64
- })),
65
- url: `/__peach/swift/${artifact.hash}.wasm`,
66
- hash: artifact.hash,
67
- icuUrl: icuUrl('', artifact),
68
- bundleFiles: artifact.package.bundleFiles.files,
69
- },
70
- assets,
103
+ return { metadata, assets }
104
+ }
105
+
106
+ // one build per app root and dev server; concurrent boots share it. the
107
+ // compiler reuses an unchanged artifact, so a reload pays only the source check.
108
+ const compiling = new Map<string, Promise<NitroCompiledModule | null>>()
109
+
110
+ // the dev server's build of an app's installed Nitro providers. its wasm and
111
+ // ICU are served from the same host by the Swift artifact route.
112
+ export async function handleNitroRequest(
113
+ req: IncomingMessage,
114
+ res: ServerResponse,
115
+ ): Promise<void> {
116
+ const url = new URL(req.url ?? '/', 'http://localhost')
117
+ const remote = req.socket.remoteAddress?.replace(/^::ffff:/, '')
118
+ const origin = req.headers.origin
119
+ if (
120
+ !remote ||
121
+ !isLoopbackHost(remote) ||
122
+ (origin && !isLoopbackHost(new URL(origin).hostname))
123
+ ) {
124
+ res.writeHead(403)
125
+ res.end('Nitro compilation requires a loopback client')
126
+ return
127
+ }
128
+ res.setHeader('Access-Control-Allow-Origin', origin ?? '*')
129
+ res.setHeader('Vary', 'Origin')
130
+ res.setHeader('Cross-Origin-Resource-Policy', 'cross-origin')
131
+ const root = url.searchParams.get('root')
132
+ const host = req.headers.host
133
+ if (req.method !== 'GET' || !root || !path.isAbsolute(root) || !host) {
134
+ res.writeHead(400)
135
+ res.end('Nitro compilation needs GET with an absolute app root')
136
+ return
137
+ }
138
+ try {
139
+ const key = `${host}\0${fs.realpathSync(root)}`
140
+ let pending = compiling.get(key)
141
+ if (!pending) {
142
+ pending = compileNitroApp(fs.realpathSync(root), `http://${host}`)
143
+ .then((compiled) => compiled?.metadata ?? null)
144
+ .finally(() => compiling.delete(key))
145
+ compiling.set(key, pending)
146
+ }
147
+ const metadata = await pending
148
+ res.writeHead(200, {
149
+ 'Content-Type': 'application/json',
150
+ 'Cache-Control': 'no-store',
151
+ })
152
+ res.end(JSON.stringify(metadata))
153
+ } catch (error) {
154
+ if (res.destroyed) return
155
+ res.writeHead(500, { 'Content-Type': 'text/plain' })
156
+ res.end(error instanceof Error ? error.message : String(error))
71
157
  }
72
158
  }
@@ -24,7 +24,7 @@ import {
24
24
  swiftManifestCxxLanguageStandard,
25
25
  swiftManifestTargets,
26
26
  } from './swift-package'
27
- import { collectSwiftSourcePods } from './swift-source-pods'
27
+ import { appPodfileLock, collectSwiftSourcePods } from './swift-source-pods'
28
28
  import type { SwiftCompileInput } from './swift-compile'
29
29
 
30
30
  // every selected installed implementation, its generated registration and the
@@ -69,9 +69,11 @@ export function collectNitroCompileInput(
69
69
 
70
70
  const entry = 'Sources/PeachNitroApp/main.swift'
71
71
  // every provider registers before the one runtime serves guest evaluation.
72
+ // the entry has no app to install the reactor's inline executor, so it does
73
+ // that first: a Task a HybridObject launches (Promise.async) runs on it.
72
74
  files[entry] =
73
- `import NitroCore\n${collection.registrations.map(({ target }) => `import ${target}\n`).join('')}` +
74
- `peachNitroInitialize()\n${collection.registrations.map(({ symbol }) => `${symbol}()\n`).join('')}`
75
+ `@_spi(Peach) import PeachFoundation\nimport NitroCore\n${collection.registrations.map(({ target }) => `import ${target}\n`).join('')}` +
76
+ `PeachHostDriver.installExecutor()\npeachNitroInitialize()\n${collection.registrations.map(({ symbol }) => `${symbol}()\n`).join('')}`
75
77
  files['Package.swift'] = [
76
78
  '// swift-tools-version: 6.2',
77
79
  'import PackageDescription',
@@ -97,12 +99,36 @@ export function collectNitroCompileInput(
97
99
  }
98
100
  }
99
101
 
102
+ // framework names C-family sources include as `<Name/Header.h>` or
103
+ // `"Name/Header.h"` that no collected file provides: a pod the provider's
104
+ // podspec depends on, which CocoaPods would put on the header search path.
105
+ function unresolvedFrameworkIncludes(files: Record<string, string>): string[] {
106
+ const paths = Object.keys(files)
107
+ const names = new Set<string>()
108
+ for (const [file, contents] of Object.entries(files)) {
109
+ if (!/\.(?:h|hh|hpp|hxx|c|cc|cpp|cxx|m|mm)$/.test(file)) continue
110
+ for (const match of contents.matchAll(
111
+ /^\s*#\s*(?:include|import)\s*[<"]([A-Za-z_]\w*)\/([^>"]+)[>"]/gm,
112
+ )) {
113
+ const header = `${match[1]}/${match[2]}`
114
+ if (
115
+ !paths.some(
116
+ (candidate) => candidate === header || candidate.endsWith(`/${header}`),
117
+ )
118
+ )
119
+ names.add(match[1]!)
120
+ }
121
+ }
122
+ return [...names].sort()
123
+ }
124
+
100
125
  export async function compileNitroModule(
101
126
  options: NitroSourceOptions & { moduleRoot: string },
102
127
  ): Promise<{ artifact: SwiftArtifact; collection: NitroSourceCollection }> {
103
128
  const collection = collectNitroSources(options)
104
129
  let dependencies: SwiftCompileInput | null = null
105
- if (options.appRoot && fs.existsSync(path.join(options.appRoot, 'Podfile.lock'))) {
130
+ const podfileLock = options.appRoot && appPodfileLock(options.appRoot)
131
+ if (podfileLock) {
106
132
  const available = new Set(
107
133
  swiftAvailableModules(
108
134
  options.moduleRoot,
@@ -112,9 +138,10 @@ export async function compileNitroModule(
112
138
  for (const target of collection.targets) available.add(target.name)
113
139
  const missing = [...missingSwiftModules(collection.files, available).keys()]
114
140
  dependencies = await collectSwiftSourcePods(
115
- options.appRoot,
141
+ podfileLock,
116
142
  missing,
117
143
  options.moduleRoot,
144
+ unresolvedFrameworkIncludes(collection.files),
118
145
  )
119
146
  }
120
147
  const input = collectNitroCompileInput(
@@ -379,7 +379,9 @@ export function collectNitroSources(options: NitroSourceOptions): NitroSourceCol
379
379
  const key = `${targetPath(name)}/upstream/${path.relative(root, source).split(path.sep).join('/')}`
380
380
  let original = originals.get(source)
381
381
  if (!original) {
382
- const bytes = readPackageFile(root, source, MAX_SWIFT_COMPILE_SOURCE_BYTES)
382
+ // Nitro compiles only on this machine, so the compile service's
383
+ // request limit does not bound one upstream file (simdutf.cpp).
384
+ const bytes = readPackageFile(root, source, Infinity)
383
385
  original = key
384
386
  const text = bytes.toString('utf8')
385
387
  if (!Buffer.from(text).equals(bytes))
@@ -445,7 +447,7 @@ export function collectNitroSources(options: NitroSourceOptions): NitroSourceCol
445
447
  directory,
446
448
  'NitroModules',
447
449
  null,
448
- new Set(['HybridView.swift']),
450
+ new Set(),
449
451
  () => true,
450
452
  /\.swift$/,
451
453
  )
@@ -461,7 +463,15 @@ export function collectNitroSources(options: NitroSourceOptions): NitroSourceCol
461
463
  const implementationHeaders = fs.existsSync(path.join(module.root, 'cpp'))
462
464
  ? collect(module.root, 'cpp', targetName, null)
463
465
  : new Map<string, string>()
464
- collect(module.root, 'nitrogen/generated/shared/c++', targetName, null)
466
+ // views/ holds nitrogen's Fabric component descriptor and props parser,
467
+ // which only React Native's Fabric renderer reads.
468
+ collect(
469
+ module.root,
470
+ 'nitrogen/generated/shared/c++',
471
+ targetName,
472
+ null,
473
+ new Set(['views']),
474
+ )
465
475
  for (const entry of config.classes)
466
476
  if (
467
477
  entry.language === 'c++' &&
@@ -50,9 +50,24 @@ export interface NitroAdapterManifest {
50
50
  archive: { path: string; size: number; sha256: string }
51
51
  }
52
52
 
53
- /** the published tarball one CLI build installs, committed beside swift-distribution.lock.json. */
54
- export interface NitroAdapterLock extends Omit<NitroAdapterManifest, 'archive'> {
55
- /** the downloaded .tar.gz, which installVerifiedTarball checks. */
53
+ /** every published tarball one CLI build installs, committed beside
54
+ * swift-distribution.lock.json: one build identity, and one archive per pair of
55
+ * original React Native JSI and Nitro headers it was compiled against. */
56
+ export interface NitroAdapterLock extends Omit<
57
+ NitroAdapterManifest,
58
+ 'schema' | 'archive' | 'headers'
59
+ > {
60
+ schema: 2
61
+ /** each downloaded .tar.gz, which installVerifiedTarball checks. */
62
+ archives: {
63
+ headers: NitroAdapterManifest['headers']
64
+ sha256: string
65
+ size: number
66
+ }[]
67
+ }
68
+
69
+ /** the one archive an app's headers select: its manifest identity and tarball. */
70
+ export interface NitroAdapterPin extends Omit<NitroAdapterManifest, 'archive'> {
56
71
  archive: { sha256: string; size: number }
57
72
  }
58
73
 
@@ -170,44 +185,109 @@ export function parseNitroAdapterManifest(value: unknown): NitroAdapterManifest
170
185
  }
171
186
  }
172
187
 
188
+ function headerPair(value: unknown): NitroAdapterManifest['headers'] {
189
+ if (!isRecord(value)) throw new Error('invalid Nitro adapter headers')
190
+ return {
191
+ reactNativeJsi: digestField(value.reactNativeJsi, 'JSI header digest'),
192
+ nitroModules: digestField(value.nitroModules, 'Nitro header digest'),
193
+ }
194
+ }
195
+
196
+ const sameHeaders = (
197
+ a: NitroAdapterManifest['headers'],
198
+ b: NitroAdapterManifest['headers'],
199
+ ) => a.reactNativeJsi === b.reactNativeJsi && a.nitroModules === b.nitroModules
200
+
173
201
  export function parseNitroAdapterLock(value: unknown): NitroAdapterLock {
174
- const archive = isRecord(value) ? value.archive : undefined
175
- if (!isRecord(archive) || typeof archive.size !== 'number')
176
- throw new Error('invalid Nitro adapter lock archive')
202
+ if (!isRecord(value) || value.schema !== 2 || !Array.isArray(value.archives))
203
+ throw new Error('invalid Nitro adapter lock')
204
+ const { headers: _headers, ...shared } = identity({
205
+ ...value,
206
+ schema: 1,
207
+ headers: { reactNativeJsi: '0'.repeat(64), nitroModules: '0'.repeat(64) },
208
+ })
209
+ const archives = value.archives.map((entry: unknown) => {
210
+ if (!isRecord(entry) || typeof entry.size !== 'number')
211
+ throw new Error('invalid Nitro adapter lock archive')
212
+ return {
213
+ headers: headerPair(entry.headers),
214
+ sha256: digestField(entry.sha256, 'lock archive digest'),
215
+ size: entry.size,
216
+ }
217
+ })
218
+ archives.forEach((entry, index) => {
219
+ if (
220
+ archives.findIndex((other) => sameHeaders(other.headers, entry.headers)) !== index
221
+ )
222
+ throw new Error('Nitro adapter lock repeats a header pair')
223
+ })
224
+ return { ...shared, schema: 2, archives }
225
+ }
226
+
227
+ /** the archive built against these original headers, or null when none was published. */
228
+ export function nitroAdapterPin(
229
+ lock: NitroAdapterLock,
230
+ headers: NitroAdapterManifest['headers'],
231
+ ): NitroAdapterPin | null {
232
+ const entry = lock.archives.find((archive) => sameHeaders(archive.headers, headers))
233
+ if (!entry) return null
234
+ // manifest field order: the installed manifest is compared as JSON
177
235
  return {
178
- ...identity(value),
179
- archive: {
180
- sha256: digestField(archive.sha256, 'lock archive digest'),
181
- size: archive.size,
182
- },
236
+ schema: 1,
237
+ platform: lock.platform,
238
+ target: lock.target,
239
+ recipe: lock.recipe,
240
+ adapter: lock.adapter,
241
+ headers: entry.headers,
242
+ compiler: lock.compiler,
243
+ sdk: lock.sdk,
244
+ framework: lock.framework,
245
+ archive: { sha256: entry.sha256, size: entry.size },
183
246
  }
184
247
  }
185
248
 
186
- /** the lock one published manifest and its tarball produce. */
187
- export function nitroAdapterLock(
249
+ /** the lock with one published manifest's tarball added, replacing the archive
250
+ * for the same headers. every archive in a lock shares one build identity. */
251
+ export function withNitroAdapterArchive(
252
+ lock: NitroAdapterLock | null,
188
253
  manifest: NitroAdapterManifest,
189
254
  tarball: { sha256: string; size: number },
190
255
  ): NitroAdapterLock {
191
- const { archive: _library, ...rest } = manifest
192
- return { ...rest, archive: tarball }
256
+ const { archive: _library, headers, schema: _schema, ...shared } = manifest
257
+ if (lock) {
258
+ const { archives: _archives, schema: _lockSchema, ...current } = lock
259
+ if (JSON.stringify(current) !== JSON.stringify(shared))
260
+ throw new Error(
261
+ 'the archive was built with another adapter, recipe, compiler, SDK or distribution than the lock; rebuild every archive',
262
+ )
263
+ }
264
+ const archives = [
265
+ ...(lock?.archives ?? []).filter((entry) => !sameHeaders(entry.headers, headers)),
266
+ { headers, ...tarball },
267
+ ].sort((a, b) =>
268
+ `${a.headers.reactNativeJsi}${a.headers.nitroModules}`.localeCompare(
269
+ `${b.headers.reactNativeJsi}${b.headers.nitroModules}`,
270
+ ),
271
+ )
272
+ return { schema: 2, ...shared, archives }
193
273
  }
194
274
 
195
275
  /** the tarball's path under PEACH_SWIFT_ENDPOINT: content addressed, so immutable. */
196
- export function nitroAdapterArchiveKey(lock: NitroAdapterLock): string {
197
- return `nitro-adapter/${lock.archive.sha256}.tar.gz`
276
+ export function nitroAdapterArchiveKey(pin: { archive: { sha256: string } }): string {
277
+ return `nitro-adapter/${pin.archive.sha256}.tar.gz`
198
278
  }
199
279
 
200
- /** throws unless an unpacked adapter is the one the lock pins and its library
280
+ /** throws unless an unpacked adapter is the one the pin names and its library
201
281
  * bytes are the ones its manifest records. needs no adapter source. */
202
282
  export function verifyInstalledNitroAdapter(
203
283
  directory: string,
204
- lock: NitroAdapterLock,
284
+ pin: NitroAdapterPin,
205
285
  ): NitroAdapterManifest {
206
286
  const manifest = parseNitroAdapterManifest(
207
287
  JSON.parse(readFileSync(path.join(directory, NITRO_ADAPTER_MANIFEST), 'utf8')),
208
288
  )
209
289
  const { archive, ...recorded } = manifest
210
- const { archive: _tarball, ...pinned } = lock
290
+ const { archive: _tarball, ...pinned } = pin
211
291
  if (JSON.stringify(recorded) !== JSON.stringify(pinned))
212
292
  throw new Error('Nitro adapter manifest does not match the lock this build carries')
213
293
  const bytes = readFileSync(path.join(directory, archive.path))