stim 1.20.2 → 1.21.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 (217) hide show
  1. package/README.md +88 -8
  2. package/dist/acquire-artifact-CD4lbiWE.mjs +153 -0
  3. package/dist/act-DHAw2A2S.mjs +2667 -0
  4. package/dist/activity-BzVfHSrY.mjs +1376 -0
  5. package/dist/{agent-device-usage-output-Dzgv6lgR.mjs → agent-device-usage-output-zh1vhbLp.mjs} +21 -65
  6. package/dist/{android-HqP1_vB_.mjs → android-BEJ8Jpl7.mjs} +2 -2
  7. package/dist/{android-DCKZrNvV.mjs → android-BLgbNqox.mjs} +128 -78
  8. package/dist/{android-Dlzxshgp.mjs → android-CV_GCELZ.mjs} +5 -5
  9. package/dist/{android-Mz_Inn3w.mjs → android-DUYkNF4u.mjs} +184 -102
  10. package/dist/{android-cas-Bl-cLJBk.mjs → android-cas-Ct5b1xCK.mjs} +7 -6
  11. package/dist/android-cas-compiler.mjs +2 -2
  12. package/dist/android-project-BCAAmMwz.mjs +12 -0
  13. package/dist/api.d.mts +740 -8
  14. package/dist/api.mjs +585 -1
  15. package/dist/{artifact-HSwkIWEQ.mjs → artifact-B8T3S5gi.mjs} +223 -201
  16. package/dist/{artifact-D3czlUvT.mjs → artifact-DAuZ-FNU.mjs} +158 -148
  17. package/dist/{browser-web-CA-F1GQo.mjs → browser-web-QQzVjz3O.mjs} +26 -24
  18. package/dist/budget-Bs6SxxzO.mjs +9154 -0
  19. package/dist/{build-DYDbfkk5.mjs → build-CoPzQRNw.mjs} +144 -96
  20. package/dist/build-cache-DmyR9Zzc.mjs +602 -0
  21. package/dist/build-plan-CaFskB7_.mjs +188 -0
  22. package/dist/{cache-manifest-XH-fvDUj.mjs → cache-manifest-DkkqguoK.mjs} +2 -2
  23. package/dist/cache-manifest.mjs +1 -1
  24. package/dist/{ccache-zdKiYQ3E.mjs → ccache-BJRZ9pG3.mjs} +10 -9
  25. package/dist/{cdp-Dq_ypAlJ.mjs → cdp-CWmIUMbw.mjs} +18 -5
  26. package/dist/{chrome-BnzZMqsR.mjs → chrome-B6tfCta1.mjs} +7 -4
  27. package/dist/{cli-CLP3diBm.mjs → cli-0DYf8QhQ.mjs} +20 -20
  28. package/dist/cli.mjs +1 -1
  29. package/dist/client-B7QVOlCr.d.mts +253 -0
  30. package/dist/client-UXD70ZbM.mjs +1406 -0
  31. package/dist/collector-run.d.mts +4 -40
  32. package/dist/collector-run.mjs +9 -8
  33. package/dist/{command-output-BTy8hZ0F.mjs → command-output-B1UrjZHL.mjs} +1 -1
  34. package/dist/config-CYcBF478.mjs +949 -0
  35. package/dist/{created-devices-Dzd5C2LF.mjs → created-devices-CqeBlrEn.mjs} +3 -3
  36. package/dist/{dependency-state-DG0p31-y.mjs → dependency-state-BbKQW83h.mjs} +20 -5
  37. package/dist/{detached-entry-B9C_zeQC.mjs → detached-entry-DFRyG1_o.mjs} +1 -1
  38. package/dist/{dev-client-DAWVIGBu.mjs → dev-client-UOeESKm6.mjs} +2 -2
  39. package/dist/device-DCxH7_By.mjs +1068 -0
  40. package/dist/{device-BECOiufl.mjs → device-ExJq8Ei7.mjs} +35 -35
  41. package/dist/{device-capacity-CBUAcRyQ.mjs → device-capacity-CMlqEcvw.mjs} +43 -13
  42. package/dist/device-host-worker.mjs +65 -61
  43. package/dist/{device-ios-COSi6oS1.mjs → device-ios-DRUeKaFV.mjs} +48 -45
  44. package/dist/{device-lease-run-Cw2M4z51.mjs → device-lease-run-C8raGFoP.mjs} +14 -26
  45. package/dist/{device-pool-Bf-pOhSw.mjs → device-pool-DMRpVX9a.mjs} +5 -5
  46. package/dist/doctor-BLHCYxzi.mjs +2 -0
  47. package/dist/{doctor-kfMBnUw6.mjs → doctor-DTvaDOda.mjs} +281 -317
  48. package/dist/{doctor-CB8oZKCk.mjs → doctor-Dhqebm0q.mjs} +183 -91
  49. package/dist/doctor-fingerprint.mjs +19 -0
  50. package/dist/{doctor-watchman-BRyV2adA.mjs → doctor-watchman-Cv1F10Kj.mjs} +40 -21
  51. package/dist/{eas-build-JyfqyHfC.mjs → eas-build-BomfRnFT.mjs} +53 -20
  52. package/dist/{build-plan-B7SZsc2N.mjs → eas-fallback-DJwZpy0c.mjs} +26 -208
  53. package/dist/{watchman-CPQFZLXY.mjs → eas-session-ledger-op6A54yi.mjs} +229 -11
  54. package/dist/{error-diagnostics-BR677IDM.mjs → error-diagnostics-Bf0rZvG9.mjs} +172 -82
  55. package/dist/exec-H20xSg2T.d.mts +65 -0
  56. package/dist/exec-_UbtCQcG.mjs +750 -0
  57. package/dist/gc-C-WwL0yi.mjs +3 -0
  58. package/dist/{gc-qWOMdnER.mjs → gc-_-dCXdyL.mjs} +584 -796
  59. package/dist/git-C3iTsJaZ.mjs +73 -0
  60. package/dist/{guide-G9cAbVAc.mjs → guide-Yqwt2bd6.mjs} +941 -269
  61. package/dist/{hosted-android-C3MHGld1.mjs → hosted-android-Bw-honsd.mjs} +8 -6
  62. package/dist/{hosted-client-ZEKpS9vw.mjs → hosted-client-DB_gBPfY.mjs} +34 -19
  63. package/dist/{hosted-ios-l-o3iM9J.mjs → hosted-ios-CUvOf4Vr.mjs} +1 -1
  64. package/dist/{hosted-logs-EzQM7-3Z.mjs → hosted-logs-DL_P5AdN.mjs} +77 -43
  65. package/dist/{hosted-macos-BACVAVqE.mjs → hosted-macos-QI141yKk.mjs} +21 -17
  66. package/dist/{hosted-native-A4s1QPXe.mjs → hosted-native-Ksyjgzq-.mjs} +30 -21
  67. package/dist/idle-BVeRGroT.d.mts +24 -0
  68. package/dist/{idle-shutdown-DtxhPTKe.mjs → idle-shutdown-DaKmZi0z.mjs} +11 -10
  69. package/dist/{ios-BwVCF7oA.mjs → ios-CQ68hG9s.mjs} +8 -8
  70. package/dist/{ios-RkW4pnQf.mjs → ios-CpByZy12.mjs} +140 -80
  71. package/dist/{ios-device-B5veSDDQ.mjs → ios-device-CXGP1bsD.mjs} +1 -1
  72. package/dist/{ios-device-D7pi2Sca.mjs → ios-device-CwFMehUS.mjs} +51 -26
  73. package/dist/{ios-project-K9hY_Jab.mjs → ios-project-WuwwBdvW.mjs} +13 -13
  74. package/dist/{ios-nOLJGVdy.mjs → ios-qNJt4dFm.mjs} +1 -1
  75. package/dist/ios-signing-DTTIChGs.mjs +489 -0
  76. package/dist/{ios-state-CBLe1xYw.mjs → ios-state-DvFX-K_l.mjs} +1 -1
  77. package/dist/{ios-Ce7bc7br.mjs → ios-ubFsBzwq.mjs} +129 -86
  78. package/dist/{js-swap-Bb3nsS07.mjs → js-swap-Cc1dttps.mjs} +53 -26
  79. package/dist/{launch-F4sOqAhB.mjs → launch-CD1yVc7U.mjs} +91 -90
  80. package/dist/{launch-C3qJ6Agb.mjs → launch-Zq2mOSDy.mjs} +82 -541
  81. package/dist/logs-BS00Anxf.mjs +352 -0
  82. package/dist/logs-CMm05HxN.mjs +255 -0
  83. package/dist/{macos-D7uDvO-z.mjs → macos-B65--pPd.mjs} +1 -1
  84. package/dist/{macos-Ch5VJmcS.mjs → macos-C-0qJ6zq.mjs} +225 -212
  85. package/dist/macos-run.mjs +1 -1
  86. package/dist/maintenance-run.mjs +122 -247
  87. package/dist/{metro-DnCEjCxs.mjs → metro-DEXpIhHC.mjs} +67 -12
  88. package/dist/{metro-gateway-CX9Xlkq2.mjs → metro-gateway-BMJNlj3E.mjs} +20 -12
  89. package/dist/{named-ports-4WopRPg-.mjs → named-ports-BWTzt6mu.mjs} +8 -63
  90. package/dist/native-android-JACyjTZs.mjs +844 -0
  91. package/dist/{native-gradle-inputs-BsLRrl7u.mjs → native-gradle-inputs-Bep9JcSF.mjs} +128 -140
  92. package/dist/native-inputs-TRTTTRxt.mjs +91 -0
  93. package/dist/native-run-DY_RLx3C.mjs +277 -0
  94. package/dist/{native-runtime-k8dTIrbK.mjs → native-runtime-Dg1Q7tfF.mjs} +9 -8
  95. package/dist/{native-xcode-inputs-CykopJdM.mjs → native-xcode-inputs-CB2iQeWq.mjs} +27 -18
  96. package/dist/{native-xcode-ios-Bbf30Gm0.mjs → native-xcode-ios-CXX39F7o.mjs} +96 -47
  97. package/dist/{ndjson-GOnbyvso.mjs → ndjson-CgE_o3Dl.mjs} +3 -3
  98. package/dist/offload-worker.d.mts +1 -46
  99. package/dist/offload-worker.mjs +197 -66
  100. package/dist/{ownership-DCtw_2IA.mjs → ownership-DEmM5vhh.mjs} +3 -3
  101. package/dist/{page-DRHy329N.mjs → page-CPaHeYqj.mjs} +7 -4
  102. package/dist/paths-BsJMoPP2.mjs +12 -0
  103. package/dist/paths-DQtTgsBf.mjs +42 -0
  104. package/dist/{placement-log-MOfPVgaM.mjs → placement-log-BqGbTa61.mjs} +5 -5
  105. package/dist/{plan-placement-V0TdzYXp.mjs → plan-placement-Bwj-IjY1.mjs} +6 -6
  106. package/dist/{ports-DdSUicVo.mjs → ports-D-MmCTdv.mjs} +3 -3
  107. package/dist/prebuild-uD_ipCxF.mjs +449 -0
  108. package/dist/{project-_phNIJfs.mjs → project-BZNjmW_8.mjs} +65 -37
  109. package/dist/{pull-request-CQ8sPbZa.mjs → pull-request-Lfetn8Kr.mjs} +2 -2
  110. package/dist/pull-request-zjCSAryH.d.mts +120 -0
  111. package/dist/pull-requests.d.mts +1 -119
  112. package/dist/pull-requests.mjs +1 -1
  113. package/dist/{react-native-android-CM1XRDwv.mjs → react-native-android-DuzH0cn3.mjs} +74 -48
  114. package/dist/{gradle-DSrXb6lG.mjs → react-native-build-rhk4smwQ.mjs} +292 -15
  115. package/dist/react-native-doctor-CQpuIMso.mjs +234 -0
  116. package/dist/{react-native-ios-Dhq_eiYQ.mjs → react-native-ios-Bhq1rJeV.mjs} +46 -28
  117. package/dist/{recordings-D0d5aQt0.mjs → recordings-DYteQSu4.mjs} +12 -9
  118. package/dist/{reload-C8JhxjSh.mjs → reload-CmTRFJaX.mjs} +93 -47
  119. package/dist/reload-DzjSl5P_.mjs +2 -0
  120. package/dist/{remote-BiR6aYjy.mjs → remote-ByYkXdGD.mjs} +15 -10
  121. package/dist/result-DNiS-tTP.mjs +434 -0
  122. package/dist/{run-BtPgpKks.mjs → run-D23HmJMs.mjs} +4 -5
  123. package/dist/selection-CSl9i5qU.mjs +619 -0
  124. package/dist/{server-bare-R2m_gsH8.mjs → server-bare-CxTrvDg8.mjs} +3 -4
  125. package/dist/{server-command-CTtCkmcQ.mjs → server-command-CtzloH3v.mjs} +14 -7
  126. package/dist/server-expo-C-90EhcG.mjs +2 -0
  127. package/dist/{server-expo-DsguMGUF.mjs → server-expo-DT_F_uVI.mjs} +50 -9
  128. package/dist/{settings-B717odTD.mjs → settings-CsJDEXgK.mjs} +234 -24
  129. package/dist/{settings-vk3mJGSm.d.mts → settings-DkdmlelE.d.mts} +6 -4
  130. package/dist/settings-T1gtc3bf.mjs +114 -0
  131. package/dist/settings-write-HyVZ8eQ8.mjs +359 -0
  132. package/dist/settings.schema.json +163 -16
  133. package/dist/{simslim-CCr3rE-A.mjs → simslim-Cgk17SXV.mjs} +14 -12
  134. package/dist/{slot-launch-DPt0m9Nd.mjs → slot-launch-DF8VfT64.mjs} +15 -20
  135. package/dist/{spawn-entry-Dcb7sDUz.mjs → spawn-entry-jw19m8Nl.mjs} +0 -1
  136. package/dist/stage-BIS0ydsV.mjs +183 -0
  137. package/dist/{start-BWqzODpb.mjs → start-7lpH7hmN.mjs} +63 -44
  138. package/dist/{start-TXeMmmO2.mjs → start-RChynRDp.mjs} +1 -1
  139. package/dist/{state-D1Icyjlu.mjs → state-C4ZtUisW.mjs} +40 -13
  140. package/dist/{state-CG_OFoaA.mjs → state-XMziexv2.mjs} +3 -2
  141. package/dist/{stats-BoY5sEPU.mjs → stats-53T7OTb9.mjs} +7 -13
  142. package/dist/stats-report-BFfMpWWF.mjs +16 -0
  143. package/dist/{status-WgFbkRzj.mjs → status-BL7jVyAB.mjs} +535 -447
  144. package/dist/status-CSi6tlRq.mjs +2 -0
  145. package/dist/{status-BTA7kKiQ.mjs → status-DqEUSSxs.mjs} +6 -4
  146. package/dist/{status-watch-C23ILtf9.mjs → status-watch-GDCfqpTE.mjs} +187 -22
  147. package/dist/status-worker.d.mts +1 -0
  148. package/dist/status-worker.mjs +19 -0
  149. package/dist/stim-desktop-C12we7lz.mjs +112 -0
  150. package/dist/{stop-DR6VoDIk.mjs → stop-Bk_1qiV6.mjs} +2 -2
  151. package/dist/{stop-BNmBMi1F.mjs → stop-CPzlM1L-.mjs} +138 -98
  152. package/dist/{stop-DPEhunlw.mjs → stop-D7h6jAXQ.mjs} +11 -10
  153. package/dist/supervisor-run.d.mts +8 -17
  154. package/dist/supervisor-run.mjs +63 -27
  155. package/dist/{support-DMTqj3Hm.mjs → support-67vraa1Q.mjs} +18 -11
  156. package/dist/{support-CwjbFs9H.mjs → support-Dlu37g6H.mjs} +12 -12
  157. package/dist/{swiftpm-macos-DRNVJWlb.mjs → swiftpm-macos-p8WZbxKU.mjs} +35 -24
  158. package/dist/toolchain-DhKwp9iI.mjs +2 -0
  159. package/dist/toolchain-Hp9sCpK4.mjs +873 -0
  160. package/dist/{trigger-CigAYjeL.mjs → trigger-BAahxUPq.mjs} +20 -5
  161. package/dist/trigger-Bf3uDcpv.mjs +2 -0
  162. package/dist/{warm-progress-BuY-Fvfn.mjs → warm-progress-BHX5r0Ei.mjs} +250 -156
  163. package/dist/{web-BDBMxDpx.mjs → web-CJmIj6AI.mjs} +18 -13
  164. package/dist/web-DknQETPs.mjs +2 -0
  165. package/dist/web-run.mjs +11 -12
  166. package/dist/windows-report.d.mts +1 -0
  167. package/dist/windows-report.mjs +18 -0
  168. package/dist/windows-report.ps1 +43 -0
  169. package/dist/workspace-process-lock-1_1OoVW5.mjs +57 -0
  170. package/dist/{workspace-state-DJt_MMvf.mjs → workspace-state-Cjuigeeu.mjs} +62 -58
  171. package/dist/{workspaces-C36s2jb9.mjs → workspaces-BccMFmGQ.mjs} +1188 -1079
  172. package/dist/worktree-CK2MpJW5.mjs +2 -0
  173. package/dist/{worktree-CgvJYJ-Q.mjs → worktree-DQ6Zi2Mv.mjs} +304 -53
  174. package/dist/xcode-Zlx3qjEs.mjs +896 -0
  175. package/package.json +7 -5
  176. package/shim/android-optimizations.gradle +7 -5
  177. package/dist/activity-BSV745Kz.mjs +0 -629
  178. package/dist/api-qvOzWyfO.mjs +0 -154
  179. package/dist/api-run.mjs +0 -294
  180. package/dist/app-install-BIKtMfPq.mjs +0 -896
  181. package/dist/artifact-lifecycle-DzPpBYvK.mjs +0 -30
  182. package/dist/budget-f7516Zk0.mjs +0 -4106
  183. package/dist/build-facts-DcLv2HSd.d.mts +0 -111
  184. package/dist/cancellation-C_22VQTH.mjs +0 -24
  185. package/dist/client-qQAaXSUs.mjs +0 -1771
  186. package/dist/config-BYDxlMY3.mjs +0 -562
  187. package/dist/device-DuiPJQSn.mjs +0 -290
  188. package/dist/device-lease-BX1sJQ2E.mjs +0 -1224
  189. package/dist/device-remote-xRT0Vmo9.mjs +0 -1272
  190. package/dist/eas-session-ledger-Cm0Gwq2F.mjs +0 -207
  191. package/dist/exec-DqKo9GKJ.mjs +0 -268
  192. package/dist/git-DDfFzkMm.mjs +0 -45
  193. package/dist/launch-verify-B6Q8hZP-.mjs +0 -428
  194. package/dist/logs-BGrEUaEs.mjs +0 -383
  195. package/dist/miss-reason-mKzZ4VvN.mjs +0 -238
  196. package/dist/native-android-D5qc3-_v.mjs +0 -226
  197. package/dist/ndjson-Du3j0AQ9.d.mts +0 -17
  198. package/dist/plan-C4TjdPsR.mjs +0 -260
  199. package/dist/prebuild-DYbucPXy.mjs +0 -212
  200. package/dist/preview-78a9kR_-.mjs +0 -1011
  201. package/dist/react-native-build-CtCccJtb.mjs +0 -239
  202. package/dist/react-native-doctor-CfRnFfjs.mjs +0 -78
  203. package/dist/remote-cache-OyOyVIS3.mjs +0 -526
  204. package/dist/result-CaJg5Iat.mjs +0 -186
  205. package/dist/server-expo-Bigriskl.mjs +0 -2
  206. package/dist/settings-BORNaaCO.mjs +0 -402
  207. package/dist/spawn-claims-DVS5RkMS.mjs +0 -72
  208. package/dist/stage-KNTQopqv.mjs +0 -157
  209. package/dist/stim-desktop-BzBN2Em2.mjs +0 -63
  210. package/dist/tailnet-Dh-qiYzG.mjs +0 -265
  211. package/dist/toolchain-BFkAcstd.mjs +0 -2
  212. package/dist/toolchain-DxSsNssu.mjs +0 -1657
  213. package/dist/trigger-9_USgmxz.mjs +0 -2
  214. package/dist/web-Dq-i3wzJ.mjs +0 -2
  215. package/dist/worktree-DpLdCHga.mjs +0 -2
  216. package/dist/{api-run.d.mts → doctor-fingerprint.d.mts} +0 -0
  217. package/dist/{errors-DzkMYh8Q.mjs → errors-ccaPc4ox.mjs} +2 -2
