peachsim 0.1.936 → 0.1.937

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 (79) 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/bundle-channel.cjs +48 -11
  16. package/dist-lib/capture-contract.cjs +1 -1
  17. package/dist-lib/capture-contract.mjs +1 -1
  18. package/dist-lib/cli-constants.cjs +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/detox/index.cjs +1 -1
  27. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  28. package/dist-lib/expo-swift-bundle.cjs +48 -11
  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 +48 -11
  33. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  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 +5 -4
  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 +5 -4
  49. package/dist-lib/native-app-identity.cjs +1 -1
  50. package/dist-lib/native-app-identity.mjs +1 -1
  51. package/dist-lib/native-firebase-metadata.cjs +1 -1
  52. package/dist-lib/native-firebase-metadata.mjs +1 -1
  53. package/dist-lib/plist.cjs +1 -1
  54. package/dist-lib/plist.mjs +1 -1
  55. package/dist-lib/profiles.cjs +1 -1
  56. package/dist-lib/public-brand.cjs +1 -1
  57. package/dist-lib/react-native-host-modules.cjs +1 -1
  58. package/dist-lib/react-native-host-modules.mjs +1 -1
  59. package/dist-lib/render-mode.cjs +1 -1
  60. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  61. package/dist-lib/sdk.cjs +1 -1
  62. package/dist-lib/sdk.mjs +1 -1
  63. package/dist-lib/skills.cjs +48 -11
  64. package/dist-lib/swift-compile.cjs +1 -1
  65. package/dist-lib/swift-compile.mjs +1 -1
  66. package/dist-lib/swift-package.cjs +1 -1
  67. package/dist-lib/swift-package.mjs +1 -1
  68. package/dist-lib/swift-submit.cjs +1 -1
  69. package/dist-lib/swift-submit.mjs +1 -1
  70. package/dist-lib/swift-toolchain.cjs +1 -1
  71. package/dist-lib/swift.cjs +1 -1
  72. package/dist-lib/vite-swift.cjs +48 -11
  73. package/dist-lib/vite.cjs +1 -1
  74. package/dist-lib/worklet-executable.cjs +1 -1
  75. package/dist-lib/worklet-executable.mjs +1 -1
  76. package/package.json +1 -1
  77. package/src/swift-host.ts +45 -7
  78. package/src/swift-standins.ts +18 -1
  79. package/src/xcode-project.ts +8 -5
package/src/swift-host.ts CHANGED
@@ -29,6 +29,7 @@ import { swiftImplicitResourcePaths, type SwiftPackageTarget } from './swift-pac
29
29
  import {
30
30
  REMOTE_CHECKOUTS,
31
31
  resolveSwiftPackages,
32
+ type SwiftPackageBinary,
32
33
  type SwiftPackageGap,
33
34
  type SwiftPackages,
34
35
  } from './swift-packages'
@@ -202,6 +203,8 @@ interface XcodeProjectEntry {
202
203
  standinKey: string
203
204
  packages: SwiftPackages
204
205
  standins: SwiftStandin[]
206
+ /** why a framework the project vendors got no stand-in, by name. */
207
+ projectGaps: Map<string, string>
205
208
  }
206
209
  }
207
210
 
