peachsim 0.1.1406 → 0.1.1463

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 (149) hide show
  1. package/LICENSE +8 -4
  2. package/README.md +22 -2
  3. package/cli/app-fonts.ts +50 -44
  4. package/cli/bin.ts +5 -4
  5. package/cli/bridge-diagnostics.ts +5 -0
  6. package/cli/bridge-flow-runner.ts +21 -13
  7. package/cli/cloud-client.ts +4 -3
  8. package/cli/commands/control.ts +155 -123
  9. package/cli/commands/daemon-mac-app.ts +3 -3
  10. package/cli/commands/daemon.ts +2 -2
  11. package/cli/commands/do-chain.ts +9 -2
  12. package/cli/commands/electron.ts +4 -1
  13. package/cli/commands/inspect/core.ts +1 -1
  14. package/cli/commands/inspect/settle.ts +19 -7
  15. package/cli/commands/inspect/settling.ts +92 -56
  16. package/cli/commands/inspect/wait-idle.ts +21 -9
  17. package/cli/commands/inspect/wait-ready.ts +22 -8
  18. package/cli/commands/inspect.ts +101 -134
  19. package/cli/commands/setup.ts +26 -16
  20. package/cli/commands/upgrade.ts +53 -9
  21. package/cli/desktop-companion.ts +1 -1
  22. package/cli/drivers/playwright-sim-host.ts +22 -13
  23. package/cli/drivers/playwright.ts +3 -3
  24. package/cli/main.ts +14 -5
  25. package/cli/outbound-endpoints.ts +1 -9
  26. package/detox/index.ts +6 -1
  27. package/dist-lib/agent-daemon-client.cjs +1 -1
  28. package/dist-lib/agent-events.cjs +1 -1
  29. package/dist-lib/attached-projects.cjs +1 -1
  30. package/dist-lib/auth/shared-session.cjs +1 -1
  31. package/dist-lib/backend-origin.cjs +1 -1
  32. package/dist-lib/beta.cjs +1 -1
  33. package/dist-lib/beta.mjs +1 -1
  34. package/dist-lib/bridge-constants.cjs +1 -1
  35. package/dist-lib/bridge-contract-input.cjs +1 -1
  36. package/dist-lib/bridge-contract-input.mjs +1 -1
  37. package/dist-lib/bridge-contract.cjs +3 -3
  38. package/dist-lib/bridge-contract.mjs +3 -3
  39. package/dist-lib/bundle-channel.cjs +322 -274
  40. package/dist-lib/capture-contract.cjs +1 -1
  41. package/dist-lib/capture-contract.mjs +1 -1
  42. package/dist-lib/cloud-contract.cjs +1 -1
  43. package/dist-lib/cloud-contract.mjs +1 -1
  44. package/dist-lib/cloud-test-args.cjs +1 -1
  45. package/dist-lib/cloud-test-args.mjs +1 -1
  46. package/dist-lib/cloud.cjs +1 -1
  47. package/dist-lib/cloud.mjs +1 -1
  48. package/dist-lib/config.cjs +1 -1
  49. package/dist-lib/config.mjs +1 -1
  50. package/dist-lib/detox/index.cjs +322 -45
  51. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  52. package/dist-lib/expo-swift-bundle.cjs +69 -33
  53. package/dist-lib/expo-swift-metadata.cjs +1 -1
  54. package/dist-lib/expo-swift-metadata.mjs +1 -1
  55. package/dist-lib/home-paths.cjs +1 -1
  56. package/dist-lib/host/bridge-host.cjs +3650 -3528
  57. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  58. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  59. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  60. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  61. package/dist-lib/host/websocket-proxy.cjs +1 -1
  62. package/dist-lib/index.cjs +327 -123
  63. package/dist-lib/jump-to-source-babel.cjs +1 -1
  64. package/dist-lib/jump-to-source-native.cjs +1 -1
  65. package/dist-lib/kotlin-host.cjs +10 -5
  66. package/dist-lib/menu.cjs +1 -1
  67. package/dist-lib/menu.mjs +1 -1
  68. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  69. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  70. package/dist-lib/metro-production-bundle.cjs +1 -1
  71. package/dist-lib/metro-production-bundle.mjs +1 -1
  72. package/dist-lib/metro.cjs +49 -47
  73. package/dist-lib/native-app-identity-project.cjs +1 -1
  74. package/dist-lib/native-app-identity-project.mjs +1 -1
  75. package/dist-lib/native-app-identity.cjs +1 -1
  76. package/dist-lib/native-app-identity.mjs +1 -1
  77. package/dist-lib/native-firebase-metadata.cjs +1 -1
  78. package/dist-lib/native-firebase-metadata.mjs +1 -1
  79. package/dist-lib/plist.cjs +1 -1
  80. package/dist-lib/plist.mjs +1 -1
  81. package/dist-lib/profiles.cjs +1 -1
  82. package/dist-lib/public-brand.cjs +1 -1
  83. package/dist-lib/react-native-host-modules.cjs +1 -1
  84. package/dist-lib/react-native-host-modules.mjs +1 -1
  85. package/dist-lib/scripts/dev-server-scanner.cjs +23 -17
  86. package/dist-lib/sdk.cjs +99 -61
  87. package/dist-lib/sdk.mjs +97 -61
  88. package/dist-lib/skills.cjs +2959 -2780
  89. package/dist-lib/swift-compile.cjs +26 -12
  90. package/dist-lib/swift-compile.mjs +26 -12
  91. package/dist-lib/swift-package.cjs +1 -1
  92. package/dist-lib/swift-package.mjs +1 -1
  93. package/dist-lib/swift-submit.cjs +2 -2
  94. package/dist-lib/swift-submit.mjs +2 -2
  95. package/dist-lib/swift-toolchain.cjs +1 -1
  96. package/dist-lib/swift.cjs +1 -1
  97. package/dist-lib/vite-swift.cjs +66 -31
  98. package/dist-lib/vite.cjs +1 -1
  99. package/dist-lib/worklet-executable.cjs +1 -1
  100. package/dist-lib/worklet-executable.mjs +1 -1
  101. package/kotlin/AppSources/android/view/Window.kt +2 -0
  102. package/kotlin/AppSources/dev/peach/app/PeachApp.kt +1 -1
  103. package/kotlin/ComposeSources/PeachComposeHost.kt +35 -9
  104. package/kotlin/ExpoComposeSources/dev/peach/expo/PeachExpoCompose.kt +2 -2
  105. package/kotlin/ExpoSources/dev/peach/expo/PeachExpoRuntime.kt +9 -6
  106. package/kotlin/ExpoSources/dev/peach/expo/PeachExpoTypes.kt +4 -4
  107. package/kotlin/ExpoSources/expo/modules/kotlin/modules/Module.kt +2 -2
  108. package/kotlin/ExpoSources/expo/modules/kotlin/viewevent/ViewEvent.kt +22 -8
  109. package/kotlin/ExpoSources/expo/modules/kotlin/views/ExpoView.kt +0 -3
  110. package/kotlin/ExpoSources/expo/modules/kotlin/views/ViewDefinitionBuilder.kt +10 -9
  111. package/kotlin/ExpoSources/expo/modules/kotlin/views/ViewProps.kt +6 -5
  112. package/kotlin/fixtures/import-drawing/Drawing.d.kt.ts +7 -0
  113. package/kotlin/fixtures/import-drawing/Drawing.kt +101 -0
  114. package/kotlin/fixtures/import-drawing/ImportDrawing.native.tsx +18 -0
  115. package/kotlin/fixtures/import-drawing/README.md +34 -0
  116. package/kotlin/fixtures/import-drawing/app/_layout.tsx +4 -0
  117. package/kotlin/fixtures/import-drawing/app/index+spa.tsx +1 -0
  118. package/kotlin/fixtures/import-drawing/package.json +23 -0
  119. package/kotlin/fixtures/import-drawing/tsconfig.json +20 -0
  120. package/kotlin/fixtures/import-drawing/vite.config.ts +20 -0
  121. package/kotlin/fixtures/import-scroll/ImportNested.native.tsx +10 -0
  122. package/kotlin/fixtures/import-scroll/Nested.d.kt.ts +4 -0
  123. package/kotlin/fixtures/import-scroll/README.md +15 -0
  124. package/kotlin/fixtures/import-scroll/app/nested+spa.tsx +1 -0
  125. package/kotlin/fixtures/import-values/ImportValues.native.tsx +26 -0
  126. package/kotlin/fixtures/import-values/README.md +6 -1
  127. package/kotlin/fixtures/import-values/Values.d.kt.ts +4 -0
  128. package/kotlin/fixtures/import-values/Values.kt +18 -0
  129. package/kotlin/tools/expo-types.main.kts +17 -5
  130. package/package.json +2 -1
  131. package/scripts/dev-server-scanner.ts +33 -23
  132. package/src/assetCatalogContract.ts +7 -0
  133. package/src/bridge-contract.ts +21 -3
  134. package/src/connect.ts +18 -5
  135. package/src/desktop-host-delivery.ts +33 -3
  136. package/src/expo-swift-host.ts +6 -3
  137. package/src/host/bridge-host.ts +2 -0
  138. package/src/host/fetch-proxy-transport.ts +8 -0
  139. package/src/kotlin-host.ts +11 -5
  140. package/src/native-firebase-config.ts +95 -54
  141. package/src/process-output.ts +16 -0
  142. package/src/sdk.ts +6 -1
  143. package/src/sim-client.ts +6 -1
  144. package/src/swift-compile.ts +36 -15
  145. package/src/swift-distribution.lock.json +8 -8
  146. package/src/swift-standin-emit.ts +10 -1
  147. package/src/swift-standins.ts +21 -7
  148. package/src/swift-submit.ts +6 -1
  149. /package/kotlin/fixtures/{kotlin-app-variants → import-scroll}/Nested.kt +0 -0
