peachsim 0.1.774 → 0.1.776

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 (76) 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 +1790 -810
  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 +1 -1
  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 +1 -1
  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 +2158 -1165
  60. package/dist-lib/swift-compile.cjs +54 -15
  61. package/dist-lib/swift-compile.mjs +52 -15
  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 +1404 -424
  69. package/dist-lib/vite.cjs +1 -1
  70. package/package.json +1 -1
  71. package/src/swift-compile.ts +65 -18
  72. package/src/swift-distribution.lock.json +11 -11
  73. package/src/swift-host.ts +60 -11
  74. package/src/swift-packages.ts +18 -3
  75. package/src/swift-standin-emit.ts +12 -5
  76. package/src/swift-standins.ts +546 -0
package/dist-lib/vite.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! rnx v0.1.774 | (c) 2026 Tamagui LLC | Proprietary — see LICENSE */
1
+ /*! rnx v0.1.776 | (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.774",
3
+ "version": "0.1.776",
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",
@@ -142,13 +142,18 @@ export function swiftModuleInputFiles(root: string): string[] {
142
142
  // flag reaches the driver but the plugin never loads), so every build loads
143
143
  // both with -Xswiftc, as scripts/build.sh does for the fixtures. their
144
144
  // sources are under Sources/, which the artifact hash already covers.
145
- async function ensureMacroPlugins(
146
- moduleRoot: string,
147
- toolchainBin: string,
148
- ): Promise<string[]> {
145
+ /** the host macro plugin libraries a module root compiles with, and whether a
146
+ * checkout's must be rebuilt (scripts/build-preview-plugin.sh) first. */
147
+ export function swiftMacroPlugins(moduleRoot: string): {
148
+ libraries: string[]
149
+ stale: boolean
150
+ } {
149
151
  const distribution = swiftDistributionAt(moduleRoot)
150
152
  if (distribution)
151
- return distribution.plugins.map((plugin) => path.join(moduleRoot, plugin))
153
+ return {
154
+ libraries: distribution.plugins.map((plugin) => path.join(moduleRoot, plugin)),
155
+ stale: false,
156
+ }
152
157
  const dir = path.join(moduleRoot, '.build/host/RnxPreviewMacros')
153
158
  // linux names a plugin's module from lib<Module>.so
154
159
  const ext = process.platform === 'darwin' ? 'dylib' : 'so'
@@ -162,18 +167,28 @@ async function ensureMacroPlugins(
162
167
  source: path.join(moduleRoot, 'Sources/FoundationMacros/PredicateMacro.swift'),
163
168
  },
164
169
  ]
165
- const stale = plugins.some(
166
- ({ library, source }) =>
167
- !existsSync(library) || statSync(source).mtimeMs > statSync(library).mtimeMs,
168
- )
170
+ return {
171
+ libraries: plugins.map(({ library }) => library),
172
+ stale: plugins.some(
173
+ ({ library, source }) =>
174
+ !existsSync(library) || statSync(source).mtimeMs > statSync(library).mtimeMs,
175
+ ),
176
+ }
177
+ }
178
+
179
+ async function ensureMacroPlugins(
180
+ moduleRoot: string,
181
+ toolchainBin: string,
182
+ ): Promise<string[]> {
183
+ const { libraries, stale } = swiftMacroPlugins(moduleRoot)
169
184
  if (stale) {
170
185
  await run('sh', [
171
186
  path.join(moduleRoot, 'scripts/build-preview-plugin.sh'),
172
187
  toolchainBin,
173
- plugins[0].library,
188
+ libraries[0],
174
189
  ])
175
190
  }
176
- return plugins.map(({ library }) => library)
191
+ return libraries
177
192
  }
178
193
 
179
194
  const linkedModuleDigests = new Map<string, { stamp: string; digest: Buffer }>()
