stim 1.20.2 → 1.22.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 (231) hide show
  1. package/README.md +141 -8
  2. package/dist/acquire-artifact-Co2k4f7O.mjs +171 -0
  3. package/dist/act-DsuqEkiM.mjs +2801 -0
  4. package/dist/activity-CMLmzp7o.mjs +1397 -0
  5. package/dist/{agent-device-usage-output-Dzgv6lgR.mjs → agent-device-usage-output-DUFaTMdd.mjs} +23 -67
  6. package/dist/{android-DCKZrNvV.mjs → android-ByRMUoiJ.mjs} +157 -93
  7. package/dist/{android-Mz_Inn3w.mjs → android-C7sVmyI9.mjs} +299 -116
  8. package/dist/{android-Dlzxshgp.mjs → android-DGkNqa_c.mjs} +5 -5
  9. package/dist/{android-HqP1_vB_.mjs → android-DR5lZ2Az.mjs} +2 -2
  10. package/dist/android-cas-compiler.mjs +2 -2
  11. package/dist/{android-cas-Bl-cLJBk.mjs → android-cas-ngferVq2.mjs} +7 -6
  12. package/dist/android-project-BCAAmMwz.mjs +12 -0
  13. package/dist/android-project-DVWyCbWU.d.mts +391 -0
  14. package/dist/api.d.mts +810 -64
  15. package/dist/api.mjs +782 -1
  16. package/dist/{artifact-HSwkIWEQ.mjs → artifact-8EY8SAPw.mjs} +240 -213
  17. package/dist/{artifact-D3czlUvT.mjs → artifact-DJPy518Y.mjs} +203 -164
  18. package/dist/artifact-platform-CXcmX_j3.mjs +27 -0
  19. package/dist/{browser-web-CA-F1GQo.mjs → browser-web-Bcv99PBM.mjs} +194 -64
  20. package/dist/budget-Cvwn54qV.mjs +9285 -0
  21. package/dist/{build-DYDbfkk5.mjs → build-CabC3G23.mjs} +153 -98
  22. package/dist/build-cache-Dv7RN200.mjs +602 -0
  23. package/dist/build-plan-DUC8Ka9y.mjs +248 -0
  24. package/dist/{cache-manifest-XH-fvDUj.mjs → cache-manifest-DSeQjt-Q.mjs} +2 -2
  25. package/dist/cache-manifest.mjs +1 -1
  26. package/dist/{ccache-zdKiYQ3E.mjs → ccache-Btwc36-I.mjs} +10 -9
  27. package/dist/{cdp-Dq_ypAlJ.mjs → cdp-3fwICjzi.mjs} +18 -5
  28. package/dist/{chrome-BnzZMqsR.mjs → chrome-Bbw689-6.mjs} +7 -4
  29. package/dist/{cli-CLP3diBm.mjs → cli-CHZa9Lvk.mjs} +20 -20
  30. package/dist/cli.mjs +1 -1
  31. package/dist/client-OyRoEuSr.mjs +1577 -0
  32. package/dist/collector-run.d.mts +4 -40
  33. package/dist/collector-run.mjs +9 -8
  34. package/dist/{command-output-BTy8hZ0F.mjs → command-output-gwpm28fu.mjs} +1 -1
  35. package/dist/config-DlrsduwG.mjs +955 -0
  36. package/dist/{created-devices-Dzd5C2LF.mjs → created-devices-x9rN6bhs.mjs} +14 -4
  37. package/dist/{dependency-state-DG0p31-y.mjs → dependency-state-1I9KZT1Y.mjs} +20 -5
  38. package/dist/{detached-entry-B9C_zeQC.mjs → detached-entry-BwNEtIrP.mjs} +1 -1
  39. package/dist/{dev-client-DAWVIGBu.mjs → dev-client-BSDR5h3F.mjs} +2 -2
  40. package/dist/{device-BECOiufl.mjs → device-B-L3Fbxy.mjs} +91 -34
  41. package/dist/device-DklWZLqb.mjs +1068 -0
  42. package/dist/{device-capacity-CBUAcRyQ.mjs → device-capacity-DK5_EwRS.mjs} +42 -13
  43. package/dist/device-host-worker.mjs +76 -79
  44. package/dist/{device-ios-COSi6oS1.mjs → device-ios-DoB6KFCO.mjs} +77 -51
  45. package/dist/{device-lease-run-Cw2M4z51.mjs → device-lease-run-xJPQ_QQG.mjs} +14 -26
  46. package/dist/{device-pool-Bf-pOhSw.mjs → device-pool-BMkdsefq.mjs} +5 -5
  47. package/dist/{doctor-kfMBnUw6.mjs → doctor-Bo7BXLux.mjs} +271 -320
  48. package/dist/{doctor-CB8oZKCk.mjs → doctor-D5_EzwfA.mjs} +186 -91
  49. package/dist/doctor-fingerprint-DZLoYFVb.mjs +16 -0
  50. package/dist/doctor-fingerprint.mjs +19 -0
  51. package/dist/doctor-thjWAV0z.mjs +2 -0
  52. package/dist/{doctor-watchman-BRyV2adA.mjs → doctor-watchman-N2wDotwQ.mjs} +40 -21
  53. package/dist/{eas-build-JyfqyHfC.mjs → eas-build-CwknaQYj.mjs} +53 -20
  54. package/dist/{build-plan-B7SZsc2N.mjs → eas-fallback-CSgAulr5.mjs} +41 -214
  55. package/dist/{watchman-CPQFZLXY.mjs → eas-session-ledger-DlY_serQ.mjs} +230 -11
  56. package/dist/{error-diagnostics-BR677IDM.mjs → error-diagnostics-DBWO2rxE.mjs} +172 -82
  57. package/dist/exec-DEoAhcze.mjs +858 -0
  58. package/dist/exec-DnYc4HGH.d.mts +78 -0
  59. package/dist/{gc-qWOMdnER.mjs → gc-CXxN-4SE.mjs} +1091 -1029
  60. package/dist/gc-DnNDQyaP.mjs +3 -0
  61. package/dist/{guide-G9cAbVAc.mjs → guide-Br0LEfKy.mjs} +1165 -297
  62. package/dist/{hosted-android-C3MHGld1.mjs → hosted-android-B-9f-jkd.mjs} +10 -8
  63. package/dist/{hosted-client-ZEKpS9vw.mjs → hosted-client-DZAPrcro.mjs} +34 -19
  64. package/dist/{hosted-ios-l-o3iM9J.mjs → hosted-ios-CsCS21hn.mjs} +1 -1
  65. package/dist/{hosted-logs-EzQM7-3Z.mjs → hosted-logs-FIRx9X2f.mjs} +77 -43
  66. package/dist/{hosted-macos-BACVAVqE.mjs → hosted-macos-_awYSpfv.mjs} +35 -22
  67. package/dist/{hosted-native-A4s1QPXe.mjs → hosted-native-BdzE668-.mjs} +49 -27
  68. package/dist/idle-C4cZ757K.d.mts +24 -0
  69. package/dist/{idle-shutdown-DtxhPTKe.mjs → idle-shutdown-DDg3SdvY.mjs} +11 -10
  70. package/dist/ios-CDvlmUs7.d.mts +24 -0
  71. package/dist/{ios-BwVCF7oA.mjs → ios-Ds1clbIt.mjs} +8 -8
  72. package/dist/{ios-device-D7pi2Sca.mjs → ios-device--h_-8ENa.mjs} +51 -26
  73. package/dist/{ios-device-B5veSDDQ.mjs → ios-device-BXZ0c7Kb.mjs} +1 -1
  74. package/dist/{ios-RkW4pnQf.mjs → ios-hcBpnEGk.mjs} +200 -93
  75. package/dist/{ios-Ce7bc7br.mjs → ios-pm4nL6By.mjs} +160 -108
  76. package/dist/{ios-project-K9hY_Jab.mjs → ios-project-CZhKODF3.mjs} +13 -13
  77. package/dist/ios-signing-BtAffm0A.mjs +489 -0
  78. package/dist/{ios-state-CBLe1xYw.mjs → ios-state-Dtw5K2aI.mjs} +1 -1
  79. package/dist/{ios-nOLJGVdy.mjs → ios-xtlRHaeB.mjs} +1 -1
  80. package/dist/{js-swap-Bb3nsS07.mjs → js-swap-Bwhh4S7V.mjs} +30 -25
  81. package/dist/{launch-C3qJ6Agb.mjs → launch-BjxemNpK.mjs} +85 -543
  82. package/dist/{launch-F4sOqAhB.mjs → launch-CCzXlc8r.mjs} +91 -90
  83. package/dist/logs-BfwwadsZ.mjs +479 -0
  84. package/dist/logs-jTS_lHSo.mjs +248 -0
  85. package/dist/{macos-D7uDvO-z.mjs → macos-DVlSSyUg.mjs} +1 -1
  86. package/dist/macos-NfV2D7dO.mjs +694 -0
  87. package/dist/macos-run.mjs +1 -1
  88. package/dist/maintenance-run.mjs +123 -248
  89. package/dist/{metro-DnCEjCxs.mjs → metro-DiXtA3Ty.mjs} +107 -30
  90. package/dist/metro-gateway-CKZqKqx7.mjs +209 -0
  91. package/dist/{named-ports-4WopRPg-.mjs → named-ports-DkEzOfzO.mjs} +42 -90
  92. package/dist/native-android-CqgnOgsT.mjs +645 -0
  93. package/dist/native-gradle-artifact-inputs-DHFnmrVf.mjs +270 -0
  94. package/dist/native-gradle-inputs-Dnh84Zbd.mjs +211 -0
  95. package/dist/native-inputs-TRTTTRxt.mjs +91 -0
  96. package/dist/native-run-NwUuxbkg.mjs +276 -0
  97. package/dist/{native-runtime-k8dTIrbK.mjs → native-runtime-B7KIafpM.mjs} +11 -9
  98. package/dist/native-source-Y0yLhFyQ.mjs +133 -0
  99. package/dist/{native-xcode-inputs-CykopJdM.mjs → native-xcode-inputs-D_VOfFL7.mjs} +26 -18
  100. package/dist/{native-xcode-ios-Bbf30Gm0.mjs → native-xcode-ios-BYDOHWLN.mjs} +104 -60
  101. package/dist/{ndjson-GOnbyvso.mjs → ndjson-CgE_o3Dl.mjs} +3 -3
  102. package/dist/offload-worker.d.mts +59 -41
  103. package/dist/offload-worker.mjs +478 -115
  104. package/dist/operation-exec-BW0em61G.mjs +171 -0
  105. package/dist/{ownership-DCtw_2IA.mjs → ownership-C5fo5Edb.mjs} +3 -3
  106. package/dist/{page-DRHy329N.mjs → page-DBL2PiUU.mjs} +12 -5
  107. package/dist/paths-BsJMoPP2.mjs +12 -0
  108. package/dist/paths-DQtTgsBf.mjs +42 -0
  109. package/dist/{placement-log-MOfPVgaM.mjs → placement-log-BnGgJRRZ.mjs} +5 -5
  110. package/dist/{plan-placement-V0TdzYXp.mjs → plan-placement-DIsMtN-d.mjs} +15 -11
  111. package/dist/{ports-DdSUicVo.mjs → ports-Cy1RkmuQ.mjs} +3 -3
  112. package/dist/prebuild-D4JoEAEs.mjs +484 -0
  113. package/dist/{project-_phNIJfs.mjs → project-wM_XFTvE.mjs} +65 -37
  114. package/dist/{pull-request-CQ8sPbZa.mjs → pull-request-W1IuLXDt.mjs} +102 -20
  115. package/dist/pull-request-eODyIqZF.d.mts +124 -0
  116. package/dist/pull-requests.d.mts +2 -120
  117. package/dist/pull-requests.mjs +2 -2
  118. package/dist/{react-native-android-CM1XRDwv.mjs → react-native-android-6OZ7MSM7.mjs} +121 -72
  119. package/dist/{gradle-DSrXb6lG.mjs → react-native-build-Dvd8hC21.mjs} +292 -15
  120. package/dist/react-native-doctor-DsoSF1Y9.mjs +234 -0
  121. package/dist/{react-native-ios-Dhq_eiYQ.mjs → react-native-ios-4u1Rn-GR.mjs} +71 -39
  122. package/dist/{recordings-D0d5aQt0.mjs → recordings-CQmfzAh7.mjs} +12 -9
  123. package/dist/registration-BcRgF6Ox.mjs +51 -0
  124. package/dist/{reload-C8JhxjSh.mjs → reload-BzkYabB-.mjs} +94 -47
  125. package/dist/reload-D7AVlb8N.mjs +2 -0
  126. package/dist/{remote-BiR6aYjy.mjs → remote-DjGDmlTZ.mjs} +26 -18
  127. package/dist/result-D2Ykz_iD.mjs +435 -0
  128. package/dist/{run-BtPgpKks.mjs → run-DidHghD1.mjs} +5 -5
  129. package/dist/selection-DSMbWEX2.mjs +620 -0
  130. package/dist/{server-bare-R2m_gsH8.mjs → server-bare-CafzuyFB.mjs} +3 -4
  131. package/dist/{server-command-CTtCkmcQ.mjs → server-command-C6QjeupS.mjs} +14 -7
  132. package/dist/{server-expo-DsguMGUF.mjs → server-expo-CrjB29pq.mjs} +54 -11
  133. package/dist/server-expo-D58c9L0M.mjs +2 -0
  134. package/dist/{settings-B717odTD.mjs → settings-C7O8A6ZI.mjs} +309 -119
  135. package/dist/settings-DpR-1Wnn.mjs +114 -0
  136. package/dist/settings-write-CzD60rOD.mjs +360 -0
  137. package/dist/settings.schema.json +176 -16
  138. package/dist/{simslim-CCr3rE-A.mjs → simslim-BNckWpXi.mjs} +14 -12
  139. package/dist/{slot-launch-DPt0m9Nd.mjs → slot-launch-CbfmNgM6.mjs} +15 -20
  140. package/dist/{spawn-entry-Dcb7sDUz.mjs → spawn-entry-jw19m8Nl.mjs} +0 -1
  141. package/dist/stage-Bps5oius.mjs +200 -0
  142. package/dist/{start-TXeMmmO2.mjs → start-Br-oxqMD.mjs} +1 -1
  143. package/dist/start-EojN4WFz.mjs +1364 -0
  144. package/dist/{state-D1Icyjlu.mjs → state--smjFSTL.mjs} +55 -13
  145. package/dist/{state-CG_OFoaA.mjs → state-08I3hw3_.mjs} +3 -2
  146. package/dist/{stats-BoY5sEPU.mjs → stats-D3GerlFW.mjs} +7 -13
  147. package/dist/stats-report-BzaPrRm6.mjs +16 -0
  148. package/dist/{status-BTA7kKiQ.mjs → status-BRROykC8.mjs} +7 -5
  149. package/dist/status-EvrK72L2.mjs +2 -0
  150. package/dist/{status-WgFbkRzj.mjs → status-WBDajew2.mjs} +554 -452
  151. package/dist/{status-watch-C23ILtf9.mjs → status-watch-Bg_u-pwR.mjs} +222 -25
  152. package/dist/status-worker.d.mts +1 -0
  153. package/dist/status-worker.mjs +19 -0
  154. package/dist/stim-desktop-D5OGpYZM.mjs +112 -0
  155. package/dist/{stop-DR6VoDIk.mjs → stop-DTZ9uTw3.mjs} +2 -2
  156. package/dist/{stop-DPEhunlw.mjs → stop-Dky10AEJ.mjs} +33 -23
  157. package/dist/{stop-BNmBMi1F.mjs → stop-Mv6W9FAk.mjs} +137 -98
  158. package/dist/supervisor-run.d.mts +8 -17
  159. package/dist/supervisor-run.mjs +56 -28
  160. package/dist/{support-CwjbFs9H.mjs → support-CNioewsd.mjs} +14 -14
  161. package/dist/{support-DMTqj3Hm.mjs → support-yUiOjnVY.mjs} +20 -13
  162. package/dist/swiftpm-artifact-inputs-DFcGsXDP.mjs +153 -0
  163. package/dist/swiftpm-macos-BIak-Rxv.mjs +532 -0
  164. package/dist/toolchain-BY8X8HXx.mjs +2 -0
  165. package/dist/toolchain-DpJMHq0n.mjs +876 -0
  166. package/dist/{trigger-CigAYjeL.mjs → trigger-Cbyc41d_.mjs} +21 -6
  167. package/dist/trigger-yb_nFzPF.mjs +2 -0
  168. package/dist/{warm-progress-BuY-Fvfn.mjs → warm-progress-CA3TgT3-.mjs} +263 -156
  169. package/dist/web-CZ07gd77.mjs +2 -0
  170. package/dist/{web-BDBMxDpx.mjs → web-DKx6yoFA.mjs} +20 -14
  171. package/dist/web-run.mjs +13 -12
  172. package/dist/windows-report.d.mts +1 -0
  173. package/dist/windows-report.mjs +18 -0
  174. package/dist/windows-report.ps1 +43 -0
  175. package/dist/{workspace-state-DJt_MMvf.mjs → workspace-state-U08dEzhG.mjs} +62 -58
  176. package/dist/{workspaces-C36s2jb9.mjs → workspaces-CpANmBlq.mjs} +1723 -1286
  177. package/dist/{worktree-CgvJYJ-Q.mjs → worktree-CHecZ4Oq.mjs} +1097 -547
  178. package/dist/worktree-ZqZVjD9K.mjs +2 -0
  179. package/dist/xcode-BXn9-xYx.mjs +896 -0
  180. package/package.json +7 -5
  181. package/shim/android-audio/Main.java +24 -0
  182. package/shim/android-audio/README.md +17 -0
  183. package/shim/android-audio.jar +0 -0
  184. package/shim/android-optimizations.gradle +7 -5
  185. package/dist/activity-BSV745Kz.mjs +0 -629
  186. package/dist/api-qvOzWyfO.mjs +0 -154
  187. package/dist/api-run.mjs +0 -294
  188. package/dist/app-install-BIKtMfPq.mjs +0 -896
  189. package/dist/artifact-lifecycle-DzPpBYvK.mjs +0 -30
  190. package/dist/budget-f7516Zk0.mjs +0 -4106
  191. package/dist/build-facts-DcLv2HSd.d.mts +0 -111
  192. package/dist/cancellation-C_22VQTH.mjs +0 -24
  193. package/dist/client-qQAaXSUs.mjs +0 -1771
  194. package/dist/config-BYDxlMY3.mjs +0 -562
  195. package/dist/device-DuiPJQSn.mjs +0 -290
  196. package/dist/device-lease-BX1sJQ2E.mjs +0 -1224
  197. package/dist/device-remote-xRT0Vmo9.mjs +0 -1272
  198. package/dist/eas-session-ledger-Cm0Gwq2F.mjs +0 -207
  199. package/dist/exec-DqKo9GKJ.mjs +0 -268
  200. package/dist/git-DDfFzkMm.mjs +0 -45
  201. package/dist/launch-verify-B6Q8hZP-.mjs +0 -428
  202. package/dist/logs-BGrEUaEs.mjs +0 -383
  203. package/dist/macos-Ch5VJmcS.mjs +0 -584
  204. package/dist/metro-gateway-CX9Xlkq2.mjs +0 -103
  205. package/dist/miss-reason-mKzZ4VvN.mjs +0 -238
  206. package/dist/native-android-D5qc3-_v.mjs +0 -226
  207. package/dist/native-gradle-inputs-BsLRrl7u.mjs +0 -349
  208. package/dist/ndjson-Du3j0AQ9.d.mts +0 -17
  209. package/dist/plan-C4TjdPsR.mjs +0 -260
  210. package/dist/prebuild-DYbucPXy.mjs +0 -212
  211. package/dist/preview-78a9kR_-.mjs +0 -1011
  212. package/dist/react-native-build-CtCccJtb.mjs +0 -239
  213. package/dist/react-native-doctor-CfRnFfjs.mjs +0 -78
  214. package/dist/remote-cache-OyOyVIS3.mjs +0 -526
  215. package/dist/result-CaJg5Iat.mjs +0 -186
  216. package/dist/server-expo-Bigriskl.mjs +0 -2
  217. package/dist/settings-BORNaaCO.mjs +0 -402
  218. package/dist/settings-vk3mJGSm.d.mts +0 -13
  219. package/dist/spawn-claims-DVS5RkMS.mjs +0 -72
  220. package/dist/stage-KNTQopqv.mjs +0 -157
  221. package/dist/start-BWqzODpb.mjs +0 -1116
  222. package/dist/stim-desktop-BzBN2Em2.mjs +0 -63
  223. package/dist/swiftpm-macos-DRNVJWlb.mjs +0 -119
  224. package/dist/tailnet-Dh-qiYzG.mjs +0 -265
  225. package/dist/toolchain-BFkAcstd.mjs +0 -2
  226. package/dist/toolchain-DxSsNssu.mjs +0 -1657
  227. package/dist/trigger-9_USgmxz.mjs +0 -2
  228. package/dist/web-Dq-i3wzJ.mjs +0 -2
  229. package/dist/worktree-DpLdCHga.mjs +0 -2
  230. package/dist/{api-run.d.mts → doctor-fingerprint.d.mts} +0 -0
  231. package/dist/{errors-DzkMYh8Q.mjs → errors-ccaPc4ox.mjs} +2 -2
