stim 1.6.0 → 1.7.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.
Files changed (71) hide show
  1. package/README.md +1 -1
  2. package/dist/{android-BkYmndPp.mjs → android-DWssqHQ8.mjs} +165 -661
  3. package/dist/{android-DLJB8ljN.mjs → android-Da-G_o3n.mjs} +646 -548
  4. package/dist/{android-BW8i_YxU.mjs → android-DeYdjjBP.mjs} +6 -2
  5. package/dist/{android-cas-CrzI_Zha.mjs → android-cas-SWIjzeuL.mjs} +54 -18
  6. package/dist/android-cas-compiler.mjs +1 -1
  7. package/dist/{app-install--PAocWvq.mjs → app-install-DJg7bVv-.mjs} +36 -10
  8. package/dist/build-lock-CgtsB6TV.mjs +604 -0
  9. package/dist/{build-slots-CuPszJDu.mjs → build-slots-C-oAHRT1.mjs} +2 -2
  10. package/dist/{cache-manifest-uoOKhgUD.mjs → cache-manifest-CYJi8-Hx.mjs} +2 -2
  11. package/dist/cache-manifest.d.mts +1 -1
  12. package/dist/cache-manifest.mjs +1 -1
  13. package/dist/cli.mjs +14 -14
  14. package/dist/collector-run.d.mts +2 -0
  15. package/dist/collector-run.mjs +7 -7
  16. package/dist/{command-output-BuIb_ZOI.mjs → command-output-B3ycpsYv.mjs} +2 -2
  17. package/dist/{config-DMP7L7H6.mjs → config-B7iyKWkL.mjs} +56 -16
  18. package/dist/{dependency-state-CTL8A9p3.mjs → dependency-state-D0M7oKA7.mjs} +2 -2
  19. package/dist/{deps-C1zGnr61.mjs → deps-oCXVNEqQ.mjs} +6 -6
  20. package/dist/detached-entry-Bpo6ZY_I.mjs +65 -0
  21. package/dist/{dev-client-BaTXAAnC.mjs → dev-client-DDUkWgJL.mjs} +12 -12
  22. package/dist/{device-xoQxw8hR.mjs → device-CBSaC6BU.mjs} +7 -7
  23. package/dist/{device-XY_5eGdN.mjs → device-CLeDp-KH.mjs} +17 -15
  24. package/dist/{device-lease-DBW-IL4p.mjs → device-lease-Ffz_M5t0.mjs} +3 -3
  25. package/dist/{device-pool-C0s_83Og.mjs → device-pool-DNSHL5z8.mjs} +4 -4
  26. package/dist/{device-remote-D9wN3CdE.mjs → device-remote-BprxZp-m.mjs} +11 -11
  27. package/dist/{doctor-BRO8UKlK.mjs → doctor-CTAx9gMu.mjs} +90 -46
  28. package/dist/{error-diagnostics-B5STzxqN.mjs → error-diagnostics-D1Kaf-eT.mjs} +23 -17
  29. package/dist/{exec-CyylIdq9.mjs → exec-B29XNuhP.mjs} +14 -2
  30. package/dist/{gc-C-6grAQI.mjs → gc-CX0KRfLG.mjs} +17 -16
  31. package/dist/{guide-CYtd7xbA.mjs → guide-CPmAG9me.mjs} +38 -15
  32. package/dist/{guide-status-BF6RsJJp.mjs → guide-status-Craq9z0t.mjs} +3 -3
  33. package/dist/{ios-Ccm6c8Hj.mjs → ios-BRXYSxSc.mjs} +34 -37
  34. package/dist/{ios-device-DJOi9FR5.mjs → ios-device-CDbvn5H2.mjs} +2 -2
  35. package/dist/{ios-device-D3pzTKQE.mjs → ios-device-CFXA46ez.mjs} +1 -1
  36. package/dist/{ios-Deh5js5V.mjs → ios-lEJ5pKsq.mjs} +3 -3
  37. package/dist/{logs-D4Poojxy.mjs → logs-CakdBTtm.mjs} +6 -6
  38. package/dist/{logs-query-Cdp5aaCH.mjs → logs-query-BGL-Pl12.mjs} +1 -1
  39. package/dist/metro-C7bcJ0uo.mjs +233 -0
  40. package/dist/{named-ports-DH9SXd0f.mjs → named-ports-DzMOlmaX.mjs} +57 -42
  41. package/dist/{ownership-CD_XnpDu.mjs → ownership-Cp52QAK1.mjs} +3 -3
  42. package/dist/{ownership-CVY9cqCr.mjs → ownership-D5vkdm8H.mjs} +13 -13
  43. package/dist/{ports-A6uTJSPj.mjs → ports-BIbJaKNW.mjs} +3 -3
  44. package/dist/{process-output-C7IlIzd7.mjs → process-output-Dl5uKE03.mjs} +1 -1
  45. package/dist/{project-B_SDt4ip.mjs → project-DDZWf_16.mjs} +3 -3
  46. package/dist/{reclaim-WXTbXPX4.mjs → reclaim-D614jI6_.mjs} +11 -11
  47. package/dist/{reload-xlQvHKfN.mjs → reload-ChW46VDb.mjs} +9 -9
  48. package/dist/{server-bare-CCLb90FS.mjs → server-bare-BQkyxa_b.mjs} +1 -1
  49. package/dist/{server-expo-CX-zkgWl.mjs → server-expo-BVAA1OqJ.mjs} +23 -11
  50. package/dist/server-expo-YDDG3eP7.mjs +2 -0
  51. package/dist/{settings-CGHTt5vb.mjs → settings-BXXorVM2.mjs} +3 -3
  52. package/dist/{slot-launch-BYjnljAs.mjs → slot-launch-DbLvyrup.mjs} +4 -4
  53. package/dist/{start-DHYAyGzm.mjs → start-TTVILlUi.mjs} +111 -38
  54. package/dist/{state-CnWzvCWP.mjs → state-DZobzxLW.mjs} +2 -2
  55. package/dist/{stats-Fo9ACIv7.mjs → stats-BYcZ6n1h.mjs} +1 -1
  56. package/dist/{stats-DHrO0frH.mjs → stats-CLg5RuDS.mjs} +4 -4
  57. package/dist/{status-QeLZb8SM.mjs → status-DUNy_HZs.mjs} +14 -15
  58. package/dist/{stop-CHTaw65F.mjs → stop-CnUpnFT5.mjs} +2 -2
  59. package/dist/{stop-DsdOx9Hj.mjs → stop-ZrfODZ51.mjs} +13 -13
  60. package/dist/supervisor-run.mjs +7 -5
  61. package/dist/{teardown-sm1FwF6V.mjs → teardown-5J5UXz2P.mjs} +14 -17
  62. package/dist/{workspace-process-lock-Bz19_R9R.mjs → workspace-process-lock-BYfZz_S-.mjs} +1 -1
  63. package/dist/{workspace-state-WVwWw_hB.mjs → workspace-state-BT5E3SA2.mjs} +3 -3
  64. package/dist/{worktree-CCNPg_f0.mjs → worktree-BfE4lzHK.mjs} +21 -16
  65. package/dist/{worktree-DJnBbQZ9.mjs → worktree-FG_ZKKdb.mjs} +13 -9
  66. package/dist/{xcode-DUF7jrXj.mjs → xcode-B6YaWeg0.mjs} +8 -8
  67. package/package.json +12 -8
  68. package/shim/android-optimizations.gradle +6 -0
  69. package/dist/metro-ato6ef3J.mjs +0 -99
  70. package/dist/ports-BZprTJRa.mjs +0 -90
  71. package/dist/server-expo-CjeTJ273.mjs +0 -2