@@ -271,6 +286,15 @@ const OPTIONAL_FRAMEWORK_DEPENDENCIES: Record<string, string[]> = {
271
286
  FBAEMKit: ['FBSDKCoreKit_Basics'],
272
287
  FBSDKCoreKit_Basics: [],
273
288
  Intercom: [],
289
+ FirebaseCore: [],
290
+ FirebaseSharedSwift: ["FirebaseCore"],
291
+ FirebaseFirestoreInternal: ["FirebaseCore"],
292
+ FirebaseAnalytics: ["FirebaseCore"],
293
+ FirebaseAppCheck: ["FirebaseCore"],
294
+ FirebaseAuth: ["FirebaseCore"],
295
+ FirebaseCrashlytics: ["FirebaseCore"],
296
+ FirebaseFirestore: ["FirebaseCore", "FirebaseSharedSwift", "FirebaseFirestoreInternal"],
297
+ FirebaseStorage: ["FirebaseCore"],
274
298
  FBAudienceNetwork: [],
275
299
  }
276
300
  const OPTIONAL_FRAMEWORKS = new Set(Object.keys(OPTIONAL_FRAMEWORK_DEPENDENCIES))
@@ -403,6 +427,35 @@ export function swiftPeachModules(moduleRoot: string): string[] {
403
427
  ].map((match) => match[1]!)
404
428
  }
405
429
 
430
+ const sdkPaths = new Map<string, { sysroot: string; resources: string }>()
431
+
432
+ /** the wasm SDK's sysroot and swift resource directory, as swiftpm reads them. */
433
+ export function swiftSdkPaths(
434
+ moduleRoot: string,
435
+ toolchainBin: string,
436
+ ): { sysroot: string; resources: string } {
437
+ const sdk = swiftModuleSdk(moduleRoot).wasmSdkId
438
+ const key = `${toolchainBin}\0${sdk}`
439
+ const cached = sdkPaths.get(key)
440
+ if (cached) return cached
441
+ const configuration = execFileSync(
442
+ path.join(toolchainBin, 'swift'),
443
+ ['sdk', 'configure', '--show-configuration', sdk, 'wasm32-unknown-wasip1'],
444
+ { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] },
445
+ )
446
+ const field = (name: string) => {
447
+ const value = new RegExp(`^${name}:\\s*(.+)$`, 'm').exec(configuration)?.[1]?.trim()
448
+ if (!value) throw new Error(`swift sdk ${sdk} reports no ${name}`)
449
+ return value
450
+ }
451
+ const paths = {
452
+ sysroot: field('sdkRootPath'),
453
+ resources: field('swiftResourcesPath'),
454
+ }
455
+ sdkPaths.set(key, paths)
456
+ return paths
457
+ }
458
+
406
459
  const availableModules = new Map<string, Set<string>>()
407
460
 
