peachsim 0.1.1815 → 0.1.1818

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/cli/commands/agent-indicator-mode.ts +2 -1
  2. package/cli/commands/coverage-swift.ts +4 -3
  3. package/cli/commands/flow.ts +7 -0
  4. package/cli/commands/inspect/core.ts +1 -1
  5. package/cli/commands/maestro-compare.ts +7 -0
  6. package/cli/commands/package.ts +87 -31
  7. package/cli/commands/screenshot-mode.ts +2 -1
  8. package/cli/commands/shell-boolean-mode.ts +7 -3
  9. package/cli/commands/shell-url.ts +4 -0
  10. package/cli/commands/show-touches-mode.ts +2 -1
  11. package/cli/commands/test.ts +3 -2
  12. package/cli/commands/three-mode.ts +2 -1
  13. package/cli/outbound-endpoints.ts +1 -1
  14. package/cli/packaged-app-launcher.ts +6 -1
  15. package/dist-lib/agent-daemon-client.cjs +1 -1
  16. package/dist-lib/agent-events.cjs +1 -1
  17. package/dist-lib/attached-projects.cjs +1 -1
  18. package/dist-lib/auth/shared-session.cjs +1 -1
  19. package/dist-lib/backend-origin.cjs +1 -1
  20. package/dist-lib/beta.cjs +1 -1
  21. package/dist-lib/beta.mjs +1 -1
  22. package/dist-lib/bridge-constants.cjs +1 -1
  23. package/dist-lib/bridge-contract-input.cjs +1 -1
  24. package/dist-lib/bridge-contract-input.mjs +1 -1
  25. package/dist-lib/bridge-contract.cjs +1 -1
  26. package/dist-lib/bridge-contract.mjs +1 -1
  27. package/dist-lib/bundle-channel.cjs +5728 -7551
  28. package/dist-lib/capture-contract.cjs +1 -1
  29. package/dist-lib/capture-contract.mjs +1 -1
  30. package/dist-lib/cloud-contract.cjs +1 -1
  31. package/dist-lib/cloud-contract.mjs +1 -1
  32. package/dist-lib/cloud-test-args.cjs +1 -1
  33. package/dist-lib/cloud-test-args.mjs +1 -1
  34. package/dist-lib/cloud.cjs +1 -1
  35. package/dist-lib/cloud.mjs +1 -1
  36. package/dist-lib/config.cjs +1 -1
  37. package/dist-lib/config.mjs +1 -1
  38. package/dist-lib/detox/index.cjs +13 -4
  39. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  40. package/dist-lib/expo-swift-bundle.cjs +5234 -5704
  41. package/dist-lib/expo-swift-metadata.cjs +1 -1
  42. package/dist-lib/expo-swift-metadata.mjs +1 -1
  43. package/dist-lib/home-paths.cjs +1 -1
  44. package/dist-lib/host/bridge-host.cjs +4913 -6811
  45. package/dist-lib/host/fetch-proxy-handler.cjs +13 -4
  46. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  47. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  48. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  49. package/dist-lib/host/websocket-proxy.cjs +1 -1
  50. package/dist-lib/index.cjs +40 -30
  51. package/dist-lib/jump-to-source-babel.cjs +1 -1
  52. package/dist-lib/jump-to-source-native.cjs +1 -1
  53. package/dist-lib/kotlin-host.cjs +1 -1
  54. package/dist-lib/menu.cjs +1 -1
  55. package/dist-lib/menu.mjs +1 -1
  56. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  57. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  58. package/dist-lib/metro-production-bundle.cjs +1 -1
  59. package/dist-lib/metro-production-bundle.mjs +1 -1
  60. package/dist-lib/metro.cjs +39 -29
  61. package/dist-lib/native-app-identity-project.cjs +31 -26
  62. package/dist-lib/native-app-identity-project.mjs +295 -279
  63. package/dist-lib/native-app-identity.cjs +1 -1
  64. package/dist-lib/native-app-identity.mjs +1 -1
  65. package/dist-lib/native-firebase-metadata.cjs +1 -1
  66. package/dist-lib/native-firebase-metadata.mjs +1 -1
  67. package/dist-lib/pdfium-raster.cjs +1 -1
  68. package/dist-lib/pdfium-raster.mjs +1 -1
  69. package/dist-lib/plist.cjs +1 -1
  70. package/dist-lib/plist.mjs +1 -1
  71. package/dist-lib/profiles.cjs +1 -1
  72. package/dist-lib/public-brand.cjs +1 -1
  73. package/dist-lib/public-origins-lib-esm.json +29 -24
  74. package/dist-lib/public-origins-lib.json +121 -93
  75. package/dist-lib/react-native-host-modules.cjs +1 -1
  76. package/dist-lib/react-native-host-modules.mjs +1 -1
  77. package/dist-lib/reap-browser.cjs +1 -1
  78. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  79. package/dist-lib/sdk.cjs +2 -2
  80. package/dist-lib/sdk.mjs +2 -2
  81. package/dist-lib/skills.cjs +64622 -66476
  82. package/dist-lib/swift-compile.cjs +328 -265
  83. package/dist-lib/swift-compile.mjs +335 -270
  84. package/dist-lib/swift-package.cjs +1 -1
  85. package/dist-lib/swift-package.mjs +1 -1
  86. package/dist-lib/swift-submit.cjs +1 -1
  87. package/dist-lib/swift-submit.mjs +1 -1
  88. package/dist-lib/swift-toolchain.cjs +52 -6
  89. package/dist-lib/swift.cjs +1 -1
  90. package/dist-lib/vite-swift.cjs +2405 -2262
  91. package/dist-lib/vite.cjs +13 -4
  92. package/dist-lib/worklet-executable.cjs +1 -1
  93. package/dist-lib/worklet-executable.mjs +1 -1
  94. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +5 -0
  95. package/dist-types/packages/peach-engine/src/render-worker/map-command-channel.d.ts +41 -0
  96. package/dist-types/packages/peach-engine/src/render-worker/mapServicesContract.d.ts +45 -0
  97. package/package.json +2 -1
  98. package/runtime-companion.json +1 -1
  99. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.apinotes +1 -1
  100. package/sdk/ios/usr/include/module.modulemap +3 -0
  101. package/sdk/ios/usr/include/notify.modulemap +9 -0
  102. package/sdk/ios/usr/lib/swift/Darwin.swiftmodule/arm64-apple-ios-simulator.swiftinterface +4 -0
  103. package/sdk/ios/usr/lib/swift/Dispatch.swiftmodule/arm64-apple-ios-simulator.swiftinterface +1 -1
  104. package/sdk/ios/usr/lib/swift/Foundation.swiftmodule/arm64-apple-ios-simulator.swiftinterface +7 -1
  105. package/sdk/ios/usr/lib/swift/ObjectiveC.swiftmodule/arm64-apple-ios-simulator.swiftinterface +1 -0
  106. package/sdk/ios/usr/lib/swift/SwiftUI.swiftmodule/arm64-apple-ios-simulator.swiftinterface +21 -0
  107. package/sdk/ios/usr/lib/swift/SwiftUICore.swiftmodule/arm64-apple-ios-simulator.swiftinterface +6 -1
  108. package/sdk/ios/wasm/include/__header_time.h +4 -0
  109. package/sdk/ios/wasm/include/pthread.h +2 -0
  110. package/sdk/ios/wasm/include/sys/mman.h +1 -1
  111. package/sdk/ios/wasm/include/sys/resource.h +31 -0
  112. package/sdk/ios/wasm/include/unistd.h +4 -0
  113. package/src/answeredNativePackages.ts +43 -0
  114. package/src/cli-runtime.ts +2 -9
  115. package/src/expo-discovery-cache.ts +71 -52
  116. package/src/expo-kotlin-host.ts +11 -9
  117. package/src/expo-swift-host.ts +55 -13
  118. package/src/installed-native-libraries.ts +103 -20
  119. package/src/native-static-libraries.ts +69 -33
  120. package/src/nitro-adapter.ts +0 -9
  121. package/src/nitro-bundle.ts +8 -6
  122. package/src/nitro-compile.ts +45 -16
  123. package/src/nitro-compiler-digest.ts +2 -4
  124. package/src/nitro-superset.lock.json +19 -251
  125. package/src/nitro-superset.ts +63 -68
  126. package/src/plist-bytes.ts +9 -0
  127. package/src/portable-expo-workspace.ts +4 -3
  128. package/src/react-native-bridge-modules.ts +13 -19
  129. package/src/swift-compile.ts +379 -269
  130. package/src/swift-cxx-reachable.ts +13 -0
  131. package/src/swift-distribution.ts +3 -4
  132. package/src/swift-host.ts +5 -3
  133. package/src/swift-installed-targets.ts +32 -14
  134. package/src/swift-native-pin.ts +45 -0
  135. package/src/swift-objc-compile.ts +23 -1
  136. package/src/swift-objc-standin.ts +14 -7
  137. package/src/swift-package-manifest.ts +2 -2
  138. package/src/swift-root-lock.ts +4 -3
  139. package/src/swift-standins.ts +41 -38
  140. package/src/swift-toolchain.ts +69 -12
  141. package/src/swift-wasm-prune.ts +1 -0
  142. package/src/swift-xcframework.ts +23 -12
  143. package/src/swiftContract.ts +2 -0
  144. package/src/swiftNativePinContract.ts +68 -0
  145. package/src/turbo-bundle.ts +14 -6
  146. package/src/turbo-compile.ts +76 -11
  147. package/src/turbo-source.ts +93 -18