@@ -233,7 +236,11 @@ export function openXcodeProject(
233
236
  function swiftPackages(
234
237
  entry: XcodeProjectEntry,
235
238
  app: XcodeAppTarget,
236
- ): { packages: SwiftPackages; standins: SwiftStandin[] } {
239
+ ): {
240
+ packages: SwiftPackages
241
+ standins: SwiftStandin[]
242
+ projectGaps: Map<string, string>
243
+ } {
237
244
  const stamp = (file: string | null) =>
238
245
  file && fs.existsSync(file) ? fs.statSync(file).mtimeMs : 0
239
246
  const key = JSON.stringify([
@@ -261,6 +268,7 @@ function swiftPackages(
261
268
  provided: entry.provided,
262
269
  }),
263
270
  standins: [],
271
+ projectGaps: new Map(),
264
272
  }
265
273
  entry.packages = cached
266
274
  }
@@ -269,7 +277,22 @@ function swiftPackages(
269
277
  // their reason with why no stand-in was built. surfaces peach already
270
278
  // ships are skipped up front, so no generated target overrides a shipped
271
279
  // module.
272
- const reached = cached.packages.binaries.filter((binary) => binary.reached)
280
+ // a framework the project vendors links straight into its target, so it
281
+ // stands in the same way a package's binary target does.
282
+ const vendored = app.binaryFrameworks.map(
283
+ ({ name, path: dir }): SwiftPackageBinary => ({
284
+ target: name,
285
+ source: 'the project',
286
+ url: null,
287
+ checksum: null,
288
+ dir,
289
+ reached: true,
290
+ }),
291
+ )
292
+ const reached = [
293
+ ...cached.packages.binaries.filter((binary) => binary.reached),
294
+ ...vendored,
295
+ ]
273
296
  if (entry.moduleRoot && entry.provided && reached.length > 0) {
274
297
  const resolved = swiftModuleToolchain(entry.moduleRoot)
275
298
  const toolchain = {
@@ -292,6 +315,12 @@ function swiftPackages(
292
315
  binaryGaps: built.gaps,
293
316
  })
294
317
  cached.standins = built.standins
318
+ cached.projectGaps = new Map(
319
+ vendored.flatMap(({ target }) => {
320
+ const gap = built.gaps.get(target)
321
+ return gap ? [[target, gap] as const] : []
322
+ }),
323
+ )
295
324
  cached.standinKey = generation
296
325
  }
297
326
  }
@@ -328,6 +357,8 @@ interface XcodeLayout {
328
357
  targets: (SwiftPackageTarget & { exclude: string[] })[]
329
358
  packages: SwiftPackages
330
359
  standins: SwiftStandin[]
360
+ /** why a framework the project vendors got no stand-in, by name. */
361
+ projectGaps: Map<string, string>
331
362
  /** the input directory each app and framework source compiles under. */
332
363
  targetDirs: Map<string, string>
333
364
  files: string[]
@@ -358,7 +389,7 @@ function xcodeLayout(root: string): XcodeLayout | null {
358
389
  mainActorIsolation: framework.mainActorIsolation,
359
390
  })
360
391
  }
361
- const { packages, standins } = swiftPackages(registered, app)
392
+ const { packages, standins, projectGaps } = swiftPackages(registered, app)
362
393
  for (const standin of standins)
