stim 1.14.0 → 1.16.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.
Files changed (152) hide show
  1. package/README.md +2 -0
  2. package/dist/activity-BxwdD81S.mjs +609 -0
  3. package/dist/agent-device-usage-output-Dpih1Tfa.mjs +411 -0
  4. package/dist/{android-d6rGq1pA.mjs → android-B_NumVyQ.mjs} +169 -81
  5. package/dist/{android-LbPFRWVL.mjs → android-Ift4kVvt.mjs} +517 -413
  6. package/dist/android-cas-8U4DPqeR.mjs +167 -0
  7. package/dist/android-cas-compiler.mjs +2 -2
  8. package/dist/{android-XpvCrV7q.mjs → android-r2rBL8kV.mjs} +2 -2
  9. package/dist/{app-install-BpgSgkJj.mjs → app-install-CKWdbXIX.mjs} +128 -151
  10. package/dist/attempt-Bk2ouQVL.mjs +39 -0
  11. package/dist/budget-DjrURfQn.mjs +2700 -0
  12. package/dist/{build-plan-Dcr-3ie0.mjs → build-plan-DjeSb2Xl.mjs} +192 -653
  13. package/dist/build-slots-rUk77xqh.mjs +132 -0
  14. package/dist/{cache-manifest-C68QQ0ua.mjs → cache-manifest-DnUHBJaU.mjs} +2 -2
  15. package/dist/cache-manifest.mjs +1 -1
  16. package/dist/{chrome-BPCiC3ZX.mjs → chrome-BrcVWQyD.mjs} +1 -1
  17. package/dist/cli-BkYZ_6hy.mjs +51 -0
  18. package/dist/cli.mjs +6 -42
  19. package/dist/client-BTY686R6.mjs +1368 -0
  20. package/dist/collector-run.mjs +9 -195
  21. package/dist/{command-output-DVcpw6eE.mjs → command-output-DnJMdEY-.mjs} +1 -1
  22. package/dist/{config-lvc7d3C2.mjs → config-D0DbpZtM.mjs} +28 -29
  23. package/dist/{created-devices-CllH_8eb.mjs → created-devices-D5owjN4C.mjs} +2 -2
  24. package/dist/{dependency-state-DsT7aKeo.mjs → dependency-state-B6cMXZab.mjs} +2 -2
  25. package/dist/{deps-D9IcKqXS.mjs → deps-urbmfXig.mjs} +3 -3
  26. package/dist/{detached-entry-DJHoca49.mjs → detached-entry-CiTEgMR1.mjs} +1 -1
  27. package/dist/dev-client-CroAIjjj.mjs +43 -0
  28. package/dist/{device-CjuuAJjQ.mjs → device-DZQjF7H5.mjs} +8 -7
  29. package/dist/device-capacity-BHwxNBlu.mjs +136 -0
  30. package/dist/device-host-worker.d.mts +1 -0
  31. package/dist/device-host-worker.mjs +964 -0
  32. package/dist/device-ios-BadmeL2V.mjs +381 -0
  33. package/dist/{device-lease-5c3WrVRm.mjs → device-lease-D-hLqx1b.mjs} +43 -36
  34. package/dist/{device-pool-BiyDyPP-.mjs → device-lease-run-CqjShqWW.mjs} +6 -126
  35. package/dist/device-pool-CUaEWMMm.mjs +125 -0
  36. package/dist/{device-remote-D87zEzaq.mjs → device-remote-D5WVWqOq.mjs} +69 -163
  37. package/dist/{doctor-x9pnU9fq.mjs → doctor-Cimf-gGB.mjs} +241 -103
  38. package/dist/{error-diagnostics-C5HzcwCW.mjs → error-diagnostics-B9L4Ae0x.mjs} +15 -18
  39. package/dist/{exec-DK8KaVHK.mjs → exec-CaErVv7t.mjs} +5 -1
  40. package/dist/{gc-ko6mUAYD.mjs → gc-Bqy4bjEu.mjs} +599 -108
  41. package/dist/{android-cas-iZK3DOCr.mjs → gradle-BsO1MdsH.mjs} +8 -294
  42. package/dist/{guide-6R0VNFqI.mjs → guide-B_uyKTxW.mjs} +2511 -239
  43. package/dist/{guide-status-BZrFPIA_.mjs → guide-status-CjEZMAD4.mjs} +3 -3
  44. package/dist/hosted-client-a-WmqE2L.mjs +197 -0
  45. package/dist/hosted-ios-CIWelIqf.mjs +220 -0
  46. package/dist/hosted-logs-D5g041Q3.mjs +187 -0
  47. package/dist/hosted-macos-BSZyIb3y.mjs +135 -0
  48. package/dist/idle-DYVymG92.mjs +1099 -0
  49. package/dist/idle-shutdown-CTsDnAde.mjs +122 -0
  50. package/dist/in-use-DvBw0Kxo.mjs +130 -0
  51. package/dist/{ios-BwDPrnYQ.mjs → ios-BaInn3sW.mjs} +201 -10
  52. package/dist/ios-Cr1h5gnO.mjs +189 -0
  53. package/dist/{ios-P1f5nm2n.mjs → ios-aq3QoGI3.mjs} +1159 -633
  54. package/dist/{ios-device-BiOsSVzd.mjs → ios-device-Ee7sDXfp.mjs} +1 -1
  55. package/dist/{ios-device-DGglU3E_.mjs → ios-device-FfCN_C8p.mjs} +12 -7
  56. package/dist/ios-state-DS5UpYTH.mjs +48 -0
  57. package/dist/{launch-verify-Deg4tB3Z.mjs → launch-verify-2DBRizjo.mjs} +5 -5
  58. package/dist/logs-CHEVK8zD.mjs +371 -0
  59. package/dist/machines-BIBUdhpj.mjs +265 -0
  60. package/dist/macos-CSYEAFmF.mjs +473 -0
  61. package/dist/macos-run.d.mts +5 -0
  62. package/dist/macos-run.mjs +2 -0
  63. package/dist/maintenance-run.d.mts +4 -0
  64. package/dist/maintenance-run.mjs +254 -0
  65. package/dist/{metro-CcEo8Fl8.mjs → metro-BeK1ZPz1.mjs} +20 -120
  66. package/dist/metro-gateway-BJ-rxQAB.mjs +84 -0
  67. package/dist/{named-ports-Blg8IxOh.mjs → named-ports-Bk_YXEmE.mjs} +6 -59
  68. package/dist/native-run-NaBrRFtQ.mjs +147 -0
  69. package/dist/{native-runtime-DjBHRg5m.mjs → native-runtime-DBzRnEKS.mjs} +9 -5
  70. package/dist/{ndjson-CDY9IkVC.mjs → ndjson-PclOIwVY.mjs} +2 -2
  71. package/dist/offload-worker.d.mts +122 -0
  72. package/dist/offload-worker.mjs +606 -0
  73. package/dist/{ownership-DyYDF5ww.mjs → ownership-DiA16AsN.mjs} +3 -2
  74. package/dist/ownership-hCkPzGmr.mjs +571 -0
  75. package/dist/{page-BHUzTDFt.mjs → page-QF_Ke10s.mjs} +7 -2
  76. package/dist/{ports-BguS83ex.mjs → ports-R2k4Knz3.mjs} +3 -3
  77. package/dist/prebuild-D2fsca_Z.mjs +213 -0
  78. package/dist/preview-DhVbvPAZ.mjs +318 -0
  79. package/dist/process-identity-BmRm1qV0.mjs +12 -0
  80. package/dist/{project-CWlvEaeN.mjs → project-Du91Ilvc.mjs} +74 -19
  81. package/dist/pull-request-pxnDCQzn.mjs +322 -0
  82. package/dist/pull-requests.d.mts +120 -0
  83. package/dist/pull-requests.mjs +2 -0
  84. package/dist/recordings-BIXOzVnr.mjs +37 -0
  85. package/dist/{reload-BiniwsSZ.mjs → reload-rM9jV1fz.mjs} +109 -24
  86. package/dist/{remote-cache-CcR6o6lI.mjs → remote-cache-C8-V13XN.mjs} +5 -5
  87. package/dist/run-f4vI6EnK.mjs +119 -0
  88. package/dist/{server-bare-DGfgyJ5J.mjs → server-bare-CpPGmnmO.mjs} +33 -15
  89. package/dist/server-expo-CVqO2c35.mjs +2 -0
  90. package/dist/{server-expo-BVuwQ65v.mjs → server-expo-MC0rHlOC.mjs} +8 -12
  91. package/dist/settings-BBpMcDbD.mjs +25 -0
  92. package/dist/{settings-B-fsC-Om.mjs → settings-ZkDzkzvB.mjs} +22 -10
  93. package/dist/settings-oTSkkNrM.mjs +1439 -0
  94. package/dist/settings.schema.json +845 -97
  95. package/dist/{simslim-DrDN4WuV.mjs → simslim-B8-7AoTI.mjs} +8 -132
  96. package/dist/{slot-launch-D5t8EiMf.mjs → slot-launch-B8VrHxn1.mjs} +11 -8
  97. package/dist/{spawn-claims-Drw_o-Fb.mjs → spawn-claims-D0XfSe8u.mjs} +1 -1
  98. package/dist/spawn-entry-jw19m8Nl.mjs +17 -0
  99. package/dist/stage-CzaiwFsI.mjs +143 -0
  100. package/dist/start-CX8Ig-U2.mjs +2 -0
  101. package/dist/{start-s4RXp1wy.mjs → start-ClDfwXa4.mjs} +116 -65
  102. package/dist/state-3DwSQIBK.mjs +41 -0
  103. package/dist/state-B4PQFXMW.d.mts +12 -0
  104. package/dist/{state-Dk9RVXI7.mjs → state-C1jB7Q8q.mjs} +70 -8
  105. package/dist/{state-DHqvsbqC.mjs → state-DcW6vOd_.mjs} +7 -4
  106. package/dist/stats-CEZ_i5je.mjs +77 -0
  107. package/dist/{status-BgAuxESg.mjs → status-BuvBFeII.mjs} +118 -20
  108. package/dist/{status-BsPAnfOI.mjs → status-Cs7VLg9D.mjs} +542 -283
  109. package/dist/status-DlKvVJBE.mjs +49 -0
  110. package/dist/stdout-reader-C8yjre1x.mjs +23 -0
  111. package/dist/stim-desktop-Cnz8CPnl.mjs +63 -0
  112. package/dist/stim-footprint.swift +32 -0
  113. package/dist/{stim-installations-CINXy_su.mjs → stim-installations-QMEI32v1.mjs} +1 -1
  114. package/dist/stop-B0Yxtmiy.mjs +48 -0
  115. package/dist/{stop-BzreOWJp.mjs → stop-Bffozsac.mjs} +83 -16
  116. package/dist/{stop-BWIF_6BK.mjs → stop-Dt_dM16A.mjs} +2 -2
  117. package/dist/stop-cause-CidxIqup.mjs +97 -0
  118. package/dist/supervisor-run.d.mts +43 -11
  119. package/dist/supervisor-run.mjs +363 -24
  120. package/dist/support-CAP8qDUF.mjs +316 -0
  121. package/dist/support-D4aYJniO.mjs +201 -0
  122. package/dist/teardown-CL6vDs2Y.mjs +727 -0
  123. package/dist/{xcode-Cp5KvK9x.mjs → toolchain-DkUflduf.mjs} +364 -14
  124. package/dist/trigger-Bemu8ytw.mjs +65 -0
  125. package/dist/trigger-CXts6qt1.mjs +2 -0
  126. package/dist/warm-progress-CpGv3Wb6.mjs +732 -0
  127. package/dist/{web-BsQs1WlO.mjs → web-DWUaMp8P.mjs} +37 -21
  128. package/dist/web-run.mjs +310 -13
  129. package/dist/workspace-process-lock-BL7Q0HCO.mjs +57 -0
  130. package/dist/workspace-state-B8-aJ1_5.mjs +371 -0
  131. package/dist/workspaces-BV4pdHFz.mjs +306 -0
  132. package/dist/{worktree-UrQWXSeb.mjs → worktree-K-xj9Db0.mjs} +625 -256
  133. package/dist/worktree-jnG8Iph5.mjs +2 -0
  134. package/package.json +10 -5
  135. package/shim/bundle-response.cjs +28 -12
  136. package/dist/activity-CYVDcrt3.mjs +0 -356
  137. package/dist/budget-CGDkhvv_.mjs +0 -1745
  138. package/dist/build-progress-DxKpwnaS.mjs +0 -247
  139. package/dist/idle-DXtx3RbX.mjs +0 -191
  140. package/dist/in-use-DlqBDKqY.mjs +0 -249
  141. package/dist/logs-Civ4gbBH.mjs +0 -486
  142. package/dist/merge-state-ytFQCeh4.mjs +0 -262
  143. package/dist/server-expo-DIHDhvGg.mjs +0 -2
  144. package/dist/settings-D61iNOsB.mjs +0 -629
  145. package/dist/start-Cetfvy8l.mjs +0 -2
  146. package/dist/stats-CFpFGlJV.mjs +0 -62
  147. package/dist/stats-CX1Z8Tca.mjs +0 -368
  148. package/dist/stim-desktop-CXt8-Z3J.mjs +0 -40
  149. package/dist/stop-cause-hjGBOZTG.mjs +0 -1231
  150. package/dist/worktree-BVrHsYZG.mjs +0 -752
  151. package/dist/worktree-CHWWvm5v.mjs +0 -2
  152. package/dist/{metro-store-DzeWkfqW.mjs → metro-store-CDDZHtPl.mjs} +1 -1
