peachsim 0.1.714 → 0.1.716

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/cli/commands/install-desktop.ts +74 -20
  2. package/cli/desktop-companion.ts +11 -6
  3. package/dist-lib/agent-daemon-client.cjs +1 -1
  4. package/dist-lib/agent-events.cjs +1 -1
  5. package/dist-lib/agent-identity.cjs +1 -1
  6. package/dist-lib/agent-sessions.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/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/home-paths.cjs +1 -1
  30. package/dist-lib/host/bridge-host.cjs +71 -25
  31. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  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 +1 -1
  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 +1 -1
  47. package/dist-lib/native-app-identity.cjs +1 -1
  48. package/dist-lib/native-app-identity.mjs +1 -1
  49. package/dist-lib/native-firebase-metadata.cjs +1 -1
  50. package/dist-lib/native-firebase-metadata.mjs +1 -1
  51. package/dist-lib/plist.cjs +1 -1
  52. package/dist-lib/plist.mjs +1 -1
  53. package/dist-lib/profiles.cjs +1 -1
  54. package/dist-lib/public-brand.cjs +1 -1
  55. package/dist-lib/react-native-host-modules.cjs +1 -1
  56. package/dist-lib/react-native-host-modules.mjs +1 -1
  57. package/dist-lib/render-mode.cjs +1 -1
  58. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  59. package/dist-lib/sdk.cjs +1 -1
  60. package/dist-lib/sdk.mjs +1 -1
  61. package/dist-lib/skills.cjs +82 -31
  62. package/dist-lib/swift-compile.cjs +56 -21
  63. package/dist-lib/swift-compile.mjs +56 -21
  64. package/dist-lib/swift-package.cjs +27 -5
  65. package/dist-lib/swift-package.mjs +26 -5
  66. package/dist-lib/swift-submit.cjs +1 -1
  67. package/dist-lib/swift-submit.mjs +1 -1
  68. package/dist-lib/swift-toolchain.cjs +1 -1
  69. package/dist-lib/swift.cjs +1 -1
  70. package/dist-lib/vite-swift.cjs +63 -21
  71. package/dist-lib/vite.cjs +1 -1
  72. package/package.json +1 -1
  73. package/src/swift-compile.ts +43 -20
  74. package/src/swift-host.ts +9 -0
  75. package/src/swift-package.ts +42 -5
  76. package/src/swift-submit.ts +4 -0
@@ -10,7 +10,7 @@ export interface SwiftPackageTarget {
10
10
  languageMode: number
11
11
  /** true when the target declares `.defaultIsolation(MainActor.self)`. */
12
12
  mainActorIsolation: boolean
13
- /** true when the target declares `resources:`, so SwiftPM gives it `Bundle.module`. */
13
+ /** true when declared or implicit resources give the target `Bundle.module`. */
14
14
  resources: boolean
15
15
  }
16
16
 
@@ -20,6 +20,20 @@ export function isSwiftManifestFile(file: string): boolean {
20
20
  return segments[segments.length - 1] === 'Package.swift'
21
21
  }
22
22
 
23
+ /** the files xcode recognizes as implicit resources, before target exclusions. */
24
+ export function swiftImplicitResourcePaths(paths: readonly string[]): string[] {
25
+ return paths
26
+ .filter(
27
+ (file) =>
28
+ !file.endsWith('.swift') &&
29
+ (/\.(xcassets|xcstrings|nib|xib|storyboard|xcdatamodeld|xcdatamodel|xcmappingmodel|metal|xcprivacy)(?:\/|$)/.test(
30
+ file,
31
+ ) ||
32
+ /(?:^|\/)[^/]+\.lproj\/[^/]+$/.test(file)),
33
+ )
34
+ .sort()
35
+ }
36
+
23
37
  /**
24
38
  * the library and executable targets a sent root manifest declares, in order.
25
39
  *
@@ -29,7 +43,11 @@ export function isSwiftManifestFile(file: string): boolean {
29
43
  * early), and `name:` / `path:` are read from the call's own depth only, so
30
44
  * a nested `.product(name: "SwiftUI", ...)` inside dependencies never wins.
31
45
  */