363
394
  targets.push({
364
395
  name: standin.module,
@@ -401,6 +432,7 @@ function xcodeLayout(root: string): XcodeLayout | null {
401
432
  targets,
402
433
  packages,
403
434
  standins,
435
+ projectGaps,
404
436
  targetDirs,
405
437
  files: [...files].sort(),
406
438
  }
@@ -1052,10 +1084,16 @@ async function missingModulesMessage(
1052
1084
  ): Promise<string> {
1053
1085
  const layout = xcodeLayout(packagePath)
1054
1086
  const gaps = new Map<string, SwiftPackageGap>([
1055
- ...(layout?.app.binaryFrameworks ?? []).map(
1056
- (name) =>
1057
- [name, { source: 'the project', reason: 'a vendored binary framework' }] as const,
1058
- ),
1087
+ ...(layout?.app.binaryFrameworks ?? []).map(({ name }) => {
1088
+ const gap = layout?.projectGaps.get(name)
1089
+ return [
1090
+ name,
1091
+ {
1092
+ source: 'the project',
1093
+ reason: `a vendored binary framework${gap ? `; no stand-in: ${gap}` : ''}`,
1094
+ },
1095
+ ] as const
1096
+ }),
1059
1097
  ...[...missing.keys()].flatMap((name) =>
1060
1098
  UNPROVIDED_PLATFORM_MODULES[name]
1061
1099
  ? [
@@ -294,7 +294,21 @@ function peachModuleDirs(toolchain: Toolchain, imports: string[]): string[] {
294
294
  ],
295
295
  moduleRoot,
296
296
  )
297
- return [path.join(moduleRoot, '.build', TRIPLE, 'release', 'Modules')]
297
+ // a c target's module map sits in its own build directory, where swiftpm
298
+ // generated it; a peach module re-exporting one fails to load without it
299
+ const release = path.join(moduleRoot, '.build', TRIPLE, 'release')
300
+ return [
301
+ path.join(release, 'Modules'),
302
+ ...fs
303
+ .readdirSync(release)
304
+ .filter(
305
+ (name) =>
306
+ name.endsWith('.build') &&
307
+ fs.existsSync(path.join(release, name, 'module.modulemap')),
308
+ )
309
+ .sort()
310
+ .map((name) => path.join(release, name)),
311
+ ]
298
312
  }
299
313
 
300
314
  // an iOS interface read for wasm: its own flags target wasm, and objective-c
@@ -735,6 +749,9 @@ function binaryStandins(
735
749
  provided: ReadonlySet<string>,
736
750
  ): SwiftStandin[] | string {
737
751
  if (provided.has(binary.target)) return []
752
+ // a local artifact a build step writes is absent from a fresh checkout
753
+ if (!binary.url && !fs.existsSync(binary.dir))
754
+ return `${path.basename(binary.dir)} is not on disk; build or fetch it, then run again`
738
755
  let all: Surface[]
739
756
  let digest: string
740
757
  try {
@@ -154,8 +154,8 @@ export interface XcodeAppTarget extends XcodeModuleTarget {
154
154
  linkedProducts: SwiftLinkedProduct[]
155
155
  /** local package directories the workspace or a project references. */
156
156
  localPackageDirs: string[]
157
- /** prebuilt frameworks and xcframeworks the projects vendor and link, by name. */
158
- binaryFrameworks: string[]
157
+ /** prebuilt frameworks and xcframeworks the projects vendor and link. */
158
+ binaryFrameworks: { name: string; path: string }[]
159
159
  /** the Package.resolved pinning the remote packages' revisions, when resolved. */
160
160
  packageResolved: string | null
161
161
  /** every application target in the workspace, for a chooser. */
@@ -911,7 +911,7 @@ export function readXcodeAppTarget(input: string, targetName?: string): XcodeApp
911
911
  ),
912
912
  ]
913
913
  const linkedProducts: SwiftLinkedProduct[] = []
914
- const binaryFrameworks = new Set<string>()
914
+ const binaryFrameworks = new Map<string, string>()
915
915
  for (const { project, target } of order) {
916
916
  const productDependencies = [
917
917
  ...list(target.packageProductDependencies),
@@ -963,7 +963,8 @@ export function readXcodeAppTarget(input: string, targetName?: string): XcodeApp
963
963
  tree === 'DEVELOPER_DIR'
964
964
  )
965
965
  continue
966
- binaryFrameworks.add(name)
966
+ const resolved = fileId ? project.resolvePath(fileId) : null
967
+ if (resolved && !binaryFrameworks.has(name)) binaryFrameworks.set(name, resolved)
967
968
  }
968
969
  }
969
970
  }
@@ -999,7 +1000,9 @@ export function readXcodeAppTarget(input: string, targetName?: string): XcodeApp
999
1000
  localPackageDirs: [
1000
1001
  ...new Set(localPackageDirs.map((dir) => fs.realpathSync(dir))),
1001
1002
  ].sort(),
1002
- binaryFrameworks: [...binaryFrameworks].sort(),
1003
+ binaryFrameworks: [...binaryFrameworks]
1004
+ .map(([name, file]) => ({ name, path: file }))
1005
+ .sort((left, right) => left.name.localeCompare(right.name)),
1003
1006
  packageResolved: fs.existsSync(resolvedFile) ? resolvedFile : null,
1004
1007
  appTargets: appTargetNames,
1005
1008
  }