peachsim 0.1.2430 → 0.1.2432

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 (104) hide show
  1. package/cli/commands/preview.ts +2 -1
  2. package/cli/outbound-endpoints.ts +10 -2
  3. package/dist-lib/agent-daemon-client.cjs +1 -1
  4. package/dist-lib/agent-events.cjs +1 -1
  5. package/dist-lib/attached-projects.cjs +1 -1
  6. package/dist-lib/auth/shared-session.cjs +1 -1
  7. package/dist-lib/backend-origin.cjs +1 -1
  8. package/dist-lib/beta.cjs +1 -1
  9. package/dist-lib/beta.mjs +1 -1
  10. package/dist-lib/bridge-constants.cjs +1 -1
  11. package/dist-lib/bridge-contract-input.cjs +1 -1
  12. package/dist-lib/bridge-contract-input.mjs +1 -1
  13. package/dist-lib/bridge-contract.cjs +1 -1
  14. package/dist-lib/bridge-contract.mjs +1 -1
  15. package/dist-lib/bundle-channel.cjs +15765 -5973
  16. package/dist-lib/capture-contract.cjs +1 -1
  17. package/dist-lib/capture-contract.mjs +1 -1
  18. package/dist-lib/cloud-contract.cjs +1 -1
  19. package/dist-lib/cloud-contract.mjs +1 -1
  20. package/dist-lib/cloud-test-args.cjs +1 -1
  21. package/dist-lib/cloud-test-args.mjs +1 -1
  22. package/dist-lib/cloud.cjs +1 -1
  23. package/dist-lib/cloud.mjs +1 -1
  24. package/dist-lib/config.cjs +1 -1
  25. package/dist-lib/config.mjs +1 -1
  26. package/dist-lib/detox/index.cjs +1 -1
  27. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  28. package/dist-lib/expo-swift-bundle.cjs +14638 -4888
  29. package/dist-lib/expo-swift-metadata.cjs +1 -1
  30. package/dist-lib/expo-swift-metadata.mjs +1 -1
  31. package/dist-lib/home-paths.cjs +1 -1
  32. package/dist-lib/host/bridge-host.cjs +15464 -5754
  33. package/dist-lib/host/fetch-proxy-handler.cjs +3204 -54
  34. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  35. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  36. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  37. package/dist-lib/host/websocket-proxy.cjs +1 -1
  38. package/dist-lib/index.cjs +3541 -391
  39. package/dist-lib/jump-to-source-babel.cjs +1 -1
  40. package/dist-lib/jump-to-source-native.cjs +1 -1
  41. package/dist-lib/kotlin-host.cjs +1 -1
  42. package/dist-lib/menu.cjs +1 -1
  43. package/dist-lib/menu.mjs +1 -1
  44. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  45. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  46. package/dist-lib/metro-production-bundle.cjs +1 -1
  47. package/dist-lib/metro-production-bundle.mjs +1 -1
  48. package/dist-lib/metro.cjs +3437 -287
  49. package/dist-lib/native-app-identity-project.cjs +2 -2
  50. package/dist-lib/native-app-identity-project.mjs +2 -2
  51. package/dist-lib/native-app-identity.cjs +1 -1
  52. package/dist-lib/native-app-identity.mjs +1 -1
  53. package/dist-lib/native-firebase-metadata.cjs +1 -1
  54. package/dist-lib/native-firebase-metadata.mjs +1 -1
  55. package/dist-lib/pdfium-raster.cjs +1 -1
  56. package/dist-lib/pdfium-raster.mjs +1 -1
  57. package/dist-lib/plist.cjs +1 -1
  58. package/dist-lib/plist.mjs +1 -1
  59. package/dist-lib/profiles.cjs +1 -1
  60. package/dist-lib/public-brand.cjs +1 -1
  61. package/dist-lib/public-origins-lib-esm.json +24 -24
  62. package/dist-lib/public-origins-lib.json +172 -79
  63. package/dist-lib/react-native-host-modules.cjs +1 -1
  64. package/dist-lib/react-native-host-modules.mjs +1 -1
  65. package/dist-lib/reap-browser.cjs +1 -1
  66. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  67. package/dist-lib/sdk.cjs +1 -1
  68. package/dist-lib/sdk.mjs +1 -1
  69. package/dist-lib/skills.cjs +16786 -6994
  70. package/dist-lib/swift-compile.cjs +2 -2
  71. package/dist-lib/swift-compile.mjs +2 -2
  72. package/dist-lib/swift-package.cjs +1 -1
  73. package/dist-lib/swift-package.mjs +1 -1
  74. package/dist-lib/swift-submit.cjs +1 -1
  75. package/dist-lib/swift-submit.mjs +1 -1
  76. package/dist-lib/swift-toolchain.cjs +1 -1
  77. package/dist-lib/swift.cjs +1 -1
  78. package/dist-lib/vite-swift.cjs +74 -6
  79. package/dist-lib/vite.cjs +3331 -181
  80. package/dist-lib/worklet-executable.cjs +1 -1
  81. package/dist-lib/worklet-executable.mjs +1 -1
  82. package/package.json +1 -1
  83. package/src/expo-native-workspace.ts +23 -63
  84. package/src/pbx-table.ts +200 -0
  85. package/src/pod-sources.ts +628 -0
  86. package/src/podfile-cocoapods.ts +40 -3
  87. package/src/pods-analysis.ts +488 -0
  88. package/src/pods-build-settings.ts +1015 -0
  89. package/src/pods-files.ts +478 -0
  90. package/src/pods-install.ts +475 -0
  91. package/src/pods-integration.ts +778 -0
  92. package/src/pods-post-install.ts +1811 -0
  93. package/src/pods-project.ts +2416 -0
  94. package/src/pods-scripts.ts +409 -0
  95. package/src/pods-targets.ts +757 -0
  96. package/src/pods-xcconfig.ts +198 -0
  97. package/src/podspec-cocoapods.ts +29 -3
  98. package/src/podspec-ruby-stdlib.ts +111 -10
  99. package/src/podspec-ruby.ts +52 -8
  100. package/src/swift-catalog-png.ts +75 -0
  101. package/src/swift-host.ts +4 -3
  102. package/src/swift-root-lock.ts +0 -10
  103. package/src/swift-source-pods.ts +29 -73
  104. package/src/turbo-source.ts +16 -37