32
- export function swiftManifestTargets(manifest: string): SwiftPackageTarget[] {
46
+ export function swiftManifestTargets(
47
+ manifest: string,
48
+ resourcePaths: readonly string[] = [],
49
+ ): SwiftPackageTarget[] {
50
+ const implicitResources = swiftImplicitResourcePaths(resourcePaths)
33
51
  const code = manifest.replace(/\/\*[\s\S]*?\*\//g, '').replace(/\/\/[^\n]*/g, '')
34
52
  const targets: SwiftPackageTarget[] = []
35
53
  const pattern = /\.(executableTarget|target)\s*\(/g
@@ -77,7 +95,23 @@ export function swiftManifestTargets(manifest: string): SwiftPackageTarget[] {
77
95
  /\.swiftLanguageMode\(\s*\.v(\d+)\s*\)/.exec(call)?.[1] ?? '5',
78
96
  )
79
97
  const mainActorIsolation = /\.defaultIsolation\(\s*MainActor\.self\s*\)/.test(call)
80
- const resources = /\bresources\s*:/.test(flat)
98
+ const excluded = [
99
+ ...(/\bexclude\s*:\s*\[([^\]]*)\]/.exec(flat)?.[1] ?? '').matchAll(/"([^"]+)"/g),
100
+ ].map((match) => match[1].replace(/^\.\//, '').replace(/\/+$/, ''))
101
+ const prefix = targetPath === '.' ? '' : `${targetPath}/`
102
+ const resources =
103
+ /\bresources\s*:/.test(flat) ||
104
+ implicitResources.some((file) => {
105
+ if (!file.startsWith(prefix)) return false
106
+ const relative = file.slice(prefix.length)
107
+ if (
108
+ excluded.some(
109
+ (exclude) => relative === exclude || relative.startsWith(`${exclude}/`),
110
+ )
111
+ )
112
+ return false
113
+ return true
114
+ })
81
115
  targets.push({
82
116
  name,
83
117
  path: targetPath,
@@ -95,8 +129,11 @@ export function swiftManifestTargets(manifest: string): SwiftPackageTarget[] {
95
129
  * executable target at the package root (`path: "."`) holds the whole project,
96
130
  * which is the compiler's single-target shape, so it declares no partition.
97
131
  */
98
- export function swiftPackagePartition(manifest: string): SwiftPackageTarget[] {
99
- const targets = swiftManifestTargets(manifest)
132
+ export function swiftPackagePartition(
133
+ manifest: string,
134
+ resourcePaths: readonly string[] = [],
135
+ ): SwiftPackageTarget[] {
136
+ const targets = swiftManifestTargets(manifest, resourcePaths)
100
137
  return targets.length === 1 && targets[0].executable && targets[0].path === '.'
101
138
  ? []
102
139
  : targets
@@ -183,6 +183,8 @@ export type SwiftCompileSubmit = (work: {
183
183
  files: Record<string, string>
184
184
  /** the bundle pack; absent means the project packs none. */
185
185
  resources?: Record<string, string>
186
+ /** project-relative resource paths used to associate implicit resources with targets. */
187
+ resourcePaths?: string[]
186
188
  /** the photo rasters to publish; absent means the project packs none. */
187
189
  images?: Record<string, SwiftImageUpload>
188
190
  entry: string
@@ -330,6 +332,8 @@ export async function compileSwiftProject(
330
332
  work: {
331
333
  files: Record<string, string>
332
334
  resources?: Record<string, string>
335
+ /** project-relative resource paths used to associate implicit resources with targets. */
336
+ resourcePaths?: string[]
333
337
  images?: Record<string, SwiftImageUpload>
334
338
  entry: string
335
339
  packageId?: string