peachsim 0.1.871 → 0.1.873

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 (82) hide show
  1. package/cli/commands/swift.ts +39 -12
  2. package/dist-lib/agent-daemon-client.cjs +1 -1
  3. package/dist-lib/agent-events.cjs +1 -1
  4. package/dist-lib/agent-identity.cjs +1 -1
  5. package/dist-lib/agent-sessions.cjs +1 -1
  6. package/dist-lib/attached-projects.cjs +1 -1
  7. package/dist-lib/auth/shared-session.cjs +1 -1
  8. package/dist-lib/backend-origin.cjs +1 -1
  9. package/dist-lib/beta.cjs +1 -1
  10. package/dist-lib/beta.mjs +1 -1
  11. package/dist-lib/bridge-constants.cjs +1 -1
  12. package/dist-lib/bridge-contract-input.cjs +1 -1
  13. package/dist-lib/bridge-contract-input.mjs +1 -1
  14. package/dist-lib/bridge-contract.cjs +1 -1
  15. package/dist-lib/bridge-contract.mjs +1 -1
  16. package/dist-lib/bundle-channel.cjs +10 -9
  17. package/dist-lib/capture-contract.cjs +1 -1
  18. package/dist-lib/capture-contract.mjs +1 -1
  19. package/dist-lib/cli-constants.cjs +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/detox/index.cjs +1 -1
  28. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  29. package/dist-lib/expo-swift-bundle.cjs +10 -9
  30. package/dist-lib/expo-swift-metadata.cjs +1 -1
  31. package/dist-lib/expo-swift-metadata.mjs +1 -1
  32. package/dist-lib/home-paths.cjs +1 -1
  33. package/dist-lib/host/bridge-host.cjs +48 -14
  34. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  35. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  36. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  37. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  38. package/dist-lib/host/websocket-proxy.cjs +1 -1
  39. package/dist-lib/index.cjs +2 -1
  40. package/dist-lib/jump-to-source-babel.cjs +1 -1
  41. package/dist-lib/jump-to-source-native.cjs +1 -1
  42. package/dist-lib/kotlin-host.cjs +1 -1
  43. package/dist-lib/menu.cjs +1 -1
  44. package/dist-lib/menu.mjs +1 -1
  45. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  46. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  47. package/dist-lib/metro-production-bundle.cjs +1 -1
  48. package/dist-lib/metro-production-bundle.mjs +1 -1
  49. package/dist-lib/metro.cjs +2 -1
  50. package/dist-lib/native-app-identity.cjs +1 -1
  51. package/dist-lib/native-app-identity.mjs +1 -1
  52. package/dist-lib/native-firebase-metadata.cjs +1 -1
  53. package/dist-lib/native-firebase-metadata.mjs +1 -1
  54. package/dist-lib/plist.cjs +1 -1
  55. package/dist-lib/plist.mjs +1 -1
  56. package/dist-lib/profiles.cjs +1 -1
  57. package/dist-lib/public-brand.cjs +1 -1
  58. package/dist-lib/react-native-host-modules.cjs +1 -1
  59. package/dist-lib/react-native-host-modules.mjs +1 -1
  60. package/dist-lib/render-mode.cjs +1 -1
  61. package/dist-lib/scripts/dev-server-scanner.cjs +39 -6
  62. package/dist-lib/sdk.cjs +1 -1
  63. package/dist-lib/sdk.mjs +1 -1
  64. package/dist-lib/skills.cjs +55 -14
  65. package/dist-lib/swift-compile.cjs +1 -1
  66. package/dist-lib/swift-compile.mjs +1 -1
  67. package/dist-lib/swift-package.cjs +1 -1
  68. package/dist-lib/swift-package.mjs +1 -1
  69. package/dist-lib/swift-submit.cjs +1 -1
  70. package/dist-lib/swift-submit.mjs +1 -1
  71. package/dist-lib/swift-toolchain.cjs +1 -1
  72. package/dist-lib/swift.cjs +1 -1
  73. package/dist-lib/vite-swift.cjs +10 -9
  74. package/dist-lib/vite.cjs +1 -1
  75. package/dist-lib/worklet-executable.cjs +1 -1
  76. package/dist-lib/worklet-executable.mjs +1 -1
  77. package/package.json +1 -1
  78. package/scripts/dev-server-scanner.ts +38 -19
  79. package/src/swift-distribution.lock.json +8 -8
  80. package/src/swift-host.ts +65 -0
  81. package/src/swiftDiscoveryContract.ts +32 -0
  82. package/src/xcode-project.ts +2 -0
