peachsim 0.1.2438 → 0.1.2440

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 (183) 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 +8743 -5562
  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-B27MTHKJ.mjs +50 -0
  50. package/dist-lib/esm-chunks/chunk-4U7IGWPB.mjs +42 -0
  51. package/dist-lib/esm-chunks/chunk-5CZQZKYU.mjs +10 -0
  52. package/dist-lib/esm-chunks/chunk-6HFWZJ6C.mjs +115 -0
  53. package/dist-lib/esm-chunks/chunk-6JGALQD5.mjs +12 -0
  54. package/dist-lib/esm-chunks/chunk-ADE23YGG.mjs +30 -0
  55. package/dist-lib/esm-chunks/chunk-D4Z36DQQ.mjs +186 -0
  56. package/dist-lib/esm-chunks/chunk-EATI62W3.mjs +188 -0
  57. package/dist-lib/esm-chunks/chunk-H6QIEJRC.mjs +10992 -0
  58. package/dist-lib/esm-chunks/chunk-HIK3VREC.mjs +1353 -0
  59. package/dist-lib/esm-chunks/chunk-HP7DHONL.mjs +598 -0
  60. package/dist-lib/esm-chunks/chunk-PRZI3CFF.mjs +5719 -0
  61. package/dist-lib/esm-chunks/chunk-QECVPSP3.mjs +10 -0
  62. package/dist-lib/esm-chunks/chunk-R5FNLCBO.mjs +17 -0
  63. package/dist-lib/esm-chunks/chunk-RVMUQQWC.mjs +664 -0
  64. package/dist-lib/esm-chunks/chunk-SJFNKW3W.mjs +57 -0
  65. package/dist-lib/esm-chunks/chunk-WQISIGIX.mjs +10 -0
  66. package/dist-lib/esm-chunks/chunk-X6UKJ5AX.mjs +375 -0
  67. package/dist-lib/esm-chunks/chunk-ZXNBC3PZ.mjs +18959 -0
  68. package/dist-lib/esm-chunks/metro-layout-parser-ZOI5PO4E.mjs +58 -0
  69. package/dist-lib/expo-swift-bundle.cjs +7881 -4717
  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 +15685 -11414
  74. package/dist-lib/host/fetch-proxy-handler.cjs +3928 -343
  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 +664 -452
  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 +21694 -17393
  111. package/dist-lib/swift-compile.cjs +1355 -1322
  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-compat/src/stubs/native-seams/react-native-cookies.d.ts +4 -0
  138. package/dist-types/packages/peach-engine/src/config.d.ts +1 -1
  139. package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +2 -2
  140. package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +9 -0
  141. package/kotlin/fork/NOTICE +3 -0
  142. package/kotlin/sdk.tar.gz +0 -0
  143. package/kotlin/toolchain.json +6 -6
  144. package/package.json +17 -121
  145. package/runtime-companion.json +1 -1
  146. package/scripts/dev-server-scanner.ts +13 -223
  147. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/NSDateComponentsFormatter.h +1 -1
  148. package/src/android-autolinking.ts +2 -2
  149. package/src/bundle-channel.mjs +3 -15
  150. package/src/cloud-contract.ts +3 -4
  151. package/src/config.ts +0 -5
  152. package/src/host/bridge-host.ts +21 -1
  153. package/src/host/server-scan-handler.ts +1 -9
  154. package/src/index.ts +0 -2
  155. package/src/kotlin-host.ts +1 -2
  156. package/src/kotlinDiscoveryContract.ts +1 -0
  157. package/src/metro-production-bundle.ts +28 -6
  158. package/src/native-seam-manifest.ts +0 -13
  159. package/src/native-slices.ts +1 -1
  160. package/src/one-native-app-catalog.ts +8 -27
  161. package/src/one-native-app-config.ts +95 -0
  162. package/src/one-native-source.ts +250 -0
  163. package/src/one-widget-metadata.ts +45 -126
  164. package/src/oneWidgetContract.ts +80 -117
  165. package/src/serverDiscoveryContract.ts +0 -1
  166. package/src/simulator-route.ts +8 -0
  167. package/src/swift-compile.ts +13 -7
  168. package/src/swift-host.ts +2 -0
  169. package/src/swift-package-manifest.ts +13 -8
  170. package/src/vite-plugin.ts +2 -2
  171. package/src/xcode-project.ts +1 -1
  172. package/dist-lib/metro.cjs +0 -27984
  173. package/dist-lib/vite-swift.cjs +0 -43376
  174. package/dist-lib/vite.cjs +0 -21456
  175. package/src/androidAutolinkingContract.ts +0 -48
  176. package/src/androidRootModuleContract.ts +0 -39
  177. package/src/dev-server-open.ts +0 -92
  178. package/src/metro-plugin.ts +0 -578
  179. package/src/one-widget-discovery.ts +0 -23
  180. package/src/swift-vite-lifetime.ts +0 -42
  181. package/src/vite-plugin-one.ts +0 -746
  182. package/src/vite-plugin-swift.ts +0 -225
  183. package/src/vite.d.ts +0 -10