@@ -12,8 +12,8 @@ import { createHash } from 'node:crypto'
12
12
  import fs from 'node:fs'
13
13
  import path from 'node:path'
14
14
  import { promisify } from 'node:util'
15
- import { PEACH_ANSWERED_NATIVE_PACKAGE_NAMES } from '../../peach-compat/src/generated/supported-native-packages'
16
15
  import { rnxHomeDir } from './home-paths'
16
+ import { installedNativeSources } from './installed-native-libraries'
17
17
 
18
18
  const execFileAsync = promisify(execFile)
19
19
 
@@ -24,6 +24,7 @@ function codegenSpecRoot(codegen: string): string {
24
24
  const nested = path.join(codegen, 'ReactCodegen')
25
25
  return fs.existsSync(nested) ? nested : codegen
26
26
  }
27
+ import { peachAnsweredNativePackages } from './answeredNativePackages'
27
28
  import {
28
29
  glogSources,
29
30
  nitroDependencyIncludes,
@@ -46,6 +47,7 @@ import {
46
47
  installedRendererDependencyGlobs,
47
48
  runInstalledTurboCodegen,
48
49
  } from './turbo-codegen-intake'
50
+ import { installedXcodeWorkspace } from './xcode-project'
49
51
  import type { SwiftCompileInput } from './swift-compile'
50
52
  import type { SwiftPackageTarget } from './swift-package'
51
53
  import type { SwiftNativeHeaderMap } from './swiftContract'
@@ -59,15 +61,22 @@ export interface TurboProvider {
59
61
  podspecPath: string
60
62
  }
61
63
 
62
- export interface TurboInstalledPod {
64
+ export interface TurboInstalledSources {
63
65
  root: string
64
66
  files: string[]
67
+ }
68
+
69
+ export interface TurboInstalledPod extends TurboInstalledSources {
65
70
  publicHeaders: string[]
66
71
  headerSearchPaths: string[]
72
+ dependencySearchPaths: { root: string; directory: string }[]
67
73
  reactHeaderMaps: SwiftNativeHeaderMap[]
74
+ dependencyHeaderMaps: (SwiftNativeHeaderMap & { root: string })[]
68
75
  mappedHeaders: [string, string][]
69
76
  preprocessorFlags: { c: string[]; cxx: string[] }
70
77
  library?: string
78
+ /** registered vendored framework implementations owned by the shared core. */
79
+ sharedLibrary?: string
71
80
  }
72
81
 
73
82
  /** source fragments for the common Swift host. the caller owns the executable,
@@ -104,7 +113,6 @@ const CODEGEN_OBJC = /@generated by codegen project: GenerateModuleObjCpp\b/
104
113
  const UNIT = /\.(?:c|cc|cpp|cxx)$/
105
114
  const HEADER = /\.(?:h|hh|hpp|hxx|inl|ipp)$/
106
115
  const OBJC = /\.(?:m|mm)$/
107
- const answeredPackages: ReadonlySet<string> = new Set(PEACH_ANSWERED_NATIVE_PACKAGE_NAMES)
108
116
  // an Objective-C TurboModule: a class whose getTurboModule: returns the C++
109
117
  // object React Native's TurboModule manager installs
110
118
  const OBJC_TURBO =
@@ -882,18 +890,35 @@ function registers(root: string, files: Iterable<string>, objc = true): boolean
882
890
  }
883
891
 
884
892
  /** autolinked iOS pods that provide modules or original Fabric components. */
885
- export async function discoverTurboProviders(appRoot: string): Promise<TurboProvider[]> {
893
+ export async function discoverTurboProviders(
894
+ appRoot: string,
895
+ projectRoot?: string,
896
+ iosTarget?: string,
897
+ ): Promise<TurboProvider[]> {
886
898
  const providers: TurboProvider[] = []
899
+ const candidates: { provider: TurboProvider; fabric: boolean }[] = []
887
900
  for (const { name, root, podspecPath } of await iosAutolinkedDependencies(appRoot)) {
888
901
  // a package peach-compat answers keeps its answer, Fabric views included.
889
- if (answeredPackages.has(name)) continue
902
+ if (peachAnsweredNativePackages().has(name)) continue
890
903
  // a pod can register Nitro objects and Fabric components independently.
891
904
  const fabric = fabricComponents(root)
892
905
  if (!podspecPath) continue
893
- const provider = { name, root, podspecPath }
906
+ candidates.push({ provider: { name, root, podspecPath }, fabric })
907
+ }
908
+ const installed =
909
+ projectRoot && installedXcodeWorkspace(projectRoot)
910
+ ? installedNativeSources(
911
+ candidates.map(({ provider }) => provider),
912
+ projectRoot,
913
+ iosTarget,
914
+ )
915
+ : null
916
+ for (const { provider, fabric } of candidates) {
894
917
  const pod = readPod(provider, appRoot)
895
- const files = fabric ? null : podGlobFiles(pod)
896
- if (fabric || (files !== null && registers(pod.root, files))) {
918
+ const { root, files } = installed
919
+ ? installed.get(provider.name)!
920
+ : { root: pod.root, files: fabric ? null : podGlobFiles(pod) }
921
+ if (fabric || (files !== null && registers(root, files))) {
897
922
  const dependencies = await Promise.all(
898
923
  podspecDependencies(pod.text).map((dep) =>
899
924
  resolveExternalTurboPod(dep.name, dep.requirements, dep.subspecs),
@@ -1021,6 +1046,13 @@ export async function collectTurboSources(options: {
1021
1046
  externalPodSources: [],
1022
1047
  rendererSwiftTargets: [],
1023
1048
  }
1049
+ const sharedLibrary = [...(options.installedPods?.values() ?? [])].find(
1050
+ (pod) => pod.sharedLibrary,
1051
+ )?.sharedLibrary
1052
+ if (sharedLibrary)
1053
+ result.libraries = {
1054
+ [TURBO_CORE_TARGET]: fs.readFileSync(sharedLibrary).toString('base64'),
1055
+ }
1024
1056
  const add = (file: string, text: string) => {
1025
1057
  if (Object.hasOwn(result.files, file)) {
1026
1058
  if (result.files[file] !== text)
@@ -1177,10 +1209,16 @@ export async function collectTurboSources(options: {
1177
1209
  label: string
1178
1210
  root: string
1179
1211
  searchPaths: string[]
1212
+ dependencySearchPaths: TurboInstalledPod['dependencySearchPaths']
1180
1213
  reactHeaderMaps: {
1181
1214
  flag: SwiftNativeHeaderMap['flag']
1182
1215
  headers: Map<string, string>
1183
1216
  }[]
1217
+ dependencyHeaderMaps: {
1218
+ flag: SwiftNativeHeaderMap['flag']
1219
+ root: string
1220
+ headers: Map<string, string>
1221
+ }[]
1184
1222
  }
1185
1223
  >()
1186
1224
  // an include a file names, resolved as clang would against the pod's own
@@ -1340,6 +1378,44 @@ export async function collectTurboSources(options: {
1340
1378
  )
1341
1379
  return
1342
1380
  }
1381
+ for (const map of quoted
1382
+ ? [
1383
+ ...(pod?.dependencyHeaderMaps.filter(({ flag }) => flag === '-iquote') ?? []),
1384
+ ...(pod?.dependencyHeaderMaps.filter(({ flag }) => flag === '-I') ?? []),
1385
+ ]
1386
+ : (pod?.dependencyHeaderMaps.filter(({ flag }) => flag === '-I') ?? [])) {
1387
+ const relative = map.headers.get(include)
1388
+ if (relative === undefined) continue
1389
+ // the workspace is a copy of the app. use the same pod-relative source
1390
+ // identity as public-header lookup so pragma once sees one file.
1391
+ const owner = installedHeaderPods.flatMap((candidate) => {
1392
+ const root = relativeInside(options.appRoot, candidate.root)
1393
+ const file = root === null ? null : relativeInside(root, relative)
1394
+ return file === null ? [] : [{ pod: candidate, file }]
1395
+ })[0]
1396
+ alias(
1397
+ own,
1398
+ owner
1399
+ ? original(from.targetName, owner.pod.name, owner.pod.root, owner.file, false)
1400
+ : original(from.targetName, 'installed-dependency', map.root, relative, false),
1401
+ )
1402
+ return
1403
+ }
1404
+ // preserve installed cross-pod search roots without copying every header
1405
+ // in the sandbox. the original file's adjacent includes keep its own root.
1406
+ for (const search of pod?.dependencySearchPaths ?? []) {
1407
+ const candidate = path.resolve(search.root, search.directory, include)
1408
+ if (!fs.statSync(candidate, { throwIfNoEntry: false })?.isFile()) continue
1409
+ const file = fs.realpathSync(candidate)
1410
+ const relative = relativeInside(search.root, file)
1411
+ if (relative === null)
1412
+ throw new Error('installed dependency header escapes its workspace: ' + candidate)
1413
+ alias(
1414
+ own,
1415
+ original(from.targetName, 'installed-dependency', search.root, relative, false),
1416
+ )
1417
+ return
1418
+ }
1343
1419
  resolveDependency(include)
1344
1420
  }
1345
1421
  const scanText = (from: Scan, text: string, dependency = false) => {
@@ -1480,12 +1556,16 @@ export async function collectTurboSources(options: {
1480
1556
  (match) => match[1]!,
1481
1557
  ),
1482
1558
  ),
1559
+ dependencySearchPaths: pod.installed?.dependencySearchPaths ?? [],
1483
1560
  reactHeaderMaps: (pod.installed?.reactHeaderMaps ?? []).map(
1484
1561
  ({ flag, entries }) => ({
1485
1562
  flag,
1486
1563
  headers: new Map(entries),
1487
1564
  }),
1488
1565
  ),
1566
+ dependencyHeaderMaps: (pod.installed?.dependencyHeaderMaps ?? []).map(
1567
+ ({ flag, root, entries }) => ({ flag, root, headers: new Map(entries) }),
1568
+ ),
1489
1569
  })
1490
1570
  const mappings = podHeaderMappings(pod)
1491
1571
  // CocoaPods flattens a pod's headers: `Name.h` and `<pod>/Name.h`
@@ -1891,15 +1971,6 @@ export async function collectTurboSources(options: {
1891
1971
  '#import <UIKit/UIKit.h>',
1892
1972
  '#endif',
1893
1973
  '#if defined(__OBJC__) && !defined(__swift__)',
1894
- '@class NSURLConnection;',
1895
- '@class NSURLAuthenticationChallenge;',
1896
- '@class NSURLProtectionSpace;',
1897
- '@protocol NSURLConnectionDelegate <NSObject>',
1898
- '@optional',
1899
- '- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;',
1900
- '- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace;',
1901
- '- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge;',
1902
- '@end',
1903
1974
  '@interface UIScreen (PeachTurboRuntime)',
1904
1975
  '@property(nonatomic) CGFloat brightness;',
1905
1976
  '@end',
@@ -1978,7 +2049,11 @@ export async function collectTurboSources(options: {
1978
2049
  })
1979
2050
  result.rendererSwiftTargets.push(name)
1980
2051
  }
1981
- for (const file of pod.files) original(name, 'react-native', reactNative.root, file)
2052
+ for (const file of pod.files) {
2053
+ const collected = original(name, 'react-native', reactNative.root, file)
2054
+ if (swift)
2055
+ result.externalPodSources.push({ moduleName: pod.module, file: collected })
2056
+ }
1982
2057
  }
1983
2058
  const patterns = installedRendererDependencyGlobs(reactNative.root)
1984
2059
  const matchers = new Map(