stim 1.20.2 → 1.22.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 (231) hide show
  1. package/README.md +141 -8
  2. package/dist/acquire-artifact-Co2k4f7O.mjs +171 -0
  3. package/dist/act-DsuqEkiM.mjs +2801 -0
  4. package/dist/activity-CMLmzp7o.mjs +1397 -0
  5. package/dist/{agent-device-usage-output-Dzgv6lgR.mjs → agent-device-usage-output-DUFaTMdd.mjs} +23 -67
  6. package/dist/{android-DCKZrNvV.mjs → android-ByRMUoiJ.mjs} +157 -93
  7. package/dist/{android-Mz_Inn3w.mjs → android-C7sVmyI9.mjs} +299 -116
  8. package/dist/{android-Dlzxshgp.mjs → android-DGkNqa_c.mjs} +5 -5
  9. package/dist/{android-HqP1_vB_.mjs → android-DR5lZ2Az.mjs} +2 -2
  10. package/dist/android-cas-compiler.mjs +2 -2
  11. package/dist/{android-cas-Bl-cLJBk.mjs → android-cas-ngferVq2.mjs} +7 -6
  12. package/dist/android-project-BCAAmMwz.mjs +12 -0
  13. package/dist/android-project-DVWyCbWU.d.mts +391 -0
  14. package/dist/api.d.mts +810 -64
  15. package/dist/api.mjs +782 -1
  16. package/dist/{artifact-HSwkIWEQ.mjs → artifact-8EY8SAPw.mjs} +240 -213
  17. package/dist/{artifact-D3czlUvT.mjs → artifact-DJPy518Y.mjs} +203 -164
  18. package/dist/artifact-platform-CXcmX_j3.mjs +27 -0
  19. package/dist/{browser-web-CA-F1GQo.mjs → browser-web-Bcv99PBM.mjs} +194 -64
  20. package/dist/budget-Cvwn54qV.mjs +9285 -0
  21. package/dist/{build-DYDbfkk5.mjs → build-CabC3G23.mjs} +153 -98
  22. package/dist/build-cache-Dv7RN200.mjs +602 -0
  23. package/dist/build-plan-DUC8Ka9y.mjs +248 -0
  24. package/dist/{cache-manifest-XH-fvDUj.mjs → cache-manifest-DSeQjt-Q.mjs} +2 -2
  25. package/dist/cache-manifest.mjs +1 -1
  26. package/dist/{ccache-zdKiYQ3E.mjs → ccache-Btwc36-I.mjs} +10 -9
  27. package/dist/{cdp-Dq_ypAlJ.mjs → cdp-3fwICjzi.mjs} +18 -5
  28. package/dist/{chrome-BnzZMqsR.mjs → chrome-Bbw689-6.mjs} +7 -4
  29. package/dist/{cli-CLP3diBm.mjs → cli-CHZa9Lvk.mjs} +20 -20
  30. package/dist/cli.mjs +1 -1
  31. package/dist/client-OyRoEuSr.mjs +1577 -0
  32. package/dist/collector-run.d.mts +4 -40
  33. package/dist/collector-run.mjs +9 -8
  34. package/dist/{command-output-BTy8hZ0F.mjs → command-output-gwpm28fu.mjs} +1 -1
  35. package/dist/config-DlrsduwG.mjs +955 -0
  36. package/dist/{created-devices-Dzd5C2LF.mjs → created-devices-x9rN6bhs.mjs} +14 -4
  37. package/dist/{dependency-state-DG0p31-y.mjs → dependency-state-1I9KZT1Y.mjs} +20 -5
  38. package/dist/{detached-entry-B9C_zeQC.mjs → detached-entry-BwNEtIrP.mjs} +1 -1
  39. package/dist/{dev-client-DAWVIGBu.mjs → dev-client-BSDR5h3F.mjs} +2 -2
  40. package/dist/{device-BECOiufl.mjs → device-B-L3Fbxy.mjs} +91 -34
  41. package/dist/device-DklWZLqb.mjs +1068 -0
  42. package/dist/{device-capacity-CBUAcRyQ.mjs → device-capacity-DK5_EwRS.mjs} +42 -13
  43. package/dist/device-host-worker.mjs +76 -79
  44. package/dist/{device-ios-COSi6oS1.mjs → device-ios-DoB6KFCO.mjs} +77 -51
  45. package/dist/{device-lease-run-Cw2M4z51.mjs → device-lease-run-xJPQ_QQG.mjs} +14 -26
  46. package/dist/{device-pool-Bf-pOhSw.mjs → device-pool-BMkdsefq.mjs} +5 -5
  47. package/dist/{doctor-kfMBnUw6.mjs → doctor-Bo7BXLux.mjs} +271 -320
  48. package/dist/{doctor-CB8oZKCk.mjs → doctor-D5_EzwfA.mjs} +186 -91
  49. package/dist/doctor-fingerprint-DZLoYFVb.mjs +16 -0
  50. package/dist/doctor-fingerprint.mjs +19 -0
  51. package/dist/doctor-thjWAV0z.mjs +2 -0
  52. package/dist/{doctor-watchman-BRyV2adA.mjs → doctor-watchman-N2wDotwQ.mjs} +40 -21
  53. package/dist/{eas-build-JyfqyHfC.mjs → eas-build-CwknaQYj.mjs} +53 -20
  54. package/dist/{build-plan-B7SZsc2N.mjs → eas-fallback-CSgAulr5.mjs} +41 -214
  55. package/dist/{watchman-CPQFZLXY.mjs → eas-session-ledger-DlY_serQ.mjs} +230 -11
  56. package/dist/{error-diagnostics-BR677IDM.mjs → error-diagnostics-DBWO2rxE.mjs} +172 -82
  57. package/dist/exec-DEoAhcze.mjs +858 -0
  58. package/dist/exec-DnYc4HGH.d.mts +78 -0
  59. package/dist/{gc-qWOMdnER.mjs → gc-CXxN-4SE.mjs} +1091 -1029
  60. package/dist/gc-DnNDQyaP.mjs +3 -0
  61. package/dist/{guide-G9cAbVAc.mjs → guide-Br0LEfKy.mjs} +1165 -297
  62. package/dist/{hosted-android-C3MHGld1.mjs → hosted-android-B-9f-jkd.mjs} +10 -8
  63. package/dist/{hosted-client-ZEKpS9vw.mjs → hosted-client-DZAPrcro.mjs} +34 -19
  64. package/dist/{hosted-ios-l-o3iM9J.mjs → hosted-ios-CsCS21hn.mjs} +1 -1
  65. package/dist/{hosted-logs-EzQM7-3Z.mjs → hosted-logs-FIRx9X2f.mjs} +77 -43
  66. package/dist/{hosted-macos-BACVAVqE.mjs → hosted-macos-_awYSpfv.mjs} +35 -22
  67. package/dist/{hosted-native-A4s1QPXe.mjs → hosted-native-BdzE668-.mjs} +49 -27
  68. package/dist/idle-C4cZ757K.d.mts +24 -0
  69. package/dist/{idle-shutdown-DtxhPTKe.mjs → idle-shutdown-DDg3SdvY.mjs} +11 -10
  70. package/dist/ios-CDvlmUs7.d.mts +24 -0
  71. package/dist/{ios-BwVCF7oA.mjs → ios-Ds1clbIt.mjs} +8 -8
  72. package/dist/{ios-device-D7pi2Sca.mjs → ios-device--h_-8ENa.mjs} +51 -26
  73. package/dist/{ios-device-B5veSDDQ.mjs → ios-device-BXZ0c7Kb.mjs} +1 -1
  74. package/dist/{ios-RkW4pnQf.mjs → ios-hcBpnEGk.mjs} +200 -93
  75. package/dist/{ios-Ce7bc7br.mjs → ios-pm4nL6By.mjs} +160 -108
  76. package/dist/{ios-project-K9hY_Jab.mjs → ios-project-CZhKODF3.mjs} +13 -13
  77. package/dist/ios-signing-BtAffm0A.mjs +489 -0
  78. package/dist/{ios-state-CBLe1xYw.mjs → ios-state-Dtw5K2aI.mjs} +1 -1
  79. package/dist/{ios-nOLJGVdy.mjs → ios-xtlRHaeB.mjs} +1 -1
  80. package/dist/{js-swap-Bb3nsS07.mjs → js-swap-Bwhh4S7V.mjs} +30 -25
  81. package/dist/{launch-C3qJ6Agb.mjs → launch-BjxemNpK.mjs} +85 -543
  82. package/dist/{launch-F4sOqAhB.mjs → launch-CCzXlc8r.mjs} +91 -90
  83. package/dist/logs-BfwwadsZ.mjs +479 -0
  84. package/dist/logs-jTS_lHSo.mjs +248 -0
  85. package/dist/{macos-D7uDvO-z.mjs → macos-DVlSSyUg.mjs} +1 -1
  86. package/dist/macos-NfV2D7dO.mjs +694 -0
  87. package/dist/macos-run.mjs +1 -1
  88. package/dist/maintenance-run.mjs +123 -248
  89. package/dist/{metro-DnCEjCxs.mjs → metro-DiXtA3Ty.mjs} +107 -30
  90. package/dist/metro-gateway-CKZqKqx7.mjs +209 -0
  91. package/dist/{named-ports-4WopRPg-.mjs → named-ports-DkEzOfzO.mjs} +42 -90
  92. package/dist/native-android-CqgnOgsT.mjs +645 -0
  93. package/dist/native-gradle-artifact-inputs-DHFnmrVf.mjs +270 -0
  94. package/dist/native-gradle-inputs-Dnh84Zbd.mjs +211 -0
  95. package/dist/native-inputs-TRTTTRxt.mjs +91 -0
  96. package/dist/native-run-NwUuxbkg.mjs +276 -0
  97. package/dist/{native-runtime-k8dTIrbK.mjs → native-runtime-B7KIafpM.mjs} +11 -9
  98. package/dist/native-source-Y0yLhFyQ.mjs +133 -0
  99. package/dist/{native-xcode-inputs-CykopJdM.mjs → native-xcode-inputs-D_VOfFL7.mjs} +26 -18
  100. package/dist/{native-xcode-ios-Bbf30Gm0.mjs → native-xcode-ios-BYDOHWLN.mjs} +104 -60
  101. package/dist/{ndjson-GOnbyvso.mjs → ndjson-CgE_o3Dl.mjs} +3 -3
  102. package/dist/offload-worker.d.mts +59 -41
  103. package/dist/offload-worker.mjs +478 -115
  104. package/dist/operation-exec-BW0em61G.mjs +171 -0
  105. package/dist/{ownership-DCtw_2IA.mjs → ownership-C5fo5Edb.mjs} +3 -3
  106. package/dist/{page-DRHy329N.mjs → page-DBL2PiUU.mjs} +12 -5
  107. package/dist/paths-BsJMoPP2.mjs +12 -0
  108. package/dist/paths-DQtTgsBf.mjs +42 -0
  109. package/dist/{placement-log-MOfPVgaM.mjs → placement-log-BnGgJRRZ.mjs} +5 -5
  110. package/dist/{plan-placement-V0TdzYXp.mjs → plan-placement-DIsMtN-d.mjs} +15 -11
  111. package/dist/{ports-DdSUicVo.mjs → ports-Cy1RkmuQ.mjs} +3 -3
  112. package/dist/prebuild-D4JoEAEs.mjs +484 -0
  113. package/dist/{project-_phNIJfs.mjs → project-wM_XFTvE.mjs} +65 -37
  114. package/dist/{pull-request-CQ8sPbZa.mjs → pull-request-W1IuLXDt.mjs} +102 -20
  115. package/dist/pull-request-eODyIqZF.d.mts +124 -0
  116. package/dist/pull-requests.d.mts +2 -120
  117. package/dist/pull-requests.mjs +2 -2
  118. package/dist/{react-native-android-CM1XRDwv.mjs → react-native-android-6OZ7MSM7.mjs} +121 -72
  119. package/dist/{gradle-DSrXb6lG.mjs → react-native-build-Dvd8hC21.mjs} +292 -15
  120. package/dist/react-native-doctor-DsoSF1Y9.mjs +234 -0
  121. package/dist/{react-native-ios-Dhq_eiYQ.mjs → react-native-ios-4u1Rn-GR.mjs} +71 -39
  122. package/dist/{recordings-D0d5aQt0.mjs → recordings-CQmfzAh7.mjs} +12 -9
  123. package/dist/registration-BcRgF6Ox.mjs +51 -0
  124. package/dist/{reload-C8JhxjSh.mjs → reload-BzkYabB-.mjs} +94 -47
  125. package/dist/reload-D7AVlb8N.mjs +2 -0
  126. package/dist/{remote-BiR6aYjy.mjs → remote-DjGDmlTZ.mjs} +26 -18
  127. package/dist/result-D2Ykz_iD.mjs +435 -0
  128. package/dist/{run-BtPgpKks.mjs → run-DidHghD1.mjs} +5 -5
  129. package/dist/selection-DSMbWEX2.mjs +620 -0
  130. package/dist/{server-bare-R2m_gsH8.mjs → server-bare-CafzuyFB.mjs} +3 -4
  131. package/dist/{server-command-CTtCkmcQ.mjs → server-command-C6QjeupS.mjs} +14 -7
  132. package/dist/{server-expo-DsguMGUF.mjs → server-expo-CrjB29pq.mjs} +54 -11
  133. package/dist/server-expo-D58c9L0M.mjs +2 -0
  134. package/dist/{settings-B717odTD.mjs → settings-C7O8A6ZI.mjs} +309 -119
  135. package/dist/settings-DpR-1Wnn.mjs +114 -0
  136. package/dist/settings-write-CzD60rOD.mjs +360 -0
  137. package/dist/settings.schema.json +176 -16
  138. package/dist/{simslim-CCr3rE-A.mjs → simslim-BNckWpXi.mjs} +14 -12
  139. package/dist/{slot-launch-DPt0m9Nd.mjs → slot-launch-CbfmNgM6.mjs} +15 -20
  140. package/dist/{spawn-entry-Dcb7sDUz.mjs → spawn-entry-jw19m8Nl.mjs} +0 -1
  141. package/dist/stage-Bps5oius.mjs +200 -0
  142. package/dist/{start-TXeMmmO2.mjs → start-Br-oxqMD.mjs} +1 -1
  143. package/dist/start-EojN4WFz.mjs +1364 -0
  144. package/dist/{state-D1Icyjlu.mjs → state--smjFSTL.mjs} +55 -13
  145. package/dist/{state-CG_OFoaA.mjs → state-08I3hw3_.mjs} +3 -2
  146. package/dist/{stats-BoY5sEPU.mjs → stats-D3GerlFW.mjs} +7 -13
  147. package/dist/stats-report-BzaPrRm6.mjs +16 -0
  148. package/dist/{status-BTA7kKiQ.mjs → status-BRROykC8.mjs} +7 -5
  149. package/dist/status-EvrK72L2.mjs +2 -0
  150. package/dist/{status-WgFbkRzj.mjs → status-WBDajew2.mjs} +554 -452
  151. package/dist/{status-watch-C23ILtf9.mjs → status-watch-Bg_u-pwR.mjs} +222 -25
  152. package/dist/status-worker.d.mts +1 -0
  153. package/dist/status-worker.mjs +19 -0
  154. package/dist/stim-desktop-D5OGpYZM.mjs +112 -0
  155. package/dist/{stop-DR6VoDIk.mjs → stop-DTZ9uTw3.mjs} +2 -2
  156. package/dist/{stop-DPEhunlw.mjs → stop-Dky10AEJ.mjs} +33 -23
  157. package/dist/{stop-BNmBMi1F.mjs → stop-Mv6W9FAk.mjs} +137 -98
  158. package/dist/supervisor-run.d.mts +8 -17
  159. package/dist/supervisor-run.mjs +56 -28
  160. package/dist/{support-CwjbFs9H.mjs → support-CNioewsd.mjs} +14 -14
  161. package/dist/{support-DMTqj3Hm.mjs → support-yUiOjnVY.mjs} +20 -13
  162. package/dist/swiftpm-artifact-inputs-DFcGsXDP.mjs +153 -0
  163. package/dist/swiftpm-macos-BIak-Rxv.mjs +532 -0
  164. package/dist/toolchain-BY8X8HXx.mjs +2 -0
  165. package/dist/toolchain-DpJMHq0n.mjs +876 -0
  166. package/dist/{trigger-CigAYjeL.mjs → trigger-Cbyc41d_.mjs} +21 -6
  167. package/dist/trigger-yb_nFzPF.mjs +2 -0
  168. package/dist/{warm-progress-BuY-Fvfn.mjs → warm-progress-CA3TgT3-.mjs} +263 -156
  169. package/dist/web-CZ07gd77.mjs +2 -0
  170. package/dist/{web-BDBMxDpx.mjs → web-DKx6yoFA.mjs} +20 -14
  171. package/dist/web-run.mjs +13 -12
  172. package/dist/windows-report.d.mts +1 -0
  173. package/dist/windows-report.mjs +18 -0
  174. package/dist/windows-report.ps1 +43 -0
  175. package/dist/{workspace-state-DJt_MMvf.mjs → workspace-state-U08dEzhG.mjs} +62 -58
  176. package/dist/{workspaces-C36s2jb9.mjs → workspaces-CpANmBlq.mjs} +1723 -1286
  177. package/dist/{worktree-CgvJYJ-Q.mjs → worktree-CHecZ4Oq.mjs} +1097 -547
  178. package/dist/worktree-ZqZVjD9K.mjs +2 -0
  179. package/dist/xcode-BXn9-xYx.mjs +896 -0
  180. package/package.json +7 -5
  181. package/shim/android-audio/Main.java +24 -0
  182. package/shim/android-audio/README.md +17 -0
  183. package/shim/android-audio.jar +0 -0
  184. package/shim/android-optimizations.gradle +7 -5
  185. package/dist/activity-BSV745Kz.mjs +0 -629
  186. package/dist/api-qvOzWyfO.mjs +0 -154
  187. package/dist/api-run.mjs +0 -294
  188. package/dist/app-install-BIKtMfPq.mjs +0 -896
  189. package/dist/artifact-lifecycle-DzPpBYvK.mjs +0 -30
  190. package/dist/budget-f7516Zk0.mjs +0 -4106
  191. package/dist/build-facts-DcLv2HSd.d.mts +0 -111
  192. package/dist/cancellation-C_22VQTH.mjs +0 -24
  193. package/dist/client-qQAaXSUs.mjs +0 -1771
  194. package/dist/config-BYDxlMY3.mjs +0 -562
  195. package/dist/device-DuiPJQSn.mjs +0 -290
  196. package/dist/device-lease-BX1sJQ2E.mjs +0 -1224
  197. package/dist/device-remote-xRT0Vmo9.mjs +0 -1272
  198. package/dist/eas-session-ledger-Cm0Gwq2F.mjs +0 -207
  199. package/dist/exec-DqKo9GKJ.mjs +0 -268
  200. package/dist/git-DDfFzkMm.mjs +0 -45
  201. package/dist/launch-verify-B6Q8hZP-.mjs +0 -428
  202. package/dist/logs-BGrEUaEs.mjs +0 -383
  203. package/dist/macos-Ch5VJmcS.mjs +0 -584
  204. package/dist/metro-gateway-CX9Xlkq2.mjs +0 -103
  205. package/dist/miss-reason-mKzZ4VvN.mjs +0 -238
  206. package/dist/native-android-D5qc3-_v.mjs +0 -226
  207. package/dist/native-gradle-inputs-BsLRrl7u.mjs +0 -349
  208. package/dist/ndjson-Du3j0AQ9.d.mts +0 -17
  209. package/dist/plan-C4TjdPsR.mjs +0 -260
  210. package/dist/prebuild-DYbucPXy.mjs +0 -212
  211. package/dist/preview-78a9kR_-.mjs +0 -1011
  212. package/dist/react-native-build-CtCccJtb.mjs +0 -239
  213. package/dist/react-native-doctor-CfRnFfjs.mjs +0 -78
  214. package/dist/remote-cache-OyOyVIS3.mjs +0 -526
  215. package/dist/result-CaJg5Iat.mjs +0 -186
  216. package/dist/server-expo-Bigriskl.mjs +0 -2
  217. package/dist/settings-BORNaaCO.mjs +0 -402
  218. package/dist/settings-vk3mJGSm.d.mts +0 -13
  219. package/dist/spawn-claims-DVS5RkMS.mjs +0 -72
  220. package/dist/stage-KNTQopqv.mjs +0 -157
  221. package/dist/start-BWqzODpb.mjs +0 -1116
  222. package/dist/stim-desktop-BzBN2Em2.mjs +0 -63
  223. package/dist/swiftpm-macos-DRNVJWlb.mjs +0 -119
  224. package/dist/tailnet-Dh-qiYzG.mjs +0 -265
  225. package/dist/toolchain-BFkAcstd.mjs +0 -2
  226. package/dist/toolchain-DxSsNssu.mjs +0 -1657
  227. package/dist/trigger-9_USgmxz.mjs +0 -2
  228. package/dist/web-Dq-i3wzJ.mjs +0 -2
  229. package/dist/worktree-DpLdCHga.mjs +0 -2
  230. package/dist/{api-run.d.mts → doctor-fingerprint.d.mts} +0 -0
  231. package/dist/{errors-DzkMYh8Q.mjs → errors-ccaPc4ox.mjs} +2 -2