@@ -1,562 +0,0 @@
1
- import { t as getExecutor } from "./exec-DqKo9GKJ.mjs";
2
- import { createRequire } from "node:module";
3
- import { join } from "node:path";
4
- import { dirname as dirname$1, isAbsolute as isAbsolute$1, join as join$1, normalize, parse, sep as sep$1 } from "path";
5
- import { allMetroPorts, configCorruptRepair, findEnclosingWorktreeRoot, getConcurrencyLimits, getConfigPath, getConfigPath as getConfigPath$1, getProject, getProjectSettings, getRepoSettings, isPathPrefix, loadConfig, loadConfig as loadConfig$1, validateAutomaticPool, withConfigLock, withConfigLock as withConfigLock$1 } from "@stim-cli/core/state";
6
- import { existsSync, lstatSync, readdirSync, readlinkSync, renameSync, statSync, unlinkSync, writeFileSync } from "fs";
7
- import { configDir, ensurePrivateDir } from "@stim-cli/core";
8
- import { InvalidArgumentError } from "commander";
9
- //#region \0rolldown/runtime.js
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
15
- var __exportAll = (all, no_symbols) => {
16
- let target = {};
17
- for (var name in all) __defProp(target, name, {
18
- get: all[name],
19
- enumerable: true
20
- });
21
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
22
- return target;
23
- };
24
- var __copyProps = (to, from, except, desc) => {
25
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
26
- key = keys[i];
27
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
28
- get: ((k) => from[k]).bind(null, key),
29
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
30
- });
31
- }
32
- return to;
33
- };
34
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
35
- var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
36
- //#endregion
37
- //#region src/devices/device-slots.ts
38
- const DEFAULT_DEVICE_SLOT = "default";
39
- const DEVICE_SLOT_RULE = "A device slot must be 1-64 letters, digits, underscores or hyphens, starting with a letter or digit.";
40
- function isDeviceSlot(slot) {
41
- return /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$/.test(slot) && ![
42
- "constructor",
43
- "prototype",
44
- "__proto__"
45
- ].includes(slot);
46
- }
47
- function validateDeviceSlot(slot = "default") {
48
- if (!isDeviceSlot(slot)) {
49
- const error = /* @__PURE__ */ new Error(DEVICE_SLOT_RULE);
50
- Object.assign(error, { code: "STIM_BAD_ARG" });
51
- throw error;
52
- }
53
- return slot;
54
- }
55
- function parseDeviceSlotOption(slot) {
56
- if (!isDeviceSlot(slot)) throw new InvalidArgumentError(DEVICE_SLOT_RULE);
57
- if (slot === "web") throw new InvalidArgumentError(`web names this workspace's owned Chrome (stim stop --slot web); choose another device slot name.`);
58
- return slot;
59
- }
60
- function deviceSlotPlatforms(project, slot = DEFAULT_DEVICE_SLOT) {
61
- validateDeviceSlot(slot);
62
- if (slot === DEFAULT_DEVICE_SLOT) return project?.platforms;
63
- return project?.deviceSlots && Object.hasOwn(project.deviceSlots, slot) ? project.deviceSlots[slot] : void 0;
64
- }
65
- function projectDeviceSlots(project) {
66
- const slots = [{
67
- slot: DEFAULT_DEVICE_SLOT,
68
- platforms: project?.platforms ?? {}
69
- }];
70
- for (const [slot, platforms] of Object.entries(project?.deviceSlots ?? {})) {
71
- validateDeviceSlot(slot);
72
- if (slot === DEFAULT_DEVICE_SLOT) throw new Error("The default device slot must use the existing platforms record.");
73
- if (!platforms || typeof platforms !== "object" || Array.isArray(platforms)) throw new Error(`Invalid device slot record: ${slot}`);
74
- slots.push({
75
- slot,
76
- platforms
77
- });
78
- }
79
- return slots;
80
- }
81
- function assignSlotDevice(project, platform, device, slot = DEFAULT_DEVICE_SLOT) {
82
- validateDeviceSlot(slot);
83
- if (platform !== "ios" && platform !== "android") throw new Error(`Unknown device platform: ${platform}`);
84
- if (slot === DEFAULT_DEVICE_SLOT) project.platforms = {
85
- ...project.platforms,
86
- [platform]: device
87
- };
88
- else project.deviceSlots = {
89
- ...project.deviceSlots,
90
- [slot]: {
91
- ...deviceSlotPlatforms(project, slot),
92
- [platform]: device
93
- }
94
- };
95
- }
96
- function removeSlotDevice(project, platform, slot = DEFAULT_DEVICE_SLOT) {
97
- const platforms = deviceSlotPlatforms(project, slot);
98
- if (!platforms) return;
99
- delete platforms[platform];
100
- if (slot !== DEFAULT_DEVICE_SLOT && Object.keys(platforms).length === 0) {
101
- delete project.deviceSlots[slot];
102
- if (Object.keys(project.deviceSlots).length === 0) delete project.deviceSlots;
103
- }
104
- }
105
- function deviceSlotKey(platform, slot = "default") {
106
- validateDeviceSlot(slot);
107
- if (platform !== "ios" && platform !== "android") throw new Error(`Unknown device platform: ${platform}`);
108
- return slot === "default" ? platform : `${platform}:${slot}`;
109
- }
110
- /**
111
- * The slot key in a form that is legal as a file name. NTFS reads a colon in a file name as an
112
- * alternate data stream: the write and the read of the exact path both succeed while `readdirSync`
113
- * cannot see the file, so every non-default slot's logs would be invisible to `stim logs`. A slot
114
- * name can contain neither a colon nor a dot, so the two forms stay one-to-one.
115
- */
116
- function deviceSlotFileKey(platform, slot = "default") {
117
- return deviceSlotKey(platform, slot).replace(":", ".");
118
- }
119
- function parseDeviceSlotKey(key) {
120
- const [platform, slot = "default", extra] = key.split(":");
121
- if (platform !== "ios" && platform !== "android" || extra !== void 0) return null;
122
- try {
123
- validateDeviceSlot(slot);
124
- } catch {
125
- return null;
126
- }
127
- if (key !== deviceSlotKey(platform, slot)) return null;
128
- return {
129
- platform,
130
- slot
131
- };
132
- }
133
- //#endregion
134
- //#region src/fs-util.ts
135
- const WINDOWS = process.platform === "win32";
136
- const DRIVE_LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
137
- function volumeRootFor(path) {
138
- const normalized = normalize(String(path));
139
- if (WINDOWS) return parse(normalized).root.replace(/^[a-z]:/, (drive) => drive.toUpperCase());
140
- const m = normalized.match(/^\/volumes\/([^/]+)/i);
141
- return m ? `/Volumes/${m[1]}` : "/";
142
- }
143
- function resolveWorkspaceRealish(workspacePath) {
144
- const raw = String(workspacePath);
145
- if (!isAbsolute$1(raw)) return null;
146
- let current = raw;
147
- const MAX_HOPS = 40;
148
- for (let hops = 0; hops < MAX_HOPS; hops++) {
149
- const normalized = normalize(current);
150
- const root = parse(normalized).root;
151
- const segments = normalized.slice(root.length).split(sep$1).filter(Boolean);
152
- let prefix = root.endsWith(sep$1) ? root.slice(0, -sep$1.length) : root;
153
- let followedSymlink = false;
154
- for (const segment of segments) {
155
- prefix += `${sep$1}${segment}`;
156
- let st;
157
- try {
158
- st = lstatSync(prefix);
159
- } catch (err) {
160
- if (err && err.code === "ENOENT") return normalized;
161
- return null;
162
- }
163
- if (st.isSymbolicLink()) {
164
- let target;
165
- try {
166
- target = readlinkSync(prefix);
167
- } catch {
168
- return null;
169
- }
170
- current = `${isAbsolute$1(target) ? target : normalize(join$1(dirname$1(prefix), target))}${normalized.slice(prefix.length)}`;
171
- followedSymlink = true;
172
- break;
173
- }
174
- }
175
- if (!followedSymlink) return normalized;
176
- }
177
- return null;
178
- }
179
- function isRealMount(entryDev, rootDev) {
180
- return entryDev != null && rootDev != null && entryDev !== rootDev;
181
- }
182
- function listWindowsVolumeRoots(statFn) {
183
- const roots = [];
184
- for (const letter of DRIVE_LETTERS) {
185
- const root = `${letter}:${sep$1}`;
186
- try {
187
- statFn(root);
188
- } catch {
189
- continue;
190
- }
191
- roots.push(root);
192
- }
193
- return roots;
194
- }
195
- function listMountedVolumes({ statFn = statSync } = {}) {
196
- if (WINDOWS) return listWindowsVolumeRoots(statFn);
197
- const roots = ["/"];
198
- let rootDev;
199
- try {
200
- rootDev = statFn("/").dev;
201
- } catch {
202
- return roots;
203
- }
204
- try {
205
- for (const name of readdirSync("/Volumes")) {
206
- const path = join$1("/Volumes", name);
207
- let entryDev;
208
- try {
209
- entryDev = statFn(path).dev;
210
- } catch {
211
- continue;
212
- }
213
- if (isRealMount(entryDev, rootDev)) roots.push(path);
214
- }
215
- } catch {}
216
- return roots;
217
- }
218
- function resolveVolumeRoot(path) {
219
- const realish = resolveWorkspaceRealish(path);
220
- return realish === null ? null : volumeRootFor(realish);
221
- }
222
- function uncShareIsReachable(volume, statFn) {
223
- if (!WINDOWS || !volume.startsWith(`${sep$1}${sep$1}`)) return false;
224
- try {
225
- return statFn(volume).isDirectory();
226
- } catch {
227
- return false;
228
- }
229
- }
230
- function isOnMountedVolume(path, mountedVolumes, { statFn = statSync } = {}) {
231
- const mounted = new Set(mountedVolumes || listMountedVolumes());
232
- const volume = resolveVolumeRoot(path);
233
- if (volume === null) return false;
234
- return mounted.has(volume) || uncShareIsReachable(volume, statFn);
235
- }
236
- function directorySize(dir, { timeoutMs }) {
237
- return measuredDirectorySize(dir, { timeoutMs }) ?? 0;
238
- }
239
- function measuredDirectorySize(dir, { timeoutMs }) {
240
- let out;
241
- try {
242
- out = getExecutor().runFile("du", ["-sk", dir], { timeoutMs });
243
- } catch {
244
- return null;
245
- }
246
- if (!out) return 0;
247
- const kb = parseInt(out.split(/\s+/)[0] ?? "", 10);
248
- return isNaN(kb) ? 0 : kb * 1024;
249
- }
250
- function formatBytes(bytes) {
251
- if (bytes >= 1024 ** 3) return `${(bytes / 1024 ** 3).toFixed(1)}G`;
252
- if (bytes >= 1024 ** 2) return `${Math.round(bytes / 1024 ** 2)}M`;
253
- return `${Math.round(bytes / 1024)}K`;
254
- }
255
- //#endregion
256
- //#region src/ownership-claim.ts
257
- var ownership_claim_exports = /* @__PURE__ */ __exportAll({});
258
- import * as import__stim_cli_core_ownership_claim from "@stim-cli/core/ownership-claim";
259
- __reExport(ownership_claim_exports, import__stim_cli_core_ownership_claim);
260
- //#endregion
261
- //#region src/devices/avd-claim.ts
262
- function acquireAvdClaim(avdName) {
263
- const root = join(configDir(), "avd-locks", `${encodeURIComponent(avdName.toLowerCase())}.lock`);
264
- const label = `AVD ${avdName}`;
265
- const attempt = (0, ownership_claim_exports.tryAcquireClaim)({
266
- root,
267
- mode: "exclusive",
268
- label
269
- });
270
- if (attempt.pending) (0, ownership_claim_exports.releaseClaim)(attempt.pending);
271
- if (attempt.acquired) return attempt.acquired;
272
- throw new ownership_claim_exports.ClaimRefusedError({
273
- root,
274
- claimPath: attempt.held?.path ?? attempt.waitingFor?.[0]?.path ?? root,
275
- label,
276
- reason: "another operation is creating, recovering, or tearing down this AVD"
277
- });
278
- }
279
- //#endregion
280
- //#region src/process-identity.ts
281
- var process_identity_exports = /* @__PURE__ */ __exportAll({});
282
- import * as import__stim_cli_core_process_identity from "@stim-cli/core/process-identity";
283
- __reExport(process_identity_exports, import__stim_cli_core_process_identity);
284
- //#endregion
285
- //#region src/workspace/config.ts
286
- function getConfigDir() {
287
- return configDir();
288
- }
289
- function refuseRelativeStimPaths(env = process.env) {
290
- for (const name of [
291
- "STIM_HOME",
292
- "STIM_BUILD_CACHE",
293
- "STIM_METRO_CACHE"
294
- ]) {
295
- const value = env[name];
296
- if (!value || isAbsolute$1(value)) continue;
297
- const error = /* @__PURE__ */ new Error(`${name}=${value} is not an absolute path. Set it to an absolute path, or unset it to use the default.`);
298
- error.code = "STIM_RELATIVE_PATH";
299
- throw error;
300
- }
301
- }
302
- function saveConfig(config) {
303
- ensurePrivateDir(getConfigDir());
304
- const target = getConfigPath();
305
- const tmp = `${target}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;
306
- writeFileSync(tmp, JSON.stringify(config, null, 2) + "\n", { mode: 384 });
307
- try {
308
- renameSync(tmp, target);
309
- } catch (err) {
310
- try {
311
- unlinkSync(tmp);
312
- } catch {}
313
- throw err;
314
- }
315
- }
316
- const CONFIG_VERSION = 2;
317
- function ensureConfig() {
318
- return withConfigLock(() => {
319
- const existing = loadConfig();
320
- if (existing) {
321
- if (existing.version !== CONFIG_VERSION) {
322
- existing.version = CONFIG_VERSION;
323
- saveConfig(existing);
324
- }
325
- return existing;
326
- }
327
- const fresh = {
328
- version: CONFIG_VERSION,
329
- projects: {},
330
- repos: {}
331
- };
332
- saveConfig(fresh);
333
- return fresh;
334
- });
335
- }
336
- function requireAbsoluteProjectPath(projectPath) {
337
- if (isAbsolute$1(projectPath)) return;
338
- throw new Error(`Project key "${projectPath}" is not an absolute path. The registry is keyed by the realpath of a workspace root, so a relative key can never resolve.`);
339
- }
340
- function upsertProject(projectPath, fields) {
341
- requireAbsoluteProjectPath(projectPath);
342
- return withConfigLock(() => {
343
- const cfg = ensureConfig();
344
- const existing = cfg.projects[projectPath] || {
345
- metroPort: null,
346
- platforms: {}
347
- };
348
- cfg.projects[projectPath] = {
349
- ...existing,
350
- ...typeof fields === "function" ? fields(existing) : fields
351
- };
352
- saveConfig(cfg);
353
- return cfg.projects[projectPath];
354
- });
355
- }
356
- function removeProject(projectPath) {
357
- withConfigLock(() => {
358
- const cfg = loadConfig();
359
- if (!cfg?.projects?.[projectPath]) return;
360
- if (Object.keys(cfg.projects[projectPath].ports ?? {}).length) throw new Error(`Named ports remain for ${projectPath}; stop or release them before removing its registry entry.`);
361
- for (const { platforms } of projectDeviceSlots(cfg.projects[projectPath])) if (platforms.android?.owned && platforms.android.avdName) (0, ownership_claim_exports.releaseClaim)(acquireAvdClaim(platforms.android.avdName));
362
- delete cfg.projects[projectPath];
363
- saveConfig(cfg);
364
- });
365
- }
366
- function claimMetroPort(projectPath, port) {
367
- return withConfigLock(() => {
368
- const cfg = ensureConfig();
369
- if (!cfg.projects[projectPath]) throw new Error(`Project not registered: ${projectPath}`);
370
- for (const [path, proj] of Object.entries(cfg.projects)) {
371
- if (path !== projectPath && proj?.metroPort === port) return null;
372
- if (Object.values(proj?.ports ?? {}).includes(port)) return null;
373
- }
374
- cfg.projects[projectPath].metroPort = port;
375
- saveConfig(cfg);
376
- return port;
377
- });
378
- }
379
- function releaseMetroPort(projectPath, port) {
380
- withConfigLock(() => {
381
- const cfg = loadConfig();
382
- const project = cfg?.projects?.[projectPath];
383
- if (!cfg || project?.metroPort !== port) return;
384
- project.metroPort = null;
385
- saveConfig(cfg);
386
- });
387
- }
388
- function setDevice(projectPath, platform, deviceFields, slot = "default") {
389
- requireAbsoluteProjectPath(projectPath);
390
- withConfigLock(() => {
391
- const cfg = ensureConfig();
392
- if (!cfg.projects[projectPath]) throw new Error(`Project not registered: ${projectPath}`);
393
- assignSlotDevice(cfg.projects[projectPath], platform, deviceFields, slot);
394
- saveConfig(cfg);
395
- });
396
- }
397
- function releaseAndroidConsolePort(projectPath, consolePort, slot = "default") {
398
- return withConfigLock(() => {
399
- const cfg = loadConfig();
400
- const android = deviceSlotPlatforms(cfg?.projects?.[projectPath], slot)?.android;
401
- if (!cfg || !android || android.consolePort !== consolePort) return false;
402
- delete android.consolePort;
403
- saveConfig(cfg);
404
- return true;
405
- });
406
- }
407
- function recordIosSchemeApprovals(projectPath, deviceUdid, schemeApprovals, slot = "default") {
408
- withConfigLock(() => {
409
- const cfg = loadConfig();
410
- const ios = deviceSlotPlatforms(cfg?.projects?.[projectPath], slot)?.ios;
411
- if (!cfg || !ios?.owned || ios.deviceUdid !== deviceUdid) return;
412
- ios.schemeApprovals = schemeApprovals;
413
- saveConfig(cfg);
414
- });
415
- }
416
- function clearAndroidBootPending(projectPath, avdName, slot = "default") {
417
- withConfigLock(() => {
418
- const cfg = loadConfig();
419
- const android = deviceSlotPlatforms(cfg?.projects?.[projectPath], slot)?.android;
420
- if (!cfg || android?.avdName !== avdName || !android.bootPending) return;
421
- delete android.bootPending;
422
- saveConfig(cfg);
423
- });
424
- }
425
- function clearDevice(projectPath, platform, slot = "default", expectedId) {
426
- return withConfigLock(() => {
427
- const cfg = loadConfig();
428
- const project = cfg?.projects?.[projectPath];
429
- if (!cfg || !project) return false;
430
- const current = deviceSlotPlatforms(project, slot)?.[platform];
431
- if (expectedId !== void 0 && (platform === "ios" ? current?.deviceUdid : current?.avdName) !== expectedId) return false;
432
- removeSlotDevice(project, platform, slot);
433
- saveConfig(cfg);
434
- return true;
435
- });
436
- }
437
- function setSupervisor(projectPath, { pid, port, startedAt, processToken }) {
438
- requireAbsoluteProjectPath(projectPath);
439
- return withConfigLock(() => {
440
- const cfg = ensureConfig();
441
- if (!cfg.projects[projectPath]) cfg.projects[projectPath] = {
442
- metroPort: null,
443
- platforms: {}
444
- };
445
- cfg.projects[projectPath].supervisor = {
446
- pid,
447
- port,
448
- startedAt,
449
- processToken
450
- };
451
- saveConfig(cfg);
452
- return cfg.projects[projectPath].supervisor;
453
- });
454
- }
455
- function clearSupervisor(projectPath, expected) {
456
- return withConfigLock(() => {
457
- const cfg = loadConfig();
458
- const current = cfg?.projects?.[projectPath]?.supervisor;
459
- if (!current) return true;
460
- if (expected !== void 0 && !(0, process_identity_exports.sameProcessRecord)(current, expected)) return false;
461
- delete cfg.projects[projectPath].supervisor;
462
- saveConfig(cfg);
463
- return true;
464
- });
465
- }
466
- function targetSettings(cfg, target, create) {
467
- if (target.scope === "machine") return cfg;
468
- if (target.scope === "workspace") {
469
- if (!cfg.projects[target.projectPath]) {
470
- if (!create) return null;
471
- cfg.projects[target.projectPath] = {
472
- metroPort: null,
473
- platforms: {}
474
- };
475
- }
476
- const project = cfg.projects[target.projectPath];
477
- if (!project.settings && create) project.settings = {};
478
- return project.settings ?? null;
479
- }
480
- if (!cfg.repos[target.gitCommonDir]) {
481
- if (!create) return null;
482
- cfg.repos[target.gitCommonDir] = {};
483
- }
484
- const repo = cfg.repos[target.gitCommonDir];
485
- if (!repo.settings && create) repo.settings = {};
486
- return repo.settings ?? null;
487
- }
488
- function writeConfigSetting(target, dottedKey, value) {
489
- if (target.scope === "workspace") requireAbsoluteProjectPath(target.projectPath);
490
- return withConfigLock(() => {
491
- const cfg = value === void 0 ? loadConfig() : ensureConfig();
492
- const settings = cfg ? targetSettings(cfg, target, value !== void 0) : null;
493
- if (!cfg || !settings) return false;
494
- if (value === void 0) {
495
- if (!deleteNested(settings, dottedKey)) return false;
496
- } else writeNested(settings, dottedKey, value);
497
- if (target.scope === "machine") {
498
- if (dottedKey === "remote.buildPoolDisabled" || dottedKey === "remote.machines") validateAutomaticPool("build", cfg);
499
- if (dottedKey === "remote.devicePoolDisabled" || dottedKey === "remote.machines") validateAutomaticPool("device", cfg);
500
- }
501
- saveConfig(cfg);
502
- return true;
503
- });
504
- }
505
- function writeNested(obj, dottedKey, value) {
506
- const keys = dottedKey.split(".");
507
- let cur = obj;
508
- for (let i = 0; i < keys.length - 1; i++) {
509
- const k = keys[i];
510
- if (k === void 0) continue;
511
- const next = cur[k];
512
- if (typeof next !== "object" || next === null) cur[k] = {};
513
- cur = cur[k];
514
- }
515
- const leaf = keys[keys.length - 1];
516
- if (leaf !== void 0) cur[leaf] = value;
517
- }
518
- function deleteNested(obj, dottedKey) {
519
- const keys = dottedKey.split(".");
520
- const chain = [obj];
521
- let cur = obj;
522
- for (let i = 0; i < keys.length - 1; i++) {
523
- const k = keys[i];
524
- if (k === void 0) return false;
525
- const next = cur[k];
526
- if (next == null || typeof next !== "object") return false;
527
- cur = next;
528
- chain.push(cur);
529
- }
530
- const leaf = keys[keys.length - 1];
531
- if (leaf === void 0) return false;
532
- if (!(leaf in cur)) return false;
533
- delete cur[leaf];
534
- for (let i = chain.length - 2; i >= 0; i--) {
535
- const parent = chain[i];
536
- const key = keys[i];
537
- const child = chain[i + 1];
538
- if (parent === void 0 || key === void 0 || child === void 0) break;
539
- if (Object.keys(child).length === 0) delete parent[key];
540
- else break;
541
- }
542
- return true;
543
- }
544
- function allConsolePortsAndSerials({ isMounted = isOnMountedVolume } = {}) {
545
- const cfg = loadConfig();
546
- const result = {
547
- androidConsolePorts: [],
548
- androidPhysicalSerials: []
549
- };
550
- if (!cfg) return result;
551
- for (const [path, proj] of Object.entries(cfg.projects || {})) {
552
- if (!existsSync(path) && isMounted(path)) continue;
553
- for (const { platforms } of projectDeviceSlots(proj)) {
554
- const android = platforms.android;
555
- if (typeof android?.consolePort === "number") result.androidConsolePorts.push(android.consolePort);
556
- if (android?.serial && !android.avdName) result.androidPhysicalSerials.push(android.serial);
557
- }
558
- }
559
- return result;
560
- }
561
- //#endregion
562
- export { acquireAvdClaim as A, deviceSlotKey as B, saveConfig as C, withConfigLock$1 as D, upsertProject as E, listMountedVolumes as F, removeSlotDevice as G, parseDeviceSlotKey as H, measuredDirectorySize as I, __require as J, validateDeviceSlot as K, volumeRootFor as L, directorySize as M, formatBytes as N, writeConfigSetting as O, isOnMountedVolume as P, assignSlotDevice as R, removeProject as S, setSupervisor as T, parseDeviceSlotOption as U, deviceSlotPlatforms as V, projectDeviceSlots as W, loadConfig$1 as _, clearDevice as a, releaseAndroidConsolePort as b, ensureConfig as c, getConfigDir as d, getConfigPath$1 as f, isPathPrefix as g, getRepoSettings as h, clearAndroidBootPending as i, ownership_claim_exports as j, process_identity_exports as k, findEnclosingWorktreeRoot as l, getProjectSettings as m, allMetroPorts as n, clearSupervisor as o, getProject as p, __commonJSMin as q, claimMetroPort as r, configCorruptRepair as s, allConsolePortsAndSerials as t, getConcurrencyLimits as u, recordIosSchemeApprovals as v, setDevice as w, releaseMetroPort as x, refuseRelativeStimPaths as y, deviceSlotFileKey as z };