stim 1.19.0 → 1.20.1

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 (172) hide show
  1. package/README.md +20 -3
  2. package/dist/{activity-BSw0x84R.mjs → activity-BaMpUQ4-.mjs} +3 -3
  3. package/dist/{agent-device-usage-output-Bjxu_VmX.mjs → agent-device-usage-output-VPaOgGaF.mjs} +7 -7
  4. package/dist/android-CLbBJ2ve.mjs +1258 -0
  5. package/dist/{android-DE5g_5gv.mjs → android-CZh6ElG5.mjs} +2 -2
  6. package/dist/{android-BdQC6zs1.mjs → android-DE8-JfGW.mjs} +105 -47
  7. package/dist/{android-cas-C87geAg-.mjs → android-cas-BFpS84v2.mjs} +9 -5
  8. package/dist/android-cas-compiler.mjs +1 -1
  9. package/dist/android-eXfIjKJr.mjs +6 -0
  10. package/dist/api-run.mjs +159 -8
  11. package/dist/{api-DIf_s86s.mjs → api-zuX3ynYN.mjs} +5 -1
  12. package/dist/api.d.mts +98 -4
  13. package/dist/api.mjs +1 -1
  14. package/dist/{app-install-CFI4ptUL.mjs → app-install-Cg9YJy3x.mjs} +9 -8
  15. package/dist/artifact-Ctb2jpw6.mjs +807 -0
  16. package/dist/artifact-DXk_Fle_.mjs +772 -0
  17. package/dist/artifact-lifecycle-DzPpBYvK.mjs +30 -0
  18. package/dist/{browser-web-CDhqQxhv.mjs → browser-web-xQWC2RWl.mjs} +19 -19
  19. package/dist/{budget-Dz-kyXLv.mjs → budget-RFbwFpG5.mjs} +3101 -3062
  20. package/dist/build-COBA1tBc.mjs +462 -0
  21. package/dist/{build-facts-B87vo-Im.d.mts → build-facts-DcLv2HSd.d.mts} +1 -32
  22. package/dist/build-plan-CRjAA6Qi.mjs +553 -0
  23. package/dist/{cache-manifest-DiwKSyv9.mjs → cache-manifest-qA3dT2x2.mjs} +1 -1
  24. package/dist/cache-manifest.mjs +1 -1
  25. package/dist/{manifest-CX0d1IkZ.mjs → ccache-CtbqWxIC.mjs} +13 -19
  26. package/dist/{chrome-BTUOo8p2.mjs → chrome-Dp2lMLBe.mjs} +1 -1
  27. package/dist/{cli-C9Zvgbdc.mjs → cli-sGqlPu1n.mjs} +20 -20
  28. package/dist/cli.mjs +1 -1
  29. package/dist/{client-CuUo8Nvg.mjs → client-zqjFd79D.mjs} +89 -307
  30. package/dist/collector-run.d.mts +4 -0
  31. package/dist/collector-run.mjs +7 -7
  32. package/dist/{command-output-Bt8ygHE7.mjs → command-output-CPDq_90S.mjs} +2 -2
  33. package/dist/{config-DC5jEtd1.mjs → config-D0LhTY3S.mjs} +8 -12
  34. package/dist/{created-devices-D0s26Hx5.mjs → created-devices-CXBMtoj5.mjs} +7 -6
  35. package/dist/{dependency-state-DKaS1OM9.mjs → dependency-state-B2m8eqsS.mjs} +2 -2
  36. package/dist/{detached-entry-pB_IPfV4.mjs → detached-entry-BXq4fIl-.mjs} +1 -1
  37. package/dist/{dev-client-CDY_zAmD.mjs → dev-client-BqYjMIaC.mjs} +2 -2
  38. package/dist/{device-BHw0WlHl.mjs → device-BgNj-qVj.mjs} +8 -8
  39. package/dist/device-D4DqjSZZ.mjs +727 -0
  40. package/dist/{device-capacity-BoN1jQkO.mjs → device-capacity-DrwHwR97.mjs} +13 -14
  41. package/dist/device-host-worker.mjs +38 -18
  42. package/dist/device-ios-DE8KJd3b.mjs +413 -0
  43. package/dist/{device-lease-Cu7PtQpZ.mjs → device-lease-C309csaB.mjs} +138 -24
  44. package/dist/{device-lease-run-D38SnZtt.mjs → device-lease-run-Baelt3nc.mjs} +4 -4
  45. package/dist/{device-pool-CP4rAsHx.mjs → device-pool-DtK9S6AD.mjs} +3 -3
  46. package/dist/{device-remote-B5GiUifk.mjs → device-remote-DjsNw8DD.mjs} +17 -68
  47. package/dist/doctor-DiP9HsIP.mjs +515 -0
  48. package/dist/{doctor-PRJH94v6.mjs → doctor-Dunu3Nv1.mjs} +333 -744
  49. package/dist/{doctor-watchman-wZhyTdp4.mjs → doctor-watchman-XJzT8tK-.mjs} +15 -13
  50. package/dist/{simslim-D9LkJxIO.mjs → eas-build-0gadvrca.mjs} +6 -152
  51. package/dist/{stim-installations-DbmUjsLv.mjs → eas-session-ledger-DJDeL4Uq.mjs} +57 -4
  52. package/dist/{error-diagnostics--v5HGOU0.mjs → error-diagnostics-BhQtoLrZ.mjs} +17 -12
  53. package/dist/errors-DzkMYh8Q.mjs +205 -0
  54. package/dist/{exec-i8GDPwq9.mjs → exec-B81Qodjn.mjs} +40 -10
  55. package/dist/{gc-CyHMcKcn.mjs → gc-D5cz5G0k.mjs} +22 -21
  56. package/dist/{device-ios-B2ruohE-.mjs → gradle-CZZo1TSA.mjs} +21 -650
  57. package/dist/{guide-dRaQJJk9.mjs → guide-DakjcoUt.mjs} +503 -251
  58. package/dist/{hosted-android-Bs7fytj7.mjs → hosted-android-C-D8Dj0_.mjs} +5 -5
  59. package/dist/{hosted-client-C5G4h_OJ.mjs → hosted-client--hNFgixu.mjs} +9 -3
  60. package/dist/{hosted-ios-Bik035eL.mjs → hosted-ios-Chx9XQyI.mjs} +3 -3
  61. package/dist/{hosted-logs-CI9Az9a4.mjs → hosted-logs-Bkz0Hxzh.mjs} +8 -8
  62. package/dist/{hosted-macos-DABm3ScO.mjs → hosted-macos-ckTjN-0V.mjs} +7 -6
  63. package/dist/{hosted-native-DbV2aUVw.mjs → hosted-native-3KXZ5-qn.mjs} +17 -14
  64. package/dist/{idle-shutdown-DYiMBn34.mjs → idle-shutdown-DhAUyf5s.mjs} +7 -7
  65. package/dist/{ios-DYUr9LGc.mjs → ios-BDBN-xpf.mjs} +8 -7
  66. package/dist/ios-CQ8bHQXB.mjs +1112 -0
  67. package/dist/{ios-DCrkgXEM.mjs → ios-VGvNdsv2.mjs} +1 -1
  68. package/dist/{ios-device-CrW8aMb5.mjs → ios-device-B1B14xND.mjs} +1 -1
  69. package/dist/{ios-device-CJ_ZOGky.mjs → ios-device-BWHKGaJq.mjs} +3 -3
  70. package/dist/{ios-BWbHFZVz.mjs → ios-o896T9PE.mjs} +195 -35
  71. package/dist/ios-project-BeOXKPt2.mjs +197 -0
  72. package/dist/{ios-state-By0XuLTQ.mjs → ios-state-BsXMwo5y.mjs} +1 -1
  73. package/dist/js-swap-Z_mSuRrx.mjs +432 -0
  74. package/dist/{react-native-ios-CSpIxexZ.mjs → launch-BootbMk4.mjs} +59 -612
  75. package/dist/launch-V1zqiOYn.mjs +745 -0
  76. package/dist/{launch-verify-DCveSE6d.mjs → launch-verify-Dl78EVgR.mjs} +26 -7
  77. package/dist/{logs-Bao1HOMy.mjs → logs-Bh4eqCCc.mjs} +11 -11
  78. package/dist/{macos-ciyBdTY5.mjs → macos-D7irBW3A.mjs} +42 -50
  79. package/dist/macos-kivF8qKz.mjs +2 -0
  80. package/dist/macos-run.mjs +1 -1
  81. package/dist/maintenance-run.mjs +13 -10
  82. package/dist/{metro-DI2AjPF_.mjs → metro-_ZIE3Axg.mjs} +18 -5
  83. package/dist/{metro-gateway-BxpJLIwh.mjs → metro-gateway-BzlQZQmU.mjs} +2 -2
  84. package/dist/miss-reason-SuTptY-I.mjs +238 -0
  85. package/dist/{named-ports-B4iWH4E-.mjs → named-ports-O1TIl7tx.mjs} +3 -3
  86. package/dist/native-android-D94RlJ-X.mjs +226 -0
  87. package/dist/native-gradle-inputs-BQnIdAlL.mjs +356 -0
  88. package/dist/{native-runtime-BGxsbfny.mjs → native-runtime-D024BAvm.mjs} +9 -8
  89. package/dist/native-xcode-inputs-UElfGs59.mjs +306 -0
  90. package/dist/native-xcode-ios-CjS-nDVY.mjs +434 -0
  91. package/dist/{ndjson-LGZAMsqa.mjs → ndjson-GOnbyvso.mjs} +6 -6
  92. package/dist/offload-worker.d.mts +41 -7
  93. package/dist/offload-worker.mjs +409 -74
  94. package/dist/{ownership-EB0ySdGK.mjs → ownership-BrjepDiv.mjs} +2 -2
  95. package/dist/{placement-log-Dxe34rJm.mjs → placement-log-BItXET1x.mjs} +1 -1
  96. package/dist/plan-Jwu_vr-F.mjs +260 -0
  97. package/dist/plan-placement-B466UYMU.mjs +73 -0
  98. package/dist/{ports-ByPc0_97.mjs → ports-BFRL6JTj.mjs} +3 -3
  99. package/dist/{prebuild-BKJ3wJI1.mjs → prebuild-DB_zLOLc.mjs} +4 -4
  100. package/dist/{preview-BbSottmO.mjs → preview-BRLFRhTz.mjs} +50 -32
  101. package/dist/project-DX8fXyw_.mjs +1131 -0
  102. package/dist/project-plan-BPwbLwQu.mjs +10 -0
  103. package/dist/{pull-request-IHNdMnG8.mjs → pull-request-vOhLNmIb.mjs} +1 -1
  104. package/dist/pull-requests.mjs +1 -1
  105. package/dist/react-native-android-CuXM3QS8.mjs +921 -0
  106. package/dist/react-native-build-JUF31S8U.mjs +239 -0
  107. package/dist/react-native-doctor-BQHqiXaQ.mjs +78 -0
  108. package/dist/react-native-ios-DtVO4qf2.mjs +595 -0
  109. package/dist/{recordings-Bv8McZN4.mjs → recordings-Bk-VivUV.mjs} +1 -1
  110. package/dist/{reload-rAPdqeRR.mjs → reload-D9V7D8gP.mjs} +17 -13
  111. package/dist/remote-CZiTijxG.mjs +192 -0
  112. package/dist/{remote-cache-N3hAEaAL.mjs → remote-cache-fxcl5C-L.mjs} +5 -5
  113. package/dist/result-BrfgXtdO.mjs +186 -0
  114. package/dist/{run-lAkle1-c.mjs → run-ClC8UVB5.mjs} +3 -3
  115. package/dist/{server-bare-CkIjnegq.mjs → server-bare-dWjAarki.mjs} +5 -5
  116. package/dist/server-command-DnJYLnr4.mjs +69 -0
  117. package/dist/{server-expo-n3tUi3Em.mjs → server-expo-CUuzP9Mp.mjs} +107 -82
  118. package/dist/server-expo-Dvkd7JcF.mjs +2 -0
  119. package/dist/{settings-CxgngUZk.mjs → settings-Bbztm4oV.mjs} +179 -129
  120. package/dist/{settings-2am7TSxp.mjs → settings-BuKMOANA.mjs} +6 -6
  121. package/dist/{state-lKh8shBp.d.mts → settings-vk3mJGSm.d.mts} +4 -2
  122. package/dist/settings.schema.json +84 -0
  123. package/dist/simslim-ChMfe8rg.mjs +149 -0
  124. package/dist/{slot-launch-HV_KtPIw.mjs → slot-launch-CeCRr6MK.mjs} +6 -6
  125. package/dist/{stage-BgaZJVZY.mjs → stage-BNKKdDNc.mjs} +6 -3
  126. package/dist/{start-DtxthMfI.mjs → start-CRkG-mZ7.mjs} +97 -68
  127. package/dist/start-mh6bS27z.mjs +2 -0
  128. package/dist/{state-Tp4uImDS.mjs → state-BUpAmt2r.mjs} +1 -1
  129. package/dist/{state-D2KtnALG.mjs → state-lqxdOH_g.mjs} +32 -12
  130. package/dist/{stats-8EJ5ivFT.mjs → stats-CaB1MxMi.mjs} +5 -5
  131. package/dist/{status-BEeL6IKz.mjs → status-BDGHwkCs.mjs} +3 -1
  132. package/dist/{status-BOyp0CUl.mjs → status-C7vzkInu.mjs} +81 -293
  133. package/dist/status-watch-ZaVqRdtW.mjs +296 -0
  134. package/dist/{stim-desktop-C65jk_q2.mjs → stim-desktop-8GQX2OV8.mjs} +1 -1
  135. package/dist/{stop-zDlknFoz.mjs → stop-BO80KJoT.mjs} +21 -20
  136. package/dist/{stop-DRipAg-e.mjs → stop-BU7JaFCg.mjs} +2 -2
  137. package/dist/{stop-D0UIpZuh.mjs → stop-Cftw_sXJ.mjs} +5 -5
  138. package/dist/supervisor-run.d.mts +7 -2
  139. package/dist/supervisor-run.mjs +32 -20
  140. package/dist/{support-DsNaFg6D.mjs → support-Ca6PZbpr.mjs} +17 -7
  141. package/dist/{support-CNqYkV0y.mjs → support-Co0wk8Cv.mjs} +61 -8
  142. package/dist/{swiftpm-macos-aJzPAj1t.mjs → swiftpm-macos-siFSkmCO.mjs} +5 -5
  143. package/dist/tailnet-D7-tE_ug.mjs +265 -0
  144. package/dist/toolchain-B12psPA2.mjs +2 -0
  145. package/dist/{toolchain-C3xSoyUl.mjs → toolchain-SqehyPLw.mjs} +206 -53
  146. package/dist/{trigger-CAhmG-4s.mjs → trigger-C0MWBi8O.mjs} +2 -2
  147. package/dist/trigger-SHLOWJ4O.mjs +2 -0
  148. package/dist/{warm-progress-pFLB2e6P.mjs → warm-progress-5FAXkXIg.mjs} +6 -6
  149. package/dist/{watchman-BL1IdOtq.mjs → watchman-CqmaGcIb.mjs} +6 -6
  150. package/dist/{web-DbbrPUn0.mjs → web-BTjzE8mc.mjs} +9 -13
  151. package/dist/web-CHN5gh34.mjs +2 -0
  152. package/dist/web-run.mjs +10 -10
  153. package/dist/{workspace-state-CR9X86xJ.mjs → workspace-state-CvgTFe-h.mjs} +36 -36
  154. package/dist/{workspaces-Djb2gfi9.mjs → workspaces-C4kqIOlx.mjs} +1260 -1258
  155. package/dist/worktree-Cgnm6vZt.mjs +2 -0
  156. package/dist/{worktree-BL4M1rhB.mjs → worktree-DtRsh6go.mjs} +86 -50
  157. package/package.json +6 -5
  158. package/shim/native-android.gradle +101 -0
  159. package/dist/android-BXc6BmEi.mjs +0 -3732
  160. package/dist/android-BvV1gGdN.mjs +0 -4
  161. package/dist/ios-ITYno9rO.mjs +0 -2241
  162. package/dist/macos-nIOATJmR.mjs +0 -2
  163. package/dist/metro-store-BAHFcJm6.mjs +0 -106
  164. package/dist/miss-reason-CjQCOKqq.mjs +0 -1743
  165. package/dist/plan-placement-BVY59qa8.mjs +0 -290
  166. package/dist/project-B5eQ1USs.mjs +0 -612
  167. package/dist/react-native-ios-BMh2i25I.mjs +0 -2
  168. package/dist/server-expo-DGsdUGX2.mjs +0 -2
  169. package/dist/start-D8NbxNBb.mjs +0 -2
  170. package/dist/trigger-CoalsMTV.mjs +0 -2
  171. package/dist/web-DFpFeZu5.mjs +0 -2
  172. package/dist/worktree-DV-A0LNL.mjs +0 -2