408
461
  /**
@@ -418,13 +471,7 @@ export function swiftAvailableModules(
418
471
  const cached = availableModules.get(key)
419
472
  if (cached) return cached
420
473
  const modules = new Set(swiftPeachModules(moduleRoot))
421
- const configuration = execFileSync(
422
- path.join(toolchainBin, 'swift'),
423
- ['sdk', 'configure', '--show-configuration', sdk, 'wasm32-unknown-wasip1'],
424
- { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] },
425
- )
426
- const resources = /^swiftResourcesPath:\s*(.+)$/m.exec(configuration)?.[1]?.trim()
427
- if (!resources) throw new Error(`swift sdk ${sdk} reports no swiftResourcesPath`)
474
+ const { resources } = swiftSdkPaths(moduleRoot, toolchainBin)
428
475
  for (const entry of readdirSync(path.join(resources, 'wasi'))) {
429
476
  if (entry.endsWith('.swiftmodule'))
430
477
  modules.add(entry.slice(0, -'.swiftmodule'.length))
@@ -1,22 +1,22 @@
1
1
  {
2
- "id": "d27a9b6d2aee64d4",
2
+ "id": "487239d0e061dfaa",
3
3
  "release": "swift-6.3-RELEASE",
4
- "wasmSdkId": "swift-6.3-RELEASE_wasm-peach-41921598-peach-26be2317",
5
- "wasmSdkUrl": "https://r2.sootsim.com/swift-wasm-sdk/swift-6.3-RELEASE_wasm-peach-41921598-peach-26be2317.artifactbundle.tar.gz",
6
- "wasmSdkChecksum": "f34f29d9426f42b04d1c38585d61cf38ecb5357f4287c4843870bec63de6b08c",
7
- "source": "8f9873608a950d832ec49cf4bbc32fb65689e5f7",
4
+ "wasmSdkId": "swift-6.3-RELEASE_wasm-peach-41921598-peach-209157d6",
5
+ "wasmSdkUrl": "https://r2.sootsim.com/swift-wasm-sdk/swift-6.3-RELEASE_wasm-peach-41921598-peach-209157d6.artifactbundle.tar.gz",
6
+ "wasmSdkChecksum": "2b291ff21683ba1063c7362fd5a244fe22af704315f20563abd68c8b4a19b089",
7
+ "source": "a3d70fe1a5bcc462e1362c11285327d180e54e28",
8
8
  "hosts": {
9
9
  "darwin-arm64": {
10
- "sha256": "b7fa68565ae1be6ee7964390b4d07949228894ac4a06fe7f58e4238dd0650197",
11
- "size": 19319227
10
+ "sha256": "361390f1d2f9fee9577fc2253ce67ad40b09bb7946e8e6f3e034f3dc6670fd5b",
11
+ "size": 31682452
12
12
  },
13
13
  "linux-x64": {
14
- "sha256": "733ebee3a16142c97575532daf49990df57171ede17de6530a9c5906471d96ca",
15
- "size": 19324099
14
+ "sha256": "d36ab74f444591458f72dc1d0c3c4032ee1620585a12ce3635fbd6adb8c9a0c8",
15
+ "size": 31688001
16
16
  },
17
17
  "linux-arm64": {
18
- "sha256": "84b258d95a71536392f25d2afb8c40835df771594a2c0e42049ee33781ce78ad",
19
- "size": 19323438
18
+ "sha256": "b3f167eb3cbfcf06f1ccf43e3b2cdd94c1a949a0d5ffea03a065a724d306caea",
19
+ "size": 31686984
20
20
  }
21
21
  }
22
22
  }
package/src/swift-host.ts CHANGED
@@ -33,6 +33,7 @@ import {
33
33
  type SwiftPackageGap,
34
34
  type SwiftPackages,
35
35
  } from './swift-packages'
36
+ import { swiftStandins, type SwiftStandin } from './swift-standins'
36
37
  import {
37
38
  MAX_SWIFT_COMPILE_FILES,
38
39
  MAX_SWIFT_COMPILE_SOURCE_BYTES,
@@ -184,7 +185,9 @@ interface XcodeProjectEntry {
184
185
  target?: string
185
186
  /** peach's own modules: a remote product named one links it, never its source. */
186
187
  provided: ReadonlySet<string> | null
187
- packages?: { key: string; packages: SwiftPackages }
188
+ /** the module root a local compile links, which builds binary stand-ins. */
189
+ moduleRoot: string | null
190
+ packages?: { key: string; packages: SwiftPackages; standins: SwiftStandin[] }
188
191
  }
189
192
 
190
193
  const xcodeProjects = new Map<string, XcodeProjectEntry>()
@@ -206,12 +209,16 @@ export function openXcodeProject(
206
209
  xcodeproj,
207
210
  target: app.name,
208
211
  provided: moduleRoot ? new Set(swiftPeachModules(moduleRoot)) : null,
212
+ moduleRoot: moduleRoot ?? null,
209
213
  })
210
214
  return root
211
215
  }
212
216
 
213
217
  // packages resolve once per set of linked products, pins and local manifests.
