peachsim 0.1.2035 → 0.1.2037

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 (105) hide show
  1. package/cli/cloud-test-tunnel.ts +43 -6
  2. package/cli/commands/inspect/get-node.ts +1 -1
  3. package/cli/outbound-endpoints.ts +4 -0
  4. package/dist-lib/agent-daemon-client.cjs +1 -1
  5. package/dist-lib/agent-events.cjs +1 -1
  6. package/dist-lib/attached-projects.cjs +1 -1
  7. package/dist-lib/auth/shared-session.cjs +1 -1
  8. package/dist-lib/backend-origin.cjs +1 -1
  9. package/dist-lib/beta.cjs +1 -1
  10. package/dist-lib/beta.mjs +1 -1
  11. package/dist-lib/bridge-constants.cjs +1 -1
  12. package/dist-lib/bridge-contract-input.cjs +1 -1
  13. package/dist-lib/bridge-contract-input.mjs +1 -1
  14. package/dist-lib/bridge-contract.cjs +1 -1
  15. package/dist-lib/bridge-contract.mjs +1 -1
  16. package/dist-lib/bundle-channel.cjs +4626 -4189
  17. package/dist-lib/capture-contract.cjs +1 -1
  18. package/dist-lib/capture-contract.mjs +1 -1
  19. package/dist-lib/cloud-contract.cjs +1 -1
  20. package/dist-lib/cloud-contract.mjs +1 -1
  21. package/dist-lib/cloud-test-args.cjs +1 -1
  22. package/dist-lib/cloud-test-args.mjs +1 -1
  23. package/dist-lib/cloud.cjs +1 -1
  24. package/dist-lib/cloud.mjs +1 -1
  25. package/dist-lib/config.cjs +1 -1
  26. package/dist-lib/config.mjs +1 -1
  27. package/dist-lib/detox/index.cjs +15 -7
  28. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  29. package/dist-lib/expo-swift-bundle.cjs +8741 -4085
  30. package/dist-lib/expo-swift-metadata.cjs +2 -2
  31. package/dist-lib/expo-swift-metadata.mjs +2 -2
  32. package/dist-lib/home-paths.cjs +1 -1
  33. package/dist-lib/host/bridge-host.cjs +4639 -4468
  34. package/dist-lib/host/fetch-proxy-handler.cjs +5119 -274
  35. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  36. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  37. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  38. package/dist-lib/host/websocket-proxy.cjs +1 -1
  39. package/dist-lib/index.cjs +17104 -16999
  40. package/dist-lib/jump-to-source-babel.cjs +1 -1
  41. package/dist-lib/jump-to-source-native.cjs +1 -1
  42. package/dist-lib/kotlin-host.cjs +1 -1
  43. package/dist-lib/menu.cjs +1 -1
  44. package/dist-lib/menu.mjs +1 -1
  45. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  46. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  47. package/dist-lib/metro-production-bundle.cjs +1 -1
  48. package/dist-lib/metro-production-bundle.mjs +1 -1
  49. package/dist-lib/metro.cjs +12730 -12621
  50. package/dist-lib/native-app-identity-project.cjs +1 -1
  51. package/dist-lib/native-app-identity-project.mjs +1 -1
  52. package/dist-lib/native-app-identity.cjs +1 -1
  53. package/dist-lib/native-app-identity.mjs +1 -1
  54. package/dist-lib/native-firebase-metadata.cjs +1 -1
  55. package/dist-lib/native-firebase-metadata.mjs +1 -1
  56. package/dist-lib/pdfium-raster.cjs +1 -1
  57. package/dist-lib/pdfium-raster.mjs +1 -1
  58. package/dist-lib/plist.cjs +1 -1
  59. package/dist-lib/plist.mjs +1 -1
  60. package/dist-lib/profiles.cjs +1 -1
  61. package/dist-lib/public-brand.cjs +1 -1
  62. package/dist-lib/public-origins-lib-esm.json +24 -24
  63. package/dist-lib/public-origins-lib.json +615 -211
  64. package/dist-lib/react-native-host-modules.cjs +1 -1
  65. package/dist-lib/react-native-host-modules.mjs +1 -1
  66. package/dist-lib/reap-browser.cjs +1 -1
  67. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  68. package/dist-lib/sdk.cjs +1 -1
  69. package/dist-lib/sdk.mjs +1 -1
  70. package/dist-lib/skills.cjs +5291 -5096
  71. package/dist-lib/swift-compile.cjs +1 -1
  72. package/dist-lib/swift-compile.mjs +1 -1
  73. package/dist-lib/swift-package.cjs +1 -1
  74. package/dist-lib/swift-package.mjs +1 -1
  75. package/dist-lib/swift-submit.cjs +1 -1
  76. package/dist-lib/swift-submit.mjs +1 -1
  77. package/dist-lib/swift-toolchain.cjs +1 -1
  78. package/dist-lib/swift.cjs +1 -1
  79. package/dist-lib/vite-swift.cjs +2 -2
  80. package/dist-lib/vite.cjs +5159 -342
  81. package/dist-lib/worklet-executable.cjs +1 -1
  82. package/dist-lib/worklet-executable.mjs +1 -1
  83. package/dist-types/packages/peach-engine/src/engine/app-catalog-wire.d.ts +2 -0
  84. package/dist-types/packages/peach-engine/src/render-worker/metro-bundle-metadata.d.ts +2 -0
  85. package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +2 -0
  86. package/package.json +1 -1
  87. package/runtime-companion.json +1 -1
  88. package/src/bundle-channel.mjs +35 -1
  89. package/src/expo-autolinking.ts +36 -13
  90. package/src/expo-discovery-cache.ts +1 -0
  91. package/src/expo-native-workspace.ts +10 -9
  92. package/src/expo-pod-prebuilt.ts +122 -0
  93. package/src/expo-swift-host.ts +267 -121
  94. package/src/expo-swift-ready.ts +11 -5
  95. package/src/expoSwiftContract.ts +3 -1
  96. package/src/host/dev-server-package-versions.ts +20 -4
  97. package/src/native-failure-output.ts +34 -0
  98. package/src/native-firebase-config.ts +28 -10
  99. package/src/native-prebuilt.ts +3 -3
  100. package/src/nitro-adapter.lock.json +261 -261
  101. package/src/nitro-superset.lock.json +4 -4
  102. package/src/swift-distribution.lock.json +8 -8
  103. package/src/turbo-compile.ts +3 -3
  104. package/src/turbo-runtime.lock.json +17 -17
  105. package/src/turbo-source.ts +45 -32
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2035 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2037 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
  let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