@@ -0,0 +1,147 @@
1
+ import { a as formatElapsed } from "./command-output-DnJMdEY-.mjs";
2
+ import { a as updateWorkspaceState, r as readWorkspaceState, t as clearWorkspaceStateKey, v as workspaceDir } from "./workspace-state-B8-aJ1_5.mjs";
3
+ import { i as signalDeclaredSpawns, r as refuseDeclaredSpawns, t as allowDeclaredSpawns } from "./spawn-claims-D0XfSe8u.mjs";
4
+ import { t as withWorkspaceProcessLock } from "./workspace-process-lock-BL7Q0HCO.mjs";
5
+ //#region src/engine/native-run.ts
6
+ const NATIVE_RUN_LOCK = "native-run";
7
+ const NATIVE_RUN_WAIT_MS = 18e5;
8
+ const WAIT_HEARTBEAT_MS = 3e4;
9
+ const CANCEL_REQUEST_KEY = "nativeRunCancel";
10
+ function nativeRunHolder(holder) {
11
+ const { command, platform, slot } = holder.details;
12
+ return {
13
+ command: typeof command === "string" ? command : null,
14
+ platform: typeof platform === "string" ? platform : null,
15
+ slot: typeof slot === "string" ? slot : "default"
16
+ };
17
+ }
18
+ function describeNativeRunHolder(holder, now) {
19
+ const { command, slot } = nativeRunHolder(holder);
20
+ const started = Date.parse(holder.startedAt);
21
+ const facts = [`pid ${holder.owner.pid}`];
22
+ if (Number.isFinite(started)) facts.push(`running for ${formatElapsed(now - started)}`);
23
+ if (command === null) return `another Stim run (${facts.join(", ")})`;
24
+ return `\`stim ${command}${slot === "default" ? "" : ` --slot ${slot}`}\` (${facts.join(", ")})`;
25
+ }
26
+ /**
27
+ * Report a wait on the native-run lock: one line as soon as a holder is seen, a line for each new
28
+ * holder, and a heartbeat every WAIT_HEARTBEAT_MS while the same holder keeps it.
29
+ */
30
+ function nativeRunWaitNotice({ write, now = Date.now, describe = describeNativeRunHolder }) {
31
+ let claimId = null;
32
+ let lastAt = 0;
33
+ return (holder, firstLine) => {
34
+ const at = now();
35
+ if (holder.claimId !== claimId) {
36
+ claimId = holder.claimId;
37
+ lastAt = at;
38
+ write(firstLine ?? `waiting for ${describe(holder, at)} in this workspace to finish`);
39
+ return;
40
+ }
41
+ if (at - lastAt < WAIT_HEARTBEAT_MS) return;
42
+ lastAt = at;
43
+ write(`still waiting for ${describe(holder, at)}`);
44
+ };
45
+ }
46
+ /**
47
+ * What `stop` does about the run holding the native-run lock. A build is interrupted only when the stop
48
+ * leaves it nothing to deploy to: the whole workspace stops, the build targets the stopped slot, or the
49
+ * stopped slot is the workspace's only device. A build for another slot that stays is left running and
50
+ * the stop proceeds without the lock. Only an owner whose identity is proven live is signalled.
51
+ */
52
+ function decideStopAction({ stopSlot, holder, ownerIdentity, deviceSlots }) {
53
+ if (holder.command === "macos") {
54
+ if (stopSlot !== void 0) return { action: "proceed" };
55
+ return ownerIdentity === "same" ? { action: "interrupt" } : { action: "refuse" };
56
+ }
57
+ if (holder.command !== "ios" && holder.command !== "android") return { action: "wait" };
58
+ if (!(stopSlot === void 0 || holder.slot === stopSlot || deviceSlots.includes(stopSlot) && deviceSlots.every((slot) => slot === stopSlot))) return { action: "proceed" };
59
+ return ownerIdentity === "same" ? { action: "interrupt" } : { action: "refuse" };
60
+ }
61
+ function requestNativeRunCancel(root, claimId, pid = process.pid) {
62
+ updateWorkspaceState(root, (state) => ({
63
+ ...state,
64
+ [CANCEL_REQUEST_KEY]: {
65
+ claimId,
66
+ pid,
67
+ at: (/* @__PURE__ */ new Date()).toISOString()
68
+ }
69
+ }));
70
+ }
71
+ function cancelRequestFor(root, claimId) {
72
+ const request = readWorkspaceState(root)?.[CANCEL_REQUEST_KEY];
73
+ if (request?.claimId !== claimId || typeof request.pid !== "number") return null;
74
+ return { pid: request.pid };
75
+ }
76
+ function clearNativeRunCancel(root, claimId) {
77
+ try {
78
+ clearWorkspaceStateKey(root, CANCEL_REQUEST_KEY, (value) => value?.claimId === claimId);
79
+ } catch {}
80
+ }
81
+ let cancelled = null;
82
+ /** Why this process's native run was cancelled, or null while it was not. */
83
+ function runCancellation() {
84
+ return cancelled;
85
+ }
86
+ function cancelledFailure(platform, { code, message }) {
87
+ if (cancelled === null) return null;
88
+ return {
89
+ code: "STIM_CANCELLED",
90
+ message: `The ${platform} run was ${cancelled} before it finished.`,
91
+ remedy: `Run \`stim ${platform}\` again when you want the app on a device.`,
92
+ lines: [`it stopped at ${code ?? "an unfinished step"}${message ? `: ${message}` : ""}`]
93
+ };
94
+ }
95
+ function cancelOnInterrupt({ root, claim, write, exit }) {
96
+ let signals = 0;
97
+ const onInterrupt = () => {
98
+ signals += 1;
99
+ if (signals > 1) {
100
+ exit(130);
101
+ return;
102
+ }
103
+ const request = cancelRequestFor(root, claim.claimId);
104
+ cancelled = request ? `cancelled by \`stim stop\` (pid ${request.pid})` : "cancelled by an interrupt";
105
+ refuseDeclaredSpawns(`the run was ${cancelled}`);
106
+ const signalled = signalDeclaredSpawns("SIGINT");
107
+ write(signalled > 0 ? `${cancelled}; stopping the running build tool` : request ? `${cancelled}; stopping before the next build tool or install` : cancelled);
108
+ if (signalled === 0 && !request) exit(130);
109
+ };
110
+ process.on("SIGINT", onInterrupt);
111
+ return () => {
112
+ process.off("SIGINT", onInterrupt);
113
+ allowDeclaredSpawns();
114
+ clearNativeRunCancel(root, claim.claimId);
115
+ };
116
+ }
117
+ /**
118
+ * Run an `ios`, `android` or `macos` invocation under the workspace's native-run lock: the claim records the
119
+ * command, platform and slot, and a wait for another holder is reported on `write`. The first SIGINT
120
+ * forwards the interrupt to the running declared build tool; a run `stim stop` cancelled between build
121
+ * tools starts no further one; a terminal interrupt with no build tool running, or a second SIGINT, exits
122
+ * with 130 at once.
123
+ */
124
+ function withNativeBuildRun(root, details, fn, { write, exit = (code) => process.exit(code) }) {
125
+ const notice = nativeRunWaitNotice({ write });
126
+ return withWorkspaceProcessLock(workspaceDir(root), NATIVE_RUN_LOCK, async (claim) => {
127
+ const dispose = cancelOnInterrupt({
128
+ root,
129
+ claim,
130
+ write,
131
+ exit
132
+ });
133
+ try {
134
+ return await fn(claim);
135
+ } finally {
136
+ dispose();
137
+ }
138
+ }, {
139
+ external: true,
140
+ waitMs: NATIVE_RUN_WAIT_MS,
141
+ declareSpawns: true,
142
+ details: { ...details },
143
+ onHeld: (holder) => notice(holder)
144
+ });
145
+ }
146
+ //#endregion
147
+ export { decideStopAction as a, nativeRunWaitNotice as c, withNativeBuildRun as d, clearNativeRunCancel as i, requestNativeRunCancel as l, NATIVE_RUN_WAIT_MS as n, describeNativeRunHolder as o, cancelledFailure as r, nativeRunHolder as s, NATIVE_RUN_LOCK as t, runCancellation as u };
@@ -1,13 +1,17 @@
1
- import { S as ensureWorkspaceStorage, c as resolveProjectMetro, h as readWorkspaceState$1 } from "./metro-CcEo8Fl8.mjs";
2
- import { l as phaseLine } from "./command-output-DVcpw6eE.mjs";
3
- import { r as LAUNCH_UNVERIFIED, t as LAUNCH_BUNDLING } from "./launch-verify-Deg4tB3Z.mjs";
4
- import { s as startDevServer } from "./start-s4RXp1wy.mjs";
1
+ import { l as phaseLine } from "./command-output-DnJMdEY-.mjs";
2
+ import { S as metroPortSetting } from "./settings-oTSkkNrM.mjs";
3
+ import { l as resolveProjectMetro } from "./metro-BeK1ZPz1.mjs";
4
+ import { r as readWorkspaceState$1, u as ensureWorkspaceStorage } from "./workspace-state-B8-aJ1_5.mjs";
5
+ import { r as LAUNCH_UNVERIFIED, t as LAUNCH_BUNDLING } from "./launch-verify-2DBRizjo.mjs";
6
+ import { c as startDevServer } from "./start-ClDfwXa4.mjs";
5
7
  import { readIdleStop } from "@stim-cli/core/state";