214
- function swiftPackages(entry: XcodeProjectEntry, app: XcodeAppTarget): SwiftPackages {
218
+ function swiftPackages(
219
+ entry: XcodeProjectEntry,
220
+ app: XcodeAppTarget,
221
+ ): { packages: SwiftPackages; standins: SwiftStandin[] } {
215
222
  const stamp = (file: string | null) =>
216
223
  file && fs.existsSync(file) ? fs.statSync(file).mtimeMs : 0
217
224
  const key = JSON.stringify([
@@ -224,18 +231,38 @@ function swiftPackages(entry: XcodeProjectEntry, app: XcodeAppTarget): SwiftPack
224
231
  ),
225
232
  ])
226
233
  if (entry.packages?.key !== key) {
227
- entry.packages = {
228
- key,
229
- packages: resolveSwiftPackages({
234
+ const resolve = (
235
+ provided: ReadonlySet<string> | null,
236
+ binaryGaps?: Map<string, string>,
237
+ ) =>
238
+ resolveSwiftPackages({
230
239
  rootDir: app.rootDir,
231
240
  resolved: app.packageResolved,
232
241
  products: app.linkedProducts,
233
242
  localDirs: app.localPackageDirs,
234
- provided: entry.provided,
235
- }),
243
+ provided,
244
+ binaryGaps,
245
+ })
246
+ let packages = resolve(entry.provided)
247
+ let standins: SwiftStandin[] = []
248
+ // a reached binary target with stand-ins for every module it ships
249
+ // resolves as provided, so what depends on it compiles; the rest keep
250
+ // their reason with why no stand-in was built
251
+ const reached = packages.binaries.filter((binary) => binary.reached)
252
+ if (entry.moduleRoot && entry.provided && reached.length > 0) {
253
+ const built = swiftStandins(reached, {
254
+ moduleRoot: entry.moduleRoot,
255
+ toolchainBin: swiftModuleToolchain(entry.moduleRoot).toolchainBin,
256
+ })
257
+ standins = built.standins
258
+ packages = resolve(
259
+ new Set([...entry.provided, ...standins.map((standin) => standin.target)]),
260
+ built.gaps,
261
+ )
236
262
  }
263
+ entry.packages = { key, packages, standins }
237
264
  }
238
- return entry.packages.packages
265
+ return entry.packages
239
266
  }
240
267
 
241
268
  // the app target's sources compile as one executable target under this
@@ -248,6 +275,9 @@ const XCODE_FRAMEWORKS_DIR = '__frameworks__'
248
275
  // remote package checkouts compile here: swiftpm owns `.build` in the
249
276
  // compile's package root as its scratch directory.
250
277
  const XCODE_PACKAGES_DIR = '__packages__'
278
+ // each binary target's stand-in compiles as a target under its module's
279
+ // directory here, from sources generated on this host.
280
+ const XCODE_STANDINS_DIR = '__standins__'
251
281
  const CHECKOUTS_PREFIX = `${REMOTE_CHECKOUTS.split(path.sep).join(path.posix.sep)}/`
252
282
 
253
283
  // the compile input key of a root-relative path in an xcode layout.
@@ -264,6 +294,7 @@ interface XcodeLayout {
264
294
  /** framework and package targets, with root-relative paths and the nested target directories they exclude. */
265
295
  targets: (SwiftPackageTarget & { exclude: string[] })[]
266
296
  packages: SwiftPackages
297
+ standins: SwiftStandin[]
267
298
  /** the input directory each app and framework source compiles under. */
268
299
  targetDirs: Map<string, string>
269
300
  files: string[]
@@ -294,7 +325,17 @@ function xcodeLayout(root: string): XcodeLayout | null {
294
325
  mainActorIsolation: framework.mainActorIsolation,
295
326
  })
296
327
  }