@@ -1,22 +1,22 @@
1
1
  {
2
- "id": "8a53b074b33eb8b5",
2
+ "id": "cf49b84963eae4ec",
3
3
  "release": "swift-6.3-RELEASE",
4
4
  "wasmSdkId": "swift-6.3-RELEASE_wasm-peach-41921598-peach-edd95e37",
5
5
  "wasmSdkUrl": "https://r2.rnxsim.com/swift-wasm-sdk/swift-6.3-RELEASE_wasm-peach-41921598-peach-edd95e37.artifactbundle.tar.gz",
6
6
  "wasmSdkChecksum": "e8b76a6b78c21e9e16a6943a691ea001aeb0a18518d775a26130520303eb5c6d",
7
- "source": "882ff4ff4b262e108926af9d13985fba69132c1a",
7
+ "source": "7b29f31b65a02aea2d28fd0518e0118f2337f2b7",
8
8
  "hosts": {
9
9
  "darwin-arm64": {
10
- "sha256": "6199b51b4d4f963db72bff2fc7174d7944bbf7c6f0379b58fc9fe1db81081dd7",
11
- "size": 39773614
10
+ "sha256": "c120569e34e16edb81fe0fabe92a9d7c4c5f64b06363726b466f996cdb05588b",
11
+ "size": 43318901
12
12
  },
13
13
  "linux-x64": {
14
- "sha256": "dd414d2c73175b5ea4e142f414615e2648102f827a998b8a80edf3c0a8acbb0f",
15
- "size": 39779064
14
+ "sha256": "d8a65a3f77d7302ed3547f525c4274a6c7aa2bdccdf9a41f4864ad305d0ae643",
15
+ "size": 43324299
16
16
  },
17
17
  "linux-arm64": {
18
- "sha256": "67396e3baa888a4463ecfdeb9f14996e8f5ee397c181e64cf0e82868b27d3463",
19
- "size": 39778119
18
+ "sha256": "d47964d033ac59af2417939703335148993ea2d3e931a7db048a8080780c5de6",
19
+ "size": 43323284
20
20
  }
21
21
  }
22
22
  }
package/src/swift-host.ts CHANGED
@@ -479,6 +479,71 @@ function resourceCandidateFiles(root: string): string[] {
479
479
  )
480
480
  }
481
481
 
