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
|
@@ -1,9 +1,64 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { n as ownership_claim_exports, t as process_identity_exports } from "./process-identity-Biv3arCO.mjs";
|
|
2
|
+
import { t as getExecutor } from "./exec-i8GDPwq9.mjs";
|
|
3
|
+
import { C as saveConfig, D as withConfigLock, _ as loadConfig, c as ensureConfig, d as getConfigDir, p as getProject } from "./config-DC5jEtd1.mjs";
|
|
4
|
+
import { d as signalProcessTree, f as createPortProbe, o as parseNetstatPids } from "./metro-DI2AjPF_.mjs";
|
|
5
|
+
import { n as declareSpawnsOn, o as stopDeclaringSpawnsOn } from "./spawn-claims-Kqiifsk2.mjs";
|
|
6
6
|
import { realpathSync } from "node:fs";
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
import { setTimeout } from "node:timers/promises";
|
|
9
|
+
//#region src/engine/workspace-process-lock.ts
|
|
10
|
+
const DEFAULT_WAIT_MS = 6e4;
|
|
11
|
+
const POLL_MS = 25;
|
|
12
|
+
function workspaceProcessLockError(err) {
|
|
13
|
+
const code = err?.code;
|
|
14
|
+
if (code === "STIM_LOCK_REFUSED") return "refused";
|
|
15
|
+
if (code === "STIM_LOCK_TIMEOUT") return "timeout";
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
function workspaceProcessLockPath(root, name, external) {
|
|
19
|
+
return external ? join(root, `${name}.lock`) : join(root, ".stim", `${name}.lock`);
|
|
20
|
+
}
|
|
21
|
+
async function withWorkspaceProcessLock(root, name, fn, { now = Date.now, signal, sleep = (ms) => setTimeout(ms, void 0, { signal }), waitMs = DEFAULT_WAIT_MS, ownerPurpose, details = {}, onHeld, rejectOwnerPurposes = [], external = false, declareSpawns = false } = {}) {
|
|
22
|
+
const path = workspaceProcessLockPath(root, name, external);
|
|
23
|
+
const deadline = now() + waitMs;
|
|
24
|
+
for (;;) {
|
|
25
|
+
signal?.throwIfAborted();
|
|
26
|
+
const attempt = (0, ownership_claim_exports.tryAcquireClaim)({
|
|
27
|
+
root: path,
|
|
28
|
+
mode: "exclusive",
|
|
29
|
+
label: `${name} lock`,
|
|
30
|
+
details: ownerPurpose ? {
|
|
31
|
+
...details,
|
|
32
|
+
purpose: ownerPurpose
|
|
33
|
+
} : details
|
|
34
|
+
});
|
|
35
|
+
if (attempt.pending) (0, ownership_claim_exports.releaseClaim)(attempt.pending);
|
|
36
|
+
if (attempt.acquired) {
|
|
37
|
+
if (declareSpawns) declareSpawnsOn(attempt.acquired);
|
|
38
|
+
try {
|
|
39
|
+
return await fn(attempt.acquired);
|
|
40
|
+
} finally {
|
|
41
|
+
stopDeclaringSpawnsOn(attempt.acquired);
|
|
42
|
+
(0, ownership_claim_exports.releaseClaim)(attempt.acquired);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const holder = attempt.held ?? attempt.waitingFor?.[0];
|
|
46
|
+
const purpose = holder?.details.purpose;
|
|
47
|
+
if (typeof purpose === "string" && rejectOwnerPurposes.includes(purpose)) {
|
|
48
|
+
const error = /* @__PURE__ */ new Error(`The ${name} lock at ${path} is held for ${purpose}.`);
|
|
49
|
+
error.code = "STIM_LOCK_REFUSED";
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
if (holder && onHeld) await onHeld(holder);
|
|
53
|
+
if (now() >= deadline) {
|
|
54
|
+
const error = /* @__PURE__ */ new Error(`Timed out waiting for the ${name} lock at ${path}.`);
|
|
55
|
+
error.code = "STIM_LOCK_TIMEOUT";
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
await sleep(POLL_MS);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
7
62
|
//#region src/named-ports.ts
|
|
8
63
|
const FIRST_PORT = 8900;
|
|
9
64
|
const LAST_PORT = 8999;
|
|
@@ -14,7 +69,14 @@ function validatePortLabel(label) {
|
|
|
14
69
|
if (!/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/.test(label)) throw new Error("A port label must start with a letter and contain at most 64 letters, digits, underscores or hyphens.");
|
|
15
70
|
}
|
|
16
71
|
function portListeners(port, platform) {
|
|
17
|
-
if (platform === "win32")
|
|
72
|
+
if (platform === "win32") {
|
|
73
|
+
const out = getExecutor().runFile("netstat", ["-ano"], {
|
|
74
|
+
timeoutMs: 5e3,
|
|
75
|
+
rejectStderr: true
|
|
76
|
+
});
|
|
77
|
+
if (!/^\s*(?:Proto|TCP)\s/m.test(out)) throw new Error("netstat printed no TCP connection table.");
|
|
78
|
+
return parseNetstatPids(out, port);
|
|
79
|
+
}
|
|
18
80
|
let out;
|
|
19
81
|
try {
|
|
20
82
|
out = getExecutor().runFile("lsof", [
|
|
@@ -71,7 +133,7 @@ function releaseBrowserPort(projectPath, port) {
|
|
|
71
133
|
saveConfig(cfg);
|
|
72
134
|
}));
|
|
73
135
|
}
|
|
74
|
-
async function allocateNamedPort(projectPath, label, { isFree =
|
|
136
|
+
async function allocateNamedPort(projectPath, label, { isFree = createPortProbe() }) {
|
|
75
137
|
const root = realpathSync(projectPath);
|
|
76
138
|
return withPortsLock(async () => {
|
|
77
139
|
const existing = getProject(root)?.ports;
|
|
@@ -165,4 +227,4 @@ async function clearNamedPorts(projectPath, { label, stop = false, dryRun = fals
|
|
|
165
227
|
});
|
|
166
228
|
}
|
|
167
229
|
//#endregion
|
|
168
|
-
export { reserveBrowserPort as i, getNamedPort as n, releaseBrowserPort as r, clearNamedPorts as t };
|
|
230
|
+
export { withWorkspaceProcessLock as a, reserveBrowserPort as i, getNamedPort as n, workspaceProcessLockError as o, releaseBrowserPort as r, workspaceProcessLockPath as s, clearNamedPorts as t };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { l as phaseLine } from "./command-output-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { r as LAUNCH_UNVERIFIED, t as LAUNCH_BUNDLING } from "./launch-verify-
|
|
6
|
-
import { c as startDevServer } from "./start-
|
|
1
|
+
import { l as phaseLine } from "./command-output-Bt8ygHE7.mjs";
|
|
2
|
+
import { r as readWorkspaceState$1, u as ensureWorkspaceStorage } from "./workspace-state-CR9X86xJ.mjs";
|
|
3
|
+
import { x as metroPortSetting } from "./settings-CxgngUZk.mjs";
|
|
4
|
+
import { u as resolveProjectMetro } from "./metro-DI2AjPF_.mjs";
|
|
5
|
+
import { r as LAUNCH_UNVERIFIED, t as LAUNCH_BUNDLING } from "./launch-verify-DCveSE6d.mjs";
|
|
6
|
+
import { c as startDevServer } from "./start-DtxthMfI.mjs";
|
|
7
7
|
import { readIdleStop } from "@stim-cli/core/state";
|
|
8
8
|
import chalk from "chalk";
|
|
9
9
|
//#region src/commands/native-runtime.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { closeSync, mkdirSync, openSync, writeSync } from "fs";
|
|
2
1
|
import { dirname } from "path";
|
|
2
|
+
import { LEVELS, SOURCES, levelRank, parseNdjsonLine, readNdjsonGenerations as readNdjsonGenerations$1, runId } from "@stim-cli/core/state";
|
|
3
|
+
import { closeSync, mkdirSync, openSync, writeSync } from "fs";
|
|
3
4
|
import { rotateLog } from "@stim-cli/core";
|
|
4
|
-
import { LEVELS, SOURCES, levelRank, parseNdjsonLine, readNdjsonGenerations as readNdjsonGenerations$1 } from "@stim-cli/core/state";
|
|
5
5
|
//#region src/ndjson.ts
|
|
6
6
|
const ROTATE_CHECK_MS = 1e3;
|
|
7
7
|
function formatNdjsonLine(record) {
|
|
@@ -104,9 +104,13 @@ function createNdjsonWriter(file, { truncate = false, fields = {}, maxBytes, now
|
|
|
104
104
|
}
|
|
105
105
|
function stamp(record) {
|
|
106
106
|
const base = record && typeof record === "object" && !Array.isArray(record) ? record : { msg: String(record) };
|
|
107
|
-
|
|
108
|
-
return {
|
|
107
|
+
const withRun = typeof base.runId === "string" ? base : {
|
|
109
108
|
...base,
|
|
109
|
+
runId: runId()
|
|
110
|
+
};
|
|
111
|
+
if (typeof base.ts === "number" && Number.isFinite(base.ts)) return withRun;
|
|
112
|
+
return {
|
|
113
|
+
...withRun,
|
|
110
114
|
ts: Date.now()
|
|
111
115
|
};
|
|
112
116
|
}
|
|
@@ -1,52 +1,10 @@
|
|
|
1
|
+
import "./state-lKh8shBp.mjs";
|
|
2
|
+
import { a as Optimizations, n as CcacheActivity, r as CompilationCacheActivity } from "./build-facts-B87vo-Im.mjs";
|
|
1
3
|
import "./ndjson-Du3j0AQ9.mjs";
|
|
2
|
-
import "./state-B4PQFXMW.mjs";
|
|
3
|
-
import { readFileSync } from "fs";
|
|
4
4
|
import "@stim-cli/core/state";
|
|
5
|
+
import { readFileSync } from "fs";
|
|
5
6
|
import "@expo/fingerprint";
|
|
6
7
|
import "@stim-cli/core/protocol";
|
|
7
|
-
//#region src/engine/build-facts.d.ts
|
|
8
|
-
interface CompilationCacheActivity {
|
|
9
|
-
status: "reported" | "unavailable" | "not-run";
|
|
10
|
-
hits: number | null;
|
|
11
|
-
cacheableTasks: number | null;
|
|
12
|
-
hitRatePercent: number | null;
|
|
13
|
-
swiftTargetsWithoutExplicitModules?: number;
|
|
14
|
-
}
|
|
15
|
-
interface CcacheActivity {
|
|
16
|
-
status: "reported" | "unavailable" | "not-run";
|
|
17
|
-
hits: number | null;
|
|
18
|
-
misses: number | null;
|
|
19
|
-
hitRatePercent: number | null;
|
|
20
|
-
}
|
|
21
|
-
//#endregion
|
|
22
|
-
//#region src/optimizations.d.ts
|
|
23
|
-
interface Optimizations {
|
|
24
|
-
buildCache: boolean;
|
|
25
|
-
remoteBuildCache: boolean;
|
|
26
|
-
releaseBundleSwap: boolean;
|
|
27
|
-
metroSharedCache: boolean;
|
|
28
|
-
metroWarmup: boolean;
|
|
29
|
-
ios: {
|
|
30
|
-
compilationCache: boolean;
|
|
31
|
-
swiftCompilationCache: boolean | null;
|
|
32
|
-
prefixMapping: boolean;
|
|
33
|
-
};
|
|
34
|
-
android: {
|
|
35
|
-
compilerCache: "ccache" | "cas" | "none";
|
|
36
|
-
casToolchain: string | null;
|
|
37
|
-
compilerCacheFallback: CompilerCacheFallback | null;
|
|
38
|
-
pch: "auto" | "on" | "off";
|
|
39
|
-
gradleBuildCache: boolean;
|
|
40
|
-
targetAbiOnly: boolean;
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
interface CompilerCacheFallback {
|
|
44
|
-
key: string;
|
|
45
|
-
reason: string;
|
|
46
|
-
fromEnvironment: boolean;
|
|
47
|
-
manifest: string | null;
|
|
48
|
-
}
|
|
49
|
-
//#endregion
|
|
50
8
|
//#region src/offload/client.d.ts
|
|
51
9
|
/** The Gradle choices that shape the APK, so the machine builds what this Mac's cache key describes. */
|
|
52
10
|
interface AndroidBuildOptions {
|
package/dist/offload-worker.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { t as getExecutor } from "./exec-
|
|
1
|
+
import { t as getExecutor } from "./exec-i8GDPwq9.mjs";
|
|
2
2
|
import { n as stripAnsi } from "./process-output-Fpl8PYi8.mjs";
|
|
3
|
-
import { D as fingerprintProject, M as refingerprintAfterMutation } from "./device-lease-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { n as recordPrebuild, r as runPrebuild, t as planPrebuild } from "./prebuild-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { createHash } from "node:crypto";
|
|
3
|
+
import { D as fingerprintProject, M as refingerprintAfterMutation } from "./device-lease-Cu7PtQpZ.mjs";
|
|
4
|
+
import { r as CCACHE_UNAVAILABLE, s as resolveCcache, t as manifestDigest } from "./manifest-CX0d1IkZ.mjs";
|
|
5
|
+
import { c as podsAreStale, f as runPodInstall, l as readPodState, o as workerToolchain } from "./toolchain-C3xSoyUl.mjs";
|
|
6
|
+
import { m as assembleTaskFor, o as buildAndroid, s as buildIos, u as gradlewPath } from "./device-ios-B2ruohE-.mjs";
|
|
7
|
+
import { n as recordPrebuild, r as runPrebuild, t as planPrebuild } from "./prebuild-BKJ3wJI1.mjs";
|
|
8
|
+
import { d as podAction } from "./support-CNqYkV0y.mjs";
|
|
9
|
+
import { r as stageBundle, t as resolveBundleExtras } from "./stage-BgaZJVZY.mjs";
|
|
10
|
+
import { t as logLines } from "./run-lAkle1-c.mjs";
|
|
12
11
|
import { chmodSync, constants, copyFileSync, cpSync, createReadStream, existsSync, lstatSync, mkdirSync, readFileSync, realpathSync, renameSync, rmSync, statSync, symlinkSync, writeFileSync } from "node:fs";
|
|
13
12
|
import { basename, dirname, join } from "node:path";
|
|
13
|
+
import { createHash } from "node:crypto";
|
|
14
14
|
//#region src/offload/worker.ts
|
|
15
15
|
function emit(value) {
|
|
16
16
|
process.stdout.write(`${JSON.stringify(value)}\n`);
|
|
@@ -582,7 +582,7 @@ async function compileAndroid(job, root, log, time) {
|
|
|
582
582
|
}
|
|
583
583
|
async function main() {
|
|
584
584
|
const mode = process.argv[2];
|
|
585
|
-
if (mode === "offer") return emit(workerToolchain());
|
|
585
|
+
if (mode === "offer") return emit(workerToolchain(process.argv[3] ?? null));
|
|
586
586
|
if (mode === "build") {
|
|
587
587
|
const chunks = [];
|
|
588
588
|
for await (const chunk of process.stdin) chunks.push(chunk);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as process_identity_exports } from "./process-identity-
|
|
2
|
-
import { o as
|
|
3
|
-
import {
|
|
1
|
+
import { t as process_identity_exports } from "./process-identity-Biv3arCO.mjs";
|
|
2
|
+
import { c as writeWorkspaceState, o as withWorkspaceStateLock, r as readWorkspaceState } from "./workspace-state-CR9X86xJ.mjs";
|
|
3
|
+
import { s as pidExists } from "./metro-DI2AjPF_.mjs";
|
|
4
4
|
import { realpathSync } from "node:fs";
|
|
5
5
|
//#region src/collector/state.ts
|
|
6
6
|
function collectorRoot(root) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as process_identity_exports } from "./process-identity-
|
|
1
|
+
import { t as process_identity_exports } from "./process-identity-Biv3arCO.mjs";
|
|
2
2
|
import { t as connectOwnedBrowser } from "./cdp-Dq_ypAlJ.mjs";
|
|
3
3
|
//#region src/web/page.ts
|
|
4
4
|
/** The record of a verified live browser: its supervisor and Chrome are the processes the record names. */
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { T as buildPlacementSettings } from "./client-CuUo8Nvg.mjs";
|
|
2
|
+
//#region src/placement-log.ts
|
|
3
|
+
/** `machine` is `local` when the run stays on this Mac. */
|
|
4
|
+
function placementRecord(input) {
|
|
5
|
+
const { choice, fallback } = input;
|
|
6
|
+
const event = input.event ?? (input.kind === "build" ? "build_placement" : "device_placement");
|
|
7
|
+
const base = `${input.kind} placement: ${choice.machine} (${choice.msg})`;
|
|
8
|
+
return {
|
|
9
|
+
src: "placement",
|
|
10
|
+
level: fallback ? "warn" : "info",
|
|
11
|
+
...input,
|
|
12
|
+
event,
|
|
13
|
+
msg: fallback ? `${base}; fell back: ${fallback.msg}` : base
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function skippedCandidates(skipped) {
|
|
17
|
+
return skipped.map(({ machine, code, reason }) => ({
|
|
18
|
+
machine,
|
|
19
|
+
code,
|
|
20
|
+
msg: reason
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
function devicePlacementRecord({ platform, fromFlag, easFallback = false, placed }) {
|
|
24
|
+
return placementRecord({
|
|
25
|
+
kind: "device",
|
|
26
|
+
platform,
|
|
27
|
+
settings: [{
|
|
28
|
+
key: `${platform}.remote`,
|
|
29
|
+
value: "auto",
|
|
30
|
+
from: fromFlag ? "flag" : "setting"
|
|
31
|
+
}, ...easFallback ? [{
|
|
32
|
+
key: "remote.easFallback",
|
|
33
|
+
value: "true",
|
|
34
|
+
from: "setting"
|
|
35
|
+
}] : []],
|
|
36
|
+
candidates: skippedCandidates(placed.skipped),
|
|
37
|
+
choice: {
|
|
38
|
+
machine: placed.placement.machine ?? "local",
|
|
39
|
+
code: placed.code,
|
|
40
|
+
msg: placed.placement.reason
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The record for where a build runs. `stays` is the reason this Mac builds it, `chose` the remote Mac that takes it,
|
|
46
|
+
* and `fallback` why a remote Mac that was meant to build it did not.
|
|
47
|
+
*/
|
|
48
|
+
function buildPlacementRecord({ platform, buildMachine, candidates = [], ...outcome }) {
|
|
49
|
+
const base = {
|
|
50
|
+
kind: "build",
|
|
51
|
+
platform,
|
|
52
|
+
settings: buildPlacementSettings(buildMachine),
|
|
53
|
+
candidates
|
|
54
|
+
};
|
|
55
|
+
if ("stays" in outcome) return placementRecord({
|
|
56
|
+
...base,
|
|
57
|
+
choice: {
|
|
58
|
+
machine: "local",
|
|
59
|
+
code: outcome.stays.code,
|
|
60
|
+
msg: outcome.stays.reason
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
if ("chose" in outcome) return placementRecord({
|
|
64
|
+
...base,
|
|
65
|
+
choice: {
|
|
66
|
+
machine: outcome.chose.machine,
|
|
67
|
+
code: "placed",
|
|
68
|
+
msg: outcome.chose.reason
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
const { code, reason, machine } = outcome.fallback;
|
|
72
|
+
return placementRecord({
|
|
73
|
+
...base,
|
|
74
|
+
event: outcome.event ?? "build_placement",
|
|
75
|
+
choice: {
|
|
76
|
+
machine: "local",
|
|
77
|
+
code,
|
|
78
|
+
msg: "building on this Mac"
|
|
79
|
+
},
|
|
80
|
+
fallback: {
|
|
81
|
+
code,
|
|
82
|
+
msg: reason,
|
|
83
|
+
...machine ? { machine } : {}
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
export { devicePlacementRecord as n, buildPlacementRecord as t };
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import { i as formatDuration, l as phaseLine, m as shortHash, u as plural } from "./command-output-Bt8ygHE7.mjs";
|
|
2
|
+
import { Ct as removeTemporaryEntry, St as makeTemporaryDirectory } from "./settings-CxgngUZk.mjs";
|
|
3
|
+
import { B as readStats$1, M as estimateBuild } from "./budget-Dz-kyXLv.mjs";
|
|
4
|
+
import { w as entryDir, y as artifactIn } from "./device-lease-Cu7PtQpZ.mjs";
|
|
5
|
+
import { N as hostingMachines } from "./client-CuUo8Nvg.mjs";
|
|
6
|
+
import { r as readHostedNative } from "./ios-state-By0XuLTQ.mjs";
|
|
7
|
+
import { g as automaticDevicePlacement, r as predictBuildMiss, v as probeHost } from "./miss-reason-CjQCOKqq.mjs";
|
|
8
|
+
import { a as easAuthNote } from "./remote-cache-N3hAEaAL.mjs";
|
|
9
|
+
import { i as staleNativeDirRefusal } from "./prebuild-BKJ3wJI1.mjs";
|
|
10
|
+
import { automaticMachineEnabled } from "@stim-cli/core/state";
|
|
11
|
+
import chalk from "chalk";
|
|
12
|
+
import { resolveTieredBuild } from "@stim-cli/cache";
|
|
13
|
+
//#region src/engine/artifact-lifecycle.ts
|
|
14
|
+
async function runArtifactLifecycle(phases) {
|
|
15
|
+
try {
|
|
16
|
+
const resolved = await phases.resolve();
|
|
17
|
+
if (resolved.kind === "ready") return resolved.artifact;
|
|
18
|
+
const cached = resolved.kind === "cached" ? resolved.artifact : await phases.claim?.() ?? null;
|
|
19
|
+
if (cached !== null) {
|
|
20
|
+
const reused = await phases.reuse(cached);
|
|
21
|
+
if (reused !== null) return reused;
|
|
22
|
+
}
|
|
23
|
+
const { build } = phases;
|
|
24
|
+
const placement = build.placement?.select() ?? null;
|
|
25
|
+
if (placement === null) await build.admit();
|
|
26
|
+
const preparation = await build.prepare();
|
|
27
|
+
const late = await build.revalidate(preparation);
|
|
28
|
+
if (late !== null) return late.ready;
|
|
29
|
+
if (build.placement && placement !== null) {
|
|
30
|
+
const offloaded = await build.placement.acquire(placement, preparation);
|
|
31
|
+
if (offloaded !== null) return offloaded.ready;
|
|
32
|
+
await build.admit();
|
|
33
|
+
}
|
|
34
|
+
const artifact = await build.compile(placement, preparation);
|
|
35
|
+
if (await build.validate(preparation) === "cacheable") await build.store(artifact);
|
|
36
|
+
return build.finish ? await build.finish(artifact) : artifact;
|
|
37
|
+
} finally {
|
|
38
|
+
phases.release();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/commands/build-plan.ts
|
|
43
|
+
const DISCARD = {
|
|
44
|
+
file: "",
|
|
45
|
+
written: 0,
|
|
46
|
+
dropped: 0,
|
|
47
|
+
lastError: null,
|
|
48
|
+
write: () => true,
|
|
49
|
+
close: () => ({
|
|
50
|
+
file: "",
|
|
51
|
+
written: 0,
|
|
52
|
+
dropped: 0,
|
|
53
|
+
lastError: null
|
|
54
|
+
})
|
|
55
|
+
};
|
|
56
|
+
async function providerHit({ root, platform, cacheKey, providerConfig }, deps) {
|
|
57
|
+
if (!providerConfig) return null;
|
|
58
|
+
let destinationDir;
|
|
59
|
+
try {
|
|
60
|
+
destinationDir = makeTemporaryDirectory(root, "stim-plan-");
|
|
61
|
+
} catch (error) {
|
|
62
|
+
deps.note(chalk.yellow(phaseLine("cache", `provider not checked: ${error?.message || error}`)));
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
const found = await resolveTieredBuild({
|
|
67
|
+
local: {
|
|
68
|
+
resolve: () => null,
|
|
69
|
+
store: () => null
|
|
70
|
+
},
|
|
71
|
+
loadProvider: () => deps.loadCacheProvider({
|
|
72
|
+
projectRoot: root,
|
|
73
|
+
config: providerConfig
|
|
74
|
+
}),
|
|
75
|
+
target: {
|
|
76
|
+
projectRoot: root,
|
|
77
|
+
platform,
|
|
78
|
+
key: cacheKey
|
|
79
|
+
},
|
|
80
|
+
destinationDir,
|
|
81
|
+
warn: (_code, message) => deps.note(chalk.yellow(phaseLine("cache", message)))
|
|
82
|
+
});
|
|
83
|
+
return found ? found.providerName ?? "the cache provider" : null;
|
|
84
|
+
} finally {
|
|
85
|
+
removeTemporaryEntry(destinationDir);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
async function expoRemoteHit(lookup, deps) {
|
|
89
|
+
if (!lookup.expoRemote) return null;
|
|
90
|
+
const { root, platform, isExpo, fingerprint } = lookup;
|
|
91
|
+
const loaded = await deps.loadProjectProvider(root, { isExpo });
|
|
92
|
+
if (loaded?.unavailable) {
|
|
93
|
+
deps.note(chalk.yellow(phaseLine("cache", `provider not usable: ${loaded.unavailable}`)));
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
if (!loaded?.provider) return null;
|
|
97
|
+
const name = loaded.name ?? "the build cache provider";
|
|
98
|
+
if (name === "eas") {
|
|
99
|
+
const auth = deps.checkEasAuth({
|
|
100
|
+
projectRoot: root,
|
|
101
|
+
owner: loaded.owner || null
|
|
102
|
+
});
|
|
103
|
+
const authNote = easAuthNote(auth);
|
|
104
|
+
if (authNote) deps.note(chalk.yellow(phaseLine("cache", authNote)));
|
|
105
|
+
if (auth?.code === "logged-out") return null;
|
|
106
|
+
}
|
|
107
|
+
const hit = await deps.resolveRemote({
|
|
108
|
+
provider: loaded.provider,
|
|
109
|
+
platform,
|
|
110
|
+
projectRoot: root,
|
|
111
|
+
fingerprintHash: fingerprint,
|
|
112
|
+
runOptions: lookup.expoRemote.runOptions,
|
|
113
|
+
logWriter: DISCARD
|
|
114
|
+
});
|
|
115
|
+
if (hit?.timedOut) deps.note(chalk.yellow(phaseLine("cache", `${name} did not answer; counted as a miss`)));
|
|
116
|
+
else if (hit?.failed) deps.note(chalk.yellow(phaseLine("cache", `${name} could not be used: ${hit.failed}`)));
|
|
117
|
+
return hit?.appPath ? name : null;
|
|
118
|
+
}
|
|
119
|
+
async function planCachedBuild(lookup, deps) {
|
|
120
|
+
const { root, platform, isExpo, fingerprint, sources, cacheKey, cachePolicy } = lookup;
|
|
121
|
+
let cacheHit = false;
|
|
122
|
+
let provider = null;
|
|
123
|
+
if (cachePolicy.read) {
|
|
124
|
+
if (artifactIn(entryDir(platform, cacheKey))) cacheHit = "local";
|
|
125
|
+
else {
|
|
126
|
+
provider = (cachePolicy.remote ? await providerHit(lookup, deps) : null) ?? await expoRemoteHit(lookup, deps);
|
|
127
|
+
if (provider) cacheHit = "remote";
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
let prebuild = null;
|
|
131
|
+
let refusal = null;
|
|
132
|
+
let missReason;
|
|
133
|
+
if (!cacheHit) {
|
|
134
|
+
prebuild = deps.planPrebuild(root, platform, {
|
|
135
|
+
isExpo,
|
|
136
|
+
fingerprint,
|
|
137
|
+
sources
|
|
138
|
+
});
|
|
139
|
+
if (prebuild === "refuse") refusal = staleNativeDirRefusal(platform);
|
|
140
|
+
else if (cachePolicy.read) missReason = predictBuildMiss({
|
|
141
|
+
root,
|
|
142
|
+
platform,
|
|
143
|
+
current: {
|
|
144
|
+
hash: fingerprint,
|
|
145
|
+
sources
|
|
146
|
+
},
|
|
147
|
+
prebuild: prebuild === "generate" || prebuild === "regenerate" ? prebuild : null
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
return planPayload(lookup, {
|
|
151
|
+
fingerprint,
|
|
152
|
+
cacheKey,
|
|
153
|
+
cacheHit,
|
|
154
|
+
provider,
|
|
155
|
+
cacheSkipped: !cachePolicy.read,
|
|
156
|
+
prebuild,
|
|
157
|
+
...missReason ? { missReason } : {},
|
|
158
|
+
refusal
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
function planPayload({ platform, slot, projectKey }, found) {
|
|
162
|
+
const { refusal, missReason, ...rest } = found;
|
|
163
|
+
const outcome = refusal ? null : found.cacheHit ? "hit" : "cold";
|
|
164
|
+
const estimate = outcome ? estimateBuild(readStats$1().record?.history?.[projectKey], platform, outcome) : {
|
|
165
|
+
expectedMs: null,
|
|
166
|
+
basis: 0
|
|
167
|
+
};
|
|
168
|
+
return {
|
|
169
|
+
platform,
|
|
170
|
+
...slot === "default" ? {} : { slot },
|
|
171
|
+
...rest,
|
|
172
|
+
outcome,
|
|
173
|
+
expectedMs: estimate.expectedMs,
|
|
174
|
+
basis: estimate.basis,
|
|
175
|
+
...missReason ? { missReason } : {},
|
|
176
|
+
...refusal ? { refusal } : {}
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
function cacheLine(plan) {
|
|
180
|
+
if (plan.refusal) return `the build would refuse with ${plan.refusal.code}`;
|
|
181
|
+
if (plan.cacheHit === "local") return "local cache hit";
|
|
182
|
+
if (plan.cacheHit === "remote") return `remote cache hit (${plan.provider})`;
|
|
183
|
+
return `${plan.cacheSkipped ? "cache reads are off" : "cache miss"}: compiles${plan.prebuild === "generate" || plan.prebuild === "regenerate" ? `, ${plan.prebuild}s the native dir` : ""}`;
|
|
184
|
+
}
|
|
185
|
+
function printPlan(plan, json) {
|
|
186
|
+
if (json) {
|
|
187
|
+
console.log(JSON.stringify(plan));
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
const slot = plan.slot ? ` [${plan.slot}]` : "";
|
|
191
|
+
console.log(phaseLine("plan", `${plan.platform}${slot} ${shortHash(plan.fingerprint)} -> ${cacheLine(plan)}`));
|
|
192
|
+
if (plan.placement) console.log(phaseLine("placement", plan.placement));
|
|
193
|
+
if (plan.missReason) console.log(phaseLine("cache", `miss: ${plan.missReason.summary}`));
|
|
194
|
+
if (plan.refusal) {
|
|
195
|
+
console.log(phaseLine("error", plan.refusal.message));
|
|
196
|
+
console.log(phaseLine("remedy", plan.refusal.remedy));
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
console.log(phaseLine("expect", plan.expectedMs === null ? `unknown: no ${plan.outcome} run of this project is recorded yet` : `~${formatDuration(plan.expectedMs)} (median of ${plural(plan.basis, `${plan.outcome} run`)})`));
|
|
200
|
+
}
|
|
201
|
+
function refusePlan({ code, message, remedy }, json, lines = []) {
|
|
202
|
+
console.error(chalk.red(phaseLine("error", message)));
|
|
203
|
+
for (const line of lines) console.error(chalk.dim(phaseLine("", line)));
|
|
204
|
+
console.error(chalk.dim(phaseLine("remedy", remedy)));
|
|
205
|
+
console.error(chalk.red(phaseLine("failed", code)));
|
|
206
|
+
if (json) console.log(JSON.stringify({
|
|
207
|
+
code,
|
|
208
|
+
message,
|
|
209
|
+
remedy
|
|
210
|
+
}));
|
|
211
|
+
process.exitCode = 1;
|
|
212
|
+
}
|
|
213
|
+
const PLAN_ONLY_REMEDY = "Drop the flag to plan the owned simulator or emulator build, or run the command without --plan.";
|
|
214
|
+
function planFlagRefusal(flag) {
|
|
215
|
+
return {
|
|
216
|
+
code: "STIM_BAD_ARG",
|
|
217
|
+
message: `${flag} does not apply to --plan, which predicts the next local build without choosing a device.`,
|
|
218
|
+
remedy: PLAN_ONLY_REMEDY
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
//#endregion
|
|
222
|
+
//#region src/device-host/plan-placement.ts
|
|
223
|
+
/**
|
|
224
|
+
* Where `--plan` assumes the next run puts its simulator or emulator, with no session, reservation or state write.
|
|
225
|
+
* A named Mac, or the Mac a recorded session already holds, answers with the device its `device-host.offer` would
|
|
226
|
+
* give; `auto` repeats the placement decision a run makes now and, when that stays on this Mac, notes any Mac
|
|
227
|
+
* whose device would key differently. The result predicts the cache key only; a run reads its own device.
|
|
228
|
+
*/
|
|
229
|
+
async function planHostedDevice({ root, slot, platform, machine, selectors, sameKey, eas, deps = {} }) {
|
|
230
|
+
const { automatic = automaticDevicePlacement, probe = probeHost, machines = hostingMachines } = deps;
|
|
231
|
+
const named = async (name) => {
|
|
232
|
+
const result = await probe(name, platform, selectors);
|
|
233
|
+
if ("failure" in result.probe) return {
|
|
234
|
+
kind: "unknown",
|
|
235
|
+
reason: `${name} did not give a ${platform} device (${result.probe.failure})`
|
|
236
|
+
};
|
|
237
|
+
const { choice, declined } = result.probe.offer;
|
|
238
|
+
if (!choice) return {
|
|
239
|
+
kind: "unknown",
|
|
240
|
+
reason: `${name} has no ${platform} device for this selection${declined ? ` (${declined})` : ""}`
|
|
241
|
+
};
|
|
242
|
+
return {
|
|
243
|
+
kind: "hosted",
|
|
244
|
+
choice,
|
|
245
|
+
placement: `on ${name}`
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
if (machine !== "auto") return named(machine);
|
|
249
|
+
try {
|
|
250
|
+
const recorded = readHostedNative(root, platform, slot)[slot];
|
|
251
|
+
if (recorded) return await named(recorded.machine);
|
|
252
|
+
const placed = await automatic({
|
|
253
|
+
root,
|
|
254
|
+
slot,
|
|
255
|
+
platform,
|
|
256
|
+
selectors,
|
|
257
|
+
noWait: false,
|
|
258
|
+
...eas ? { eas } : {}
|
|
259
|
+
}, {
|
|
260
|
+
read: () => ({}),
|
|
261
|
+
write: () => {}
|
|
262
|
+
});
|
|
263
|
+
if (placed.placement.decision === "eas") return {
|
|
264
|
+
kind: "unknown",
|
|
265
|
+
reason: `auto would run on an EAS Simulator now (${placed.placement.reason}), which --plan cannot read without a session`
|
|
266
|
+
};
|
|
267
|
+
if (placed.target) return {
|
|
268
|
+
kind: "hosted",
|
|
269
|
+
choice: placed.target.choice,
|
|
270
|
+
placement: `on ${placed.target.host.machine}, as auto would now`
|
|
271
|
+
};
|
|
272
|
+
const names = (machines() ?? []).filter((name) => automaticMachineEnabled("device", name));
|
|
273
|
+
const differs = (await Promise.all(names.map((name) => probe(name, platform, selectors)))).flatMap(({ probe: each }) => "offer" in each && each.offer.choice && sameKey(each.offer.choice) === false ? [each.machine] : []);
|
|
274
|
+
if (differs.length) return {
|
|
275
|
+
kind: "local",
|
|
276
|
+
placement: `this Mac; auto may use ${differs.join(", ")}, which builds for another architecture, so its key differs`
|
|
277
|
+
};
|
|
278
|
+
return {
|
|
279
|
+
kind: "local",
|
|
280
|
+
placement: names.length ? `this Mac; auto may use ${names.join(", ")}` : "this Mac"
|
|
281
|
+
};
|
|
282
|
+
} catch (error) {
|
|
283
|
+
return {
|
|
284
|
+
kind: "unknown",
|
|
285
|
+
reason: error.message
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
//#endregion
|
|
290
|
+
export { printPlan as a, planPayload as i, planCachedBuild as n, refusePlan as o, planFlagRefusal as r, runArtifactLifecycle as s, planHostedDevice as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { p as getProject } from "./config-
|
|
2
|
-
import {
|
|
3
|
-
import { n as getNamedPort, t as clearNamedPorts } from "./named-ports-
|
|
1
|
+
import { p as getProject } from "./config-DC5jEtd1.mjs";
|
|
2
|
+
import { n as findCommandWorkspace } from "./project-B5eQ1USs.mjs";
|
|
3
|
+
import { n as getNamedPort, t as clearNamedPorts } from "./named-ports-B4iWH4E-.mjs";
|
|
4
4
|
//#region src/commands/ports.ts
|
|
5
5
|
async function inProject(action) {
|
|
6
6
|
try {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as getExecutor } from "./exec-
|
|
1
|
+
import { t as getExecutor } from "./exec-i8GDPwq9.mjs";
|
|
2
2
|
import { n as stripAnsi, r as waitForChild, t as createLineReader } from "./process-output-Fpl8PYi8.mjs";
|
|
3
|
-
import { r as
|
|
4
|
-
import {
|
|
5
|
-
import { a as spawnDeclared } from "./spawn-claims-
|
|
6
|
-
import { i as expoBinRefusal, r as expoBinPath } from "./server-expo-
|
|
3
|
+
import { a as updateWorkspaceState, r as readWorkspaceState } from "./workspace-state-CR9X86xJ.mjs";
|
|
4
|
+
import { p as detectIsExpo } from "./project-B5eQ1USs.mjs";
|
|
5
|
+
import { a as spawnDeclared } from "./spawn-claims-Kqiifsk2.mjs";
|
|
6
|
+
import { i as expoBinRefusal, r as expoBinPath } from "./server-expo-n3tUi3Em.mjs";
|
|
7
7
|
import { existsSync } from "node:fs";
|
|
8
8
|
import { join } from "node:path";
|
|
9
9
|
//#region src/engine/prebuild.ts
|