peachsim 0.1.2410 → 0.1.2411

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 (111) hide show
  1. package/README.md +2 -5
  2. package/cli/internal-child-contract.ts +0 -1
  3. package/cli/internal-child.ts +0 -6
  4. package/cli/outbound-endpoints.ts +0 -23
  5. package/dist-lib/agent-daemon-client.cjs +1 -1
  6. package/dist-lib/agent-events.cjs +1 -1
  7. package/dist-lib/attached-projects.cjs +1 -1
  8. package/dist-lib/auth/shared-session.cjs +1 -1
  9. package/dist-lib/backend-origin.cjs +1 -1
  10. package/dist-lib/beta.cjs +1 -1
  11. package/dist-lib/beta.mjs +1 -1
  12. package/dist-lib/bridge-constants.cjs +1 -1
  13. package/dist-lib/bridge-contract-input.cjs +1 -1
  14. package/dist-lib/bridge-contract-input.mjs +1 -1
  15. package/dist-lib/bridge-contract.cjs +1 -1
  16. package/dist-lib/bridge-contract.mjs +1 -1
  17. package/dist-lib/bundle-channel.cjs +10279 -4163
  18. package/dist-lib/capture-contract.cjs +1 -1
  19. package/dist-lib/capture-contract.mjs +1 -1
  20. package/dist-lib/cloud-contract.cjs +1 -1
  21. package/dist-lib/cloud-contract.mjs +1 -1
  22. package/dist-lib/cloud-test-args.cjs +1 -1
  23. package/dist-lib/cloud-test-args.mjs +1 -1
  24. package/dist-lib/cloud.cjs +1 -1
  25. package/dist-lib/cloud.mjs +1 -1
  26. package/dist-lib/config.cjs +1 -1
  27. package/dist-lib/config.mjs +1 -1
  28. package/dist-lib/detox/index.cjs +1 -1
  29. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  30. package/dist-lib/expo-swift-bundle.cjs +11551 -5435
  31. package/dist-lib/expo-swift-metadata.cjs +1 -1
  32. package/dist-lib/expo-swift-metadata.mjs +1 -1
  33. package/dist-lib/home-paths.cjs +1 -1
  34. package/dist-lib/host/bridge-host.cjs +12798 -6682
  35. package/dist-lib/host/fetch-proxy-handler.cjs +924 -150
  36. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  37. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  38. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  39. package/dist-lib/host/websocket-proxy.cjs +1 -1
  40. package/dist-lib/index.cjs +1011 -237
  41. package/dist-lib/jump-to-source-babel.cjs +1 -1
  42. package/dist-lib/jump-to-source-native.cjs +1 -1
  43. package/dist-lib/kotlin-host.cjs +1 -1
  44. package/dist-lib/menu.cjs +1 -1
  45. package/dist-lib/menu.mjs +1 -1
  46. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  47. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  48. package/dist-lib/metro-production-bundle.cjs +1 -1
  49. package/dist-lib/metro-production-bundle.mjs +1 -1
  50. package/dist-lib/metro.cjs +927 -153
  51. package/dist-lib/native-app-identity-project.cjs +2 -2
  52. package/dist-lib/native-app-identity-project.mjs +2 -2
  53. package/dist-lib/native-app-identity.cjs +1 -1
  54. package/dist-lib/native-app-identity.mjs +1 -1
  55. package/dist-lib/native-firebase-metadata.cjs +1 -1
  56. package/dist-lib/native-firebase-metadata.mjs +1 -1
  57. package/dist-lib/pdfium-raster.cjs +1 -1
  58. package/dist-lib/pdfium-raster.mjs +1 -1
  59. package/dist-lib/plist.cjs +1 -1
  60. package/dist-lib/plist.mjs +1 -1
  61. package/dist-lib/profiles.cjs +1 -1
  62. package/dist-lib/public-brand.cjs +1 -1
  63. package/dist-lib/public-origins-lib-esm.json +24 -24
  64. package/dist-lib/public-origins-lib.json +124 -104
  65. package/dist-lib/react-native-host-modules.cjs +1 -1
  66. package/dist-lib/react-native-host-modules.mjs +1 -1
  67. package/dist-lib/reap-browser.cjs +1 -1
  68. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  69. package/dist-lib/sdk.cjs +1 -1
  70. package/dist-lib/sdk.mjs +1 -1
  71. package/dist-lib/skills.cjs +13905 -7789
  72. package/dist-lib/swift-compile.cjs +62 -14
  73. package/dist-lib/swift-compile.mjs +62 -13
  74. package/dist-lib/swift-package.cjs +1 -1
  75. package/dist-lib/swift-package.mjs +1 -1
  76. package/dist-lib/swift-submit.cjs +1 -1
  77. package/dist-lib/swift-submit.mjs +1 -1
  78. package/dist-lib/swift-toolchain.cjs +1 -1
  79. package/dist-lib/swift.cjs +1 -1
  80. package/dist-lib/vite-swift.cjs +76 -19
  81. package/dist-lib/vite.cjs +3100 -2326
  82. package/dist-lib/worklet-executable.cjs +1 -1
  83. package/dist-lib/worklet-executable.mjs +1 -1
  84. package/kotlin/sdk.tar.gz +0 -0
  85. package/package.json +3 -3
  86. package/sdk/ios/System/Library/Frameworks/AuthenticationServices.framework/Headers/ASWebAuthenticationSession.h +1 -1
  87. package/sdk/ios/System/Library/Frameworks/Photos.framework/Headers/PHAsset.h +1 -1
  88. package/sdk/ios/System/Library/Frameworks/Photos.framework/Headers/PHAssetResource.h +1 -1
  89. package/sdk/ios/System/Library/Frameworks/Photos.framework/Headers/PHChange.h +1 -1
  90. package/sdk/ios/System/Library/Frameworks/Photos.framework/Headers/PHFetchOptions.h +1 -1
  91. package/sdk/ios/System/Library/Frameworks/Photos.framework/Headers/PHFetchResult.h +1 -1
  92. package/sdk/ios/System/Library/Frameworks/Photos.framework/Headers/PHImageManager.h +2 -2
  93. package/sdk/ios/System/Library/Frameworks/Photos.framework/Headers/PHObject.h +1 -1
  94. package/sdk/ios/System/Library/Frameworks/Photos.framework/Headers/PHPhotoLibrary.h +2 -2
  95. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h +1 -1
  96. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIVibrancyEffect.h +1 -1
  97. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIVisualEffectView.h +1 -1
  98. package/sdk/ios/System/Library/Frameworks/UIKitActivity.framework/Headers/UIKitActivity.h +1 -1
  99. package/src/nitro-adapter.lock.json +262 -262
  100. package/src/nitro-superset.lock.json +4 -4
  101. package/src/podspec-cocoapods.ts +934 -0
  102. package/src/podspec-prism.ts +66 -0
  103. package/src/podspec-ruby-stdlib.ts +1121 -0
  104. package/src/podspec-ruby.ts +5175 -0
  105. package/src/podspec-sources.ts +25 -112
  106. package/src/swift-compile.ts +70 -12
  107. package/src/swift-distribution.lock.json +9 -8
  108. package/src/swift-host.ts +14 -4
  109. package/src/turbo-runtime.lock.json +19 -19
  110. package/cli/drivers/linux-cocoapods.lock.json +0 -303
  111. package/cli/drivers/linux-cocoapods.ts +0 -99