@@ -1,8 +1,8 @@
1
- import { t as getExecutor } from "./exec-CyylIdq9.mjs";
2
- import { u as getConfigDir, w as process_identity_exports } from "./config-DMP7L7H6.mjs";
3
- import { t as createLineReader } from "./process-output-C7IlIzd7.mjs";
4
- import { r as pidExists } from "./metro-ato6ef3J.mjs";
5
- import { t as withWorkspaceProcessLock } from "./workspace-process-lock-Bz19_R9R.mjs";
1
+ import { t as getExecutor } from "./exec-B29XNuhP.mjs";
2
+ import { u as getConfigDir, w as process_identity_exports } from "./config-B7iyKWkL.mjs";
3
+ import { t as createLineReader } from "./process-output-Dl5uKE03.mjs";
4
+ import { i as pidExists, o as signalProcessTree } from "./metro-C7bcJ0uo.mjs";
5
+ import { t as withWorkspaceProcessLock } from "./workspace-process-lock-BYfZz_S-.mjs";
6
6
  import { closeSync, mkdirSync, openSync, readFileSync, unlinkSync } from "node:fs";
7
7
  import { createHash, randomUUID } from "node:crypto";
8
8
  import { basename, join, resolve, sep } from "node:path";
@@ -324,13 +324,14 @@ function resumeChildPipes(child) {
324
324
  child.stdout?.resume?.();
325
325
  child.stderr?.resume?.();
326
326
  }
