peachsim 0.1.751 → 0.1.753

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 (74) hide show
  1. package/dist-lib/agent-daemon-client.cjs +1 -1
  2. package/dist-lib/agent-events.cjs +1 -1
  3. package/dist-lib/agent-identity.cjs +1 -1
  4. package/dist-lib/agent-sessions.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/capture-contract.cjs +1 -1
  16. package/dist-lib/capture-contract.mjs +1 -1
  17. package/dist-lib/cli-constants.cjs +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/detox/index.cjs +1 -1
  26. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  27. package/dist-lib/home-paths.cjs +1 -1
  28. package/dist-lib/host/bridge-host.cjs +571 -300
  29. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  30. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  31. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  32. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  33. package/dist-lib/host/websocket-proxy.cjs +1 -1
  34. package/dist-lib/index.cjs +906 -135
  35. package/dist-lib/jump-to-source-babel.cjs +1 -1
  36. package/dist-lib/jump-to-source-native.cjs +1 -1
  37. package/dist-lib/kotlin-host.cjs +1 -1
  38. package/dist-lib/menu.cjs +1 -1
  39. package/dist-lib/menu.mjs +1 -1
  40. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  41. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  42. package/dist-lib/metro-production-bundle.cjs +1 -1
  43. package/dist-lib/metro-production-bundle.mjs +1 -1
  44. package/dist-lib/metro.cjs +907 -136
  45. package/dist-lib/native-app-identity.cjs +1 -1
  46. package/dist-lib/native-app-identity.mjs +1 -1
  47. package/dist-lib/native-firebase-metadata.cjs +1 -1
  48. package/dist-lib/native-firebase-metadata.mjs +1 -1
  49. package/dist-lib/plist.cjs +1 -1
  50. package/dist-lib/plist.mjs +1 -1
  51. package/dist-lib/profiles.cjs +1 -1
  52. package/dist-lib/public-brand.cjs +1 -1
  53. package/dist-lib/react-native-host-modules.cjs +1 -1
  54. package/dist-lib/react-native-host-modules.mjs +1 -1
  55. package/dist-lib/render-mode.cjs +1 -1
  56. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  57. package/dist-lib/sdk.cjs +1 -1
  58. package/dist-lib/sdk.mjs +1 -1
  59. package/dist-lib/skills.cjs +767 -574
  60. package/dist-lib/swift-compile.cjs +1 -1
  61. package/dist-lib/swift-compile.mjs +1 -1
  62. package/dist-lib/swift-package.cjs +1 -1
  63. package/dist-lib/swift-package.mjs +1 -1
  64. package/dist-lib/swift-submit.cjs +1 -1
  65. package/dist-lib/swift-submit.mjs +1 -1
  66. package/dist-lib/swift-toolchain.cjs +1 -1
  67. package/dist-lib/swift.cjs +1 -1
  68. package/dist-lib/vite-swift.cjs +465 -194
  69. package/dist-lib/vite.cjs +1 -1
  70. package/package.json +1 -1
  71. package/src/home-paths.ts +1 -0
  72. package/src/native-firebase-config.ts +17 -111
  73. package/src/swift-host.ts +51 -18
  74. package/src/xcode-project.ts +590 -245
package/dist-lib/vite.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.751 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.753 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
2
2
  let __sootsim_import_meta_url = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; } catch {}
3
3
  "use strict";
4
4
  var __create = Object.create;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "peachsim",
