stim 1.20.2 → 1.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -8
- package/dist/acquire-artifact-CD4lbiWE.mjs +153 -0
- package/dist/act-DHAw2A2S.mjs +2667 -0
- package/dist/activity-BzVfHSrY.mjs +1376 -0
- package/dist/{agent-device-usage-output-Dzgv6lgR.mjs → agent-device-usage-output-zh1vhbLp.mjs} +21 -65
- package/dist/{android-HqP1_vB_.mjs → android-BEJ8Jpl7.mjs} +2 -2
- package/dist/{android-DCKZrNvV.mjs → android-BLgbNqox.mjs} +128 -78
- package/dist/{android-Dlzxshgp.mjs → android-CV_GCELZ.mjs} +5 -5
- package/dist/{android-Mz_Inn3w.mjs → android-DUYkNF4u.mjs} +184 -102
- package/dist/{android-cas-Bl-cLJBk.mjs → android-cas-Ct5b1xCK.mjs} +7 -6
- package/dist/android-cas-compiler.mjs +2 -2
- package/dist/android-project-BCAAmMwz.mjs +12 -0
- package/dist/api.d.mts +740 -8
- package/dist/api.mjs +585 -1
- package/dist/{artifact-HSwkIWEQ.mjs → artifact-B8T3S5gi.mjs} +223 -201
- package/dist/{artifact-D3czlUvT.mjs → artifact-DAuZ-FNU.mjs} +158 -148
- package/dist/{browser-web-CA-F1GQo.mjs → browser-web-QQzVjz3O.mjs} +26 -24
- package/dist/budget-Bs6SxxzO.mjs +9154 -0
- package/dist/{build-DYDbfkk5.mjs → build-CoPzQRNw.mjs} +144 -96
- package/dist/build-cache-DmyR9Zzc.mjs +602 -0
- package/dist/build-plan-CaFskB7_.mjs +188 -0
- package/dist/{cache-manifest-XH-fvDUj.mjs → cache-manifest-DkkqguoK.mjs} +2 -2
- package/dist/cache-manifest.mjs +1 -1
- package/dist/{ccache-zdKiYQ3E.mjs → ccache-BJRZ9pG3.mjs} +10 -9
- package/dist/{cdp-Dq_ypAlJ.mjs → cdp-CWmIUMbw.mjs} +18 -5
- package/dist/{chrome-BnzZMqsR.mjs → chrome-B6tfCta1.mjs} +7 -4
- package/dist/{cli-CLP3diBm.mjs → cli-0DYf8QhQ.mjs} +20 -20
- package/dist/cli.mjs +1 -1
- package/dist/client-B7QVOlCr.d.mts +253 -0
- package/dist/client-UXD70ZbM.mjs +1406 -0
- package/dist/collector-run.d.mts +4 -40
- package/dist/collector-run.mjs +9 -8
- package/dist/{command-output-BTy8hZ0F.mjs → command-output-B1UrjZHL.mjs} +1 -1
- package/dist/config-CYcBF478.mjs +949 -0
- package/dist/{created-devices-Dzd5C2LF.mjs → created-devices-CqeBlrEn.mjs} +3 -3
- package/dist/{dependency-state-DG0p31-y.mjs → dependency-state-BbKQW83h.mjs} +20 -5
- package/dist/{detached-entry-B9C_zeQC.mjs → detached-entry-DFRyG1_o.mjs} +1 -1
- package/dist/{dev-client-DAWVIGBu.mjs → dev-client-UOeESKm6.mjs} +2 -2
- package/dist/device-DCxH7_By.mjs +1068 -0
- package/dist/{device-BECOiufl.mjs → device-ExJq8Ei7.mjs} +35 -35
- package/dist/{device-capacity-CBUAcRyQ.mjs → device-capacity-CMlqEcvw.mjs} +43 -13
- package/dist/device-host-worker.mjs +65 -61
- package/dist/{device-ios-COSi6oS1.mjs → device-ios-DRUeKaFV.mjs} +48 -45
- package/dist/{device-lease-run-Cw2M4z51.mjs → device-lease-run-C8raGFoP.mjs} +14 -26
- package/dist/{device-pool-Bf-pOhSw.mjs → device-pool-DMRpVX9a.mjs} +5 -5
- package/dist/doctor-BLHCYxzi.mjs +2 -0
- package/dist/{doctor-kfMBnUw6.mjs → doctor-DTvaDOda.mjs} +281 -317
- package/dist/{doctor-CB8oZKCk.mjs → doctor-Dhqebm0q.mjs} +183 -91
- package/dist/doctor-fingerprint.mjs +19 -0
- package/dist/{doctor-watchman-BRyV2adA.mjs → doctor-watchman-Cv1F10Kj.mjs} +40 -21
- package/dist/{eas-build-JyfqyHfC.mjs → eas-build-BomfRnFT.mjs} +53 -20
- package/dist/{build-plan-B7SZsc2N.mjs → eas-fallback-DJwZpy0c.mjs} +26 -208
- package/dist/{watchman-CPQFZLXY.mjs → eas-session-ledger-op6A54yi.mjs} +229 -11
- package/dist/{error-diagnostics-BR677IDM.mjs → error-diagnostics-Bf0rZvG9.mjs} +172 -82
- package/dist/exec-H20xSg2T.d.mts +65 -0
- package/dist/exec-_UbtCQcG.mjs +750 -0
- package/dist/gc-C-WwL0yi.mjs +3 -0
- package/dist/{gc-qWOMdnER.mjs → gc-_-dCXdyL.mjs} +584 -796
- package/dist/git-C3iTsJaZ.mjs +73 -0
- package/dist/{guide-G9cAbVAc.mjs → guide-Yqwt2bd6.mjs} +941 -269
- package/dist/{hosted-android-C3MHGld1.mjs → hosted-android-Bw-honsd.mjs} +8 -6
- package/dist/{hosted-client-ZEKpS9vw.mjs → hosted-client-DB_gBPfY.mjs} +34 -19
- package/dist/{hosted-ios-l-o3iM9J.mjs → hosted-ios-CUvOf4Vr.mjs} +1 -1
- package/dist/{hosted-logs-EzQM7-3Z.mjs → hosted-logs-DL_P5AdN.mjs} +77 -43
- package/dist/{hosted-macos-BACVAVqE.mjs → hosted-macos-QI141yKk.mjs} +21 -17
- package/dist/{hosted-native-A4s1QPXe.mjs → hosted-native-Ksyjgzq-.mjs} +30 -21
- package/dist/idle-BVeRGroT.d.mts +24 -0
- package/dist/{idle-shutdown-DtxhPTKe.mjs → idle-shutdown-DaKmZi0z.mjs} +11 -10
- package/dist/{ios-BwVCF7oA.mjs → ios-CQ68hG9s.mjs} +8 -8
- package/dist/{ios-RkW4pnQf.mjs → ios-CpByZy12.mjs} +140 -80
- package/dist/{ios-device-B5veSDDQ.mjs → ios-device-CXGP1bsD.mjs} +1 -1
- package/dist/{ios-device-D7pi2Sca.mjs → ios-device-CwFMehUS.mjs} +51 -26
- package/dist/{ios-project-K9hY_Jab.mjs → ios-project-WuwwBdvW.mjs} +13 -13
- package/dist/{ios-nOLJGVdy.mjs → ios-qNJt4dFm.mjs} +1 -1
- package/dist/ios-signing-DTTIChGs.mjs +489 -0
- package/dist/{ios-state-CBLe1xYw.mjs → ios-state-DvFX-K_l.mjs} +1 -1
- package/dist/{ios-Ce7bc7br.mjs → ios-ubFsBzwq.mjs} +129 -86
- package/dist/{js-swap-Bb3nsS07.mjs → js-swap-Cc1dttps.mjs} +53 -26
- package/dist/{launch-F4sOqAhB.mjs → launch-CD1yVc7U.mjs} +91 -90
- package/dist/{launch-C3qJ6Agb.mjs → launch-Zq2mOSDy.mjs} +82 -541
- package/dist/logs-BS00Anxf.mjs +352 -0
- package/dist/logs-CMm05HxN.mjs +255 -0
- package/dist/{macos-D7uDvO-z.mjs → macos-B65--pPd.mjs} +1 -1
- package/dist/{macos-Ch5VJmcS.mjs → macos-C-0qJ6zq.mjs} +225 -212
- package/dist/macos-run.mjs +1 -1
- package/dist/maintenance-run.mjs +122 -247
- package/dist/{metro-DnCEjCxs.mjs → metro-DEXpIhHC.mjs} +67 -12
- package/dist/{metro-gateway-CX9Xlkq2.mjs → metro-gateway-BMJNlj3E.mjs} +20 -12
- package/dist/{named-ports-4WopRPg-.mjs → named-ports-BWTzt6mu.mjs} +8 -63
- package/dist/native-android-JACyjTZs.mjs +844 -0
- package/dist/{native-gradle-inputs-BsLRrl7u.mjs → native-gradle-inputs-Bep9JcSF.mjs} +128 -140
- package/dist/native-inputs-TRTTTRxt.mjs +91 -0
- package/dist/native-run-DY_RLx3C.mjs +277 -0
- package/dist/{native-runtime-k8dTIrbK.mjs → native-runtime-Dg1Q7tfF.mjs} +9 -8
- package/dist/{native-xcode-inputs-CykopJdM.mjs → native-xcode-inputs-CB2iQeWq.mjs} +27 -18
- package/dist/{native-xcode-ios-Bbf30Gm0.mjs → native-xcode-ios-CXX39F7o.mjs} +96 -47
- package/dist/{ndjson-GOnbyvso.mjs → ndjson-CgE_o3Dl.mjs} +3 -3
- package/dist/offload-worker.d.mts +1 -46
- package/dist/offload-worker.mjs +197 -66
- package/dist/{ownership-DCtw_2IA.mjs → ownership-DEmM5vhh.mjs} +3 -3
- package/dist/{page-DRHy329N.mjs → page-CPaHeYqj.mjs} +7 -4
- package/dist/paths-BsJMoPP2.mjs +12 -0
- package/dist/paths-DQtTgsBf.mjs +42 -0
- package/dist/{placement-log-MOfPVgaM.mjs → placement-log-BqGbTa61.mjs} +5 -5
- package/dist/{plan-placement-V0TdzYXp.mjs → plan-placement-Bwj-IjY1.mjs} +6 -6
- package/dist/{ports-DdSUicVo.mjs → ports-D-MmCTdv.mjs} +3 -3
- package/dist/prebuild-uD_ipCxF.mjs +449 -0
- package/dist/{project-_phNIJfs.mjs → project-BZNjmW_8.mjs} +65 -37
- package/dist/{pull-request-CQ8sPbZa.mjs → pull-request-Lfetn8Kr.mjs} +2 -2
- package/dist/pull-request-zjCSAryH.d.mts +120 -0
- package/dist/pull-requests.d.mts +1 -119
- package/dist/pull-requests.mjs +1 -1
- package/dist/{react-native-android-CM1XRDwv.mjs → react-native-android-DuzH0cn3.mjs} +74 -48
- package/dist/{gradle-DSrXb6lG.mjs → react-native-build-rhk4smwQ.mjs} +292 -15
- package/dist/react-native-doctor-CQpuIMso.mjs +234 -0
- package/dist/{react-native-ios-Dhq_eiYQ.mjs → react-native-ios-Bhq1rJeV.mjs} +46 -28
- package/dist/{recordings-D0d5aQt0.mjs → recordings-DYteQSu4.mjs} +12 -9
- package/dist/{reload-C8JhxjSh.mjs → reload-CmTRFJaX.mjs} +93 -47
- package/dist/reload-DzjSl5P_.mjs +2 -0
- package/dist/{remote-BiR6aYjy.mjs → remote-ByYkXdGD.mjs} +15 -10
- package/dist/result-DNiS-tTP.mjs +434 -0
- package/dist/{run-BtPgpKks.mjs → run-D23HmJMs.mjs} +4 -5
- package/dist/selection-CSl9i5qU.mjs +619 -0
- package/dist/{server-bare-R2m_gsH8.mjs → server-bare-CxTrvDg8.mjs} +3 -4
- package/dist/{server-command-CTtCkmcQ.mjs → server-command-CtzloH3v.mjs} +14 -7
- package/dist/server-expo-C-90EhcG.mjs +2 -0
- package/dist/{server-expo-DsguMGUF.mjs → server-expo-DT_F_uVI.mjs} +50 -9
- package/dist/{settings-B717odTD.mjs → settings-CsJDEXgK.mjs} +234 -24
- package/dist/{settings-vk3mJGSm.d.mts → settings-DkdmlelE.d.mts} +6 -4
- package/dist/settings-T1gtc3bf.mjs +114 -0
- package/dist/settings-write-HyVZ8eQ8.mjs +359 -0
- package/dist/settings.schema.json +163 -16
- package/dist/{simslim-CCr3rE-A.mjs → simslim-Cgk17SXV.mjs} +14 -12
- package/dist/{slot-launch-DPt0m9Nd.mjs → slot-launch-DF8VfT64.mjs} +15 -20
- package/dist/{spawn-entry-Dcb7sDUz.mjs → spawn-entry-jw19m8Nl.mjs} +0 -1
- package/dist/stage-BIS0ydsV.mjs +183 -0
- package/dist/{start-BWqzODpb.mjs → start-7lpH7hmN.mjs} +63 -44
- package/dist/{start-TXeMmmO2.mjs → start-RChynRDp.mjs} +1 -1
- package/dist/{state-D1Icyjlu.mjs → state-C4ZtUisW.mjs} +40 -13
- package/dist/{state-CG_OFoaA.mjs → state-XMziexv2.mjs} +3 -2
- package/dist/{stats-BoY5sEPU.mjs → stats-53T7OTb9.mjs} +7 -13
- package/dist/stats-report-BFfMpWWF.mjs +16 -0
- package/dist/{status-WgFbkRzj.mjs → status-BL7jVyAB.mjs} +535 -447
- package/dist/status-CSi6tlRq.mjs +2 -0
- package/dist/{status-BTA7kKiQ.mjs → status-DqEUSSxs.mjs} +6 -4
- package/dist/{status-watch-C23ILtf9.mjs → status-watch-GDCfqpTE.mjs} +187 -22
- package/dist/status-worker.d.mts +1 -0
- package/dist/status-worker.mjs +19 -0
- package/dist/stim-desktop-C12we7lz.mjs +112 -0
- package/dist/{stop-DR6VoDIk.mjs → stop-Bk_1qiV6.mjs} +2 -2
- package/dist/{stop-BNmBMi1F.mjs → stop-CPzlM1L-.mjs} +138 -98
- package/dist/{stop-DPEhunlw.mjs → stop-D7h6jAXQ.mjs} +11 -10
- package/dist/supervisor-run.d.mts +8 -17
- package/dist/supervisor-run.mjs +63 -27
- package/dist/{support-DMTqj3Hm.mjs → support-67vraa1Q.mjs} +18 -11
- package/dist/{support-CwjbFs9H.mjs → support-Dlu37g6H.mjs} +12 -12
- package/dist/{swiftpm-macos-DRNVJWlb.mjs → swiftpm-macos-p8WZbxKU.mjs} +35 -24
- package/dist/toolchain-DhKwp9iI.mjs +2 -0
- package/dist/toolchain-Hp9sCpK4.mjs +873 -0
- package/dist/{trigger-CigAYjeL.mjs → trigger-BAahxUPq.mjs} +20 -5
- package/dist/trigger-Bf3uDcpv.mjs +2 -0
- package/dist/{warm-progress-BuY-Fvfn.mjs → warm-progress-BHX5r0Ei.mjs} +250 -156
- package/dist/{web-BDBMxDpx.mjs → web-CJmIj6AI.mjs} +18 -13
- package/dist/web-DknQETPs.mjs +2 -0
- package/dist/web-run.mjs +11 -12
- package/dist/windows-report.d.mts +1 -0
- package/dist/windows-report.mjs +18 -0
- package/dist/windows-report.ps1 +43 -0
- package/dist/workspace-process-lock-1_1OoVW5.mjs +57 -0
- package/dist/{workspace-state-DJt_MMvf.mjs → workspace-state-Cjuigeeu.mjs} +62 -58
- package/dist/{workspaces-C36s2jb9.mjs → workspaces-BccMFmGQ.mjs} +1188 -1079
- package/dist/worktree-CK2MpJW5.mjs +2 -0
- package/dist/{worktree-CgvJYJ-Q.mjs → worktree-DQ6Zi2Mv.mjs} +304 -53
- package/dist/xcode-Zlx3qjEs.mjs +896 -0
- package/package.json +7 -5
- package/shim/android-optimizations.gradle +7 -5
- package/dist/activity-BSV745Kz.mjs +0 -629
- package/dist/api-qvOzWyfO.mjs +0 -154
- package/dist/api-run.mjs +0 -294
- package/dist/app-install-BIKtMfPq.mjs +0 -896
- package/dist/artifact-lifecycle-DzPpBYvK.mjs +0 -30
- package/dist/budget-f7516Zk0.mjs +0 -4106
- package/dist/build-facts-DcLv2HSd.d.mts +0 -111
- package/dist/cancellation-C_22VQTH.mjs +0 -24
- package/dist/client-qQAaXSUs.mjs +0 -1771
- package/dist/config-BYDxlMY3.mjs +0 -562
- package/dist/device-DuiPJQSn.mjs +0 -290
- package/dist/device-lease-BX1sJQ2E.mjs +0 -1224
- package/dist/device-remote-xRT0Vmo9.mjs +0 -1272
- package/dist/eas-session-ledger-Cm0Gwq2F.mjs +0 -207
- package/dist/exec-DqKo9GKJ.mjs +0 -268
- package/dist/git-DDfFzkMm.mjs +0 -45
- package/dist/launch-verify-B6Q8hZP-.mjs +0 -428
- package/dist/logs-BGrEUaEs.mjs +0 -383
- package/dist/miss-reason-mKzZ4VvN.mjs +0 -238
- package/dist/native-android-D5qc3-_v.mjs +0 -226
- package/dist/ndjson-Du3j0AQ9.d.mts +0 -17
- package/dist/plan-C4TjdPsR.mjs +0 -260
- package/dist/prebuild-DYbucPXy.mjs +0 -212
- package/dist/preview-78a9kR_-.mjs +0 -1011
- package/dist/react-native-build-CtCccJtb.mjs +0 -239
- package/dist/react-native-doctor-CfRnFfjs.mjs +0 -78
- package/dist/remote-cache-OyOyVIS3.mjs +0 -526
- package/dist/result-CaJg5Iat.mjs +0 -186
- package/dist/server-expo-Bigriskl.mjs +0 -2
- package/dist/settings-BORNaaCO.mjs +0 -402
- package/dist/spawn-claims-DVS5RkMS.mjs +0 -72
- package/dist/stage-KNTQopqv.mjs +0 -157
- package/dist/stim-desktop-BzBN2Em2.mjs +0 -63
- package/dist/tailnet-Dh-qiYzG.mjs +0 -265
- package/dist/toolchain-BFkAcstd.mjs +0 -2
- package/dist/toolchain-DxSsNssu.mjs +0 -1657
- package/dist/trigger-9_USgmxz.mjs +0 -2
- package/dist/web-Dq-i3wzJ.mjs +0 -2
- package/dist/worktree-DpLdCHga.mjs +0 -2
- package/dist/{api-run.d.mts → doctor-fingerprint.d.mts} +0 -0
- package/dist/{errors-DzkMYh8Q.mjs → errors-ccaPc4ox.mjs} +2 -2
package/dist/api.mjs
CHANGED
|
@@ -1,2 +1,586 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as trackReportResource, h as runReport, u as operationState } from "./exec-_UbtCQcG.mjs";
|
|
2
|
+
import { d as workspaceDir, m as workspaceLogsDir$1, n as ensureWorkspaceStorage } from "./paths-DQtTgsBf.mjs";
|
|
3
|
+
import { E as upsertProject, p as getProject, y as refuseRelativeStimPaths } from "./config-CYcBF478.mjs";
|
|
4
|
+
import { l as phaseLine } from "./command-output-B1UrjZHL.mjs";
|
|
5
|
+
import { a as recordWorkspaceUseAsync, i as recordWorkspaceUse } from "./workspace-state-Cjuigeeu.mjs";
|
|
6
|
+
import { $t as cancelledError, It as repoRootAsync, J as resolveProjectSettingsAsync, a as SETTING_SHAPE_REMEDY, en as throwIfCancelled, et as settingShapeErrors } from "./settings-CsJDEXgK.mjs";
|
|
7
|
+
import { f as projectRegistry, r as findCommandWorkspaceAsync } from "./project-BZNjmW_8.mjs";
|
|
8
|
+
import { n as macosDir } from "./state-XMziexv2.mjs";
|
|
9
|
+
import { r as createNdjsonWriter } from "./ndjson-CgE_o3Dl.mjs";
|
|
10
|
+
import { B as recordFinishedBuild, H as tapBuildLog, V as startBuildProgress } from "./budget-Bs6SxxzO.mjs";
|
|
11
|
+
import { d as runCancellationSignal, f as withNativeBuildRun } from "./native-run-DY_RLx3C.mjs";
|
|
12
|
+
import { c as ensureHomeIdentity, s as workspaceShareURL } from "./stim-desktop-C12we7lz.mjs";
|
|
13
|
+
import { s as resolveBuildPlacement } from "./selection-CSl9i5qU.mjs";
|
|
14
|
+
import { c as stopWorkspaceNow } from "./stop-CPzlM1L-.mjs";
|
|
15
|
+
import { r as runReload } from "./reload-CmTRFJaX.mjs";
|
|
16
|
+
import { s as recordDoctorCheck } from "./doctor-watchman-Cv1F10Kj.mjs";
|
|
17
|
+
import { a as readDoctorReport } from "./doctor-Dhqebm0q.mjs";
|
|
18
|
+
import { r as readGcReport } from "./gc-_-dCXdyL.mjs";
|
|
19
|
+
import { r as readWorkspaceLogs, t as followWorkspaceLogs } from "./logs-BS00Anxf.mjs";
|
|
20
|
+
import { t as readProjectStats } from "./stats-report-BFfMpWWF.mjs";
|
|
21
|
+
import { n as buildAndroidOperation, t as buildIosOperation } from "./build-CoPzQRNw.mjs";
|
|
22
|
+
import { i as runAndroidOperation } from "./android-BLgbNqox.mjs";
|
|
23
|
+
import { r as runIosOperation } from "./ios-ubFsBzwq.mjs";
|
|
24
|
+
import { i as buildMacosBundle, n as runMacos } from "./macos-C-0qJ6zq.mjs";
|
|
25
|
+
import { t as runWeb } from "./web-CJmIj6AI.mjs";
|
|
26
|
+
import { i as SettingsRefusal, o as readSettingsContext, s as readSettingsPayload, t as mutateSetting } from "./settings-write-HyVZ8eQ8.mjs";
|
|
27
|
+
import { randomBytes } from "node:crypto";
|
|
28
|
+
import { mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync } from "node:fs";
|
|
29
|
+
import { stripVTControlCharacters } from "node:util";
|
|
30
|
+
import { homedir } from "node:os";
|
|
31
|
+
import { isAbsolute, join, resolve } from "node:path";
|
|
32
|
+
import { withAmbientContext } from "@stim-cli/core";
|
|
33
|
+
import { RUN_ID_ENV, findProjectRoot, openLogDir, validRunId } from "@stim-cli/core/state";
|
|
34
|
+
//#region src/commands/macos-build.ts
|
|
35
|
+
async function buildMacosOperation(context, root, options) {
|
|
36
|
+
const note = (line) => context.output("stderr", `${line}\n`);
|
|
37
|
+
if (process.platform !== "darwin") throw new Error("Building a macOS app requires a Mac with Swift installed.");
|
|
38
|
+
root = realpathSync(root);
|
|
39
|
+
const selected = projectRegistry.selectMacos(root);
|
|
40
|
+
if ("problem" in selected) throw Object.assign(new Error(selected.problem.message), {
|
|
41
|
+
code: "STIM_NO_PROJECT",
|
|
42
|
+
remedy: selected.problem.remedy
|
|
43
|
+
});
|
|
44
|
+
const { settings } = await resolveProjectSettingsAsync(root, {
|
|
45
|
+
env: context.env,
|
|
46
|
+
signal: runCancellationSignal(context) ?? context.signal
|
|
47
|
+
});
|
|
48
|
+
const [shape] = settingShapeErrors(settings);
|
|
49
|
+
if (shape) throw Object.assign(/* @__PURE__ */ new Error(`${shape} ${SETTING_SHAPE_REMEDY}`), { code: "STIM_BAD_ARG" });
|
|
50
|
+
const placement = resolveBuildPlacement(options.remoteBuild);
|
|
51
|
+
if (placement.failure) throw Object.assign(new Error(placement.failure.message), placement.failure);
|
|
52
|
+
const recipe = await (await selected.load()).prepare(context, settings);
|
|
53
|
+
ensureWorkspaceStorage(root);
|
|
54
|
+
return withNativeBuildRun(context, root, {
|
|
55
|
+
command: "build",
|
|
56
|
+
platform: "macos"
|
|
57
|
+
}, async (claim) => {
|
|
58
|
+
if (!getProject(root)) upsertProject(root, {});
|
|
59
|
+
recordWorkspaceUse(root, /* @__PURE__ */ new Date(), context.env, context.cwd);
|
|
60
|
+
const started = Date.now();
|
|
61
|
+
const progress = startBuildProgress({
|
|
62
|
+
root,
|
|
63
|
+
platform: "macos",
|
|
64
|
+
slot: "default",
|
|
65
|
+
claim,
|
|
66
|
+
note
|
|
67
|
+
});
|
|
68
|
+
const logs = workspaceLogsDir$1(root);
|
|
69
|
+
const writer = tapBuildLog(createNdjsonWriter(join(logs, "build-artifact-macos.ndjson"), { truncate: true }), progress);
|
|
70
|
+
const build = {
|
|
71
|
+
state: "running",
|
|
72
|
+
startedAt: new Date(started).toISOString(),
|
|
73
|
+
buildMachine: placement.selected
|
|
74
|
+
};
|
|
75
|
+
let directory;
|
|
76
|
+
let succeeded = false;
|
|
77
|
+
try {
|
|
78
|
+
const artifacts = join(workspaceDir(root), "artifacts");
|
|
79
|
+
mkdirSync(artifacts, { recursive: true });
|
|
80
|
+
directory = mkdtempSync(join(artifacts, "macos-"));
|
|
81
|
+
const bundle = join(directory, `${recipe.product}.app`);
|
|
82
|
+
await buildMacosBundle({
|
|
83
|
+
context,
|
|
84
|
+
root,
|
|
85
|
+
recipe,
|
|
86
|
+
bundle,
|
|
87
|
+
bundleId: recipe.bundleId,
|
|
88
|
+
scratch: join(macosDir(root), "build"),
|
|
89
|
+
writer,
|
|
90
|
+
note,
|
|
91
|
+
progress,
|
|
92
|
+
record: build,
|
|
93
|
+
buildMachine: placement.selected
|
|
94
|
+
});
|
|
95
|
+
throwIfCancelled(runCancellationSignal(context), "macOS build");
|
|
96
|
+
const executable = realpathSync(join(bundle, "Contents", "MacOS", recipe.product));
|
|
97
|
+
const links = { workspace: await workspaceShareURL(root, { platform: "macos" }, runCancellationSignal(context) ?? context.signal) };
|
|
98
|
+
throwIfCancelled(runCancellationSignal(context), "macOS build");
|
|
99
|
+
build.state = "ok";
|
|
100
|
+
succeeded = true;
|
|
101
|
+
return {
|
|
102
|
+
product: recipe.product,
|
|
103
|
+
bundle,
|
|
104
|
+
bundleId: recipe.bundleId,
|
|
105
|
+
executable,
|
|
106
|
+
build,
|
|
107
|
+
logs: { dir: logs },
|
|
108
|
+
links
|
|
109
|
+
};
|
|
110
|
+
} catch (error) {
|
|
111
|
+
const failure = runCancellationSignal(context)?.aborted ? cancelledError("macOS build", error) : error;
|
|
112
|
+
build.state = "failed";
|
|
113
|
+
build.error = failure instanceof Error ? failure.message : String(failure);
|
|
114
|
+
build.errorCode = failure.code;
|
|
115
|
+
throw failure;
|
|
116
|
+
} finally {
|
|
117
|
+
build.finishedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
118
|
+
build.durationMs = Date.now() - started;
|
|
119
|
+
try {
|
|
120
|
+
recordFinishedBuild(root, {
|
|
121
|
+
platform: "macos",
|
|
122
|
+
status: build.state,
|
|
123
|
+
configuration: "Debug",
|
|
124
|
+
fingerprint: null,
|
|
125
|
+
cacheKey: null,
|
|
126
|
+
cacheHit: false,
|
|
127
|
+
cacheSkipped: false,
|
|
128
|
+
durationMs: build.durationMs,
|
|
129
|
+
startedAt: build.startedAt,
|
|
130
|
+
errorCode: build.errorCode,
|
|
131
|
+
buildMachine: build.buildMachine,
|
|
132
|
+
builtOn: build.builtOn,
|
|
133
|
+
offloadedTo: build.offloadedTo,
|
|
134
|
+
offloadFallback: build.offloadFallback,
|
|
135
|
+
compileSteps: progress.steps()
|
|
136
|
+
}, { artifactOnly: true });
|
|
137
|
+
} catch (error) {
|
|
138
|
+
note(phaseLine("state", `could not record the build: ${error?.message || error}`));
|
|
139
|
+
} finally {
|
|
140
|
+
if (!succeeded && directory) rmSync(directory, {
|
|
141
|
+
recursive: true,
|
|
142
|
+
force: true
|
|
143
|
+
});
|
|
144
|
+
writer.close();
|
|
145
|
+
progress.clear();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}, { write: note });
|
|
149
|
+
}
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region src/api.ts
|
|
152
|
+
const version = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
|
|
153
|
+
var StimError = class extends Error {
|
|
154
|
+
code;
|
|
155
|
+
remedy;
|
|
156
|
+
details;
|
|
157
|
+
constructor({ code, message, remedy = null, details }) {
|
|
158
|
+
super(message);
|
|
159
|
+
this.name = "StimError";
|
|
160
|
+
this.code = code;
|
|
161
|
+
this.remedy = remedy;
|
|
162
|
+
this.details = details;
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* Creates a client without starting processes or changing the caller's cwd, environment, or signal handlers.
|
|
167
|
+
* The Stim home is fixed when the client is created: `home`, else STIM_HOME from `env`, else the default home.
|
|
168
|
+
* Operations run in the calling process against the client's home and project, so clients for different
|
|
169
|
+
* homes can share a process.
|
|
170
|
+
* Resources remain workspace-owned until stop() is called.
|
|
171
|
+
*/
|
|
172
|
+
function createStim(options) {
|
|
173
|
+
let projectRoot;
|
|
174
|
+
try {
|
|
175
|
+
projectRoot = realpathSync(options.projectRoot);
|
|
176
|
+
} catch (error) {
|
|
177
|
+
throw new StimError({
|
|
178
|
+
code: "STIM_NO_PROJECT",
|
|
179
|
+
message: `Could not resolve projectRoot ${options.projectRoot}: ${error instanceof Error ? error.message : String(error)}`,
|
|
180
|
+
remedy: "Pass the path to an existing, readable app directory."
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
for (const [name, path] of [["home", options.home], ["buildCache", options.buildCache]]) if (path !== void 0 && !isAbsolute(path)) throw new StimError({
|
|
184
|
+
code: "STIM_BAD_ARG",
|
|
185
|
+
message: `${name} must be an absolute path.`
|
|
186
|
+
});
|
|
187
|
+
const base = options.env ?? process.env;
|
|
188
|
+
const home = options.home ?? (base.STIM_HOME || join(base.HOME || base.USERPROFILE || homedir(), ".stim"));
|
|
189
|
+
const clientContext = {
|
|
190
|
+
...options,
|
|
191
|
+
projectRoot,
|
|
192
|
+
env: {
|
|
193
|
+
...base,
|
|
194
|
+
...options.home === void 0 ? {} : { STIM_HOME: options.home },
|
|
195
|
+
...options.buildCache === void 0 ? {} : { STIM_BUILD_CACHE: options.buildCache },
|
|
196
|
+
FORCE_COLOR: "0"
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
const begin = (signal, cancelOnProgress = false) => {
|
|
200
|
+
const controller = cancelOnProgress ? new AbortController() : void 0;
|
|
201
|
+
const abort = () => controller?.abort();
|
|
202
|
+
if (controller) {
|
|
203
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
204
|
+
if (signal?.aborted) abort();
|
|
205
|
+
}
|
|
206
|
+
const callback = {};
|
|
207
|
+
const output = (stream, message) => {
|
|
208
|
+
if ("error" in callback) return;
|
|
209
|
+
try {
|
|
210
|
+
options.onProgress?.({
|
|
211
|
+
stream,
|
|
212
|
+
message: stripVTControlCharacters(message)
|
|
213
|
+
});
|
|
214
|
+
} catch (error) {
|
|
215
|
+
callback.error = error;
|
|
216
|
+
controller?.abort();
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
const operation = operationContext(clientContext, home, output, controller?.signal ?? signal);
|
|
220
|
+
if (controller) operationState(operation).abortOperation = abort;
|
|
221
|
+
return {
|
|
222
|
+
context: operation,
|
|
223
|
+
callback,
|
|
224
|
+
dispose: () => signal?.removeEventListener("abort", abort)
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
const report = async (signal, work) => {
|
|
228
|
+
const operation = begin(signal, true);
|
|
229
|
+
operation.context.env.STIM_HOME = clientContext.env.STIM_HOME;
|
|
230
|
+
for (const name of [
|
|
231
|
+
"AGENT_DEVICE_STATE_DIR",
|
|
232
|
+
"AGENT_DEVICE_CLAIMS_DIR",
|
|
233
|
+
"AGENT_DEVICE_IOS_RUNNER_LEASE_DIR"
|
|
234
|
+
]) {
|
|
235
|
+
const directory = operation.context.env[name]?.trim();
|
|
236
|
+
if (directory) operation.context.env[name] = resolve(operation.context.cwd, directory);
|
|
237
|
+
}
|
|
238
|
+
try {
|
|
239
|
+
return await read(operation, (context) => runReport(context, (request) => withAmbientContext(request, () => work(request))));
|
|
240
|
+
} finally {
|
|
241
|
+
operation.dispose();
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
return {
|
|
245
|
+
projectRoot,
|
|
246
|
+
identity: ({ signal } = {}) => read(begin(signal), (operation) => ensureHomeIdentity(operation.signal)),
|
|
247
|
+
doctor: async ({ signal, platform, record } = {}) => {
|
|
248
|
+
if (platform !== void 0 && platform !== "ios" && platform !== "android") return Promise.reject(new StimError({
|
|
249
|
+
code: "STIM_BAD_ARG",
|
|
250
|
+
message: "platform must be ios or android."
|
|
251
|
+
}));
|
|
252
|
+
const result = await report(signal, (context) => readDoctorReport(context, platform, version));
|
|
253
|
+
if (record !== true) return result;
|
|
254
|
+
return read(begin(signal), async (context) => {
|
|
255
|
+
await recordDoctorCheck(result.project, platform, version, context.signal);
|
|
256
|
+
return result;
|
|
257
|
+
});
|
|
258
|
+
},
|
|
259
|
+
gc: ({ signal, olderThan, cache, worktrees } = {}) => {
|
|
260
|
+
if (olderThan !== void 0 && !Number.isSafeInteger(olderThan)) return Promise.reject(new StimError({
|
|
261
|
+
code: "STIM_BAD_ARG",
|
|
262
|
+
message: "olderThan must be a whole number of days."
|
|
263
|
+
}));
|
|
264
|
+
return report(signal, async (context) => {
|
|
265
|
+
const result = await readGcReport({
|
|
266
|
+
olderThan,
|
|
267
|
+
cache,
|
|
268
|
+
worktrees
|
|
269
|
+
}, {
|
|
270
|
+
operation: context,
|
|
271
|
+
easLedgerRoot: join(context.env.HOME || context.env.USERPROFILE || homedir(), ".stim", "machine", "eas")
|
|
272
|
+
});
|
|
273
|
+
if ("code" in result) throw new StimError(result);
|
|
274
|
+
return result;
|
|
275
|
+
});
|
|
276
|
+
},
|
|
277
|
+
settings: ({ signal } = {}) => read(begin(signal), async (operation) => readSettingsPayload(await readSettingsContext(operation.projectRoot, {
|
|
278
|
+
...operation.env,
|
|
279
|
+
STIM_HOME: clientContext.env.STIM_HOME
|
|
280
|
+
}, note(operation), operation.signal), operation.signal)),
|
|
281
|
+
setSetting: (key, value, { signal, scope, beforeWrite } = {}) => read(begin(signal), (operation) => mutateSetting({
|
|
282
|
+
action: "set",
|
|
283
|
+
key,
|
|
284
|
+
value,
|
|
285
|
+
scope
|
|
286
|
+
}, {
|
|
287
|
+
cwd: operation.projectRoot,
|
|
288
|
+
env: {
|
|
289
|
+
...operation.env,
|
|
290
|
+
STIM_HOME: clientContext.env.STIM_HOME
|
|
291
|
+
},
|
|
292
|
+
note: note(operation),
|
|
293
|
+
signal: operation.signal,
|
|
294
|
+
beforeWrite
|
|
295
|
+
})),
|
|
296
|
+
unsetSetting: (key, { signal, scope, beforeWrite } = {}) => read(begin(signal), (operation) => mutateSetting({
|
|
297
|
+
action: "unset",
|
|
298
|
+
key,
|
|
299
|
+
scope
|
|
300
|
+
}, {
|
|
301
|
+
cwd: operation.projectRoot,
|
|
302
|
+
env: {
|
|
303
|
+
...operation.env,
|
|
304
|
+
STIM_HOME: clientContext.env.STIM_HOME
|
|
305
|
+
},
|
|
306
|
+
note: note(operation),
|
|
307
|
+
signal: operation.signal,
|
|
308
|
+
beforeWrite
|
|
309
|
+
})),
|
|
310
|
+
stats: ({ signal } = {}) => read(begin(signal), async (operation) => (await readProjectStats(findProjectRoot(operation.projectRoot), operation.env, operation.signal)).report),
|
|
311
|
+
logs: ({ signal, ...request } = {}) => read(begin(signal), (operation) => readWorkspaceLogs(operation, request)),
|
|
312
|
+
followLogs: ({ signal, ...request }, onRecord, onBackfill) => {
|
|
313
|
+
const operation = begin(signal);
|
|
314
|
+
return read(operation, async (readContext) => {
|
|
315
|
+
const stop = await followWorkspaceLogs(readContext, request, onRecord, onBackfill);
|
|
316
|
+
if ("error" in operation.callback) stop();
|
|
317
|
+
return stop;
|
|
318
|
+
});
|
|
319
|
+
},
|
|
320
|
+
build: (({ signal, ...request }) => lifecycle(begin(signal, true), (operation) => build(operation, request))),
|
|
321
|
+
run: (({ signal, ...request }) => lifecycle(begin(signal, true), (operation) => run(operation, request))),
|
|
322
|
+
stop: ({ signal, ...request } = {}) => read(begin(signal), async (operation) => {
|
|
323
|
+
const root = operation.projectRoot;
|
|
324
|
+
const logs = workspaceLogsDir$1(root);
|
|
325
|
+
let result;
|
|
326
|
+
try {
|
|
327
|
+
result = await stopWorkspaceNow({
|
|
328
|
+
root,
|
|
329
|
+
slot: request.slot,
|
|
330
|
+
report: note(operation),
|
|
331
|
+
operation
|
|
332
|
+
});
|
|
333
|
+
} catch (error) {
|
|
334
|
+
if (operation.signal.aborted) throw error;
|
|
335
|
+
const failure = error;
|
|
336
|
+
throw new StimError({
|
|
337
|
+
code: failure.code ?? "STIM_RUN_FAILED",
|
|
338
|
+
message: error instanceof Error ? error.message : String(error),
|
|
339
|
+
remedy: failure.remedy ?? null,
|
|
340
|
+
details: {
|
|
341
|
+
logs,
|
|
342
|
+
cause: failure.details
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
if ("refusal" in result) throw new StimError({
|
|
347
|
+
...result.refusal,
|
|
348
|
+
details: {
|
|
349
|
+
logs,
|
|
350
|
+
cause: result.remote
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
return result;
|
|
354
|
+
}),
|
|
355
|
+
reload: async ({ signal, ...request } = {}) => {
|
|
356
|
+
const requestOperation = begin(signal, true);
|
|
357
|
+
try {
|
|
358
|
+
return await read(requestOperation, (context) => runReport(context, (operation) => withAmbientContext(operation, () => {
|
|
359
|
+
const result = reload(operation, request);
|
|
360
|
+
trackReportResource(operation, result.then(() => void 0, () => void 0), () => {});
|
|
361
|
+
return result;
|
|
362
|
+
})));
|
|
363
|
+
} finally {
|
|
364
|
+
requestOperation.dispose();
|
|
365
|
+
}
|
|
366
|
+
},
|
|
367
|
+
diagnostics({ signal, ...request } = {}) {
|
|
368
|
+
if (request.tail !== void 0 && (!Number.isSafeInteger(request.tail) || request.tail < 0)) return Promise.reject(new StimError({
|
|
369
|
+
code: "STIM_BAD_ARG",
|
|
370
|
+
message: "tail must be a non-negative integer."
|
|
371
|
+
}));
|
|
372
|
+
return read(begin(signal), async (operation) => {
|
|
373
|
+
const directory = workspaceLogsDir$1(operation.projectRoot);
|
|
374
|
+
if (request.tail === 0) return {
|
|
375
|
+
directory,
|
|
376
|
+
records: []
|
|
377
|
+
};
|
|
378
|
+
const view = await openLogDir(directory, { signal: operation.signal });
|
|
379
|
+
try {
|
|
380
|
+
return {
|
|
381
|
+
directory,
|
|
382
|
+
records: await view.query({
|
|
383
|
+
tail: request.tail ?? 200,
|
|
384
|
+
errorsOnly: request.errors ?? false
|
|
385
|
+
})
|
|
386
|
+
};
|
|
387
|
+
} finally {
|
|
388
|
+
await view.close();
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
function operationContext(client, home, output, signal) {
|
|
395
|
+
const runId = validRunId(client.env[RUN_ID_ENV]) ?? randomBytes(6).toString("hex");
|
|
396
|
+
return {
|
|
397
|
+
home,
|
|
398
|
+
buildCache: client.buildCache ?? null,
|
|
399
|
+
projectRoot: client.projectRoot,
|
|
400
|
+
cwd: client.projectRoot,
|
|
401
|
+
runId,
|
|
402
|
+
env: {
|
|
403
|
+
...client.env,
|
|
404
|
+
STIM_HOME: home,
|
|
405
|
+
[RUN_ID_ENV]: runId
|
|
406
|
+
},
|
|
407
|
+
signal: signal ?? new AbortController().signal,
|
|
408
|
+
output
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
async function read({ context, callback }, operation) {
|
|
412
|
+
const { signal } = context;
|
|
413
|
+
if (signal.aborted) throw cancelled();
|
|
414
|
+
let result;
|
|
415
|
+
try {
|
|
416
|
+
refuseRelativeStimPaths(context.env);
|
|
417
|
+
result = await withAmbientContext(context, () => operation(context));
|
|
418
|
+
} catch (error) {
|
|
419
|
+
if ("error" in callback) throw callback.error;
|
|
420
|
+
if (signal.aborted && !(error instanceof Error && "reportCleanup" in error)) throw cancelled();
|
|
421
|
+
if (error instanceof StimError) throw error;
|
|
422
|
+
if (error instanceof Error && "code" in error && typeof error.code === "string" && error.code.startsWith("STIM_")) {
|
|
423
|
+
const remedy = error instanceof SettingsRefusal ? error.remedy : null;
|
|
424
|
+
throw new StimError({
|
|
425
|
+
code: error.code,
|
|
426
|
+
message: error.message,
|
|
427
|
+
remedy
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
throw error;
|
|
431
|
+
}
|
|
432
|
+
if ("error" in callback) throw callback.error;
|
|
433
|
+
if (signal.aborted) throw cancelled();
|
|
434
|
+
return result;
|
|
435
|
+
}
|
|
436
|
+
function note(operation) {
|
|
437
|
+
return (line) => operation.output("stderr", `${line}\n`);
|
|
438
|
+
}
|
|
439
|
+
function cancelled() {
|
|
440
|
+
return new StimError({
|
|
441
|
+
code: "STIM_CANCELLED",
|
|
442
|
+
message: "The Stim operation was cancelled."
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
async function lifecycle(operation, work) {
|
|
446
|
+
try {
|
|
447
|
+
return await read(operation, async (context) => {
|
|
448
|
+
const logs = workspaceLogsDir$1(context.projectRoot);
|
|
449
|
+
try {
|
|
450
|
+
return await work(context);
|
|
451
|
+
} catch (error) {
|
|
452
|
+
const failure = error;
|
|
453
|
+
throw new StimError({
|
|
454
|
+
code: failure?.code ?? "STIM_RUN_FAILED",
|
|
455
|
+
message: error instanceof Error ? error.message : String(error),
|
|
456
|
+
remedy: failure?.remedy ?? null,
|
|
457
|
+
details: {
|
|
458
|
+
logs,
|
|
459
|
+
cause: failure?.details
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
} finally {
|
|
465
|
+
operation.dispose();
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
async function reload(context, options) {
|
|
469
|
+
if (options.platform !== void 0 && ![
|
|
470
|
+
"ios",
|
|
471
|
+
"android",
|
|
472
|
+
"web"
|
|
473
|
+
].includes(options.platform)) throw new StimError({
|
|
474
|
+
code: "STIM_BAD_ARG",
|
|
475
|
+
message: "platform must be ios, android or web."
|
|
476
|
+
});
|
|
477
|
+
const root = await findCommandWorkspaceAsync(context.projectRoot, (cwd) => repoRootAsync(cwd, {
|
|
478
|
+
env: context.env,
|
|
479
|
+
signal: context.signal
|
|
480
|
+
}), note(context));
|
|
481
|
+
context.signal.throwIfAborted();
|
|
482
|
+
if (!root) throw new StimError({
|
|
483
|
+
code: "STIM_NO_PROJECT",
|
|
484
|
+
message: `No Stim environment is registered for ${context.projectRoot}.`,
|
|
485
|
+
remedy: "Run stim start first."
|
|
486
|
+
});
|
|
487
|
+
options.beforeReload?.(root);
|
|
488
|
+
context.signal.throwIfAborted();
|
|
489
|
+
await recordWorkspaceUseAsync(root, /* @__PURE__ */ new Date(), context.env, context.projectRoot, context.signal);
|
|
490
|
+
const result = await runReload({
|
|
491
|
+
root,
|
|
492
|
+
platform: options.platform,
|
|
493
|
+
signal: context.signal
|
|
494
|
+
});
|
|
495
|
+
if (!result.ok) throw new StimError(result.error);
|
|
496
|
+
return result.facts;
|
|
497
|
+
}
|
|
498
|
+
async function build(context, options) {
|
|
499
|
+
const root = context.projectRoot;
|
|
500
|
+
switch (options.platform) {
|
|
501
|
+
case "ios": return {
|
|
502
|
+
platform: "ios",
|
|
503
|
+
facts: await buildIosOperation(context, root, options)
|
|
504
|
+
};
|
|
505
|
+
case "android": return {
|
|
506
|
+
platform: "android",
|
|
507
|
+
facts: await buildAndroidOperation(context, root, options)
|
|
508
|
+
};
|
|
509
|
+
case "macos": return {
|
|
510
|
+
platform: "macos",
|
|
511
|
+
facts: await buildMacosOperation(context, root, options)
|
|
512
|
+
};
|
|
513
|
+
default: throw new StimError({
|
|
514
|
+
code: "STIM_BAD_ARG",
|
|
515
|
+
message: "Unknown Stim build platform."
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
async function run(context, options) {
|
|
520
|
+
const root = context.projectRoot;
|
|
521
|
+
switch (options.platform) {
|
|
522
|
+
case "ios": {
|
|
523
|
+
let error;
|
|
524
|
+
const result = await runIosOperation(context, root, options, {}, (failure) => {
|
|
525
|
+
error = failure;
|
|
526
|
+
});
|
|
527
|
+
if (!result) throw new StimError({
|
|
528
|
+
code: error?.code ?? "STIM_RUN_FAILED",
|
|
529
|
+
message: error?.message ?? "The iOS run failed.",
|
|
530
|
+
remedy: error?.remedy,
|
|
531
|
+
details: error
|
|
532
|
+
});
|
|
533
|
+
return {
|
|
534
|
+
platform: "ios",
|
|
535
|
+
facts: result.facts
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
case "android": {
|
|
539
|
+
const result = await runAndroidOperation(context, root, options);
|
|
540
|
+
if (!result.ok || !result.facts) throw new StimError({
|
|
541
|
+
code: result.error?.code ?? "STIM_RUN_FAILED",
|
|
542
|
+
message: result.error?.message ?? "The Android run failed.",
|
|
543
|
+
remedy: result.error?.remedy
|
|
544
|
+
});
|
|
545
|
+
return {
|
|
546
|
+
platform: "android",
|
|
547
|
+
facts: result.facts
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
case "macos": {
|
|
551
|
+
const record = await runMacos(context, root, note(context), void 0, options.remoteBuild);
|
|
552
|
+
return {
|
|
553
|
+
platform: "macos",
|
|
554
|
+
facts: {
|
|
555
|
+
product: record.product,
|
|
556
|
+
bundle: record.bundle,
|
|
557
|
+
bundleId: record.bundleId,
|
|
558
|
+
executable: record.executable,
|
|
559
|
+
pid: record.app?.pid ?? null,
|
|
560
|
+
launched: record.app !== void 0,
|
|
561
|
+
build: record.build,
|
|
562
|
+
logs: { dir: workspaceLogsDir$1(root) }
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
case "web": {
|
|
567
|
+
const result = await runWeb({
|
|
568
|
+
root,
|
|
569
|
+
headed: options.headed ?? false,
|
|
570
|
+
note: note(context),
|
|
571
|
+
context
|
|
572
|
+
});
|
|
573
|
+
if (!result.ok) throw new StimError(result.error);
|
|
574
|
+
return {
|
|
575
|
+
platform: "web",
|
|
576
|
+
facts: result.facts
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
default: throw new StimError({
|
|
580
|
+
code: "STIM_BAD_ARG",
|
|
581
|
+
message: "Unknown Stim platform."
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
//#endregion
|
|
2
586
|
export { StimError, createStim };
|