@@ -1,13 +1,13 @@
1
- import { t as getExecutor } from "./exec-DqKo9GKJ.mjs";
2
- import { K as resolveProjectSettings } from "./settings-B717odTD.mjs";
1
+ import { t as getExecutor } from "./exec-_UbtCQcG.mjs";
3
2
  import { n as stripAnsi, t as createLineReader } from "./process-output-Fpl8PYi8.mjs";
4
- import { S as resolvePackageJson } from "./project-_phNIJfs.mjs";
5
- import { t as cancellableSleep } from "./cancellation-C_22VQTH.mjs";
6
- import { r as createNdjsonWriter } from "./ndjson-GOnbyvso.mjs";
7
- import { a as expoMetroStoreEnv, c as registerMetroStore, f as resolveMetroSharedCache, i as expoMetroConfigPath, n as supervisorError, o as metroStoreConfirmedRoot, s as metroStoreRoot } from "./errors-DzkMYh8Q.mjs";
3
+ import { Qt as cancellableSleep, q as resolveProjectSettings } from "./settings-CsJDEXgK.mjs";
4
+ import { C as resolvePackageJson } from "./project-BZNjmW_8.mjs";
5
+ import { r as createNdjsonWriter } from "./ndjson-CgE_o3Dl.mjs";
6
+ import { a as expoMetroStoreEnv, c as registerMetroStore, f as resolveMetroSharedCache, i as expoMetroConfigPath, n as supervisorError, o as metroStoreConfirmedRoot, s as metroStoreRoot } from "./errors-ccaPc4ox.mjs";
8
7
  import { accessSync, constants, existsSync, readFileSync } from "node:fs";
