peachsim 0.1.1814 → 0.1.1817

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 (115) hide show
  1. package/cli/commands/control.ts +5 -2
  2. package/cli/commands/inspect.ts +43 -385
  3. package/cli/commands/package.ts +88 -32
  4. package/cli/commands/runtime.ts +2 -2
  5. package/cli/outbound-endpoints.ts +2 -2
  6. package/cli/packaged-app-launcher.ts +6 -1
  7. package/dist-lib/agent-daemon-client.cjs +1 -1
  8. package/dist-lib/agent-events.cjs +1 -1
  9. package/dist-lib/attached-projects.cjs +1 -1
  10. package/dist-lib/auth/shared-session.cjs +1 -1
  11. package/dist-lib/backend-origin.cjs +1 -1
  12. package/dist-lib/beta.cjs +1 -1
  13. package/dist-lib/beta.mjs +1 -1
  14. package/dist-lib/bridge-constants.cjs +1 -1
  15. package/dist-lib/bridge-contract-input.cjs +1 -1
  16. package/dist-lib/bridge-contract-input.mjs +1 -1
  17. package/dist-lib/bridge-contract.cjs +1 -1
  18. package/dist-lib/bridge-contract.mjs +1 -1
  19. package/dist-lib/bundle-channel.cjs +5186 -5881
  20. package/dist-lib/capture-contract.cjs +1 -1
  21. package/dist-lib/capture-contract.mjs +1 -1
  22. package/dist-lib/cloud-contract.cjs +1 -1
  23. package/dist-lib/cloud-contract.mjs +1 -1
  24. package/dist-lib/cloud-test-args.cjs +1 -1
  25. package/dist-lib/cloud-test-args.mjs +1 -1
  26. package/dist-lib/cloud.cjs +1 -1
  27. package/dist-lib/cloud.mjs +1 -1
  28. package/dist-lib/config.cjs +1 -1
  29. package/dist-lib/config.mjs +1 -1
  30. package/dist-lib/detox/index.cjs +100 -16
  31. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  32. package/dist-lib/expo-swift-bundle.cjs +3949 -4535
  33. package/dist-lib/expo-swift-metadata.cjs +1 -1
  34. package/dist-lib/expo-swift-metadata.mjs +1 -1
  35. package/dist-lib/home-paths.cjs +1 -1
  36. package/dist-lib/host/bridge-host.cjs +3724 -4482
  37. package/dist-lib/host/fetch-proxy-handler.cjs +25 -14
  38. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  39. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  40. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  41. package/dist-lib/host/websocket-proxy.cjs +1 -1
  42. package/dist-lib/index.cjs +26 -36
  43. package/dist-lib/jump-to-source-babel.cjs +1 -1
  44. package/dist-lib/jump-to-source-native.cjs +1 -1
  45. package/dist-lib/kotlin-host.cjs +1 -1
  46. package/dist-lib/menu.cjs +1 -1
  47. package/dist-lib/menu.mjs +1 -1
  48. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  49. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  50. package/dist-lib/metro-production-bundle.cjs +1 -1
  51. package/dist-lib/metro-production-bundle.mjs +1 -1
  52. package/dist-lib/metro.cjs +26 -36
  53. package/dist-lib/native-app-identity-project.cjs +4 -23
  54. package/dist-lib/native-app-identity-project.mjs +4 -23
  55. package/dist-lib/native-app-identity.cjs +1 -1
  56. package/dist-lib/native-app-identity.mjs +1 -1
  57. package/dist-lib/native-firebase-metadata.cjs +1 -1
  58. package/dist-lib/native-firebase-metadata.mjs +1 -1
  59. package/dist-lib/pdfium-raster.cjs +1 -1
  60. package/dist-lib/pdfium-raster.mjs +1 -1
  61. package/dist-lib/plist.cjs +1 -1
  62. package/dist-lib/plist.mjs +1 -1
  63. package/dist-lib/profiles.cjs +1 -1
  64. package/dist-lib/public-brand.cjs +1 -1
  65. package/dist-lib/public-origins-lib-esm.json +24 -24
  66. package/dist-lib/public-origins-lib.json +87 -76
  67. package/dist-lib/react-native-host-modules.cjs +1 -1
  68. package/dist-lib/react-native-host-modules.mjs +1 -1
  69. package/dist-lib/reap-browser.cjs +1 -1
  70. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  71. package/dist-lib/sdk.cjs +1 -1
  72. package/dist-lib/sdk.mjs +1 -1
  73. package/dist-lib/skills.cjs +4265 -4982
  74. package/dist-lib/swift-compile.cjs +218 -243
  75. package/dist-lib/swift-compile.mjs +218 -243
  76. package/dist-lib/swift-package.cjs +1 -1
  77. package/dist-lib/swift-package.mjs +1 -1
  78. package/dist-lib/swift-submit.cjs +1 -1
  79. package/dist-lib/swift-submit.mjs +1 -1
  80. package/dist-lib/swift-toolchain.cjs +1 -1
  81. package/dist-lib/swift.cjs +1 -1
  82. package/dist-lib/vite-swift.cjs +274 -251
  83. package/dist-lib/vite.cjs +25 -14
  84. package/dist-lib/worklet-executable.cjs +1 -1
  85. package/dist-lib/worklet-executable.mjs +1 -1
  86. package/dist-types/packages/peach-engine/src/engine/nativeReplayContract.d.ts +2 -0
  87. package/package.json +1 -1
  88. package/runtime-companion.json +1 -1
  89. package/src/answeredNativePackages.ts +41 -0
  90. package/src/cli-runtime.ts +34 -13
  91. package/src/expo-discovery-cache.ts +2 -0
  92. package/src/expo-kotlin-host.ts +11 -9
  93. package/src/expo-swift-host.ts +10 -6
  94. package/src/expo-swift-ready.ts +16 -2
  95. package/src/installed-native-libraries.ts +79 -18
  96. package/src/nitro-adapter.lock.json +240 -240
  97. package/src/nitro-bundle.ts +8 -6
  98. package/src/nitro-compile.ts +6 -3
  99. package/src/nitro-compiler-digest.ts +2 -4
  100. package/src/nitro-dependencies.ts +8 -2
  101. package/src/nitro-source.ts +34 -3
  102. package/src/nitro-superset.lock.json +21 -253
  103. package/src/nitro-superset.ts +59 -63
  104. package/src/nitroContract.ts +26 -3
  105. package/src/react-native-bridge-modules.ts +2 -4
  106. package/src/runtime-delivery.ts +2 -2
  107. package/src/swift-compile.ts +260 -255
  108. package/src/swift-distribution.lock.json +9 -8
  109. package/src/swift-installed-targets.ts +13 -0
  110. package/src/swift-objc-standin.ts +10 -6
  111. package/src/swift-standins.ts +44 -14
  112. package/src/turbo-bundle.ts +20 -1
  113. package/src/turbo-compile.ts +6 -12
  114. package/src/turbo-runtime.lock.json +19 -19
  115. package/src/turbo-source.ts +18 -3