3
  "use strict";
4
4
  var __defProp = Object.defineProperty;
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.2035 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.2037 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/worklet-executable.ts
4
4
  import { parse } from "acorn";
@@ -7,4 +7,6 @@ export type AppCatalog = {
7
7
  accentName: string | null;
8
8
  };
9
9
  export declare function encodeAppCatalogWire(catalog: AppCatalog): string;
10
+ export declare function insertAppCatalogFooter(source: string, catalog: AppCatalog): string;
11
+ export declare function readAppCatalogFooter(source: string): AppCatalog | null;
10
12
  export declare function decodeAppCatalogWire(raw: string | null): AppCatalog | null;
@@ -5,6 +5,7 @@ import { type ExpoSwiftCompilationResult } from '../../../../../src/expoSwiftCon
5
5
  import { type NitroCompiledModule, type TurboCompiledModule } from '../../../../../src/nitroContract.ts';
6
6
  import { type OneSDKCompilation } from '../../../../../src/oneSdkContract.ts';
7
7
  import { type PackageVersions } from '../../../../../src/packageVersionsContract.ts';
8
+ import { type AppCatalog } from '../engine/app-catalog-wire.d.ts';
8
9
  import { type RolldownModulePreparation } from '../rolldown-production-module.d.ts';
9
10
  import type { MetroModuleIdentity } from '../metro-identity-contract.d.ts';
10
11
  import type { NativeAppIdentity } from '../../../../../src/native-app-identity.ts';