6
8
  import chalk from "chalk";
7
9
  //#region src/commands/native-runtime.ts
8
10
  const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
9
11
  async function ensureDevServer({ root, port, settings, remote, note, resolve = resolveProjectMetro, start = startDevServer, readState = readWorkspaceState$1 }) {
10
- const held = port === null ? null : (await resolve(port, root)).metro;
12
+ const pin = metroPortSetting(root);
13
+ const canReuse = !pin.error && (pin.port === null || pin.port === port);
14
+ const held = port === null || !canReuse ? null : (await resolve(port, root)).metro;
11
15
  if (port !== null && held) return {
12
16
  ok: true,
13
17
  port,
@@ -1,7 +1,7 @@
1
1
  import { closeSync, mkdirSync, openSync, writeSync } from "fs";
2
2
  import { dirname } from "path";
3
3
  import { rotateLog } from "@stim-cli/core";
4
- import { LEVELS, SOURCES, levelRank, parseNdjsonLine, readNdjsonGenerations } from "@stim-cli/core/state";
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) {
@@ -111,4 +111,4 @@ function stamp(record) {
111
111
  };
112
112
  }
113
113
  //#endregion
114
- export { parseNdjsonLine as a, levelRank as i, SOURCES as n, readNdjsonGenerations as o, createNdjsonWriter as r, LEVELS as t };
114
+ export { parseNdjsonLine as a, levelRank as i, SOURCES as n, readNdjsonGenerations$1 as o, createNdjsonWriter as r, LEVELS as t };
@@ -0,0 +1,122 @@
1
+ import "./ndjson-Du3j0AQ9.mjs";
2
+ import "./state-B4PQFXMW.mjs";
3
+ import { readFileSync } from "fs";
4
+ import "@stim-cli/core/state";
5
+ import "@expo/fingerprint";
6
+ 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
+ //#region src/offload/client.d.ts
51
+ /** The Gradle choices that shape the APK, so the machine builds what this Mac's cache key describes. */
52
+ interface AndroidBuildOptions {
53
+ variant: string | null;
54
+ abi: string | null;
55
+ gradleBuildCache: boolean;
56
+ pch: "auto" | "on" | "off";
57
+ compilerCache: "ccache" | "none";
58
+ }
59
+ //#endregion
60
+ //#region src/offload/worker.d.ts
61
+ /** One file of the client's checkout, as `git ls-files -co --exclude-standard` lists it. */
62
+ interface ManifestEntry {
63
+ path: string;
64
+ kind: "file" | "exec" | "link";
65
+ size: number;
66
+ sha256: string;
67
+ }
68
+ /** What stim-server hands this process on stdin; it has already checked every path and blob. */
69
+ interface WorkerJob {
70
+ job: string;
71
+ area: string;
72
+ blobs: string;
73
+ manifest: ManifestEntry[];
74
+ platform: "ios" | "android" | "macos";
75
+ macos: {
76
+ product: string;
77
+ infoPlist: string;
78
+ bundleId: string;
79
+ resources?: Record<string, string>;
80
+ assetCatalog?: string | null;
81
+ } | null;
82
+ swiftpmCache: string;
83
+ project: string;
84
+ packageName: string | null;
85
+ isExpo: boolean;
86
+ configuration: string | null;
87
+ scheme: string | null;
88
+ runtime: string | null;
89
+ android: AndroidBuildOptions | null;
90
+ expectedFingerprint: string;
91
+ optimizations: Optimizations["ios"] | null;
92
+ /** How long the client's Gradle daemon stays warm after an Android build; 0 or absent stops it when the build ends. */
93
+ gradleDaemonIdleMs?: number;
94
+ }
95
+ interface WorkerTimings {
96
+ syncMs: number;
97
+ depsMs: number;
98
+ prebuildMs: number;
99
+ podsMs: number;
100
+ fingerprintMs: number;
101
+ buildMs: number;
102
+ packageMs: number;
103
+ }
104
+ type WorkerResult = {
105
+ ok: true;
106
+ artifact: {
107
+ path: string;
108
+ name: string;
109
+ size: number;
110
+ sha256: string;
111
+ };
112
+ fingerprint: string;
113
+ compilationCache: CompilationCacheActivity | CcacheActivity | Record<string, never>;
114
+ timings: WorkerTimings;
115
+ } | {
116
+ ok: false;
117
+ code: string;
118
+ message: string;
119
+ timings: WorkerTimings;
120
+ };
121
+ //#endregion
122
+ export { ManifestEntry, WorkerJob, WorkerResult, WorkerTimings };