peachsim 0.1.781 → 0.1.783

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 (84) hide show
  1. package/cli/commands/detox.ts +6 -0
  2. package/cli/main.ts +1 -0
  3. package/detox/expectations.ts +1 -1
  4. package/detox/gestures.ts +1 -1
  5. package/detox/index.ts +27 -3
  6. package/detox/navigation-lifecycle.ts +1 -1
  7. package/dist-lib/agent-daemon-client.cjs +1 -1
  8. package/dist-lib/agent-events.cjs +1 -1
  9. package/dist-lib/agent-identity.cjs +1 -1
  10. package/dist-lib/agent-sessions.cjs +1 -1
  11. package/dist-lib/attached-projects.cjs +1 -1
  12. package/dist-lib/auth/shared-session.cjs +1 -1
  13. package/dist-lib/backend-origin.cjs +1 -1
  14. package/dist-lib/beta.cjs +1 -1
  15. package/dist-lib/beta.mjs +1 -1
  16. package/dist-lib/bridge-constants.cjs +1 -1
  17. package/dist-lib/bridge-contract-input.cjs +1 -1
  18. package/dist-lib/bridge-contract-input.mjs +1 -1
  19. package/dist-lib/bridge-contract.cjs +1 -1
  20. package/dist-lib/bridge-contract.mjs +1 -1
  21. package/dist-lib/capture-contract.cjs +1 -1
  22. package/dist-lib/capture-contract.mjs +1 -1
  23. package/dist-lib/cli-constants.cjs +1 -1
  24. package/dist-lib/cloud-contract.cjs +1 -1
  25. package/dist-lib/cloud-contract.mjs +1 -1
  26. package/dist-lib/cloud-test-args.cjs +1 -1
  27. package/dist-lib/cloud-test-args.mjs +1 -1
  28. package/dist-lib/cloud.cjs +1 -1
  29. package/dist-lib/cloud.mjs +1 -1
  30. package/dist-lib/config.cjs +1 -1
  31. package/dist-lib/detox/index.cjs +3534 -134
  32. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  33. package/dist-lib/home-paths.cjs +1 -1
  34. package/dist-lib/host/bridge-host.cjs +6975 -2893
  35. package/dist-lib/host/fetch-proxy-handler.cjs +1 -1
  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 +4664 -1266
  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 +1114 -2
  51. package/dist-lib/native-app-identity.cjs +1 -1
  52. package/dist-lib/native-app-identity.mjs +1 -1
  53. package/dist-lib/native-firebase-metadata.cjs +1 -1
  54. package/dist-lib/native-firebase-metadata.mjs +1 -1
  55. package/dist-lib/plist.cjs +1 -1
  56. package/dist-lib/plist.mjs +1 -1
  57. package/dist-lib/profiles.cjs +1 -1
  58. package/dist-lib/public-brand.cjs +1 -1
  59. package/dist-lib/react-native-host-modules.cjs +1 -1
  60. package/dist-lib/react-native-host-modules.mjs +1 -1
  61. package/dist-lib/render-mode.cjs +1 -1
  62. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  63. package/dist-lib/sdk.cjs +1 -1
  64. package/dist-lib/sdk.mjs +1 -1
  65. package/dist-lib/skills.cjs +8560 -166
  66. package/dist-lib/swift-compile.cjs +1 -1
  67. package/dist-lib/swift-compile.mjs +1 -1
  68. package/dist-lib/swift-package.cjs +1 -1
  69. package/dist-lib/swift-package.mjs +1 -1
  70. package/dist-lib/swift-submit.cjs +1 -1
  71. package/dist-lib/swift-submit.mjs +1 -1
  72. package/dist-lib/swift-toolchain.cjs +1 -1
  73. package/dist-lib/swift.cjs +1 -1
  74. package/dist-lib/vite-swift.cjs +1810 -413
  75. package/dist-lib/vite.cjs +38 -16
  76. package/package.json +1 -1
  77. package/skills/contrast/SKILL.md +2 -0
  78. package/src/one-widget-package.ts +202 -0
  79. package/src/oneWidgetContract.ts +16 -0
  80. package/src/swift-host.ts +1 -1
  81. package/src/swift-standin-emit.ts +149 -39
  82. package/src/swift-standins.ts +3 -0
  83. package/src/vite-plugin-one.ts +45 -17
  84. package/src/vite-plugin-swift.ts +2 -0
@@ -14,6 +14,7 @@ import { createHash } from 'node:crypto'
14
14
  import fs from 'node:fs'
15
15
  import os from 'node:os'
16
16
  import path from 'node:path'