482
+ // discovery reads only the app target's catalog, before the first compile.
483
+ export function swiftProjectAppInfo(packagePath: string): {
484
+ name: string
485
+ icon: { bytes: Buffer; contentType: string } | null
486
+ } {
487
+ const registered = xcodeProjects.get(packagePath)
488
+ const app = registered
489
+ ? readXcodeAppTarget(registered.xcodeproj, registered.target)
490
+ : null
491
+ const files = app?.resources ?? resourceCandidateFiles(packagePath)
492
+ const catalogs = files.filter(
493
+ (file) =>
494
+ file.endsWith('.appiconset/Contents.json') &&
495
+ (!app?.appIconName ||
496
+ path.basename(path.dirname(file)) === `${app.appIconName}.appiconset`),
497
+ )
498
+ let icon: { bytes: Buffer; contentType: string } | null = null
499
+ for (const contents of catalogs) {
500
+ const value: unknown = JSON.parse(fs.readFileSync(contents, 'utf8'))
501
+ if (
502
+ !value ||
503
+ typeof value !== 'object' ||
504
+ !('images' in value) ||
505
+ !Array.isArray(value.images)
506
+ )
507
+ continue
508
+ const images: { filename: string; pixels: number }[] = []
509
+ const entries: readonly unknown[] = value.images
510
+ for (const image of entries) {
511
+ if (
512
+ !image ||
513
+ typeof image !== 'object' ||
514
+ !('filename' in image) ||
515
+ typeof image.filename !== 'string' ||
516
+ path.basename(image.filename) !== image.filename ||
517
+ !/\.(png|jpe?g|webp)$/i.test(image.filename)
518
+ )
519
+ continue
520
+ if (
521
+ 'idiom' in image &&
522
+ (typeof image.idiom !== 'string' ||
523
+ !['iphone', 'ios-marketing', 'universal'].includes(image.idiom))
524
+ )
525
+ continue
526
+ if ('appearances' in image) continue
527
+ const size =
528
+ 'size' in image && typeof image.size === 'string' ? parseFloat(image.size) : 0
529
+ const scale =
530
+ 'scale' in image && typeof image.scale === 'string' ? parseFloat(image.scale) : 1
531
+ images.push({ filename: image.filename, pixels: size * scale })
532
+ }
533
+ const picked = images.sort((a, b) => b.pixels - a.pixels)[0]
534
+ if (!picked) continue
535
+ const file = path.join(path.dirname(contents), picked.filename)
536
+ if (!files.includes(file)) continue
537
+ icon = {
538
+ bytes: fs.readFileSync(file),
539
+ contentType:
540
+ RESOURCE_CONTENT_TYPES[path.extname(file).toLowerCase()] ?? 'image/png',
541
+ }
542
+ break
543
+ }
544
+ return { name: app?.name ?? path.basename(packagePath), icon }
545
+ }
546
+
482
547
  // the hosted compile service caps what a project sends it; a local compile
483
548
  // reads the author's own files, so nothing caps them there.
484
549
  const HOSTED_LIMITS = {
@@ -0,0 +1,32 @@
1
+ // the foreground swift host's signature, shared by its server and scanner.
2
+ export const SWIFT_DISCOVERY_PATH = '/__peach/swift-host'
3
+ export const SWIFT_GUEST_PATH = '/__peach/swift-guest.js'
4
+ export const SWIFT_ICON_PATH = '/__peach/swift-icon'
5
+
6
+ export interface SwiftHostDiscovery {
7
+ framework: 'swift'
8
+ projectName: string
9
+ status: 'compiling' | 'ready' | 'error'
10
+ iconPath?: typeof SWIFT_ICON_PATH
11
+ }
12
+
13
+ export function parseSwiftHostDiscovery(value: unknown): SwiftHostDiscovery | null {
14
+ if (!value || typeof value !== 'object') return null
15
+ if (
16
+ !('framework' in value) ||
17
+ value.framework !== 'swift' ||
18
+ !('projectName' in value) ||
19
+ typeof value.projectName !== 'string' ||
20
+ !('status' in value) ||
21
+ (value.status !== 'compiling' && value.status !== 'ready' && value.status !== 'error')
22
+ )
23
+ return null
24
+ return {
25
+ framework: value.framework,
26
+ projectName: value.projectName,
27
+ status: value.status,
28
+ ...('iconPath' in value && value.iconPath === SWIFT_ICON_PATH
29
+ ? { iconPath: SWIFT_ICON_PATH }
30
+ : {}),
31
+ }
32
+ }
@@ -141,6 +141,7 @@ export interface XcodeAppTarget extends XcodeModuleTarget {
141
141
  /** the target's processed launch plist, including generated build settings. */
142
142
  infoPlist: string
143
143
  infoPlistFile: string | null
144
+ appIconName: string
144
145
  /** the target's compiled sources in every language, swift or not. */
145
146
  allSources: string[]
146
147
  /**
@@ -966,6 +967,7 @@ export function readXcodeAppTarget(input: string, targetName?: string): XcodeApp
966
967
  ].map((dir) => fs.realpathSync(dir)),
967
968
  ),
968
969
  projectFiles: [...new Set(used.map((project) => project.projectFile))].sort(),
970
+ appIconName: settings('ASSETCATALOG_COMPILER_APPICON_NAME'),
969
971
  infoPlist: plist.build(info),
970
972
  infoPlistFile,
971
973
  frameworks,