peachsim 0.1.2434 → 0.1.2435

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 (88) 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/attached-projects.cjs +1 -1
  4. package/dist-lib/auth/shared-session.cjs +1 -1
  5. package/dist-lib/backend-origin.cjs +1 -1
  6. package/dist-lib/beta.cjs +1 -1
  7. package/dist-lib/beta.mjs +1 -1
  8. package/dist-lib/bridge-constants.cjs +1 -1
  9. package/dist-lib/bridge-contract-input.cjs +1 -1
  10. package/dist-lib/bridge-contract-input.mjs +1 -1
  11. package/dist-lib/bridge-contract.cjs +1 -1
  12. package/dist-lib/bridge-contract.mjs +1 -1
  13. package/dist-lib/bundle-channel.cjs +95 -28
  14. package/dist-lib/capture-contract.cjs +1 -1
  15. package/dist-lib/capture-contract.mjs +1 -1
  16. package/dist-lib/cloud-contract.cjs +1 -1
  17. package/dist-lib/cloud-contract.mjs +1 -1
  18. package/dist-lib/cloud-test-args.cjs +1 -1
  19. package/dist-lib/cloud-test-args.mjs +1 -1
  20. package/dist-lib/cloud.cjs +1 -1
  21. package/dist-lib/cloud.mjs +1 -1
  22. package/dist-lib/config.cjs +1 -1
  23. package/dist-lib/config.mjs +1 -1
  24. package/dist-lib/detox/index.cjs +1 -1
  25. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  26. package/dist-lib/expo-swift-bundle.cjs +94 -27
  27. package/dist-lib/expo-swift-metadata.cjs +1 -1
  28. package/dist-lib/expo-swift-metadata.mjs +1 -1
  29. package/dist-lib/home-paths.cjs +1 -1
  30. package/dist-lib/host/bridge-host.cjs +95 -28
  31. package/dist-lib/host/fetch-proxy-handler.cjs +3 -3
  32. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  33. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  34. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  35. package/dist-lib/host/websocket-proxy.cjs +1 -1
  36. package/dist-lib/index.cjs +14 -6
  37. package/dist-lib/jump-to-source-babel.cjs +1 -1
  38. package/dist-lib/jump-to-source-native.cjs +1 -1
  39. package/dist-lib/kotlin-host.cjs +1 -1
  40. package/dist-lib/menu.cjs +1 -1
  41. package/dist-lib/menu.mjs +1 -1
  42. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  43. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  44. package/dist-lib/metro-production-bundle.cjs +1 -1
  45. package/dist-lib/metro-production-bundle.mjs +1 -1
  46. package/dist-lib/metro.cjs +14 -6
  47. package/dist-lib/native-app-identity-project.cjs +13 -5
  48. package/dist-lib/native-app-identity-project.mjs +13 -5
  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/pdfium-raster.cjs +1 -1
  54. package/dist-lib/pdfium-raster.mjs +1 -1
  55. package/dist-lib/plist.cjs +1 -1
  56. package/dist-lib/plist.mjs +1 -1
  57. package/dist-lib/profiles.cjs +1 -1
  58. package/dist-lib/public-brand.cjs +1 -1
  59. package/dist-lib/public-origins-lib-esm.json +24 -24
  60. package/dist-lib/public-origins-lib.json +53 -53
  61. package/dist-lib/react-native-host-modules.cjs +1 -1
  62. package/dist-lib/react-native-host-modules.mjs +1 -1
  63. package/dist-lib/reap-browser.cjs +1 -1
  64. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  65. package/dist-lib/sdk.cjs +1 -1
  66. package/dist-lib/sdk.mjs +1 -1
  67. package/dist-lib/skills.cjs +101 -35
  68. package/dist-lib/swift-compile.cjs +69 -19
  69. package/dist-lib/swift-compile.mjs +69 -19
  70. package/dist-lib/swift-package.cjs +1 -1
  71. package/dist-lib/swift-package.mjs +1 -1
  72. package/dist-lib/swift-submit.cjs +1 -1
  73. package/dist-lib/swift-submit.mjs +1 -1
  74. package/dist-lib/swift-toolchain.cjs +1 -1
  75. package/dist-lib/swift.cjs +1 -1
  76. package/dist-lib/vite-swift.cjs +92 -25
  77. package/dist-lib/vite.cjs +3 -3
  78. package/dist-lib/worklet-executable.cjs +1 -1
  79. package/dist-lib/worklet-executable.mjs +1 -1
  80. package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -0
  81. package/package.json +1 -1
  82. package/src/bazel-project.ts +11 -3
  83. package/src/swift-compile.ts +49 -5
  84. package/src/swift-guest-image-ledger.ts +15 -12
  85. package/src/swift-guest-link.ts +13 -2
  86. package/src/swift-host.ts +12 -0
  87. package/src/swift-submit.ts +2 -0
  88. package/src/swift-wasm-prune.ts +8 -3