package/src/swift-host.ts CHANGED
@@ -22,6 +22,7 @@ import { readNativeAppIdentityFromXcodeTarget } from './native-app-identity-proj
22
22
  import { parsePlistSource } from './plist'
23
23
  import { preparedSwiftCheckouts } from './prepared-xcode-phases'
24
24
  import { swiftBinaryModules } from './swift-binary-modules'
25
+ import { normalizeSwiftCatalogPng } from './swift-catalog-png'
25
26
  import {
26
27
  brotliCompressQ4,
27
28
  compileSwiftProjectUnit,
@@ -2202,9 +2203,6 @@ export function buildSwiftResourceTable(
2202
2203
  const pdfHash = createHash('sha256').update(pdfBytes).digest('hex')
2203
2204
  const raster = rasterizePdfFile(disk, pdfHash)
2204
2205
  bytes = raster.bytes
2205
- if (bytes.length > limits.imageBytes) {
2206
- throw new Error(`swift image ${file} raster exceeds the per-image cap`)
2207
- }
2208
2206
  ext = '.png'
2209
2207
  uploadName = `${path.posix.basename(file, path.posix.extname(file))}.png`
2210
2208
  } else {
@@ -2212,6 +2210,7 @@ export function buildSwiftResourceTable(
2212
2210
  throw new Error('swift image pack exceeds the compile service caps')
2213
2211
  }
2214
2212
  bytes = readPackageFile(project.packagePath, disk, limits.imageBytes)
2213
+ if (ext === '.png') bytes = normalizeSwiftCatalogPng(bytes)
2215
2214
  const svg =
2216
2215
  ext === '.svg'
2217
2216
  ? rasterizeSvgFile(disk, createHash('sha256').update(bytes).digest('hex'))
@@ -2223,6 +2222,8 @@ export function buildSwiftResourceTable(
2223
2222
  uploadName = `${path.posix.basename(file, path.posix.extname(file))}.png`
2224
2223
  }
2225
2224
  }
2225
+ if (bytes.length > limits.imageBytes)
2226
+ throw new Error(`swift image ${file} raster exceeds the per-image cap`)
2226
2227
  if (imageBytes + bytes.length > limits.imageTotalBytes) {
2227
2228
  throw new Error('swift image pack exceeds the compile service caps')
2228
2229
  }
@@ -191,16 +191,6 @@ export function swiftRootLocksDir(): string {
191
191
  return path.join(homedir(), '.peach', 'cache', 'swift-root-locks')
192
192
  }
193
193
 
194
- /** CocoaPods keeps one download cache per user and rewrites a pod's cache
195
- * entry with rsync --delete, so two installs fetching the same pod tear each
196
- * other's tree. installs on one Mac take turns on that cache. */
197
- export function withCocoaPodsCacheLock<T>(work: () => Promise<T>): Promise<T> {
198
- return withSwiftRootLock(
199
- process.env.CP_CACHE_DIR || path.join(homedir(), 'Library/Caches/CocoaPods'),
200
- work,
201
- )
202
- }
203
-
204
194
  /** runs `work` as the only process using a swift build root. the in-process
205
195
  * queue orders one process's requests; two processes sharing a root each
206
196
  * rewrite its sources and manifest, and swiftpm's own build lock only orders
@@ -3,9 +3,10 @@ import fs from 'node:fs'
3
3
  import path from 'node:path'
4
4
  import yaml from 'yaml'
5
5
  import { cacheDir } from './home-paths'
6
+ import { installPods } from './pods-install'
6
7
  import { compileInput, withXcodeProject, prepareXcodeSwiftPackages } from './swift-host'
7
8
  import { swiftManifestTargets } from './swift-package'
8
- import { withCocoaPodsCacheLock, withSwiftRootLock } from './swift-root-lock'
9
+ import { withSwiftRootLock } from './swift-root-lock'
9
10
  import { readXcodeAppTarget } from './xcode-project'
10
11
  import type { SwiftCompileInput } from './swift-compile'
11
12
 
@@ -13,7 +14,7 @@ const APP = 'PeachPodDependencies'
13
14
  const record = (value: unknown): value is Record<string, unknown> =>
14
15
  value !== null && typeof value === 'object' && !Array.isArray(value)
15
16
 
16
- // this is an empty host project; CocoaPods alone writes every dependency target.
17
+ // this is an empty host project; the pod install writes every dependency target.
17
18
  const project = `{
18
19
  archiveVersion = 1;
19
20
  objectVersion = 56;
@@ -158,7 +159,7 @@ export function appPodfileLock(appRoot: string): string | undefined {
158
159
  ].find((file) => fs.existsSync(file))
159
160
  }
160
161
 
161
- /** install only the locked closure of missing imports, then read CocoaPods' real project.
162
+ /** install only the locked closure of missing imports, then read the installed project.
162
163
  * `headerModules` are framework names C and C++ sources include (`<MMKVCore/MMKV.h>`)
163
164
  * that no collected file provides; they select only trunk pods, since a pod the
164
165
  * app installs from a local path is React Native's own or the provider itself. */
@@ -277,73 +278,33 @@ export async function collectSwiftSourcePods(
277
278
  )
278
279
  .digest('hex')
279
280
  const work = path.join(cacheDir(), 'swift-source-pods', key)
280
- return withSwiftRootLock(work, async (lease) => {
281
- fs.mkdirSync(path.join(work, `${APP}.xcodeproj`), { recursive: true })
282
- const runPod = async (args: string[]): Promise<string> => {
283
- // CocoaPods refuses a non UTF-8 locale, which a daemon or editor parent
284
- // may not set, so the child names one whatever its caller runs under.
285
- // runner-toolchain-platform: darwin
286
- const child = lease.spawn('pod', args, {
287
- cwd: work,
288
- env: { ...process.env, LANG: 'en_US.UTF-8', LC_ALL: 'en_US.UTF-8' },
289
- })
290
- child.stdin.end()
291
- const output: Buffer[] = []
292
- const errors: Buffer[] = []
293
- child.stdout.on('data', (bytes: Buffer) => output.push(bytes))
294
- child.stderr.on('data', (bytes: Buffer) => errors.push(bytes))
295
- await new Promise<void>((resolve, reject) => {
296
- child.once('error', (error) =>
297
- reject(
298
- new Error(
299
- `CocoaPods is required to install source dependencies: ${error.message}`,
300
- { cause: error },
301
- ),
302
- ),
303
- )
304
- child.once('close', (status) =>
305
- status === 0
306
- ? resolve()
307
- : reject(
308
- new Error(
309
- `CocoaPods command pod ${args.join(' ')} exited ${status}: ${Buffer.concat(errors).toString('utf8')}`,
310
- ),
311
- ),
281
+ return withSwiftRootLock(work, async () => {
282
+ const ios = path.join(work, 'ios')
283
+ const complete = path.join(work, 'pods-installed')
284
+ if (!fs.existsSync(complete)) {
285
+ fs.mkdirSync(path.join(ios, `${APP}.xcodeproj`), { recursive: true })
286
+ for (const root of [...roots].sort()) {
287
+ const { text } = await trunkSpecification(
288
+ lockFile,
289
+ root,
290
+ rootVersion(root),
291
+ specificationChecksums[root],
312
292
  )
293
+ fs.writeFileSync(path.join(ios, `${root}.podspec.json`), text)
294
+ }
295
+ fs.writeFileSync(path.join(ios, `${APP}.xcodeproj/project.pbxproj`), project)
296
+ fs.writeFileSync(path.join(ios, 'main.swift'), 'import Foundation\n')
297
+ fs.writeFileSync(path.join(ios, 'Podfile'), podfile)
298
+ await installPods(work, {
299
+ ...process.env,
300
+ LANG: 'en_US.UTF-8',
301
+ LC_ALL: 'en_US.UTF-8',
313
302
  })
314
- if (args[0] === 'install')
315
- fs.writeFileSync(
316
- path.join(work, 'pod-install.log'),
317
- Buffer.concat([...output, ...errors]),
318
- )
319
- return Buffer.concat(output).toString('utf8')
320
- }
321
- const installed = path.join(work, 'Pods/Manifest.lock')
322
- const complete = path.join(work, 'pod-install-complete')
323
- const installedChecksums: Record<string, string> = {}
324
- // checksum-pinned JSON binds the original prepare_command too; CocoaPods owns execution.
325
- for (const root of [...roots].sort()) {
326
- const file = path.join(work, `${root}.podspec.json`)
327
- const { text } = await trunkSpecification(
328
- lockFile,
329
- root,
330
- rootVersion(root),
331
- specificationChecksums[root],
332
- )
333
- if (!fs.existsSync(file)) fs.writeFileSync(file, text)
334
- // CocoaPods serializes external JSON specs before computing their installed checksum.
335
- const serialized = await runPod(['ipc', 'spec', file])
336
- installedChecksums[root] = createHash('sha1').update(serialized).digest('hex')
337
- }
338
- if (!fs.existsSync(complete)) {
339
- fs.writeFileSync(path.join(work, `${APP}.xcodeproj/project.pbxproj`), project)
340
- fs.writeFileSync(path.join(work, 'main.swift'), 'import Foundation\n')
341
- fs.writeFileSync(path.join(work, 'Podfile'), podfile)
342
- await withCocoaPodsCacheLock(() => runPod(['install']))
343
303
  fs.writeFileSync(complete, key)
344
304
  }
345
- const actualLock: unknown = yaml.parse(fs.readFileSync(installed, 'utf8'))
346
- const actual = lockedPods(actualLock)
305
+ const actual = lockedPods(
306
+ yaml.parse(fs.readFileSync(path.join(ios, 'Pods/Manifest.lock'), 'utf8')),
307
+ )
347
308
  if (
348
309
  JSON.stringify([...actual].sort(([a], [b]) => a.localeCompare(b))) !==
349
310
  JSON.stringify([...selected].sort(([a], [b]) => a.localeCompare(b)))
@@ -351,12 +312,7 @@ export async function collectSwiftSourcePods(
351
312
  throw new Error(
352
313
  `${work}: installed pod versions or dependencies differ from ${lockFile}`,
353
314
  )
354
- if (!record(actualLock) || !record(actualLock['SPEC CHECKSUMS']))
355
- throw new Error(`${work}: installed pod checksums missing`)
356
- for (const root of roots)
357
- if (actualLock['SPEC CHECKSUMS'][root] !== installedChecksums[root])
358
- throw new Error(`${work}: ${root} podspec checksum differs from ${lockFile}`)
359
- const workspace = path.join(work, `${APP}.xcworkspace`)
315
+ const workspace = path.join(ios, `${APP}.xcworkspace`)
360
316
  await prepareXcodeSwiftPackages(workspace, APP, 'Release')
361
317
  const app = readXcodeAppTarget(workspace, APP, 'Release', { installedPods: true })
362
318
  if (app.binaryFrameworks.length > 0)
@@ -386,7 +342,7 @@ export async function collectSwiftSourcePods(
386
342
  moduleRoots.has(module) &&
387
343
  !targets.some((target) => target.name === module)
388
344
  )
389
- throw new Error(`${work}: CocoaPods did not provide module ${module}`)
345
+ throw new Error(`${work}: the pod install did not provide module ${module}`)
390
346
  return input
391
347
  },
392
348
  )
@@ -1,4 +1,3 @@
1
- import { execFile } from 'node:child_process'
2
1
  // the original native source of an app's C++ TurboModules, collected as
3
2
  // CocoaPods builds it for iOS: every autolinked pod whose sources register a
4
3
  // module into React Native's global C++ module map
@@ -11,12 +10,9 @@ import { execFile } from 'node:child_process'
11
10
  import { createHash } from 'node:crypto'
12
11
  import fs from 'node:fs'
13
12
  import path from 'node:path'
14
- import { promisify } from 'node:util'
15
13
  import { trunkSpecificationFile, trunkVersions } from './cocoapods-trunk'
16
- import { rnxHomeDir } from './home-paths'
17
14
  import { installedNativeSources } from './installed-native-libraries'
18
-
19
- const execFileAsync = promisify(execFile)
15
+ import { podSourceRoot } from './pod-sources'
20
16
 
21
17
  // react-native 0.81 emits codegen specs directly under build/generated/ios;
22
18
  // other releases nest them in a ReactCodegen subdirectory. use whichever
@@ -535,7 +531,6 @@ async function resolveExternalTurboPod(
535
531
  /** the pod's own GCC_PREPROCESSOR_DEFINITIONS, which CocoaPods builds it with */
536
532
  defines: string[]
537
533
  } | null> {
538
- const baseDir = path.join(rnxHomeDir(), 'turbo-pods')
539
534
  const [only] = requirements
540
535
  let version =
541
536
  requirements.length === 1 &&
@@ -552,35 +547,7 @@ async function resolveExternalTurboPod(
552
547
  fs.readFileSync(await trunkSpecificationFile(name, version), 'utf8'),
553
548
  )
554
549
  if (!object(spec)) return null
555
- const source = object(spec.source) ? spec.source : null
556
- const gitUrl = typeof source?.git === 'string' ? source.git : null
557
- const tag = typeof source?.tag === 'string' ? source.tag : version
558
- if (!gitUrl || !gitUrl.startsWith('https://github.com/')) return null
559
- const treeDir = path.join(baseDir, 'trees', `${name}-${version}`)
560
- const marker = path.join(treeDir, '.extracted')
561
- if (!fs.existsSync(marker)) {
562
- const archiveUrl = `${gitUrl.replace(/\.git$/, '')}/archive/refs/tags/${tag}.tar.gz`
563
- const res = await fetch(archiveUrl)
564
- if (!res.ok) return null
565
- const bytes = new Uint8Array(await res.arrayBuffer())
566
- const archiveFile = path.join(baseDir, 'archives', `${name}-${version}.tar.gz`)
567
- fs.mkdirSync(path.dirname(archiveFile), { recursive: true })
568
- fs.writeFileSync(archiveFile, bytes)
569
- const staging = path.join(baseDir, 'staging', `${name}-${version}-${process.pid}`)
570
- fs.rmSync(staging, { recursive: true, force: true })
571
- fs.mkdirSync(staging, { recursive: true })
572
- await execFileAsync('tar', ['-xzf', archiveFile, '-C', staging])
573
- const entries = fs.readdirSync(staging)
574
- const extractedRoot =
575
- entries.length === 1 && fs.statSync(path.join(staging, entries[0]!)).isDirectory()
576
- ? path.join(staging, entries[0]!)
577
- : staging
578
- fs.rmSync(treeDir, { recursive: true, force: true })
579
- fs.mkdirSync(path.dirname(treeDir), { recursive: true })
580
- fs.renameSync(extractedRoot, treeDir)
581
- fs.rmSync(staging, { recursive: true, force: true })
582
- fs.writeFileSync(marker, version)
583
- }
550
+ const treeDir = await podSourceRoot(spec)
584
551
  const members = externalSpecMembers(spec, requestedSubspecs)
585
552
  const sourceGlobs = members.flatMap((member) => [
586
553
  ...stringList(member.source_files),
@@ -1667,9 +1634,19 @@ export async function collectTurboSources(options: {
1667
1634
  include.startsWith('hermes/') &&
1668
1635
  isHeaderFile(path.join(hermesHeaders, include))
1669
1636
  ) {
1637
+ // a public header link keeps its file's path below the pod's own header root
1638
+ const linked = fs.realpathSync(path.join(hermesHeaders, include))
1639
+ if (!linked.endsWith(`${path.sep}${include}`))
1640
+ throw new Error(`hermes-engine links ${include} to ${linked}`)
1670
1641
  alias(
1671
1642
  `${core}/include/${include}`,
1672
- original(TURBO_CORE_TARGET, 'hermes-engine', hermesHeaders, include, false),
1643
+ original(
1644
+ TURBO_CORE_TARGET,
1645
+ 'hermes-engine',
1646
+ linked.slice(0, -include.length - 1),
1647
+ include,
1648
+ false,
1649
+ ),
1673
1650
  )
1674
1651
  return
1675
1652
  }
@@ -2595,9 +2572,11 @@ export async function collectTurboSources(options: {
2595
2572
  // legacy bridge stops at this error.
2596
2573
  if (legacyBridge) {
2597
2574
  result.targets[0]!.cxxDefines = [...defines, 'USE_HERMES=1']
2575
+ // the public headers pod install links for hermes-engine, from its
2576
+ // source tree or from a prebuilt destroot alike
2598
2577
  hermesHeaders = path.join(
2599
2578
  options.projectRoot,
2600
- 'ios/Pods/hermes-engine/destroot/include',
2579
+ 'ios/Pods/Headers/Public/hermes-engine',
2601
2580
  )
2602
2581
  if (!fs.existsSync(path.join(hermesHeaders, 'hermes/hermes.h')))
2603
2582
  throw new Error(