@@ -612,7 +612,7 @@ const FOUNDATION_IMPLICIT_FLAGS = FOUNDATION_IMPLICIT_MODULES.map(
612
612
  const ONE_IMPLICIT_FLAGS = ', "-Xfrontend", "-import-module", "-Xfrontend", "One"'
613
613
 
614
614
  /** bump with any change to the emitted multi-target manifest text. */
615
- export const MULTI_MANIFEST_VERSION = 18
615
+ export const MULTI_MANIFEST_VERSION = 19
616
616
 
617
617
  export function swiftArtifactHash(
618
618
  input: SwiftCompileInput,
@@ -620,6 +620,7 @@ export function swiftArtifactHash(
620
620
  moduleRoot: string,
621
621
  ): string {
622
622
  const hash = createHash('sha256')
623
+ // v24: distribution objects use an ordered linker response file
623
624
  // v22: Foundation sources see Darwin, which carries the libc and Mach
624
625
  // v21: Foundation sources see the ObservableObject and Published aliases
625
626
  // v20: supplied table editing and swipe methods preserve objective-c selectors
@@ -638,7 +639,7 @@ export function swiftArtifactHash(
638
639
  // v6: app and scene delegate classes compile final
639
640
  // (v5: a target declaring resources gets SwiftPM's Bundle.module accessor;
640
641
  // v4: sources compile through swiftSourceAsIOS)
641
- hash.update(`swift-compile/v23\n${release}\n`)
642
+ hash.update(`swift-compile/v24\n${release}\n`)
642
643
  if (input.oneModule) hash.update('one-module\n')
643
644
  hash.update(swiftModuleDigest(moduleRoot))
644
645
  for (const file of Object.keys(input.files).sort()) {
@@ -721,6 +722,8 @@ export function emitSwiftPackageManifest(args: {
721
722
  spriteKit?: boolean
722
723
  /** link the prebuilt distribution at moduleRoot instead of its sources. */
723
724
  distribution?: SwiftDistributionManifest
725
+ /** ordered distribution objects, read by the linker without expanding argv. */
726
+ distributionLink?: { path: string; files: Map<string, string | Buffer> }
724
727
  /** the static library each target links, by target name. */
725
728
  libraries?: Map<string, string>
726
729
  }): string {
@@ -741,11 +744,27 @@ export function emitSwiftPackageManifest(args: {
741
744
  }
742
745
  // the distribution builder names each object lib/<target>-<file>.o.
743
746
  // preserve link order while leaving unreached optional module objects out.
744
- const distributionObjects = distribution?.objects.filter((object) =>
745
- [...OPTIONAL_FRAMEWORKS, 'SpriteKit', 'PeachBox2D'].every(
746
- (name) => !object.startsWith(`lib/${name}-`) || reachedFrameworks.has(name),
747
- ),
748
- )
747
+ const distributionLink = args.distributionLink
748
+ if (distribution && !distributionLink)
749
+ throw new Error(
750
+ 'swift-compile: distribution linking requires its object response file',
751
+ )
752
+ if (distribution && distributionLink) {
753
+ const objects = distribution.objects.filter((object) =>
754
+ [...OPTIONAL_FRAMEWORKS, 'SpriteKit', 'PeachBox2D'].every(
755
+ (name) => !object.startsWith(`lib/${name}-`) || reachedFrameworks.has(name),
756
+ ),
757
+ )
758
+ distributionLink.files.set(
759
+ distributionLink.path,
760
+ objects
761
+ .map(
762
+ (object) =>
763
+ `"${path.join(moduleRoot, object).replaceAll('\\', '\\\\').replaceAll('"', '\\"')}"`,
764
+ )
765
+ .join('\n') + '\n',
766
+ )
767
+ }
749
768
  const executable = targets.find((target) => target.executable)
750
769
  if (!executable) throw new Error('swift-compile: no executable target to emit')
751
770
  // each target compiles in the language mode and default isolation its
@@ -807,14 +826,12 @@ export function emitSwiftPackageManifest(args: {
807
826
  : [`"${dependency}"`],
808
827
  ),
809
828
  ].join(', ')
810
- const library = distribution
811
- ? [
812
- ...(distributionObjects ?? []).map((object) => path.join(moduleRoot, object)),
813
- ...distribution.link,
814
- ]
815
- .map((flag) => `, ${JSON.stringify(flag)}`)
816
- .join('')
817
- : ''
829
+ const library =
830
+ distribution && distributionLink
831
+ ? ['-Xlinker', `@${distributionLink.path}`, ...distribution.link]
832
+ .map((flag) => `, ${JSON.stringify(flag)}`)
833
+ .join('')
834
+ : ''
818
835
  const kind = target.executable ? '.executableTarget' : '.target'
819
836
  const link = target.executable
820
837
  ? `,
@@ -2554,6 +2571,10 @@ export function writeSwiftProject(
2554
2571
  oneModule: input.oneModule,
2555
2572
  spriteKit: importsSpriteKit(input.files),
2556
2573
  distribution: distribution ?? undefined,
2574
+ distributionLink: {
2575
+ path: path.join(layout.root, '.peach-distribution-objects.rsp'),
2576
+ files,
2577
+ },
2557
2578
  libraries,
2558
2579
  }) + moduleFiles,
2559
2580
  )
@@ -1,10 +1,10 @@
1
1
  {
2
- "id": "3246f7e5ccb24952",
2
+ "id": "c60899948fe25af8",
3
3
  "release": "swift-6.4.0-RELEASE",
4
4
  "wasmSdkId": "swift-6.4.0-RELEASE_wasm-peach-e4629014",
5
5
  "wasmSdkUrl": "https://r2.sootsim.com/swift-wasm-sdk/swift-6.4.0-RELEASE_wasm-peach-e4629014.artifactbundle.tar.gz",
6
6
  "wasmSdkChecksum": "522f3ff98e951872d64751376d45e36394e572ec2aa4e0a52fb0027824bf41f6",
7
- "source": "a1e87668019272a329f6d9fada213573e3c5107f",
7
+ "source": "22d7666f9c66ec4b558db482661d440e581d84ff",
8
8
  "targets": [
9
9
  "ExpoModulesCore",
10
10
  "PeachJSON",
@@ -118,16 +118,16 @@
118
118
  ],
119
119
  "hosts": {
120
120
  "darwin-arm64": {
121
- "sha256": "fb5a3e9db1eae670b5ba84432345e52de8b55b5fdf0e468ff95dfa25a62a6968",
122
- "size": 55050821
121
+ "sha256": "4661b87b8d627792bd28ef41d856bc9abcc913eb816efa448075d48e88abe823",
122
+ "size": 55595616
123
123
  },
124
124
  "linux-x64": {
125
- "sha256": "46a0eae68905751ee7c6536e79f626bc71d9d5a22cf9a76ce12b8d6c3aa34293",
126
- "size": 55056198
125
+ "sha256": "85dc5fc24acd33568f5ddccb3d69905c638162f5d5d767eefbbc16f9a4cca845",
126
+ "size": 55601101
127
127
  },
128
128
  "linux-arm64": {
129
- "sha256": "ea6453b55ff428d4d152d829731504400d49969ab0750264a931eaf0d7659122",
130
- "size": 55055213
129
+ "sha256": "009f687e2f5a03cf2af277638861543aead3ad907136c2de8e48a6a702040182",
130
+ "size": 55600268
131
131
  }
132
132
  }
133
133
  }
@@ -862,7 +862,16 @@ export function emitSwiftStandin(
862
862
  if (fix && !/^(?:prefix|infix|postfix)\b/.test(spelled))
863
863
  spelled = `${fix} ${spelled}`
864
864
  }
865
- emit(`${attrs}public ${spelled} { ${trap(path)} }`)
865
+ const measured = behavior.get(path)
866
+ if (measured) used.add(path)
867
+ const overloadBody = /\basync\b/.test(spelled)
868
+ ? measured?.asyncBody
869
+ : /\bResult</.test(spelled)
870
+ ? measured?.resultBody
871
+ : undefined
872
+ emit(
873
+ `${attrs}public ${spelled} { ${overloadBody ?? measured?.body ?? trap(path)} }`,
874
+ )
866
875
  } else if (kind === 'swift.var') {
867
876
  const parsed = splitAccessors(text(symbol).replace(/^let /, 'var '))
868
877
  // a measured global keeps the sdk's declaration with a working getter,
@@ -15,6 +15,7 @@ import fs from 'node:fs'
15
15
  import os from 'node:os'
16
16
  import path from 'node:path'
17
17
  import { getCliVersion } from './cli-version'
18
+ import { parsePlistSource } from './plist'
18
19
  import {
19
20
  swiftDistributionAt,
20
21
  swiftMacroPlugins,
@@ -773,6 +774,25 @@ function crateFor(root: string, name: string): string | null {
773
774
  return walk(root, 4)
774
775
  }
775
776
 
777
+ // the simulator slice's static library as the xcframework's Info.plist
778
+ // declares it, the name Xcode links; the archive itself may be unbuilt.
779
+ function simulatorLibraryName(dir: string): string | undefined {
780
+ const info = parsePlistSource(fs.readFileSync(path.join(dir, 'Info.plist'), 'utf8'))
781
+ const libraries =
782
+ info && typeof info === 'object' ? Reflect.get(info, 'AvailableLibraries') : undefined
783
+ if (!Array.isArray(libraries)) return undefined
784
+ return libraries
785
+ .filter(
786
+ (entry: unknown): entry is object =>
787
+ typeof entry === 'object' &&
788
+ entry !== null &&
789
+ Reflect.get(entry, 'SupportedPlatform') === 'ios' &&
790
+ Reflect.get(entry, 'SupportedPlatformVariant') === 'simulator',
791
+ )
792
+ .map((entry): unknown => Reflect.get(entry, 'LibraryPath'))
793
+ .find((name): name is string => typeof name === 'string' && /^lib.+\.a$/.test(name))
794
+ }
795
+
776
796
  /**
777
797
  * the WebAssembly static library a c stand-in links in place of its traps,
778
798
  * or null when it has none. a build the developer supplies in the
@@ -785,13 +805,7 @@ export function standinLibrary(
785
805
  searchRoot: string,
786
806
  ): string | null {
787
807
  const dir = xcframework(binary).dir
788
- const slice = fs
789
- .readdirSync(dir)
790
- .filter((name) => /^ios-.+-simulator$/.test(name))
791
- .sort()[0]
792
- const library = slice
793
- ? fs.readdirSync(path.join(dir, slice)).find((name) => /^lib.+\.a$/.test(name))
794
- : undefined
808
+ const library = simulatorLibraryName(dir)
795
809
  const supplied = path.join(dir, RUST_TARGET)
796
810
  if (fs.existsSync(supplied)) {
797
811
  const found = fs.readdirSync(supplied).filter((name) => name.endsWith('.a'))
@@ -98,7 +98,12 @@ export const MAX_SWIFT_COMPILE_IMAGE_TOTAL_BYTES = 16 * 1024 * 1024
98
98
  // 39: canvas image draw operations retain their target bundle.
99
99
  // 40: implicit animations retain typed value changes through a generation marker.
100
100
  // 41: original compiled SwiftUI libraries retain data and deferred URL inputs.
101
- export const SWIFT_HOST_ABI = 41
101
+ // 42: shader image arguments retain system symbol identity and content textures.
102
+ // 43: Foundation preferences retain property-list values through the tenant owner.
103
+ // 44: swift scene phase follows the tenant's application lifecycle.
104
+ // 45: confirmation dialogs present from a measured `presentationSource`, and a
105
+ // refreshable's pull ends on the host's `refreshEnded` request.
106
+ export const SWIFT_HOST_ABI = 45
102
107
 
103
108
  export interface SwiftImageUpload {
104
109
  /** the raster file picked for the asset (has the extension). */