@@ -167,7 +167,7 @@ function configurationFlags(configuration: string): string[] {
167
167
  }
168
168
 
169
169
  // the stored query's shape; a change to what bazelGraph asks for bumps it
170
- const GRAPH_FORMAT = 4
170
+ const GRAPH_FORMAT = 6
171
171
 
172
172
  function bazelGraph(root: string, label: string, configuration: string): BazelGraph {
173
173
  const key = JSON.stringify([root, label, configuration])
@@ -199,8 +199,10 @@ function bazelGraph(root: string, label: string, configuration: string): BazelGr
199
199
  )
200
200
  const deps = app.attrs.get('deps')?.list ?? []
201
201
  if (deps.length === 0) throw new Error(`${label} links no libraries`)
202
+ const strings = app.attrs.get('strings')?.list ?? []
202
203
  const infoplists = app.attrs.get('infoplists')?.list ?? []
203
- const query = `kind("${QUERIED_RULES.join('|')}", deps(set(${deps.join(' ')})))${infoplists.length > 0 ? ` + set(${infoplists.join(' ')})` : ''}`
204
+ const roots = [...deps, ...strings]
205
+ const query = `kind("${QUERIED_RULES.join('|')}", deps(set(${roots.join(' ')})))${infoplists.length > 0 ? ` + set(${infoplists.join(' ')})` : ''}`
204
206
  const output = run(['cquery', query, ...flags, '--output=jsonproto'])
205
207
  // a rule that declares its outputs in its implementation lists none in the
206
208
  // proto; its default outputs name them
@@ -740,9 +742,15 @@ export function readBazelAppTarget(
740
742
  graph.app.attrs.get('infoplists')?.list ?? [],
741
743
  graph.app.label,
742
744
  )
745
+ const strings = files.expand(
746
+ graph.app.attrs.get('strings')?.list ?? [],
747
+ graph.app.label,
748
+ )
749
+ resources.push(...strings)
743
750
  const absent = () =>
