peachsim 0.1.2438 → 0.1.2439

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 (175) hide show
  1. package/README.md +30 -98
  2. package/cli/app-catalog.ts +4 -73
  3. package/cli/catalog/content.ts +1 -1
  4. package/cli/cloud-box-artifact.ts +26 -39
  5. package/cli/cloud-client.ts +69 -117
  6. package/cli/cloud-session.ts +2 -9
  7. package/cli/commands/box.ts +6 -6
  8. package/cli/commands/control.ts +4 -11
  9. package/cli/commands/flow.ts +5 -9
  10. package/cli/commands/kotlin.ts +2 -1
  11. package/cli/commands/platform.ts +21 -39
  12. package/cli/commands/record-three.ts +1 -1
  13. package/cli/commands/shell-url.ts +29 -23
  14. package/cli/dev-build-freshness.ts +4 -3
  15. package/cli/native-input.ts +2 -2
  16. package/cli/outbound-endpoints.ts +20 -45
  17. package/cli/remote-project-bundle.ts +8 -14
  18. package/cli/remote-simulators.ts +1 -1
  19. package/cli/send-to-box.ts +2 -1
  20. package/detox/jest-preset.cjs +1 -1
  21. package/detox/jest-transform.cjs +40 -2
  22. package/dist-lib/agent-daemon-client.cjs +34 -24
  23. package/dist-lib/agent-events.cjs +1 -1
  24. package/dist-lib/attached-projects.cjs +19 -17
  25. package/dist-lib/auth/shared-session.cjs +18 -16
  26. package/dist-lib/backend-origin.cjs +1 -1
  27. package/dist-lib/beta.cjs +1 -1
  28. package/dist-lib/beta.mjs +2 -1
  29. package/dist-lib/bridge-constants.cjs +1 -1
  30. package/dist-lib/bridge-contract-input.cjs +1 -1
  31. package/dist-lib/bridge-contract-input.mjs +20 -583
  32. package/dist-lib/bridge-contract.cjs +1 -1
  33. package/dist-lib/bridge-contract.mjs +17 -99
  34. package/dist-lib/bundle-channel.cjs +8718 -5552
  35. package/dist-lib/capture-contract.cjs +1 -1
  36. package/dist-lib/capture-contract.mjs +13 -363
  37. package/dist-lib/cloud-contract.cjs +1 -1
  38. package/dist-lib/cloud-contract.mjs +34 -155
  39. package/dist-lib/cloud-test-args.cjs +1 -1
  40. package/dist-lib/cloud-test-args.mjs +2 -1
  41. package/dist-lib/cloud.cjs +1 -1
  42. package/dist-lib/cloud.mjs +26 -155
  43. package/dist-lib/config.cjs +1 -4
  44. package/dist-lib/config.mjs +11 -30
  45. package/dist-lib/detox/index.cjs +2554 -230
  46. package/dist-lib/detox/jest-preset.cjs +1 -1
  47. package/dist-lib/detox/jest-transform.cjs +40 -2
  48. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  49. package/dist-lib/esm-chunks/acorn-FGE4PYDJ.mjs +50 -0
  50. package/dist-lib/esm-chunks/chunk-2EUHEBIJ.mjs +664 -0
  51. package/dist-lib/esm-chunks/chunk-2NPABFPN.mjs +5719 -0
  52. package/dist-lib/esm-chunks/chunk-4ZFNH7TU.mjs +10 -0
  53. package/dist-lib/esm-chunks/chunk-5T4XBUJP.mjs +1353 -0
  54. package/dist-lib/esm-chunks/chunk-6VY6HTJC.mjs +18951 -0
  55. package/dist-lib/esm-chunks/chunk-7HANEMO4.mjs +188 -0
  56. package/dist-lib/esm-chunks/chunk-C3WBGYP6.mjs +186 -0
  57. package/dist-lib/esm-chunks/chunk-CVGDRROP.mjs +57 -0
  58. package/dist-lib/esm-chunks/chunk-DADGQELM.mjs +375 -0
  59. package/dist-lib/esm-chunks/chunk-DEGYKHN7.mjs +12 -0
  60. package/dist-lib/esm-chunks/chunk-HIDNO3RP.mjs +10992 -0
  61. package/dist-lib/esm-chunks/chunk-HSADZOVN.mjs +30 -0
  62. package/dist-lib/esm-chunks/chunk-IWJUYJQO.mjs +42 -0
  63. package/dist-lib/esm-chunks/chunk-JCKI3VZ6.mjs +10 -0
  64. package/dist-lib/esm-chunks/chunk-KSQ5KM5Y.mjs +17 -0
  65. package/dist-lib/esm-chunks/chunk-KVTIDLBK.mjs +598 -0
  66. package/dist-lib/esm-chunks/chunk-MIQSRBVU.mjs +10 -0
  67. package/dist-lib/esm-chunks/chunk-YB27R6JG.mjs +115 -0
  68. package/dist-lib/esm-chunks/metro-layout-parser-MVUAXRUJ.mjs +58 -0
  69. package/dist-lib/expo-swift-bundle.cjs +7856 -4707
  70. package/dist-lib/expo-swift-metadata.cjs +1 -1
  71. package/dist-lib/expo-swift-metadata.mjs +16 -165
  72. package/dist-lib/home-paths.cjs +1 -1
  73. package/dist-lib/host/bridge-host.cjs +15658 -11404
  74. package/dist-lib/host/fetch-proxy-handler.cjs +3927 -342
  75. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  76. package/dist-lib/host/fetch-proxy-overrides.mjs +2 -1
  77. package/dist-lib/host/replacement-module-handler.cjs +4 -4
  78. package/dist-lib/host/websocket-proxy.cjs +1 -1
  79. package/dist-lib/index.cjs +9145 -32150
  80. package/dist-lib/jump-to-source-babel.cjs +1 -1
  81. package/dist-lib/jump-to-source-native.cjs +2 -2
  82. package/dist-lib/kotlin-host.cjs +260 -253
  83. package/dist-lib/menu.cjs +1 -1
  84. package/dist-lib/menu.mjs +5 -13
  85. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  86. package/dist-lib/metro-fingerprint-registry.mjs +5 -6
  87. package/dist-lib/metro-production-bundle.cjs +22 -3
  88. package/dist-lib/metro-production-bundle.mjs +26 -92
  89. package/dist-lib/native-app-identity-project.cjs +663 -451
  90. package/dist-lib/native-app-identity-project.mjs +509 -2318
  91. package/dist-lib/native-app-identity.cjs +1 -1
  92. package/dist-lib/native-app-identity.mjs +27 -1340
  93. package/dist-lib/native-firebase-metadata.cjs +1 -1
  94. package/dist-lib/native-firebase-metadata.mjs +5 -18
  95. package/dist-lib/pdfium-raster.cjs +1 -1
  96. package/dist-lib/pdfium-raster.mjs +2 -1
  97. package/dist-lib/plist.cjs +2 -2
  98. package/dist-lib/plist.mjs +5 -7
  99. package/dist-lib/profiles.cjs +2 -1
  100. package/dist-lib/public-brand.cjs +1 -1
  101. package/dist-lib/public-origins-lib-esm.json +246 -187
  102. package/dist-lib/public-origins-lib-static.json +1 -1
  103. package/dist-lib/public-origins-lib.json +1059 -1238
  104. package/dist-lib/react-native-host-modules.cjs +1 -1
  105. package/dist-lib/react-native-host-modules.mjs +2 -1
  106. package/dist-lib/reap-browser.cjs +18 -7
  107. package/dist-lib/scripts/dev-server-scanner.cjs +6 -230
  108. package/dist-lib/sdk.cjs +1 -1
  109. package/dist-lib/sdk.mjs +22 -78
  110. package/dist-lib/skills.cjs +21657 -17374
  111. package/dist-lib/swift-compile.cjs +1343 -1318
  112. package/dist-lib/swift-compile.mjs +68 -19013
  113. package/dist-lib/swift-package.cjs +1 -1
  114. package/dist-lib/swift-package.mjs +35 -630
  115. package/dist-lib/swift-submit.cjs +1 -1
  116. package/dist-lib/swift-submit.mjs +9 -24
  117. package/dist-lib/swift-toolchain.cjs +1 -1
  118. package/dist-lib/swift.cjs +1 -1
  119. package/dist-lib/vendor/@peculiar/x509.cjs +18061 -0
  120. package/dist-lib/vendor/acorn.cjs +5699 -0
  121. package/dist-lib/vendor/bplist-parser.cjs +1589 -0
  122. package/dist-lib/vendor/ignore.cjs +455 -0
  123. package/dist-lib/vendor/magic-string.cjs +1693 -0
  124. package/dist-lib/vendor/plist.cjs +10978 -0
  125. package/dist-lib/vendor/smol-toml.cjs +768 -0
  126. package/dist-lib/vendor/stream-json.cjs +1997 -0
  127. package/dist-lib/vendor/sucrase/dist/index.js.cjs +23593 -0
  128. package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +15750 -0
  129. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +11316 -0
  130. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +482 -0
  131. package/dist-lib/vendor/sucrase.cjs +23593 -0
  132. package/dist-lib/vendor/terser.cjs +36874 -0
  133. package/dist-lib/vendor/valibot.cjs +6253 -0
  134. package/dist-lib/vendor/zod.cjs +23262 -0
  135. package/dist-lib/worklet-executable.cjs +3 -3
  136. package/dist-lib/worklet-executable.mjs +11 -16
  137. package/dist-types/packages/peach-engine/src/config.d.ts +1 -1
  138. package/kotlin/fork/NOTICE +3 -0
  139. package/kotlin/sdk.tar.gz +0 -0
  140. package/kotlin/toolchain.json +6 -6
  141. package/package.json +17 -121
  142. package/runtime-companion.json +1 -1
  143. package/scripts/dev-server-scanner.ts +13 -223
  144. package/src/android-autolinking.ts +2 -2
  145. package/src/bundle-channel.mjs +3 -15
  146. package/src/cloud-contract.ts +3 -4
  147. package/src/config.ts +0 -5
  148. package/src/host/bridge-host.ts +19 -1
  149. package/src/host/server-scan-handler.ts +1 -9
  150. package/src/index.ts +0 -2
  151. package/src/kotlin-host.ts +1 -2
  152. package/src/kotlinDiscoveryContract.ts +1 -0
  153. package/src/metro-production-bundle.ts +28 -6
  154. package/src/native-seam-manifest.ts +0 -13
  155. package/src/one-native-app-catalog.ts +8 -27
  156. package/src/one-native-app-config.ts +95 -0
  157. package/src/one-native-source.ts +250 -0
  158. package/src/one-widget-metadata.ts +45 -126
  159. package/src/oneWidgetContract.ts +80 -117
  160. package/src/serverDiscoveryContract.ts +0 -1
  161. package/src/simulator-route.ts +8 -0
  162. package/src/vite-plugin.ts +2 -2
  163. package/src/xcode-project.ts +1 -1
  164. package/dist-lib/metro.cjs +0 -27984
  165. package/dist-lib/vite-swift.cjs +0 -43376
  166. package/dist-lib/vite.cjs +0 -21456
  167. package/src/androidAutolinkingContract.ts +0 -48
  168. package/src/androidRootModuleContract.ts +0 -39
  169. package/src/dev-server-open.ts +0 -92
  170. package/src/metro-plugin.ts +0 -578
  171. package/src/one-widget-discovery.ts +0 -23
  172. package/src/swift-vite-lifetime.ts +0 -42
  173. package/src/vite-plugin-one.ts +0 -746
  174. package/src/vite-plugin-swift.ts +0 -225
  175. package/src/vite.d.ts +0 -10
@@ -1,225 +0,0 @@
1
- // vite adapts the common Swift package host to native source imports.
2
- import fs from 'node:fs'
3
- import path from 'node:path'
4
- import { resolveSwiftImageResourceUrls } from '../../sootsim-swift/src/bundleAssets'
5
- import { swiftEntryModuleEsm } from '../../sootsim-swift/src/entryModule'
6
- import { swiftModuleInputFiles } from './swift-compile'
7
- import {
8
- artifactFor,
9
- entryRootId,
10
- icuUrl,
11
- linkedModuleRoots,
12
- nativeSourceDescriptor,
13
- nativeSourceFiles,
14
- projectFor,
15
- serveSwiftPackageAsset,
16
- sourceFiles,
17
- type SwiftArtifact,
18
- type SwiftProject,
19
- } from './swift-host'
20
- import { swiftNativeEntry } from './swift-submit'
21
- import { swiftViteLifetime } from './swift-vite-lifetime'
22
- import type { Plugin, ViteDevServer } from 'vite'
23
-
24
- export {
25
- buildSwiftBundleFiles,
26
- buildSwiftResourceTable,
27
- compileInput,
28
- disposeSwiftProject,
29
- entryRootId,
30
- linkedModuleRoots,
31
- serveSwiftPackageAsset,
32
- serveSwiftResource,
33
- sourceStamp,
34
- swiftPackageMetadata,
35
- swiftPackageWatchFiles,
36
- type SwiftBundlePack,
37
- type SwiftResourceTable,
38
- } from './swift-host'
39
-
40
- export { oneWidgetPackage, ONE_WIDGET_PACKAGE } from './one-widget-package'
41
-
42
- const ARTIFACT_PATH = '/__peach/swift/'
43
- const VIRTUAL_PREFIX = '\0peach-swift:'
44
- const VIRTUAL_SUFFIX = '.mjs'
45
- let devServer: ViteDevServer | undefined
46
-
47
- // the app fetches from a worker whose origin is the shell, so urls have to
48
- // name this dev server rather than resolve relative to the shell.
49
- function serverOrigin(): string {
50
- const address = devServer?.httpServer?.address()
51
- const port =
52
- address && typeof address === 'object' ? address.port : devServer?.config.server.port
53
- if (!port) throw new Error('the swift urls need the dev server port')
54
- return `http://localhost:${port}`
55
- }
56
-
57
- function artifactUrl(project: SwiftProject, artifact: SwiftArtifact): string {
58
- return `${serverOrigin()}${ARTIFACT_PATH}${artifact.hash}.wasm`
59
- }
60
-
61
- // the swiftpm package that owns an imported file: the nearest directory at
62
- // or above the file that holds a Package.swift, stopping at the vite root
63
- // once the dev server has named it. a swift-only project keeps its sources at
64
- // the root so that is its package; a React Native app keeps its in a
65
- // subdirectory (a `native/` package beside the js), and each such package
66
- // compiles on its own.
67
- function packageFor(file: string): string {
68
- let dir = path.dirname(file)
69
- const stop = devServer?.config.root
70
- for (;;) {
71
- if (fs.existsSync(path.join(dir, 'Package.swift'))) return dir
72
- if ((stop !== undefined && dir === stop) || path.dirname(dir) === dir) break
73
- dir = path.dirname(dir)
74
- }
75
- throw new Error(
76
- `no Package.swift above ${file}${stop === undefined ? '' : ` (searched up to ${stop})`}; a .swift import needs a swiftpm package like the one in packages/sootsim-swift/example`,
77
- )
78
- }
79
-
80
- export interface SwiftPluginOptions {
81
- // swiftpm package that owns the project's .swift sources. defaults to the
82
- // nearest Package.swift above each imported file, which is the vite root
83
- // for the layout a swift-only project uses.
84
- packagePath?: string
85
- }
86
-
87
- export function swiftPlugin(options: SwiftPluginOptions = {}): Plugin {
88
- let lifetime: ReturnType<typeof swiftViteLifetime> | undefined
89
- return {
90
- name: 'rnx-swift',
91
- enforce: 'pre',
92
-
93
- async resolveId(source, importer) {
94
- if (source.startsWith(VIRTUAL_PREFIX)) return source
95
- // import-analysis re-resolves the served URL form of the id
96
- // (/@id/__x00__..., with the null byte encoded) while transforming the
97
- // importer. it still names this module, so answer the decoded id; any
98
- // other /@id/ url is already resolved and must not fall through to the
99
- // filesystem resolve below, which would throw for it.
100
- if (source.startsWith('/@id/')) {
101
- const decoded = source.slice('/@id/'.length).replace(/^__x00__/, '\0')
102
- return decoded.startsWith(VIRTUAL_PREFIX) ? decoded : null
103
- }
104
- if (!source.endsWith('.swift')) return null
105
- const resolved = await this.resolve(source, importer, { skipSelf: true })
106
- if (!resolved) throw new Error(`cannot resolve swift source ${source}`)
107
- // a symlinked source (the showcase app links the files Xcode builds)
108
- // resolves to its target, and the package walk then finds the target's
109
- // package instead of the importing one. keep the importer's own path
110
- // when it names the same file, so the import's package owns the compile.
111
- let id = resolved.id
112
- if (importer && (source.startsWith('./') || source.startsWith('../'))) {
113
- const raw = path.resolve(path.dirname(importer.split('?')[0] ?? importer), source)
114
- try {
115
- if (fs.realpathSync(raw) === fs.realpathSync(resolved.id)) id = raw
116
- } catch {
117
- // fall through with the resolver's answer
118
- }
119
- }
120
- return VIRTUAL_PREFIX + id + VIRTUAL_SUFFIX
121
- },
122
-
123
- async load(id) {
124
- if (!id.startsWith(VIRTUAL_PREFIX)) return null
125
- const owner = lifetime
126
- owner?.signal.throwIfAborted()
127
- const file = id.slice(VIRTUAL_PREFIX.length, -VIRTUAL_SUFFIX.length)
128
- // the module is the whole package's artifact, so an import of a file
129
- // that was deleted would keep answering with it. a deleted .tsx fails
130
- // its importer; so does a deleted .swift.
131
- if (!fs.existsSync(file)) throw new Error(`swift source ${file} no longer exists`)
132
- const packagePath = options.packagePath ?? packageFor(file)
133
- const project = projectFor(packagePath, undefined, owner?.signal)
134
- owner?.projects.add(project.packagePath)
135
- const entry = path.relative(packagePath, file).split(path.sep).join(path.posix.sep)
136
- // every source in the package is a dependency of this module, so a
137
- // bundler watching this module learns about a `.swift` edit and re-runs
138
- // load. that is the whole hot reload: the new hash in the emitted module
139
- // is what tells the mount it is looking at a different app.
140
- for (const source of [
141
- ...sourceFiles(packagePath),
142
- ...nativeSourceFiles(packagePath),
143
- ])
144
- this.addWatchFile(source)
145
- this.addWatchFile(path.join(packagePath, 'Package.swift'))
146
- // an edit to the linked SwiftUI module rebuilds the artifact without
147
- // touching the project's own sources, so the module inputs the source
148
- // stamp hashes gate the reload too. the module is never uploaded, so
149
- // the compile service's source caps do not apply to it.
150
- const moduleRoot = linkedModuleRoots(packagePath).find((root) =>
151
- fs.existsSync(path.join(root, 'toolchain.json')),
152
- )
153
- if (moduleRoot)
154
- for (const relative of swiftModuleInputFiles(moduleRoot))
155
- this.addWatchFile(path.join(moduleRoot, relative))
156
- let artifact: SwiftArtifact
157
- try {
158
- const pending = artifactFor(project, entry)
159
- owner?.compiles.add(pending)
160
- try {
161
- artifact = await pending
162
- } finally {
163
- owner?.compiles.delete(pending)
164
- }
165
- } catch (error) {
166
- // a compile error must not fail this module. a module whose load threw
167
- // leaves the graph unwatched, so the edit that fixes the error would
168
- // never rebuild it and the app would sit on a stale frame until the
169
- // dev server restarted. the previous artifact keeps rendering, and the
170
- // error is reported here instead.
171
- owner?.signal.throwIfAborted()
172
- if (!project.artifact) throw error
173
- this.warn(error instanceof Error ? error.message : String(error))
174
- artifact = project.artifact
175
- }
176
- owner?.signal.throwIfAborted()
177
- const resources = resolveSwiftImageResourceUrls(
178
- artifact.package.resources.table,
179
- serverOrigin(),
180
- )
181
- for (const watched of [
182
- ...artifact.package.resources.watched,
183
- ...artifact.package.bundleFiles.watched,
184
- ])
185
- this.addWatchFile(path.join(packagePath, ...watched.split(path.posix.sep)))
186
- const colors = artifact.package.resources.colors
187
- const symbols = artifact.package.resources.symbols
188
- const bundleFiles = artifact.package.bundleFiles.files
189
- // every import mounts through the one entry: the artifact answers
190
- // whether it is a view or an app root at runtime, so the transform
191
- // never re-derives the conformance from source. the entry is rooted by
192
- // its package and source path so a hot reload finds the same instance.
193
- const native = nativeSourceDescriptor(packagePath)
194
- return swiftEntryModuleEsm({
195
- url: artifactUrl(project, artifact),
196
- hash: artifact.hash,
197
- icuUrl: icuUrl(serverOrigin(), artifact),
198
- rootId: entryRootId(packagePath, file),
199
- resources,
200
- bundleFiles,
201
- colors,
202
- symbols,
203
- designTimeValues: artifact.designTimeValues ?? {},
204
- native: native ? swiftNativeEntry(native, entry) : undefined,
205
- })
206
- },
207
-
208
- async closeBundle() {
209
- await lifetime?.close()
210
- },
211
-
212
- configureServer(server) {
213
- devServer = server
214
- lifetime = swiftViteLifetime(server)
215
-
216
- server.middlewares.use((req, res, next) => {
217
- void serveSwiftPackageAsset((req.url ?? '').split('?')[0], res)
218
- .then((handled) => {
219
- if (!handled) next()
220
- })
221
- .catch(next)
222
- })
223
- },
224
- }
225
- }
package/src/vite.d.ts DELETED
@@ -1,10 +0,0 @@
1
- import type { Plugin } from 'vite'
2
-
3
- export interface PeachPluginOptions {
4
- bundleUrl?: string
5
- prefix?: string
6
- enabled?: boolean
7
- open?: boolean | { appName: string }
8
- }
9
-
10
- export declare function peachPlugin(options?: PeachPluginOptions): Plugin