@@ -1,14 +1,12 @@
1
- // CocoaPods' own Ruby evaluates native membership: the developer's CocoaPods on
2
- // macOS, peach's pinned bundle on linux. evaluations restored from a compiled
3
- // key artifact or a prepared workspace manifest answer without it.
4
- import { execFileSync } from 'node:child_process'
1
+ // native membership comes from evaluating each podspec with CocoaPods' own DSL
2
+ // in Peach's Ruby interpreter, the same on every host. evaluations restored
3
+ // from a compiled key artifact or a prepared workspace manifest skip it.
5
4
  import { createHash, randomUUID } from 'node:crypto'
6
5
  import fs from 'node:fs'
7
- import { createRequire } from 'node:module'
8
6
  import path from 'node:path'
9
7
  import { z } from 'zod'
10
- import { linuxCocoaPods } from '../cli/drivers/linux-cocoapods'
11
8
  import { cacheDir } from './home-paths'
9
+ import { evaluatePodspec } from './podspec-cocoapods'
12
10
  import { findWorkspaceRoot } from './workspace-root'
13
11
 
14
12
  export class UnsupportedPodspec extends Error {}
@@ -274,79 +272,6 @@ function podspecEnv(): NodeJS.ProcessEnv {
274
272
  }
275
273
  }
276
274
 