@@ -1,5 +1,5 @@
1
- import { t as getExecutor } from "./exec-i8GDPwq9.mjs";
2
- import { u as androidToolCwd } from "./android-BdQC6zs1.mjs";
1
+ import { t as getExecutor } from "./exec-B81Qodjn.mjs";
2
+ import { u as androidToolCwd } from "./android-DE8-JfGW.mjs";
3
3
  //#region src/collector/android.ts
4
4
  const LEVEL_BY_LETTER = {
5
5
  V: "debug",
@@ -1,23 +1,40 @@
1
1
  import { n as ownership_claim_exports, t as process_identity_exports } from "./process-identity-Biv3arCO.mjs";
2
- import { t as getExecutor } from "./exec-i8GDPwq9.mjs";
3
- import { C as saveConfig, D as withConfigLock$1, H as projectDeviceSlots, I as assignSlotDevice, U as removeSlotDevice, _ as loadConfig$1, c as ensureConfig, d as getConfigDir, f as getConfigPath$1, z as deviceSlotPlatforms } from "./config-DC5jEtd1.mjs";
4
- import { s as androidDataPartitionSizeBytes } from "./settings-CxgngUZk.mjs";
5
- import { d as signalProcessTree, s as pidExists } from "./metro-DI2AjPF_.mjs";
6
- import { n as readCreatedDevices$1, r as recordCreatedDevice, t as forgetCreatedDevice } from "./created-devices-D0s26Hx5.mjs";
7
- import { n as settingDefault, r as stimDesktopInstalled, t as STIM_DESKTOP_OPEN_OPTIONS } from "./stim-desktop-C65jk_q2.mjs";
2
+ import { t as getExecutor } from "./exec-B81Qodjn.mjs";
3
+ import { C as saveConfig, D as withConfigLock$1, H as projectDeviceSlots, I as assignSlotDevice, U as removeSlotDevice, _ as loadConfig$1, c as ensureConfig, d as getConfigDir, f as getConfigPath$1, z as deviceSlotPlatforms } from "./config-D0LhTY3S.mjs";
4
+ import { c as androidDataPartitionSizeBytes } from "./settings-Bbztm4oV.mjs";
5
+ import { n as settingDefault, r as stimDesktopInstalled, t as STIM_DESKTOP_OPEN_OPTIONS } from "./stim-desktop-8GQX2OV8.mjs";
6
+ import { n as readCreatedDevices$1, r as recordCreatedDevice, t as forgetCreatedDevice } from "./created-devices-CXBMtoj5.mjs";
7
+ import { d as signalProcessTree, s as pidExists } from "./metro-_ZIE3Axg.mjs";
8
8
  import { join } from "node:path";
9
9
  import { dirname as dirname$1, isAbsolute as isAbsolute$1, join as join$1, resolve as resolve$1 } from "path";
10
- import { ANDROID_EMULATOR_APPS, getParkedMax, loadConfig, settingDefinition } from "@stim-cli/core/state";
11
- import { isDeepStrictEqual } from "node:util";
10
+ import { ANDROID_EMULATOR_APPS, getParkedMax, isJsonObject, loadConfig, settingDefinition } from "@stim-cli/core/state";
12
11
  import { existsSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "fs";
13
12
  import { homedir, tmpdir } from "os";
13
+ import { isDeepStrictEqual } from "node:util";
14
+ //#region src/devices/android-emulator-viewer.ts
15
+ function configuredAndroidEmulatorApp(platform = process.platform) {
16
+ const value = loadConfig$1()?.androidEmulatorApp ?? settingDefault(settingDefinition("androidEmulatorApp"), () => stimDesktopInstalled(platform)).value;
17
+ if (ANDROID_EMULATOR_APPS.includes(value)) return value;
18
+ const error = /* @__PURE__ */ new Error("Invalid androidEmulatorApp in machine config. Use \"emulator\" or \"stim-desktop\".");
19
+ Object.assign(error, { code: "STIM_BAD_ARG" });
20
+ throw error;
21
+ }
22
+ function openEmulatorInStimDesktop(serial) {
23
+ getExecutor().runFileQuiet("open", [
24
+ "-g",
25
+ "-a",
26
+ "Stim",
27
+ `stim-desktop://open?serial=${serial}`
28
+ ], STIM_DESKTOP_OPEN_OPTIONS);
29
+ }
30
+ //#endregion
14
31
  //#region src/devices/sim-pool.ts
15
32
  const POOL_SETTING_REMEDY = "Run `stim guide settings` for the device pool bounds and where it can be set.";
16
33
  function parkedMaxSetting(platform, options = {}) {
17
34
  return getParkedMax(platform, options);
18
35
  }
19
36
  function isParkedRecord(value, platform) {
20
- if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
37
+ if (!isJsonObject(value)) return false;
21
38
  const record = value;
22
39
  return typeof record.udid === "string" && typeof record.name === "string" && record.name.startsWith("stim-") && typeof record.parkedAt === "string" && (platform === "android" ? record.udid === record.name && /^stim-[A-Za-z0-9._-]+$/.test(record.name) && typeof record.systemImage === "string" && typeof record.configuration === "string" && (record.packageName === void 0 || typeof record.packageName === "string") && (record.cacheKey === void 0 || typeof record.cacheKey === "string") : typeof record.deviceTypeIdentifier === "string" && typeof record.runtimeIdentifier === "string" && typeof record.simslimManaged === "boolean" && (record.bundleId === void 0 || typeof record.bundleId === "string") && (record.cacheKey === void 0 || typeof record.cacheKey === "string") && (record.schemeApprovals === void 0 || Array.isArray(record.schemeApprovals) && record.schemeApprovals.every((v) => typeof v === "string")));
23
40
  }
@@ -230,23 +247,6 @@ function isStimOwnedAvd(name) {
230
247
  return name.startsWith("stim-") && isStimOwnedDevice("android", name);
231
248
  }
232
249
  //#endregion
233
- //#region src/devices/android-emulator-viewer.ts
234
- function configuredAndroidEmulatorApp(platform = process.platform) {
235
- const value = loadConfig$1()?.androidEmulatorApp ?? settingDefault(settingDefinition("androidEmulatorApp"), () => stimDesktopInstalled(platform)).value;
236
- if (ANDROID_EMULATOR_APPS.includes(value)) return value;
237
- const error = /* @__PURE__ */ new Error("Invalid androidEmulatorApp in machine config. Use \"emulator\" or \"stim-desktop\".");
238
- Object.assign(error, { code: "STIM_BAD_ARG" });
239
- throw error;
240
- }
241
- function openEmulatorInStimDesktop(serial) {
242
- getExecutor().runFileQuiet("open", [
243
- "-g",
244
- "-a",
245
- "Stim",
246
- `stim-desktop://open?serial=${serial}`
247
- ], STIM_DESKTOP_OPEN_OPTIONS);
248
- }
249
- //#endregion
250
250
  //#region src/devices/android.ts
251
251
  const ANDROID_ABIS = /* @__PURE__ */ new Set([
252
252
  "armeabi-v7a",
@@ -334,10 +334,6 @@ function findBuildTool(tools, { home = androidHome(), readDir = readdirSync, exi
334
334
  }
335
335
  return null;
336
336
  }
337
- function androidTool(tool) {
338
- const resolved = androidToolPath(tool);
339
- return resolved === tool ? tool : `"${resolved}"`;
340
- }
341
337
  function listInstalledSystemImages(onUnreadable) {
342
338
  const root = join$1(androidHome(), "system-images");
343
339
  const images = [];
@@ -504,7 +500,12 @@ const AVDMANAGER_DELETE_TIMEOUT_MS = 12e4;
504
500
  function deleteAvd(avdName) {
505
501
  if (!isStimOwnedAvd(avdName)) throw new Error(`Refusing to delete AVD "${avdName}": not a Stim-owned AVD; Stim has no record of creating it.`);
506
502
  const root = process.env.ANDROID_AVD_HOME ? void 0 : avdStorageRoots().find((candidate) => avdPathExists(join$1(candidate, `${avdName}.ini`)));
507
- getExecutor().run(`${androidTool("avdmanager")} delete avd -n "${avdName}"`, {
503
+ getExecutor().runFile(androidToolPath("avdmanager"), [
504
+ "delete",
505
+ "avd",
506
+ "-n",
507
+ avdName
508
+ ], {
508
509
  timeoutMs: AVDMANAGER_DELETE_TIMEOUT_MS,
509
510
  killSignal: "SIGKILL",
510
511
  ...root ? { env: { ANDROID_AVD_HOME: root } } : {}
@@ -553,7 +554,10 @@ function parseAdbDevices(text) {
553
554
  };
554
555
  }
555
556
  function listAvds({ timeoutMs } = {}) {
556
- return parseAvdList(getExecutor().run(`${androidTool("emulator")} -list-avds`, { timeoutMs }));
557
+ return parseAvdList(getExecutor().runFile(androidToolPath("emulator"), ["-list-avds"], {
558
+ timeoutMs,
559
+ killSignal: "SIGKILL"
560
+ }));
557
561
  }
558
562
  /**
559
563
  * Working directory for the adb client and the emulator Stim starts. Both leave processes behind
@@ -567,8 +571,9 @@ function androidToolCwd(platform = process.platform) {
567
571
  return platform === "win32" ? homedir() : void 0;
568
572
  }
569
573
  function listAdbDevices({ timeoutMs, platform = process.platform } = {}) {
570
- return parseAdbDevices(getExecutor().run(`${androidTool("adb")} devices`, {
574
+ return parseAdbDevices(getExecutor().runFile(androidToolPath("adb"), ["devices"], {
571
575
  timeoutMs,
576
+ killSignal: "SIGKILL",
572
577
  cwd: androidToolCwd(platform)
573
578
  }));
574
579
  }
@@ -997,7 +1002,7 @@ function parseEmulatorVersion(text) {
997
1002
  return match ? Number(match[1]) : null;
998
1003
  }
999
1004
  function emulatorMajorVersion() {
1000
- return parseEmulatorVersion(getExecutor().runQuiet(`${androidTool("emulator")} -version`, { timeoutMs: 1e4 }));
1005
+ return parseEmulatorVersion(getExecutor().runFileQuiet(androidToolPath("emulator"), ["-version"], { timeoutMs: 1e4 }));
1001
1006
  }
1002
1007
  /** The first emulator whose launcher accepts `-crash-report-mode`; an older one refuses to start with it. */
1003
1008
  const CRASH_REPORT_MODE_EMULATOR_VERSION = 37;
@@ -1110,12 +1115,27 @@ function emulatorFailureRemedy(lines) {
1110
1115
  return emulatorDiskSpaceRemedy(lines) ?? "Fix what the emulator reported above, then run `stim android` again.";
1111
1116
  }
1112
1117
  function getprop(exec, serial, prop, timeoutMs) {
1113
- const out = exec.runQuiet(`${androidTool("adb")} -s ${serial} shell getprop ${prop}`, { timeoutMs });
1118
+ const out = exec.runFileQuiet(androidToolPath("adb"), [
1119
+ "-s",
1120
+ serial,
1121
+ "shell",
1122
+ "getprop",
1123
+ prop
1124
+ ], { timeoutMs });
1114
1125
  return typeof out === "string" ? out.trim() : "";
1115
1126
  }
1116
- const PACKAGE_MANAGER_PROBE = "shell pm path android";
1127
+ const PACKAGE_MANAGER_PROBE = [
1128
+ "shell",
1129
+ "pm",
1130
+ "path",
1131
+ "android"
1132
+ ];
1117
1133
  function packageManagerReady(exec, serial, timeoutMs) {
1118
- const out = exec.runQuiet(`${androidTool("adb")} -s ${serial} ${PACKAGE_MANAGER_PROBE}`, { timeoutMs });
1134
+ const out = exec.runFileQuiet(androidToolPath("adb"), [
1135
+ "-s",
1136
+ serial,
1137
+ ...PACKAGE_MANAGER_PROBE
1138
+ ], { timeoutMs });
1119
1139
  return typeof out === "string" && /^package:/m.test(out);
1120
1140
  }
1121
1141
  async function waitForBoot(serial, timeoutMs = 6e4, { aborted = () => false, pollMs = 1e3, commandTimeoutMs } = {}) {
@@ -1135,18 +1155,40 @@ async function waitForBoot(serial, timeoutMs = 6e4, { aborted = () => false, pol
1135
1155
  const diagnosticQuery = (args) => {
1136
1156
  const remaining = diagnosticDeadline - Date.now();
1137
1157
  if (remaining <= 0) return "";
1138
- const value = exec.runQuiet(`${androidTool("adb")} ${args}`, { timeoutMs: remaining });
1158
+ const value = exec.runFileQuiet(androidToolPath("adb"), args, { timeoutMs: remaining });
1139
1159
  return typeof value === "string" ? value.trim() : "";
1140
1160
  };
1141
1161
  return {
1142
1162
  ok: false,
1143
1163
  ...exited ? { exited: true } : {},
1144
1164
  diagnostic: {
1145
- devices: diagnosticQuery("devices"),
1146
- sysBoot: diagnosticQuery(`-s ${serial} shell getprop sys.boot_completed`),
1147
- devBoot: diagnosticQuery(`-s ${serial} shell getprop dev.bootcomplete`),
1148
- bootAnim: diagnosticQuery(`-s ${serial} shell getprop init.svc.bootanim`),
1149
- packageManager: diagnosticQuery(`-s ${serial} ${PACKAGE_MANAGER_PROBE}`)
1165
+ devices: diagnosticQuery(["devices"]),
1166
+ sysBoot: diagnosticQuery([
1167
+ "-s",
1168
+ serial,
1169
+ "shell",
1170
+ "getprop",
1171
+ "sys.boot_completed"
1172
+ ]),
1173
+ devBoot: diagnosticQuery([
1174
+ "-s",
1175
+ serial,
1176
+ "shell",
1177
+ "getprop",
1178
+ "dev.bootcomplete"
1179
+ ]),
1180
+ bootAnim: diagnosticQuery([
1181
+ "-s",
1182
+ serial,
1183
+ "shell",
1184
+ "getprop",
1185
+ "init.svc.bootanim"
1186
+ ]),
1187
+ packageManager: diagnosticQuery([
1188
+ "-s",
1189
+ serial,
1190
+ ...PACKAGE_MANAGER_PROBE
1191
+ ])
1150
1192
  }
1151
1193
  };
1152
1194
  }
@@ -1155,8 +1197,18 @@ const ANDROID_EMULATOR_SHUTDOWN_POLL_MS = 100;
1155
1197
  function shutdownAndroidEmulator(serial, timeoutMs = ANDROID_EMULATOR_SHUTDOWN_TIMEOUT_MS) {
1156
1198
  const exec = getExecutor();
1157
1199
  const started = Date.now();
1158
- if (exec.runQuiet(`${androidTool("adb")} -s ${serial} shell sync`, { timeoutMs: Math.min(5e3, timeoutMs) }) === null) console.error(`warning: could not flush ${serial} before shutdown; shutting it down anyway`);
1159
- exec.runQuiet(`${androidTool("adb")} -s ${serial} emu kill`, { timeoutMs: Math.max(1, timeoutMs - (Date.now() - started)) });
1200
+ if (exec.runFileQuiet(androidToolPath("adb"), [
1201
+ "-s",
1202
+ serial,
1203
+ "shell",
1204
+ "sync"
1205
+ ], { timeoutMs: Math.min(5e3, timeoutMs) }) === null) console.error(`warning: could not flush ${serial} before shutdown; shutting it down anyway`);
1206
+ exec.runFileQuiet(androidToolPath("adb"), [
1207
+ "-s",
1208
+ serial,
1209
+ "emu",
1210
+ "kill"
1211
+ ], { timeoutMs: Math.max(1, timeoutMs - (Date.now() - started)) });
1160
1212
  }
1161
1213
  function sleepSync(ms) {
1162
1214
  Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
@@ -1340,7 +1392,13 @@ function waitForAndroidEmulatorShutdown(avdName, shutdown, { timeoutMs = ANDROID
1340
1392
  }
1341
1393
  const EMU_AVD_NAME_TIMEOUT_MS = 1e4;
1342
1394
  function getAvdNameForSerial(serial, { timeoutMs = EMU_AVD_NAME_TIMEOUT_MS } = {}) {
1343
- const out = getExecutor().runQuiet(`${androidTool("adb")} -s ${serial} emu avd name`, {
1395
+ const out = getExecutor().runFileQuiet(androidToolPath("adb"), [
1396
+ "-s",
1397
+ serial,
1398
+ "emu",
1399
+ "avd",
1400
+ "name"
1401
+ ], {
1344
1402
  timeoutMs: Math.min(timeoutMs, EMU_AVD_NAME_TIMEOUT_MS),
1345
1403
  killSignal: "SIGKILL"
1346
1404
  });
@@ -1390,4 +1448,4 @@ function ownedAvdSerialResolver({ timeoutMs } = {}) {
1390
1448
  };
1391
1449
  }
1392
1450
  //#endregion
1393
- export { trimAndroidCaches as $, listAvds as A, ownedAvdSystemImage as B, emulatorFailureRemedy as C, hostSystemImageArch as D, getAvdNameForSerial as E, ownedAvdDeviceProfile as F, probeEmulatorSerial as G, parseAvdSystemImage as H, ownedAvdDirectory as I, resolveOwnedAvdSerial as J, profileNeedsFoldFeature as K, ownedAvdMatchesConfiguration as L, listOrphanedAvdDirectories as M, memoizeEmulatorProbe as N, listAdbDevices as O, nextConsolePort as P, systemImageSupportsFold as Q, ownedAvdName as R, emulatorDiskSpaceRemedy as S, findBuildTool as T, physicalDeviceModel as U, parseAvdDeviceProfile as V, pickDefaultSystemImage as W, shutdownAndroidEmulator as X, resolvePhysicalDevice as Y, sleepSync as Z, avdStorageRoots as _, androidDeviceAbi as a, isStimOwnedSim as at, createOwnedAvd as b, androidPoolNoCandidatesRefusal as c, dropParked as ct, androidToolPath as d, parkSim as dt, waitForAndroidEmulatorShutdown as et, assertOwnedAvdStopped as f, parkedMaxSetting as ft, avdPoolConfiguration as g, avdPathExists as h, selectParked as ht, androidDataFreeBytes as i, isStimOwnedAvd as it, listInstalledSystemImages as j, listAvdDeviceProfiles as k, androidSystemImageAbi as l, eraseParkedAfter as lt, avdNameAbsent as m, removeParkedAfter as mt, OWNED_AVD_CONFIG_DEFAULTS as n, wipeAvdUserData as nt, androidHome as o, POOL_SETTING_REMEDY as ot, avdIniPaths as p, readParked as pt, resetAdoptedAvd as q, androidBuildToolName as r, configuredAndroidEmulatorApp as rt, androidPoolCandidates as s, adoptParked as st, DEFAULT_AVD_DEVICE_PROFILE as t, waitForBoot as tt, androidToolCwd as u, isLegacyDeletionClaim as ut, bootAndroidEmulator as v, extractEmulatorFailure as w, deleteAvd as x, configureNewOwnedAvd as y, ownedAvdSerialResolver as z };
1451
+ export { trimAndroidCaches as $, listAvds as A, ownedAvdSystemImage as B, emulatorFailureRemedy as C, hostSystemImageArch as D, getAvdNameForSerial as E, ownedAvdDeviceProfile as F, probeEmulatorSerial as G, parseAvdSystemImage as H, ownedAvdDirectory as I, resolveOwnedAvdSerial as J, profileNeedsFoldFeature as K, ownedAvdMatchesConfiguration as L, listOrphanedAvdDirectories as M, memoizeEmulatorProbe as N, listAdbDevices as O, nextConsolePort as P, systemImageSupportsFold as Q, ownedAvdName as R, emulatorDiskSpaceRemedy as S, findBuildTool as T, physicalDeviceModel as U, parseAvdDeviceProfile as V, pickDefaultSystemImage as W, shutdownAndroidEmulator as X, resolvePhysicalDevice as Y, sleepSync as Z, avdStorageRoots as _, androidDeviceAbi as a, POOL_SETTING_REMEDY as at, createOwnedAvd as b, androidPoolNoCandidatesRefusal as c, eraseParkedAfter as ct, androidToolPath as d, parkedMaxSetting as dt, waitForAndroidEmulatorShutdown as et, assertOwnedAvdStopped as f, readParked as ft, avdPoolConfiguration as g, avdPathExists as h, configuredAndroidEmulatorApp as ht, androidDataFreeBytes as i, isStimOwnedSim as it, listInstalledSystemImages as j, listAvdDeviceProfiles as k, androidSystemImageAbi as l, isLegacyDeletionClaim as lt, avdNameAbsent as m, selectParked as mt, OWNED_AVD_CONFIG_DEFAULTS as n, wipeAvdUserData as nt, androidHome as o, adoptParked as ot, avdIniPaths as p, removeParkedAfter as pt, resetAdoptedAvd as q, androidBuildToolName as r, isStimOwnedAvd as rt, androidPoolCandidates as s, dropParked as st, DEFAULT_AVD_DEVICE_PROFILE as t, waitForBoot as tt, androidToolCwd as u, parkSim as ut, bootAndroidEmulator as v, extractEmulatorFailure as w, deleteAvd as x, configureNewOwnedAvd as y, ownedAvdSerialResolver as z };
@@ -1,6 +1,7 @@
1
- import { d as getConfigDir } from "./config-DC5jEtd1.mjs";
2
- import { u as ensureWorkspaceStorage, w as withDirLock$1 } from "./workspace-state-CR9X86xJ.mjs";
3
- import { r as register } from "./cache-manifest-DiwKSyv9.mjs";
1
+ import { d as getConfigDir } from "./config-D0LhTY3S.mjs";
2
+ import { r as register } from "./cache-manifest-qA3dT2x2.mjs";
3
+ import { m as defaultAndroidLayout } from "./settings-Bbztm4oV.mjs";
4
+ import { D as withDirLock$1, p as ensureWorkspaceStorage } from "./workspace-state-CvgTFe-h.mjs";
4
5
  import { accessSync, constants, existsSync, mkdirSync, readFileSync, realpathSync, renameSync, statSync, writeFileSync } from "node:fs";
5
6
  import { join } from "node:path";
6
7
  import { isJsonObject, readJsonFile } from "@stim-cli/core/state";
@@ -39,6 +40,9 @@ function directory(path) {
39
40
  return false;
40
41
  }
41
42
  }
43
+ function casSourceRoot(root, layout) {
44
+ return layout.custom ? layout.gradleRoot : root;
45
+ }
42
46
  function isAndroidCasToolchain(value) {
43
47
  return CAS_TOOLCHAIN_FIELDS.every((field) => typeof value[field] === "string");
44
48
  }
@@ -92,7 +96,7 @@ function resolveAndroidCompilerCache({ optimizations, use, env = process.env })
92
96
  };
93
97
  }
94
98
  }
95
- function resolveAndroidCas(root, env = process.env) {
99
+ function resolveAndroidCas(root, env = process.env, layout = defaultAndroidLayout(root)) {
96
100
  const manifest = env.STIM_ANDROID_CAS_TOOLCHAIN;
97
101
  if (!manifest) return null;
98
102
  const { toolchain, ndkVersion, ndkProperties } = readAndroidCasToolchain(manifest);
@@ -150,7 +154,7 @@ function resolveAndroidCas(root, env = process.env) {
150
154
  initScript: scripts[0],
151
155
  env: {
152
156
  STIM_ANDROID_CAS_CONTEXT: context,
153
- STIM_ANDROID_CAS_SOURCE_ROOT: realpathSync(root),
157
+ STIM_ANDROID_CAS_SOURCE_ROOT: realpathSync(casSourceRoot(root, layout)),
154
158
  STIM_ANDROID_CAS_STATE: state,
155
159
  STIM_ANDROID_CAS_NDK: toolchain.ndk,
156
160
  STIM_ANDROID_CAS_NDK_VERSION: ndkVersion,
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as getExecutor } from "./exec-i8GDPwq9.mjs";
2
+ import { t as getExecutor } from "./exec-B81Qodjn.mjs";
3
3
  import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
4
4
  import { join } from "node:path";
5
5
  import { createHash, randomUUID } from "node:crypto";
@@ -0,0 +1,6 @@
1
+ import { i as formatDuration, l as phaseLine, m as shortHash } from "./command-output-CPDq_90S.mjs";
2
+ import { E as resolveVariant, T as resolveSystemImage, _ as findAapt, b as noDeviceDiagnostic, d as androidVariantSetting, f as apkDevClientFacts, g as dumpApkManifest, h as displayPath, i as NO_FINGERPRINT, p as apkPackage, r as NO_DEVICE, s as androidDevClientScheme, u as androidSystemImageSetting, x as parseXmltree, y as isReleaseVariant } from "./support-Ca6PZbpr.mjs";
3
+ import { r as lastBuildRecord, t as androidFacts } from "./result-BrfgXtdO.mjs";
4
+ import { i as runAndroidOperation, n as registerAndroid, r as runAndroid, t as androidCommand } from "./android-CLbBJ2ve.mjs";
5
+ import { a as killPreviousCollector, i as collectorLogFile, o as startCollector } from "./launch-V1zqiOYn.mjs";
6
+ export { NO_DEVICE, NO_FINGERPRINT, androidDevClientScheme, androidFacts, androidSystemImageSetting, androidVariantSetting, apkDevClientFacts, apkPackage, collectorLogFile, androidCommand as default, displayPath, dumpApkManifest, findAapt, formatDuration, isReleaseVariant, killPreviousCollector, lastBuildRecord, noDeviceDiagnostic, parseXmltree, phaseLine, registerAndroid, resolveSystemImage, resolveVariant, runAndroid, runAndroidOperation, shortHash, startCollector };
package/dist/api-run.mjs CHANGED
@@ -1,12 +1,136 @@
1
- import { t as StimError } from "./api-DIf_s86s.mjs";
2
- import { y as refuseRelativeStimPaths } from "./config-DC5jEtd1.mjs";
3
- import { x as workspaceLogsDir$1 } from "./workspace-state-CR9X86xJ.mjs";
4
- import { i as runAndroidOperation } from "./android-BXc6BmEi.mjs";
5
- import { r as runIosOperation } from "./ios-ITYno9rO.mjs";
6
- import { n as runMacos } from "./macos-ciyBdTY5.mjs";
7
- import { c as stopWorkspaceNow } from "./stop-zDlknFoz.mjs";
8
- import { t as runWeb } from "./web-DbbrPUn0.mjs";
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";
9
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
10
134
  //#region src/api-run.ts
11
135
  async function dispatch({ projectRoot: root, ...request }) {
12
136
  let directory;
@@ -41,6 +165,33 @@ async function dispatch({ projectRoot: root, ...request }) {
41
165
  result
42
166
  };
43
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
+ }
44
195
  const options = request.options;
45
196
  switch (options.platform) {
46
197
  case "ios": {
@@ -1,4 +1,4 @@
1
- import { t as getExecutor } from "./exec-i8GDPwq9.mjs";
1
+ import { t as getExecutor } from "./exec-B81Qodjn.mjs";
2
2
  import { t as spawnEntry } from "./spawn-entry-Dcb7sDUz.mjs";
3
3
  import { realpathSync } from "node:fs";
4
4
  import { isAbsolute } from "node:path";
@@ -46,6 +46,10 @@ function createStim(options) {
46
46
  };
47
47
  return {
48
48
  projectRoot,
49
+ build: (({ signal, ...request }) => invoke(context, {
50
+ operation: "build",
51
+ options: request
52
+ }, signal)),
49
53
  run: (({ signal, ...request }) => invoke(context, {
50
54
  operation: "run",
51
55
  options: request
package/dist/api.d.mts CHANGED
@@ -1,10 +1,78 @@
1
- import "./state-lKh8shBp.mjs";
2
- import { i as IosFacts, t as AndroidFacts } from "./build-facts-B87vo-Im.mjs";
1
+ import { i as IosFacts, n as CcacheActivity, r as CompilationCacheActivity, t as AndroidFacts } from "./build-facts-DcLv2HSd.mjs";
2
+ import "./settings-vk3mJGSm.mjs";
3
3
  import "./ndjson-Du3j0AQ9.mjs";
4
4
  import { MacosBuild, NdjsonRecord, WebBrowserState, WebViewport } from "@stim-cli/core/state";
5
5
  import { Command } from "commander";
6
- import "@stim-cli/cache";
7
6
  import { ChildProcess } from "node:child_process";
7
+ //#region src/commands/android/build.d.ts
8
+ interface AndroidBuildOptions {
9
+ variant?: string;
10
+ abi?: "arm64-v8a" | "armeabi-v7a" | "x86" | "x86_64" | "all";
11
+ buildCache?: boolean;
12
+ remoteBuild?: string;
13
+ }
14
+ interface AndroidBuildFacts {
15
+ /** Owned copy, retained with this workspace until explicitly removed. */
16
+ apkPath: string;
17
+ androidPackage: string | null;
18
+ variant: string;
19
+ abi: string | null;
20
+ cacheKey: string | null;
21
+ cacheHit: string | boolean;
22
+ cacheSkipped: boolean;
23
+ buildMachine: string;
24
+ builtOn: string | null;
25
+ ccache: CcacheActivity;
26
+ durationMs: number;
27
+ logs: {
28
+ dir: string;
29
+ };
30
+ }
31
+ //#endregion
32
+ //#region src/commands/macos-build.d.ts
33
+ interface MacosBuildOptions {
34
+ remoteBuild?: string;
35
+ }
36
+ interface MacosBuildFacts {
37
+ product: string;
38
+ /** Owned copy, retained with this workspace until explicitly removed. */
39
+ bundle: string;
40
+ bundleId: string;
41
+ executable: string;
42
+ build: MacosBuild;
43
+ logs: {
44
+ dir: string;
45
+ };
46
+ }
47
+ //#endregion
48
+ //#region src/commands/ios/build.d.ts
49
+ interface IosBuildOptions {
50
+ configuration?: string;
51
+ scheme?: string;
52
+ /** Simulator architecture. Defaults to the host for Debug, or all architectures otherwise. */
53
+ arch?: "arm64" | "x86_64" | "all";
54
+ buildCache?: boolean;
55
+ remoteBuild?: string;
56
+ }
57
+ interface IosBuildFacts {
58
+ /** Owned simulator app, retained with this workspace until explicitly removed. */
59
+ appPath: string;
60
+ bundleId: string | null;
61
+ configuration: string;
62
+ scheme: string | null;
63
+ arch: "arm64" | "x86_64" | null;
64
+ cacheKey: string | null;
65
+ cacheHit: string | boolean;
66
+ cacheSkipped: boolean;
67
+ buildMachine: string;
68
+ builtOn: string | null;
69
+ compilationCache: CompilationCacheActivity;
70
+ durationMs: number;
71
+ logs: {
72
+ dir: string;
73
+ };
74
+ }
75
+ //#endregion
8
76
  //#region src/engine/device-lease.d.ts
9
77
  type LeasePlatform = "ios" | "android";
10
78
  interface ReleasedLease {
@@ -165,6 +233,25 @@ type StimRunResult = {
165
233
  platform: "web";
166
234
  facts: WebFacts;
167
235
  };
236
+ type StimBuildOptions = ((IosBuildOptions & {
237
+ platform: "ios";
238
+ }) | (AndroidBuildOptions & {
239
+ platform: "android";
240
+ }) | (MacosBuildOptions & {
241
+ platform: "macos";
242
+ })) & {
243
+ signal?: AbortSignal;
244
+ };
245
+ type StimBuildResult = {
246
+ platform: "ios";
247
+ facts: IosBuildFacts;
248
+ } | {
249
+ platform: "android";
250
+ facts: AndroidBuildFacts;
251
+ } | {
252
+ platform: "macos";
253
+ facts: MacosBuildFacts;
254
+ };
168
255
  interface StimStopOptions {
169
256
  slot?: string;
170
257
  signal?: AbortSignal;
@@ -182,6 +269,13 @@ interface StimDiagnostics {
182
269
  }
183
270
  interface StimClient {
184
271
  readonly projectRoot: string;
272
+ /** Builds an artifact without acquiring a device or starting a runtime. */
273
+ build<P extends StimBuildOptions["platform"]>(options: StimBuildOptions & {
274
+ platform: P;
275
+ }): Promise<Extract<StimBuildResult, {
276
+ platform: P;
277
+ }>>;
278
+ build(options: StimBuildOptions): Promise<StimBuildResult>;
185
279
  run<P extends StimPlatform>(options: StimRunOptions & {
186
280
  platform: P;
187
281
  }): Promise<Extract<StimRunResult, {
@@ -215,4 +309,4 @@ declare class StimError extends Error {
215
309
  */
216
310
  declare function createStim(options: StimOptions): StimClient;
217
311
  //#endregion
218
- export { type StimClient, type StimDiagnostics, type StimDiagnosticsOptions, StimError, type StimOptions, type StimPlatform, type StimProgress, type StimRunOptions, type StimRunResult, type StimStopOptions, type StimStopResult, createStim };
312
+ export { type StimBuildOptions, type StimBuildResult, type StimClient, type StimDiagnostics, type StimDiagnosticsOptions, StimError, type StimOptions, type StimPlatform, type StimProgress, type StimRunOptions, type StimRunResult, type StimStopOptions, type StimStopResult, createStim };
package/dist/api.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as createStim, t as StimError } from "./api-DIf_s86s.mjs";
1
+ import { n as createStim, t as StimError } from "./api-zuX3ynYN.mjs";
2
2
  export { StimError, createStim };