@@ -37,7 +37,6 @@ import {
37
37
  alignLoopbackBundleUrlWithProbe,
38
38
  normalizeNativeDevBundleUrl,
39
39
  } from '../src/native-dev-bundle-url.ts'
40
- import { configuredWidgetFromScan } from '../src/oneWidgetContract'
41
40
  import {
42
41
  __resetAppSettingsBundleCacheForTests,
43
42
  readAppSettingsBundle,
@@ -48,7 +47,6 @@ import {
48
47
  parseSwiftHostDiscovery,
49
48
  } from '../src/swiftDiscoveryContract'
50
49
  import { loadOptionalDemoApps, optionalDemoAppsSync } from './optional-demo-registry.ts'
51
- import type { ConfiguredOneWidget } from '../src/oneWidgetContract'
52
50
  import type { DiscoveredServer } from '../src/serverDiscoveryContract'
53
51
 
54
52
  export type { DiscoveredServer } from '../src/serverDiscoveryContract'
@@ -327,13 +325,6 @@ const TIMEOUT_MS = 250
327
325
  // (404|502)" regression on monorepo One projects (apps/<name>/...). give
328
326
  // the manifest more headroom so the canonical launchAsset.url wins.
329
327
  const MANIFEST_TIMEOUT_MS = 1500
330
- /**
331
- * marks the scanner's /__server-scan probe of a candidate port. the probe reads
332
- * only a One server's entry for itself, which a peach host's list never holds,
333
- * so a host answers it from what it already knows instead of scanning the
334
- * machine: otherwise every scan sets off one more in each host it probes.
335
- */
336
- export const SERVER_SCAN_PROBE_HEADER = 'x-peach-scan-probe'
337
328
  // cheap TCP-connect check gate for HTTP probes — if we can't open a socket
338
329
  // within this budget the port isn't actually reachable, and all 5 HTTP probes
339
330
  // would just time out for nothing.
@@ -1017,7 +1008,7 @@ function applyManifest(
1017
1008
  buildLoopbackProbeBaseUrl('http:', manifestRes.hostname, result.port),
1018
1009
  )
1019
1010
  : undefined
1020
- if (launchUrl && !result.patched && !isDirectOneBundleUrl(result.bundleUrl)) {
1011
+ if (launchUrl && !isDirectOneBundleUrl(result.bundleUrl)) {
1021
1012
  result.bundleUrl = withRuntimeConfig(result.port, launchUrl, result.cwd)
1022
1013
  }
1023
1014
  // expo's withIosIcons.ts selects its base icon as light || dark || tinted.
@@ -1174,58 +1165,19 @@ async function fetchManifestEnrichment(
1174
1165
  invalidatePortCache(result.port)
1175
1166
  }
1176
1167
 
1177
- // ports confirmed to be running a non-sootsim dev server — safe to skip the
1178
- // /__peachsim/ probe on subsequent scans. cleared when the port disappears from the
1179
- // listening set (process restarted, could now be a different server).
1180
- const knownNonPatched = new Set<number>()
1181
-
1182
1168
  // ports confirmed to be a one/vxrn dev server. on these, we skip the manifest
1183
1169
  // probe (`GET /` with expo-platform headers) on subsequent scans: one already
1184
1170
  // served the bundle HEAD so we know what it is, AND one's Expo Go manifest
1185
1171
  // middleware crashes the whole server when a probe aborts mid-stream
1186
1172
  // (Cannot pipe to a closed or destroyed stream → unhandled rejection → exit).
1187
1173
  // the bundle URL is enough; no information is lost by skipping the manifest.
1188
- // same invalidation rules as knownNonPatched: cleared on port
1189
- // disappearance, owning-pid change, and __resetScannerCache.
1174
+ // cleared on port disappearance, owning-pid change, and __resetScannerCache.
1190
1175
  const knownOne = new Set<number>()
1191
- const oneNativeApps = new Map<number, { root: string; bundleId: string }>()
1192
-
1193
- function oneNativeWidgetFromScan(
1194
- scan: unknown,
1195
- result: DiscoveredServer,
1196
- identity: { root: string; bundleId: string },
1197
- ): ConfiguredOneWidget | null {
1198
- if (!Array.isArray(scan)) return null
1199
- for (const entry of scan) {
1200
- if (!entry || typeof entry !== 'object' || entry.port !== result.port) continue
1201
- if (typeof entry.bundleUrl !== 'string') continue
1202
- let advertised: URL
1203
- try {
1204
- advertised = new URL(entry.bundleUrl)
1205
- } catch {
1206
- continue
1207
- }
1208
- if (!isLoopbackHost(advertised.hostname) || advertised.port !== String(result.port))
1209
- continue
1210
- const widget = configuredWidgetFromScan(scan, advertised.href)
1211
- if (
1212
- widget?.projectRoot === identity.root &&
1213
- widget.metadata.bundleId === identity.bundleId
1214
- )
1215
- return {
1216
- ...widget,
1217
- bundleUrl: result.bundleUrl,
1218
- packageUrl: new URL('/__peach/swift-package/OneWidgets', result.bundleUrl).href,
1219
- }
1220
- }
1221
- return null
1222
- }
1223
1176
 
1224
1177
  // fire signature probes in waves and pick the best match by precedence:
1225
1178
  // 1. expo manifest (JSON manifest at /)
1226
1179
  // 2. metro/expo (packager-status:running on /status)
1227
- // 3. sootsim-patched (/__peachsim/)
1228
- // 4. one/vxrn (HEAD on /node_modules/one/metro-entry.bundle) — only
1180
+ // 3. one/vxrn (HEAD on /node_modules/one/metro-entry.bundle) — only
1229
1181
  // fires as a true last resort; on expo apps this probe
1230
1182
  // crashes metro by triggering HmrServer.registerEntryPoint
1231
1183
  // for a path metro can't resolve, so we never fire it
@@ -1271,7 +1223,6 @@ export async function probePort(
1271
1223
 
1272
1224
  // wave 1 — safe parallel probes. none of these mutate metro state. a known
1273
1225
  // verdict skips its probe and counts as answered.
1274
- const skipPatched = knownNonPatched.has(port)
1275
1226
  const skipManifest = knownOne.has(port)
1276
1227
  const [[statusRes, manifestRes], owner] = await Promise.all([
1277
1228
  Promise.all([
@@ -1288,30 +1239,11 @@ export async function probePort(
1288
1239
  // a busy one is slow enough to miss the manifest timeout. the host and scan
1289
1240
  // endpoints below belong to other servers, so asking a metro packager only
1290
1241
  // burns its web build. a packager is the metro status body, other than one
1291
- // whose manifest names a One entry, which `/__server-scan` still identifies; a
1292
- // spa fallback answers 200 html to every path and never matches the status body.
1242
+ // whose manifest names a One entry; a spa fallback answers 200 html to every
1243
+ // path and never matches the status body.
1293
1244
  const manifestParsed = manifestRes ? safeParseManifest(manifestRes.body) : null
1294
1245
  const { launchUrl: manifestLaunchUrl, client: manifestClient } =
1295
1246
  readExpoManifestFields(manifestParsed)
1296
- const metadata = manifestParsed?.metadata
1297
- const extra = manifestParsed?.extra
1298
- const expoGo = extra && typeof extra === 'object' ? Reflect.get(extra, 'expoGo') : null
1299
- const developer =
1300
- expoGo && typeof expoGo === 'object' ? Reflect.get(expoGo, 'developer') : null
1301
- const projectRoot =
1302
- developer && typeof developer === 'object'
1303
- ? Reflect.get(developer, 'projectRoot')
1304
- : null
1305
- const bundleId = manifestClient.ios?.bundleIdentifier
1306
- if (
1307
- metadata &&
1308
- typeof metadata === 'object' &&
1309
- Reflect.get(metadata, 'oneNativeApp') === true &&
1310
- typeof projectRoot === 'string' &&
1311
- typeof bundleId === 'string'
1312
- )
1313
- oneNativeApps.set(port, { root: projectRoot, bundleId })
1314
- else if (manifestRes) oneNativeApps.delete(port)
1315
1247
  // `manifestRes === null` means the probe got NO answer — it timed out or the
1316
1248
  // connection failed. that is not the same fact as a server that answered and
1317
1249
  // turned out to have no manifest, and only the second one licenses the
@@ -1327,71 +1259,13 @@ export async function probePort(
1327
1259
  manifestState === 'resolved' &&
1328
1260
  manifestLaunchUrl?.includes('/one/metro-entry.bundle')
1329
1261
  )
1330
- const [sootsimRes, swiftRes, kotlinRes, oneScanRes] = metroPackager
1331
- ? [null, null, null, null]
1262
+ const [swiftRes, kotlinRes] = metroPackager
1263
+ ? [null, null]
1332
1264
  : await Promise.all([
1333
- skipPatched
1334
- ? Promise.resolve(null)
1335
- : httpGet(probeHostname, port, '/__peachsim/'),
1336
1265
  httpGet(probeHostname, port, SWIFT_DISCOVERY_PATH),
1337
1266
  httpGet(probeHostname, port, KOTLIN_DISCOVERY_PATH),
1338
- httpGet(probeHostname, port, '/__server-scan', 'GET', MANIFEST_TIMEOUT_MS, {
1339
- [SERVER_SCAN_PROBE_HEADER]: '1',
1340
- }),
1341
1267
  ])
1342
1268
 
1343
- // the One plugin advertises its exact native entry, including replacement
1344
- // identity. native.app's Expo Go manifest can instead advertise index.bundle.
1345
- const oneScan =
1346
- oneScanRes?.statusCode === 200 ? safeParseManifest(oneScanRes.body) : null
1347
- if (Array.isArray(oneScan)) {
1348
- for (const entry of oneScan) {
1349
- if (
1350
- !entry ||
1351
- typeof entry !== 'object' ||
1352
- entry.framework !== 'one' ||
1353
- entry.port !== port ||
1354
- typeof entry.bundleUrl !== 'string'
1355
- )
1356
- continue
1357
- let bundle: URL
1358
- try {
1359
- bundle = new URL(entry.bundleUrl)
1360
- } catch {
1361
- continue
1362
- }
1363
- if (
1364
- bundle.protocol !== 'http:' ||
1365
- !isLoopbackHost(bundle.hostname) ||
1366
- bundle.port !== String(port) ||
1367
- !bundle.pathname.endsWith('/one/metro-entry.bundle')
1368
- )
1369
- continue
1370
- knownOne.add(port)
1371
- return enrichWithManifest(
1372
- applyManifest(
1373
- {
1374
- port,
1375
- framework: 'one',
1376
- bundleUrl: withRuntimeConfig(
1377
- port,
1378
- alignLoopbackBundleUrlWithProbe(
1379
- bundle.href,
1380
- buildLoopbackProbeBaseUrl('http:', probeHostname, port),
1381
- ),
1382
- owner.cwd,
1383
- ),
1384
- lastSeen: Date.now(),
1385
- ...owner,
1386
- },
1387
- manifestRes,
1388
- buildIconProxyUrl,
1389
- ),
1390
- buildIconProxyUrl,
1391
- )
1392
- }
1393
- }
1394
-
1395
1269
  const swift =
1396
1270
  swiftRes?.statusCode === 200
1397
1271
  ? parseSwiftHostDiscovery(safeParseManifest(swiftRes.body))
@@ -1437,7 +1311,6 @@ export async function probePort(
1437
1311
  // /node_modules/one/metro-entry.bundle constant we used as a discriminator
1438
1312
  // below, so we check the manifest FIRST.
1439
1313
  if (manifestState === 'resolved') {
1440
- knownNonPatched.add(port)
1441
1314
  const launchUrl =
1442
1315
  manifestLaunchUrl ||
1443
1316
  `${buildLoopbackProbeBaseUrl('http:', probeHostname, port)}/index.bundle?platform=ios&dev=true&hot=true&minify=false`
@@ -1477,7 +1350,6 @@ export async function probePort(
1477
1350
  // identifying expo/metro instances here from their /status response we
1478
1351
  // never fire the HEAD against them.
1479
1352
  if (statusRes && statusRes.body.includes('packager-status:running')) {
1480
- knownNonPatched.add(port)
1481
1353
  // `makeResult` builds the entry the app's native delegate names. that is
1482
1354
  // the RIGHT answer for a vanilla Metro or plain Expo packager, which is a
1483
1355
  // server that ANSWERED `/` and had no manifest to give. it is a guess when
@@ -1494,36 +1366,6 @@ export async function probePort(
1494
1366
  )
1495
1367
  }
1496
1368
 
1497
- // patched sootsim — fallback for legacy /__peachsim/ patched servers. also
1498
- // checked before the one HEAD for the same reason.
1499
- if (
1500
- sootsimRes &&
1501
- sootsimRes.statusCode === 200 &&
1502
- sootsimRes.body.includes('sootsim-patched')
1503
- ) {
1504
- knownNonPatched.delete(port)
1505
- return enrichWithManifest(
1506
- applyManifest(
1507
- {
1508
- port,
1509
- framework: 'one',
1510
- bundleUrl: withRuntimeConfig(
1511
- port,
1512
- `${buildLoopbackProbeBaseUrl('http:', probeHostname, port)}/__peachsim/bundle.js`,
1513
- owner.cwd,
1514
- ),
1515
- hmrUrl: `${buildLoopbackProbeBaseUrl('ws:', probeHostname, port)}/hot`,
1516
- lastSeen: Date.now(),
1517
- patched: true,
1518
- ...owner,
1519
- },
1520
- manifestRes,
1521
- buildIconProxyUrl,
1522
- ),
1523
- buildIconProxyUrl,
1524
- )
1525
- }
1526
-
1527
1369
  // wave 2 — one/vxrn HEAD probe. only fired as a true last resort, since
1528
1370
  // it has the metro side-effect documented above. older One bare-dev-server
1529
1371
  // setups that don't serve a manifest still resolve through this path; new
@@ -1545,8 +1387,8 @@ export async function probePort(
1545
1387
  (statusRes && statusRes.statusCode === 200) ||
1546
1388
  (manifestRes && manifestRes.statusCode === 200 && manifestParsed != null)
1547
1389
  if (looksLikeMetroPackager) {
1548
- // do NOT cache as knownNonPatched — we want a fresh wave-1 pass next scan
1549
- // once the packager finishes booting and its manifest/status are ready.
1390
+ // a fresh wave-1 pass next scan sees the packager once its manifest and
1391
+ // status are ready.
1550
1392
  return null
1551
1393
  }
1552
1394
 
@@ -1558,7 +1400,6 @@ export async function probePort(
1558
1400
  // one's native dev engine serves text/javascript; metro uses application/javascript.
1559
1401
  /^(?:application|text)\/javascript(?:\s*;|$)/i.test(oneRes.contentType?.trim() || '')
1560
1402
  ) {
1561
- knownNonPatched.add(port)
1562
1403
  knownOne.add(port)
1563
1404
  return enrichWithManifest(
1564
1405
  applyManifest(
@@ -1581,16 +1422,12 @@ export async function probePort(
1581
1422
  )
1582
1423
  }
1583
1424
 
1584
- // only an answer is knowledge: a /__peachsim/ that never answered is asked again
1585
- if (sootsimRes) knownNonPatched.add(port)
1586
1425
  if (verdict) {
1587
1426
  verdict.answeredNegative =
1588
- (skipPatched || sootsimRes !== null) &&
1589
1427
  statusRes !== null &&
1590
1428
  (skipManifest || manifestRes !== null) &&
1591
1429
  swiftRes !== null &&
1592
1430
  kotlinRes !== null &&
1593
- oneScanRes !== null &&
1594
1431
  oneRes !== null
1595
1432
  }
1596
1433
  return null
@@ -1686,9 +1523,7 @@ export function __shouldReuseScannerCacheEntry(
1686
1523
  // exported for tests / `peach debug` — forces the next scan to re-probe.
1687
1524
  export function __resetScannerCache() {
1688
1525
  portCache.clear()
1689
- knownNonPatched.clear()
1690
1526
  knownOne.clear()
1691
- oneNativeApps.clear()
1692
1527
  enrichmentCache.clear()
1693
1528
  enrichmentInFlight.clear()
1694
1529
  portCacheInvalidatedAt.clear()
@@ -1734,20 +1569,14 @@ export async function scanDevServers(
1734
1569
  const currentPorts = new Set(processes.map((p) => p.port))
1735
1570
 
1736
1571
  // evict cache entries for ports that disappeared. a restarted process may
1737
- // bring up a different server (possibly sootsim-patched) on the same port,
1738
- // and both caches need to let go so the next probe sees the new state.
1572
+ // bring up a different server on the same port, and the caches need to let
1573
+ // go so the next probe sees the new state.
1739
1574
  for (const p of [...portCache.keys()]) {
1740
1575
  if (!currentPorts.has(p)) portCache.delete(p)
1741
1576
  }
1742
- for (const p of [...knownNonPatched]) {
1743
- if (!currentPorts.has(p)) knownNonPatched.delete(p)
1744
- }
1745
1577
  for (const p of [...knownOne]) {
1746
1578
  if (!currentPorts.has(p)) knownOne.delete(p)
1747
1579
  }
1748
- for (const p of [...oneNativeApps.keys()]) {
1749
- if (!currentPorts.has(p)) oneNativeApps.delete(p)
1750
- }
1751
1580
  for (const p of [...enrichmentCache.keys()]) {
1752
1581
  if (!currentPorts.has(p)) enrichmentCache.delete(p)
1753
1582
  }
@@ -1767,22 +1596,16 @@ export async function scanDevServers(
1767
1596
  // so we can't trust the cache — reprobe.
1768
1597
  const retryNegative =
1769
1598
  opts.fresh === true && cached?.result === null && cached.answeredNegative
1770
- if (retryNegative) {
1771
- // middleware may mount on the same listener after its negative answer.
1772
- knownNonPatched.delete(port)
1773
- }
1774
1599
  if (cached && !retryNegative && __shouldReuseScannerCacheEntry(cached, pid)) {
1775
1600
  if (cached.result) results.push(cached.result)
1776
1601
  continue
1777
1602
  }
1778
1603
  // pid changed or cache expired — drop any endpoint-specific verdicts so
1779
1604
  // the re-probe starts from scratch. otherwise a restarted process that
1780
- // swapped frameworks keeps the old skip-/__peachsim/
1781
- // decision, and the scanner never discovers the new server.
1605
+ // swapped frameworks keeps the old skip-manifest decision, and the
1606
+ // scanner never discovers the new server.
1782
1607
  if (cached && cached.pid !== pid) {
1783
- knownNonPatched.delete(port)
1784
1608
  knownOne.delete(port)
1785
- oneNativeApps.delete(port)
1786
1609
  // a restarted process may be a different app — drop its captured name/icon.
1787
1610
  enrichmentCache.delete(port)
1788
1611
  localIconPathCache.delete(port)
@@ -1815,39 +1638,6 @@ export async function scanDevServers(
1815
1638
  })
1816
1639
  }
1817
1640
 
1818
- // the app server's Vite root, rather than a process cwd, owns widget metadata,
1819
- // and its /__server-scan reads it from source on every request, so each scan
1820
- // asks again within the budget wave 1 gives that endpoint. a server too busy
1821
- // to answer keeps the widget it last advertised: no answer is not the answer
1822
- // "no widget".
1823
- await Promise.all(
1824
- results.map(async (result) => {
1825
- const nativeIdentity = oneNativeApps.get(result.port)
1826
- if (result.framework !== 'one' && result.framework !== 'vxrn' && !nativeIdentity) {
1827
- result.widget = null
1828
- return
1829
- }
1830
- const scanRes = await httpGet(
1831
- normalizeHostname(new URL(result.bundleUrl).hostname),
1832
- result.port,
1833
- '/__server-scan',
1834
- 'GET',
1835
- MANIFEST_TIMEOUT_MS,
1836
- )
1837
- if (!scanRes) {
1838
- result.widget ??= null
1839
- return
1840
- }
1841
- const scan =
1842
- scanRes.statusCode === 200 && scanRes.contentType?.includes('json')
1843
- ? safeParseManifest(scanRes.body)
1844
- : null
1845
- result.widget = nativeIdentity
1846
- ? oneNativeWidgetFromScan(scan, result, nativeIdentity)
1847
- : configuredWidgetFromScan(scan, result.bundleUrl)
1848
- }),
1849
- )
1850
-
1851
1641
  // attach pid + cwd. pid comes from the listening-process scan; cwd is
1852
1642
  // lsof-resolved and cached per pid. both enable auto-attach of agent
1853
1643
  // sessions to the right project without a manual `sootsim agent attach`.
@@ -117,7 +117,7 @@ typedef NS_OPTIONS(NSUInteger, NSDateComponentsFormatterZeroFormattingBehavior)
117
117
  /// > In Swift, you can use ``Date/RelativeFormatStyle`` rather than ``DateComponentsFormatter``. The ``FormatStyle`` API offers a declarative idiom for customizing the formatting of various types. Also, Foundation caches identical ``FormatStyle`` instances, so you don't need to pass them around your app, or risk wasting memory with duplicate formatters.
118
118
  NS_SWIFT_SENDABLE
119
119
  API_AVAILABLE(macos(10.10), ios(8.0), watchos(2.0), tvos(9.0))
120
- @interface NSDateComponentsFormatter : NSFormatter
120
+ PEACH_SWIFT_CLASS(PeachFoundation) @interface NSDateComponentsFormatter : NSFormatter
121
121
 
122
122
  /// Returns a formatted string based on the date information in the specified object.
123
123
  ///
@@ -2,11 +2,11 @@
2
2
  import fs from 'node:fs'
3
3
  import { createRequire } from 'node:module'
4
4
  import path from 'node:path'
5
- import { readAndroidAutolinkedPackages } from './androidAutolinkingContract'
5
+ import { readAndroidAutolinkedPackages } from '@peach/globals/android-autolinking'
6
6
  import { autolinkerJson, runAutolinker } from './autolinker-process'
7
7
  import { isRecord } from './is-record'
8
8
  import { reactNativeAutolinkingConfig } from './react-native-autolinking'
9
- import type { AndroidAutolinkedDependency } from './androidAutolinkingContract'
9
+ import type { AndroidAutolinkedDependency } from '@peach/globals/android-autolinking'
10
10
 
11
11
  const resolving = new Map<string, Promise<readonly Record<string, unknown>[]>>()
12
12
 
@@ -18,9 +18,7 @@ import {
18
18
  import { terminateProcessGroup } from './process-group'
19
19
  import {
20
20
  discoverAppCatalog,
21
- discoverOneNativeAppCatalog,
22
- oneDeclaredAppCatalog,
23
- readProjectOneNativeAppCatalog,
21
+ discoverProjectOneNativeAppCatalog,
24
22
  } from '../cli/app-catalog'
25
23
  import { captureStagedHostFiles } from './host/staged-host-files'
26
24
 
@@ -333,7 +331,7 @@ async function packagePlatformBundle(
333
331
  projectRoot,
334
332
  platform,
335
333
  bundle,
336
- { config, versions, readAssetFile, configuration, devOrigin = null, oneDeclared = null },
334
+ { config, versions, readAssetFile, configuration },
337
335
  ) {
338
336
  const { produceConfiguredBundle } = await import('./configured-bundle-producer')
339
337
  const assets = new Map()
@@ -361,8 +359,7 @@ async function packagePlatformBundle(
361
359
  if (platform === 'ios') {
362
360
  const captured = await captureStagedHostFiles(async () =>
363
361
  (await discoverAppCatalog(projectRoot, 'https://packaged.invalid')) ??
364
- (devOrigin ? await discoverOneNativeAppCatalog(devOrigin, 'https://packaged.invalid') : null) ??
365
- (oneDeclared ? oneDeclaredAppCatalog(oneDeclared, 'https://packaged.invalid') : null),
362
+ discoverProjectOneNativeAppCatalog(projectRoot, 'https://packaged.invalid'),
366
363
  )
367
364
  if (captured.value) {
368
365
  appCatalog = {
@@ -461,7 +458,6 @@ export async function snapshotDevServerBundles(
461
458
  await packagePlatformBundle(projectRoot, platform, bundle, {
462
459
  ...inputs,
463
460
  configuration: 'Debug',
464
- devOrigin: origin,
465
461
  readAssetFile: async (asset, file) => {
466
462
  const response = await fetch(
467
463
  `${origin}${asset.httpServerLocation}/${file}?platform=${platform}&hash=${asset.hash}`,
@@ -490,13 +486,6 @@ export async function snapshotOneProductionBundle(
490
486
  const { tmpdir } = await import('node:os')
491
487
  const { promisify } = await import('node:util')
492
488
  const inputs = await readPackagingInputs(projectRoot)
493
- const oneDeclared = platforms.includes('ios')
494
- ? await readProjectOneNativeAppCatalog(
495
- projectRoot,
496
- { ...process.env, ...env, NODE_ENV: 'production' },
497
- runtimeExecutable,
498
- )
499
- : null
500
489
  const snapshots = []
501
490
  for (const platform of platforms) {
502
491
  const out = await mkdtemp(join(tmpdir(), 'peach-production-bundle-'))
@@ -519,7 +508,6 @@ export async function snapshotOneProductionBundle(
519
508
  snapshots.push(
520
509
  await packagePlatformBundle(projectRoot, platform, await readFile(join(out, 'bundle.js')), {
521
510
  ...inputs,
522
- oneDeclared,
523
511
  configuration: 'Release',
524
512
  readAssetFile: (asset, file) =>
525
513
  readFile(join(out, asset.httpServerLocation, file)),
@@ -261,9 +261,8 @@ export interface RnxCloudSimView {
261
261
  // one simulator as create and get report it, with the watch URL a browser
262
262
  // opens to see it.
263
263
  export interface RnxCloudSimInstance extends RnxCloudSimView {
264
- /** a watch URL with its grant in the fragment, or null when none can be
265
- * minted yet: an unconfirmed simulator is not watchable. */
266
- streamUrl: string | null
264
+ /** the simulator page for members of the owning account. */
265
+ streamUrl: string
267
266
  }
268
267
 
269
268
  // the create/reuse answer: the receipt the box path also returns, plus what
@@ -272,7 +271,7 @@ export interface RnxCloudSimCreateResponse extends RnxCloudCreateReceipt {
272
271
  token: string
273
272
  status: RnxCloudSimStatus
274
273
  labels: Record<string, string>
275
- streamUrl: string | null
274
+ streamUrl: string
276
275
  }
277
276
 
278
277
  // one grammar for the create map and the list selector: `key=value,key2=value2`.
package/src/config.ts CHANGED
@@ -30,11 +30,6 @@ export type ModuleResolution =
30
30
  | { file: string } // resolve to a file relative to the config
31
31
  | { inline: Record<string, any> } // inline stub object
32
32
 
33
- // a production bundle has no module paths, so the build tags each workspace
34
- // module a config `modules` entry names with an assignment of this global to the
35
- // entry's key; the engine finds the tagged factory and substitutes it
36
- export const PEACH_WORKSPACE_MODULE_MARKER = '__peach_workspace_module'
37
-
38
33
  // match a metro module name against config.modules patterns.
39
34
  // config keys match as path prefixes: key "modules/bottom-sheet" matches
40
35
  // any module whose name contains "/modules/bottom-sheet/"
@@ -43,8 +43,14 @@ import {
43
43
  type DevBridgeLockfile,
44
44
  type SharedConfig,
45
45
  } from '../home-paths.ts'
46
+ import { KOTLIN_PACKAGE_PATH } from '../kotlinDiscoveryContract'
46
47
  import { handleNitroRequest, NITRO_ROUTE } from '../nitro-bundle.ts'
48
+ import {
49
+ handleOneNativeSourceRequest,
50
+ handleOneNativeSourceUpgrade,
51
+ } from '../one-native-source'
47
52
  import { handleOneSDKRequest, ONE_SDK_ROUTE } from '../one-sdk-bundle.ts'
53
+ import { ONE_WIDGET_PATH } from '../oneWidgetContract'
48
54
  import { isProcessRunning } from '../process-liveness.ts'
49
55
  import { rnxPublicBrand } from '../public-brand.ts'
50
56
  import {
@@ -56,6 +62,7 @@ import {
56
62
  } from '../runtime-assets.ts'
57
63
  import { rnxRuntime } from '../runtime-delivery.ts'
58
64
  import { ensureRuntimePackFor } from '../runtime-packs.ts'
65
+ import { SWIFT_PACKAGE_PATH } from '../swift-submit'
59
66
  import { handleTurboRequest, TURBO_ROUTE } from '../turbo-bundle.ts'
60
67
  import {
61
68
  handleWidgetExtensionRequest,
@@ -300,6 +307,8 @@ const HTTP_MIME_TYPES: Record<string, string> = {
300
307
  '.jpg': 'image/jpeg',
301
308
  '.jpeg': 'image/jpeg',
302
309
  '.gif': 'image/gif',
310
+ '.heic': 'image/heic',
311
+ '.heif': 'image/heif',
303
312
  '.svg': 'image/svg+xml',
304
313
  '.webp': 'image/webp',
305
314
  '.avif': 'image/avif',
@@ -599,6 +608,7 @@ export class SootSimBridgeHost {
599
608
  this.wireWebSocketServer()
600
609
  server.on('upgrade', (req, socket, head) => {
601
610
  if (rejectUntrustedBridgeUpgrade(req, socket)) return
611
+ if (handleOneNativeSourceUpgrade(req, socket, head)) return
602
612
  if (handleWebSocketProxyUpgrade(req, socket, head)) return
603
613
  this.wss?.handleUpgrade(req, socket, head, (ws) => {
604
614
  this.wss?.emit('connection', ws, req)
@@ -1576,7 +1586,9 @@ export class SootSimBridgeHost {
1576
1586
  route === NITRO_ROUTE ||
1577
1587
  route === ONE_SDK_ROUTE ||
1578
1588
  route === TURBO_ROUTE ||
1579
- /^\/__peach\/(?:expo-swift|swift|expo-kotlin|kotlin-artifact\/)/.test(route)
1589
+ /^\/__peach\/(?:expo-swift|swift|expo-kotlin|kotlin-artifact\/|kotlin-package)/.test(
1590
+ route,
1591
+ )
1580
1592
  ) {
1581
1593
  // a sim waiting on its app's native build is not idle, however long the
1582
1594
  // compile takes; the reaper measures idleness from when the work settles.
@@ -1607,6 +1619,14 @@ export class SootSimBridgeHost {
1607
1619
  void handleTurboRequest(req, res)
1608
1620
  return
1609
1621
  }
1622
+ if (
1623
+ route.startsWith(SWIFT_PACKAGE_PATH) ||
1624
+ route === KOTLIN_PACKAGE_PATH ||
1625
+ route === ONE_WIDGET_PATH
1626
+ ) {
1627
+ void handleOneNativeSourceRequest(req, res)
1628
+ return
1629
+ }
1610
1630
  if (
1611
1631
  req.url?.startsWith('/__peach/expo-swift') ||
1612
1632
  req.url?.startsWith('/__peach/swift')
@@ -1,7 +1,4 @@
1
- import {
2
- scanDevServers,
3
- SERVER_SCAN_PROBE_HEADER,
4
- } from '../../scripts/dev-server-scanner.ts'
1
+ import { scanDevServers } from '../../scripts/dev-server-scanner.ts'
5
2
  import { buildBrowserAssetProxyUrl } from '../backend-origin.ts'
6
3
  import type { DiscoveredServer } from '../serverDiscoveryContract'
7
4
  import type { IncomingMessage, ServerResponse } from 'node:http'
@@ -59,11 +56,6 @@ export function createServerScanHandler(options: ServerScanOptions) {
59
56
  })
60
57
  res.end(JSON.stringify(body))
61
58
  }
62
- // another scanner may probe this host while our own scan is in flight.
63
- if (req.headers[SERVER_SCAN_PROBE_HEADER] !== undefined) {
64
- sendJson(200, cache ?? [])
65
- return
66
- }
67
59
  if (cache && Date.now() - cachedAt < SCAN_FRESH_MS) {
68
60
  sendJson(200, cache)
69
61
  return
package/src/index.ts CHANGED
@@ -70,8 +70,6 @@ export {
70
70
  type RnxScreenCapture,
71
71
  } from './capture-contract'
72
72
 
73
- export { peachPlugin } from './vite-plugin-one'
74
- export { default as metroPlugin } from './metro-plugin'
75
73
  export { default as jumpToSourceBabelPlugin } from './jump-to-source-babel'
76
74
  export {
77
75
  DEFAULT_SOOTSIM_BRIDGE_PORT,
@@ -40,6 +40,7 @@ import {
40
40
  viewModelClasses,
41
41
  type ViewModelClass,
42
42
  } from './kotlin-view-models'
43
+ import { KOTLIN_PACKAGE_PATH } from './kotlinDiscoveryContract'
43
44
  import type { DayNight, DrawableFile } from './android-drawables'
44
45
  import type { TextAppearance } from './android-theme'
45
46
  import type { XmlElement } from './android-xml'
@@ -1676,8 +1677,6 @@ export function serveKotlinArtifact(pathname: string, res: ServerResponse): bool
1676
1677
  return true
1677
1678
  }
1678
1679
 
1679
- export const KOTLIN_PACKAGE_PATH = '/__peach/kotlin-package'
1680
-
1681
1680
  export { peachKotlinModuleRoot } from './kotlin-module'
1682
1681
 
1683
1682
  // answers one /__peach/kotlin* request: the app's compiled module description,
@@ -1,6 +1,7 @@
1
1
  // the foreground kotlin host's signature, shared by its server and scanner.
2
2
  export const KOTLIN_DISCOVERY_PATH = '/__peach/kotlin-host'
3
3
  export const KOTLIN_GUEST_PATH = '/__peach/kotlin-guest.js'
4
+ export const KOTLIN_PACKAGE_PATH = '/__peach/kotlin-package'
4
5
 
5
6
  export interface KotlinHostDiscovery {
6
7
  framework: 'kotlin'