@expo/serve-sim 0.11.0 → 0.12.0

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.
package/README.md CHANGED
@@ -402,6 +402,30 @@ http://localhost:8081/_expo/plugins/expo-device-hub
402
402
 
403
403
  No other configuration needed.
404
404
 
405
+ ## Restrict a session to one simulator
406
+
407
+ ```sh
408
+ npx @expo/serve-sim --single-device <simulator-udid>
409
+ ```
410
+
411
+ This boots and locks the preview to that exact simulator. The device sidebar
412
+ and its toggle are removed. HTTP routes, helper sockets, and control actions
413
+ reject other device targets, including `all` and `booted`. The same simulator
414
+ can reboot or reconnect without changing the session's device. This option
415
+ requires the preview server and cannot be combined with `--detach`, `--orphan`,
416
+ `--no-preview`, `--list`, or `--kill`. It can accompany `--adopt` when its UDID
417
+ matches the prepared server's startup device. The private handoff applies the
418
+ restriction before reporting success; it does not boot another Simulator.
419
+
420
+ Embedded hosts can set `simMiddleware({ singleDevice: udid })`. This also enables
421
+ same-origin helper proxies; forward WebSocket upgrades as described below.
422
+ WebKit DevTools is disabled because the bridge cannot reliably associate its
423
+ targets with a simulator UDID. The restriction applies to this server's routes;
424
+ it does not prevent host tools or separately running servers from using devices.
425
+ Path-based `file.readBase64` and `app.infoPlist` actions remain host-scoped within
426
+ their existing allowed roots. They can read files belonging to another Simulator;
427
+ single-device mode is not a filesystem sandbox.
428
+
405
429
  ## Embed in your dev server
406
430
 
407
431
  `@expo/serve-sim/middleware` is a **fetch-style** middleware. `simMiddleware(options)` returns a Web-standard request handler with a `.handleWebSocket` hook, so it mounts in any server that speaks `Request`/`Response` (Bun, Deno, Hono, a Node adapter, …). Run `serve-sim --detach` once to start the streaming helper, then wire the two entry points: