stim 1.20.1 → 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 +94 -11
  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-VPaOgGaF.mjs → agent-device-usage-output-zh1vhbLp.mjs} +21 -66
  6. package/dist/{android-CZh6ElG5.mjs → android-BEJ8Jpl7.mjs} +3 -3
  7. package/dist/{android-CLbBJ2ve.mjs → android-BLgbNqox.mjs} +128 -79
  8. package/dist/{android-eXfIjKJr.mjs → android-CV_GCELZ.mjs} +5 -5
  9. package/dist/{android-DE8-JfGW.mjs → android-DUYkNF4u.mjs} +188 -106
  10. package/dist/{android-cas-BFpS84v2.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-Ctb2jpw6.mjs → artifact-B8T3S5gi.mjs} +223 -201
  16. package/dist/{artifact-DXk_Fle_.mjs → artifact-DAuZ-FNU.mjs} +158 -148
  17. package/dist/{browser-web-xQWC2RWl.mjs → browser-web-QQzVjz3O.mjs} +28 -26
  18. package/dist/budget-Bs6SxxzO.mjs +9154 -0
  19. package/dist/{build-COBA1tBc.mjs → build-CoPzQRNw.mjs} +144 -101
  20. package/dist/build-cache-DmyR9Zzc.mjs +602 -0
  21. package/dist/build-plan-CaFskB7_.mjs +188 -0
  22. package/dist/{cache-manifest-qA3dT2x2.mjs → cache-manifest-DkkqguoK.mjs} +10 -5
  23. package/dist/cache-manifest.mjs +1 -1
  24. package/dist/{ccache-CtbqWxIC.mjs → ccache-BJRZ9pG3.mjs} +10 -9
  25. package/dist/{cdp-Dq_ypAlJ.mjs → cdp-CWmIUMbw.mjs} +18 -5
  26. package/dist/{chrome-Dp2lMLBe.mjs → chrome-B6tfCta1.mjs} +7 -4
  27. package/dist/{cli-sGqlPu1n.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 -39
  32. package/dist/collector-run.mjs +9 -9
  33. package/dist/{command-output-CPDq_90S.mjs → command-output-B1UrjZHL.mjs} +1 -1
  34. package/dist/config-CYcBF478.mjs +949 -0
  35. package/dist/{created-devices-CXBMtoj5.mjs → created-devices-CqeBlrEn.mjs} +3 -3
  36. package/dist/{dependency-state-B2m8eqsS.mjs → dependency-state-BbKQW83h.mjs} +20 -5
  37. package/dist/{detached-entry-BXq4fIl-.mjs → detached-entry-DFRyG1_o.mjs} +1 -1
  38. package/dist/{dev-client-BqYjMIaC.mjs → dev-client-UOeESKm6.mjs} +2 -2
  39. package/dist/device-DCxH7_By.mjs +1068 -0
  40. package/dist/{device-D4DqjSZZ.mjs → device-ExJq8Ei7.mjs} +35 -36
  41. package/dist/{device-capacity-DrwHwR97.mjs → device-capacity-CMlqEcvw.mjs} +43 -14
  42. package/dist/device-host-worker.mjs +65 -62
  43. package/dist/{device-ios-DE8KJd3b.mjs → device-ios-DRUeKaFV.mjs} +49 -49
  44. package/dist/{device-lease-run-Baelt3nc.mjs → device-lease-run-C8raGFoP.mjs} +14 -26
  45. package/dist/{device-pool-DtK9S6AD.mjs → device-pool-DMRpVX9a.mjs} +5 -5
  46. package/dist/doctor-BLHCYxzi.mjs +2 -0
  47. package/dist/{doctor-Dunu3Nv1.mjs → doctor-DTvaDOda.mjs} +317 -344
  48. package/dist/{doctor-DiP9HsIP.mjs → doctor-Dhqebm0q.mjs} +183 -91
  49. package/dist/doctor-fingerprint.mjs +19 -0
  50. package/dist/{doctor-watchman-XJzT8tK-.mjs → doctor-watchman-Cv1F10Kj.mjs} +40 -23
  51. package/dist/{eas-build-0gadvrca.mjs → eas-build-BomfRnFT.mjs} +53 -20
  52. package/dist/{build-plan-CRjAA6Qi.mjs → eas-fallback-DJwZpy0c.mjs} +26 -208
  53. package/dist/{watchman-CqmaGcIb.mjs → eas-session-ledger-op6A54yi.mjs} +229 -11
  54. package/dist/{error-diagnostics-BhQtoLrZ.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-D5cz5G0k.mjs → gc-_-dCXdyL.mjs} +625 -786
  59. package/dist/git-C3iTsJaZ.mjs +73 -0
  60. package/dist/{guide-DakjcoUt.mjs → guide-Yqwt2bd6.mjs} +990 -280
  61. package/dist/{hosted-android-C-D8Dj0_.mjs → hosted-android-Bw-honsd.mjs} +8 -6
  62. package/dist/{hosted-client--hNFgixu.mjs → hosted-client-DB_gBPfY.mjs} +47 -24
  63. package/dist/{hosted-ios-Chx9XQyI.mjs → hosted-ios-CUvOf4Vr.mjs} +1 -1
  64. package/dist/{hosted-logs-Bkz0Hxzh.mjs → hosted-logs-DL_P5AdN.mjs} +77 -43
  65. package/dist/{hosted-macos-ckTjN-0V.mjs → hosted-macos-QI141yKk.mjs} +21 -15
  66. package/dist/{hosted-native-3KXZ5-qn.mjs → hosted-native-Ksyjgzq-.mjs} +31 -20
  67. package/dist/idle-BVeRGroT.d.mts +24 -0
  68. package/dist/{idle-shutdown-DhAUyf5s.mjs → idle-shutdown-DaKmZi0z.mjs} +11 -10
  69. package/dist/{ios-BDBN-xpf.mjs → ios-CQ68hG9s.mjs} +8 -8
  70. package/dist/{ios-o896T9PE.mjs → ios-CpByZy12.mjs} +141 -81
  71. package/dist/{ios-device-B1B14xND.mjs → ios-device-CXGP1bsD.mjs} +1 -1
  72. package/dist/{ios-device-BWHKGaJq.mjs → ios-device-CwFMehUS.mjs} +60 -35
  73. package/dist/{ios-project-BeOXKPt2.mjs → ios-project-WuwwBdvW.mjs} +13 -13
  74. package/dist/{ios-VGvNdsv2.mjs → ios-qNJt4dFm.mjs} +1 -1
  75. package/dist/ios-signing-DTTIChGs.mjs +489 -0
  76. package/dist/{ios-state-BsXMwo5y.mjs → ios-state-DvFX-K_l.mjs} +1 -1
  77. package/dist/{ios-CQ8bHQXB.mjs → ios-ubFsBzwq.mjs} +129 -86
  78. package/dist/{js-swap-Z_mSuRrx.mjs → js-swap-Cc1dttps.mjs} +60 -33
  79. package/dist/{launch-V1zqiOYn.mjs → launch-CD1yVc7U.mjs} +92 -91
  80. package/dist/{launch-BootbMk4.mjs → launch-Zq2mOSDy.mjs} +87 -545
  81. package/dist/logs-BS00Anxf.mjs +352 -0
  82. package/dist/logs-CMm05HxN.mjs +255 -0
  83. package/dist/macos-B65--pPd.mjs +2 -0
  84. package/dist/{macos-D7irBW3A.mjs → macos-C-0qJ6zq.mjs} +244 -215
  85. package/dist/macos-run.mjs +1 -1
  86. package/dist/maintenance-run.mjs +122 -247
  87. package/dist/{metro-_ZIE3Axg.mjs → metro-DEXpIhHC.mjs} +71 -17
  88. package/dist/{metro-gateway-BzlQZQmU.mjs → metro-gateway-BMJNlj3E.mjs} +20 -12
  89. package/dist/{named-ports-O1TIl7tx.mjs → named-ports-BWTzt6mu.mjs} +8 -64
  90. package/dist/native-android-JACyjTZs.mjs +844 -0
  91. package/dist/{native-gradle-inputs-BQnIdAlL.mjs → native-gradle-inputs-Bep9JcSF.mjs} +128 -147
  92. package/dist/native-inputs-TRTTTRxt.mjs +91 -0
  93. package/dist/native-run-DY_RLx3C.mjs +277 -0
  94. package/dist/{native-runtime-D024BAvm.mjs → native-runtime-Dg1Q7tfF.mjs} +10 -10
  95. package/dist/{native-xcode-inputs-UElfGs59.mjs → native-xcode-inputs-CB2iQeWq.mjs} +28 -20
  96. package/dist/{native-xcode-ios-CjS-nDVY.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 +213 -86
  100. package/dist/{ownership-BrjepDiv.mjs → ownership-DEmM5vhh.mjs} +3 -3
  101. package/dist/{page-Bv9s2KwY.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-BItXET1x.mjs → placement-log-BqGbTa61.mjs} +5 -5
  105. package/dist/{plan-placement-B466UYMU.mjs → plan-placement-Bwj-IjY1.mjs} +6 -6
  106. package/dist/{ports-BFRL6JTj.mjs → ports-D-MmCTdv.mjs} +3 -3
  107. package/dist/prebuild-uD_ipCxF.mjs +449 -0
  108. package/dist/{project-DX8fXyw_.mjs → project-BZNjmW_8.mjs} +65 -38
  109. package/dist/{pull-request-vOhLNmIb.mjs → pull-request-Lfetn8Kr.mjs} +5 -18
  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-CuXM3QS8.mjs → react-native-android-DuzH0cn3.mjs} +83 -53
  114. package/dist/{gradle-CZZo1TSA.mjs → react-native-build-rhk4smwQ.mjs} +292 -15
  115. package/dist/react-native-doctor-CQpuIMso.mjs +234 -0
  116. package/dist/{react-native-ios-DtVO4qf2.mjs → react-native-ios-Bhq1rJeV.mjs} +46 -28
  117. package/dist/{recordings-Bk-VivUV.mjs → recordings-DYteQSu4.mjs} +12 -9
  118. package/dist/{reload-D9V7D8gP.mjs → reload-CmTRFJaX.mjs} +95 -49
  119. package/dist/reload-DzjSl5P_.mjs +2 -0
  120. package/dist/{remote-CZiTijxG.mjs → remote-ByYkXdGD.mjs} +15 -10
  121. package/dist/result-DNiS-tTP.mjs +434 -0
  122. package/dist/{run-ClC8UVB5.mjs → run-D23HmJMs.mjs} +4 -5
  123. package/dist/selection-CSl9i5qU.mjs +619 -0
  124. package/dist/{server-bare-dWjAarki.mjs → server-bare-CxTrvDg8.mjs} +3 -4
  125. package/dist/{server-command-DnJYLnr4.mjs → server-command-CtzloH3v.mjs} +14 -7
  126. package/dist/server-expo-C-90EhcG.mjs +2 -0
  127. package/dist/{server-expo-CUuzP9Mp.mjs → server-expo-DT_F_uVI.mjs} +51 -15
  128. package/dist/{settings-Bbztm4oV.mjs → settings-CsJDEXgK.mjs} +301 -132
  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-ChMfe8rg.mjs → simslim-Cgk17SXV.mjs} +14 -13
  134. package/dist/{slot-launch-CeCRr6MK.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-CRkG-mZ7.mjs → start-7lpH7hmN.mjs} +66 -48
  138. package/dist/{start-mh6bS27z.mjs → start-RChynRDp.mjs} +1 -1
  139. package/dist/{state-lqxdOH_g.mjs → state-C4ZtUisW.mjs} +41 -14
  140. package/dist/{state-BUpAmt2r.mjs → state-XMziexv2.mjs} +3 -2
  141. package/dist/{stats-CaB1MxMi.mjs → stats-53T7OTb9.mjs} +7 -13
  142. package/dist/stats-report-BFfMpWWF.mjs +16 -0
  143. package/dist/{status-C7vzkInu.mjs → status-BL7jVyAB.mjs} +538 -467
  144. package/dist/status-CSi6tlRq.mjs +2 -0
  145. package/dist/{status-BDGHwkCs.mjs → status-DqEUSSxs.mjs} +6 -4
  146. package/dist/{status-watch-ZaVqRdtW.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-BU7JaFCg.mjs → stop-Bk_1qiV6.mjs} +2 -2
  151. package/dist/{stop-BO80KJoT.mjs → stop-CPzlM1L-.mjs} +138 -99
  152. package/dist/{stop-Cftw_sXJ.mjs → stop-D7h6jAXQ.mjs} +11 -10
  153. package/dist/supervisor-run.d.mts +8 -17
  154. package/dist/supervisor-run.mjs +63 -28
  155. package/dist/{support-Ca6PZbpr.mjs → support-67vraa1Q.mjs} +18 -11
  156. package/dist/{support-Co0wk8Cv.mjs → support-Dlu37g6H.mjs} +12 -12
  157. package/dist/{swiftpm-macos-siFSkmCO.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-C0MWBi8O.mjs → trigger-BAahxUPq.mjs} +20 -5
  161. package/dist/trigger-Bf3uDcpv.mjs +2 -0
  162. package/dist/{warm-progress-5FAXkXIg.mjs → warm-progress-BHX5r0Ei.mjs} +252 -176
  163. package/dist/{web-BTjzE8mc.mjs → web-CJmIj6AI.mjs} +18 -13
  164. package/dist/web-DknQETPs.mjs +2 -0
  165. package/dist/web-run.mjs +16 -17
  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-CvgTFe-h.mjs → workspace-state-Cjuigeeu.mjs} +70 -56
  171. package/dist/{workspaces-C4kqIOlx.mjs → workspaces-BccMFmGQ.mjs} +1188 -1080
  172. package/dist/worktree-CK2MpJW5.mjs +2 -0
  173. package/dist/{worktree-DtRsh6go.mjs → worktree-DQ6Zi2Mv.mjs} +368 -110
  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-BaMpUQ4-.mjs +0 -629
  178. package/dist/api-run.mjs +0 -296
  179. package/dist/api-zuX3ynYN.mjs +0 -154
  180. package/dist/app-install-Cg9YJy3x.mjs +0 -873
  181. package/dist/artifact-lifecycle-DzPpBYvK.mjs +0 -30
  182. package/dist/budget-RFbwFpG5.mjs +0 -4109
  183. package/dist/build-facts-DcLv2HSd.d.mts +0 -111
  184. package/dist/client-zqjFd79D.mjs +0 -1779
  185. package/dist/config-D0LhTY3S.mjs +0 -524
  186. package/dist/device-BgNj-qVj.mjs +0 -290
  187. package/dist/device-lease-C309csaB.mjs +0 -1228
  188. package/dist/device-remote-DjsNw8DD.mjs +0 -1272
  189. package/dist/eas-session-ledger-DJDeL4Uq.mjs +0 -205
  190. package/dist/exec-B81Qodjn.mjs +0 -254
  191. package/dist/launch-verify-Dl78EVgR.mjs +0 -428
  192. package/dist/logs-Bh4eqCCc.mjs +0 -384
  193. package/dist/macos-kivF8qKz.mjs +0 -2
  194. package/dist/miss-reason-SuTptY-I.mjs +0 -238
  195. package/dist/native-android-D94RlJ-X.mjs +0 -226
  196. package/dist/ndjson-Du3j0AQ9.d.mts +0 -17
  197. package/dist/plan-Jwu_vr-F.mjs +0 -260
  198. package/dist/prebuild-DB_zLOLc.mjs +0 -213
  199. package/dist/preview-BRLFRhTz.mjs +0 -1004
  200. package/dist/process-identity-Biv3arCO.mjs +0 -40
  201. package/dist/react-native-build-JUF31S8U.mjs +0 -239
  202. package/dist/react-native-doctor-BQHqiXaQ.mjs +0 -78
  203. package/dist/remote-cache-fxcl5C-L.mjs +0 -526
  204. package/dist/result-BrfgXtdO.mjs +0 -186
  205. package/dist/server-expo-Dvkd7JcF.mjs +0 -2
  206. package/dist/settings-BuKMOANA.mjs +0 -402
  207. package/dist/spawn-claims-Kqiifsk2.mjs +0 -72
  208. package/dist/stage-BNKKdDNc.mjs +0 -157
  209. package/dist/stim-desktop-8GQX2OV8.mjs +0 -63
  210. package/dist/tailnet-D7-tE_ug.mjs +0 -265
  211. package/dist/toolchain-B12psPA2.mjs +0 -2
  212. package/dist/toolchain-SqehyPLw.mjs +0 -1657
  213. package/dist/trigger-SHLOWJ4O.mjs +0 -2
  214. package/dist/web-CHN5gh34.mjs +0 -2
  215. package/dist/worktree-Cgnm6vZt.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