277
- // preload the helpers once; each fork isolates podspec globals and environment.
278
- function evaluateSpecs(sources: string[], app: string): EvaluatedSpec[] {
279
- const directory = path.join(cacheDir(), 'podspecs')
280
- fs.mkdirSync(directory, { recursive: true })
281
- fs.mkdirSync(path.join(app, 'ios'), { recursive: true })
282
- const temporary = fs.mkdtempSync(path.join(directory, 'evaluation-'))
283
- const outputFile = path.join(temporary, 'spec.json')
284
- const reactNative = path.dirname(
285
- createRequire(path.join(app, 'package.json')).resolve('react-native/package.json'),
286
- )
287
- try {
288
- // the evaluation loads into the pod launcher so it runs on the Ruby and
289
- // gems CocoaPods was installed with; the system Ruby has no cocoapods gem.
290
- const evaluation = path.join(temporary, 'evaluate.rb')
291
- fs.writeFileSync(
292
- evaluation,
293
- [
294
- "ENV.delete('RUBYOPT')",
295
- "require 'cocoapods'",
296
- '$stdout = $stderr',
297
- "require File.join(ARGV[1], 'scripts/react_native_pods.rb')",
298
- "Pod::Config.instance.installation_root = Pathname.new(File.join(ARGV[0], 'ios'))",
299
- 'def evaluated(spec)',
300
- ' consumer = spec.consumer(:ios)',
301
- " result = {'name' => spec.name.split('/').last}",
302
- ' %w[source_files exclude_files public_header_files private_header_files header_mappings_dir header_dir module_name vendored_frameworks vendored_libraries pod_target_xcconfig].each do |attribute|',
303
- ' value = consumer.public_send(attribute)',
304
- ' result[attribute] = value unless value.nil?',
305
- ' end',
306
- " result['default_subspecs'] = spec.attributes_hash['default_subspecs'] if spec.attributes_hash.key?('default_subspecs')",
307
- ' result[\'dependencies\'] = consumer.dependencies.to_h { |dependency| [dependency.name, dependency.requirement.requirements.map { |operator, version| "#{operator} #{version}" }] }',
308
- " result['swift_versions'] = spec.swift_versions.map(&:to_s) if spec.swift_versions",
309
- " result['subspecs'] = spec.subspecs.select(&:library_specification?).map { |child| evaluated(child) }",
310
- ' result',
311
- 'end',
312
- 'specs = ARGV[3..].map do |file|',
313
- ' reader, writer = IO.pipe',
314
- ' pid = Process.fork do',
315
- ' reader.close',
316
- ' Marshal.dump(evaluated(Pod::Specification.from_file(Pathname.new(file))), writer)',
317
- ' writer.close',
318
- ' end',
319
- ' writer.close',
320
- ' payload = reader.read',
321
- ' reader.close',
322
- ' Process.wait(pid)',
323
- ' raise "podspec evaluation failed: #{file}" unless $?.success?',
324
- ' Marshal.load(payload)',
325
- 'end',
326
- 'File.write(ARGV[2], JSON.generate(specs))',
327
- 'exit 0',
328
- ].join('\n'),
329
- )
330
- // runner-toolchain-platform: darwin
331
- const pod =
332
- process.platform === 'darwin'
333
- ? { command: 'pod', args: [], env: {} }
334
- : linuxCocoaPods()
335
- execFileSync(pod.command, [...pod.args, app, reactNative, outputFile, ...sources], {
336
- cwd: app,
337
- env: { ...podspecEnv(), ...pod.env, RUBYOPT: `-r${evaluation}` },
338
- encoding: 'utf8',
339
- maxBuffer: 16 * 1024 * 1024,
340
- })
341
- return z
342
- .array(evaluatedSpecSchema)
343
- .length(sources.length)
344
- .parse(JSON.parse(fs.readFileSync(outputFile, 'utf8')))
345
- } finally {
346
- fs.rmSync(temporary, { recursive: true, force: true })
347
- }
348
- }
349
-
350
275
  function registerReceipt(plan: PodspecPlan, receipt: PodspecReceipt) {
351
276
  const values = appReceipts.get(plan.app) ?? new Map<string, PodspecReceipt>()
352
277
  values.set(plan.key, receipt)
@@ -357,44 +282,32 @@ export function loadPodspec(file: string, appRoot: string | null = null): Spec {
357
282
  return loadPodspecs([file], appRoot)[0]!
358
283
  }
359
284
 
360
- /** the specs for `files` in input order, evaluating cache misses together. */
285
+ /** the specs for `files` in input order. */
361
286
  export function loadPodspecs(
362
287
  files: readonly string[],
363
288
  appRoot: string | null = null,
364
289
  ): Spec[] {
365
- const plans = files.map((file) => planPodspec(file, appRoot))
366
- const misses = plans.filter((plan) => !plan.receipt)
367
- if (misses.length) {
368
- const byApp = new Map<string, PodspecPlan[]>()
369
- for (const plan of misses) {
370
- const group = byApp.get(plan.app) ?? []
371
- group.push(plan)
372
- byApp.set(plan.app, group)
373
- }
374
- for (const [app, group] of byApp) {
375
- const specs = evaluateSpecs(
376
- group.map((plan) => plan.source),
377
- app,
378
- )
379
- const identity = appIdentity(app)
380
- group.forEach((plan, index) => {
381
- plan.receipt = {
382
- key: plan.key,
383
- environment: plan.environment,
384
- app: identity,
385
- spec: specs[index]!,
386
- }
387
- receipts.set(plan.key, plan.receipt)
388
- const file = receiptFile(plan.key, plan.environment)
389
- fs.mkdirSync(path.dirname(file), { recursive: true })
390
- const temporary = `${file}.${randomUUID()}.tmp`
391
- fs.writeFileSync(temporary, JSON.stringify(plan.receipt))
392
- fs.renameSync(temporary, file)
393
- })
290
+ return files.map((podspec) => {
291
+ const plan = planPodspec(podspec, appRoot)
292
+ if (!plan.receipt) {
293
+ plan.receipt = {
294
+ key: plan.key,
295
+ environment: plan.environment,
296
+ app: appIdentity(plan.app),
297
+ spec: evaluatedSpecSchema.parse(
298
+ evaluatePodspec(plan.source, plan.app, packageRoot(plan.file), podspecEnv()),
299
+ ),
300
+ }
301
+ receipts.set(plan.key, plan.receipt)
302
+ const file = receiptFile(plan.key, plan.environment)
303
+ fs.mkdirSync(path.dirname(file), { recursive: true })
304
+ const temporary = `${file}.${randomUUID()}.tmp`
305
+ fs.writeFileSync(temporary, JSON.stringify(plan.receipt))
306
+ fs.renameSync(temporary, file)
394
307
  }
395
- }
396
- for (const plan of plans) registerReceipt(plan, plan.receipt!)
397
- return plans.map((plan) => decodeSpec(plan.receipt!.spec))
308
+ registerReceipt(plan, plan.receipt)
309
+ return decodeSpec(plan.receipt.spec)
310
+ })
398
311
  }
399
312
 
400
313
  export function podspecAttribute(spec: Spec, attribute: string): string[] | null {
@@ -2635,7 +2635,7 @@ const OS_IOS = /\b(?:os\(\s*iOS\s*\)|targetEnvironment\(\s*simulator\s*\))/g
2635
2635
  // the guest is the arm64 iOS simulator at 64-bit pointers: the compiler reports wasm64, so a
2636
2636
  // package that lists only the architectures its iOS build runs on would reach its
2637
2637
  // `#error("Unknown architecture")`. a target naming a declaration its
2638
- // headers make only for arm64 keeps wasm64 (swiftTargetsOnWasmArch).
2638
+ // headers make only for arm64 keeps wasm64 (swiftTargetArchitectures).
2639
2639
  const ARCH_ARM64 = /\barch\(\s*arm64\s*\)/g
2640
2640
  // iOS has no FoundationNetworking module; Peach's is imported implicitly
2641
2641
  // and gated packages must take their Apple branch
@@ -2654,6 +2654,8 @@ const DELEGATE_CLASS =
2654
2654
  // wasm64 in every condition, as its C does, and takes the path its other
2655
2655
  // architectures take; `arch(arm64)` holds everywhere else.
2656
2656
  const ARM64_MACRO = /^__(?:aarch64|arm64|AARCH64|ARM)/
2657
+ const WASM_MACRO = /\b__(?:wasm(?:32|64)?|wasi)__\b/
2658
+ const ARCH_WASM32 = /\barch\(\s*wasm32\s*\)/
2657
2659
  const C_WORDS = new Set(
2658
2660
  'auto bool break case char const continue default do double else enum extern false float for goto if inline int long register restrict return short signed sizeof static struct switch true typedef union unsigned void volatile while YES NO NULL nil Nil id self super instancetype'.split(
2659
2661
  ' ',
@@ -2665,6 +2667,7 @@ let archEnvironments:
2665
2667
  function headerNamesByArch(headers: Iterable<string>): {
2666
2668
  arm64: Set<string>
2667
2669
  wasm: Set<string>
2670
+ withoutWasm: Set<string>
2668
2671
  } {
2669
2672
  archEnvironments ??= (() => {
2670
2673
  const predefines = swiftCPredefines('objective-c')
@@ -2676,11 +2679,21 @@ function headerNamesByArch(headers: Iterable<string>): {
2676
2679
  },
2677
2680
  }
2678
2681
  })()
2679
- const names = { arm64: new Set<string>(), wasm: new Set<string>() }
2682
+ const names = {
2683
+ arm64: new Set<string>(),
2684
+ wasm: new Set<string>(),
2685
+ withoutWasm: new Set<string>(),
2686
+ }
2687
+ const withoutWasm = { ...archEnvironments.wasm, defines: emptyMacroEnvironment.defines }
2680
2688
  for (const header of headers) {
2681
2689
  const code = stripCCode(header)
2682
2690
  const wasm = cActiveCode(code, archEnvironments.wasm).match(/[A-Za-z_]\w*/g) ?? []
2683
2691
  for (const name of wasm) names.wasm.add(name)
2692
+ if (WASM_MACRO.test(code))
2693
+ for (const match of cActiveCode(code, withoutWasm).matchAll(
2694
+ /\b([A-Za-z_]\w*)\s*\(/g,
2695
+ ))
2696
+ names.withoutWasm.add(match[1]!)
2684
2697
  if (!/\b__(?:aarch64|arm64|AARCH64|ARM)/.test(code)) continue
2685
2698
  for (const name of cActiveCode(code, archEnvironments.arm64).match(/[A-Za-z_]\w*/g) ??
2686
2699
  [])
@@ -2689,11 +2702,11 @@ function headerNamesByArch(headers: Iterable<string>): {
2689
2702
  return names
2690
2703
  }
2691
2704
 
2692
- export function swiftTargetsOnWasmArch(
2705
+ function swiftTargetArchitectures(
2693
2706
  targets: readonly SwiftPackageTarget[],
2694
2707
  swiftSources: ReadonlyMap<string, readonly string[]>,
2695
2708
  headers: (target: SwiftPackageTarget) => Iterable<string>,
2696
- ): Set<string> {
2709
+ ) {
2697
2710
  const byName = new Map(targets.map((target) => [target.name, target]))
2698
2711
  const namesByTarget = new Map<string, ReturnType<typeof headerNamesByArch>>()
2699
2712
  const targetNames = (target: SwiftPackageTarget) => {
@@ -2703,6 +2716,7 @@ export function swiftTargetsOnWasmArch(
2703
2716
  return names
2704
2717
  }
2705
2718
  const onWasm = new Set<string>()
2719
+ const withoutWasm = new Map<string, ReadonlySet<string>>()
2706
2720
  for (const [name, sources] of swiftSources) {
2707
2721
  const target = byName.get(name)
2708
2722
  if (!target) continue
@@ -2714,6 +2728,14 @@ export function swiftTargetsOnWasmArch(
2714
2728
  }),
2715
2729
  ].map(targetNames)
2716
2730
  const wasm = new Set(visible.flatMap((names) => [...names.wasm]))
2731
+ if (sources.some((source) => ARCH_WASM32.test(source))) {
2732
+ const unavailable = new Set(
2733
+ visible
2734
+ .flatMap((names) => [...names.withoutWasm])
2735
+ .filter((name) => !wasm.has(name)),
2736
+ )
2737
+ if (unavailable.size) withoutWasm.set(name, unavailable)
2738
+ }
2717
2739
  const arm64Only = [...new Set(visible.flatMap((names) => [...names.arm64]))].filter(
2718
2740
  (name) => !wasm.has(name) && !C_WORDS.has(name),
2719
2741
  )
@@ -2722,7 +2744,46 @@ export function swiftTargetsOnWasmArch(
2722
2744
  if (sources.some((source) => named.test(source) && named.test(swiftCodeMask(source))))
2723
2745
  onWasm.add(name)
2724
2746
  }
2725
- return onWasm
2747
+ return { onWasm, withoutWasm }
2748
+ }
2749
+
2750
+ // old swift packages used wasm32 to exclude calls their clang headers hide on
2751
+ // every wasm target. apply that meaning only to the clause that calls them.
2752
+ function swiftWasmCallGuards(source: string, unavailable: ReadonlySet<string>): string {
2753
+ if (!ARCH_WASM32.test(source)) return source
2754
+ const code = swiftCodeMask(source)
2755
+ const clauses = /^[ \t]*#(if|elseif|else|endif)\b([^\n]*)/gm
2756
+ const stack: ({ start: number; body: number } | undefined)[] = []
2757
+ const edits: [number, number, string][] = []
2758
+ for (const directive of code.matchAll(clauses)) {
2759
+ const kind = directive[1]
2760
+ if (kind !== 'if') {
2761
+ const previous = stack.pop()
2762
+ if (previous) {
2763
+ const body = code.slice(previous.body, directive.index)
2764
+ for (const match of body.matchAll(/\b([A-Za-z_]\w*)\s*\(/g)) {
2765
+ if (!unavailable.has(match[1]!)) continue
2766
+ const condition = ARCH_WASM32.exec(code.slice(previous.start, previous.body))!
2767
+ edits.push([
2768
+ previous.start + condition.index,
2769
+ condition[0].length,
2770
+ 'true'.padEnd(condition[0].length),
2771
+ ])
2772
+ break
2773
+ }
2774
+ }
2775
+ }
2776
+ if (kind !== 'endif')
2777
+ stack.push(
2778
+ /^\s*!\s*arch\(\s*wasm32\s*\)\s*$/.test(directive[2]!)
2779
+ ? { start: directive.index, body: directive.index + directive[0].length }
2780
+ : undefined,
2781
+ )
2782
+ }
2783
+ let out = source
2784
+ for (const [at, width, replacement] of edits.sort((a, b) => b[0] - a[0]))
2785
+ out = out.slice(0, at) + replacement + out.slice(at + width)
2786
+ return out
2726
2787
  }
2727
2788
 
2728
2789
  function compiledSwiftSources(
@@ -2752,7 +2813,7 @@ function compiledSwiftSources(
2752
2813
  for (const { source, owner } of owners.values())
2753
2814
  if (owner)
2754
2815
  swiftSources.set(owner.name, [...(swiftSources.get(owner.name) ?? []), source])
2755
- const wasmArch = swiftTargetsOnWasmArch(targets, swiftSources, headers)
2816
+ const { onWasm, withoutWasm } = swiftTargetArchitectures(targets, swiftSources, headers)
2756
2817
  return new Map(
2757
2818
  [...owners].map(([file, { source, owner }]) => {
2758
2819
  // generated transport must keep its wasi exports while app code emulates ios.
@@ -2764,14 +2825,15 @@ function compiledSwiftSources(
2764
2825
  const manifest = /(?:^|\/)Package(?:@swift-[\d.]+)?\.swift$/.test(file)
2765
2826
  if (manifest && (!owner || /^Package(?:@swift-[\d.]+)?\.swift$/.test(file)))
2766
2827
  return [file, source]
2828
+ const unavailable = owner && withoutWasm.get(owner.name)
2767
2829
  const ios = swiftSourceAsIOS(
2768
- source,
2830
+ unavailable ? swiftWasmCallGuards(source, unavailable) : source,
2769
2831
  overlayFrameworks,
2770
2832
  owner?.defines?.includes(SWIFT_XCODE_BUILD_CONDITION) &&
2771
2833
  !owner.defines.includes('SWIFT_PACKAGE')
2772
2834
  ? false
2773
2835
  : undefined,
2774
- !owner || !wasmArch.has(owner.name),
2836
+ !owner || !onWasm.has(owner.name),
2775
2837
  )
2776
2838
  return [file, withPreconcurrencyFoundationModules(ios)]
2777
2839
  }),
@@ -2938,7 +3000,6 @@ const FOUNDATION_OVERLAY_TYPES = new Set([
2938
3000
  'NSAssertionHandler',
2939
3001
  'NSAttributedStringFormattingContextKey',
2940
3002
  'NSBundleResourceRequest',
2941
- 'NSCollectionChangeType',
2942
3003
  'NSConditionLock',
2943
3004
  'NSException',
2944
3005
  'NSExtensionItem',
@@ -2976,9 +3037,6 @@ const FOUNDATION_OVERLAY_TYPES = new Set([
2976
3037
  'NSMetadataQueryAttributeValueTuple',
2977
3038
  'NSMetadataQueryDelegate',
2978
3039
  'NSMetadataQueryResultGroup',
2979
- 'NSOrderedCollectionChange',
2980
- 'NSOrderedCollectionDifference',
2981
- 'NSOrderedCollectionDifferenceCalculationOptions',
2982
3040
  'NSPointerArray',
2983
3041
  'NSPredicateValidating',
2984
3042
  'NSProxy',
@@ -1,10 +1,10 @@
1
1
  {
2
- "id": "bc40ad2d5d02ab07",
2
+ "id": "16225f964dc45bd4",
3
3
  "release": "swift-6.4.0-RELEASE-custom-cbd9cef4b408cc96",
4
4
  "wasmSdkId": "swift-6.4.0-RELEASE_wasm-peach-8200ad6f",
5
5
  "wasmSdkUrl": "https://r2.rnxsim.com/swift-wasm-sdk/swift-6.4.0-RELEASE_wasm-peach-8200ad6f.artifactbundle.tar.gz",
6
6
  "wasmSdkChecksum": "8bad20813c74d19d242f1f2d05b7afacbaad6be6930bc3b696dfa2c3e41f0297",
7
- "source": "5fa745a21992484252eecda3078cbe269ab91290",
7
+ "source": "e0429c2746b5110cbd34a08278ef39fd8afcccc9",
8
8
  "targets": [
9
9
  "AddressBook",
10
10
  "EventKitUI",
@@ -61,6 +61,7 @@
61
61
  "FoundationNetworking",
62
62
  "DeveloperToolsSupport",
63
63
  "CoreImageEnums",
64
+ "SwiftUICore",
64
65
  "SwiftUI",
65
66
  "DarwinRecords",
66
67
  "Darwin",
@@ -252,16 +253,16 @@
252
253
  },
253
254
  "hosts": {
254
255
  "darwin-arm64": {
255
- "sha256": "923fcab189e826a45d389a78c6d910834eb6274c338eb3f12078b7e7bf7bedf9",
256
- "size": 110605000
256
+ "sha256": "ecfd2225503eedf9208359fd81472907d4b0293b0a2e0f366682bd6551523427",
257
+ "size": 110571839
257
258
  },
258
259
  "linux-x64": {
259
- "sha256": "88f5cc4da582ad06b69795e8a374cb827c45669bac8edb28e410124eff4ea7f6",
260
- "size": 113323738
260
+ "sha256": "499a800b8c169bd35dca753d30cc839c5992a5bde9d4fcc55f07ff422a3df3f2",
261
+ "size": 113289285
261
262
  },
262
263
  "linux-arm64": {
263
- "sha256": "d7040efcb9f587b74af1212076814f49b266eb11f473c401e32d31b45e743bc7",
264
- "size": 112812547
264
+ "sha256": "1f8e754184b630c34141a503b8016135f6ac8ad2a1b4db967990a797862f34ec",
265
+ "size": 112783063
265
266
  }
266
267
  }
267
268
  }
package/src/swift-host.ts CHANGED
@@ -2035,13 +2035,23 @@ export function buildSwiftResourceTable(
2035
2035
  return swiftResourceBundleForFile(bundles, key)?.path ?? '.'
2036
2036
  },
2037
2037
  ).map((image) => ({ ...image, file: bundled.get(image.file) ?? image.file }))
2038
- const colors = enumerateBundleColors(catalogFiles, readContents)
2039
- const symbols = enumerateBundleSymbols(catalogFiles, readContents, (file) => {
2038
+ const catalogBundle = (file: string) => {
2040
2039
  const disk = byRelative.get(file)
2041
- if (!disk) throw new Error(`symbol source ${file} has no input file`)
2040
+ if (!disk) throw new Error(`catalog source ${file} has no input file`)
2042
2041
  const key = layout ? xcodeInputKey(layout, disk, file) : file
2043
2042
  return swiftResourceBundleForFile(bundles, key)?.path ?? '.'
2044
- })
2043
+ }
2044
+ const colors = enumerateBundleColors(catalogFiles, readContents)
2045
+ // a package bundle's colors also answer under their bundle-relative key,
2046
+ // the one its Bundle.module lookups use, as its symbols are keyed.
2047
+ const packageCatalogs = Map.groupBy(catalogFiles, catalogBundle)
2048
+ packageCatalogs.delete('.')
2049
+ for (const [bundle, files] of packageCatalogs)
2050
+ for (const [name, color] of Object.entries(
2051
+ enumerateBundleColors(files, readContents),
2052
+ ))
2053
+ colors[`${bundle}/${name}`] = color
2054
+ const symbols = enumerateBundleSymbols(catalogFiles, readContents, catalogBundle)
2045
2055
  const table: SwiftImageResources = Object.create(null)
2046
2056
  const images: Record<string, SwiftImageUpload> = {}
2047
2057
  const metalSources: Record<string, SwiftMetalLibrarySource> = {}
@@ -12,7 +12,7 @@
12
12
  "checksum": "8bad20813c74d19d242f1f2d05b7afacbaad6be6930bc3b696dfa2c3e41f0297"
13
13
  },
14
14
  "framework": {
15
- "distribution": "bc40ad2d5d02ab07",
15
+ "distribution": "16225f964dc45bd4",
16
16
  "wireAbi": "38eed69f6b7391584112981b7892914e7033d7e0c17c2e8d4a4448030618bd2b"
17
17
  },
18
18
  "archives": [
@@ -20,71 +20,71 @@
20
20
  "headers": {
21
21
  "reactNativeJsi": "0f8c2defbca69a27a848a81ae72363073bf9602fd316e57a75811be1a0528358"
22
22
  },
23
- "sha256": "2614118da2d86bb9f647b84ad3bb6ac2b5bc13f0d0f6e1bfc23e0ed6a7626356",
23
+ "sha256": "c144c43e1c941143b25c5a02c110125d9603ca8ae8b08d77ba96fa47b1f13ef7",
24
24
  "size": 26179
25
25
  },
26
26
  {
27
27
  "headers": {
28
28
  "reactNativeJsi": "21a624ea24fd17d56bf26832d496fc1177067f89640414c20e6486c7984dfb0a"
29
29
  },
30
- "sha256": "c93c41da7ca8d9d2224755e1157e38d9c16a2f3f10b0e5a72df93e01955e6254",
31
- "size": 26917
30
+ "sha256": "0ea1d72e09441ba4341f774b7e50fb02538f3a9353349583d7663684763d9756",
31
+ "size": 26918
32
32
  },
33
33
  {
34
34
  "headers": {
35
35
  "reactNativeJsi": "324aefd8591d9ce688bce7589c4c2b516cd33ecb95d35c47239a87a8fcf6a8da"
36
36
  },
37
- "sha256": "22ab1e2624df513bb839f60801053c6bfea16b5893d5cf79aa8b493ef365a4ff",
38
- "size": 26168
37
+ "sha256": "892dfda9f8c621fd9945860c883b5576926fab6889e3c9d5da1b263a2afd9bae",
38
+ "size": 26171
39
39
  },
40
40
  {
41
41
  "headers": {
42
42
  "reactNativeJsi": "33596664ee7d7a6623f0796a6feb429543316c3a41b211150acda6e1d835286c"
43
43
  },
44
- "sha256": "5a8b143f5156fd6eeb4b2dfbba8a03db3bc53d149069d9b1fde7e34819cb491e",
45
- "size": 25959
44
+ "sha256": "5decc22f282534cbc37a0947914bbac9712632dc09457f38ded4d3df73c2914a",
45
+ "size": 25963
46
46
  },
47
47
  {
48
48
  "headers": {
49
49
  "reactNativeJsi": "66b2cd5a38511195207f6c8a76aba735f9b9cc66a52a0d00780ffe5d331623f7"
50
50
  },
51
- "sha256": "e0d1ffd5378fe3d9f810fbed6212701d995072e06abb3779727a286c21439e68",
52
- "size": 26177
51
+ "sha256": "872ea016120eb3c25c1a2246bcd3c1c46ed97fdbcfe69c7ccc1debfe603aeae6",
52
+ "size": 26176
53
53
  },
54
54
  {
55
55
  "headers": {
56
56
  "reactNativeJsi": "96db4e758dd53e9320cef7cad485e00aa06e7a982cefd920f17007de8a5bd9f9"
57
57
  },
58
- "sha256": "58b321f114b51ff8da608af62cc7cc475dc0dd66548b45d502803f43e4d3395a",
59
- "size": 26911
58
+ "sha256": "0702af793760400889c796fb9030ee58907e85a4d47a2d22b5be9ba104d4fd13",
59
+ "size": 26913
60
60
  },
61
61
  {
62
62
  "headers": {
63
63
  "reactNativeJsi": "aeab590ddd1218df963462242d3954ce467b0fa88f70e91429e4ffc74d230893"
64
64
  },
65
- "sha256": "d06fb5890b8bd2df42caa1a37622c76b987110a92c8457113891ae5fe817a731",
65
+ "sha256": "90b65d39c4a3f9fcc02ed08af77d1f20499a5e954b12bdd343a4431936520903",
66
66
  "size": 26916
67
67
  },
68
68
  {
69
69
  "headers": {
70
70
  "reactNativeJsi": "b5fb260522384dd7ab07d740cdc534b529922446fcec798341c7817d9eaa49f4"
71
71
  },
72
- "sha256": "4597f353aee8fa8613960e280dffb2db1b893194b163a5cc098a1c99b3b93e64",
73
- "size": 26047
72
+ "sha256": "f9b2aa338b4b8d28f7a764ca0eda45bc4e13a0b8b8d209555ae2f385255f5335",
73
+ "size": 26053
74
74
  },
75
75
  {
76
76
  "headers": {
77
77
  "reactNativeJsi": "c6b391a1e870ccf7cdd534be63582862840f8245b99ebd253317deece1e6ffd5"
78
78
  },
79
- "sha256": "26150e17a86dd52ed8f6575f3de2f07812c833dcedbe1313e81358f1439337ba",
80
- "size": 26914
79
+ "sha256": "b5f474e28189996fc265b3b38557d3ca3561535566f238ba421d3eb537dc05ed",
80
+ "size": 26915
81
81
  },
82
82
  {
83
83
  "headers": {
84
84
  "reactNativeJsi": "c8270f1315745ecc204c4209a4f50f58ff6f14b4a385ad6820a69800270b53c6"
85
85
  },
86
- "sha256": "3161e3e6e71bdebb9db6ecac952e76be789d10a086e050ecfe735913523633af",
87
- "size": 25919
86
+ "sha256": "18bfac5b52de230943a003214e4fe1125f5c82d9fec2a3c696dbc27b4fe2d2dd",
87
+ "size": 25921
88
88
  }
89
89
  ]
90
90
  }