297
- const packages = swiftPackages(registered, app)
328
+ const { packages, standins } = swiftPackages(registered, app)
329
+ for (const standin of standins)
330
+ targets.push({
331
+ name: standin.module,
332
+ path: path.posix.join(XCODE_STANDINS_DIR, standin.module),
333
+ executable: false,
334
+ resources: false,
335
+ exclude: [],
336
+ languageMode: 5,
337
+ mainActorIsolation: false,
338
+ })
298
339
  for (const target of packages.targets) {
299
340
  const relative = path.relative(
300
341
  target.remote ? path.join(root, REMOTE_CHECKOUTS) : root,
@@ -326,6 +367,7 @@ function xcodeLayout(root: string): XcodeLayout | null {
326
367
  app,
327
368
  targets,
328
369
  packages,
370
+ standins,
329
371
  targetDirs,
330
372
  files: [...files].sort(),
331
373
  }
@@ -730,7 +772,12 @@ function packageSources(packagePath: string): Record<string, string> {
730
772
  MAX_SWIFT_COMPILE_SOURCE_BYTES,
731
773
  ).toString('utf8')
732
774
  }
733
- if (xcode) files['Package.swift'] = xcodeManifest(xcode)
775
+ if (xcode) {
776
+ files['Package.swift'] = xcodeManifest(xcode)
777
+ for (const standin of xcode.standins)
778
+ for (const [file, text] of Object.entries(standin.files))
779
+ files[path.posix.join(XCODE_STANDINS_DIR, standin.module, file)] = text
780
+ }
734
781
  return files
735
782
  }
736
783
 
@@ -1000,7 +1047,9 @@ async function missingModulesMessage(
1000
1047
  if (packaged.has(name))
1001
1048
  gaps.set(name, {
1002
1049
  source: binary.source,
1003
- reason: `${binary.target} is a binary framework`,
1050
+ reason:
1051
+ layout?.packages.modules.get(binary.target)?.reason ??
1052
+ `${binary.target} is a binary framework`,
1004
1053
  })
1005
1054
  }),
1006
1055
  )
@@ -3,8 +3,9 @@
3
3
  // (swift-package-manifest.ts) to the source targets that build it; remote
4
4
  // packages are fetched at the revision the app's Package.resolved pins, into
5
5
  // .build/peach/checkouts under the app's root. peach compiles swift source
6
- // only, so a target reaching a binary or c-family target stays missing, with
7
- // the reason; the targets beside it still compile.
6
+ // only, so a target reaching a c-family target, or a binary target the host
7
+ // built no stand-in for (swift-standins.ts), stays missing, with the reason;
8
+ // the targets beside it still compile.
8
9
 
9
10
  import { execFileSync } from 'node:child_process'
10
11
  import fs from 'node:fs'
@@ -65,6 +66,8 @@ export interface SwiftPackageBinary {
65
66
  /** the archive url, or null for a local artifact at `dir`. */
66
67
  url: string | null
67
68
  dir: string
69
+ /** a linked product's closure reaches it, so the app links it. */
70
+ reached: boolean
68
71
  }
69
72
 
70
73
  /** where checkouts live, relative to the app's root. */