package/dist/api-run.mjs DELETED
@@ -1,296 +0,0 @@
1
- import { t as StimError } from "./api-zuX3ynYN.mjs";
2
- import { E as upsertProject, p as getProject, y as refuseRelativeStimPaths } from "./config-D0LhTY3S.mjs";
3
- import { K as resolveProjectSettings, Q as settingShapeErrors, a as SETTING_SHAPE_REMEDY } from "./settings-Bbztm4oV.mjs";
4
- import { i as recordWorkspaceUse, p as ensureWorkspaceStorage, w as workspaceLogsDir$1, x as workspaceDir } from "./workspace-state-CvgTFe-h.mjs";
5
- import { l as phaseLine } from "./command-output-CPDq_90S.mjs";
6
- import { d as projectRegistry } from "./project-DX8fXyw_.mjs";
7
- import { Dt as recordFinishedBuild, Ot as startBuildProgress, kt as tapBuildLog } from "./budget-RFbwFpG5.mjs";
8
- import { S as withNativeBuildRun, x as runCancellationSignal } from "./tailnet-D7-tE_ug.mjs";
9
- import { r as createNdjsonWriter } from "./ndjson-GOnbyvso.mjs";
10
- import { y as resolveBuildPlacement } from "./client-zqjFd79D.mjs";
11
- import { n as macosDir } from "./state-BUpAmt2r.mjs";
12
- import { n as buildAndroidOperation, t as buildIosOperation } from "./build-COBA1tBc.mjs";
13
- import { i as runAndroidOperation } from "./android-CLbBJ2ve.mjs";
14
- import { r as runIosOperation } from "./ios-CQ8bHQXB.mjs";
15
- import { n as runMacos, r as buildMacosBundle } from "./macos-D7irBW3A.mjs";
16
- import { c as stopWorkspaceNow } from "./stop-BO80KJoT.mjs";
17
- import { t as runWeb } from "./web-BTjzE8mc.mjs";
18
- import { mkdirSync, mkdtempSync, realpathSync, rmSync } from "node:fs";
19
- import { join } from "node:path";
20
- import { queryJsonLogs } from "@stim-cli/core/state";
21
- //#region src/commands/macos-build.ts
22
- const note = (line) => console.error(line);
23
- async function buildMacosOperation(root, options) {
24
- if (process.platform !== "darwin") throw new Error("Building a macOS app requires a Mac with Swift installed.");
25
- root = realpathSync(root);
26
- const selected = projectRegistry.selectMacos(root);
27
- if ("problem" in selected) throw Object.assign(new Error(selected.problem.message), {
28
- code: "STIM_NO_PROJECT",
29
- remedy: selected.problem.remedy
30
- });
31
- const { settings } = resolveProjectSettings(root);
32
- const [shape] = settingShapeErrors(settings);
33
- if (shape) throw Object.assign(/* @__PURE__ */ new Error(`${shape} ${SETTING_SHAPE_REMEDY}`), { code: "STIM_BAD_ARG" });
34
- const placement = resolveBuildPlacement(options.remoteBuild);
35
- if (placement.failure) throw Object.assign(new Error(placement.failure.message), placement.failure);
36
- const recipe = (await selected.load()).prepare(settings);
37
- ensureWorkspaceStorage(root);
38
- return withNativeBuildRun(root, {
39
- command: "build",
40
- platform: "macos"
41
- }, async (claim) => {
42
- if (!getProject(root)) upsertProject(root, {});
43
- recordWorkspaceUse(root);
44
- const started = Date.now();
45
- const progress = startBuildProgress({
46
- root,
47
- platform: "macos",
48
- slot: "default",
49
- claim,
50
- note
51
- });
52
- const logs = workspaceLogsDir$1(root);
53
- const writer = tapBuildLog(createNdjsonWriter(join(logs, "build-artifact-macos.ndjson"), { truncate: true }), progress);
54
- const build = {
55
- state: "running",
56
- startedAt: new Date(started).toISOString(),
57
- buildMachine: placement.selected
58
- };
59
- let directory;
60
- let succeeded = false;
61
- try {
62
- const artifacts = join(workspaceDir(root), "artifacts");
63
- mkdirSync(artifacts, { recursive: true });
64
- directory = mkdtempSync(join(artifacts, "macos-"));
65
- const bundle = join(directory, `${recipe.product}.app`);
66
- await buildMacosBundle({
67
- root,
68
- recipe,
69
- bundle,
70
- bundleId: recipe.bundleId,
71
- scratch: join(macosDir(root), "build"),
72
- writer,
73
- note,
74
- progress,
75
- record: build,
76
- buildMachine: placement.selected
77
- });
78
- if (runCancellationSignal()?.aborted) throw Object.assign(/* @__PURE__ */ new Error("The macOS build was cancelled."), { code: "STIM_CANCELLED" });
79
- const executable = realpathSync(join(bundle, "Contents", "MacOS", recipe.product));
80
- build.state = "ok";
81
- succeeded = true;
82
- return {
83
- product: recipe.product,
84
- bundle,
85
- bundleId: recipe.bundleId,
86
- executable,
87
- build,
88
- logs: { dir: logs }
89
- };
90
- } catch (error) {
91
- const failure = runCancellationSignal()?.aborted ? Object.assign(/* @__PURE__ */ new Error("The macOS build was cancelled."), {
92
- code: "STIM_CANCELLED",
93
- cause: error
94
- }) : error;
95
- build.state = "failed";
96
- build.error = failure instanceof Error ? failure.message : String(failure);
97
- build.errorCode = failure.code;
98
- throw failure;
99
- } finally {
100
- build.finishedAt = (/* @__PURE__ */ new Date()).toISOString();
101
- build.durationMs = Date.now() - started;
102
- try {
103
- recordFinishedBuild(root, {
104
- platform: "macos",
105
- status: build.state,
106
- configuration: "Debug",
107
- fingerprint: null,
108
- cacheKey: null,
109
- cacheHit: false,
110
- cacheSkipped: false,
111
- durationMs: build.durationMs,
112
- startedAt: build.startedAt,
113
- errorCode: build.errorCode,
114
- buildMachine: build.buildMachine,
115
- builtOn: build.builtOn,
116
- offloadedTo: build.offloadedTo,
117
- offloadFallback: build.offloadFallback,
118
- compileSteps: progress.steps()
119
- }, { artifactOnly: true });
120
- } catch (error) {
121
- note(phaseLine("state", `could not record the build: ${error?.message || error}`));
122
- } finally {
123
- if (!succeeded && directory) rmSync(directory, {
124
- recursive: true,
125
- force: true
126
- });
127
- writer.close();
128
- progress.clear();
129
- }
130
- }
131
- }, { write: note });
132
- }
133
- //#endregion
134
- //#region src/api-run.ts
135
- async function dispatch({ projectRoot: root, ...request }) {
136
- let directory;
137
- try {
138
- refuseRelativeStimPaths();
139
- directory = workspaceLogsDir$1(root);
140
- if (request.operation === "diagnostics") {
141
- const { tail = 200, errors = false } = request.options;
142
- return {
143
- ok: true,
144
- result: {
145
- directory,
146
- records: tail === 0 ? [] : queryJsonLogs({
147
- dir: directory,
148
- tail,
149
- errorsOnly: errors
150
- })
151
- }
152
- };
153
- }
154
- if (request.operation === "stop") {
155
- const result = await stopWorkspaceNow({
156
- root,
157
- slot: request.options.slot
158
- });
159
- if ("refusal" in result) throw new StimError({
160
- ...result.refusal,
161
- details: result.remote
162
- });
163
- return {
164
- ok: true,
165
- result
166
- };
167
- }
168
- if (request.operation === "build") switch (request.options.platform) {
169
- case "ios": return {
170
- ok: true,
171
- result: {
172
- platform: "ios",
173
- facts: await buildIosOperation(root, request.options)
174
- }
175
- };
176
- case "android": return {
177
- ok: true,
178
- result: {
179
- platform: "android",
180
- facts: await buildAndroidOperation(root, request.options)
181
- }
182
- };
183
- case "macos": return {
184
- ok: true,
185
- result: {
186
- platform: "macos",
187
- facts: await buildMacosOperation(root, request.options)
188
- }
189
- };
190
- default: throw new StimError({
191
- code: "STIM_BAD_ARG",
192
- message: "Unknown Stim build platform."
193
- });
194
- }
195
- const options = request.options;
196
- switch (options.platform) {
197
- case "ios": {
198
- let error;
199
- const result = await runIosOperation(root, options, {}, (failure) => {
200
- error = failure;
201
- });
202
- if (!result) throw new StimError({
203
- code: error?.code ?? "STIM_RUN_FAILED",
204
- message: error?.message ?? "The iOS run failed.",
205
- remedy: error?.remedy,
206
- details: error
207
- });
208
- return {
209
- ok: true,
210
- result: {
211
- platform: "ios",
212
- facts: result.facts
213
- }
214
- };
215
- }
216
- case "android": {
217
- const result = await runAndroidOperation(root, options);
218
- if (!result.ok || !result.facts) throw new StimError({
219
- code: result.error?.code ?? "STIM_RUN_FAILED",
220
- message: result.error?.message ?? "The Android run failed.",
221
- remedy: result.error?.remedy
222
- });
223
- return {
224
- ok: true,
225
- result: {
226
- platform: "android",
227
- facts: result.facts
228
- }
229
- };
230
- }
231
- case "macos": {
232
- const record = await runMacos(root, console.error, void 0, options.remoteBuild);
233
- return {
234
- ok: true,
235
- result: {
236
- platform: "macos",
237
- facts: {
238
- product: record.product,
239
- bundle: record.bundle,
240
- bundleId: record.bundleId,
241
- executable: record.executable,
242
- pid: record.app?.pid ?? null,
243
- launched: record.app !== void 0,
244
- build: record.build,
245
- logs: { dir: directory }
246
- }
247
- }
248
- };
249
- }
250
- case "web": {
251
- const result = await runWeb({
252
- root,
253
- headed: options.headed ?? false,
254
- note: console.error
255
- });
256
- if (!result.ok) throw new StimError(result.error);
257
- return {
258
- ok: true,
259
- result: {
260
- platform: "web",
261
- facts: result.facts
262
- }
263
- };
264
- }
265
- default: throw new StimError({
266
- code: "STIM_BAD_ARG",
267
- message: "Unknown Stim platform."
268
- });
269
- }
270
- } catch (error) {
271
- const failure = error;
272
- return {
273
- ok: false,
274
- error: {
275
- code: failure.code ?? "STIM_RUN_FAILED",
276
- message: error instanceof Error ? error.message : String(error),
277
- remedy: failure.remedy ?? null,
278
- details: {
279
- logs: directory,
280
- cause: failure.details
281
- }
282
- }
283
- };
284
- }
285
- }
286
- function interrupt() {
287
- if (!process.emit("SIGINT")) process.exit(130);
288
- }
289
- process.once("disconnect", interrupt);
290
- process.on("message", async (request) => {
291
- if (request.operation === "cancel") return interrupt();
292
- const response = await dispatch(request);
293
- process.send?.(response, () => process.exit(response.ok ? 0 : 1));
294
- });
295
- //#endregion
296
- export {};
@@ -1,154 +0,0 @@
1
- import { t as getExecutor } from "./exec-B81Qodjn.mjs";
2
- import { t as spawnEntry } from "./spawn-entry-Dcb7sDUz.mjs";
3
- import { realpathSync } from "node:fs";
4
- import { isAbsolute } from "node:path";
5
- //#region src/api.ts
6
- var StimError = class extends Error {
7
- code;
8
- remedy;
9
- details;
10
- constructor({ code, message, remedy = null, details }) {
11
- super(message);
12
- this.name = "StimError";
13
- this.code = code;
14
- this.remedy = remedy;
15
- this.details = details;
16
- }
17
- };
18
- /**
19
- * Creates a client without starting processes or changing the caller's cwd, environment, or signal handlers.
20
- * Each operation runs in a separate Stim worker. Resources remain workspace-owned until stop() is called.
21
- */
22
- function createStim(options) {
23
- let projectRoot;
24
- try {
25
- projectRoot = realpathSync(options.projectRoot);
26
- } catch (error) {
27
- throw new StimError({
28
- code: "STIM_NO_PROJECT",
29
- message: `Could not resolve projectRoot ${options.projectRoot}: ${error instanceof Error ? error.message : String(error)}`,
30
- remedy: "Pass the path to an existing, readable app directory."
31
- });
32
- }
33
- for (const [name, path] of [["home", options.home], ["buildCache", options.buildCache]]) if (path !== void 0 && !isAbsolute(path)) throw new StimError({
34
- code: "STIM_BAD_ARG",
35
- message: `${name} must be an absolute path.`
36
- });
37
- const context = {
38
- ...options,
39
- projectRoot,
40
- env: {
41
- ...process.env,
42
- ...options.home === void 0 ? {} : { STIM_HOME: options.home },
43
- ...options.buildCache === void 0 ? {} : { STIM_BUILD_CACHE: options.buildCache },
44
- FORCE_COLOR: "0"
45
- }
46
- };
47
- return {
48
- projectRoot,
49
- build: (({ signal, ...request }) => invoke(context, {
50
- operation: "build",
51
- options: request
52
- }, signal)),
53
- run: (({ signal, ...request }) => invoke(context, {
54
- operation: "run",
55
- options: request
56
- }, signal)),
57
- stop({ signal, ...request } = {}) {
58
- return invoke(context, {
59
- operation: "stop",
60
- options: request
61
- }, signal);
62
- },
63
- diagnostics({ signal, ...request } = {}) {
64
- if (request.tail !== void 0 && (!Number.isSafeInteger(request.tail) || request.tail < 0)) return Promise.reject(new StimError({
65
- code: "STIM_BAD_ARG",
66
- message: "tail must be a non-negative integer."
67
- }));
68
- return invoke(context, {
69
- operation: "diagnostics",
70
- options: request
71
- }, signal);
72
- }
73
- };
74
- }
75
- function cancelled() {
76
- return new StimError({
77
- code: "STIM_CANCELLED",
78
- message: "The Stim operation was cancelled."
79
- });
80
- }
81
- function invoke(context, request, signal) {
82
- if (signal?.aborted) return Promise.reject(cancelled());
83
- return new Promise((resolve, reject) => {
84
- const child = getExecutor().spawn(process.execPath, [spawnEntry("api-run")], {
85
- cwd: context.projectRoot,
86
- env: context.env,
87
- stdio: [
88
- "ignore",
89
- "pipe",
90
- "pipe",
91
- "ipc"
92
- ]
93
- });
94
- let response;
95
- let transportError;
96
- let callbackError;
97
- let callbackFailed = false;
98
- let stderr = "";
99
- const abort = () => {
100
- child.send?.({ operation: "cancel" }, (error) => {
101
- if (error) child.kill("SIGINT");
102
- });
103
- };
104
- signal?.addEventListener("abort", abort, { once: true });
105
- if (signal?.aborted) abort();
106
- const progress = (stream, message) => {
107
- if (stream === "stderr") stderr = (stderr + message).slice(-16384);
108
- if (!context.onProgress || callbackFailed) return;
109
- try {
110
- context.onProgress({
111
- stream,
112
- message
113
- });
114
- } catch (error) {
115
- callbackError = error;
116
- callbackFailed = true;
117
- abort();
118
- }
119
- };
120
- child.stdout?.setEncoding("utf8").on("data", (chunk) => progress("stdout", chunk));
121
- child.stderr?.setEncoding("utf8").on("data", (chunk) => progress("stderr", chunk));
122
- child.on("message", (message) => {
123
- response = message;
124
- });
125
- child.on("error", (error) => {
126
- transportError = error;
127
- });
128
- child.on("close", (code, exitSignal) => {
129
- signal?.removeEventListener("abort", abort);
130
- if (callbackFailed) return reject(callbackError);
131
- if (signal?.aborted) return reject(cancelled());
132
- if (transportError) return reject(new StimError({
133
- code: "STIM_WORKER_FAILED",
134
- message: transportError.message,
135
- details: { stderr }
136
- }));
137
- if (response?.ok === false) return reject(new StimError(response.error));
138
- if (code === 0 && response?.ok) return resolve(response.result);
139
- reject(new StimError({
140
- code: "STIM_WORKER_FAILED",
141
- message: `Stim worker exited without a result (${exitSignal ?? code}).`,
142
- details: { stderr }
143
- }));
144
- });
145
- child.send?.({
146
- ...request,
147
- projectRoot: context.projectRoot
148
- }, (error) => {
149
- if (error) transportError = error;
150
- });
151
- });
152
- }
153
- //#endregion
154
- export { createStim as n, StimError as t };