@@ -16,6 +17,7 @@ export interface MetroBundleBootMetadata {
16
17
  rolldownPreparation?: RolldownModulePreparation | null;
17
18
  rolldownSourceHash: string | null;
18
19
  nativeAppIdentity: NativeAppIdentity | null;
20
+ appCatalog: AppCatalog | null;
19
21
  nativeFirebaseConfig: NativeFirebaseConfig | null;
20
22
  configuredBundle: PeachBundleConfig | null;
21
23
  expoSwift: ExpoSwiftCompilationResult | null;
@@ -2,6 +2,7 @@ import type { DeviceModel, DevicePosture, DeviceSpec, InterfaceOrientation, Inte
2
2
  import type { DiscoveredServer } from '../../../../../src/serverDiscoveryContract.ts';
3
3
  import type { LockstepFramePosition } from '../capture/lockstep-clockContract.d.ts';
4
4
  import type { AnimationClockSnapshot } from '../engine/animation-clockContract.d.ts';
5
+ import type { AppCatalog } from '../engine/app-catalog-wire.d.ts';
5
6
  import type { EngineMemoryCounts } from '../engine/memory-counts.d.ts';
6
7
  import type { ShellControlEvent } from '../engine/shell-owned-values.d.ts';
7
8
  import type { AuxShellActivity } from '../ios/aux-home-scene.d.ts';
@@ -584,6 +585,7 @@ export type WorkerToHost = {
584
585
  type: 'nativeAppIdentity';
585
586
  requestId: number;
586
587
  identity: NativeAppIdentity | null;
588
+ appCatalog: AppCatalog | null;
587
589
  } | {
588
590
  type: 'debugHeld';
589
591
  } | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peachsim",
3
- "version": "0.1.2035",
3
+ "version": "0.1.2037",
4
4
  "description": "Vite and Metro plugins, testing drivers, and SDK exports for peach.",
5
5
  "author": "Tamagui LLC",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -1 +1 @@
1
- {"abi":1,"sha256":"b47adb394ab539ff00e2ed18f1f0df810baa01bd705819ca976eb65d6798b348","file":"node/cli-b47adb394ab539ff00e2ed18f1f0df810baa01bd705819ca976eb65d6798b348.cjs"}
1
+ {"abi":1,"sha256":"4f57b56031901847c4b58b0a8a000279a4718438d3dad8494c82fc83e6c3417d","file":"node/cli-4f57b56031901847c4b58b0a8a000279a4718438d3dad8494c82fc83e6c3417d.cjs"}
@@ -16,6 +16,8 @@ import {
16
16
  insertPackageVersionsFooter,
17
17
  } from './packageVersionsContract'
18
18
  import { terminateProcessGroup } from './process-group'
19
+ import { discoverAppCatalog } from '../cli/app-catalog'
20
+ import { captureStagedHostFiles } from './host/staged-host-files'
19
21
 
20
22
  const digest = (bytes) => createHash('sha256').update(bytes).digest('hex')
21
23
  const segment = /^[a-zA-Z0-9._-]+$/
@@ -104,6 +106,7 @@ async function prepareChannel({
104
106
  expoKotlin = null,
105
107
  nitro = null,
106
108
  turbo = null,
109
+ appCatalog = null,
107
110
  }) {
108
111
  if (!(platform in nativeAssetPath)) throw new Error(`unknown platform: ${platform}`)
109
112
  const native = platform === 'ios' ? expoSwift : expoKotlin
@@ -159,6 +162,7 @@ async function prepareChannel({
159
162
  if (oneSDK) identity.update(JSON.stringify(oneSDK.metadata))
160
163
  if (nitro) identity.update(JSON.stringify(nitro.metadata))
161
164
  if (turbo) identity.update(JSON.stringify(turbo.metadata))
165
+ if (appCatalog) identity.update(JSON.stringify(appCatalog))
162
166
  const releaseKey = `${prefix}/peach/releases/${identity.digest('hex')}`
163
167
  const assetBaseUrl = `${origin.origin}/${releaseKey}/`
164
168
  const directories = new Set(
@@ -185,7 +189,7 @@ async function prepareChannel({
185
189
  return `${property}${JSON.stringify(new URL(path, assetBaseUrl).href)}`
186
190
  },
187
191
  )
188
- if (assets.length && !locations)
192
+ if (assets.some(asset => !asset.path.startsWith('assets/native-catalog/')) && !locations)
189
193
  throw new Error('bundle has packaged files but no asset metadata')
190
194
  const attached = insertNativeBundleFooters(
191
195
  source,
@@ -193,6 +197,15 @@ async function prepareChannel({
193
197
  (path) => new URL(path, assetBaseUrl).href,
194
198
  )
195
199
  source = attached.source
200
+ if (appCatalog) {
201
+ source = getCliRuntime().engine_app_catalog_wire.insertAppCatalogFooter(source, {
202
+ ...appCatalog,
203
+ images: Object.fromEntries(Object.entries(appCatalog.images).map(([name, variants]) => [
204
+ name,
205
+ variants.map(image => ({...image, uri: new URL(image.uri, assetBaseUrl).href})),
206
+ ])),
207
+ })
208
+ }
196
209
  if (detached.versions)
197
210
  source = insertPackageVersionsFooter(source, detached.versions)
198
211
  source = await attachRolldownBundleInventory(source)
@@ -338,8 +351,29 @@ async function packagePlatformBundle(
338
351
  if (!assets.has(path)) assets.set(path, await readAssetFile(asset, file))
339
352
  }
340
353
  }
354
+ let appCatalog = null
355
+ if (platform === 'ios') {
356
+ const captured = await captureStagedHostFiles(() => discoverAppCatalog(projectRoot, 'https://packaged.invalid'))
357
+ if (captured.value) {
358
+ appCatalog = {
359
+ ...captured.value,
360
+ images: Object.fromEntries(Object.entries(captured.value.images).map(([name, variants]) => [
361
+ name,
362
+ variants.map(image => {
363
+ const file = basename(new URL(image.uri).pathname)
364
+ const staged = captured.files.get(file)
365
+ if (!staged) throw new Error('app catalog image was not staged')
366
+ const resource = `assets/native-catalog/${file}`
367
+ assets.set(resource, readFileSync(staged))
368
+ return {...image, uri: resource}
369
+ }),
370
+ ])),
371
+ }
372
+ }
373
+ }
341
374
  return {
342
375
  platform,
376
+ appCatalog,
343
377
  // the versions footer stays last: the rolldown inventory reads it there.
344
378
  bundle: Buffer.from(
345
379
  insertPackageVersionsFooter(
@@ -30,17 +30,13 @@ export function autolinkerAppleFlags(autolinkerManifest: string, appRoot: string
30
30
 
31
31
  const run = promisify(execFile)
32
32
 
33
- /** the Apple pods of every Expo module the app's autolinker selects, which the
34
- * React Native autolinker leaves out; an app without the autolinker has none. */
35
- export async function expoAutolinkedPods(
36
- appRoot: string,
37
- ): Promise<{ name: string; root: string; podspecPath: string }[]> {
33
+ async function autolinkerResults(appRoot: string) {
38
34
  const appRequire = createRequire(path.join(appRoot, 'package.json'))
39
35
  let manifest: string
40
36
  try {
41
37
  manifest = appRequire.resolve('expo-modules-autolinking/package.json')
42
38
  } catch (error) {
43
- if (Reflect.get(Object(error), 'code') === 'MODULE_NOT_FOUND') return []
39
+ if (Reflect.get(Object(error), 'code') === 'MODULE_NOT_FOUND') return null
44
40
  throw error
45
41
  }
46
42
  const cli = path.join(path.dirname(manifest), 'bin/expo-modules-autolinking.js')
@@ -59,12 +55,39 @@ export async function expoAutolinkedPods(
59
55
  ),
60
56
  ),
61
57
  )
62
- return resolve.modules.flatMap(
63
- (module: { packageName: string; pods: { podName: string; podspecDir: string }[] }) =>
64
- module.pods.map((pod) => ({
65
- name: module.packageName,
66
- root: search[module.packageName].path,
67
- podspecPath: path.join(pod.podspecDir, `${pod.podName}.podspec`),
68
- })),
58
+ const modules: AutolinkedModule[] = resolve.modules
59
+ return { search, modules }
60
+ }
61
+
62
+ interface AutolinkedModule {
63
+ packageName: string
64
+ swiftModuleNames?: string[]
65
+ pods: { podName: string; podspecDir: string }[]
66
+ }
67
+
68
+ /** the Apple pods of every Expo module the app's autolinker selects, which the
69
+ * React Native autolinker leaves out; an app without the autolinker has none. */
70
+ export async function expoAutolinkedPods(
71
+ appRoot: string,
72
+ ): Promise<{ name: string; root: string; podspecPath: string }[]> {
73
+ const linked = await autolinkerResults(appRoot)
74
+ return (linked?.modules ?? []).flatMap((module) =>
75
+ module.pods.map((pod) => ({
76
+ name: module.packageName,
77
+ root: linked!.search[module.packageName].path,
78
+ podspecPath: path.join(pod.podspecDir, `${pod.podName}.podspec`),
79
+ })),
69
80
  )
70
81
  }
82
+
83
+ /** each installed Expo module package the app's autolinker selects, with the Swift modules it builds. */
84
+ export async function expoAutolinkedPackages(
85
+ appRoot: string,
86
+ ): Promise<{ name: string; root: string; swiftModuleNames: string[] }[]> {
87
+ const linked = await autolinkerResults(appRoot)
88
+ return (linked?.modules ?? []).map((module) => ({
89
+ name: module.packageName,
90
+ root: fs.realpathSync(linked!.search[module.packageName].path),
91
+ swiftModuleNames: module.swiftModuleNames ?? [],
92
+ }))
93
+ }
@@ -162,6 +162,7 @@ function isStoredUnit(value: unknown): value is StoredExpoSwiftSourceUnit {
162
162
  strings(value.reactDelegateHandlers) &&
163
163
  digestRecord(value.files) &&
164
164
  strings(value.frameworks) &&
165
+ (value.reactNativeProvider === undefined || value.reactNativeProvider === true) &&
165
166
  (value.workspaceSources === undefined || strings(value.workspaceSources)) &&
166
167
  (value.nativeTargets === undefined ||
167
168
  (strings(value.nativeTargets) && value.nativeTargets.every(isDigest))) &&
@@ -9,6 +9,7 @@ import { detectPackageManager } from '../cli/commands/detect'
9
9
  import { teamMachineInstalled } from './admitted-mac-build'
10
10
  import { workspaceExclusion } from './expo-workspace-exclusion'
11
11
  import { cacheDir } from './home-paths'
12
+ import { failedOutputLine } from './native-failure-output'
12
13
  import { prepareOneSDKSources } from './one-sdk-preparation'
13
14
  import { portableExpoWorkspace } from './portable-expo-workspace'
14
15
  import {
@@ -1018,14 +1019,14 @@ async function runAdmitted(
1018
1019
  child.stderr.on('data', (bytes: Buffer) => output.push(bytes))
1019
1020
  await new Promise<void>((resolve, reject) => {
1020
1021
  child.once('error', reject)
1021
- child.once('close', (status) =>
1022
- status === 0
1023
- ? resolve()
1024
- : reject(
1025
- new Error(
1026
- `${command} exited ${status}: ${Buffer.concat(output).toString('utf8')}`,
1027
- ),
1028
- ),
1029
- )
1022
+ child.once('close', (status, signal) => {
1023
+ if (status === 0) return resolve()
1024
+ const bytes = Buffer.concat(output)
1025
+ reject(
1026
+ new Error(
1027
+ `${command} exited ${status ?? signal}: ${bytes.toString('utf8')}\n${failedOutputLine(command, cwd, bytes)}`,
1028
+ ),
1029
+ )
1030
+ })
1030
1031
  })
1031
1032
  }
@@ -0,0 +1,122 @@
1
+ // one installed Expo module package's compiled Swift from the prebuilt registry
2
+ // (specs/peach/swift/expo-native-compilation.md). a hosted run has no native
3
+ // workspace to compile in, so our builder publishes each package alone under a
4
+ // key of its name, version and source tree, the compilers and the runtime's
5
+ // pins. the host looks up every Expo module package an app installs and loads
6
+ // the ones published; the rest stay unanswered, as before.
7
+ import fs from 'node:fs'
8
+ import path from 'node:path'
9
+ import { peachAnsweredNativePackages } from './answeredNativePackages'
10
+ import { expoAutolinkedPackages } from './expo-autolinking'
11
+ import { EXPO_NATIVE_COMPILER_DIGEST } from './expo-native-prebuilt'
12
+ import {
13
+ isExpoSwiftCompilationResult,
14
+ type ExpoSwiftCompilationResult,
15
+ } from './expoSwiftContract'
16
+ import { isRecord } from './is-record'
17
+ import {
18
+ NATIVE_PREBUILT_ORIGIN,
19
+ nativeEntryKey,
20
+ nativeEntryPrefix,
21
+ } from './native-prebuilt'
22
+ import { packageTreeDigest } from './package-tree-digest'
23
+ import { swiftNativePin } from './swift-native-pin'
24
+
25
+ export interface ExpoPodPackage {
26
+ name: string
27
+ root: string
28
+ version: string
29
+ swiftModule: string
30
+ }
31
+
32
+ /** the installed Expo module packages a package entry can hold: one Swift module each, from node_modules, not answered by the runtime. */
33
+ export async function expoPodPackages(appRoot: string): Promise<ExpoPodPackage[]> {
34
+ const answered = peachAnsweredNativePackages()
35
+ return (await expoAutolinkedPackages(appRoot)).flatMap((pod) => {
36
+ const [swiftModule] = pod.swiftModuleNames
37
+ if (
38
+ swiftModule === undefined ||
39
+ pod.swiftModuleNames.length !== 1 ||
40
+ answered.has(pod.name) ||
41
+ !pod.root.split(path.sep).includes('node_modules')
42
+ )
43
+ return []
44
+ const manifest: unknown = JSON.parse(
45
+ fs.readFileSync(path.join(pod.root, 'package.json'), 'utf8'),
46
+ )
47
+ const version = isRecord(manifest) ? manifest.version : null
48
+ if (typeof version !== 'string')
49
+ throw new Error(`${pod.root}: package has no version`)
50
+ return [{ name: pod.name, root: pod.root, version, swiftModule }]
51
+ })
52
+ }
53
+
54
+ export async function expoPodInputs(
55
+ pod: ExpoPodPackage,
56
+ ): Promise<Record<string, string>> {
57
+ return {
58
+ compiler: EXPO_NATIVE_COMPILER_DIGEST,
59
+ 'swift-pin': JSON.stringify(swiftNativePin()),
60
+ answered: JSON.stringify([...peachAnsweredNativePackages()].sort()),
61
+ name: pod.name,
62
+ version: pod.version,
63
+ tree: await packageTreeDigest(pod.root),
64
+ }
65
+ }
66
+
67
+ // a scoped package name holds a slash the entry path cannot
68
+ export const expoPodEntryName = (name: string) => name.replace('/', '+')
69
+
70
+ export const expoPodEntryUrl = (name: string, key: string, file: string) =>
71
+ `${NATIVE_PREBUILT_ORIGIN}/${nativeEntryPrefix('expo-pod', expoPodEntryName(name), key)}/${file}`
72
+
73
+ // the package's own root id: the tenant prefixes its installation, so only
74
+ // uniqueness among one app's modules matters.
75
+ export const expoPodRootId = (pod: ExpoPodPackage) =>
76
+ `expo-pod/${pod.name}@${pod.version}`
77
+
78
+ // one process asks for each key once: an entry never changes.
79
+ const published = new Map<string, Promise<ExpoSwiftCompilationResult | null>>()
80
+
81
+ function lookup(url: string) {
82
+ let pending = published.get(url)
83
+ if (!pending) {
84
+ pending = fetch(url)
85
+ .then(async (response) => {
86
+ if (!response.ok) return null
87
+ const entry: unknown = await response.json()
88
+ return isExpoSwiftCompilationResult(entry) ? entry : null
89
+ })
90
+ .catch(() => null)
91
+ published.set(url, pending)
92
+ }
93
+ return pending
94
+ }
95
+
96
+ /**
97
+ * the published Swift for every Expo module package the app installs, or null
98
+ * when none is published. a network failure is a miss: the module stays
99
+ * unanswered, as it is without an entry.
100
+ */
101
+ export async function prebuiltExpoPods(
102
+ appRoot: string,
103
+ ): Promise<ExpoSwiftCompilationResult | null> {
104
+ const entries = await Promise.all(
105
+ (await expoPodPackages(fs.realpathSync(appRoot))).map(async (pod) =>
106
+ lookup(
107
+ expoPodEntryUrl(
108
+ pod.name,
109
+ nativeEntryKey(await expoPodInputs(pod)),
110
+ 'metadata.json',
111
+ ),
112
+ ),
113
+ ),
114
+ )
115
+ const hits = entries.filter((entry) => entry !== null)
116
+ if (hits.length === 0) return null
117
+ return {
118
+ namespaces: hits.flatMap((entry) => entry.namespaces),
119
+ modules: hits.flatMap((entry) => entry.modules),
120
+ failures: [],
121
+ }
122
+ }