package/dist-lib/vite.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1814 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1817 | (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 __create = Object.create;
@@ -184,15 +184,6 @@ var import_node_fs2 = require("node:fs");
184
184
  var import_node_module = require("node:module");
185
185
  var import_node_path2 = require("node:path");
186
186
 
187
- // runtime-companion.json
188
- var runtime_companion_default = { abi: 1, sha256: "58cc17038ff9baf52198a5edfd081d9a60236469948361b70f2471760d394d3e", file: "node/cli-58cc17038ff9baf52198a5edfd081d9a60236469948361b70f2471760d394d3e.cjs" };
189
-
190
- // src/runtime-assets.ts
191
- init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
192
- var import_fs = __toESM(require("fs"), 1);
193
- var import_path = __toESM(require("path"), 1);
194
- var import_url = require("url");
195
-
196
187
  // ../contrast-runtime-delivery/src/index.ts
197
188
  init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
198
189
 
@@ -211,6 +202,18 @@ function isValidRuntimeVersion(value) {
211
202
  return value.length <= 100 && /^[0-9A-Za-z][0-9A-Za-z._+-]*$/.test(value);
212
203
  }
213
204
 
205
+ // runtime-companion.json
206
+ var runtime_companion_default = { abi: 1, sha256: "d657f8c4fd2d3c861f50ea15c42b3275555ac4f799c58a46d3dca829656bc63c", file: "node/cli-d657f8c4fd2d3c861f50ea15c42b3275555ac4f799c58a46d3dca829656bc63c.cjs" };
207
+
208
+ // src/answeredNativePackages.ts
209
+ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
210
+
211
+ // src/runtime-assets.ts
212
+ init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
213
+ var import_fs = __toESM(require("fs"), 1);
214
+ var import_path = __toESM(require("path"), 1);
215
+ var import_url = require("url");
216
+
214
217
  // src/home-paths.ts
215
218
  init_define_SWIFT_COVERAGE_SOURCE_DIGESTS();
216
219
  var import_node_fs = __toESM(require("node:fs"), 1);
@@ -484,19 +487,28 @@ function streamFile(res, stream) {
484
487
  stream.pipe(res);
485
488
  }
486
489
 
490
+ // src/answeredNativePackages.ts
491
+ function peachRuntimeRoot() {
492
+ const root = resolveDevCheckoutRuntimeAssetRoot() ?? resolveActiveRuntimeRoot();
493
+ if (!root) throw new Error("No Peach runtime installed; run `peach runtime install`");
494
+ return root;
495
+ }
496
+
487
497
  // src/cli-runtime.ts
488
498
  var CLI_COMPANION_ABI = 1;
489
499
  function cliCompanionPath() {
490
500
  return `node/cli-${runtime_companion_default.sha256}.cjs`;
491
501
  }
492
502
  function verifyCliCompanion(root) {
493
- const file = (0, import_node_path2.join)(root, cliCompanionPath());
503
+ verifyCompanionFile((0, import_node_path2.join)(root, cliCompanionPath()));
504
+ }
505
+ function verifyCompanionFile(file) {
494
506
  let bytes;
495
507
  try {
496
508
  bytes = (0, import_node_fs2.readFileSync)(file);
497
509
  } catch (error) {
498
510
  if (error instanceof Error) {
499
- const missing2 = "code" in error && error.code === "ENOENT" ? "; this runtime has no companion for this CLI (it was published before this CLI, or the file was removed after unpacking), run `peach runtime install` for the latest runtime and check Windows Security protection history if it repeats" : "";
511
+ const missing2 = "code" in error && error.code === "ENOENT" ? "; run `peach runtime install`, which fetches the companion this CLI published, and check Windows Security protection history if it repeats" : "";
500
512
  error.message = `Could not read Peach runtime companion ${file}: ${error.message}${missing2}`;
501
513
  }
502
514
  throw error;
@@ -511,8 +523,7 @@ function verifyCliCompanion(root) {
511
523
  var loaded;
512
524
  function getCliRuntime() {
513
525
  if (loaded) return loaded.runtime;
514
- const root = resolveDevCheckoutRuntimeAssetRoot() ?? resolveActiveRuntimeRoot();
515
- if (!root) throw new Error("No Peach runtime installed; run `peach runtime install`");
526
+ const root = peachRuntimeRoot();
516
527
  verifyCliCompanion(root);
517
528
  const require2 = (0, import_node_module.createRequire)(__sootsim_import_meta_url);
518
529
  const runtime = require2((0, import_node_path2.join)(root, cliCompanionPath()));
@@ -1,4 +1,4 @@
1
- /*! peach v0.1.1814 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1817 | (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.1814 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
1
+ /*! peach v0.1.1817 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
2
 
3
3
  // src/worklet-executable.ts
4
4
  import { parse } from "acorn";
@@ -14,6 +14,8 @@ export interface NativeReplayObservation {
14
14
  clipRectangular: boolean;
15
15
  clipAntialiased: boolean;
16
16
  inkBounds: [number, number, number, number];
17
+ recordDpr: number | null;
18
+ walkDpr: number | null;
17
19
  }
18
20
  export interface CanvasKitReplayApi {
19
21
  p15(rows: number, frames: number, tag: number, target: number): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peachsim",
3
- "version": "0.1.1814",
3
+ "version": "0.1.1817",
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":"58cc17038ff9baf52198a5edfd081d9a60236469948361b70f2471760d394d3e","file":"node/cli-58cc17038ff9baf52198a5edfd081d9a60236469948361b70f2471760d394d3e.cjs"}
1
+ {"abi":1,"sha256":"d657f8c4fd2d3c861f50ea15c42b3275555ac4f799c58a46d3dca829656bc63c","file":"node/cli-d657f8c4fd2d3c861f50ea15c42b3275555ac4f799c58a46d3dca829656bc63c.cjs"}
@@ -0,0 +1,41 @@
1
+ import { readFileSync } from 'node:fs'
2
+ import { join } from 'node:path'
3
+ import {
4
+ resolveActiveRuntimeRoot,
5
+ resolveDevCheckoutRuntimeAssetRoot,
6
+ } from './runtime-assets'
7
+
8
+ // the runtime states which installed native packages it answers itself, so a
9
+ // CLI built from newer source never skips compiling one its runtime lacks.
10
+ export const ANSWERED_NATIVE_PACKAGES_PATH = 'node/answered-native-packages.json'
11
+
12
+ // the companion and the answered packages come from the runtime the host
13
+ // serves: inside the dev checkout that is the dev build `build:peachsim:cli`
14
+ // copied them beside, unless PEACH_HOME stages a runtime, as a release replay
15
+ // does inside a builder's checkout
16
+ export function peachRuntimeRoot(): string {
17
+ const root = resolveDevCheckoutRuntimeAssetRoot() ?? resolveActiveRuntimeRoot()
18
+ if (!root) throw new Error('No Peach runtime installed; run `peach runtime install`')
19
+ return root
20
+ }
21
+
22
+ let answered: ReadonlySet<string> | undefined
23
+
24
+ export function peachAnsweredNativePackages(): ReadonlySet<string> {
25
+ if (answered) return answered
26
+ const file = join(peachRuntimeRoot(), ANSWERED_NATIVE_PACKAGES_PATH)
27
+ let names: unknown
28
+ try {
29
+ names = JSON.parse(readFileSync(file, 'utf8'))
30
+ } catch (error) {
31
+ if (error instanceof Error && 'code' in error && error.code === 'ENOENT')
32
+ throw new Error(
33
+ `The active Peach runtime predates ${ANSWERED_NATIVE_PACKAGES_PATH}; run \`peach runtime install\``,
34
+ )
35
+ throw error
36
+ }
37
+ if (!Array.isArray(names) || !names.every((name) => typeof name === 'string'))
38
+ throw new Error(`${file} must list package names`)
39
+ answered = new Set(names)
40
+ return answered
41
+ }
@@ -1,12 +1,10 @@
1
1
  import { createHash } from 'node:crypto'
2
- import { readFileSync } from 'node:fs'
2
+ import { readFileSync, renameSync, rmSync } from 'node:fs'
3
3
  import { createRequire } from 'node:module'
4
4
  import { join } from 'node:path'
5
+ import { downloadToFile } from '@contrast/runtime-delivery'
5
6
  import companionIdentity from '../runtime-companion.json' with { type: 'json' }
6
- import {
7
- resolveActiveRuntimeRoot,
8
- resolveDevCheckoutRuntimeAssetRoot,
9
- } from './runtime-assets'
7
+ import { peachRuntimeRoot } from './answeredNativePackages'
10
8
  import type * as CliRuntime from '#peach-cli-contract/cli-companion'
11
9
 
12
10
  export const CLI_COMPANION_ABI = 1
@@ -16,16 +14,18 @@ export function cliCompanionPath(): string {
16
14
  }
17
15
 
18
16
  export function verifyCliCompanion(root: string): void {
19
- const file = join(root, cliCompanionPath())
17
+ verifyCompanionFile(join(root, cliCompanionPath()))
18
+ }
19
+
20
+ function verifyCompanionFile(file: string): void {
20
21
  let bytes: Buffer
21
22
  try {
22
23
  bytes = readFileSync(file)
23
24
  } catch (error) {
24
25
  if (error instanceof Error) {
25
- // a runtime carries the companions of CLIs published before it, never a later one
26
26
  const missing =
27
27
  'code' in error && error.code === 'ENOENT'
28
- ? '; this runtime has no companion for this CLI (it was published before this CLI, or the file was removed after unpacking), run `peach runtime install` for the latest runtime and check Windows Security protection history if it repeats'
28
+ ? '; run `peach runtime install`, which fetches the companion this CLI published, and check Windows Security protection history if it repeats'
29
29
  : ''
30
30
  error.message = `Could not read Peach runtime companion ${file}: ${error.message}${missing}`
31
31
  }
@@ -39,17 +39,38 @@ export function verifyCliCompanion(root: string): void {
39
39
  }
40
40
  }
41
41
 
42
+ // a runtime carries the companions of CLIs published before it. a CLI newer
43
+ // than its runtime fetches the companion its own release published, bound by
44
+ // the same exact hash, so a CLI never waits for a runtime release.
45
+ export async function ensureCliCompanion(root: string): Promise<void> {
46
+ const file = join(root, cliCompanionPath())
47
+ try {
48
+ verifyCompanionFile(file)
49
+ return
50
+ } catch (error) {
51
+ if (!(error instanceof Error && 'code' in error && error.code === 'ENOENT'))
52
+ throw error
53
+ }
54
+ const staged = `${file}.${process.pid}`
55
+ try {
56
+ await downloadToFile(
57
+ `https://r2.rnxsim.com/rnx-cli/companions/cli-${companionIdentity.sha256}.cjs`,
58
+ staged,
59
+ )
60
+ verifyCompanionFile(staged)
61
+ renameSync(staged, file)
62
+ } finally {
63
+ rmSync(staged, { force: true })
64
+ }
65
+ }
66
+
42
67
  let loaded: { root: string; runtime: typeof CliRuntime } | undefined
43
68
 
44
69
  // select once per runtime, verify before evaluation, and retain the real functions
45
70
  // so host serializers receive their implementation rather than a forwarding closure.
46
71
  export function getCliRuntime(): typeof CliRuntime {
47
72
  if (loaded) return loaded.runtime
48
- // the companion comes from the runtime the host serves: inside the dev checkout
49
- // that is the dev build `build:peachsim:cli` copied it beside, unless PEACH_HOME
50
- // stages a runtime, as a release replay does inside a builder's checkout
51
- const root = resolveDevCheckoutRuntimeAssetRoot() ?? resolveActiveRuntimeRoot()
52
- if (!root) throw new Error('No Peach runtime installed; run `peach runtime install`')
73
+ const root = peachRuntimeRoot()
53
74
  verifyCliCompanion(root)
54
75
  const require = createRequire(import.meta.url)
55
76
  const runtime: typeof CliRuntime = require(join(root, cliCompanionPath()))
@@ -13,6 +13,7 @@ import { homedir } from 'node:os'
13
13
  import path from 'node:path'
14
14
  import { fileURLToPath } from 'node:url'
15
15
  import { EXPO_EAGER_NATIVE_VIEWS } from '../../peach-compat/src/stubs/native-seams/expo-eager-seam-contract'
16
+ import { peachAnsweredNativePackages } from './answeredNativePackages'
16
17
  import { getCliVersion } from './cli-version'
17
18
  import { hashExpoWorkspace } from './expo-native-workspace'
18
19
  import { isRecord } from './is-record'
@@ -53,6 +54,7 @@ function peachPin(): string {
53
54
  const hash = createHash('sha256')
54
55
  hash.update(`${FORMAT}\0${getCliVersion()}\0`)
55
56
  hash.update(JSON.stringify([...EXPO_EAGER_NATIVE_VIEWS]))
57
+ hash.update(JSON.stringify([...peachAnsweredNativePackages()].sort()))
56
58
  for (const name of PIPELINE_FILES) {
57
59
  let bytes: string | null = null
58
60
  for (const ext of ['.ts', '.js']) {
@@ -4,7 +4,6 @@
4
4
  // package with a native seam keeps it; one without compiles here.
5
5
  import fs from 'node:fs'
6
6
  import path from 'node:path'
7
- import { PEACH_ANSWERED_NATIVE_PACKAGE_NAMES } from '../../peach-compat/src/generated/supported-native-packages'
8
7
  import { resolveExpoAndroidAutolinking } from './android-autolinking'
9
8
  import {
10
9
  androidAppSources,
@@ -12,6 +11,7 @@ import {
12
11
  type BridgePackage,
13
12
  type BridgeSelection,
14
13
  } from './android-bridge-packages'
14
+ import { peachAnsweredNativePackages } from './answeredNativePackages'
15
15
  import { isLoopbackHost } from './backend-origin'
16
16
  import { isRecord } from './is-record'
17
17
  import { peachKotlinModuleRoot } from './kotlin-module'
@@ -20,8 +20,6 @@ import type { IncomingMessage, ServerResponse } from 'node:http'
20
20
 
21
21
  export const EXPO_KOTLIN_ROUTE = '/__peach/expo-kotlin'
22
22
 
23
- const answeredPackages: ReadonlySet<string> = new Set(PEACH_ANSWERED_NATIVE_PACKAGE_NAMES)
24
-
25
23
  export interface ExpoKotlinModules {
26
24
  // the registration names Android's ExpoModulesPackageList passes, in order
27
25
  modules: { classifier: string; name: string | null }[]
@@ -44,6 +42,7 @@ export async function collectExpoKotlinModules(
44
42
  ): Promise<ExpoKotlinProject[] | null> {
45
43
  const modules = await resolveExpoAndroidAutolinking(appRoot)
46
44
  const result: ExpoKotlinProject[] = []
45
+ let answeredInstalled = false
47
46
  for (const entry of modules) {
48
47
  // plugin-only dependencies have no local Kotlin module project.
49
48
  if (entry.projects === undefined) continue
@@ -58,11 +57,13 @@ export async function collectExpoKotlinModules(
58
57
  throw new Error('invalid Expo Android project')
59
58
  const sourceDir = fs.realpathSync(project.sourceDir)
60
59
  const installed = sourceDir.split(path.sep).includes('node_modules')
61
- if (
62
- installed &&
63
- (typeof entry.packageName !== 'string' || answeredPackages.has(entry.packageName))
64
- )
65
- continue
60
+ if (installed) {
61
+ if (typeof entry.packageName !== 'string') continue
62
+ if (peachAnsweredNativePackages().has(entry.packageName)) {
63
+ answeredInstalled = true
64
+ continue
65
+ }
66
+ }
66
67
  if (project.modules.length === 0) continue
67
68
  const group: ExpoKotlinProject = {
68
69
  modules: [],
@@ -105,7 +106,8 @@ export async function collectExpoKotlinModules(
105
106
  result.push(group)
106
107
  }
107
108
  }
108
- return result.length === 0 ? null : result
109
+ // an app whose installed modules a seam answers still links native modules.
110
+ return result.length === 0 && !answeredInstalled ? null : result
109
111
  }
110
112
 
111
113
  // the app module's ReactPackage classes the application registers
@@ -9,10 +9,10 @@ import os from 'node:os'
9
9
  import path from 'node:path'
10
10
  import { fileURLToPath } from 'node:url'
11
11
  import { promisify } from 'node:util'
12
- import { PEACH_ANSWERED_NATIVE_PACKAGE_NAMES } from '../../peach-compat/src/generated/supported-native-packages'
13
12
  import { EXPO_EAGER_NATIVE_VIEWS } from '../../peach-compat/src/stubs/native-seams/expo-eager-seam-contract'
14
13
  import { loadRNXAppConfig } from '../cli/app-config'
15
14
  import { resolveAppProject } from '../cli/app-project'
15
+ import { peachAnsweredNativePackages } from './answeredNativePackages'
16
16
  import { isLoopbackHost } from './backend-origin'
17
17
  import { autolinkerAppleFlags } from './expo-autolinking'
18
18
  import {
@@ -108,7 +108,6 @@ const WITNESS_BATCH = 200
108
108
  const traceStore = new AsyncLocalStorage<Witness>()
109
109
  const discoveryCache = new Map<string, DiscoveryEntry>()
110
110
  const preparedCache = new Map<string, PreparedEntry>()
111
- const answeredPackages: ReadonlySet<string> = new Set(PEACH_ANSWERED_NATIVE_PACKAGE_NAMES)
112
111
 
113
112
  type MissingMark = { missing: true }
114
113
  type PresentMark = {
@@ -1049,6 +1048,7 @@ async function collectExpoSwiftSourcesUncached(
1049
1048
  const units: ExpoSwiftSourceUnit[] = []
1050
1049
  const namespacesSeen = new Set<string>()
1051
1050
  const namespaceGroups = new Map<string, string[]>()
1051
+ let answeredInstalled = false
1052
1052
  let needsNativeWorkspace = false
1053
1053
  let bytes = 0
1054
1054
  let fileCount = 0
@@ -1067,9 +1067,11 @@ async function collectExpoSwiftSourcesUncached(
1067
1067
  // through the same autolinker-selected route as app-local modules.
1068
1068
  if (
1069
1069
  canonical.split(path.sep).includes('node_modules') &&
1070
- answeredPackages.has(packageName)
1071
- )
1070
+ peachAnsweredNativePackages().has(packageName)
1071
+ ) {
1072
+ answeredInstalled = true
1072
1073
  continue
1074
+ }
1073
1075
  // the autolinker read these in a child, so the parent can only stamp them
1074
1076
  // afterwards. one modified since the child started may be newer than what
1075
1077
  // the child consumed, and so may a module directory that gained or lost one.
@@ -1530,7 +1532,8 @@ async function collectExpoSwiftSourcesUncached(
1530
1532
  units.push(inlineUnit)
1531
1533
  }
1532
1534
  }
1533
- if (units.length === 0) return null
1535
+ // an app whose installed modules a seam answers still links native modules.
1536
+ if (units.length === 0) return answeredInstalled ? [] : null
1534
1537
  if (installed)
1535
1538
  enrichInstalledUnits(
1536
1539
  units,
@@ -1892,7 +1895,8 @@ async function compileExpoSwiftModulesTraced(
1892
1895
  }
1893
1896
  const units = [...(expoUnits ?? []), ...(bridge?.units ?? [])]
1894
1897
  const bridgeFailures = bridge?.failures ?? []
1895
- if (units.length === 0 && bridgeFailures.length === 0) return null
1898
+ if (units.length === 0 && bridgeFailures.length === 0 && expoUnits === null)
1899
+ return null
1896
1900
  report(
1897
1901
  `preparing ${units.length} modules: ${units.map((unit) => unit.moduleId).join(', ')}`,
1898
1902
  )
@@ -1,6 +1,7 @@
1
1
  import { getCliVersion } from './cli-version'
2
2
  import { LAUNCH_METADATA_QUERY_PARAM, readLaunchMetadata } from './launchMetadataContract'
3
3
  import { NATIVE_PREPARE_QUERY_PARAM } from './nativePreparationContract'
4
+ import { readTurboMetadata } from './nitroContract'
4
5
  import { nodeHttpFetch } from './node-http-fetch'
5
6
  import { getRuntimePlatformAdapter } from './runtimePlatformContract.ts'
6
7
  import type { RuntimePlatform } from './device-catalog.ts'
@@ -20,6 +21,8 @@ export type ExpoSwiftReadyOptions = {
20
21
  progressMs?: number
21
22
  signal?: AbortSignal
22
23
  onProgress?: (elapsedMs: number) => void
24
+ /** lines worth reporting from the endpoint's answer. */
25
+ notes?: (body: string) => string[]
23
26
  }
24
27
 
25
28
  export async function awaitExpoSwiftReady(
@@ -71,8 +74,9 @@ export async function awaitExpoSwiftReady(
71
74
  `${endpointUrl} answered ${res.status}${body ? `: ${body}` : ''}${hint}`,
72
75
  )
73
76
  }
74
- await res.text()
77
+ const answer = await res.text()
75
78
  console.log(` ${label} ready in ${((Date.now() - start) / 1000).toFixed(1)}s`)
79
+ for (const note of options.notes?.(answer) ?? []) console.log(` ${note}`)
76
80
  } finally {
77
81
  clearInterval(progress)
78
82
  }
@@ -127,7 +131,17 @@ export async function awaitStampedExpoSwiftReady(
127
131
  ? awaitExpoSwiftReady(preparationUrl(nitro), { signal: linked }, 'nitro modules')
128
132
  : null,
129
133
  turbo
130
- ? awaitExpoSwiftReady(preparationUrl(turbo), { signal: linked }, 'turbo modules')
134
+ ? awaitExpoSwiftReady(
135
+ preparationUrl(turbo),
136
+ {
137
+ signal: linked,
138
+ notes: (answer) =>
139
+ (readTurboMetadata(JSON.parse(answer))?.unavailable ?? []).map(
140
+ ({ name, diagnostic }) => `${name} is unavailable: ${diagnostic}`,
141
+ ),
142
+ },
143
+ 'turbo modules',
144
+ )
131
145
  : null,
132
146
  ])
133
147
  } catch (error) {
@@ -1,5 +1,7 @@
1
1
  // CocoaPods selects original source membership and header search roots;
2
- // verified native slices supply each declared vendored archive.
2
+ // verified native slices supply each declared vendored archive. a provider
3
+ // that links a prebuilt Apple binary with no WebAssembly build is unavailable,
4
+ // as a pod the app never linked would be, and its diagnostic names the binary.
3
5
  import fs from 'node:fs'
4
6
  import { createRequire } from 'node:module'
5
7
  import path from 'node:path'
@@ -20,8 +22,9 @@ export function installedNativeLibraries(
20
22
  moduleRoot: string,
21
23
  iosTarget?: string,
22
24
  frameworkLinkOwner: 'workspace' | 'provider' = 'workspace',
23
- ): Map<string, TurboInstalledPod> {
24
- if (providers.length === 0) return new Map()
25
+ ): InstalledNativeLibraries {
26
+ const result: InstalledNativeLibraries = { pods: new Map(), unavailable: new Map() }
27
+ if (providers.length === 0) return result
25
28
  const workspace = requireInstalledXcodeWorkspace(projectRoot, 'native providers')
26
29
  const app = readXcodeAppTarget(workspace, iosTarget, 'Release', {
27
30
  installedPods: true,
@@ -31,7 +34,12 @@ export function installedNativeLibraries(
31
34
  path.basename(provider.podspecPath, '.podspec'),
32
35
  ),
33
36
  })
34
- const result = new Map<string, TurboInstalledPod>()
37
+ const podsRoot = app.cocoapods && path.dirname(app.cocoapods.manifestLock)
38
+ const localPods = new Set(
39
+ (app.cocoapods?.localPodspecs ?? []).map((file) =>
40
+ path.basename(file, '.podspec.json'),
41
+ ),
42
+ )
35
43
  const reactNativeRoot = path.dirname(
36
44
  createRequire(path.join(projectRoot, 'package.json')).resolve(
37
45
  'react-native/package.json',
@@ -63,28 +71,55 @@ export function installedNativeLibraries(
63
71
  return value
64
72
  throw new Error(`${specFile}: invalid vendored native paths`)
65
73
  })
66
- if (paths.length > 0 && spec.subspecs)
67
- throw new Error(`${name}: native library intake does not replace subspec binaries`)
68
- if (paths.some((file) => /[*?{]/.test(file)))
69
- throw new Error(
70
- `${name}: native library intake needs literal installed archive paths`,
71
- )
72
74
  const target = app.frameworks.find((item) => item.name === name)
73
75
  if (!target?.podRoot)
74
76
  throw new Error(`${name}: installed target has no PODS_TARGET_SRCROOT`)
75
77
  const root = fs.realpathSync(target.podRoot)
76
- const ownedLibraries = paths.flatMap((file) => {
78
+ // a declared archive selects its WebAssembly slice by its original bytes;
79
+ // one with no registered slice, or one CocoaPods selects through a
80
+ // subspec or a pattern, has no build peach can link.
81
+ const archives = paths.map((file) => {
82
+ if (spec.subspecs || /[*?{]/.test(file)) return { file, recipe: null }
77
83
  const declared = path.resolve(root, file)
78
84
  const framework = declared.endsWith('.xcframework')
79
85
  ? simulatorStaticArchive(declared)
80
86
  : null
81
- if (declared.endsWith('.xcframework') && !framework)
82
- throw new Error(
83
- `${declared}: native framework intake needs an iOS simulator static archive`,
84
- )
87
+ if (declared.endsWith('.xcframework') && !framework) return { file, recipe: null }
85
88
  const native = framework?.file ?? declared
86
- const recipe = nativeStaticLibraryRecipe(readPackageFile(root, native, Infinity))
87
- if (!recipe) throw new Error(`${native}: no native WebAssembly archive recipe`)
89
+ return {
90
+ file: path.relative(root, native),
91
+ native,
92
+ framework,
93
+ recipe: nativeStaticLibraryRecipe(readPackageFile(root, native, Infinity)),
94
+ }
95
+ })
96
+ // a pod from a specification repository whose installed files are only
97
+ // prebuilt binaries, such as a vendor SDK framework, cannot compile.
98
+ const dependencyBinaries = Object.keys({
99
+ ...(isRecord(spec.dependencies) ? spec.dependencies : {}),
100
+ ...(isRecord(platform.dependencies) ? platform.dependencies : {}),
101
+ }).flatMap((dependency) => {
102
+ const pod = dependency.split('/')[0]!
103
+ if (!podsRoot || localPods.has(pod)) return []
104
+ return installedPodBinaries(path.join(podsRoot, pod)).map((file) =>
105
+ path.relative(path.dirname(podsRoot), file),
106
+ )
107
+ })
108
+ const unavailable = [
109
+ ...new Set([
110
+ ...archives.flatMap(({ file, recipe }) => (recipe ? [] : [file])),
111
+ ...dependencyBinaries,
112
+ ]),
113
+ ]
114
+ if (unavailable.length > 0) {
115
+ result.unavailable.set(
116
+ provider.name,
117
+ `${name} links the prebuilt ${unavailable.join(', ')}, which has no WebAssembly build`,
118
+ )
119
+ continue
120
+ }
121
+ const ownedLibraries = archives.flatMap(({ native, framework, recipe }) => {
122
+ if (!native || !recipe) return []
88
123
  const library = nativeStaticLibrary(native, recipe, moduleRoot)
89
124
  return framework && frameworkLinkOwner === 'workspace' ? [] : [library]
90
125
  })
@@ -133,7 +168,7 @@ export function installedNativeLibraries(
133
168
  flags.filter(
134
169
  (flag, index) => /^-[DU]/.test(flag) || /^-[DU]$/.test(flags[index - 1] ?? ''),
135
170
  )
136
- result.set(provider.name, {
171
+ result.pods.set(provider.name, {
137
172
  root,
138
173
  preprocessorFlags: {
139
174
  c: preprocessorFlags(target.objc?.flags ?? []),
@@ -185,3 +220,29 @@ export function installedNativeLibraries(
185
220
  }
186
221
  return result
187
222
  }
223
+
224
+ export interface InstalledNativeLibraries {
225
+ pods: Map<string, TurboInstalledPod>
226
+ /** providers that link a prebuilt binary with no WebAssembly build, with why. */
227
+ unavailable: Map<string, string>
228
+ }
229
+
230
+ const BINARY_BUNDLE = /\.(?:xcframework|framework)$/
231
+ const SOURCE = /\.(?:c|cc|cpp|cxx|m|mm|swift)$/
232
+
233
+ // the prebuilt bundles and archives an installed pod directory holds, or none
234
+ // when it also holds sources CocoaPods compiles.
235
+ function installedPodBinaries(directory: string): string[] {
236
+ if (!fs.existsSync(directory)) return []
237
+ const binaries: string[] = []
238
+ const pending = [directory]
239
+ for (let current = pending.pop(); current; current = pending.pop())
240
+ for (const entry of fs.readdirSync(current, { withFileTypes: true })) {
241
+ const file = path.join(current, entry.name)
242
+ if (entry.isDirectory() && BINARY_BUNDLE.test(entry.name)) binaries.push(file)
243
+ else if (entry.isDirectory()) pending.push(file)
244
+ else if (entry.name.endsWith('.a')) binaries.push(file)
245
+ else if (SOURCE.test(entry.name)) return []
246
+ }
247
+ return binaries.sort()
248
+ }