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
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import { t as getExecutor } from "./exec-DqKo9GKJ.mjs";
|
|
2
|
-
import { D as withDirLock } from "./workspace-state-DJt_MMvf.mjs";
|
|
3
|
-
import { accessSync, constants, existsSync, mkdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
4
|
-
import { delimiter, dirname, join, resolve } from "node:path";
|
|
5
|
-
import { easMachineStateRoot, easMachineStateRoot as easMachineStateRoot$1, easSessionLedgerFile, easSessionLedgerLock, readEasSessionLedger, readEasSessionLedger as readEasSessionLedger$1, validEasSessionClaim } from "@stim-cli/core/state";
|
|
6
|
-
//#region src/diagnostics/stim-installations.ts
|
|
7
|
-
const VERSION_OUTPUT_LIMIT = 4096;
|
|
8
|
-
function parsedVersion(version) {
|
|
9
|
-
const match = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/.exec(version);
|
|
10
|
-
if (!match) return null;
|
|
11
|
-
const core = [
|
|
12
|
-
match[1],
|
|
13
|
-
match[2],
|
|
14
|
-
match[3]
|
|
15
|
-
];
|
|
16
|
-
if (core.some((part) => part.length > 1 && part.startsWith("0"))) return null;
|
|
17
|
-
const prereleaseParts = match[4]?.split(".");
|
|
18
|
-
if (prereleaseParts?.some((part) => !part || /^\d+$/.test(part) && part.length > 1 && part.startsWith("0"))) return null;
|
|
19
|
-
const prerelease = prereleaseParts?.map((part) => /^\d+$/.test(part) ? Number(part) : part);
|
|
20
|
-
return {
|
|
21
|
-
core: core.map(Number),
|
|
22
|
-
prerelease: prerelease ?? null
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
function compareStimVersions(left, right) {
|
|
26
|
-
const a = parsedVersion(left);
|
|
27
|
-
const b = parsedVersion(right);
|
|
28
|
-
if (!a || !b) return null;
|
|
29
|
-
for (let index = 0; index < a.core.length; index += 1) {
|
|
30
|
-
const difference = (a.core[index] ?? 0) - (b.core[index] ?? 0);
|
|
31
|
-
if (difference !== 0) return difference;
|
|
32
|
-
}
|
|
33
|
-
if (!a.prerelease && !b.prerelease) return 0;
|
|
34
|
-
if (!a.prerelease) return 1;
|
|
35
|
-
if (!b.prerelease) return -1;
|
|
36
|
-
for (let index = 0; index < Math.max(a.prerelease.length, b.prerelease.length); index += 1) {
|
|
37
|
-
const x = a.prerelease[index];
|
|
38
|
-
const y = b.prerelease[index];
|
|
39
|
-
if (x === void 0) return -1;
|
|
40
|
-
if (y === void 0) return 1;
|
|
41
|
-
if (x === y) continue;
|
|
42
|
-
if (typeof x === "number" && typeof y === "number") return x - y;
|
|
43
|
-
if (typeof x === "number") return -1;
|
|
44
|
-
if (typeof y === "number") return 1;
|
|
45
|
-
return x < y ? -1 : 1;
|
|
46
|
-
}
|
|
47
|
-
return 0;
|
|
48
|
-
}
|
|
49
|
-
function parseStimVersionOutput(output) {
|
|
50
|
-
const version = output?.split("\n")[0]?.trim() ?? "";
|
|
51
|
-
return parsedVersion(version) ? version.replace(/^v/, "") : null;
|
|
52
|
-
}
|
|
53
|
-
function executableNames(platform) {
|
|
54
|
-
return platform === "win32" ? [
|
|
55
|
-
"stim.cmd",
|
|
56
|
-
"stim.exe",
|
|
57
|
-
"stim"
|
|
58
|
-
] : ["stim"];
|
|
59
|
-
}
|
|
60
|
-
function stimExecutablePaths(pathValue, { platform = process.platform, cwd = process.cwd() } = {}) {
|
|
61
|
-
const found = [];
|
|
62
|
-
const seen = /* @__PURE__ */ new Set();
|
|
63
|
-
for (const entry of pathValue.split(delimiter)) {
|
|
64
|
-
const directory = resolve(cwd, entry || ".");
|
|
65
|
-
for (const name of executableNames(platform)) {
|
|
66
|
-
const path = join(directory, name);
|
|
67
|
-
try {
|
|
68
|
-
accessSync(path, platform === "win32" ? constants.F_OK : constants.X_OK);
|
|
69
|
-
if (!statSync(path).isFile()) continue;
|
|
70
|
-
const realPath = realpathSync(path);
|
|
71
|
-
if (seen.has(realPath)) continue;
|
|
72
|
-
seen.add(realPath);
|
|
73
|
-
found.push({
|
|
74
|
-
path,
|
|
75
|
-
realPath
|
|
76
|
-
});
|
|
77
|
-
} catch {}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return found;
|
|
81
|
-
}
|
|
82
|
-
function canonicalPath(path) {
|
|
83
|
-
if (!path) return null;
|
|
84
|
-
try {
|
|
85
|
-
return realpathSync(resolve(path));
|
|
86
|
-
} catch {
|
|
87
|
-
return resolve(path);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
function analyzeStimVersions(runningVersion, runningPath, installations) {
|
|
91
|
-
const candidates = [runningVersion, ...installations.map((entry) => entry.version)];
|
|
92
|
-
const versions = [...new Set(candidates)].filter((version) => version !== null && compareStimVersions(version, version) !== null).toSorted((left, right) => -(compareStimVersions(left, right) ?? 0));
|
|
93
|
-
const highestVersion = versions[0] ?? null;
|
|
94
|
-
const resolved = installations[0] ?? null;
|
|
95
|
-
return {
|
|
96
|
-
runningVersion,
|
|
97
|
-
runningPath,
|
|
98
|
-
resolved,
|
|
99
|
-
installations,
|
|
100
|
-
versions,
|
|
101
|
-
highestVersion,
|
|
102
|
-
resolvedIsOlder: Boolean(resolved?.version && highestVersion && (compareStimVersions(resolved.version, highestVersion) ?? 0) < 0)
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
function probeStimVersion(path, timeoutMs) {
|
|
106
|
-
return new Promise((resolveProbe) => {
|
|
107
|
-
let settled = false;
|
|
108
|
-
let output = "";
|
|
109
|
-
const finish = (version) => {
|
|
110
|
-
if (settled) return;
|
|
111
|
-
settled = true;
|
|
112
|
-
clearTimeout(timer);
|
|
113
|
-
resolveProbe(version);
|
|
114
|
-
};
|
|
115
|
-
let child;
|
|
116
|
-
try {
|
|
117
|
-
child = getExecutor().spawn(path, ["--version"], {
|
|
118
|
-
stdio: [
|
|
119
|
-
"ignore",
|
|
120
|
-
"pipe",
|
|
121
|
-
"ignore"
|
|
122
|
-
],
|
|
123
|
-
detached: process.platform !== "win32"
|
|
124
|
-
});
|
|
125
|
-
} catch {
|
|
126
|
-
resolveProbe(null);
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
const timer = setTimeout(() => {
|
|
130
|
-
try {
|
|
131
|
-
if (process.platform !== "win32" && child.pid) process.kill(-child.pid, "SIGKILL");
|
|
132
|
-
else child.kill("SIGKILL");
|
|
133
|
-
} catch {}
|
|
134
|
-
finish(null);
|
|
135
|
-
}, timeoutMs);
|
|
136
|
-
child.stdout?.on("data", (chunk) => {
|
|
137
|
-
if (output.length < VERSION_OUTPUT_LIMIT) output += String(chunk).slice(0, VERSION_OUTPUT_LIMIT - output.length);
|
|
138
|
-
});
|
|
139
|
-
child.on("error", () => finish(null));
|
|
140
|
-
child.on("close", (code) => finish(code === 0 ? parseStimVersionOutput(output) : null));
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
async function inspectStimVersions(runningVersion, { pathValue = process.env.PATH ?? "", runningPath = process.argv[1], probeTimeoutMs = 5e3 } = {}) {
|
|
144
|
-
const paths = stimExecutablePaths(pathValue);
|
|
145
|
-
const versions = await Promise.all(paths.map((entry) => probeStimVersion(entry.path, probeTimeoutMs)));
|
|
146
|
-
const installations = paths.map((entry, index) => ({
|
|
147
|
-
path: entry.path,
|
|
148
|
-
realPath: entry.realPath,
|
|
149
|
-
version: versions[index] ?? null
|
|
150
|
-
}));
|
|
151
|
-
return analyzeStimVersions(runningVersion, canonicalPath(runningPath), installations);
|
|
152
|
-
}
|
|
153
|
-
//#endregion
|
|
154
|
-
//#region src/engine/eas-machine-root-guard-env.ts
|
|
155
|
-
const EAS_TEST_GUARD_ROOT_ENV = "STIM_TEST_GUARD_REAL_EAS_ROOT";
|
|
156
|
-
//#endregion
|
|
157
|
-
//#region src/engine/eas-session-ledger.ts
|
|
158
|
-
function assertEasMachineRootWritable(root) {
|
|
159
|
-
const guardedRoot = process.env[EAS_TEST_GUARD_ROOT_ENV];
|
|
160
|
-
if (!guardedRoot || resolve(root) !== resolve(guardedRoot)) return;
|
|
161
|
-
throw new Error(`Refusing to write the real EAS machine root ${root} from a test process. Pass a temporary ledgerRoot, machineRoot, or easLedgerRoot, or point HOME (and USERPROFILE on Windows) at a temporary directory.`);
|
|
162
|
-
}
|
|
163
|
-
function writeLedger(root, ledger) {
|
|
164
|
-
mkdirSync(root, { recursive: true });
|
|
165
|
-
const file = easSessionLedgerFile(root);
|
|
166
|
-
const tmp = `${file}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;
|
|
167
|
-
writeFileSync(tmp, `${JSON.stringify(ledger, null, 2)}\n`);
|
|
168
|
-
try {
|
|
169
|
-
renameSync(tmp, file);
|
|
170
|
-
} catch (error) {
|
|
171
|
-
rmSync(tmp, { force: true });
|
|
172
|
-
throw error;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
function recordEasSessionClaim(claim, root = easMachineStateRoot()) {
|
|
176
|
-
assertEasMachineRootWritable(root);
|
|
177
|
-
const normalized = validEasSessionClaim(claim.sessionId, claim);
|
|
178
|
-
if (!normalized) throw new Error(`Invalid EAS session claim for ${claim.sessionId}.`);
|
|
179
|
-
withDirLock(easSessionLedgerLock(root), () => {
|
|
180
|
-
const current = readEasSessionLedger(root);
|
|
181
|
-
if (!current.safe) throw new Error(current.notice ?? "EAS ownership ledger is unreadable.");
|
|
182
|
-
current.claims.set(normalized.sessionId, normalized);
|
|
183
|
-
writeLedger(root, {
|
|
184
|
-
version: 1,
|
|
185
|
-
claims: Object.fromEntries(current.claims)
|
|
186
|
-
});
|
|
187
|
-
}, { ensureParent: () => mkdirSync(dirname(easSessionLedgerLock(root)), { recursive: true }) });
|
|
188
|
-
}
|
|
189
|
-
function removeEasSessionClaim(sessionId, root = easMachineStateRoot(), when = () => true) {
|
|
190
|
-
const file = easSessionLedgerFile(root);
|
|
191
|
-
if (!existsSync(file)) return false;
|
|
192
|
-
assertEasMachineRootWritable(root);
|
|
193
|
-
return withDirLock(easSessionLedgerLock(root), () => {
|
|
194
|
-
const current = readEasSessionLedger(root);
|
|
195
|
-
if (!current.safe) return false;
|
|
196
|
-
const claim = current.claims.get(sessionId);
|
|
197
|
-
if (!claim || !when(claim)) return false;
|
|
198
|
-
current.claims.delete(sessionId);
|
|
199
|
-
writeLedger(root, {
|
|
200
|
-
version: 1,
|
|
201
|
-
claims: Object.fromEntries(current.claims)
|
|
202
|
-
});
|
|
203
|
-
return true;
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
//#endregion
|
|
207
|
-
export { removeEasSessionClaim as a, recordEasSessionClaim as i, easMachineStateRoot$1 as n, compareStimVersions as o, readEasSessionLedger$1 as r, inspectStimVersions as s, assertEasMachineRootWritable as t };
|
package/dist/exec-DqKo9GKJ.mjs
DELETED
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
import { execSync } from "child_process";
|
|
2
|
-
import spawn from "cross-spawn";
|
|
3
|
-
import which from "which";
|
|
4
|
-
import { basename } from "path";
|
|
5
|
-
import { createDebugLog, runId } from "@stim-cli/core/state";
|
|
6
|
-
//#region src/debug-log.ts
|
|
7
|
-
const debugLog = createDebugLog("cli", { base: () => ({ runId: runId() }) });
|
|
8
|
-
//#endregion
|
|
9
|
-
//#region src/exec.ts
|
|
10
|
-
const MAX_BUFFER = 67108864;
|
|
11
|
-
function budgetMs(timeoutMs) {
|
|
12
|
-
if (timeoutMs === "unbounded") return void 0;
|
|
13
|
-
if (!(timeoutMs > 0)) throw new RangeError(`timeoutMs must be a positive number of milliseconds or 'unbounded', got ${timeoutMs}`);
|
|
14
|
-
return timeoutMs;
|
|
15
|
-
}
|
|
16
|
-
/** Whether an exec error is a child killed for exceeding its `timeoutMs`. */
|
|
17
|
-
function isTimeoutError(error) {
|
|
18
|
-
return typeof error === "object" && error !== null && "code" in error && error.code === "ETIMEDOUT";
|
|
19
|
-
}
|
|
20
|
-
function nameTimeout(error, command, timeoutMs) {
|
|
21
|
-
if (error?.code === "ETIMEDOUT" && error instanceof Error) error.message = `Command timed out after ${timeoutMs}ms: ${command}`;
|
|
22
|
-
return error;
|
|
23
|
-
}
|
|
24
|
-
const WINDOWS_BATCH_FILE = /\.(?:bat|cmd)$/i;
|
|
25
|
-
const BATCH_UNSAFE_ARGUMENT = /["\r\n]/;
|
|
26
|
-
function isUnsafeBatchSpawn(target, args, platform = process.platform) {
|
|
27
|
-
return platform === "win32" && WINDOWS_BATCH_FILE.test(target) && args.some((arg) => BATCH_UNSAFE_ARGUMENT.test(arg));
|
|
28
|
-
}
|
|
29
|
-
function refuseUnsafeBatchArguments(file, args) {
|
|
30
|
-
if (process.platform !== "win32") return;
|
|
31
|
-
const target = which.sync(file, { nothrow: true }) ?? file;
|
|
32
|
-
if (isUnsafeBatchSpawn(target, args)) throw new Error(`Refusing to run ${basename(target)}: an argument contains a character cmd.exe could misinterpret (a double quote or a line break).`);
|
|
33
|
-
}
|
|
34
|
-
function redactError(error, values) {
|
|
35
|
-
const secrets = values?.filter(Boolean) ?? [];
|
|
36
|
-
if (secrets.length === 0 || !error || typeof error !== "object") return error;
|
|
37
|
-
const scrub = (text) => secrets.reduce((acc, secret) => acc.split(secret).join("***"), text);
|
|
38
|
-
const fields = error;
|
|
39
|
-
for (const key of Object.getOwnPropertyNames(error)) {
|
|
40
|
-
const value = fields[key];
|
|
41
|
-
if (typeof value === "string") fields[key] = scrub(value);
|
|
42
|
-
else if (Array.isArray(value)) fields[key] = value.map((item) => typeof item === "string" ? scrub(item) : item);
|
|
43
|
-
}
|
|
44
|
-
return error;
|
|
45
|
-
}
|
|
46
|
-
const defaultExecutor = {
|
|
47
|
-
run(cmd, { timeoutMs, killSignal, cwd, env }) {
|
|
48
|
-
const opts = {
|
|
49
|
-
encoding: "utf-8",
|
|
50
|
-
stdio: [
|
|
51
|
-
"pipe",
|
|
52
|
-
"pipe",
|
|
53
|
-
"pipe"
|
|
54
|
-
],
|
|
55
|
-
maxBuffer: MAX_BUFFER
|
|
56
|
-
};
|
|
57
|
-
const timeout = budgetMs(timeoutMs);
|
|
58
|
-
if (timeout !== void 0) opts.timeout = timeout;
|
|
59
|
-
if (killSignal) opts.killSignal = killSignal;
|
|
60
|
-
if (cwd) opts.cwd = cwd;
|
|
61
|
-
if (env) opts.env = {
|
|
62
|
-
...process.env,
|
|
63
|
-
...env
|
|
64
|
-
};
|
|
65
|
-
try {
|
|
66
|
-
return String(execSync(cmd, opts)).trim();
|
|
67
|
-
} catch (error) {
|
|
68
|
-
throw nameTimeout(error, cmd, timeoutMs);
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
runFile(file, args = [], { timeoutMs, killSignal, cwd, env, omitEnv, input, untrimmed, rejectStderr, detachedSilent, redact }) {
|
|
72
|
-
const opts = {
|
|
73
|
-
encoding: "utf-8",
|
|
74
|
-
stdio: detachedSilent ? "ignore" : [
|
|
75
|
-
"pipe",
|
|
76
|
-
"pipe",
|
|
77
|
-
"pipe"
|
|
78
|
-
],
|
|
79
|
-
maxBuffer: MAX_BUFFER
|
|
80
|
-
};
|
|
81
|
-
if (detachedSilent) opts.detached = true;
|
|
82
|
-
const timeout = budgetMs(timeoutMs);
|
|
83
|
-
if (timeout !== void 0) opts.timeout = timeout;
|
|
84
|
-
if (killSignal) opts.killSignal = killSignal;
|
|
85
|
-
if (cwd) opts.cwd = cwd;
|
|
86
|
-
if (input !== void 0) opts.input = input;
|
|
87
|
-
if (env || omitEnv?.length) {
|
|
88
|
-
const childEnv = {
|
|
89
|
-
...process.env,
|
|
90
|
-
...env
|
|
91
|
-
};
|
|
92
|
-
for (const key of omitEnv ?? []) delete childEnv[key];
|
|
93
|
-
opts.env = childEnv;
|
|
94
|
-
}
|
|
95
|
-
refuseUnsafeBatchArguments(file, args);
|
|
96
|
-
const result = spawn.sync(file, args, opts);
|
|
97
|
-
if (result.error) throw redactError(nameTimeout(Object.assign(result.error, result), [file, ...args].join(" "), timeoutMs), redact);
|
|
98
|
-
if (result.status !== 0 || rejectStderr && String(result.stderr ?? "").trim()) {
|
|
99
|
-
const stderr = String(result.stderr ?? "");
|
|
100
|
-
const message = `Command failed: ${[file, ...args].join(" ")}${stderr ? `\n${stderr}` : ""}`;
|
|
101
|
-
throw redactError(Object.assign(new Error(message), result), redact);
|
|
102
|
-
}
|
|
103
|
-
if (detachedSilent) return "";
|
|
104
|
-
return untrimmed ? String(result.stdout) : String(result.stdout).trim();
|
|
105
|
-
},
|
|
106
|
-
runFileAsync(file, args = [], { timeoutMs, killSignal, cwd, env, omitEnv, rejectStderr, onSpawn, detachedSilent, redact }) {
|
|
107
|
-
const command = [file, ...args].join(" ");
|
|
108
|
-
return new Promise((resolve, reject) => {
|
|
109
|
-
refuseUnsafeBatchArguments(file, args);
|
|
110
|
-
const timeout = budgetMs(timeoutMs);
|
|
111
|
-
const opts = detachedSilent ? {
|
|
112
|
-
stdio: "ignore",
|
|
113
|
-
detached: true
|
|
114
|
-
} : { stdio: [
|
|
115
|
-
"ignore",
|
|
116
|
-
"pipe",
|
|
117
|
-
"pipe"
|
|
118
|
-
] };
|
|
119
|
-
if (cwd) opts.cwd = cwd;
|
|
120
|
-
if (env || omitEnv?.length) {
|
|
121
|
-
const childEnv = {
|
|
122
|
-
...process.env,
|
|
123
|
-
...env
|
|
124
|
-
};
|
|
125
|
-
for (const key of omitEnv ?? []) delete childEnv[key];
|
|
126
|
-
opts.env = childEnv;
|
|
127
|
-
}
|
|
128
|
-
const child = spawn(file, args, opts);
|
|
129
|
-
try {
|
|
130
|
-
onSpawn?.(child);
|
|
131
|
-
} catch (error) {
|
|
132
|
-
child.kill("SIGKILL");
|
|
133
|
-
reject(error);
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
const stdout = [];
|
|
137
|
-
const stderr = [];
|
|
138
|
-
let timedOut = false;
|
|
139
|
-
const timer = timeout === void 0 ? void 0 : setTimeout(() => {
|
|
140
|
-
timedOut = true;
|
|
141
|
-
child.kill(killSignal ?? "SIGTERM");
|
|
142
|
-
}, timeout);
|
|
143
|
-
child.stdout?.on("data", (chunk) => stdout.push(chunk));
|
|
144
|
-
child.stderr?.on("data", (chunk) => stderr.push(chunk));
|
|
145
|
-
child.on("error", (error) => {
|
|
146
|
-
clearTimeout(timer);
|
|
147
|
-
reject(redactError(error, redact));
|
|
148
|
-
});
|
|
149
|
-
child.on("close", (status, signal) => {
|
|
150
|
-
clearTimeout(timer);
|
|
151
|
-
const out = Buffer.concat(stdout).toString("utf-8");
|
|
152
|
-
const err = Buffer.concat(stderr).toString("utf-8");
|
|
153
|
-
const result = {
|
|
154
|
-
status,
|
|
155
|
-
signal,
|
|
156
|
-
stdout: out,
|
|
157
|
-
stderr: err
|
|
158
|
-
};
|
|
159
|
-
if (timedOut) reject(redactError(nameTimeout(Object.assign(new Error(command), result, { code: "ETIMEDOUT" }), command, timeoutMs), redact));
|
|
160
|
-
else if (status !== 0 || rejectStderr && err.trim()) reject(redactError(Object.assign(/* @__PURE__ */ new Error(`Command failed: ${command}${err ? `\n${err}` : ""}`), result), redact));
|
|
161
|
-
else resolve(detachedSilent ? "" : out.trim());
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
},
|
|
165
|
-
runQuiet(cmd, opts) {
|
|
166
|
-
budgetMs(opts.timeoutMs);
|
|
167
|
-
try {
|
|
168
|
-
return this.run(cmd, opts);
|
|
169
|
-
} catch {
|
|
170
|
-
return null;
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
runFileQuiet(file, args, opts) {
|
|
174
|
-
budgetMs(opts.timeoutMs);
|
|
175
|
-
try {
|
|
176
|
-
return this.runFile(file, args, opts);
|
|
177
|
-
} catch {
|
|
178
|
-
return null;
|
|
179
|
-
}
|
|
180
|
-
},
|
|
181
|
-
spawn(cmd, args = [], opts = {}) {
|
|
182
|
-
refuseUnsafeBatchArguments(cmd, args);
|
|
183
|
-
return spawn(cmd, args, opts);
|
|
184
|
-
},
|
|
185
|
-
findExecutable(name) {
|
|
186
|
-
return which.sync(name, { nothrow: true });
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
/** The program a call runs, without its arguments: those can carry tokens. */
|
|
190
|
-
const programOf = (command) => basename(command.trim().split(/\s+/)[0] ?? "");
|
|
191
|
-
function outcomeOf(error) {
|
|
192
|
-
const { status, signal, code } = error ?? {};
|
|
193
|
-
return {
|
|
194
|
-
ok: false,
|
|
195
|
-
...typeof status === "number" ? { exit: status } : {},
|
|
196
|
-
...signal ? { signal } : {},
|
|
197
|
-
...code ? { code } : {}
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
let executionId = 0;
|
|
201
|
-
function timedSync(fn, program) {
|
|
202
|
-
return (...args) => {
|
|
203
|
-
if (!debugLog.enabled()) return fn(...args);
|
|
204
|
-
const id = ++executionId;
|
|
205
|
-
const name = program(...args);
|
|
206
|
-
const started = performance.now();
|
|
207
|
-
debugLog.log("exec.start", {
|
|
208
|
-
program: name,
|
|
209
|
-
executionId: id
|
|
210
|
-
});
|
|
211
|
-
try {
|
|
212
|
-
const out = fn(...args);
|
|
213
|
-
debugLog.log("exec", {
|
|
214
|
-
program: name,
|
|
215
|
-
executionId: id,
|
|
216
|
-
ms: Math.round(performance.now() - started),
|
|
217
|
-
ok: true
|
|
218
|
-
});
|
|
219
|
-
return out;
|
|
220
|
-
} catch (error) {
|
|
221
|
-
debugLog.log("exec", {
|
|
222
|
-
program: name,
|
|
223
|
-
executionId: id,
|
|
224
|
-
ms: Math.round(performance.now() - started),
|
|
225
|
-
...outcomeOf(error)
|
|
226
|
-
});
|
|
227
|
-
throw error;
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
let active = {
|
|
232
|
-
...defaultExecutor,
|
|
233
|
-
run: timedSync((cmd, opts) => defaultExecutor.run(cmd, opts), programOf),
|
|
234
|
-
runFile: timedSync((file, args, opts) => defaultExecutor.runFile(file, args, opts), (file) => basename(file)),
|
|
235
|
-
async runFileAsync(file, args, opts) {
|
|
236
|
-
if (!debugLog.enabled()) return defaultExecutor.runFileAsync(file, args, opts);
|
|
237
|
-
const id = ++executionId;
|
|
238
|
-
const name = basename(file);
|
|
239
|
-
const started = performance.now();
|
|
240
|
-
debugLog.log("exec.start", {
|
|
241
|
-
program: name,
|
|
242
|
-
executionId: id
|
|
243
|
-
});
|
|
244
|
-
try {
|
|
245
|
-
const out = await defaultExecutor.runFileAsync(file, args, opts);
|
|
246
|
-
debugLog.log("exec", {
|
|
247
|
-
program: name,
|
|
248
|
-
executionId: id,
|
|
249
|
-
ms: Math.round(performance.now() - started),
|
|
250
|
-
ok: true
|
|
251
|
-
});
|
|
252
|
-
return out;
|
|
253
|
-
} catch (error) {
|
|
254
|
-
debugLog.log("exec", {
|
|
255
|
-
program: name,
|
|
256
|
-
executionId: id,
|
|
257
|
-
ms: Math.round(performance.now() - started),
|
|
258
|
-
...outcomeOf(error)
|
|
259
|
-
});
|
|
260
|
-
throw error;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
function getExecutor() {
|
|
265
|
-
return active;
|
|
266
|
-
}
|
|
267
|
-
//#endregion
|
|
268
|
-
export { isTimeoutError as n, debugLog as r, getExecutor as t };
|
package/dist/git-DDfFzkMm.mjs
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { t as getExecutor } from "./exec-DqKo9GKJ.mjs";
|
|
2
|
-
//#region src/workspace/git.ts
|
|
3
|
-
const GIT_TIMEOUT_MS = 1e4;
|
|
4
|
-
const GIT_CONCURRENCY = 6;
|
|
5
|
-
function gitCall(cwd, args, { write, timeoutMs = GIT_TIMEOUT_MS, ...opts }) {
|
|
6
|
-
return {
|
|
7
|
-
args: [
|
|
8
|
-
...write ? [] : ["--no-optional-locks"],
|
|
9
|
-
"-C",
|
|
10
|
-
cwd,
|
|
11
|
-
...args
|
|
12
|
-
],
|
|
13
|
-
opts: {
|
|
14
|
-
...opts,
|
|
15
|
-
timeoutMs
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
/** Runs git in `cwd`, bounded by `timeoutMs` (10 s by default); throws like `runFile`. */
|
|
20
|
-
function git(cwd, args, opts = {}) {
|
|
21
|
-
const call = gitCall(cwd, args, opts);
|
|
22
|
-
return getExecutor().runFile("git", call.args, call.opts);
|
|
23
|
-
}
|
|
24
|
-
/** `git`, returning null instead of throwing. */
|
|
25
|
-
function gitQuiet(cwd, args, opts = {}) {
|
|
26
|
-
const call = gitCall(cwd, args, opts);
|
|
27
|
-
return getExecutor().runFileQuiet("git", call.args, call.opts);
|
|
28
|
-
}
|
|
29
|
-
const queue = [];
|
|
30
|
-
let running = 0;
|
|
31
|
-
/** `git` without blocking the event loop, at most six at a time; the budget starts when the call leaves the queue. */
|
|
32
|
-
async function gitAsync(cwd, args, opts = {}) {
|
|
33
|
-
if (running < GIT_CONCURRENCY) running++;
|
|
34
|
-
else await new Promise((proceed) => queue.push(proceed));
|
|
35
|
-
try {
|
|
36
|
-
const call = gitCall(cwd, args, opts);
|
|
37
|
-
return await getExecutor().runFileAsync("git", call.args, call.opts);
|
|
38
|
-
} finally {
|
|
39
|
-
const next = queue.shift();
|
|
40
|
-
if (next) next();
|
|
41
|
-
else running--;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
//#endregion
|
|
45
|
-
export { gitAsync as n, gitQuiet as r, git as t };
|