744
751
  [
745
752
  ...infoPlistFiles,
753
+ ...strings,
746
754
  ...[...frameworks, appModule].flatMap((module) => [
747
755
  ...module.allSources,
748
756
  ...(module.objc?.headers ?? []),
@@ -790,7 +798,7 @@ export function readBazelAppTarget(
790
798
  const missing = options.requireSources === false ? [] : absent()
791
799
  if (missing.length > 0)
792
800
  throw new Error(
793
- `bazel generates ${missing.length} sources this app compiles that are not built: ${missing
801
+ `bazel application has ${missing.length} unbuilt inputs: ${missing
794
802
  .slice(0, 5)
795
803
  .map((file) => path.relative(root, file))
796
804
  .join(', ')}`,
@@ -50,7 +50,9 @@ import {
50
50
  } from './swift-distribution-contract'
51
51
  import { foundationCategoryObjects } from './swift-foundation'
52
52
  import { compileGuestLink } from './swift-guest-compile'
53
- import { CLANG_TARGET_MODULE_WRAPPER } from './swift-guest-source-inputs'
53
+ import {
54
+ CLANG_TARGET_MODULE_WRAPPER,
55
+ } from './swift-guest-source-inputs'
54
56
  import {
55
57
  SWIFT_HEADER_COMPILER_WRAPPER,
56
58
  withSwiftHeaderCompiler,
@@ -307,6 +309,7 @@ export interface SwiftCompileInput {
307
309
  */
308
310
  projectFiles?: Record<string, string>
309
311
  packageGuestImports?: string[]
312
+ packageHostMacros?: string[]
310
313
  nativeTargets?: SwiftNativeTarget[]
311
314
  sourceLinkGraph?: SwiftSourceLinkGraph
312
315
  headerAliases?: SwiftHeaderAliases
@@ -1866,6 +1869,8 @@ export function swiftArtifactHash(
1866
1869
  hash.update(JSON.stringify(input.staticClangTargets ?? []))
1867
1870
  hash.update(JSON.stringify(input.headerAliases ?? {}))
1868
1871
  hash.update(JSON.stringify(input.packageGuestImports ?? []))
1872
+ if (input.packageHostMacros?.length)
1873
+ hash.update('package-host-macros\n' + JSON.stringify(input.packageHostMacros))
1869
1874
  if (input.defaultLocalization)
1870
1875
  hash.update(`default-localization\n${input.defaultLocalization}\n`)
1871
1876
  for (const file of Object.keys(input.packageFiles ?? {}).sort()) {
@@ -7240,6 +7245,7 @@ async function buildFrameworkProducts(
7240
7245
  // when it moves, so each revision compiles and links against its own objects
7241
7246
  // the way the builder's per-build-key roots do.
7242
7247
  const SWIFT_LINK_STAMP = '.peach-link-stamp'
7248
+ const SWIFT_HOST_COMPILER_WRAPPER = '.peach-swiftc'
7243
7249
 
7244
7250
  // stable slot paths preserve swiftpm's incremental products across checkout paths.
7245
7251
  const SWIFT_FRAMEWORK_SLOTS = 8
@@ -7441,9 +7447,12 @@ function stageFrameworkSource(
7441
7447
  function swiftLinkStamp(args: {
7442
7448
  frameworkKey: string
7443
7449
  prebuilt?: SwiftFrameworkProducts
7450
+ packageHostMacros?: string[]
7444
7451
  }): string {
7445
7452
  const hash = createHash('sha256')
7446
7453
  hash.update(`swift-link/v1\n${args.frameworkKey}\n`)
7454
+ if (args.packageHostMacros?.length)
7455
+ hash.update('package-host-macros\n' + JSON.stringify(args.packageHostMacros))
7447
7456
  if (!args.prebuilt) return hash.digest('hex')
7448
7457
  const statOf = (file: string) => {
7449
7458
  const stat = statSync(file, { bigint: true })
@@ -7717,12 +7726,15 @@ function compileSwiftProjectOnce(
7717
7726
  })
7718
7727
  }
7719
7728
  if (options.project) removeProjectLinks(root)
7729
+ const packageHostMacros =
7730
+ process.platform === 'linux' ? input.packageHostMacros : undefined
7720
7731
  if (
7721
7732
  retireStaleSwiftLink(
7722
7733
  root,
7723
7734
  swiftLinkStamp({
7724
7735
  frameworkKey,
7725
7736
  prebuilt,
7737
+ packageHostMacros,
7726
7738
  }),
7727
7739
  )
7728
7740
  )
@@ -7750,13 +7762,45 @@ function compileSwiftProjectOnce(
7750
7762
  ]
7751
7763
  : [],
7752
7764
  )
7753
- const projectProcess = options.project
7754
- ? prepareSwiftProjectProcess(root, options.project)
7755
- : undefined
7756
7765
  // the native build system takes its C compiler from CC, never a toolset
7757
7766
  const compiler: Record<string, string> = preparation.targetToolset
7758
7767
  ? { CC: path.join(root, CLANG_TARGET_MODULE_WRAPPER) }
7759
7768
  : {}
7769
+ if (packageHostMacros?.length) {
7770
+ // swiftpm build-tool flags skip macro targets; forward the import
7771
+ // when swiftpm compiles a declared macro for the linux host.
7772
+ const swiftc = path.join(root, SWIFT_HOST_COMPILER_WRAPPER)
7773
+ writeBuildFile(
7774
+ swiftc,
7775
+ [
7776
+ '#!/bin/sh',
7777
+ 'target=',
7778
+ 'module=',
7779
+ 'compile=',
7780
+ 'previous=',
7781
+ 'for argument do',
7782
+ ' case "$previous" in -target) target=$argument ;; -module-name) module=$argument ;; esac',
7783
+ ' case "$argument" in -c|-emit-module|-scan-dependencies|-typecheck) compile=1 ;; esac',
7784
+ ' previous=$argument',
7785
+ 'done',
7786
+ 'case "$target/$compile" in',
7787
+ ' *-*-linux*/1)',
7788
+ ' case ",$PEACH_SWIFT_HOST_MACROS," in',
7789
+ ' *",$module,"*) set -- "$@" -Xfrontend -import-module -Xfrontend Foundation ;;',
7790
+ ' esac ;;',
7791
+ 'esac',
7792
+ 'exec "$PEACH_SWIFTC" "$@"',
7793
+ '',
7794
+ ].join('\n'),
7795
+ )
7796
+ chmodSync(swiftc, 0o755)
7797
+ compiler.SWIFT_EXEC = swiftc
7798
+ compiler.PEACH_SWIFT_HOST_MACROS = packageHostMacros.join(',')
7799
+ compiler.PEACH_SWIFTC = path.join(options.toolchainBin, 'swiftc')
7800
+ }
7801
+ const projectProcess = options.project
7802
+ ? prepareSwiftProjectProcess(root, options.project)
7803
+ : undefined
7760
7804
  const appOptions = projectProcess
7761
7805
  ? {
7762
7806
  ...buildOptions,
@@ -8181,7 +8225,7 @@ function compileSwiftProjectOnce(
8181
8225
  toolchainBin: options.toolchainBin,
8182
8226
  swiftCompiler: preparation.headerCompiler
8183
8227
  ? path.join(root, SWIFT_HEADER_COMPILER_WRAPPER)
8184
- : path.join(options.toolchainBin, 'swiftc'),
8228
+ : compiler.SWIFT_EXEC ?? path.join(options.toolchainBin, 'swiftc'),
8185
8229
  sysroot: swiftSdkPaths(frameworkRoot, options.toolchainBin).sysroot,
8186
8230
  sdk: swiftModuleSdk(frameworkRoot),
8187
8231
  staticClangTargets: input.staticClangTargets ?? [],
@@ -82,7 +82,7 @@ function readString(bytes: Uint8Array, position: number): [string, number] {
82
82
  const [length, start] = readNumber(bytes, position)
83
83
  if (start + length > bytes.length) throw new Error('invalid wasm string')
84
84
  return [
85
- Buffer.from(bytes.subarray(start, start + length)).toString('utf8'),
85
+ Buffer.from(bytes.buffer, bytes.byteOffset + start, length).toString('utf8'),
86
86
  start + length,
87
87
  ]
88
88
  }
@@ -128,7 +128,7 @@ function rewriteObject(
128
128
  bytes: Uint8Array,
129
129
  names: Pick<ReadonlyMap<string, string>, 'get' | 'has'>,
130
130
  callerAlias: string,
131
- binding: (name: string) => string | undefined,
131
+ binding: ((name: string) => string | undefined) | undefined,
132
132
  instrumentDynamicLookups: boolean,
133
133
  preserveCanonical: ReadonlySet<string>,
134
134
  ): {
@@ -140,7 +140,9 @@ function rewriteObject(
140
140
  } {
141
141
  if (Buffer.from(bytes.subarray(0, 8)).toString('hex') !== '0061736d01000000')
142
142
  throw new Error('expected wasm object')
143
- const sections: Buffer[] = [Buffer.from(bytes.subarray(0, 8))]
143
+ const sections: Buffer[] | undefined = binding
144
+ ? [Buffer.from(bytes.subarray(0, 8))]
145
+ : undefined
144
146
  const types: FunctionType[] = []
145
147
  const functionTypes: number[] = []
146
148
  const definitions: ObjectDefinition[] = []
@@ -154,8 +156,9 @@ function rewriteObject(
154
156
  const [size, start] = readNumber(bytes, position)
155
157
  const end = start + size
156
158
  if (end > bytes.length) throw new Error('invalid wasm section')
157
- let section = Buffer.from(bytes.subarray(start, end))
158
159
  position = end
160
+ if (!sections && id > 3) continue
161
+ let section = Buffer.from(bytes.buffer, bytes.byteOffset + start, size)
159
162
  let offset = 0
160
163
  const number = (): number => {
161
164
  const [value, next] = readNumber(section, offset)
@@ -183,7 +186,7 @@ function rewriteObject(
183
186
  }
184
187
  } else if (id === 2) {
185
188
  const count = number()
186
- const imports: Buffer[] = [encodeNumber(count)]
189
+ const imports: Buffer[] | undefined = sections ? [encodeNumber(count)] : undefined
187
190
  for (let i = 0; i < count; i++) {
188
191
  const module = string()
189
192
  const name = string()
@@ -232,7 +235,7 @@ function rewriteObject(
232
235
  }
233
236
  if (isDlsym) usesDlsym = true
234
237
  if (isDlerror) usesDlerror = true
235
- imports.push(
238
+ imports?.push(
236
239
  encodedString(module),
237
240
  encodedString(
238
241
  isDlsym
@@ -240,7 +243,7 @@ function rewriteObject(
240
243
  : isDlerror
241
244
  ? '__peach_dlerror'
242
245
  : module === 'env' && name !== 'dlsym' && name !== 'dlerror'
243
- ? (binding(name) ?? name)
246
+ ? (binding?.(name) ?? name)
244
247
  : name,
245
248
  ),
246
249
  Buffer.from([kind]),
@@ -248,7 +251,7 @@ function rewriteObject(
248
251
  )
249
252
  }
250
253
  if (offset !== section.length) throw new Error('invalid wasm import section')
251
- section = Buffer.concat(imports)
254
+ if (imports) section = Buffer.concat(imports)
252
255
  } else if (id === 3) {
253
256
  const count = number()
254
257
  for (let i = 0; i < count; i++) functionTypes.push(number())
@@ -354,7 +357,7 @@ function rewriteObject(
354
357
  flags & 16 &&
355
358
  name !== 'dlsym' &&
356
359
  name !== 'dlerror' &&
357
- binding(name) !== undefined
360
+ binding?.(name) !== undefined
358
361
  ) {
359
362
  entries.push(
360
363
  section.subarray(begin, nameStart),
@@ -432,10 +435,10 @@ function rewriteObject(
432
435
  section = Buffer.concat(parts)
433
436
  }
434
437
  }
435
- sections.push(Buffer.from([id]), encodeNumber(section.length), section)
438
+ sections?.push(Buffer.from([id]), encodeNumber(section.length), section)
436
439
  }
437
440
  return {
438
- bytes: Buffer.concat(sections),
441
+ bytes: sections ? Buffer.concat(sections) : bytes,
439
442
  definitions,
440
443
  functionImports,
441
444
  usesDlsym,
@@ -500,7 +503,7 @@ export function createGuestImageLedger(input: GuestImageLedgerInput): GuestImage
500
503
  object.bytes,
501
504
  aliases,
502
505
  `__peach_dlsym_caller_${image.id}`,
503
- () => undefined,
506
+ undefined,
504
507
  object.instrumentDynamicLookups,
505
508
  new Set(),
506
509
  )
@@ -1164,7 +1164,12 @@ export function verifyGuestSymbolScopes(options: {
1164
1164
  continue
1165
1165
  if (!scope.includes(provider)) {
1166
1166
  const candidates = options.definitionObjects.get(symbol) ?? new Set<string>()
1167
- const providers = [...record.providers.keys()]
1167
+ const traced = [...record.providers.keys()]
1168
+ // the one strong definition a link traces wins over weak fallbacks beside it
1169
+ const strongTraced = traced.filter(
1170
+ (definer) => !options.weakDefinitions.get(definer)?.has(symbol),
1171
+ )
1172
+ const providers = strongTraced.length === 1 ? strongTraced : traced
1168
1173
  // a weak import binds only inside the image's own dependency scope, so
1169
1174
  // a provider outside it leaves the import absent, as in dyld.
1170
1175
  if (
@@ -1180,9 +1185,15 @@ export function verifyGuestSymbolScopes(options: {
1180
1185
  [...candidates].every((definer) =>
1181
1186
  options.weakDefinitions.get(definer)?.has(symbol),
1182
1187
  )
1188
+ const strongCandidates = [...candidates].filter(
1189
+ (definer) => !options.weakDefinitions.get(definer)?.has(symbol),
1190
+ )
1191
+ const soleCandidate =
1192
+ candidates.size === 1 ||
1193
+ (strongCandidates.length === 1 && strongCandidates[0] === providers[0])
1183
1194
  if (
1184
1195
  !equivalentCopies &&
1185
- (candidates.size !== 1 ||
1196
+ (!soleCandidate ||
1186
1197
  providers.length !== 1 ||
1187
1198
  !candidates.has(providers[0]!) ||
1188
1199
  !(
package/src/swift-host.ts CHANGED
@@ -2807,6 +2807,7 @@ interface SwiftPackageSnapshot {
2807
2807
  packageFiles?: SwiftPackageFiles
2808
2808
  projectFiles?: Record<string, string>
2809
2809
  packageGuestImports?: string[]
2810
+ packageHostMacros?: string[]
2810
2811
  files: Record<string, string>
2811
2812
  nativeTargets?: SwiftNativeTarget[]
2812
2813
  sourceLinkGraph?: SwiftSourceLinkGraph
@@ -2922,6 +2923,15 @@ function packageSnapshot(
2922
2923
  ...(Object.keys(packageFiles).length > 0
2923
2924
  ? {
2924
2925
  packageFiles,
2926
+ packageHostMacros: [
2927
+ ...new Set(
2928
+ (layout?.packages.nativePackages ?? []).flatMap(({ manifest }) =>
2929
+ [...manifest.targets.values()]
2930
+ .filter((target) => target.type === 'macro')
2931
+ .map((target) => swiftTargetModuleName(target.name)),
2932
+ ),
2933
+ ),
2934
+ ].sort(),
2925
2935
  packageGuestImports: [
2926
2936
  ...new Set(
2927
2937
  (layout?.packages.nativePackages ?? []).flatMap(
@@ -3014,6 +3024,7 @@ function snapshotCompileInput(snapshot: SwiftPackageSnapshot): SwiftCompileInput
3014
3024
  ? {
3015
3025
  packageFiles: snapshot.packageFiles,
3016
3026
  packageGuestImports: snapshot.packageGuestImports,
3027
+ packageHostMacros: snapshot.packageHostMacros,
3017
3028
  }
3018
3029
  : {}),
3019
3030
  ...(snapshot.projectFiles ? { projectFiles: snapshot.projectFiles } : {}),
@@ -3410,6 +3421,7 @@ async function compileRemote(
3410
3421
  ? {
3411
3422
  packageFiles: snapshot.packageFiles,
3412
3423
  packageGuestImports: snapshot.packageGuestImports,
3424
+ packageHostMacros: snapshot.packageHostMacros,
3413
3425
  }
3414
3426
  : {}),
3415
3427
  ...(snapshot.nativeTargets ? { nativeTargets: snapshot.nativeTargets } : {}),
@@ -283,6 +283,7 @@ export type SwiftCompileSubmit = (work: {
283
283
  files: Record<string, string>
284
284
  packageFiles?: SwiftPackageFiles
285
285
  packageGuestImports?: string[]
286
+ packageHostMacros?: string[]
286
287
  nativeTargets?: SwiftNativeTarget[]
287
288
  sourceLinkGraph?: SwiftSourceLinkGraph
288
289
  headerAliases?: SwiftHeaderAliases
@@ -459,6 +460,7 @@ export async function compileSwiftProject(
459
460
  files: Record<string, string>
460
461
  packageFiles?: SwiftPackageFiles
461
462
  packageGuestImports?: string[]
463
+ packageHostMacros?: string[]
462
464
  nativeTargets?: SwiftNativeTarget[]
463
465
  sourceLinkGraph?: SwiftSourceLinkGraph
464
466
  headerAliases?: SwiftHeaderAliases
@@ -2129,9 +2129,14 @@ export function pruneSwiftWasmLink(
2129
2129
  const def = definedGlobalSyms.get(symName)
2130
2130
  if (def) activateSymbolInObj(def.obj, def.symIdx)
2131
2131
  }
2132
- // the image ledger's generated lookup wrappers call the loader runtime, a
2133
- // reference the pruner cannot see before the ledger exists.
2134
- for (const symName of ['__peach_dlsym_from_image', '__peach_dlerror']) {
2132
+ // the image ledger's generated lookup wrappers call the loader runtime, and a
2133
+ // guest link's image tables reference the providers that read them:
2134
+ // references the pruner cannot see before the ledger exists.
2135
+ for (const symName of [
2136
+ '__peach_dlsym_from_image',
2137
+ '__peach_dlerror',
2138
+ ...(link ? ['_dyld_register_func_for_add_image'] : []),
2139
+ ]) {
2135
2140
  const provider = lazyProviders.get(symName)?.[0]
2136
2141
  if (provider) extractObject(provider)
2137
2142
  const def = definedGlobalSyms.get(symName)