327
- async function signalAndWaitForExit(child, signal, { timeoutMs, now, sleep, isAlive }) {
327
+ async function signalAndWaitForExit(child, signal, { timeoutMs, now, sleep, isAlive, platform }) {
328
328
  let exited = false;
329
329
  const onExit = () => {
330
330
  exited = true;
331
331
  };
332
332
  child.once("exit", onExit);
333
333
  try {
334
+ if (platform === "win32" && child.pid) signalProcessTree(child.pid, signal, { platform });
334
335
  child.kill(signal);
335
336
  } catch (err) {
336
337
  child.removeListener("exit", onExit);
@@ -343,7 +344,7 @@ async function signalAndWaitForExit(child, signal, { timeoutMs, now, sleep, isAl
343
344
  child.removeListener("exit", onExit);
344
345
  return hasExited();
345
346
  }
346
- async function terminateChild(child, { alreadyExited, timeoutMs, now, sleep, isAlive }) {
347
+ async function terminateChild(child, { alreadyExited, timeoutMs, now, sleep, isAlive, platform = process.platform }) {
347
348
  if (alreadyExited) {
348
349
  closeChildPipes(child);
349
350
  return true;
@@ -352,7 +353,8 @@ async function terminateChild(child, { alreadyExited, timeoutMs, now, sleep, isA
352
353
  timeoutMs,
353
354
  now,
354
355
  sleep,
355
- isAlive
356
+ isAlive,
357
+ platform
356
358
  })) {
357
359
  closeChildPipes(child);
358
360
  return true;
@@ -361,7 +363,8 @@ async function terminateChild(child, { alreadyExited, timeoutMs, now, sleep, isA
361
363
  timeoutMs,
362
364
  now,
363
365
  sleep,
364
- isAlive
366
+ isAlive,
367
+ platform
365
368
  });
366
369
  closeChildPipes(child);
367
370
  return killed;
@@ -371,13 +374,10 @@ function describe(err) {
371
374
  }
372
375
  const STOP_TIMEOUT_MS = 5e3;
373
376
  const STOP_POLL_MS = 100;
374
- function defaultKill(pid) {
375
- process.kill(pid, "SIGTERM");
376
- }
377
377
  function isEsrch(err) {
378
378
  return err?.code === "ESRCH";
379
379
  }
380
- async function stopTunnel(record, { isAlive = pidExists, inspectIdentity = process_identity_exports.inspectProcessIdentity, kill = defaultKill, now = Date.now, sleep = defaultSleep, timeoutMs = STOP_TIMEOUT_MS } = {}) {
380
+ async function stopTunnel(record, { isAlive = pidExists, inspectIdentity = process_identity_exports.inspectProcessIdentity, platform = process.platform, kill = (pid) => signalProcessTree(pid, "SIGTERM", { platform }), now = Date.now, sleep = defaultSleep, timeoutMs = STOP_TIMEOUT_MS } = {}) {
381
381
  const missing = () => {
382
382
  removeRecordedTunnelLogFile(record?.logFile);
383
383
  return { status: "missing" };
@@ -1,6 +1,6 @@
1
- import { f as getProject } from "./config-DMP7L7H6.mjs";
2
- import { a as findProjectRoot } from "./project-B_SDt4ip.mjs";
3
- import { n as getNamedPort, t as clearNamedPorts } from "./named-ports-DH9SXd0f.mjs";
1
+ import { f as getProject } from "./config-B7iyKWkL.mjs";
2
+ import { a as findProjectRoot } from "./project-DDZWf_16.mjs";
3
+ import { n as getNamedPort, t as clearNamedPorts } from "./named-ports-DzMOlmaX.mjs";
4
4
  //#region src/commands/ports.ts
5
5
  async function inProject(action) {
6
6
  try {
@@ -10,7 +10,7 @@ function createLineReader(onLine) {
10
10
  buffered += String(chunk);
11
11
  const parts = buffered.split("\n");
12
12
  buffered = parts.pop() ?? "";
13
- for (const part of parts) onLine(part);
13
+ for (const part of parts) onLine(part.endsWith("\r") ? part.slice(0, -1) : part);
14
14
  },
15
15
  flush() {
16
16
  if (!buffered) return;
@@ -1,9 +1,9 @@
1
- import { c as findEnclosingWorktreeRoot, f as getProject } from "./config-DMP7L7H6.mjs";
2
- import { g as repoRoot } from "./worktree-DJnBbQZ9.mjs";
1
+ import { c as findEnclosingWorktreeRoot, f as getProject } from "./config-B7iyKWkL.mjs";
2
+ import { g as repoRoot } from "./worktree-FG_ZKKdb.mjs";
3
3
  import { existsSync, readFileSync, readdirSync, realpathSync } from "fs";
4
4
  import { basename, dirname, join, resolve } from "path";
5
5
  import { createRequire } from "module";
6
- //#region src/project.ts
6
+ //#region src/workspace/project.ts
7
7
  const requireFromHere = createRequire(import.meta.url);
8
8
  function resolvePackageJson(projectRoot, name) {
9
9
  try {
@@ -1,15 +1,15 @@
1
- import { E as ownership_claim_exports, L as projectDeviceSlots, T as acquireAvdClaim, f as getProject, v as removeProject, w as process_identity_exports } from "./config-DMP7L7H6.mjs";
2
- import { h as workspaceDir, r as readWorkspaceState } from "./workspace-state-WVwWw_hB.mjs";
3
- import { a as clearRemoteSession, i as clearManagedMetroTunnel, s as readMetroTunnel, u as readRemoteSessionId } from "./state-CnWzvCWP.mjs";
4
- import { i as resolveProjectMetro, n as killMetroTree, r as pidExists } from "./metro-ato6ef3J.mjs";
5
- import { n as verifyCollectorOwnership } from "./ownership-CD_XnpDu.mjs";
6
- import { S as resolveEasCliBin, l as parkedMaxSetting, n as teardownOwnedIosSim, t as teardownOwnedAvd } from "./teardown-sm1FwF6V.mjs";
7
- import { l as releaseWorkspaceLeases } from "./device-lease-DBW-IL4p.mjs";
8
- import { i as endRecordedSession } from "./device-remote-D9wN3CdE.mjs";
9
- import { t as clearNamedPorts } from "./named-ports-DH9SXd0f.mjs";
10
- import { r as stopTunnel, t as resolveSupervisorTarget } from "./ownership-CVY9cqCr.mjs";
1
+ import { E as ownership_claim_exports, R as projectDeviceSlots, T as acquireAvdClaim, f as getProject, v as removeProject, w as process_identity_exports } from "./config-B7iyKWkL.mjs";
2
+ import { h as workspaceDir, r as readWorkspaceState } from "./workspace-state-BT5E3SA2.mjs";
3
+ import { a as clearRemoteSession, i as clearManagedMetroTunnel, s as readMetroTunnel, u as readRemoteSessionId } from "./state-DZobzxLW.mjs";
4
+ import { a as resolveProjectMetro, i as pidExists, n as killMetroTree } from "./metro-C7bcJ0uo.mjs";
5
+ import { n as verifyCollectorOwnership } from "./ownership-Cp52QAK1.mjs";
6
+ import { S as resolveEasCliBin, l as parkedMaxSetting, n as teardownOwnedIosSim, t as teardownOwnedAvd } from "./teardown-5J5UXz2P.mjs";
7
+ import { l as releaseWorkspaceLeases } from "./device-lease-Ffz_M5t0.mjs";
8
+ import { i as endRecordedSession } from "./device-remote-BprxZp-m.mjs";
9
+ import { t as clearNamedPorts } from "./named-ports-DzMOlmaX.mjs";
10
+ import { r as stopTunnel, t as resolveSupervisorTarget } from "./ownership-D5vkdm8H.mjs";
11
11
  import { existsSync, rmSync } from "node:fs";
12
- //#region src/reclaim.ts
12
+ //#region src/devices/reclaim.ts
13
13
  async function reapCollectors(root, { verify = verifyCollectorOwnership, collectors }) {
14
14
  const skippedDevices = [];
15
15
  const failedDevices = [];
@@ -1,12 +1,12 @@
1
- import { F as deviceSlotPlatforms, I as parseDeviceSlotKey, f as getProject } from "./config-DMP7L7H6.mjs";
2
- import { a as findProjectRoot } from "./project-B_SDt4ip.mjs";
3
- import { d as readWorkspaceLaunches } from "./state-CnWzvCWP.mjs";
4
- import { i as resolveProjectMetro } from "./metro-ato6ef3J.mjs";
5
- import { l as phaseLine } from "./command-output-BuIb_ZOI.mjs";
6
- import { N as resolveOwnedAvdSerial } from "./android-BkYmndPp.mjs";
7
- import { u as androidAppProcess, y as iosAppProcess } from "./app-install--PAocWvq.mjs";
8
- import { x as resolveOwnedIosSim } from "./ios-Deh5js5V.mjs";
9
- import { n as nativeRunCommand } from "./slot-launch-BYjnljAs.mjs";
1
+ import { I as deviceSlotPlatforms, L as parseDeviceSlotKey, f as getProject } from "./config-B7iyKWkL.mjs";
2
+ import { a as findProjectRoot } from "./project-DDZWf_16.mjs";
3
+ import { d as readWorkspaceLaunches } from "./state-DZobzxLW.mjs";
4
+ import { a as resolveProjectMetro } from "./metro-C7bcJ0uo.mjs";
5
+ import { I as resolveOwnedAvdSerial } from "./android-DWssqHQ8.mjs";
6
+ import { l as phaseLine } from "./command-output-B3ycpsYv.mjs";
7
+ import { u as androidAppProcess, y as iosAppProcess } from "./app-install-DJg7bVv-.mjs";
8
+ import { x as resolveOwnedIosSim } from "./ios-lEJ5pKsq.mjs";
9
+ import { n as nativeRunCommand } from "./slot-launch-DbLvyrup.mjs";
10
10
  import chalk from "chalk";
11
11
  import { WebSocket } from "ws";
12
12
  //#region src/engine/reload.ts
@@ -1,6 +1,6 @@
1
1
  import { i as __require, t as __commonJSMin } from "./rolldown-runtime-BsOwBuO_.mjs";
2
2
  import { n as supervisorError } from "./errors-B6W7FkxQ.mjs";
3
- import { C as projectMetroSharedCache } from "./settings-CGHTt5vb.mjs";
3
+ import { C as projectMetroSharedCache } from "./settings-BXXorVM2.mjs";
4
4
  import { a as metroStoreRoot, o as registerMetroStore, t as appendCacheStore } from "./metro-store-CDDZHtPl.mjs";
5
5
  import { createRequire } from "node:module";
6
6
  import { isAbsolute, join, relative, sep } from "node:path";
@@ -1,9 +1,9 @@
1
- import { t as getExecutor } from "./exec-CyylIdq9.mjs";
1
+ import { t as getExecutor } from "./exec-B29XNuhP.mjs";
2
2
  import { r as createNdjsonWriter } from "./ndjson-BZwI1NBv.mjs";
3
- import { l as resolvePackageJson } from "./project-B_SDt4ip.mjs";
3
+ import { l as resolvePackageJson } from "./project-DDZWf_16.mjs";
4
4
  import { n as supervisorError } from "./errors-B6W7FkxQ.mjs";
5
- import { n as stripAnsi, t as createLineReader } from "./process-output-C7IlIzd7.mjs";
6
- import { C as projectMetroSharedCache } from "./settings-CGHTt5vb.mjs";
5
+ import { n as stripAnsi, t as createLineReader } from "./process-output-Dl5uKE03.mjs";
6
+ import { C as projectMetroSharedCache } from "./settings-BXXorVM2.mjs";
7
7
  import { a as metroStoreRoot, i as metroStoreConfirmedRoot, n as expoMetroConfigPath, o as registerMetroStore, r as expoMetroStoreEnv } from "./metro-store-CDDZHtPl.mjs";
8
8
  import { accessSync, constants, existsSync, readFileSync } from "node:fs";
9
9
  import { dirname, join, parse } from "node:path";
@@ -14,10 +14,20 @@ function delay(ms) {
14
14
  if (typeof timer.unref === "function") timer.unref();
15
15
  });
16
16
  }
17
- function expoBinPath(root) {
17
+ function resolveExpoBin(root) {
18
18
  const fromPackage = expoBinFromPackage(resolvePackageJson(root, "expo"));
19
- if (fromPackage) return fromPackage;
20
- return findBinUpward(root, "expo");
19
+ if (fromPackage) return {
20
+ path: fromPackage,
21
+ source: "package"
22
+ };
23
+ const shim = findBinUpward(root, "expo");
24
+ return shim ? {
25
+ path: shim,
26
+ source: "shim"
27
+ } : null;
28
+ }
29
+ function expoBinPath(root) {
30
+ return resolveExpoBin(root)?.path ?? null;
21
31
  }
22
32
  function expoSdkMajor(root) {
23
33
  const packageJsonPath = resolvePackageJson(root, "expo");
@@ -192,12 +202,13 @@ function resolveMetroStoreInjection(root, { log, env }) {
192
202
  });
193
203
  return additions;
194
204
  }
195
- async function startExpoServer({ root, port, logsDir, writer = null, spawnFn = null, killTimeoutMs = 5e3, tunnel = false, resetCache = false, onTunnelUrl = null }) {
196
- const bin = expoBinPath(root);
197
- if (!bin) {
205
+ async function startExpoServer({ root, port, logsDir, writer = null, spawnFn = null, killTimeoutMs = 5e3, tunnel = false, resetCache = false, onTunnelUrl = null, platform = process.platform }) {
206
+ const resolved = resolveExpoBin(root);
207
+ if (!resolved) {
198
208
  const refusal = expoBinRefusal(root);
199
209
  throw supervisorError("STIM_EXPO_BIN", refusal.message, refusal.remedy);
200
210
  }
211
+ const bin = resolved.path;
201
212
  const log = writer || createNdjsonWriter(join(logsDir, "metro.ndjson"));
202
213
  const spawn = spawnFn || ((cmd, args, opts) => getExecutor().spawn(cmd, args, opts));
203
214
  const args = [
@@ -211,7 +222,8 @@ async function startExpoServer({ root, port, logsDir, writer = null, spawnFn = n
211
222
  log,
212
223
  env: process.env
213
224
  });
214
- const child = spawn(bin, args, {
225
+ const [command, commandArgs] = platform === "win32" && resolved.source === "package" ? [process.execPath, [bin, ...args]] : [bin, args];
226
+ const child = spawn(command, commandArgs, {
215
227
  cwd: root,
216
228
  stdio: [
217
229
  "ignore",
@@ -0,0 +1,2 @@
1
+ import { p as startExpoServer } from "./server-expo-BVAA1OqJ.mjs";
2
+ export { startExpoServer };
@@ -1,5 +1,5 @@
1
- import { d as getConfigPath, g as loadConfig, m as getRepoSettings, p as getProjectSettings } from "./config-DMP7L7H6.mjs";
2
- import { g as repoRoot, s as gitCommonDir } from "./worktree-DJnBbQZ9.mjs";
1
+ import { d as getConfigPath, g as loadConfig, m as getRepoSettings, p as getProjectSettings } from "./config-B7iyKWkL.mjs";
2
+ import { g as repoRoot, s as gitCommonDir } from "./worktree-FG_ZKKdb.mjs";
3
3
  import { createHash } from "node:crypto";
4
4
  import { isAbsolute } from "node:path";
5
5
  import { existsSync, readFileSync, realpathSync, statSync } from "fs";
@@ -177,7 +177,7 @@ function detectProviders(onPath) {
177
177
  return MANAGED_PROVIDERS.filter((p) => onPath(p));
178
178
  }
179
179
  //#endregion
180
- //#region src/settings.ts
180
+ //#region src/workspace/settings.ts
181
181
  function isPlainObject(v) {
182
182
  return v !== null && typeof v === "object" && !Array.isArray(v);
183
183
  }
@@ -1,7 +1,7 @@
1
- import { f as getProject } from "./config-DMP7L7H6.mjs";
2
- import { r as readWorkspaceState } from "./workspace-state-WVwWw_hB.mjs";
3
- import { h as deviceShellArg } from "./app-install--PAocWvq.mjs";
4
- import { n as fileLeaseIo } from "./device-lease-DBW-IL4p.mjs";
1
+ import { f as getProject } from "./config-B7iyKWkL.mjs";
2
+ import { r as readWorkspaceState } from "./workspace-state-BT5E3SA2.mjs";
3
+ import { h as deviceShellArg } from "./app-install-DJg7bVv-.mjs";
4
+ import { n as fileLeaseIo } from "./device-lease-Ffz_M5t0.mjs";
5
5
  //#region src/engine/slot-launch.ts
6
6
  function launchSlotScope(root, slot = "default") {
7
7
  if (slot !== "default") return slot;
@@ -1,20 +1,21 @@
1
- import { t as getExecutor } from "./exec-CyylIdq9.mjs";
2
- import { S as upsertProject, a as clearSupervisor, f as getProject, w as process_identity_exports } from "./config-DMP7L7H6.mjs";
3
- import { _ as workspaceLogsDir, c as ensureWorkspaceStorage, f as supervisorLogFile, o as writeWorkspaceState, r as readWorkspaceState } from "./workspace-state-WVwWw_hB.mjs";
4
- import { g as repoRoot, s as gitCommonDir } from "./worktree-DJnBbQZ9.mjs";
5
- import { a as findProjectRoot, i as detectIsExpo, n as detectAndroidPackage, r as detectBundleId, t as appProjectProblem } from "./project-B_SDt4ip.mjs";
1
+ import { t as getExecutor } from "./exec-B29XNuhP.mjs";
2
+ import { S as upsertProject, a as clearSupervisor, f as getProject, w as process_identity_exports } from "./config-B7iyKWkL.mjs";
3
+ import { _ as workspaceLogsDir, c as ensureWorkspaceStorage, f as supervisorLogFile, o as writeWorkspaceState, r as readWorkspaceState } from "./workspace-state-BT5E3SA2.mjs";
4
+ import { g as repoRoot, s as gitCommonDir } from "./worktree-FG_ZKKdb.mjs";
5
+ import { a as findProjectRoot, i as detectIsExpo, n as detectAndroidPackage, r as detectBundleId, t as appProjectProblem } from "./project-DDZWf_16.mjs";
6
6
  import { n as supervisorError } from "./errors-B6W7FkxQ.mjs";
7
- import { i as clearManagedMetroTunnel, o as clearWorkspaceSupervisor, s as readMetroTunnel } from "./state-CnWzvCWP.mjs";
8
- import { r as reserveMetroPort } from "./ports-BZprTJRa.mjs";
9
- import { i as resolveProjectMetro, n as killMetroTree, r as pidExists } from "./metro-ato6ef3J.mjs";
10
- import { g as stepTimer, l as phaseLine } from "./command-output-BuIb_ZOI.mjs";
11
- import { A as resolveSettings, D as remoteDeviceSettingError, E as remoteAndroidSetting, F as tunnelModeSetting, I as unknownSettingKeys, L as PUBLIC_METRO_ENV, N as settingShapeErrors, O as remoteIosSetting, R as detectProviders, S as ngrokUrlSetting, T as publicUrlSetting, a as SETTING_SHAPE_REMEDY, b as metroTunnelSettingError, d as cacheProviderSettingError, k as resolveCacheProviderConfig, z as planMetroReach } from "./settings-CGHTt5vb.mjs";
12
- import { n as workspaceProcessLockError, t as withWorkspaceProcessLock } from "./workspace-process-lock-Bz19_R9R.mjs";
7
+ import { n as windowsLauncherArgs } from "./detached-entry-Bpo6ZY_I.mjs";
8
+ import { i as clearManagedMetroTunnel, o as clearWorkspaceSupervisor, s as readMetroTunnel } from "./state-DZobzxLW.mjs";
9
+ import { a as resolveProjectMetro, i as pidExists, l as reserveMetroPort, n as killMetroTree, o as signalProcessTree } from "./metro-C7bcJ0uo.mjs";
10
+ import { A as resolveSettings, D as remoteDeviceSettingError, E as remoteAndroidSetting, F as tunnelModeSetting, I as unknownSettingKeys, L as PUBLIC_METRO_ENV, N as settingShapeErrors, O as remoteIosSetting, R as detectProviders, S as ngrokUrlSetting, T as publicUrlSetting, a as SETTING_SHAPE_REMEDY, b as metroTunnelSettingError, d as cacheProviderSettingError, k as resolveCacheProviderConfig, z as planMetroReach } from "./settings-BXXorVM2.mjs";
11
+ import { g as stepTimer, l as phaseLine } from "./command-output-B3ycpsYv.mjs";
12
+ import { n as workspaceProcessLockError, t as withWorkspaceProcessLock } from "./workspace-process-lock-BYfZz_S-.mjs";
13
13
  import { t as spawnEntry } from "./spawn-entry-nCE6m770.mjs";
14
- import { c as queryLogs } from "./logs-query-Cdp5aaCH.mjs";
15
- import { a as withManagedRemoteWorktreeLock, i as terminateChild, n as startTunnelSequence, r as stopTunnel, s as withManagedTunnelLock, t as resolveSupervisorTarget } from "./ownership-CVY9cqCr.mjs";
16
- import { mkdirSync, openSync, readFileSync } from "node:fs";
14
+ import { c as queryLogs } from "./logs-query-BGL-Pl12.mjs";
15
+ import { a as withManagedRemoteWorktreeLock, i as terminateChild, n as startTunnelSequence, r as stopTunnel, s as withManagedTunnelLock, t as resolveSupervisorTarget } from "./ownership-D5vkdm8H.mjs";
16
+ import { appendFileSync, mkdirSync, openSync, readFileSync } from "node:fs";
17
17
  import { dirname } from "node:path";
18
+ import { EventEmitter } from "node:events";
18
19
  import { CACHE_PROVIDER_ENV, cacheProviderEnv } from "@stim-cli/cache";
19
20
  import chalk from "chalk";
20
21
  //#region src/supervisor/cache-reset.ts
@@ -104,10 +105,20 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
104
105
  function startCommand(program) {
105
106
  registerStart(program);
106
107
  }
108
+ function recordedSupervisorProcess(pid) {
109
+ return Object.assign(new EventEmitter(), {
110
+ pid,
111
+ stdout: null,
112
+ stderr: null,
113
+ kill: (signal = "SIGTERM") => pid !== void 0 && signalProcessTree(pid, typeof signal === "number" ? "SIGTERM" : signal),
114
+ unref() {}
115
+ });
116
+ }
117
+ const RECORDED_SUPERVISOR_WAIT_MS = 15e3;
107
118
  function providersOnPath() {
108
119
  return detectProviders((bin) => {
109
120
  try {
110
- return Boolean(getExecutor().runQuiet(`command -v ${bin}`, { timeoutMs: 5e3 }));
121
+ return Boolean(getExecutor().findExecutable(bin));
111
122
  } catch {
112
123
  return false;
113
124
  }
@@ -129,7 +140,8 @@ const DEFAULT_START_DEPS = {
129
140
  }),
130
141
  withWorktreeLock: withManagedRemoteWorktreeLock,
131
142
  withTunnelLock: withManagedTunnelLock,
132
- clearTunnelRecord: clearManagedMetroTunnel
143
+ clearTunnelRecord: clearManagedMetroTunnel,
144
+ platform: process.platform
133
145
  };
134
146
  function normalizeManagedTunnelUrl(url) {
135
147
  return url.trim().replace(/\/+$/, "");
@@ -272,27 +284,8 @@ function registerStart(program, overrides = {}) {
272
284
  let spawnedChild = null;
273
285
  let spawnedTs = null;
274
286
  let childExit = null;
275
- const spawnSupervisor = (origin) => {
276
- mkdirSync(logsDir, { recursive: true });
287
+ const spawnDirect = (supervisorArgs, childEnv) => {
277
288
  const fd = openSync(logFile, "a");
278
- spawnedTs = Date.now();
279
- const supervisorArgs = [
280
- supervisorEntry(),
281
- "--root",
282
- root,
283
- "--port",
284
- String(port),
285
- ...tunnel ? ["--tunnel"] : [],
286
- ...opts.resetCache ? ["--reset-cache"] : []
287
- ];
288
- const childEnv = {
289
- ...process.env,
290
- ...origin ? {
291
- [PUBLIC_METRO_ENV]: origin,
292
- EXPO_PACKAGER_PROXY_URL: origin
293
- } : {}
294
- };
295
- childEnv[CACHE_PROVIDER_ENV] = cacheProviderEnv(cacheProvider);
296
289
  const child = getExecutor().spawn(process.execPath, supervisorArgs, {
297
290
  cwd: root,
298
291
  detached: true,
@@ -317,6 +310,86 @@ function registerStart(program, overrides = {}) {
317
310
  error: err
318
311
  };
319
312
  });
313
+ return child;
314
+ };
315
+ const recordedSupervisorPid = async (since) => {
316
+ const deadline = Date.now() + RECORDED_SUPERVISOR_WAIT_MS;
317
+ while (Date.now() < deadline) {
318
+ const record = readWorkspaceState(root)?.supervisor;
319
+ if (record?.pid && record.port === port && Date.parse(String(record.startedAt)) >= since && pidExists(record.pid)) return record.pid;
320
+ await sleep(25);
321
+ }
322
+ return null;
323
+ };
324
+ const spawnThroughWindowsShell = async (supervisorArgs, childEnv) => {
325
+ const [entry, ...args] = supervisorArgs;
326
+ const launcher = windowsLauncherArgs({
327
+ entry,
328
+ args,
329
+ cwd: root,
330
+ logFile
331
+ });
332
+ const since = Date.now();
333
+ const shell = getExecutor().spawn(launcher.file, launcher.args, {
334
+ cwd: root,
335
+ stdio: [
336
+ "ignore",
337
+ "ignore",
338
+ "pipe"
339
+ ],
340
+ env: {
341
+ ...childEnv,
342
+ ...launcher.env
343
+ },
344
+ windowsHide: true
345
+ });
346
+ const stderr = [];
347
+ shell.stderr?.on("data", (chunk) => stderr.push(String(chunk)));
348
+ const exit = await new Promise((resolve) => {
349
+ shell.on?.("close", (code, signal) => resolve({
350
+ code,
351
+ signal
352
+ }));
353
+ shell.on?.("error", (error) => resolve({
354
+ code: null,
355
+ signal: null,
356
+ error
357
+ }));
358
+ });
359
+ const launcherFailed = exit.code !== 0 || exit.error;
360
+ const pid = launcherFailed ? null : await recordedSupervisorPid(since);
361
+ if (pid === null) {
362
+ const reason = launcherFailed ? `the supervisor launcher exited (${exit.error ? exit.error.message : `code ${exit.code}`})` : `the supervisor did not record itself within ${RECORDED_SUPERVISOR_WAIT_MS / 1e3}s`;
363
+ appendFileSync(logFile, `Stim start: ${reason}.\n${stderr.join("")}`);
364
+ childExit = {
365
+ code: exit.code,
366
+ signal: exit.signal,
367
+ ...exit.error ? { error: exit.error } : {}
368
+ };
369
+ }
370
+ return recordedSupervisorProcess(pid ?? void 0);
371
+ };
372
+ const spawnSupervisor = async (origin) => {
373
+ mkdirSync(logsDir, { recursive: true });
374
+ spawnedTs = Date.now();
375
+ const supervisorArgs = [
376
+ supervisorEntry(),
377
+ "--root",
378
+ root,
379
+ "--port",
380
+ String(port),
381
+ ...tunnel ? ["--tunnel"] : [],
382
+ ...opts.resetCache ? ["--reset-cache"] : []
383
+ ];
384
+ const childEnv = {
385
+ ...process.env,
386
+ ...origin ? {
387
+ [PUBLIC_METRO_ENV]: origin,
388
+ EXPO_PACKAGER_PROXY_URL: origin
389
+ } : {}
390
+ };
391
+ childEnv[CACHE_PROVIDER_ENV] = cacheProviderEnv(cacheProvider);
392
+ const child = d.platform === "win32" ? await spawnThroughWindowsShell(supervisorArgs, childEnv) : spawnDirect(supervisorArgs, childEnv);
320
393
  out(chalk.dim(phaseLine("metro", `starting on port ${port} (${isExpo ? "expo-child" : "bare-inproc"}, supervisor pid ${child.pid})`)));
321
394
  spawnedChild = child;
322
395
  return child;
@@ -476,7 +549,7 @@ function registerStart(program, overrides = {}) {
476
549
  }
477
550
  let child;
478
551
  try {
479
- child = spawnSupervisor(tracking.record.url);
552
+ child = await spawnSupervisor(tracking.record.url);
480
553
  } catch (err) {
481
554
  return { failed: {
482
555
  code: "STIM_SUPERVISOR_EXITED",
@@ -648,7 +721,7 @@ function registerStart(program, overrides = {}) {
648
721
  return;
649
722
  }
650
723
  if (managedTunnelExited()) return failExitedManagedTunnel();
651
- const child = spawnedChild ?? spawnSupervisor(publicOrigin);
724
+ const child = spawnedChild ?? await spawnSupervisor(publicOrigin);
652
725
  const attemptStartedTs = spawnedTs ?? Date.now();
653
726
  if (!await waitForMetro({
654
727
  root,
@@ -1,5 +1,5 @@
1
- import { I as parseDeviceSlotKey, P as deviceSlotKey, w as process_identity_exports } from "./config-DMP7L7H6.mjs";
2
- import { a as withWorkspaceStateLock, i as updateWorkspaceState, p as supervisorPidFile, r as readWorkspaceState, t as clearWorkspaceStateKey, y as workspaceStateFile } from "./workspace-state-WVwWw_hB.mjs";
1
+ import { F as deviceSlotKey, L as parseDeviceSlotKey, w as process_identity_exports } from "./config-B7iyKWkL.mjs";
2
+ import { a as withWorkspaceStateLock, i as updateWorkspaceState, p as supervisorPidFile, r as readWorkspaceState, t as clearWorkspaceStateKey, y as workspaceStateFile } from "./workspace-state-BT5E3SA2.mjs";
3
3
  import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
4
4
  import { dirname } from "node:path";
5
5
  //#region src/supervisor/state.ts
@@ -1,4 +1,4 @@
1
- import { C as withConfigLock, u as getConfigDir } from "./config-DMP7L7H6.mjs";
1
+ import { C as withConfigLock, u as getConfigDir } from "./config-B7iyKWkL.mjs";
2
2
  import { readFileSync, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
3
3
  import { basename, dirname, join, relative, resolve } from "node:path";
4
4
  const PLATFORMS = ["ios", "android"];
@@ -1,7 +1,7 @@
1
- import { g as repoRoot, s as gitCommonDir } from "./worktree-DJnBbQZ9.mjs";
2
- import { a as findProjectRoot } from "./project-B_SDt4ip.mjs";
3
- import { o as formatLongDuration } from "./command-output-BuIb_ZOI.mjs";
4
- import { a as statsProjectKey, r as readStats } from "./stats-Fo9ACIv7.mjs";
1
+ import { g as repoRoot, s as gitCommonDir } from "./worktree-FG_ZKKdb.mjs";
2
+ import { a as findProjectRoot } from "./project-DDZWf_16.mjs";
3
+ import { o as formatLongDuration } from "./command-output-B3ycpsYv.mjs";
4
+ import { a as statsProjectKey, r as readStats } from "./stats-BYcZ6n1h.mjs";
5
5
  import chalk from "chalk";
6
6
  //#region src/commands/stats.ts
7
7
  const PLATFORMS = ["ios", "android"];
@@ -1,18 +1,17 @@
1
- import { t as getExecutor } from "./exec-CyylIdq9.mjs";
2
- import { L as projectDeviceSlots, M as volumeRootFor, g as loadConfig, u as getConfigDir } from "./config-DMP7L7H6.mjs";
3
- import { _ as workspaceLogsDir } from "./workspace-state-WVwWw_hB.mjs";
4
- import { v as resolveSourceCheckout } from "./worktree-DJnBbQZ9.mjs";
5
- import { a as findProjectRoot, c as projectShortcut } from "./project-B_SDt4ip.mjs";
6
- import { t as isMetroRunning } from "./ports-BZprTJRa.mjs";
7
- import { i as resolveProjectMetro } from "./metro-ato6ef3J.mjs";
8
- import { a as formatElapsed, r as clockTime, u as plural } from "./command-output-BuIb_ZOI.mjs";
9
- import { N as resolveOwnedAvdSerial } from "./android-BkYmndPp.mjs";
10
- import { a as POOL_SETTING_REMEDY, l as parkedMaxSetting, u as readParked } from "./teardown-sm1FwF6V.mjs";
11
- import { u as listAllIosSims } from "./ios-Deh5js5V.mjs";
12
- import { i as listLeaseFiles } from "./device-lease-DBW-IL4p.mjs";
13
- import { c as queryLogs } from "./logs-query-Cdp5aaCH.mjs";
14
- import { t as resolveSupervisorTarget } from "./ownership-CVY9cqCr.mjs";
15
- import { i as readSupervisorState } from "./stop-DsdOx9Hj.mjs";
1
+ import { t as getExecutor } from "./exec-B29XNuhP.mjs";
2
+ import { M as volumeRootFor, R as projectDeviceSlots, g as loadConfig, u as getConfigDir } from "./config-B7iyKWkL.mjs";
3
+ import { _ as workspaceLogsDir } from "./workspace-state-BT5E3SA2.mjs";
4
+ import { v as resolveSourceCheckout } from "./worktree-FG_ZKKdb.mjs";
5
+ import { a as findProjectRoot, c as projectShortcut } from "./project-DDZWf_16.mjs";
6
+ import { a as resolveProjectMetro, s as isMetroRunning } from "./metro-C7bcJ0uo.mjs";
7
+ import { I as resolveOwnedAvdSerial } from "./android-DWssqHQ8.mjs";
8
+ import { a as formatElapsed, r as clockTime, u as plural } from "./command-output-B3ycpsYv.mjs";
9
+ import { a as POOL_SETTING_REMEDY, l as parkedMaxSetting, u as readParked } from "./teardown-5J5UXz2P.mjs";
10
+ import { u as listAllIosSims } from "./ios-lEJ5pKsq.mjs";
11
+ import { i as listLeaseFiles } from "./device-lease-Ffz_M5t0.mjs";
12
+ import { c as queryLogs } from "./logs-query-BGL-Pl12.mjs";
13
+ import { t as resolveSupervisorTarget } from "./ownership-D5vkdm8H.mjs";
14
+ import { i as readSupervisorState } from "./stop-ZrfODZ51.mjs";
16
15
  import { existsSync } from "fs";
17
16
  import { totalmem } from "os";
18
17
  import chalk from "chalk";
@@ -1,3 +1,3 @@
1
- import { t as resolveSupervisorTarget } from "./ownership-CVY9cqCr.mjs";
2
- import { a as resolveCollectorTargets, i as readSupervisorState, n as clearSupervisorState, o as runStop, r as readCollectorState, s as stopCommand, t as clearCollectorState } from "./stop-DsdOx9Hj.mjs";
1
+ import { t as resolveSupervisorTarget } from "./ownership-D5vkdm8H.mjs";
2
+ import { a as resolveCollectorTargets, i as readSupervisorState, n as clearSupervisorState, o as runStop, r as readCollectorState, s as stopCommand, t as clearCollectorState } from "./stop-ZrfODZ51.mjs";
3
3
  export { clearCollectorState, clearSupervisorState, stopCommand as default, readCollectorState, readSupervisorState, resolveCollectorTargets, resolveSupervisorTarget, runStop };
@@ -1,15 +1,15 @@
1
- import { C as withConfigLock, F as deviceSlotPlatforms, I as parseDeviceSlotKey, L as projectDeviceSlots, S as upsertProject, a as clearSupervisor, f as getProject, w as process_identity_exports, z as validateDeviceSlot } from "./config-DMP7L7H6.mjs";
2
- import { a as withWorkspaceStateLock, h as workspaceDir, n as clearWorkspaceStateKeys, o as writeWorkspaceState, r as readWorkspaceState } from "./workspace-state-WVwWw_hB.mjs";
3
- import { a as findProjectRoot } from "./project-B_SDt4ip.mjs";
4
- import { a as clearRemoteSession, i as clearManagedMetroTunnel, l as readRemoteSession, o as clearWorkspaceSupervisor, s as readMetroTunnel } from "./state-CnWzvCWP.mjs";
5
- import { i as resolveProjectMetro, n as killMetroTree, r as pidExists } from "./metro-ato6ef3J.mjs";
6
- import { n as verifyCollectorOwnership } from "./ownership-CD_XnpDu.mjs";
7
- import { f as releasedLeaseFact, l as phaseLine, u as plural } from "./command-output-BuIb_ZOI.mjs";
8
- import { S as resolveEasCliBin, n as teardownOwnedIosSim, t as teardownOwnedAvd } from "./teardown-sm1FwF6V.mjs";
9
- import { t as withWorkspaceProcessLock } from "./workspace-process-lock-Bz19_R9R.mjs";
10
- import { l as releaseWorkspaceLeases } from "./device-lease-DBW-IL4p.mjs";
11
- import { i as endRecordedSession } from "./device-remote-D9wN3CdE.mjs";
12
- import { r as stopTunnel, t as resolveSupervisorTarget } from "./ownership-CVY9cqCr.mjs";
1
+ import { B as validateDeviceSlot, C as withConfigLock, I as deviceSlotPlatforms, L as parseDeviceSlotKey, R as projectDeviceSlots, S as upsertProject, a as clearSupervisor, f as getProject, w as process_identity_exports } from "./config-B7iyKWkL.mjs";
2
+ import { a as withWorkspaceStateLock, h as workspaceDir, n as clearWorkspaceStateKeys, o as writeWorkspaceState, r as readWorkspaceState } from "./workspace-state-BT5E3SA2.mjs";
3
+ import { a as findProjectRoot } from "./project-DDZWf_16.mjs";
4
+ import { a as clearRemoteSession, i as clearManagedMetroTunnel, l as readRemoteSession, o as clearWorkspaceSupervisor, s as readMetroTunnel } from "./state-DZobzxLW.mjs";
5
+ import { a as resolveProjectMetro, i as pidExists, n as killMetroTree, o as signalProcessTree } from "./metro-C7bcJ0uo.mjs";
6
+ import { n as verifyCollectorOwnership } from "./ownership-Cp52QAK1.mjs";
7
+ import { f as releasedLeaseFact, l as phaseLine, u as plural } from "./command-output-B3ycpsYv.mjs";
8
+ import { S as resolveEasCliBin, n as teardownOwnedIosSim, t as teardownOwnedAvd } from "./teardown-5J5UXz2P.mjs";
9
+ import { t as withWorkspaceProcessLock } from "./workspace-process-lock-BYfZz_S-.mjs";
10
+ import { l as releaseWorkspaceLeases } from "./device-lease-Ffz_M5t0.mjs";
11
+ import { i as endRecordedSession } from "./device-remote-BprxZp-m.mjs";
12
+ import { r as stopTunnel, t as resolveSupervisorTarget } from "./ownership-D5vkdm8H.mjs";
13
13
  import chalk from "chalk";
14
14
  //#region src/commands/stop.ts
15
15
  const DEFAULT_WAIT_MS = 1e4;
@@ -143,7 +143,7 @@ async function runStop(options) {
143
143
  result.summary = summarize(root, result.outcomes, result.ok);
144
144
  return result;
145
145
  }
146
- async function stopWorkspace({ root, project = void 0, state = void 0, collectors = void 0, signalCollector = (pid) => process.kill(pid, "SIGTERM"), verifyCollector = verifyCollectorOwnership, clearCollectors = clearCollectorState, isAlive = pidExists, killGroup = killMetroTree, inspectIdentity = process_identity_exports.inspectProcessIdentity, waitForDeath = void 0, waitMs = DEFAULT_WAIT_MS, resolveMetro = resolveProjectMetro, teardownIos = teardownOwnedIosSim, teardownAvd = teardownOwnedAvd, remoteDevice = void 0, teardownRemoteSession = defaultTeardownRemoteSession, metroTunnel = void 0, stopMetroTunnel = stopTunnel, releaseLeases = releaseWorkspaceLeases, freePort = defaultFreePort, clearRegistration = defaultClearRegistration, clearState = clearSupervisorState, report = (line) => console.error(line) }) {
146
+ async function stopWorkspace({ root, project = void 0, state = void 0, collectors = void 0, signalCollector = (pid) => signalProcessTree(pid), verifyCollector = verifyCollectorOwnership, clearCollectors = clearCollectorState, isAlive = pidExists, killGroup = killMetroTree, inspectIdentity = process_identity_exports.inspectProcessIdentity, waitForDeath = void 0, waitMs = DEFAULT_WAIT_MS, resolveMetro = resolveProjectMetro, teardownIos = teardownOwnedIosSim, teardownAvd = teardownOwnedAvd, remoteDevice = void 0, teardownRemoteSession = defaultTeardownRemoteSession, metroTunnel = void 0, stopMetroTunnel = stopTunnel, releaseLeases = releaseWorkspaceLeases, freePort = defaultFreePort, clearRegistration = defaultClearRegistration, clearState = clearSupervisorState, report = (line) => console.error(line) }) {
147
147
  const proj = project === void 0 ? getProject(root) : project;
148
148
  const sup = state === void 0 ? readSupervisorState(root) : state;
149
149
  const collectorRecords = collectors === void 0 ? readCollectorState(root) : collectors;
@@ -1,9 +1,10 @@
1
- import { a as clearSupervisor, w as process_identity_exports, x as setSupervisor } from "./config-DMP7L7H6.mjs";
1
+ import { a as clearSupervisor, w as process_identity_exports, x as setSupervisor } from "./config-B7iyKWkL.mjs";
2
2
  import { r as createNdjsonWriter } from "./ndjson-BZwI1NBv.mjs";
3
- import { _ as workspaceLogsDir, a as withWorkspaceStateLock, o as writeWorkspaceState, r as readWorkspaceState } from "./workspace-state-WVwWw_hB.mjs";
4
- import { i as detectIsExpo } from "./project-B_SDt4ip.mjs";
3
+ import { _ as workspaceLogsDir, a as withWorkspaceStateLock, o as writeWorkspaceState, r as readWorkspaceState } from "./workspace-state-BT5E3SA2.mjs";
4
+ import { i as detectIsExpo } from "./project-DDZWf_16.mjs";
5
5
  import { t as describeError } from "./errors-B6W7FkxQ.mjs";
6
- import { c as readPidFile, f as writePidFile, n as MODE_EXPO, o as clearWorkspaceSupervisor, r as clearExpoMetroTunnel, t as MODE_BARE } from "./state-CnWzvCWP.mjs";
6
+ import { t as relaunchWithLogFile } from "./detached-entry-Bpo6ZY_I.mjs";
7
+ import { c as readPidFile, f as writePidFile, n as MODE_EXPO, o as clearWorkspaceSupervisor, r as clearExpoMetroTunnel, t as MODE_BARE } from "./state-DZobzxLW.mjs";
7
8
  import { existsSync, realpathSync } from "node:fs";
8
9
  import { isAbsolute, join, resolve } from "node:path";
9
10
  import { fileURLToPath } from "node:url";
@@ -104,7 +105,7 @@ async function runSupervisor({ root, port, tunnel = false, resetCache = false, i
104
105
  };
105
106
  let server;
106
107
  try {
107
- server = await (mode === "expo-child" ? startExpo || (await import("./server-expo-CjeTJ273.mjs")).startExpoServer : startBare || (await import("./server-bare-CCLb90FS.mjs")).startBareServer)({
108
+ server = await (mode === "expo-child" ? startExpo || (await import("./server-expo-YDDG3eP7.mjs")).startExpoServer : startBare || (await import("./server-bare-BQkyxa_b.mjs")).startBareServer)({
108
109
  root,
109
110
  port,
110
111
  logsDir,
@@ -179,6 +180,7 @@ async function runSupervisor({ root, port, tunnel = false, resetCache = false, i
179
180
  };
180
181
  }
181
182
  async function main(argv = process.argv.slice(2)) {
183
+ if (relaunchWithLogFile(argv)) return;
182
184
  const parsed = parseArgs(argv);
183
185
  if (parsed.error) {
184
186
  console.error(`Stim supervisor: ${parsed.error}`);