17
+ import { getCliVersion } from './cli-version'
17
18
  import {
18
19
  swiftDistributionAt,
19
20
  swiftMacroPlugins,
@@ -677,6 +678,8 @@ export function standinGenerationInputs(
677
678
  swiftModuleSdk(moduleRoot).wasmSdkId,
678
679
  swiftModuleDigest(moduleRoot).toString('hex'),
679
680
  `emit/${STANDIN_EMIT_VERSION}`,
681
+ // a released cli can change the emitter without anyone bumping the constant
682
+ `cli/${getCliVersion()}`,
680
683
  ]
681
684
  for (const binary of binaries) {
682
685
  try {
@@ -28,6 +28,7 @@ import {
28
28
  SOOTSIM_RUNTIME_MISSING_MESSAGE,
29
29
  } from './runtime-assets'
30
30
  import { SWIFT_HMR_PATH, SWIFT_PACKAGE_PATH } from './swift-submit'
31
+ import type { OneWidgetPackage } from './oneWidgetContract'
31
32
  import type { PeachPluginOptions } from './vite'
32
33
  import type { Plugin } from 'vite'
33
34
 
@@ -88,6 +89,41 @@ export function rnxPlugin(options: PeachPluginOptions = {}): Plugin {
88
89
  swiftPackages ??= swiftPackageDirectories(server.config.root)
89
90
  return swiftPackages
90
91
  }
92
+ let widgetPackage: OneWidgetPackage | null = null
93
+ const servedPackage = async (packageName: string) => {
94
+ const host = await loadSwiftHost()
95
+ const existing = packageMap().get(packageName)
96
+ if (packageName !== host.ONE_WIDGET_PACKAGE) return existing
97
+ widgetPackage = await host.oneWidgetPackage(server.config.root)
98
+ if (!widgetPackage) return existing
99
+ if (existing)
100
+ throw new Error(
101
+ `swift package ${packageName} conflicts with One's generated widget extension`,
102
+ )
103
+ server.watcher.add(widgetPackage.watched)
104
+ return widgetPackage.packagePath
105
+ }
106
+ const packageMetadata = async (
107
+ packageName: string,
108
+ moduleRoot: string | undefined,
109
+ ) => {
110
+ const packagePath = await servedPackage(packageName)
111
+ if (!packagePath) throw new Error(`swift package ${packageName} was not found`)
112
+ const host = await loadSwiftHost()
113
+ const metadata = await host.swiftPackageMetadata(
114
+ packagePath,
115
+ packageName,
116
+ moduleRoot,
117
+ devOrigin(),
118
+ )
119
+ return {
120
+ ...metadata,
121
+ hmrPath,
122
+ ...(packageName === host.ONE_WIDGET_PACKAGE && widgetPackage
123
+ ? { widget: widgetPackage.widget }
124
+ : {}),
125
+ }
126
+ }
91
127
  const wsOptions = server.config.server.ws
92
128
  const httpServer =
93
129
  server.httpServer ??
@@ -162,32 +198,25 @@ export function rnxPlugin(options: PeachPluginOptions = {}): Plugin {
162
198
  try {
163
199
  packages = packageMap()
164
200
  } catch (error) {
165
- for (const packageName of activeSwiftPackages) {
201
+ for (const packageName of activeSwiftPackages)
166
202
  sendSwiftChange({
167
203
  type: 'error',
168
204
  packageName,
169
205
  message: error instanceof Error ? error.message : String(error),
170
206
  })
171
- }
172
207
  return
173
208
  }
174
209
  for (const packageName of activeSwiftPackages) {
175
210
  const packagePath = packages.get(packageName)
176
- if (!packagePath) continue
211
+ const widgetChanged =
212
+ packageName === 'OneWidgets' && widgetPackage?.watched.includes(file)
177
213
  if (
178
- !file.startsWith(`${packagePath}${path.sep}`) &&
214
+ !widgetChanged &&
215
+ !(packagePath && file.startsWith(`${packagePath}${path.sep}`)) &&
179
216
  !(moduleRoot && file.startsWith(`${moduleRoot}${path.sep}`))
180
217
  )
181
218
  continue
182
- void loadSwiftHost()
183
- .then((host) =>
184
- host.swiftPackageMetadata(
185
- packagePath,
186
- packageName,
187
- moduleRoot,
188
- devOrigin(),
189
- ),
190
- )
219
+ void packageMetadata(packageName, moduleRoot)
191
220
  .then((metadata) => {
192
221
  sendSwiftChange({
193
222
  type: 'package',
@@ -208,7 +237,7 @@ export function rnxPlugin(options: PeachPluginOptions = {}): Plugin {
208
237
  const pathname = (req.url ?? '').split('?')[0]
209
238
  if (!pathname.startsWith(SWIFT_ROUTE_PREFIX)) return next()
210
239
  loadSwiftHost()
211
- .then((host) => {
240
+ .then(async (host) => {
212
241
  if (host.serveSwiftPackageAsset(pathname, res)) return
213
242
  const prefix = SWIFT_PACKAGE_PATH
214
243
  if (!pathname.startsWith(prefix)) return next()
@@ -220,7 +249,7 @@ export function rnxPlugin(options: PeachPluginOptions = {}): Plugin {
220
249
  const packageName = pathname.slice(prefix.length)
221
250
  let packagePath: string | undefined
222
251
  try {
223
- packagePath = packageMap().get(packageName)
252
+ packagePath = await servedPackage(packageName)
224
253
  } catch (error) {
225
254
  res.statusCode = 500
226
255
  res.end(error instanceof Error ? error.message : String(error))
@@ -234,8 +263,7 @@ export function rnxPlugin(options: PeachPluginOptions = {}): Plugin {
234
263
  const moduleRoot = moduleRootFor()
235
264
  activeSwiftPackages.add(packageName)
236
265
  server.watcher.add(host.swiftPackageWatchFiles(packagePath, moduleRoot))
237
- void host
238
- .swiftPackageMetadata(packagePath, packageName, moduleRoot, devOrigin())
266
+ void packageMetadata(packageName, moduleRoot)
239
267
  .then((metadata) => {
240
268
  res.setHeader('access-control-allow-origin', '*')
241
269
  res.setHeader('content-type', 'application/json')
@@ -34,6 +34,8 @@ export {
34
34
  type SwiftResourceTable,
35
35
  } from './swift-host'
36
36
 
37
+ export { oneWidgetPackage, ONE_WIDGET_PACKAGE } from './one-widget-package'
38
+
37
39
  const ARTIFACT_PATH = '/__peach/swift/'
38
40
  const VIRTUAL_PREFIX = '\0peach-swift:'
39
41
  let devServer: ViteDevServer | undefined