9
- import { dirname, join } from "node:path";
8
+ import { delimiter, dirname, join } from "node:path";
10
9
  import { LOG_ROTATE_BYTES } from "@stim-cli/core";
10
+ import { projectNodeBin, satisfiesNodePin } from "@stim-cli/core/toolchain";
11
11
  //#region src/supervisor/child-server.ts
12
12
  function superviseChildServer({ mode, child, log, toRecord, signal, alive = null, killTimeoutMs, onRecord = null }) {
13
13
  let lastMsg = null;
@@ -83,6 +83,40 @@ function superviseChildServer({ mode, child, log, toRecord, signal, alive = null
83
83
  };
84
84
  }
85
85
  //#endregion
86
+ //#region src/supervisor/project-node.ts
87
+ function pathNodeVersion(env) {
88
+ const childEnv = {};
89
+ for (const [key, value] of Object.entries(env)) if (value !== void 0) childEnv[key] = value;
90
+ return getExecutor().runFileQuiet("node", ["-p", "process.versions.node"], {
91
+ timeoutMs: 5e3,
92
+ env: childEnv
93
+ });
94
+ }
95
+ /**
96
+ * `env` with the Node that `root` pins (`.nvmrc`, `.node-version`, `.tool-versions` or Volta) first on `PATH`,
97
+ * for the dev server Stim starts through its `#!/usr/bin/env node` script. It changes nothing when the project pins
98
+ * no Node, when no installed Node satisfies the pin, or when the `node` already on `PATH` satisfies it.
99
+ */
100
+ function withProjectNode(root, env, { nodeVersion = pathNodeVersion } = {}) {
101
+ const pinned = projectNodeBin(root, env);
102
+ if (!pinned) return {
103
+ env,
104
+ pinned: null
105
+ };
106
+ const current = nodeVersion(env);
107
+ if (current && satisfiesNodePin(current, pinned.spec)) return {
108
+ env,
109
+ pinned: null
110
+ };
111
+ return {
112
+ env: {
113
+ ...env,
114
+ PATH: [pinned.bin, ...(env.PATH ?? "").split(delimiter).filter(Boolean)].join(delimiter)
115
+ },
116
+ pinned
117
+ };
118
+ }
119
+ //#endregion
86
120
  //#region src/supervisor/server-expo.ts
87
121
  function resolveExpoBin(root) {
88
122
  const fromPackage = expoBinFromPackage(resolvePackageJson(root, "expo"));
@@ -294,6 +328,13 @@ async function startExpoServer({ root, port, logsDir, writer = null, spawnFn = n
294
328
  settings: settings ?? resolveProjectSettings(root).settings
295
329
  });
296
330
  const [command, commandArgs] = platform === "win32" && resolved.source === "package" ? [process.execPath, [bin, ...args]] : [bin, args];
331
+ const node = withProjectNode(root, process.env);
332
+ if (node.pinned) log.write({
333
+ src: "metro",
334
+ level: "info",
335
+ event: "project_node",
336
+ msg: `Metro runs on Node ${node.pinned.version} from ${node.pinned.bin}, which ${node.pinned.pin} pins`
337
+ });
297
338
  const child = spawn(command, commandArgs, {
298
339
  cwd: root,
299
340
  stdio: [
@@ -303,7 +344,7 @@ async function startExpoServer({ root, port, logsDir, writer = null, spawnFn = n
303
344
  ],
304
345
  detached: false,
305
346
  env: {
306
- ...process.env,
347
+ ...node.env,
307
348
  FORCE_COLOR: "0",
308
349
  ...expoProxyEnv(process.env),
309
350
  ...storeEnv,
@@ -329,4 +370,4 @@ async function startExpoServer({ root, port, logsDir, writer = null, spawnFn = n
329
370
  });
330
371
  }
331
372
  //#endregion
332
- export { expoProxyEnv as a, inferLevel as c, parseExpoWaitingOnUrl as d, recordFromLine as f, expoBinRefusal as i, isBundleMarker as l, superviseChildServer as m, expoBinFromPackage as n, expoSdkMajor as o, startExpoServer as p, expoBinPath as r, findBinUpward as s, cleanLine as t, isDevClientNavigationNotice as u };
373
+ export { expoProxyEnv as a, inferLevel as c, parseExpoWaitingOnUrl as d, recordFromLine as f, superviseChildServer as h, expoBinRefusal as i, isBundleMarker as l, withProjectNode as m, expoBinFromPackage as n, expoSdkMajor as o, startExpoServer as p, expoBinPath as r, findBinUpward as s, cleanLine as t, isDevClientNavigationNotice as u };
@@ -1,13 +1,36 @@
1
- import { _ as loadConfig$1, d as getConfigDir, f as getConfigPath$1, h as getRepoSettings, m as getProjectSettings } from "./config-BYDxlMY3.mjs";
2
- import { n as isTimeoutError, t as getExecutor } from "./exec-DqKo9GKJ.mjs";
3
- import { r as gitQuiet, t as git } from "./git-DDfFzkMm.mjs";
1
+ import { n as isTimeoutError, t as getExecutor } from "./exec-_UbtCQcG.mjs";
2
+ import { _ as loadConfig$1, d as getConfigDir, f as getConfigPath$1, h as getRepoSettings, m as getProjectSettings } from "./config-CYcBF478.mjs";
3
+ import { i as gitQuietAsync, n as gitAsync, r as gitQuiet, t as git } from "./git-C3iTsJaZ.mjs";
4
4
  import { accessSync, chmodSync, constants, lstatSync, mkdirSync, mkdtempSync, readdirSync, realpathSync, rmSync, statSync } from "node:fs";
5
+ import { tmpdir } from "node:os";
5
6
  import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
6
- import { dirname as dirname$1, isAbsolute as isAbsolute$1, join as join$1, normalize, relative as relative$1, resolve as resolve$1, sep as sep$1 } from "path";
7
+ import { ambientEnv, buildCacheRoot } from "@stim-cli/core";
7
8
  import { REMOTE_DEVICE_BACKENDS, SETTINGS, SETTING_GROUPS, TUNNEL_MODES, WEB_VIEWPORTS, acceptsShape, coerceSettingText, expectedShape, isLayeredSetting, settingDefinition, settingValueError } from "@stim-cli/core/state";
9
+ import { dirname as dirname$1, isAbsolute as isAbsolute$1, join as join$1, normalize, relative as relative$1, resolve as resolve$1, sep as sep$1 } from "path";
8
10
  import { chmodSync as chmodSync$1, existsSync as existsSync$1, lstatSync as lstatSync$1, mkdirSync as mkdirSync$1, readFileSync as readFileSync$1, readdirSync as readdirSync$1, realpathSync as realpathSync$1, statSync as statSync$1, utimesSync as utimesSync$1 } from "fs";
9
- import { buildCacheRoot } from "@stim-cli/core";
10
- import { tmpdir } from "node:os";
11
+ //#region src/cancellation.ts
12
+ function cancelledError(what, cause) {
13
+ return Object.assign(new Error(`The ${what} was cancelled.`, cause === void 0 ? void 0 : { cause }), { code: "STIM_CANCELLED" });
14
+ }
15
+ function throwIfCancelled(signal, what) {
16
+ if (signal?.aborted) throw cancelledError(what);
17
+ }
18
+ function cancellableSleep(ms, { signal, what = "wait", ref = true } = {}) {
19
+ return new Promise((resolve, reject) => {
20
+ if (signal?.aborted) return reject(cancelledError(what));
21
+ const onAbort = () => {
22
+ clearTimeout(timer);
23
+ reject(cancelledError(what));
24
+ };
25
+ const timer = setTimeout(() => {
26
+ signal?.removeEventListener("abort", onAbort);
27
+ resolve();
28
+ }, ms);
29
+ if (!ref) timer.unref();
30
+ signal?.addEventListener("abort", onAbort, { once: true });
31
+ });
32
+ }
33
+ //#endregion
11
34
  //#region src/temporary.ts
12
35
  function existingPath(path) {
13
36
  const missing = [];
@@ -41,7 +64,7 @@ function inside(parent, path) {
41
64
  function temporaryRoot(near) {
42
65
  const reference = existingPath(near);
43
66
  const insideReference = (path) => inside(reference.resolved, path);
44
- const override = process.env.STIM_TMPDIR ?? loadConfig$1()?.tempDir;
67
+ const override = ambientEnv().STIM_TMPDIR ?? loadConfig$1()?.tempDir;
45
68
  if (override !== void 0) {
46
69
  if (typeof override !== "string" || !isAbsolute(override)) throw new Error("STIM_TMPDIR / tempDir must be an absolute directory path.");
47
70
  const { existing, resolved } = existingPath(override);
@@ -89,12 +112,41 @@ function removeTemporaryEntry(path) {
89
112
  });
90
113
  }
91
114
  //#endregion
115
+ //#region src/workspace/git-read.ts
116
+ function childEnvironment(env) {
117
+ return {
118
+ env: Object.fromEntries(Object.entries(env).flatMap(([name, value]) => value === void 0 ? [] : [[name, value]])),
119
+ omitEnv: Object.keys(process.env).filter((name) => env[name] === void 0)
120
+ };
121
+ }
122
+ function killOnAbort(signal) {
123
+ return (child) => {
124
+ if (!signal || getExecutor().reportSignal?.()) return;
125
+ if (signal.aborted) return void child.kill("SIGKILL");
126
+ const kill = () => child.kill("SIGKILL");
127
+ signal.addEventListener("abort", kill, { once: true });
128
+ child.once("close", () => signal.removeEventListener("abort", kill));
129
+ };
130
+ }
131
+ /** `git rev-parse <args>` in `cwd` as a native path, or null; Git runs with exactly `env` and dies when `signal` aborts. */
132
+ function gitPath(cwd, args, env, signal) {
133
+ return gitAsync(cwd, ["rev-parse", ...args], {
134
+ ...childEnvironment(env),
135
+ signal
136
+ }).then((out) => {
137
+ const path = out.trim();
138
+ if (!path) return null;
139
+ return sep === "/" ? path : path.replaceAll("/", sep);
140
+ }, () => null);
141
+ }
142
+ //#endregion
92
143
  //#region src/workspace/worktree.ts
93
144
  const CARRY_SKIP_BASENAMES = /* @__PURE__ */ new Set([
94
145
  ".DerivedData",
95
146
  ".DS_Store",
96
147
  ".idea",
97
- ".jj"
148
+ ".jj",
149
+ ".pnpm-store"
98
150
  ]);
99
151
  function isCarrySkipped(rel) {
100
152
  return /(^|\/)android\/build\/generated\/autolinking(\/|$)/.test(rel) || String(rel).split("/").some((seg) => CARRY_SKIP_BASENAMES.has(seg));
@@ -113,32 +165,68 @@ function gitCommonDir(cwd, opts = {}) {
113
165
  ], opts);
114
166
  return out ? nativePath(out.trim()) : null;
115
167
  }
168
+ async function gitCommonDirAsync(cwd, { env, signal } = {}) {
169
+ const out = await gitQuietAsync(cwd, [
170
+ "rev-parse",
171
+ "--path-format=absolute",
172
+ "--git-common-dir"
173
+ ], {
174
+ ...env ? childEnvironment(env) : {},
175
+ signal
176
+ });
177
+ return out ? nativePath(out.trim()) : null;
178
+ }
116
179
  function repoRoot(cwd) {
117
180
  const out = gitQuiet(cwd, ["rev-parse", "--show-toplevel"]);
118
181
  return out ? nativePath(out.trim()) : null;
119
182
  }
183
+ async function repoRootAsync(cwd, { env, signal } = {}) {
184
+ const out = await gitQuietAsync(cwd, ["rev-parse", "--show-toplevel"], {
185
+ ...env ? childEnvironment(env) : {},
186
+ signal,
187
+ killSignal: "SIGKILL"
188
+ });
189
+ return out ? nativePath(out.trim()) : null;
190
+ }
191
+ function upstreamState(name, counts) {
192
+ const [ahead = NaN, behind = NaN] = counts.trim().split(/\s+/).map(Number);
193
+ if (!name || !Number.isInteger(ahead) || !Number.isInteger(behind)) return null;
194
+ return {
195
+ name,
196
+ ahead,
197
+ behind
198
+ };
199
+ }
120
200
  function locallyKnownUpstream(projectRoot) {
121
201
  try {
122
- const name = git(projectRoot, [
202
+ return upstreamState(git(projectRoot, [
123
203
  "rev-parse",
124
204
  "--abbrev-ref",
125
205
  "--symbolic-full-name",
126
206
  "@{upstream}"
127
- ], { timeoutMs: 5e3 });
128
- const counts = git(projectRoot, [
207
+ ], { timeoutMs: 5e3 }), git(projectRoot, [
129
208
  "rev-list",
130
209
  "--left-right",
131
210
  "--count",
132
211
  "HEAD...@{upstream}"
133
- ], { timeoutMs: 5e3 }).trim().split(/\s+/).map(Number);
134
- const ahead = counts[0] ?? NaN;
135
- const behind = counts[1] ?? NaN;
136
- if (!name || !Number.isInteger(ahead) || !Number.isInteger(behind)) return null;
137
- return {
138
- name,
139
- ahead,
140
- behind
141
- };
212
+ ], { timeoutMs: 5e3 }));
213
+ } catch {
214
+ return null;
215
+ }
216
+ }
217
+ async function locallyKnownUpstreamAsync(projectRoot) {
218
+ try {
219
+ return upstreamState(await gitAsync(projectRoot, [
220
+ "rev-parse",
221
+ "--abbrev-ref",
222
+ "--symbolic-full-name",
223
+ "@{upstream}"
224
+ ], { timeoutMs: 5e3 }), await gitAsync(projectRoot, [
225
+ "rev-list",
226
+ "--left-right",
227
+ "--count",
228
+ "HEAD...@{upstream}"
229
+ ], { timeoutMs: 5e3 }));
142
230
  } catch {
143
231
  return null;
144
232
  }
@@ -452,8 +540,8 @@ const FINGERPRINT_INPUT_FILES = [
452
540
  "app.config.mjs",
453
541
  "package.json"
454
542
  ];
455
- function dirtyFingerprintFiles(root) {
456
- const out = gitQuiet(root, [
543
+ async function dirtyFingerprintFiles(root) {
544
+ const out = await gitQuietAsync(root, [
457
545
  "status",
458
546
  "--porcelain",
459
547
  "--",
@@ -475,17 +563,38 @@ function removalCheck(dir, args) {
475
563
  return null;
476
564
  }
477
565
  }
566
+ async function removalCheckAsync(dir, args) {
567
+ try {
568
+ return await gitAsync(dir, args, {
569
+ timeoutMs: REMOVAL_CHECK_TIMEOUT_MS,
570
+ killSignal: "SIGKILL"
571
+ });
572
+ } catch (error) {
573
+ if (isTimeoutError(error)) throw error;
574
+ return null;
575
+ }
576
+ }
478
577
  function hasUncommittedWork(dir) {
479
578
  const out = removalCheck(dir, ["status", "--porcelain"]);
480
579
  if (out === null) return null;
481
580
  return out.trim().length > 0;
482
581
  }
582
+ async function hasUncommittedWorkAsync(dir) {
583
+ const out = await removalCheckAsync(dir, ["status", "--porcelain"]);
584
+ if (out === null) return null;
585
+ return out.trim().length > 0;
586
+ }
483
587
  /** The porcelain status lines, or null when git cannot answer; throws when git times out. */
484
588
  function dirtyPaths(dir, { limit = 10 } = {}) {
485
589
  const out = removalCheck(dir, ["status", "--porcelain"]);
486
590
  if (out === null) return null;
487
591
  return out.split("\n").map((l) => normalizePorcelainLine(l.trimEnd())).filter(Boolean).slice(0, limit);
488
592
  }
593
+ async function dirtyPathsAsync(dir, { limit = 10 } = {}) {
594
+ const out = await removalCheckAsync(dir, ["status", "--porcelain"]);
595
+ if (out === null) return null;
596
+ return out.split("\n").map((line) => normalizePorcelainLine(line.trimEnd())).filter(Boolean).slice(0, limit);
597
+ }
489
598
  function normalizePorcelainLine(line) {
490
599
  if (line === "" || line[2] === " ") return line;
491
600
  return ` ${line}`;
@@ -530,6 +639,34 @@ function unpushedCommits(dir) {
530
639
  if (out === null) return null;
531
640
  return out.split("\n").map((l) => l.trim()).filter(Boolean);
532
641
  }
642
+ async function unpushedCommitsAsync(dir) {
643
+ const branch = await removalCheckAsync(dir, [
644
+ "symbolic-ref",
645
+ "--quiet",
646
+ "--short",
647
+ "HEAD"
648
+ ]);
649
+ const own = branch === null ? "" : branch.trim();
650
+ const protection = own && SAFE_BRANCH_NAME.test(own) ? [
651
+ "--remotes",
652
+ `--exclude=${own}`,
653
+ "--branches"
654
+ ] : ["--remotes"];
655
+ if (!own && await removalCheckAsync(dir, [
656
+ "rev-parse",
657
+ "--abbrev-ref",
658
+ "HEAD"
659
+ ]) === "HEAD") protection.push("--branches");
660
+ const out = await removalCheckAsync(dir, [
661
+ "log",
662
+ "--oneline",
663
+ "HEAD",
664
+ "--not",
665
+ ...protection
666
+ ]);
667
+ if (out === null) return null;
668
+ return out.split("\n").map((line) => line.trim()).filter(Boolean);
669
+ }
533
670
  function hasRemote(dir) {
534
671
  const out = gitQuiet(dir, ["remote"]);
535
672
  return Boolean(out && out.trim().length > 0);
@@ -553,6 +690,16 @@ function resolveFullRef(cwd, ref, opts = {}) {
553
690
  ], opts);
554
691
  return out && out.trim() ? out.trim() : null;
555
692
  }
693
+ async function resolveFullRefAsync(cwd, ref) {
694
+ const out = await gitQuietAsync(cwd, [
695
+ "rev-parse",
696
+ "--verify",
697
+ "--quiet",
698
+ "--end-of-options",
699
+ `${ref}^{commit}`
700
+ ], { killSignal: "SIGKILL" });
701
+ return out && out.trim() ? out.trim() : null;
702
+ }
556
703
  function removeWorktree(path, { from, force = false, platform = process.platform }) {
557
704
  const args = [
558
705
  ...platform === "win32" ? ["-c", "core.longpaths=true"] : [],
@@ -605,6 +752,21 @@ function hasPopulatedSubmodules(worktree) {
605
752
  if (staged === null) return null;
606
753
  return staged.split("\0").some((line) => line.startsWith("160000 ") && existsSync$1(join$1(worktree, line.slice(line.indexOf(" ") + 1), ".git")));
607
754
  }
755
+ async function hasPopulatedSubmodulesAsync(worktree) {
756
+ const modules = await removalCheckAsync(worktree, [
757
+ "rev-parse",
758
+ "--git-path",
759
+ "modules"
760
+ ]);
761
+ if (modules && existsSync$1(resolve$1(worktree, nativePath(modules)))) return true;
762
+ const staged = await removalCheckAsync(worktree, [
763
+ "ls-files",
764
+ "--stage",
765
+ "-z"
766
+ ]);
767
+ if (staged === null) return null;
768
+ return staged.split("\0").some((line) => line.startsWith("160000 ") && existsSync$1(join$1(worktree, line.slice(line.indexOf(" ") + 1), ".git")));
769
+ }
608
770
  function listWorktrees(cwd, opts = {}) {
609
771
  const out = gitRead(cwd, [
610
772
  "worktree",
@@ -613,6 +775,14 @@ function listWorktrees(cwd, opts = {}) {
613
775
  ], opts);
614
776
  return out ? parseWorktrees(out) : [];
615
777
  }
778
+ async function listWorktreesAsync(cwd) {
779
+ const out = await gitQuietAsync(cwd, [
780
+ "worktree",
781
+ "list",
782
+ "--porcelain"
783
+ ], { killSignal: "SIGKILL" });
784
+ return out ? parseWorktrees(out) : [];
785
+ }
616
786
  function branchOf(head) {
617
787
  return head.startsWith("ref: refs/heads/") ? head.slice(16) : void 0;
618
788
  }
@@ -706,6 +876,19 @@ function resolveSourceCheckout(cwd) {
706
876
  ...sourceCheckoutOf(entries)
707
877
  };
708
878
  }
879
+ async function resolveSourceCheckoutAsync(cwd) {
880
+ const entries = await listWorktreesAsync(cwd);
881
+ const first = entries[0];
882
+ const head = first?.bare ? (await gitQuietAsync(first.path, [
883
+ "symbolic-ref",
884
+ "--quiet",
885
+ "HEAD"
886
+ ], { killSignal: "SIGKILL" }))?.trim() : null;
887
+ return {
888
+ entries,
889
+ ...selectSourceCheckout(entries, head?.startsWith("refs/heads/") ? head.slice(11) : null)
890
+ };
891
+ }
709
892
  //#endregion
710
893
  //#region src/engine/metro-reach.ts
711
894
  const PUBLIC_METRO_ENV = "STIM_METRO_PUBLIC_URL";
@@ -1286,6 +1469,33 @@ function resolveProjectSettings(root) {
1286
1469
  settings: resolveSettings(context)
1287
1470
  };
1288
1471
  }
1472
+ /** Resolves repository paths without blocking; cancellation rejects instead of using non-Git settings. */
1473
+ async function projectSettingsContextAsync(root, git = {
1474
+ gitCommonDir: gitCommonDirAsync,
1475
+ repoRoot: repoRootAsync
1476
+ }, { env = process.env, signal } = {}) {
1477
+ throwIfCancelled(signal, "settings resolution");
1478
+ const [gitCommonDir, repoRoot] = await Promise.all([git.gitCommonDir(root, {
1479
+ env,
1480
+ signal
1481
+ }), git.repoRoot(root, {
1482
+ env,
1483
+ signal
1484
+ })]);
1485
+ throwIfCancelled(signal, "settings resolution");
1486
+ return {
1487
+ projectPath: root,
1488
+ gitCommonDir,
1489
+ repoRoot
1490
+ };
1491
+ }
1492
+ async function resolveProjectSettingsAsync(root, options) {
1493
+ const context = await projectSettingsContextAsync(root, void 0, options);
1494
+ return {
1495
+ context,
1496
+ settings: resolveSettings(context)
1497
+ };
1498
+ }
1289
1499
  const METRO_COMMAND_PORT = "{port}";
1290
1500
  function metroCommandSetting(settings) {
1291
1501
  const value = settingValueAt(settings, "metro.command");
@@ -1348,7 +1558,7 @@ function cacheProviderSettingError(settings) {
1348
1558
  if ("options" in block && !isPlainObject(block.options)) return `Invalid cache.options setting ${JSON.stringify(block.options)}. Expected an object.`;
1349
1559
  return null;
1350
1560
  }
1351
- /** The remote target `remote` names, or null for `local`, which runs on this Mac whatever a lower layer sets. */
1561
+ /** The remote target `remote` names, or null for `local`, which runs on this machine whatever a lower layer sets. */
1352
1562
  function parseIosRemote(remote) {
1353
1563
  const selected = remote.trim();
1354
1564
  const reserved = selected.toLowerCase();
@@ -1459,4 +1669,4 @@ function webSettings(settings) {
1459
1669
  };
1460
1670
  }
1461
1671
  //#endregion
1462
- export { settingValueAt as $, metroIdleStopMinutesSetting as A, restoreFile as At, remoteAndroidSetting as B, iosSigningIdentitySha1Setting as C, locallyKnownUpstream as Ct, mergeSettingsLayers as D, repoRoot as Dt, maintenanceKeepSetting as E, removeWorktree as Et, parseIosRemote as F, makeTemporaryDirectory as Ft, resolveIosProjectDir as G, remoteIosSetting as H, projectSettingsContext as I, removeTemporaryEntry as It, runnableMetroCommand as J, resolveProjectSettings as K, publicUrlSetting as L, temporaryRoot as Lt, metroTunnelSettingError as M, unpushedCommits as Mt, metroWarmupUrlSetting as N, warmWorktreePaths as Nt, metroCommandSetting as O, resolveFullRef as Ot, ngrokUrlSetting as P, filesystemDevice as Pt, settingShapeErrors as Q, readCommittedSettings as R, iosSigningIdentitySettingError as S, listWorktrees as St, iosSimSlimProfileSetting as T, readWorktreeExclude as Tt, resolveAndroidLayout as U, remoteEasFallbackSetting as V, resolveCacheProviderConfig as W, settingOrigin as X, settingFile as Y, settingOriginScope as Z, iosLanHostSetting as _, hasPopulatedSubmodules as _t, SETTING_SHAPE_REMEDY as a, PUBLIC_METRO_ENV as at, iosProjectDirSettingError as b, isPodInstallChurn as bt, androidDataPartitionSizeBytes as c, resolveTailscaleBinary as ct, androidLayoutSetting as d, deleteBranch as dt, settingsLayers as et, androidLayoutSettingError as f, depsOutOfSync as ft, deviceReclaimIdleMinutesSetting as g, gitCommonDirOnDisk as gt, deviceIdleShutdownMinutesSetting as h, gitCommonDir as ht, SETTINGS_WITH_RESOLVE_TIME_FALLBACK as i, workspaceHiddenSetting as it, metroPortSetting as j, sourceCheckoutOf as jt, metroCommandSettingError as k, resolveSourceCheckout as kt, androidDataPartitionSizeGbSetting as l, branchExists as lt, defaultAndroidLayout as m, dirtyPaths as mt, METRO_COMMAND_PORT as n, unknownSettingKeys as nt, androidAvdConfigSetting as o, detectProviders as ot, cacheProviderSettingError as p, dirtyFingerprintFiles as pt, resolveSettings as q, PATH_SETTINGS as r, webSettings as rt, androidAvdConfigSettingError as s, planMetroReach as st, ANDROID_AVD_CONFIG_HELP as t, tunnelModeSetting as tt, androidDataPartitionSizeGbSettingError as u, cloneIgnoredEntries as ut, iosLanHostSettingError as v, hasRemote as vt, iosSigningIdentitySha1SettingError as w, podsOutOfSync as wt, iosSigningIdentitySetting as x, linkedWorktreesOnDisk as xt, iosProjectDirSetting as y, hasUncommittedWork as yt, realpathInside as z };
1672
+ export { settingOriginScope as $, cancelledError as $t, metroIdleStopMinutesSetting as A, locallyKnownUpstream as At, realpathInside as B, restoreFile as Bt, iosSigningIdentitySha1Setting as C, hasRemote as Ct, mergeSettingsLayers as D, linkedWorktreesOnDisk as Dt, maintenanceKeepSetting as E, isPodInstallChurn as Et, parseIosRemote as F, repoRoot as Ft, resolveCacheProviderConfig as G, childEnvironment as Gt, remoteEasFallbackSetting as H, unpushedCommits as Ht, projectSettingsContext as I, repoRootAsync as It, resolveProjectSettingsAsync as J, filesystemDevice as Jt, resolveIosProjectDir as K, gitPath as Kt, projectSettingsContextAsync as L, resolveFullRef as Lt, metroTunnelSettingError as M, podsOutOfSync as Mt, metroWarmupUrlSetting as N, readWorktreeExclude as Nt, metroCommandSetting as O, listWorktrees as Ot, ngrokUrlSetting as P, removeWorktree as Pt, settingOrigin as Q, cancellableSleep as Qt, publicUrlSetting as R, resolveFullRefAsync as Rt, iosSigningIdentitySettingError as S, hasPopulatedSubmodulesAsync as St, iosSimSlimProfileSetting as T, hasUncommittedWorkAsync as Tt, remoteIosSetting as U, unpushedCommitsAsync as Ut, remoteAndroidSetting as V, sourceCheckoutOf as Vt, resolveAndroidLayout as W, warmWorktreePaths as Wt, runnableMetroCommand as X, removeTemporaryEntry as Xt, resolveSettings as Y, makeTemporaryDirectory as Yt, settingFile as Z, temporaryRoot as Zt, iosLanHostSetting as _, dirtyPathsAsync as _t, SETTING_SHAPE_REMEDY as a, webSettings as at, iosProjectDirSettingError as b, gitCommonDirOnDisk as bt, androidDataPartitionSizeBytes as c, detectProviders as ct, androidLayoutSetting as d, branchExists as dt, throwIfCancelled as en, settingShapeErrors as et, androidLayoutSettingError as f, cloneIgnoredEntries as ft, deviceReclaimIdleMinutesSetting as g, dirtyPaths as gt, deviceIdleShutdownMinutesSetting as h, dirtyFingerprintFiles as ht, SETTINGS_WITH_RESOLVE_TIME_FALLBACK as i, unknownSettingKeys as it, metroPortSetting as j, locallyKnownUpstreamAsync as jt, metroCommandSettingError as k, listWorktreesAsync as kt, androidDataPartitionSizeGbSetting as l, planMetroReach as lt, defaultAndroidLayout as m, depsOutOfSync as mt, METRO_COMMAND_PORT as n, settingsLayers as nt, androidAvdConfigSetting as o, workspaceHiddenSetting as ot, cacheProviderSettingError as p, deleteBranch as pt, resolveProjectSettings as q, killOnAbort as qt, PATH_SETTINGS as r, tunnelModeSetting as rt, androidAvdConfigSettingError as s, PUBLIC_METRO_ENV as st, ANDROID_AVD_CONFIG_HELP as t, settingValueAt as tt, androidDataPartitionSizeGbSettingError as u, resolveTailscaleBinary as ut, iosLanHostSettingError as v, gitCommonDir as vt, iosSigningIdentitySha1SettingError as w, hasUncommittedWork as wt, iosSigningIdentitySetting as x, hasPopulatedSubmodules as xt, iosProjectDirSetting as y, gitCommonDirAsync as yt, readCommittedSettings as z, resolveSourceCheckoutAsync as zt };
@@ -1,13 +1,15 @@
1
- import "./ndjson-Du3j0AQ9.mjs";
2
- import { SettingsObject, WebViewport } from "@stim-cli/core/state";
3
- import "@stim-cli/cache";
1
+ import "./exec-H20xSg2T.mjs";
2
+ import { StimContext } from "@stim-cli/core";
3
+ import { SettingScope, SettingsObject, WebViewport } from "@stim-cli/core/state";
4
4
  import { ProcessRecord } from "@stim-cli/core/process-identity";
5
+ import "@stim-cli/cache";
5
6
  //#region src/supervisor/state.d.ts
6
7
  declare const MODE_BARE = "bare-inproc";
7
8
  declare const MODE_EXPO = "expo-child";
9
+ type WorkspaceLaunchPlatform = "ios" | "android";
8
10
  declare function clearWorkspaceSupervisor(root: string, expected?: ProcessRecord | null): boolean;
9
11
  declare function clearExpoMetroTunnel(root: string): void;
10
12
  declare function writePidFile(root: string, pid: number): string;
11
13
  declare function readPidFile(root: string): number | null;
12
14
  //#endregion
13
- export { clearWorkspaceSupervisor as a, clearExpoMetroTunnel as i, MODE_BARE as n, readPidFile as o, MODE_EXPO as r, writePidFile as s, SettingsObject as t };
15
+ export { clearExpoMetroTunnel as a, writePidFile as c, WorkspaceLaunchPlatform as i, MODE_BARE as n, clearWorkspaceSupervisor as o, MODE_EXPO as r, readPidFile as s, SettingsObject as t };
@@ -0,0 +1,114 @@
1
+ import { a as layerFile, c as settingEntry, i as SettingsRefusal, n as readScope, o as readSettingsContext, r as requireSetting, s as readSettingsPayload, t as mutateSetting } from "./settings-write-HyVZ8eQ8.mjs";
2
+ import { SETTING_SCOPES } from "@stim-cli/core/state";
3
+ import chalk from "chalk";
4
+ //#region src/commands/settings.ts
5
+ function formatValue(value) {
6
+ return typeof value === "string" ? value : JSON.stringify(value);
7
+ }
8
+ function formatOrigin(entry) {
9
+ if (entry.origin === null) return "unset";
10
+ return entry.defaultReason ? `${entry.origin}: ${entry.defaultReason}` : entry.origin;
11
+ }
12
+ const CONSOLE = {
13
+ out: (line) => console.log(line),
14
+ note: (line) => console.error(line)
15
+ };
16
+ async function run(json, io, action) {
17
+ try {
18
+ await action();
19
+ } catch (error) {
20
+ const code = error.code;
21
+ if (!(error instanceof SettingsRefusal) && !(typeof code === "string" && code.startsWith("STIM_"))) throw error;
22
+ const failure = {
23
+ code,
24
+ message: error.message,
25
+ remedy: error instanceof SettingsRefusal ? error.remedy : null
26
+ };
27
+ io.note(chalk.red(`${failure.code}: ${failure.message}`));
28
+ if (failure.remedy) io.note(chalk.dim(failure.remedy));
29
+ if (json) io.out(JSON.stringify(failure));
30
+ process.exitCode = 1;
31
+ }
32
+ }
33
+ function wantsJson(opts, command) {
34
+ return Boolean(opts.json ?? command.parent?.opts().json);
35
+ }
36
+ function registerSettings(program, io = CONSOLE, env = process.env) {
37
+ const settings = program.command("settings").description("Show every Stim setting with its effective value and layer, or change one").option("--json", "print every setting, its origin, and each layer value as JSON").action((opts) => run(Boolean(opts.json), io, async () => {
38
+ const payload = await readSettingsPayload(await readSettingsContext(process.cwd(), env, io.note));
39
+ if (opts.json) {
40
+ io.out(JSON.stringify(payload));
41
+ return;
42
+ }
43
+ const width = Math.max(...payload.settings.map((entry) => entry.key.length));
44
+ for (const entry of payload.settings) {
45
+ const shown = entry.origin === null ? "" : formatValue(entry.value);
46
+ io.out(`${entry.key.padEnd(width)} ${shown}${shown ? " " : ""}${chalk.dim(`(${formatOrigin(entry)})`)}`);
47
+ }
48
+ for (const entry of payload.unknown) io.note(chalk.yellow(`Warning: ${entry.key} in ${entry.file} is not read by Stim.`));
49
+ }));
50
+ settings.command("get <key>").description("Print the effective value of a setting, or its value in one layer").option("--scope <scope>", `read one layer: ${SETTING_SCOPES.join(", ")}`).option("--json", "print the setting entry as JSON").action((key, opts, command) => run(wantsJson(opts, command), io, async () => {
51
+ const setting = requireSetting(key);
52
+ const scope = opts.scope === void 0 ? null : readScope(opts.scope, setting);
53
+ const context = await readSettingsContext(process.cwd(), env, io.note);
54
+ const entry = settingEntry(context, setting);
55
+ const value = scope ? entry.layers[scope] ?? null : entry.value;
56
+ if (wantsJson(opts, command)) {
57
+ io.out(JSON.stringify(scope ? {
58
+ key,
59
+ scope,
60
+ file: layerFile(context, scope, setting),
61
+ value
62
+ } : entry));
63
+ return;
64
+ }
65
+ if (value === null) return;
66
+ io.out(formatValue(value));
67
+ if (!scope && entry.defaultReason) io.note(chalk.dim(`(${formatOrigin(entry)})`));
68
+ }));
69
+ settings.command("set <key> <value>").description("Write a setting to one layer").option("--scope <scope>", `the layer to write: ${SETTING_SCOPES.join(", ")}`).option("--json", "print the written setting as JSON").action((key, raw, opts, command) => run(wantsJson(opts, command), io, async () => {
70
+ const result = await mutateSetting({
71
+ action: "set",
72
+ key,
73
+ value: raw,
74
+ scope: opts.scope
75
+ }, {
76
+ cwd: process.cwd(),
77
+ env,
78
+ note: io.note
79
+ });
80
+ report(io, wantsJson(opts, command), result, "set");
81
+ }));
82
+ settings.command("unset <key>").description("Remove a setting from one layer").option("--scope <scope>", `the layer to clear: ${SETTING_SCOPES.join(", ")}`).option("--json", "print the setting after removal as JSON").action((key, opts, command) => run(wantsJson(opts, command), io, async () => {
83
+ const result = await mutateSetting({
84
+ action: "unset",
85
+ key,
86
+ scope: opts.scope
87
+ }, {
88
+ cwd: process.cwd(),
89
+ env,
90
+ note: io.note
91
+ });
92
+ report(io, wantsJson(opts, command), result, "unset");
93
+ }));
94
+ }
95
+ function report(io, json, result, verb) {
96
+ const { setting: entry, recordingsDeleted, ...write } = result;
97
+ if (json) {
98
+ io.out(JSON.stringify(result));
99
+ return;
100
+ }
101
+ for (const workspace of recordingsDeleted ?? []) io.note(`Deleted the device recordings of ${workspace}.`);
102
+ const effective = entry.origin === null ? "unset" : `${formatValue(entry.value)} (${formatOrigin(entry)})`;
103
+ if (!write.changed) {
104
+ io.out(`${write.key} was not set in ${write.file}; effective value: ${effective}`);
105
+ return;
106
+ }
107
+ const shown = verb === "set" ? ` = ${formatValue(entry.layers[write.scope])}` : "";
108
+ io.out(`${verb} ${write.key}${shown} in ${write.file}; effective value: ${effective}`);
109
+ }
110
+ function settingsCommand(program) {
111
+ registerSettings(program);
112
+ }
113
+ //#endregion
114
+ export { settingsCommand as default, registerSettings };