@@ -0,0 +1,602 @@
1
+ import { h as withDrainingCancellation, t as getExecutor } from "./exec-DEoAhcze.mjs";
2
+ import { i as sharedBuildCache } from "./paths-DQtTgsBf.mjs";
3
+ import { a as killOnAbort, c as gitQuiet, f as throwIfCancelled, o as git, r as childEnvironment } from "./operation-exec-BW0em61G.mjs";
4
+ import { m as defaultAndroidLayout } from "./settings-C7O8A6ZI.mjs";
5
+ import { r as register } from "./cache-manifest-DSeQjt-Q.mjs";
6
+ import { createHash } from "node:crypto";
7
+ import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
8
+ import { join } from "node:path";
9
+ import { artifactIn, buildCacheKey, resolveArtifact, storeArtifactAsync } from "@stim-cli/core";
10
+ import { join as join$1, posix as posix$1, relative as relative$1, sep as sep$1 } from "path";
11
+ import { existsSync as existsSync$1, mkdirSync as mkdirSync$1, readFileSync as readFileSync$1, readdirSync as readdirSync$1, realpathSync as realpathSync$1, rmSync as rmSync$1, statSync as statSync$1 } from "fs";
12
+ import { writeFile } from "node:fs/promises";
13
+ import { isDeepStrictEqual } from "util";
14
+ import * as expoFingerprint from "@expo/fingerprint";
15
+ import { loadConfigAsync } from "@expo/fingerprint/build/Config.js";
16
+ import { buildUploadTimeoutMs } from "@stim-cli/cache";
17
+ const ASSET_MANIFEST_FILE = "assets-manifest.json";
18
+ const MAX_DEPTH = 4;
19
+ function hashFile(file) {
20
+ try {
21
+ return createHash("sha256").update(readFileSync(file)).digest("hex");
22
+ } catch {
23
+ return null;
24
+ }
25
+ }
26
+ function readAssetManifest(root) {
27
+ if (!existsSync(root)) return null;
28
+ const assets = [];
29
+ let broken = false;
30
+ const walk = (abs, rel, depth) => {
31
+ if (depth > MAX_DEPTH || broken) return;
32
+ let names;
33
+ try {
34
+ names = readdirSync(abs);
35
+ } catch {
36
+ broken = true;
37
+ return;
38
+ }
39
+ for (const name of names) {
40
+ const child = join(abs, name);
41
+ let stat;
42
+ try {
43
+ stat = statSync(child);
44
+ } catch {
45
+ broken = true;
46
+ return;
47
+ }
48
+ const path = rel === "" ? name : `${rel}/${name}`;
49
+ if (stat.isDirectory()) {
50
+ walk(child, path, depth + 1);
51
+ continue;
52
+ }
53
+ if (!stat.isFile()) continue;
54
+ const sha256 = hashFile(child);
55
+ if (sha256 === null) {
56
+ broken = true;
57
+ return;
58
+ }
59
+ assets.push({
60
+ path,
61
+ sha256
62
+ });
63
+ }
64
+ };
65
+ walk(root, "", 0);
66
+ if (broken) return null;
67
+ assets.sort((a, b) => a.path.localeCompare(b.path));
68
+ return {
69
+ version: 1,
70
+ assets
71
+ };
72
+ }
73
+ function parseAssetManifest(text) {
74
+ let parsed;
75
+ try {
76
+ parsed = JSON.parse(String(text));
77
+ } catch {
78
+ return null;
79
+ }
80
+ const obj = parsed;
81
+ if (!obj || obj.version !== 1 || !Array.isArray(obj.assets)) return null;
82
+ const assets = [];
83
+ for (const raw of obj.assets) {
84
+ const entry = raw;
85
+ if (typeof entry?.path !== "string" || typeof entry?.sha256 !== "string") return null;
86
+ assets.push({
87
+ path: entry.path,
88
+ sha256: entry.sha256
89
+ });
90
+ }
91
+ return {
92
+ version: 1,
93
+ assets
94
+ };
95
+ }
96
+ function pickGeneratedResDir(names, variant, reactChildren = []) {
97
+ const wanted = (variant ?? "").trim().toLowerCase();
98
+ const modern = names.filter((n) => /^createBundle.+JsAndAssets$/.test(n)).toSorted();
99
+ if (wanted) {
100
+ const match = modern.find((n) => n.toLowerCase() === `createbundle${wanted}jsandassets`);
101
+ if (match) return match;
102
+ } else if (modern.length === 1) return modern[0];
103
+ if (!names.includes("react")) return null;
104
+ const children = reactChildren.toSorted();
105
+ if (wanted) {
106
+ const match = children.find((n) => n.toLowerCase() === wanted);
107
+ if (match) return `react/${match}`;
108
+ } else if (children.length === 1) return `react/${children[0]}`;
109
+ return null;
110
+ }
111
+ function androidModuleDirs(root, { list = safeList } = {}) {
112
+ const android = join(root, "android");
113
+ return ["app", ...list(android).filter((name) => name !== "app" && existsSync(join(android, name, "build", "generated", "res"))).toSorted()];
114
+ }
115
+ function findGeneratedResDir(root, variant, { list = safeList, layout = defaultAndroidLayout(root) } = {}) {
116
+ const modules = layout.custom ? [layout.moduleDir] : androidModuleDirs(root, { list }).map((m) => join(root, "android", m));
117
+ for (const moduleDir of modules) {
118
+ const base = join(moduleDir, "build", "generated", "res");
119
+ const names = list(base);
120
+ if (names.length === 0) continue;
121
+ const picked = pickGeneratedResDir(names, variant, names.includes("react") ? list(join(base, "react")) : []);
122
+ if (picked) return join(base, ...picked.split("/"));
123
+ }
124
+ return null;
125
+ }
126
+ function captureAssetManifest(root, { variant = null, layout = defaultAndroidLayout(root), findDir = findGeneratedResDir, read = readAssetManifest } = {}) {
127
+ const dir = findDir(root, variant, { layout });
128
+ return dir ? read(dir) : null;
129
+ }
130
+ function compareAssetManifests(fresh, stored) {
131
+ const left = new Map(fresh.assets.map((a) => [a.path, a.sha256]));
132
+ const right = new Map(stored.assets.map((a) => [a.path, a.sha256]));
133
+ const added = [];
134
+ const changed = [];
135
+ const removed = [];
136
+ for (const [path, sha256] of left) if (!right.has(path)) added.push(path);
137
+ else if (right.get(path) !== sha256) changed.push(path);
138
+ for (const path of right.keys()) if (!left.has(path)) removed.push(path);
139
+ added.sort();
140
+ changed.sort();
141
+ removed.sort();
142
+ return {
143
+ same: added.length === 0 && changed.length === 0 && removed.length === 0,
144
+ added,
145
+ removed,
146
+ changed,
147
+ example: added[0] ?? changed[0] ?? removed[0] ?? null
148
+ };
149
+ }
150
+ function assetDiffReason(diff) {
151
+ const which = diff.added.length ? "added" : diff.changed.length ? "changed" : "removed";
152
+ return `this workspace emits a different asset set than the cached build did (${diff.added.length} added, ${diff.changed.length} changed, ${diff.removed.length} removed; e.g. ${which} ${diff.example})`;
153
+ }
154
+ function safeList(dir) {
155
+ try {
156
+ return readdirSync(dir);
157
+ } catch {
158
+ return [];
159
+ }
160
+ }
161
+ //#endregion
162
+ //#region src/cache/build-cache.ts
163
+ function entryDir(platform, key, root = sharedBuildCache()) {
164
+ return join$1(root, platform, key);
165
+ }
166
+ const FINGERPRINT_PLATFORMS = /* @__PURE__ */ new Set(["ios", "android"]);
167
+ /**
168
+ * Paths that exist in a working checkout and not in a fresh one, which
169
+ * @expo/fingerprint does not ignore on its own. A fingerprint that counts them
170
+ * cannot match across checkouts, which is the parity failure `doctor` reports.
171
+ *
172
+ * The list stays narrow on purpose: a path belongs here only when no native
173
+ * build on any project can read it. Anything a single project can judge --
174
+ * a lockfile with machine paths, a generated report -- belongs in that
175
+ * project's `.fingerprintignore`, which still applies on top of this.
176
+ */
177
+ const DEFAULT_FINGERPRINT_IGNORES = ["**/android/local.properties", "**/android/.idea/**"];
178
+ const APP_ROOT_IOS_SKIPPED = /* @__PURE__ */ new Set([
179
+ "node_modules",
180
+ "Pods",
181
+ "build",
182
+ "android",
183
+ ".git",
184
+ ".DS_Store",
185
+ ".stim.json"
186
+ ]);
187
+ function gitIgnoredNames(projectRoot, names) {
188
+ if (names.length === 0) return /* @__PURE__ */ new Set();
189
+ const out = gitQuiet(projectRoot, [
190
+ "check-ignore",
191
+ "--",
192
+ ...names
193
+ ]);
194
+ return new Set(String(out ?? "").split("\n").map((line) => line.trim()).filter(Boolean));
195
+ }
196
+ /**
197
+ * Sources and ignores that make an `ios.projectPath` outside `ios/` count the way
198
+ * @expo/fingerprint's bare sourcer counts `ios/`. A project directory that is the
199
+ * app itself cannot be told apart from the app's JavaScript, so every top-level
200
+ * entry git tracks, except dependencies and build output, is hashed: a JS change
201
+ * misses the cache instead of risking a stale native build.
202
+ */
203
+ function iosProjectFingerprintOptions(projectRoot, iosProjectPath, { list = (dir) => readdirSync$1(dir), isDirectory = (path) => statSync$1(path).isDirectory(), ignored = gitIgnoredNames } = {}) {
204
+ if (iosProjectPath === "ios") return {};
205
+ const appRoot = iosProjectPath === ".";
206
+ const prefix = appRoot ? "" : `${iosProjectPath}/`;
207
+ const reasons = ["ios.projectPath"];
208
+ let extraSources = [{
209
+ type: "dir",
210
+ filePath: iosProjectPath,
211
+ reasons
212
+ }];
213
+ if (appRoot) {
214
+ const names = list(projectRoot).filter((name) => !APP_ROOT_IOS_SKIPPED.has(name) && !name.startsWith(".watchman-cookie-"));
215
+ const skip = ignored(projectRoot, names);
216
+ extraSources = names.filter((name) => !skip.has(name)).toSorted((a, b) => a.localeCompare(b)).map((filePath) => ({
217
+ type: isDirectory(join$1(projectRoot, filePath)) ? "dir" : "file",
218
+ filePath,
219
+ reasons
220
+ }));
221
+ }
222
+ return {
223
+ extraSources,
224
+ ignorePaths: [
225
+ `${prefix}Pods/**/*`,
226
+ `${prefix}build/**/*`,
227
+ `${prefix}.xcode.env.local`,
228
+ `${prefix}**/project.xcworkspace`,
229
+ `${prefix}*.xcworkspace/xcuserdata/**/*`
230
+ ]
231
+ };
232
+ }
233
+ const ANDROID_ROOT_SOURCES = [
234
+ "settings.gradle",
235
+ "settings.gradle.kts",
236
+ "build.gradle",
237
+ "build.gradle.kts",
238
+ "gradle.properties",
239
+ "gradle"
240
+ ];
241
+ function androidProjectFingerprintOptions(projectRoot, layout, exists = existsSync$1) {
242
+ if (!layout.custom) return {};
243
+ const reasons = ["android.gradleRoot"];
244
+ const extraSources = ANDROID_ROOT_SOURCES.filter((name) => exists(join$1(layout.gradleRoot, name))).map((name) => ({
245
+ type: name === "gradle" ? "dir" : "file",
246
+ filePath: posix$1.join(layout.gradleRootRelative, name),
247
+ reasons
248
+ }));
249
+ let appRoot = projectRoot;
250
+ try {
251
+ appRoot = realpathSync$1(projectRoot);
252
+ } catch {}
253
+ const fromApp = relative$1(appRoot, layout.moduleDir).split(sep$1).join("/");
254
+ if (fromApp === "android" || fromApp.startsWith("android/")) return fromApp === "android/app" ? { extraSources } : {
255
+ extraSources,
256
+ ignorePaths: [
257
+ "build",
258
+ ".cxx",
259
+ ".gradle"
260
+ ].map((dir) => `${fromApp}/${dir}/**/*`)
261
+ };
262
+ const moduleRel = posix$1.join(layout.gradleRootRelative, ...layout.module.split(":").filter(Boolean));
263
+ extraSources.push({
264
+ type: "dir",
265
+ filePath: moduleRel,
266
+ reasons: ["android.module"]
267
+ });
268
+ return {
269
+ extraSources,
270
+ ignorePaths: [
271
+ "build",
272
+ ".cxx",
273
+ ".gradle"
274
+ ].map((dir) => `${moduleRel}/${dir}/**/*`)
275
+ };
276
+ }
277
+ async function fingerprintProject(projectRoot, { platform, iosProjectPath = "ios", androidLayout = null, createFingerprint = expoFingerprint.createFingerprintAsync, debug = false } = {}) {
278
+ const platforms = platform && FINGERPRINT_PLATFORMS.has(platform) ? { platforms: [platform] } : void 0;
279
+ const ios = platform === "ios" ? iosProjectFingerprintOptions(projectRoot, iosProjectPath) : androidLayout?.custom ? androidProjectFingerprintOptions(projectRoot, androidLayout) : {};
280
+ if (ios.extraSources) ios.extraSources = [...(await loadConfigAsync(projectRoot, true))?.extraSources ?? [], ...ios.extraSources];
281
+ const result = await createFingerprint(projectRoot, {
282
+ ...platforms,
283
+ ...debug ? { debug } : {},
284
+ ...ios.extraSources ? { extraSources: ios.extraSources } : {},
285
+ ignorePaths: [...DEFAULT_FINGERPRINT_IGNORES, ...ios.ignorePaths ?? []],
286
+ silent: true
287
+ });
288
+ const hash = result?.hash ?? null;
289
+ if (!hash) return null;
290
+ return {
291
+ hash,
292
+ sources: Array.isArray(result?.sources) ? result.sources : []
293
+ };
294
+ }
295
+ function registerOnce(root, registeredBy) {
296
+ try {
297
+ register({
298
+ dir: root,
299
+ registeredBy,
300
+ name: "Build cache",
301
+ prune: "entries",
302
+ entriesDepth: 2,
303
+ note: "built .app/.apk keyed on the native fingerprint"
304
+ });
305
+ } catch {}
306
+ }
307
+ function resolveBuild(platform, key, root = sharedBuildCache()) {
308
+ return resolveArtifact(entryDir(platform, key, root));
309
+ }
310
+ async function storeBuild(platform, key, buildPath, rootOrOptions = {}) {
311
+ const options = typeof rootOrOptions === "string" ? { root: rootOrOptions } : rootOrOptions || {};
312
+ const root = options.root || sharedBuildCache();
313
+ const signal = options.signal ?? options.context?.signal;
314
+ const env = options.context?.env;
315
+ throwIfCancelled(signal, "build cache copy");
316
+ if (!buildPath || !existsSync$1(buildPath)) throw new Error(`No build to store at ${buildPath}`);
317
+ registerOnce(root, options.context?.cwd);
318
+ try {
319
+ return await withDrainingCancellation(options.context, signal, () => storeArtifactAsync(entryDir(platform, key, root), buildPath, {
320
+ signal,
321
+ runFile: (file, args) => getExecutor().runFileAsync(file, args, {
322
+ timeoutMs: "unbounded",
323
+ ...env ? childEnvironment(env) : {},
324
+ onSpawn: killOnAbort(signal),
325
+ declareFor: options.context
326
+ }),
327
+ overwrite: Boolean(options.overwrite),
328
+ writeMetadata: async (staging) => {
329
+ if (Array.isArray(options.sources)) try {
330
+ await writeFile(join$1(staging, SOURCES_FILE), JSON.stringify(options.sources.map(withoutContents)));
331
+ } catch {}
332
+ if (options.assetManifest) try {
333
+ await writeFile(join$1(staging, ASSET_MANIFEST_FILE), JSON.stringify(options.assetManifest));
334
+ } catch {}
335
+ }
336
+ }));
337
+ } catch (error) {
338
+ throwIfCancelled(signal, "build cache copy");
339
+ throw error;
340
+ }
341
+ }
342
+ const PROVIDER_DOWNLOAD_DIR = "cache-provider";
343
+ function providerDownloadPath(workspacePath) {
344
+ return join$1(workspacePath, PROVIDER_DOWNLOAD_DIR);
345
+ }
346
+ /**
347
+ * Empties and registers the scratch directory a provider downloads into. It is
348
+ * created only when a provider is about to be asked, and registered so `gc`
349
+ * reports what an interrupted run left behind.
350
+ */
351
+ function prepareProviderDownloadDir(dir, registeredBy) {
352
+ rmSync$1(dir, {
353
+ recursive: true,
354
+ force: true
355
+ });
356
+ mkdirSync$1(dir, { recursive: true });
357
+ try {
358
+ register({
359
+ dir,
360
+ registeredBy,
361
+ name: "Cache provider downloads",
362
+ prune: "entries",
363
+ entriesDepth: 1,
364
+ note: "artifacts fetched from the project cache provider; anything left here is from an interrupted run"
365
+ });
366
+ } catch {}
367
+ }
368
+ function filesystemBuildCapability({ root, context, sources, assetManifest, resolve = resolveBuild, store = storeBuild } = {}) {
369
+ const stored = {
370
+ ...context === void 0 ? {} : { context },
371
+ ...root === void 0 ? {} : { root },
372
+ ...sources === void 0 ? {} : { sources },
373
+ ...assetManifest === void 0 ? {} : { assetManifest }
374
+ };
375
+ return {
376
+ resolve: ({ platform, key }) => root === void 0 ? resolve(platform, key) : resolve(platform, key, root),
377
+ store: ({ platform, key, sourcePath, overwrite, signal }) => store(platform, key, sourcePath, {
378
+ ...stored,
379
+ overwrite,
380
+ signal
381
+ })
382
+ };
383
+ }
384
+ function providerUploadOutcome(result, name, env) {
385
+ if (!result) return null;
386
+ const label = name || "the cache provider";
387
+ if (result.timedOut) return {
388
+ line: `${label} upload was cancelled after ${buildUploadTimeoutMs(env)}ms`,
389
+ warn: true
390
+ };
391
+ if (result.failed) return {
392
+ line: `${label} upload failed: ${result.failed}`,
393
+ warn: true
394
+ };
395
+ return {
396
+ line: `uploaded (${label})`,
397
+ warn: false
398
+ };
399
+ }
400
+ const SOURCES_FILE = "fingerprint-sources.json";
401
+ function withoutContents(source) {
402
+ return source.type === "contents" ? {
403
+ ...source,
404
+ contents: ""
405
+ } : source;
406
+ }
407
+ function storedSources(platform, key, root = sharedBuildCache()) {
408
+ try {
409
+ const parsed = JSON.parse(readFileSync$1(join$1(entryDir(platform, key, root), SOURCES_FILE), "utf-8"));
410
+ return Array.isArray(parsed) ? parsed : null;
411
+ } catch {
412
+ return null;
413
+ }
414
+ }
415
+ function storedAssetManifest(platform, key, root = sharedBuildCache()) {
416
+ try {
417
+ return parseAssetManifest(readFileSync$1(join$1(entryDir(platform, key, root), ASSET_MANIFEST_FILE), "utf-8"));
418
+ } catch {
419
+ return null;
420
+ }
421
+ }
422
+ function sourceName(source) {
423
+ const s = source;
424
+ if (typeof s?.filePath === "string" && s.filePath !== "") return s.filePath;
425
+ if (typeof s?.id === "string" && s.id !== "") return s.id;
426
+ return null;
427
+ }
428
+ function sourceReasons(source) {
429
+ const reasons = source?.reasons;
430
+ return Array.isArray(reasons) ? reasons.filter((reason) => typeof reason === "string") : [];
431
+ }
432
+ function diffItemChange(item) {
433
+ const o = item;
434
+ const [change, source] = o?.op === "added" ? ["added", o.addedSource] : o?.op === "removed" ? ["removed", o.removedSource] : ["changed", o?.afterSource ?? o?.beforeSource];
435
+ const name = sourceName(source);
436
+ return name === null ? null : {
437
+ name,
438
+ change,
439
+ reasons: sourceReasons(source)
440
+ };
441
+ }
442
+ function compareSourceLists(previous, current) {
443
+ const previousByName = /* @__PURE__ */ new Map();
444
+ for (const source of previous) {
445
+ const name = sourceName(source);
446
+ if (name !== null) previousByName.set(name, {
447
+ hash: source.hash ?? null,
448
+ reasons: sourceReasons(source)
449
+ });
450
+ }
451
+ const changes = [];
452
+ const seen = /* @__PURE__ */ new Set();
453
+ for (const source of current) {
454
+ const name = sourceName(source);
455
+ if (name === null || seen.has(name)) continue;
456
+ seen.add(name);
457
+ const hash = source.hash ?? null;
458
+ const before = previousByName.get(name);
459
+ if (!before) changes.push({
460
+ name,
461
+ change: "added",
462
+ reasons: sourceReasons(source)
463
+ });
464
+ else if (before.hash !== hash) changes.push({
465
+ name,
466
+ change: "changed",
467
+ reasons: sourceReasons(source)
468
+ });
469
+ }
470
+ for (const [name, before] of previousByName) if (!seen.has(name)) changes.push({
471
+ name,
472
+ change: "removed",
473
+ reasons: before.reasons
474
+ });
475
+ return changes;
476
+ }
477
+ function diffFingerprintSources({ previous, previousHash = null, current, differ = null }) {
478
+ if (typeof differ === "function") try {
479
+ const items = differ({
480
+ sources: previous,
481
+ hash: previousHash ?? ""
482
+ }, {
483
+ sources: current.sources,
484
+ hash: current.hash
485
+ });
486
+ if (Array.isArray(items)) {
487
+ const changes = [];
488
+ const seen = /* @__PURE__ */ new Set();
489
+ for (const item of items) {
490
+ const change = diffItemChange(item);
491
+ if (change !== null && !seen.has(change.name)) {
492
+ seen.add(change.name);
493
+ changes.push(change);
494
+ }
495
+ }
496
+ return changes;
497
+ }
498
+ } catch {}
499
+ return compareSourceLists(previous, current.sources);
500
+ }
501
+ async function refingerprintAfterMutation({ projectRoot, platform, previousHash, iosProjectPath, androidLayout, fingerprint = fingerprintProject }) {
502
+ let computed = null;
503
+ try {
504
+ computed = await fingerprint(projectRoot, {
505
+ platform,
506
+ ...iosProjectPath ? { iosProjectPath } : {},
507
+ ...androidLayout ? { androidLayout } : {}
508
+ });
509
+ } catch {
510
+ return null;
511
+ }
512
+ if (!computed?.hash) return null;
513
+ return {
514
+ hash: computed.hash,
515
+ sources: computed.sources,
516
+ moved: computed.hash !== previousHash
517
+ };
518
+ }
519
+ const CONFIG_INPUT_REASONS = /* @__PURE__ */ new Set([
520
+ "expoConfig",
521
+ "expoConfigPlugins",
522
+ "expoConfigExternalFile"
523
+ ]);
524
+ function writtenByBuild(name, platform) {
525
+ return name === platform || name.startsWith(`${platform}/`) || name.startsWith("node_modules/") || name.includes("/node_modules/");
526
+ }
527
+ const PREBUILD_WRITTEN_IDS = [["ios", "bundleIdentifier"], ["android", "package"]];
528
+ function expoConfigContents(sources) {
529
+ const source = sources.find((s) => s.type === "contents" && s.id === "expoConfig");
530
+ if (source?.type !== "contents") return null;
531
+ try {
532
+ const parsed = JSON.parse(String(source.contents));
533
+ return parsed && typeof parsed === "object" ? parsed : null;
534
+ } catch {
535
+ return null;
536
+ }
537
+ }
538
+ function onlyPrebuildIdsAdded(before, after) {
539
+ const previous = expoConfigContents(before);
540
+ const current = expoConfigContents(after);
541
+ if (!previous || !current) return false;
542
+ const stripped = { ...current };
543
+ for (const [section, key] of PREBUILD_WRITTEN_IDS) {
544
+ const was = previous[section];
545
+ const now = stripped[section];
546
+ if (now?.[key] === void 0 || was?.[key] !== void 0) continue;
547
+ const rest = { ...now };
548
+ delete rest[key];
549
+ if (was === void 0 && Object.keys(rest).length === 0) delete stripped[section];
550
+ else stripped[section] = rest;
551
+ }
552
+ return isDeepStrictEqual(previous, stripped);
553
+ }
554
+ function configInputsChanged(before, after, { prebuildRan }) {
555
+ return compareSourceLists(before, after).filter((change) => change.reasons.some((reason) => CONFIG_INPUT_REASONS.has(reason))).filter((change) => !(prebuildRan && change.name === "expoConfig" && onlyPrebuildIdsAdded(before, after))).map((change) => change.name);
556
+ }
557
+ function inputsChangedDuringBuild({ platform, lookup, prebuildRan, compiled, current }) {
558
+ const names = new Set(configInputsChanged(lookup, current, { prebuildRan }));
559
+ for (const change of compareSourceLists(compiled, current)) if (!writtenByBuild(change.name, platform)) names.add(change.name);
560
+ return [...names];
561
+ }
562
+ function changedDuringBuildLine(changed) {
563
+ const shown = changed.slice(0, 3);
564
+ const more = changed.length > shown.length ? `, and ${changed.length - shown.length} more` : "";
565
+ return `${shown.join(", ")}${more} changed while the build ran, so the artifact may not match its key; the build will be installed but not cached`;
566
+ }
567
+ function untrackedNativeFiles({ projectRoot, iosProjectPath = "ios" }) {
568
+ let out;
569
+ try {
570
+ out = git(projectRoot, [
571
+ "ls-files",
572
+ "--others",
573
+ "--exclude-standard",
574
+ "--",
575
+ "ios",
576
+ "android",
577
+ ...iosProjectPath !== "ios" ? [iosProjectPath] : []
578
+ ]);
579
+ } catch {
580
+ return [];
581
+ }
582
+ return String(out || "").split("\n").map((line) => line.trim()).filter((line) => line !== "");
583
+ }
584
+ function untrackedMissLine(files, cap = 3) {
585
+ if (!Array.isArray(files) || files.length === 0) return null;
586
+ const shown = files.slice(0, cap);
587
+ const more = files.length > shown.length ? `, and ${files.length - shown.length} more` : "";
588
+ return `no previous entry to diff against; ${files.length} untracked file${files.length === 1 ? "" : "s"} under ios/ or android/ are hashed like any other source: ${shown.join(", ")}${more} -- list the build-irrelevant ones in .fingerprintignore`;
589
+ }
590
+ function fingerprintDiffRecord({ changed, previousHash, hash }) {
591
+ const shown = changed.slice(0, 20);
592
+ return {
593
+ src: "build",
594
+ level: "info",
595
+ event: "fingerprint_diff",
596
+ msg: `fingerprint ${previousHash} -> ${hash}: ${changed.length} source${changed.length === 1 ? "" : "s"} changed: ` + shown.join(", ") + (changed.length > shown.length ? `, and ${changed.length - shown.length} more` : ""),
597
+ changed: changed.length,
598
+ sources: shown
599
+ };
600
+ }
601
+ //#endregion
602
+ export { compareAssetManifests as C, captureAssetManifest as S, storedAssetManifest as _, diffFingerprintSources as a, untrackedNativeFiles as b, fingerprintDiffRecord as c, prepareProviderDownloadDir as d, providerDownloadPath as f, storeBuild as g, resolveBuild as h, configInputsChanged as i, fingerprintProject as l, refingerprintAfterMutation as m, buildCacheKey as n, entryDir as o, providerUploadOutcome as p, changedDuringBuildLine as r, filesystemBuildCapability as s, artifactIn as t, inputsChangedDuringBuild as u, storedSources as v, readAssetManifest as w, assetDiffReason as x, untrackedMissLine as y };