3
- "version": "0.1.751",
3
+ "version": "0.1.753",
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",
package/src/home-paths.ts CHANGED
@@ -230,6 +230,7 @@ export function cliUpdateFilePath(): string {
230
230
  // write one persisted value per choice.
231
231
 
232
232
  export interface SharedConfig {
233
+ homeScreen?: import('@peach/globals').PeachHomeScreenConfig
233
234
  telemetry?: boolean
234
235
  onboardingVersion?: number
235
236
  simulatorDriver?: 'electron' | 'playwright'
@@ -5,6 +5,7 @@ import { createRequire } from 'node:module'
5
5
  import path from 'node:path'
6
6
  import { isRecord } from './is-record'
7
7
  import { parsePlistSource } from './plist'
8
+ import { listXcodeAppTargets, readXcodeAppTarget } from './xcode-project'
8
9
 
9
10
  export function readNativeFirebaseConfig(
10
11
  projectRoot: string,
@@ -52,114 +53,14 @@ export function readNativeFirebaseConfig(
52
53
  if (projects.length > 1)
53
54
  throw new Error('native Firebase configuration requires a selected Xcode project')
54
55
  if (projects.length === 1) {
55
- const require = createRequire(path.join(projectRoot, 'package.json'))
56
- const xcode: unknown = require('xcode')
57
- if (!isRecord(xcode) || typeof xcode.project !== 'function')
58
- throw new Error('native Xcode project parser is unavailable')
59
- const project: unknown = Reflect.apply(xcode.project, xcode, [
60
- path.join(iosRoot, projects[0].name, 'project.pbxproj'),
61
- ])
62
- if (!isRecord(project) || typeof project.parseSync !== 'function')
63
- throw new Error('native Xcode project is malformed')
64
- Reflect.apply(project.parseSync, project, [])
65
- const hash = project.hash
66
- const native = isRecord(hash) ? hash.project : null
67
- const objects = isRecord(native) ? native.objects : null
68
- if (!isRecord(objects)) throw new Error('native Xcode objects are malformed')
69
- const unquote = (value: unknown) =>
70
- typeof value === 'string' ? value.replace(/^"|"$/g, '') : ''
71
- const targets = isRecord(objects.PBXNativeTarget)
72
- ? Object.values(objects.PBXNativeTarget).filter(
73
- (target) =>
74
- isRecord(target) &&
75
- unquote(target.productType) === 'com.apple.product-type.application',
76
- )
77
- : []
78
- if (targets.length > 1)
56
+ const xcodeproj = path.join(iosRoot, projects[0].name)
57
+ const appTargets = listXcodeAppTargets(xcodeproj)
58
+ if (appTargets.length > 1)
79
59
  throw new Error('native Firebase configuration requires a selected app target')
80
- const target = targets[0]
81
- if (isRecord(target) && Array.isArray(target.buildPhases)) {
82
- const buildPhases: readonly unknown[] = target.buildPhases
83
- const filePaths = new Map<string, Set<string>>()
84
- const groups = isRecord(objects.PBXGroup) ? objects.PBXGroup : {}
85
- const references = isRecord(objects.PBXFileReference)
86
- ? objects.PBXFileReference
87
- : {}
88
- const nativeProjects = isRecord(objects.PBXProject)
89
- ? Object.values(objects.PBXProject)
90
- : []
91
- const roots = nativeProjects.filter(isRecord).map((value) => value.mainGroup)
92
- const pending = roots
93
- .filter((id): id is string => typeof id === 'string')
94
- .map((id) => ({ id, base: iosRoot }))
95
- const visited = new Map<string, string>()
96
- while (pending.length) {
97
- const item = pending.pop()
98
- if (!item) break
99
- const previous = visited.get(item.id)
100
- if (previous !== undefined) {
101
- if (previous !== item.base)
102
- throw new Error('native Xcode group has ambiguous parents')
103
- continue
104
- }
105
- visited.set(item.id, item.base)
106
- const group = groups[item.id]
107
- if (!isRecord(group) || !Array.isArray(group.children)) continue
108
- const sourceTree = unquote(group.sourceTree)
109
- if (sourceTree && sourceTree !== '<group>' && sourceTree !== 'SOURCE_ROOT')
110
- continue
111
- const directory = path.resolve(
112
- sourceTree === 'SOURCE_ROOT' ? iosRoot : item.base,
113
- unquote(group.path),
114
- )
115
- for (const child of group.children) {
116
- if (!isRecord(child) || typeof child.value !== 'string') continue
117
- if (isRecord(groups[child.value])) {
118
- pending.push({ id: child.value, base: directory })
119
- continue
120
- }
121
- const file = references[child.value]
122
- if (!isRecord(file)) continue
123
- const tree = unquote(file.sourceTree)
124
- if (tree !== '<group>' && tree !== 'SOURCE_ROOT') continue
125
- const filePath = path.resolve(
126
- tree === 'SOURCE_ROOT' ? iosRoot : directory,
127
- unquote(file.path),
128
- )
129
- const values = filePaths.get(child.value) ?? new Set<string>()
130
- values.add(filePath)
131
- filePaths.set(child.value, values)
132
- }
133
- }
134
- const buildFiles = isRecord(objects.PBXBuildFile) ? objects.PBXBuildFile : {}
135
- const filesInPhase = (section: unknown, name: RegExp): string[] => {
136
- if (!isRecord(section)) return []
137
- const paths: string[] = []
138
- for (const phase of buildPhases) {
139
- if (!isRecord(phase) || typeof phase.value !== 'string') continue
140
- const value = section[phase.value]
141
- if (!isRecord(value) || !Array.isArray(value.files)) continue
142
- for (const entry of value.files) {
143
- if (!isRecord(entry) || typeof entry.value !== 'string') continue
144
- const file = buildFiles[entry.value]
145
- if (!isRecord(file) || typeof file.fileRef !== 'string') continue
146
- const reference = references[file.fileRef]
147
- if (
148
- !isRecord(reference) ||
149
- !name.test(path.basename(unquote(reference.path)))
150
- )
151
- continue
152
- const candidates = filePaths.get(file.fileRef)
153
- if (!candidates || candidates.size !== 1)
154
- throw new Error('native Firebase build resource path is unresolved')
155
- paths.push(...candidates)
156
- }
157
- }
158
- return paths
159
- }
160
- const delegates = filesInPhase(
161
- objects.PBXSourcesBuildPhase,
162
- /^AppDelegate\.(swift|mm|m)$/,
60
+ if (appTargets.length === 1) {
61
+ const app = readXcodeAppTarget(xcodeproj, appTargets[0])
62
+ const delegates = app.allSources.filter((file) =>
63
+ /^AppDelegate\.(swift|mm|m)$/.test(path.basename(file)),
163
64
  )
164
65
  const defaultConfigured = delegates.some((file) => {
165
66
  const source = fs
@@ -195,15 +96,20 @@ export function readNativeFirebaseConfig(
195
96
  return true
196
97
  })
197
98
  if (defaultConfigured) {
198
- const resources = filesInPhase(
199
- objects.PBXResourcesBuildPhase,
200
- /^GoogleService-Info\.plist$/,
99
+ const resources = app.resources.filter((file) =>
100
+ /^GoogleService-Info\.plist$/.test(path.basename(file)),
201
101
  )
202
102
  if (resources.length !== 1)
203
103
  throw new Error(
204
104
  'native Firebase default initialization requires one GoogleService-Info.plist build resource',
205
105
  )
206
- config.ios = { googleServicesFile: path.relative(projectRoot, resources[0]) }
106
+ // the target's paths are canonical, so the base must be too
107
+ config.ios = {
108
+ googleServicesFile: path.relative(
109
+ fs.realpathSync(projectRoot),
110
+ resources[0],
111
+ ),
112
+ }
207
113
  }
208
114
  }
209
115
  }
package/src/swift-host.ts CHANGED
@@ -198,7 +198,7 @@ export function openXcodeProject(
198
198
  moduleRoot: string | undefined,
199
199
  ): string {
200
200
  const app = readXcodeAppTarget(xcodeproj, target)
201
- const root = fs.realpathSync(app.projectDir)
201
+ const root = app.rootDir
202
202
  xcodeProjects.set(root, {
203
203
  xcodeproj,
204
204
  target: app.name,
@@ -219,7 +219,7 @@ function remotePackages(entry: XcodeProjectEntry, app: XcodeAppTarget): RemotePa
219
219
  entry.remote = {
220
220
  key,
221
221
  packages: resolveRemotePackages(
222
- fs.realpathSync(app.projectDir),
222
+ app.rootDir,
223
223
  app.packageResolved,
224
224
  app.remoteProducts,
225
225
  entry.provided,
@@ -230,17 +230,21 @@ function remotePackages(entry: XcodeProjectEntry, app: XcodeAppTarget): RemotePa
230
230
  }
231
231
 
232
232
  // the app target's sources compile as one executable target under this
233
- // directory, each at its project-relative path, so a diagnostic still names
234
- // the file; local package targets keep their own project-relative paths.
233
+ // directory, each at its root-relative path, so a diagnostic still names the
234
+ // file; each framework target compiles as one target under its module's
235
+ // directory below XCODE_FRAMEWORKS_DIR; local package targets keep their own
236
+ // root-relative paths.
235
237
  export const XCODE_APP_DIR = '__app__'
238
+ const XCODE_FRAMEWORKS_DIR = '__frameworks__'
236
239
  // remote package checkouts compile here: swiftpm owns `.build` in the
237
240
  // compile's package root as its scratch directory.
238
241
  const XCODE_PACKAGES_DIR = '__packages__'
239
242
  const CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(path.sep).join(path.posix.sep)}/`
240
243
 
241
- // the compile input key of a project-relative path in an xcode layout.
242
- function xcodeInputKey(appSources: Set<string>, file: string, relative: string): string {
243
- if (appSources.has(file)) return path.posix.join(XCODE_APP_DIR, relative)
244
+ // the compile input key of a root-relative path in an xcode layout.
245
+ function xcodeInputKey(layout: XcodeLayout, file: string, relative: string): string {
246
+ const owner = layout.targetDirs.get(file)
247
+ if (owner) return path.posix.join(owner, relative)
244
248
  return relative.startsWith(CHECKOUTS_PREFIX)
245
249
  ? path.posix.join(XCODE_PACKAGES_DIR, relative.slice(CHECKOUTS_PREFIX.length))
246
250
  : relative
@@ -252,6 +256,8 @@ interface XcodeLayout {
252
256
  targets: ReturnType<typeof swiftManifestTargets>
253
257
  /** remote products that cannot compile, with why. */
254
258
  unavailable: RemotePackages['unavailable']
259
+ /** the input directory each app and framework source compiles under. */
260
+ targetDirs: Map<string, string>
255
261
  files: string[]
256
262
  }
257
263
 
@@ -259,17 +265,40 @@ function xcodeLayout(root: string): XcodeLayout | null {
259
265
  const registered = xcodeProjects.get(root)
260
266
  if (!registered) return null
261
267
  const app = readXcodeAppTarget(registered.xcodeproj, registered.target)
262
- const files = new Set([app.pbxproj, ...app.sources, ...app.resources])
268
+ const files = new Set([...app.pbxprojs, ...app.sources, ...app.resources])
263
269
  if (app.infoPlistFile) files.add(app.infoPlistFile)
270
+ const targetDirs = new Map(app.sources.map((file) => [file, XCODE_APP_DIR]))
264
271
  const targets: XcodeLayout['targets'] = []
272
+ for (const framework of app.frameworks) {
273
+ const dir = path.posix.join(XCODE_FRAMEWORKS_DIR, framework.moduleName)
274
+ for (const file of framework.sources) {
275
+ if (targetDirs.has(file)) continue
276
+ targetDirs.set(file, dir)
277
+ files.add(file)
278
+ }
279
+ targets.push({
280
+ name: framework.moduleName,
281
+ path: dir,
282
+ executable: false,
283
+ resources: false,
284
+ languageMode: framework.languageMode,
285
+ mainActorIsolation: framework.mainActorIsolation,
286
+ })
287
+ }
265
288
  for (const dir of app.localPackages) {
266
- const manifest = path.join(dir, 'Package.swift')
267
- files.add(manifest)
289
+ const manifestFile = path.join(dir, 'Package.swift')
290
+ files.add(manifestFile)
291
+ const manifest = fs.readFileSync(manifestFile, 'utf8')
268
292
  const prefix = path.relative(root, dir).split(path.sep).join(path.posix.sep)
269
- const all = packageFiles(dir).map((file) =>
270
- path.relative(dir, file).split(path.sep).join(path.posix.sep),
293
+ // only target directories: a package at a repository's root holds the
294
+ // whole app beside its sources
295
+ const declared = swiftManifestTargets(manifest).filter((target) => !target.executable)
296
+ const all = declared.flatMap((target) =>
297
+ sourceTreeFiles(path.join(dir, target.path), root).map((file) =>
298
+ path.relative(dir, file).split(path.sep).join(path.posix.sep),
299
+ ),
271
300
  )
272
- for (const target of swiftManifestTargets(fs.readFileSync(manifest, 'utf8'), all)) {
301
+ for (const target of swiftManifestTargets(manifest, all)) {
273
302
  if (target.executable) continue
274
303
  targets.push({ ...target, path: path.posix.join(prefix, target.path) })
275
304
  for (const relative of all) {
@@ -295,6 +324,7 @@ function xcodeLayout(root: string): XcodeLayout | null {
295
324
  app,
296
325
  targets,
297
326
  unavailable: remote.unavailable,
327
+ targetDirs,
298
328
  files: [...files].sort(),
299
329
  }
300
330
  }
@@ -323,7 +353,11 @@ function xcodeManifest(layout: XcodeLayout): string {
323
353
  function packageFiles(root: string): string[] {
324
354
  const canonicalRoot = fs.realpathSync(root)
325
355
  const xcode = xcodeLayout(canonicalRoot)
326
- if (xcode) return xcode.files
356
+ return xcode ? xcode.files : sourceTreeFiles(canonicalRoot, canonicalRoot)
357
+ }
358
+
359
+ // every input file under `dir`, which must stay inside `canonicalRoot`.
360
+ function sourceTreeFiles(dir: string, canonicalRoot: string): string[] {
327
361
  const found: string[] = []
328
362
  const walk = (dir: string): void => {
329
363
  for (const entry of fs
@@ -356,7 +390,7 @@ function packageFiles(root: string): string[] {
356
390
  }
357
391
  }
358
392
  }
359
- walk(canonicalRoot)
393
+ if (fs.existsSync(dir)) walk(fs.realpathSync(dir))
360
394
  return found
361
395
  }
362
396
 
@@ -682,12 +716,11 @@ export function icuUrl(origin: string, artifact: SwiftArtifact): string {
682
716
 
683
717
  function packageSources(packagePath: string): Record<string, string> {
684
718
  const xcode = xcodeLayout(packagePath)
685
- const appSources = new Set(xcode?.app.sources)
686
719
  const files: Record<string, string> = {}
687
720
  for (const file of sourceFiles(packagePath)) {
688
721
  const relative = path.relative(packagePath, file).split(path.sep).join(path.posix.sep)
689
722
  if (xcode && path.basename(file) === 'Package.swift') continue
690
- files[xcode ? xcodeInputKey(appSources, file, relative) : relative] = readPackageFile(
723
+ files[xcode ? xcodeInputKey(xcode, file, relative) : relative] = readPackageFile(
691
724
  packagePath,
692
725
  file,
693
726
  MAX_SWIFT_COMPILE_SOURCE_BYTES,
@@ -867,7 +900,7 @@ export function swiftApiGapReport(output: string): string | null {
867
900
  if (!diagnostic || seen.has(line)) continue
868
901
  seen.add(line)
869
902
  const file = diagnostic[1]!
870
- .replace(new RegExp(`^${XCODE_APP_DIR}/`), '')
903
+ .replace(new RegExp(`^(?:${XCODE_APP_DIR}|${XCODE_FRAMEWORKS_DIR}/[^/]+)/`), '')
871
904
  .replace(new RegExp(`^${XCODE_PACKAGES_DIR}/`), '')
872
905
  const message = diagnostic[4]!
873
906
  const rule = API_GAP_PATTERNS.find(([pattern]) => pattern.test(message))