@@ -164,6 +167,8 @@ export function resolveSwiftPackages(options: {
164
167
  /** local package directories the workspace or a project references. */
165
168
  localDirs: readonly string[]
166
169
  provided: ReadonlySet<string> | null
170
+ /** why a binary target has no stand-in, added to its reason. */
171
+ binaryGaps?: ReadonlyMap<string, string>
167
172
  }): SwiftPackages {
168
173
  const { rootDir, resolved, products, localDirs } = options
169
174
  const provided = options.provided ?? new Set<string>()
@@ -219,7 +224,10 @@ export function resolveSwiftPackages(options: {
219
224
  if (provided.has(name)) return null
220
225
  const target = pkg.manifest.targets.get(name)
221
226
  if (!target) return `${path.basename(pkg.manifest.dir)} declares no target ${name}`
222
- if (target.type === 'binary') return `${name} ${BINARY}`
227
+ if (target.type === 'binary') {
228
+ const gap = options.binaryGaps?.get(name)
229
+ return `${name} ${BINARY}${gap ? `; ${gap}` : ''}`
230
+ }
223
231
  if (target.type === 'system') return `${name} is a system C library`
224
232
  if (target.type !== 'regular') return `${name} is a ${target.type} target`
225
233
  const files = swiftTargetFiles(pkg.manifest, target)
@@ -329,6 +337,7 @@ export function resolveSwiftPackages(options: {
329
337
  source: pkg.source,
330
338
  url: target.url,
331
339
  dir: target.dir,
340
+ reached: false,
332
341
  })
333
342
  const reason = resolveTarget(pkg, name)
334
343
  if (reason && !result.modules.has(name))
@@ -373,6 +382,12 @@ export function resolveSwiftPackages(options: {
373
382
  if (!pkg || typeof pkg === 'string') continue
374
383
  for (const root of pkg.manifest.products.get(product) ?? []) reach(pkg, root)
375
384
  }
385
+ // a package's source is its key among the loaded packages
386
+ for (const binary of result.binaries) {
387
+ const pkg = packages.get(binary.source)
388
+ if (pkg && typeof pkg !== 'string')
389
+ binary.reached = reached.has(`${pkg.manifest.dir}\0${binary.target}`)
390
+ }
376
391
  result.targets = [...targets.entries()]
377
392
  .filter(([key]) => reached.has(key))
378
393
  .map(([, target]) => target)
@@ -9,7 +9,7 @@
9
9
  // a body, a setter, or a stored property for one declaration path, so the
10
10
  // declarations stay the sdk's and only those bodies stop trapping.
11
11
 
12
- export type SymbolFragment = { kind: string; spelling: string }
12
+ export type SymbolFragment = { kind: string; spelling: string; preciseIdentifier?: string }
13
13
  export type GraphSymbol = {
14
14
  kind: { identifier: string }
15
15
  identifier: { precise: string }
@@ -52,6 +52,9 @@ export type StandinOptions = {
52
52
  export type StandinBehavior = {
53
53
  /** statements for a function, initializer, or getter body */
54
54
  body?: string
55
+ /** an async overload or a Result completion overload of the same sdk path */
56
+ asyncBody?: string
57
+ resultBody?: string
55
58
  /** statements for a setter body */
56
59
  set?: string
57
60
  /** a stored property instead of a computed one, with this initial value */
@@ -156,7 +159,7 @@ export function emitSwiftStandin(graphs: SymbolGraph[], options: StandinOptions)
156
159
  if (local) return { name: pathOf(local), local: true }
157
160
  if (!fallback) return null
158
161
  const parts = fallback.split('.')
159
- return { name: parts.slice(1).join('.') || parts[0]!, module: parts[0]!, local: false }
162
+ return { name: family.has(parts[0]!) ? parts.join('.') : parts.slice(1).join('.') || parts[0]!, module: parts[0]!, local: false }
160
163
  }
161
164
  for (const graph of graphs)
162
165
  for (const edge of graph.relationships) {
@@ -212,8 +215,9 @@ export function emitSwiftStandin(graphs: SymbolGraph[], options: StandinOptions)
212
215
  const omit = options.omit ?? new Map<string, string>()
213
216
  let current = ''
214
217
  const emit = (line: string) => {
215
- lines.push(line)
216
- owners.push(current)
218
+ const physical = line.split('\n')
219
+ lines.push(...physical)
220
+ owners.push(...physical.map(() => current))
217
221
  }
218
222
  // every declaration runs under its own path, so each line names it
219
223
  const scoped = <T extends unknown[]>(body: (symbol: GraphSymbol, ...rest: T) => void) =>
@@ -274,7 +278,10 @@ export function emitSwiftStandin(graphs: SymbolGraph[], options: StandinOptions)
274
278
  const head = `${indent}${attrs}${access(member, context.openOwner)} ${required ? 'required ' : ''}${final}${override}${mutating}`
275
279
  const measured = behavior.get(path)
276
280
  if (measured) used.add(path)
277
- const body = measured?.body ?? trap(path)
281
+ const overloadBody = /\basync\b/.test(core)
282
+ ? measured?.asyncBody
283
+ : /\bResult</.test(core) ? measured?.resultBody : undefined
284
+ const body = overloadBody ?? measured?.body ?? trap(path)
278
285
  switch (member.kind.identifier) {
279
286
  case 'swift.property':
280
287
  case 'swift.type.property':