stim 1.17.2 → 1.19.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 +50 -1
- package/dist/{activity-IRvJY_ru.mjs → activity-BSw0x84R.mjs} +4 -4
- package/dist/{agent-device-usage-output-BK41vnzN.mjs → agent-device-usage-output-Bjxu_VmX.mjs} +8 -8
- package/dist/{android-B9yaNKwa.mjs → android-BXc6BmEi.mjs} +658 -404
- package/dist/{android-B_YNZy61.mjs → android-BdQC6zs1.mjs} +9 -9
- package/dist/android-BvV1gGdN.mjs +4 -0
- package/dist/{android-DE4v59Mb.mjs → android-DE5g_5gv.mjs} +2 -2
- package/dist/{android-cas-ZFpjJBL_.mjs → android-cas-C87geAg-.mjs} +5 -5
- package/dist/android-cas-compiler.mjs +2 -2
- package/dist/api-DIf_s86s.mjs +150 -0
- package/dist/api-run.d.mts +1 -0
- package/dist/api-run.mjs +145 -0
- package/dist/api.d.mts +218 -0
- package/dist/api.mjs +2 -0
- package/dist/{app-install-VPkI5WEg.mjs → app-install-CFI4ptUL.mjs} +33 -13
- package/dist/{attempt-Bk2ouQVL.mjs → attempt-DW-mQqM7.mjs} +14 -4
- package/dist/{web-Dl0KSRHf.mjs → browser-web-CDhqQxhv.mjs} +138 -176
- package/dist/{budget-DfcgFdQB.mjs → budget-Dz-kyXLv.mjs} +1391 -58
- package/dist/build-facts-B87vo-Im.d.mts +142 -0
- package/dist/{cache-manifest-DnUHBJaU.mjs → cache-manifest-DiwKSyv9.mjs} +3 -3
- package/dist/cache-manifest.mjs +1 -1
- package/dist/{chrome-BrcVWQyD.mjs → chrome-BTUOo8p2.mjs} +1 -1
- package/dist/cli-C9Zvgbdc.mjs +68 -0
- package/dist/cli.mjs +1 -1
- package/dist/{client-SvBdgObD.mjs → client-CuUo8Nvg.mjs} +381 -49
- package/dist/collector-run.d.mts +6 -0
- package/dist/collector-run.mjs +9 -9
- package/dist/{command-output-CDAIFD-8.mjs → command-output-Bt8ygHE7.mjs} +2 -2
- package/dist/{config-D0DbpZtM.mjs → config-DC5jEtd1.mjs} +9 -5
- package/dist/{created-devices-CpvzBL25.mjs → created-devices-D0s26Hx5.mjs} +2 -2
- package/dist/{dependency-state-CLcBHH2M.mjs → dependency-state-DKaS1OM9.mjs} +2 -2
- package/dist/{detached-entry-CiTEgMR1.mjs → detached-entry-pB_IPfV4.mjs} +1 -1
- package/dist/{dev-client-B-XC4uRH.mjs → dev-client-CDY_zAmD.mjs} +2 -2
- package/dist/{device-C8IOoJPv.mjs → device-BHw0WlHl.mjs} +8 -8
- package/dist/{device-capacity-ZC4XSZ4R.mjs → device-capacity-BoN1jQkO.mjs} +25 -14
- package/dist/device-host-worker.mjs +19 -19
- package/dist/{gradle-dJpre3Yn.mjs → device-ios-B2ruohE-.mjs} +661 -107
- package/dist/{device-lease-DpoS36_u.mjs → device-lease-Cu7PtQpZ.mjs} +9 -9
- package/dist/{device-lease-run-B8YltIH_.mjs → device-lease-run-D38SnZtt.mjs} +4 -4
- package/dist/{device-pool-3o7s5lo4.mjs → device-pool-CP4rAsHx.mjs} +3 -3
- package/dist/{device-remote-hFSkpfQu.mjs → device-remote-B5GiUifk.mjs} +15 -16
- package/dist/{doctor-CFv1fCrF.mjs → doctor-PRJH94v6.mjs} +61 -34
- package/dist/doctor-watchman-wZhyTdp4.mjs +259 -0
- package/dist/{error-diagnostics-C-NMnhrk.mjs → error-diagnostics--v5HGOU0.mjs} +11 -11
- package/dist/{exec-CaErVv7t.mjs → exec-i8GDPwq9.mjs} +93 -6
- package/dist/{gc-DEmkg3Xh.mjs → gc-CyHMcKcn.mjs} +25 -471
- package/dist/{guide-CSmhMTf8.mjs → guide-dRaQJJk9.mjs} +681 -507
- package/dist/{hosted-android-E1Heoqnv.mjs → hosted-android-Bs7fytj7.mjs} +3 -3
- package/dist/{hosted-client-Bp4knSwu.mjs → hosted-client-C5G4h_OJ.mjs} +2 -2
- package/dist/{hosted-ios-BnbeYOUD.mjs → hosted-ios-Bik035eL.mjs} +1 -1
- package/dist/{hosted-logs-OcgIBvCT.mjs → hosted-logs-CI9Az9a4.mjs} +9 -9
- package/dist/{hosted-macos-DcxKjtfH.mjs → hosted-macos-DABm3ScO.mjs} +5 -5
- package/dist/{hosted-native-1Ebbig4w.mjs → hosted-native-DbV2aUVw.mjs} +13 -9
- package/dist/{idle-shutdown-IGyNV8Cr.mjs → idle-shutdown-DYiMBn34.mjs} +7 -8
- package/dist/{ios-DSfnPfse.mjs → ios-BWbHFZVz.mjs} +19 -7
- package/dist/{ios-Cr1h5gnO.mjs → ios-DCrkgXEM.mjs} +1 -1
- package/dist/ios-DYUr9LGc.mjs +8 -0
- package/dist/ios-ITYno9rO.mjs +2241 -0
- package/dist/{ios-device-pAN4t54-.mjs → ios-device-CJ_ZOGky.mjs} +3 -3
- package/dist/{ios-device-Ee7sDXfp.mjs → ios-device-CrW8aMb5.mjs} +1 -1
- package/dist/{ios-state-8L3lgum6.mjs → ios-state-By0XuLTQ.mjs} +1 -1
- package/dist/{launch-verify-lTnWZikR.mjs → launch-verify-DCveSE6d.mjs} +5 -5
- package/dist/{logs-BAaS7gS2.mjs → logs-Bao1HOMy.mjs} +13 -13
- package/dist/{macos-BIRQS90f.mjs → macos-ciyBdTY5.mjs} +194 -132
- package/dist/macos-nIOATJmR.mjs +2 -0
- package/dist/macos-run.mjs +1 -1
- package/dist/maintenance-run.mjs +349 -47
- package/dist/manifest-CX0d1IkZ.mjs +148 -0
- package/dist/{metro-g8NqiJp-.mjs → metro-DI2AjPF_.mjs} +196 -43
- package/dist/{metro-gateway-C-ijGI2F.mjs → metro-gateway-BxpJLIwh.mjs} +4 -4
- package/dist/{metro-store-CDDZHtPl.mjs → metro-store-BAHFcJm6.mjs} +16 -2
- package/dist/{build-plan-BDsSi09V.mjs → miss-reason-CjQCOKqq.mjs} +207 -249
- package/dist/{named-ports-C8m8EQs2.mjs → named-ports-B4iWH4E-.mjs} +70 -8
- package/dist/{native-runtime-BEK171xQ.mjs → native-runtime-BGxsbfny.mjs} +6 -6
- package/dist/{ndjson-PclOIwVY.mjs → ndjson-LGZAMsqa.mjs} +8 -4
- package/dist/offload-worker.d.mts +3 -45
- package/dist/offload-worker.mjs +11 -11
- package/dist/{ownership-DyRQru0q.mjs → ownership-EB0ySdGK.mjs} +3 -3
- package/dist/{page-QF_Ke10s.mjs → page-Bv9s2KwY.mjs} +1 -1
- package/dist/placement-log-Dxe34rJm.mjs +88 -0
- package/dist/plan-placement-BVY59qa8.mjs +290 -0
- package/dist/{ports-4nYqxPWC.mjs → ports-ByPc0_97.mjs} +3 -3
- package/dist/{prebuild-D7RUMkwN.mjs → prebuild-BKJ3wJI1.mjs} +5 -5
- package/dist/preview-BbSottmO.mjs +986 -0
- package/dist/{rolldown-runtime-BsOwBuO_.mjs → process-identity-Biv3arCO.mjs} +11 -1
- package/dist/project-B5eQ1USs.mjs +612 -0
- package/dist/{pull-request-pxnDCQzn.mjs → pull-request-IHNdMnG8.mjs} +1 -1
- package/dist/pull-requests.mjs +1 -1
- package/dist/react-native-ios-BMh2i25I.mjs +2 -0
- package/dist/react-native-ios-CSpIxexZ.mjs +2083 -0
- package/dist/{recordings-BNgsD1Tr.mjs → recordings-Bv8McZN4.mjs} +1 -1
- package/dist/{reload-DcRxj3qG.mjs → reload-rAPdqeRR.mjs} +14 -15
- package/dist/{remote-cache-Ci4DQYYj.mjs → remote-cache-N3hAEaAL.mjs} +5 -5
- package/dist/{run-CkE9y0nc.mjs → run-lAkle1-c.mjs} +5 -5
- package/dist/{server-bare-BkrSxSsZ.mjs → server-bare-CkIjnegq.mjs} +5 -6
- package/dist/server-expo-DGsdUGX2.mjs +2 -0
- package/dist/{server-expo-CHTyXD0G.mjs → server-expo-n3tUi3Em.mjs} +5 -6
- package/dist/{settings-SR9OmW9h.mjs → settings-2am7TSxp.mjs} +5 -5
- package/dist/{settings-Cfd-0r2d.mjs → settings-CxgngUZk.mjs} +116 -103
- package/dist/{settings-BBpMcDbD.mjs → settings-Djl-mpjX.mjs} +1 -1
- package/dist/settings.schema.json +198 -9
- package/dist/{simslim-BWNrc3M3.mjs → simslim-D9LkJxIO.mjs} +7 -7
- package/dist/{slot-launch-DmjBmpQV.mjs → slot-launch-HV_KtPIw.mjs} +6 -6
- package/dist/{spawn-claims-D0XfSe8u.mjs → spawn-claims-Kqiifsk2.mjs} +1 -1
- package/dist/{spawn-entry-jw19m8Nl.mjs → spawn-entry-Dcb7sDUz.mjs} +1 -0
- package/dist/{stage-CzaiwFsI.mjs → stage-BgaZJVZY.mjs} +14 -3
- package/dist/{start-AlfCPRVU.mjs → start-D8NbxNBb.mjs} +1 -1
- package/dist/{start-DUz3mYdb.mjs → start-DtxthMfI.mjs} +34 -27
- package/dist/{state-PeQiJuIu.mjs → state-D2KtnALG.mjs} +4 -4
- package/dist/{state-DyaNTgfR.mjs → state-Tp4uImDS.mjs} +5 -3
- package/dist/{state-B4PQFXMW.d.mts → state-lKh8shBp.d.mts} +2 -3
- package/dist/{stats-Bq4fJOdB.mjs → stats-8EJ5ivFT.mjs} +6 -6
- package/dist/{status-DlKvVJBE.mjs → status-BEeL6IKz.mjs} +6 -4
- package/dist/{status-BA2pehwf.mjs → status-BOyp0CUl.mjs} +31 -34
- package/dist/{stim-desktop-Cnz8CPnl.mjs → stim-desktop-C65jk_q2.mjs} +1 -1
- package/dist/{stim-installations-QMEI32v1.mjs → stim-installations-DbmUjsLv.mjs} +1 -1
- package/dist/stop-D0UIpZuh.mjs +72 -0
- package/dist/{stop-zF1y04f2.mjs → stop-DRipAg-e.mjs} +2 -2
- package/dist/{stop-DQIasgKp.mjs → stop-zDlknFoz.mjs} +79 -33
- package/dist/supervisor-run.d.mts +24 -22
- package/dist/supervisor-run.mjs +21 -22
- package/dist/{support-CsJNVfOc.mjs → support-CNqYkV0y.mjs} +7 -7
- package/dist/{support-WvD__tSV.mjs → support-DsNaFg6D.mjs} +5 -5
- package/dist/swiftpm-macos-aJzPAj1t.mjs +119 -0
- package/dist/{toolchain-DNyR3NPq.mjs → toolchain-C3xSoyUl.mjs} +475 -269
- package/dist/{trigger-Bemu8ytw.mjs → trigger-CAhmG-4s.mjs} +6 -6
- package/dist/trigger-CoalsMTV.mjs +2 -0
- package/dist/{warm-progress-DF4JRvYI.mjs → warm-progress-pFLB2e6P.mjs} +135 -38
- package/dist/{status-CzS4bPO9.mjs → watchman-BL1IdOtq.mjs} +75 -7
- package/dist/web-DFpFeZu5.mjs +2 -0
- package/dist/web-DbbrPUn0.mjs +127 -0
- package/dist/web-run.mjs +10 -10
- package/dist/{workspace-state-DqcCbpE7.mjs → workspace-state-CR9X86xJ.mjs} +3 -3
- package/dist/{ownership-BMLqyBgJ.mjs → workspaces-Djb2gfi9.mjs} +661 -23
- package/dist/{worktree-Be_7NLKy.mjs → worktree-BL4M1rhB.mjs} +252 -50
- package/dist/{worktree-j3IcFAI5.mjs → worktree-DV-A0LNL.mjs} +1 -1
- package/package.json +10 -5
- package/shim/bundle-response.cjs +2 -1
- package/shim/bundle-response.d.cts +1 -1
- package/shim/expo-metro-config.cjs +1 -1
- package/dist/build-progress-D0WkjCPd.mjs +0 -1036
- package/dist/build-slots-41v_d2x9.mjs +0 -142
- package/dist/cli-CYXb29oE.mjs +0 -51
- package/dist/deps-iKw0eD4P.mjs +0 -438
- package/dist/device-ios-C2Um-XUR.mjs +0 -412
- package/dist/errors-B6W7FkxQ.mjs +0 -15
- package/dist/guide-status-Du-ZQ3FD.mjs +0 -125
- package/dist/idle-BXG__1BA.mjs +0 -176
- package/dist/in-use-CvGOUn-x.mjs +0 -130
- package/dist/ios-BJ4XUSe1.mjs +0 -3867
- package/dist/native-run-D1Q56rAD.mjs +0 -158
- package/dist/preview-B-g9d7kV.mjs +0 -318
- package/dist/process-identity-BmRm1qV0.mjs +0 -12
- package/dist/project-D47Rh0ly.mjs +0 -276
- package/dist/server-expo-CeakhI8P.mjs +0 -2
- package/dist/state-BKa8wNN5.mjs +0 -148
- package/dist/stop-BIiM49EY.mjs +0 -48
- package/dist/stop-cause-rhmGfwvt.mjs +0 -97
- package/dist/trigger-CXts6qt1.mjs +0 -2
- package/dist/watchman-APYjXSQa.mjs +0 -48
- package/dist/workspace-process-lock-2mNzOlaB.mjs +0 -58
- package/dist/workspaces-Bcib97-6.mjs +0 -306
package/dist/idle-BXG__1BA.mjs
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { H as projectDeviceSlots } from "./config-D0DbpZtM.mjs";
|
|
2
|
-
import { o as formatLongDuration } from "./command-output-CDAIFD-8.mjs";
|
|
3
|
-
import { r as readWorkspaceState } from "./workspace-state-DqcCbpE7.mjs";
|
|
4
|
-
import { i as recordGcResult } from "./in-use-CvGOUn-x.mjs";
|
|
5
|
-
import { o as idleForMs, r as createActivityReader } from "./activity-IRvJY_ru.mjs";
|
|
6
|
-
import { z as ownedAvdSerialResolver } from "./android-B_YNZy61.mjs";
|
|
7
|
-
import { g as teardownOwnedIosSim, m as teardownOwnedAvd } from "./ownership-BMLqyBgJ.mjs";
|
|
8
|
-
import { r as activeBuildState, s as parseActiveBuild, t as ACTIVE_BUILD_KEY } from "./build-progress-D0WkjCPd.mjs";
|
|
9
|
-
import chalk from "chalk";
|
|
10
|
-
//#region src/commands/gc/idle.ts
|
|
11
|
-
function findOwnedDeviceActivity({ config, sims, androidSerial, readActivity, deadProjects = [] }) {
|
|
12
|
-
const booted = new Map(sims.filter((sim) => sim.state === "Booted").map((sim) => [sim.udid, sim.name]));
|
|
13
|
-
const dead = new Set(deadProjects);
|
|
14
|
-
const found = [];
|
|
15
|
-
for (const [project, record] of Object.entries(config?.projects ?? {})) {
|
|
16
|
-
if (dead.has(project)) continue;
|
|
17
|
-
for (const { slot, platforms } of projectDeviceSlots(record)) {
|
|
18
|
-
const ios = platforms.ios;
|
|
19
|
-
if (ios?.owned && ios.deviceUdid && booted.has(ios.deviceUdid)) found.push({
|
|
20
|
-
kind: "ios",
|
|
21
|
-
id: ios.deviceUdid,
|
|
22
|
-
name: booted.get(ios.deviceUdid) ?? ios.deviceUdid,
|
|
23
|
-
project,
|
|
24
|
-
slot,
|
|
25
|
-
activity: readActivity({
|
|
26
|
-
platform: "ios",
|
|
27
|
-
id: ios.deviceUdid,
|
|
28
|
-
slot,
|
|
29
|
-
workspace: project
|
|
30
|
-
})
|
|
31
|
-
});
|
|
32
|
-
const android = platforms.android;
|
|
33
|
-
const serial = android?.owned && android.avdName ? androidSerial(android.avdName) : null;
|
|
34
|
-
if (android?.avdName && serial) found.push({
|
|
35
|
-
kind: "android",
|
|
36
|
-
id: android.avdName,
|
|
37
|
-
name: android.avdName,
|
|
38
|
-
project,
|
|
39
|
-
slot,
|
|
40
|
-
activity: readActivity({
|
|
41
|
-
platform: "android",
|
|
42
|
-
id: serial,
|
|
43
|
-
slot,
|
|
44
|
-
workspace: project
|
|
45
|
-
})
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return found;
|
|
50
|
-
}
|
|
51
|
-
function findIdleDevices({ buildInProgress, now, ...inputs }) {
|
|
52
|
-
return findOwnedDeviceActivity(inputs).filter((device) => device.activity.state === "idle").map(({ kind, id, name, project, slot, activity }) => ({
|
|
53
|
-
kind,
|
|
54
|
-
id,
|
|
55
|
-
name,
|
|
56
|
-
project,
|
|
57
|
-
slot,
|
|
58
|
-
lastActivityAt: activity.lastActivityAt ?? null,
|
|
59
|
-
idleForMs: idleForMs(activity, now),
|
|
60
|
-
buildInProgress: buildInProgress(project)
|
|
61
|
-
}));
|
|
62
|
-
}
|
|
63
|
-
function idleShutdownCandidates(devices, idleMs) {
|
|
64
|
-
return devices.filter((d) => !d.buildInProgress && d.idleForMs !== null && d.idleForMs >= idleMs);
|
|
65
|
-
}
|
|
66
|
-
function parseIdleDuration(value) {
|
|
67
|
-
const match = /^([1-9][0-9]*)(m|h|d)$/.exec(value.trim());
|
|
68
|
-
if (!match) return null;
|
|
69
|
-
const unit = {
|
|
70
|
-
m: 6e4,
|
|
71
|
-
h: 36e5,
|
|
72
|
-
d: 864e5
|
|
73
|
-
}[match[2]];
|
|
74
|
-
return Number(match[1]) * unit;
|
|
75
|
-
}
|
|
76
|
-
function workspaceBuildInProgress(project) {
|
|
77
|
-
const record = parseActiveBuild(readWorkspaceState(project)?.[ACTIVE_BUILD_KEY]);
|
|
78
|
-
if (!record) return false;
|
|
79
|
-
try {
|
|
80
|
-
return activeBuildState(record.claim) !== "stale";
|
|
81
|
-
} catch {
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
function deviceActivityInputs(config, sims, now) {
|
|
86
|
-
const resolve = ownedAvdSerialResolver({ timeoutMs: 5e3 });
|
|
87
|
-
return {
|
|
88
|
-
config,
|
|
89
|
-
sims,
|
|
90
|
-
readActivity: createActivityReader({ now }),
|
|
91
|
-
androidSerial: (avdName) => {
|
|
92
|
-
try {
|
|
93
|
-
return resolve(avdName).serial ?? null;
|
|
94
|
-
} catch {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
function collectOwnedDeviceActivity(config, sims, now = Date.now()) {
|
|
101
|
-
return findOwnedDeviceActivity(deviceActivityInputs(config, sims, now));
|
|
102
|
-
}
|
|
103
|
-
function collectIdleDevices(config, sims, deadProjects, now = Date.now()) {
|
|
104
|
-
return findIdleDevices({
|
|
105
|
-
...deviceActivityInputs(config, sims, now),
|
|
106
|
-
deadProjects,
|
|
107
|
-
now,
|
|
108
|
-
buildInProgress: workspaceBuildInProgress
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
function idleDeviceLines(devices) {
|
|
112
|
-
if (devices.length === 0) return [];
|
|
113
|
-
return [`Idle owned devices (${devices.length}) - booted with no driver, claim, or recent activity:`, ...devices.map((d) => {
|
|
114
|
-
const slot = d.slot === "default" ? "" : ` [${d.slot}]`;
|
|
115
|
-
const idle = d.idleForMs === null ? "idle for an unknown time" : `idle ${formatLongDuration(d.idleForMs)}`;
|
|
116
|
-
const build = d.buildInProgress ? ", build in progress" : "";
|
|
117
|
-
return ` ${d.kind}${slot} ${d.name} (${d.project}) -- ${idle}${build}`;
|
|
118
|
-
})];
|
|
119
|
-
}
|
|
120
|
-
function shutDownIdleDevices(devices, idleMs, recollect) {
|
|
121
|
-
const candidates = idleShutdownCandidates(devices, idleMs);
|
|
122
|
-
const shutDown = [];
|
|
123
|
-
if (candidates.length === 0) {
|
|
124
|
-
console.log(chalk.dim(`No owned device has been idle for ${formatLongDuration(idleMs)} or more.`));
|
|
125
|
-
return {
|
|
126
|
-
failures: 0,
|
|
127
|
-
shutDown
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
const fresh = idleShutdownCandidates(recollect(), idleMs);
|
|
131
|
-
let failures = 0;
|
|
132
|
-
for (const device of candidates) {
|
|
133
|
-
const what = `${device.kind} ${device.name}`;
|
|
134
|
-
const current = fresh.find((d) => d.kind === device.kind && d.id === device.id && d.project === device.project && d.slot === device.slot);
|
|
135
|
-
if (!current) {
|
|
136
|
-
console.log(chalk.dim(`Kept ${what}: it is no longer idle for ${formatLongDuration(idleMs)}.`));
|
|
137
|
-
recordGcResult("idleDevice", "kept", device.name, {
|
|
138
|
-
id: device.id,
|
|
139
|
-
detail: `it is no longer idle for ${formatLongDuration(idleMs)}`
|
|
140
|
-
});
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
const outcome = device.kind === "ios" ? teardownOwnedIosSim(device.id, { label: device.name }) : teardownOwnedAvd(device.id, { owner: {
|
|
144
|
-
projectPath: device.project,
|
|
145
|
-
slot: device.slot
|
|
146
|
-
} });
|
|
147
|
-
if (outcome.status === "torn-down") {
|
|
148
|
-
shutDown.push(device);
|
|
149
|
-
console.log(chalk.green(`Shut down ${what}, idle ${formatLongDuration(current.idleForMs)}`));
|
|
150
|
-
recordGcResult("idleDevice", "done", device.name, {
|
|
151
|
-
id: device.id,
|
|
152
|
-
detail: `idle ${formatLongDuration(current.idleForMs)}`
|
|
153
|
-
});
|
|
154
|
-
} else if (outcome.status === "missing") console.log(chalk.dim(`${what} is already gone; nothing to shut down.`));
|
|
155
|
-
else if (outcome.status === "skipped") {
|
|
156
|
-
console.log(chalk.yellow(`Skipped ${what}: ${outcome.reason}`));
|
|
157
|
-
recordGcResult("idleDevice", "kept", device.name, {
|
|
158
|
-
id: device.id,
|
|
159
|
-
detail: outcome.reason
|
|
160
|
-
});
|
|
161
|
-
} else {
|
|
162
|
-
failures++;
|
|
163
|
-
console.log(chalk.red(`Failed to shut down ${what}: ${outcome.reason}`));
|
|
164
|
-
recordGcResult("idleDevice", "failed", device.name, {
|
|
165
|
-
id: device.id,
|
|
166
|
-
detail: outcome.reason
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
return {
|
|
171
|
-
failures,
|
|
172
|
-
shutDown
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
//#endregion
|
|
176
|
-
export { parseIdleDuration as a, idleShutdownCandidates as i, collectOwnedDeviceActivity as n, shutDownIdleDevices as o, idleDeviceLines as r, workspaceBuildInProgress as s, collectIdleDevices as t };
|
package/dist/in-use-CvGOUn-x.mjs
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { p as getProject } from "./config-D0DbpZtM.mjs";
|
|
2
|
-
import { n as ownership_claim_exports } from "./process-identity-BmRm1qV0.mjs";
|
|
3
|
-
import { r as readWorkspaceState$1, v as workspaceDir } from "./workspace-state-DqcCbpE7.mjs";
|
|
4
|
-
import { o as readWebRecord, u as webFacts } from "./state-PeQiJuIu.mjs";
|
|
5
|
-
import { h as listBuildLocks } from "./device-lease-DpoS36_u.mjs";
|
|
6
|
-
import { n as listBuildSlots } from "./build-slots-41v_d2x9.mjs";
|
|
7
|
-
import { n as managedLockHolders, t as resolveSupervisorTarget } from "./ownership-BMLqyBgJ.mjs";
|
|
8
|
-
import { n as workspaceProcessLockError, r as workspaceProcessLockPath, t as withWorkspaceProcessLock } from "./workspace-process-lock-2mNzOlaB.mjs";
|
|
9
|
-
import { i as macosRuntimeClaim } from "./state-DyaNTgfR.mjs";
|
|
10
|
-
import { lstatSync, readdirSync, rmSync, rmdirSync, unlinkSync } from "node:fs";
|
|
11
|
-
import { join } from "node:path";
|
|
12
|
-
import { realpathSync as realpathSync$1 } from "fs";
|
|
13
|
-
import { resolve as resolve$1 } from "path";
|
|
14
|
-
import { hostedNativeRecords, macosAppState, parseHostedNativePlacement, readMacosRecord, unreadableHostedNative } from "@stim-cli/core/state";
|
|
15
|
-
//#region src/commands/gc/paths.ts
|
|
16
|
-
function canonicalPath(p) {
|
|
17
|
-
try {
|
|
18
|
-
return realpathSync$1(p);
|
|
19
|
-
} catch {
|
|
20
|
-
return resolve$1(p);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region src/commands/gc/results.ts
|
|
25
|
-
const results = [];
|
|
26
|
-
function recordGcResult(kind, status, label, { id = null, bytes = null, detail = null } = {}) {
|
|
27
|
-
results.push({
|
|
28
|
-
kind,
|
|
29
|
-
status,
|
|
30
|
-
label,
|
|
31
|
-
id,
|
|
32
|
-
bytes,
|
|
33
|
-
detail
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
function takeGcResults() {
|
|
37
|
-
return results.splice(0);
|
|
38
|
-
}
|
|
39
|
-
//#endregion
|
|
40
|
-
//#region src/workspace/in-use.ts
|
|
41
|
-
const NATIVE_RUN = "native-run";
|
|
42
|
-
const NATIVE_RUN_HELD = "a stim ios, android or stop run holds its native-run.lock";
|
|
43
|
-
function workspaceInUse(root, { supervisor = true, managedLocks = true, hosted = true, nativeRun = true } = {}) {
|
|
44
|
-
const reasons = [];
|
|
45
|
-
if (supervisor) {
|
|
46
|
-
const project = getProject(root);
|
|
47
|
-
const target = resolveSupervisorTarget({
|
|
48
|
-
state: readWorkspaceState$1(root)?.supervisor,
|
|
49
|
-
record: project?.supervisor,
|
|
50
|
-
reservedPort: project?.metroPort
|
|
51
|
-
});
|
|
52
|
-
if (target.status === "ours") reasons.push(`its dev server supervisor (pid ${target.pid}) is running`);
|
|
53
|
-
else if (target.status === "unverified") reasons.push(`its dev server supervisor cannot be verified: ${target.reason ?? "unknown identity"}`);
|
|
54
|
-
const macos = macosAppState(readMacosRecord(root));
|
|
55
|
-
if (macos?.host) reasons.push(`its macOS app runs on ${macos.host.machine}`);
|
|
56
|
-
else if (macos?.state === "running" || macos?.state === "orphaned" || macos?.build.state === "running") reasons.push("its macOS app or build is running");
|
|
57
|
-
else if (macos?.state === "unverified" || !macos && readWorkspaceState$1(root)?.macos !== void 0) reasons.push("its macOS process owner cannot be verified");
|
|
58
|
-
const runtime = (0, ownership_claim_exports.readClaimSet)(macosRuntimeClaim(root));
|
|
59
|
-
if (runtime.live.length) reasons.push("its macOS runtime claim is held");
|
|
60
|
-
else if (runtime.unresolved[0]) reasons.push(`its macOS runtime cannot be verified: ${runtime.unresolved[0].reason}`);
|
|
61
|
-
const browser = webFacts(readWebRecord(root));
|
|
62
|
-
if (browser?.status === "running" || browser?.status === "orphaned") reasons.push(`its owned Chrome (pid ${browser.record.chromeProcess?.pid}) is running`);
|
|
63
|
-
else if (browser?.status === "unverified") reasons.push("its owned Chrome cannot be verified");
|
|
64
|
-
}
|
|
65
|
-
if (nativeRun) {
|
|
66
|
-
const claims = (0, ownership_claim_exports.readClaimSet)(workspaceProcessLockPath(workspaceDir(root), NATIVE_RUN, true));
|
|
67
|
-
if (claims.live.length) reasons.push(NATIVE_RUN_HELD);
|
|
68
|
-
else if (claims.unresolved[0]) reasons.push(`its native-run.lock cannot be resolved: ${claims.unresolved[0].reason}`);
|
|
69
|
-
}
|
|
70
|
-
for (const platform of ["ios", "android"]) for (const [slot, record] of Object.entries(hosted ? hostedNativeRecords(readWorkspaceState$1(root), platform) : {})) {
|
|
71
|
-
const placement = parseHostedNativePlacement(record, platform);
|
|
72
|
-
reasons.push(placement ? `its ${platform === "ios" ? "iOS simulator" : "Android emulator"} runs on ${placement.machine}` : unreadableHostedNative(slot, platform));
|
|
73
|
-
}
|
|
74
|
-
const self = canonicalPath(root);
|
|
75
|
-
for (const [kind, entries] of [["build lock", listBuildLocks()], ["build slot", listBuildSlots()]]) for (const entry of entries) {
|
|
76
|
-
if (!entry.alive && !entry.unresolved) continue;
|
|
77
|
-
if (entry.projectRoot !== null && canonicalPath(entry.projectRoot) === self) reasons.push(`a ${entry.alive ? "live" : "unresolvable"} ${kind} at ${entry.path} names it`);
|
|
78
|
-
}
|
|
79
|
-
if (managedLocks) reasons.push(...managedLockHolders(root));
|
|
80
|
-
return reasons;
|
|
81
|
-
}
|
|
82
|
-
function emptyWorkspaceDir(dir) {
|
|
83
|
-
if (lstatSync(dir).isSymbolicLink()) {
|
|
84
|
-
unlinkSync(dir);
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
for (const name of readdirSync(dir)) if (name !== `${NATIVE_RUN}.lock`) rmSync(join(dir, name), {
|
|
88
|
-
recursive: true,
|
|
89
|
-
force: true
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
async function withIdleWorkspace(root, fn, { purpose, ...checks }) {
|
|
93
|
-
try {
|
|
94
|
-
return await withWorkspaceProcessLock(workspaceDir(root), NATIVE_RUN, async () => {
|
|
95
|
-
const reasons = workspaceInUse(root, {
|
|
96
|
-
...checks,
|
|
97
|
-
nativeRun: false
|
|
98
|
-
});
|
|
99
|
-
if (reasons.length) return {
|
|
100
|
-
ran: false,
|
|
101
|
-
reasons
|
|
102
|
-
};
|
|
103
|
-
return {
|
|
104
|
-
ran: true,
|
|
105
|
-
value: await fn()
|
|
106
|
-
};
|
|
107
|
-
}, {
|
|
108
|
-
external: true,
|
|
109
|
-
waitMs: 0,
|
|
110
|
-
ownerPurpose: purpose
|
|
111
|
-
});
|
|
112
|
-
} catch (error) {
|
|
113
|
-
if (workspaceProcessLockError(error)) return {
|
|
114
|
-
ran: false,
|
|
115
|
-
reasons: [NATIVE_RUN_HELD]
|
|
116
|
-
};
|
|
117
|
-
if ((0, ownership_claim_exports.isClaimRefusal)(error) || (0, ownership_claim_exports.isClaimUnavailable)(error)) return {
|
|
118
|
-
ran: false,
|
|
119
|
-
reasons: [`its native-run.lock cannot be taken: ${error.reason}`]
|
|
120
|
-
};
|
|
121
|
-
throw error;
|
|
122
|
-
} finally {
|
|
123
|
-
try {
|
|
124
|
-
const dir = workspaceDir(root);
|
|
125
|
-
if (!lstatSync(dir).isSymbolicLink()) rmdirSync(dir);
|
|
126
|
-
} catch {}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
//#endregion
|
|
130
|
-
export { takeGcResults as a, recordGcResult as i, withIdleWorkspace as n, canonicalPath as o, workspaceInUse as r, emptyWorkspaceDir as t };
|