stim 1.20.2 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/README.md +88 -8
  2. package/dist/acquire-artifact-CD4lbiWE.mjs +153 -0
  3. package/dist/act-DHAw2A2S.mjs +2667 -0
  4. package/dist/activity-BzVfHSrY.mjs +1376 -0
  5. package/dist/{agent-device-usage-output-Dzgv6lgR.mjs → agent-device-usage-output-zh1vhbLp.mjs} +21 -65
  6. package/dist/{android-HqP1_vB_.mjs → android-BEJ8Jpl7.mjs} +2 -2
  7. package/dist/{android-DCKZrNvV.mjs → android-BLgbNqox.mjs} +128 -78
  8. package/dist/{android-Dlzxshgp.mjs → android-CV_GCELZ.mjs} +5 -5
  9. package/dist/{android-Mz_Inn3w.mjs → android-DUYkNF4u.mjs} +184 -102
  10. package/dist/{android-cas-Bl-cLJBk.mjs → android-cas-Ct5b1xCK.mjs} +7 -6
  11. package/dist/android-cas-compiler.mjs +2 -2
  12. package/dist/android-project-BCAAmMwz.mjs +12 -0
  13. package/dist/api.d.mts +740 -8
  14. package/dist/api.mjs +585 -1
  15. package/dist/{artifact-HSwkIWEQ.mjs → artifact-B8T3S5gi.mjs} +223 -201
  16. package/dist/{artifact-D3czlUvT.mjs → artifact-DAuZ-FNU.mjs} +158 -148
  17. package/dist/{browser-web-CA-F1GQo.mjs → browser-web-QQzVjz3O.mjs} +26 -24
  18. package/dist/budget-Bs6SxxzO.mjs +9154 -0
  19. package/dist/{build-DYDbfkk5.mjs → build-CoPzQRNw.mjs} +144 -96
  20. package/dist/build-cache-DmyR9Zzc.mjs +602 -0
  21. package/dist/build-plan-CaFskB7_.mjs +188 -0
  22. package/dist/{cache-manifest-XH-fvDUj.mjs → cache-manifest-DkkqguoK.mjs} +2 -2
  23. package/dist/cache-manifest.mjs +1 -1
  24. package/dist/{ccache-zdKiYQ3E.mjs → ccache-BJRZ9pG3.mjs} +10 -9
  25. package/dist/{cdp-Dq_ypAlJ.mjs → cdp-CWmIUMbw.mjs} +18 -5
  26. package/dist/{chrome-BnzZMqsR.mjs → chrome-B6tfCta1.mjs} +7 -4
  27. package/dist/{cli-CLP3diBm.mjs → cli-0DYf8QhQ.mjs} +20 -20
  28. package/dist/cli.mjs +1 -1
  29. package/dist/client-B7QVOlCr.d.mts +253 -0
  30. package/dist/client-UXD70ZbM.mjs +1406 -0
  31. package/dist/collector-run.d.mts +4 -40
  32. package/dist/collector-run.mjs +9 -8
  33. package/dist/{command-output-BTy8hZ0F.mjs → command-output-B1UrjZHL.mjs} +1 -1
  34. package/dist/config-CYcBF478.mjs +949 -0
  35. package/dist/{created-devices-Dzd5C2LF.mjs → created-devices-CqeBlrEn.mjs} +3 -3
  36. package/dist/{dependency-state-DG0p31-y.mjs → dependency-state-BbKQW83h.mjs} +20 -5
  37. package/dist/{detached-entry-B9C_zeQC.mjs → detached-entry-DFRyG1_o.mjs} +1 -1
  38. package/dist/{dev-client-DAWVIGBu.mjs → dev-client-UOeESKm6.mjs} +2 -2
  39. package/dist/device-DCxH7_By.mjs +1068 -0
  40. package/dist/{device-BECOiufl.mjs → device-ExJq8Ei7.mjs} +35 -35
  41. package/dist/{device-capacity-CBUAcRyQ.mjs → device-capacity-CMlqEcvw.mjs} +43 -13
  42. package/dist/device-host-worker.mjs +65 -61
  43. package/dist/{device-ios-COSi6oS1.mjs → device-ios-DRUeKaFV.mjs} +48 -45
  44. package/dist/{device-lease-run-Cw2M4z51.mjs → device-lease-run-C8raGFoP.mjs} +14 -26
  45. package/dist/{device-pool-Bf-pOhSw.mjs → device-pool-DMRpVX9a.mjs} +5 -5
  46. package/dist/doctor-BLHCYxzi.mjs +2 -0
  47. package/dist/{doctor-kfMBnUw6.mjs → doctor-DTvaDOda.mjs} +281 -317
  48. package/dist/{doctor-CB8oZKCk.mjs → doctor-Dhqebm0q.mjs} +183 -91
  49. package/dist/doctor-fingerprint.mjs +19 -0
  50. package/dist/{doctor-watchman-BRyV2adA.mjs → doctor-watchman-Cv1F10Kj.mjs} +40 -21
  51. package/dist/{eas-build-JyfqyHfC.mjs → eas-build-BomfRnFT.mjs} +53 -20
  52. package/dist/{build-plan-B7SZsc2N.mjs → eas-fallback-DJwZpy0c.mjs} +26 -208
  53. package/dist/{watchman-CPQFZLXY.mjs → eas-session-ledger-op6A54yi.mjs} +229 -11
  54. package/dist/{error-diagnostics-BR677IDM.mjs → error-diagnostics-Bf0rZvG9.mjs} +172 -82
  55. package/dist/exec-H20xSg2T.d.mts +65 -0
  56. package/dist/exec-_UbtCQcG.mjs +750 -0
  57. package/dist/gc-C-WwL0yi.mjs +3 -0
  58. package/dist/{gc-qWOMdnER.mjs → gc-_-dCXdyL.mjs} +584 -796
  59. package/dist/git-C3iTsJaZ.mjs +73 -0
  60. package/dist/{guide-G9cAbVAc.mjs → guide-Yqwt2bd6.mjs} +941 -269
  61. package/dist/{hosted-android-C3MHGld1.mjs → hosted-android-Bw-honsd.mjs} +8 -6
  62. package/dist/{hosted-client-ZEKpS9vw.mjs → hosted-client-DB_gBPfY.mjs} +34 -19
  63. package/dist/{hosted-ios-l-o3iM9J.mjs → hosted-ios-CUvOf4Vr.mjs} +1 -1
  64. package/dist/{hosted-logs-EzQM7-3Z.mjs → hosted-logs-DL_P5AdN.mjs} +77 -43
  65. package/dist/{hosted-macos-BACVAVqE.mjs → hosted-macos-QI141yKk.mjs} +21 -17
  66. package/dist/{hosted-native-A4s1QPXe.mjs → hosted-native-Ksyjgzq-.mjs} +30 -21
  67. package/dist/idle-BVeRGroT.d.mts +24 -0
  68. package/dist/{idle-shutdown-DtxhPTKe.mjs → idle-shutdown-DaKmZi0z.mjs} +11 -10
  69. package/dist/{ios-BwVCF7oA.mjs → ios-CQ68hG9s.mjs} +8 -8
  70. package/dist/{ios-RkW4pnQf.mjs → ios-CpByZy12.mjs} +140 -80
  71. package/dist/{ios-device-B5veSDDQ.mjs → ios-device-CXGP1bsD.mjs} +1 -1
  72. package/dist/{ios-device-D7pi2Sca.mjs → ios-device-CwFMehUS.mjs} +51 -26
  73. package/dist/{ios-project-K9hY_Jab.mjs → ios-project-WuwwBdvW.mjs} +13 -13
  74. package/dist/{ios-nOLJGVdy.mjs → ios-qNJt4dFm.mjs} +1 -1
  75. package/dist/ios-signing-DTTIChGs.mjs +489 -0
  76. package/dist/{ios-state-CBLe1xYw.mjs → ios-state-DvFX-K_l.mjs} +1 -1
  77. package/dist/{ios-Ce7bc7br.mjs → ios-ubFsBzwq.mjs} +129 -86
  78. package/dist/{js-swap-Bb3nsS07.mjs → js-swap-Cc1dttps.mjs} +53 -26
  79. package/dist/{launch-F4sOqAhB.mjs → launch-CD1yVc7U.mjs} +91 -90
  80. package/dist/{launch-C3qJ6Agb.mjs → launch-Zq2mOSDy.mjs} +82 -541
  81. package/dist/logs-BS00Anxf.mjs +352 -0
  82. package/dist/logs-CMm05HxN.mjs +255 -0
  83. package/dist/{macos-D7uDvO-z.mjs → macos-B65--pPd.mjs} +1 -1
  84. package/dist/{macos-Ch5VJmcS.mjs → macos-C-0qJ6zq.mjs} +225 -212
  85. package/dist/macos-run.mjs +1 -1
  86. package/dist/maintenance-run.mjs +122 -247
  87. package/dist/{metro-DnCEjCxs.mjs → metro-DEXpIhHC.mjs} +67 -12
  88. package/dist/{metro-gateway-CX9Xlkq2.mjs → metro-gateway-BMJNlj3E.mjs} +20 -12
  89. package/dist/{named-ports-4WopRPg-.mjs → named-ports-BWTzt6mu.mjs} +8 -63
  90. package/dist/native-android-JACyjTZs.mjs +844 -0
  91. package/dist/{native-gradle-inputs-BsLRrl7u.mjs → native-gradle-inputs-Bep9JcSF.mjs} +128 -140
  92. package/dist/native-inputs-TRTTTRxt.mjs +91 -0
  93. package/dist/native-run-DY_RLx3C.mjs +277 -0
  94. package/dist/{native-runtime-k8dTIrbK.mjs → native-runtime-Dg1Q7tfF.mjs} +9 -8
  95. package/dist/{native-xcode-inputs-CykopJdM.mjs → native-xcode-inputs-CB2iQeWq.mjs} +27 -18
  96. package/dist/{native-xcode-ios-Bbf30Gm0.mjs → native-xcode-ios-CXX39F7o.mjs} +96 -47
  97. package/dist/{ndjson-GOnbyvso.mjs → ndjson-CgE_o3Dl.mjs} +3 -3
  98. package/dist/offload-worker.d.mts +1 -46
  99. package/dist/offload-worker.mjs +197 -66
  100. package/dist/{ownership-DCtw_2IA.mjs → ownership-DEmM5vhh.mjs} +3 -3
  101. package/dist/{page-DRHy329N.mjs → page-CPaHeYqj.mjs} +7 -4
  102. package/dist/paths-BsJMoPP2.mjs +12 -0
  103. package/dist/paths-DQtTgsBf.mjs +42 -0
  104. package/dist/{placement-log-MOfPVgaM.mjs → placement-log-BqGbTa61.mjs} +5 -5
  105. package/dist/{plan-placement-V0TdzYXp.mjs → plan-placement-Bwj-IjY1.mjs} +6 -6
  106. package/dist/{ports-DdSUicVo.mjs → ports-D-MmCTdv.mjs} +3 -3
  107. package/dist/prebuild-uD_ipCxF.mjs +449 -0
  108. package/dist/{project-_phNIJfs.mjs → project-BZNjmW_8.mjs} +65 -37
  109. package/dist/{pull-request-CQ8sPbZa.mjs → pull-request-Lfetn8Kr.mjs} +2 -2
  110. package/dist/pull-request-zjCSAryH.d.mts +120 -0
  111. package/dist/pull-requests.d.mts +1 -119
  112. package/dist/pull-requests.mjs +1 -1
  113. package/dist/{react-native-android-CM1XRDwv.mjs → react-native-android-DuzH0cn3.mjs} +74 -48
  114. package/dist/{gradle-DSrXb6lG.mjs → react-native-build-rhk4smwQ.mjs} +292 -15
  115. package/dist/react-native-doctor-CQpuIMso.mjs +234 -0
  116. package/dist/{react-native-ios-Dhq_eiYQ.mjs → react-native-ios-Bhq1rJeV.mjs} +46 -28
  117. package/dist/{recordings-D0d5aQt0.mjs → recordings-DYteQSu4.mjs} +12 -9
  118. package/dist/{reload-C8JhxjSh.mjs → reload-CmTRFJaX.mjs} +93 -47
  119. package/dist/reload-DzjSl5P_.mjs +2 -0
  120. package/dist/{remote-BiR6aYjy.mjs → remote-ByYkXdGD.mjs} +15 -10
  121. package/dist/result-DNiS-tTP.mjs +434 -0
  122. package/dist/{run-BtPgpKks.mjs → run-D23HmJMs.mjs} +4 -5
  123. package/dist/selection-CSl9i5qU.mjs +619 -0
  124. package/dist/{server-bare-R2m_gsH8.mjs → server-bare-CxTrvDg8.mjs} +3 -4
  125. package/dist/{server-command-CTtCkmcQ.mjs → server-command-CtzloH3v.mjs} +14 -7
  126. package/dist/server-expo-C-90EhcG.mjs +2 -0
  127. package/dist/{server-expo-DsguMGUF.mjs → server-expo-DT_F_uVI.mjs} +50 -9
  128. package/dist/{settings-B717odTD.mjs → settings-CsJDEXgK.mjs} +234 -24
  129. package/dist/{settings-vk3mJGSm.d.mts → settings-DkdmlelE.d.mts} +6 -4
  130. package/dist/settings-T1gtc3bf.mjs +114 -0
  131. package/dist/settings-write-HyVZ8eQ8.mjs +359 -0
  132. package/dist/settings.schema.json +163 -16
  133. package/dist/{simslim-CCr3rE-A.mjs → simslim-Cgk17SXV.mjs} +14 -12
  134. package/dist/{slot-launch-DPt0m9Nd.mjs → slot-launch-DF8VfT64.mjs} +15 -20
  135. package/dist/{spawn-entry-Dcb7sDUz.mjs → spawn-entry-jw19m8Nl.mjs} +0 -1
  136. package/dist/stage-BIS0ydsV.mjs +183 -0
  137. package/dist/{start-BWqzODpb.mjs → start-7lpH7hmN.mjs} +63 -44
  138. package/dist/{start-TXeMmmO2.mjs → start-RChynRDp.mjs} +1 -1
  139. package/dist/{state-D1Icyjlu.mjs → state-C4ZtUisW.mjs} +40 -13
  140. package/dist/{state-CG_OFoaA.mjs → state-XMziexv2.mjs} +3 -2
  141. package/dist/{stats-BoY5sEPU.mjs → stats-53T7OTb9.mjs} +7 -13
  142. package/dist/stats-report-BFfMpWWF.mjs +16 -0
  143. package/dist/{status-WgFbkRzj.mjs → status-BL7jVyAB.mjs} +535 -447
  144. package/dist/status-CSi6tlRq.mjs +2 -0
  145. package/dist/{status-BTA7kKiQ.mjs → status-DqEUSSxs.mjs} +6 -4
  146. package/dist/{status-watch-C23ILtf9.mjs → status-watch-GDCfqpTE.mjs} +187 -22
  147. package/dist/status-worker.d.mts +1 -0
  148. package/dist/status-worker.mjs +19 -0
  149. package/dist/stim-desktop-C12we7lz.mjs +112 -0
  150. package/dist/{stop-DR6VoDIk.mjs → stop-Bk_1qiV6.mjs} +2 -2
  151. package/dist/{stop-BNmBMi1F.mjs → stop-CPzlM1L-.mjs} +138 -98
  152. package/dist/{stop-DPEhunlw.mjs → stop-D7h6jAXQ.mjs} +11 -10
  153. package/dist/supervisor-run.d.mts +8 -17
  154. package/dist/supervisor-run.mjs +63 -27
  155. package/dist/{support-DMTqj3Hm.mjs → support-67vraa1Q.mjs} +18 -11
  156. package/dist/{support-CwjbFs9H.mjs → support-Dlu37g6H.mjs} +12 -12
  157. package/dist/{swiftpm-macos-DRNVJWlb.mjs → swiftpm-macos-p8WZbxKU.mjs} +35 -24
  158. package/dist/toolchain-DhKwp9iI.mjs +2 -0
  159. package/dist/toolchain-Hp9sCpK4.mjs +873 -0
  160. package/dist/{trigger-CigAYjeL.mjs → trigger-BAahxUPq.mjs} +20 -5
  161. package/dist/trigger-Bf3uDcpv.mjs +2 -0
  162. package/dist/{warm-progress-BuY-Fvfn.mjs → warm-progress-BHX5r0Ei.mjs} +250 -156
  163. package/dist/{web-BDBMxDpx.mjs → web-CJmIj6AI.mjs} +18 -13
  164. package/dist/web-DknQETPs.mjs +2 -0
  165. package/dist/web-run.mjs +11 -12
  166. package/dist/windows-report.d.mts +1 -0
  167. package/dist/windows-report.mjs +18 -0
  168. package/dist/windows-report.ps1 +43 -0
  169. package/dist/workspace-process-lock-1_1OoVW5.mjs +57 -0
  170. package/dist/{workspace-state-DJt_MMvf.mjs → workspace-state-Cjuigeeu.mjs} +62 -58
  171. package/dist/{workspaces-C36s2jb9.mjs → workspaces-BccMFmGQ.mjs} +1188 -1079
  172. package/dist/worktree-CK2MpJW5.mjs +2 -0
  173. package/dist/{worktree-CgvJYJ-Q.mjs → worktree-DQ6Zi2Mv.mjs} +304 -53
  174. package/dist/xcode-Zlx3qjEs.mjs +896 -0
  175. package/package.json +7 -5
  176. package/shim/android-optimizations.gradle +7 -5
  177. package/dist/activity-BSV745Kz.mjs +0 -629
  178. package/dist/api-qvOzWyfO.mjs +0 -154
  179. package/dist/api-run.mjs +0 -294
  180. package/dist/app-install-BIKtMfPq.mjs +0 -896
  181. package/dist/artifact-lifecycle-DzPpBYvK.mjs +0 -30
  182. package/dist/budget-f7516Zk0.mjs +0 -4106
  183. package/dist/build-facts-DcLv2HSd.d.mts +0 -111
  184. package/dist/cancellation-C_22VQTH.mjs +0 -24
  185. package/dist/client-qQAaXSUs.mjs +0 -1771
  186. package/dist/config-BYDxlMY3.mjs +0 -562
  187. package/dist/device-DuiPJQSn.mjs +0 -290
  188. package/dist/device-lease-BX1sJQ2E.mjs +0 -1224
  189. package/dist/device-remote-xRT0Vmo9.mjs +0 -1272
  190. package/dist/eas-session-ledger-Cm0Gwq2F.mjs +0 -207
  191. package/dist/exec-DqKo9GKJ.mjs +0 -268
  192. package/dist/git-DDfFzkMm.mjs +0 -45
  193. package/dist/launch-verify-B6Q8hZP-.mjs +0 -428
  194. package/dist/logs-BGrEUaEs.mjs +0 -383
  195. package/dist/miss-reason-mKzZ4VvN.mjs +0 -238
  196. package/dist/native-android-D5qc3-_v.mjs +0 -226
  197. package/dist/ndjson-Du3j0AQ9.d.mts +0 -17
  198. package/dist/plan-C4TjdPsR.mjs +0 -260
  199. package/dist/prebuild-DYbucPXy.mjs +0 -212
  200. package/dist/preview-78a9kR_-.mjs +0 -1011
  201. package/dist/react-native-build-CtCccJtb.mjs +0 -239
  202. package/dist/react-native-doctor-CfRnFfjs.mjs +0 -78
  203. package/dist/remote-cache-OyOyVIS3.mjs +0 -526
  204. package/dist/result-CaJg5Iat.mjs +0 -186
  205. package/dist/server-expo-Bigriskl.mjs +0 -2
  206. package/dist/settings-BORNaaCO.mjs +0 -402
  207. package/dist/spawn-claims-DVS5RkMS.mjs +0 -72
  208. package/dist/stage-KNTQopqv.mjs +0 -157
  209. package/dist/stim-desktop-BzBN2Em2.mjs +0 -63
  210. package/dist/tailnet-Dh-qiYzG.mjs +0 -265
  211. package/dist/toolchain-BFkAcstd.mjs +0 -2
  212. package/dist/toolchain-DxSsNssu.mjs +0 -1657
  213. package/dist/trigger-9_USgmxz.mjs +0 -2
  214. package/dist/web-Dq-i3wzJ.mjs +0 -2
  215. package/dist/worktree-DpLdCHga.mjs +0 -2
  216. package/dist/{api-run.d.mts → doctor-fingerprint.d.mts} +0 -0
  217. package/dist/{errors-DzkMYh8Q.mjs → errors-ccaPc4ox.mjs} +2 -2
@@ -1,526 +0,0 @@
1
- import { t as getExecutor } from "./exec-DqKo9GKJ.mjs";
2
- import { w as workspaceLogsDir } from "./workspace-state-DJt_MMvf.mjs";
3
- import { n as stripAnsi } from "./process-output-Fpl8PYi8.mjs";
4
- import { S as resolvePackageJson } from "./project-_phNIJfs.mjs";
5
- import { r as createNdjsonWriter } from "./ndjson-GOnbyvso.mjs";
6
- import { n as expoBinFromPackage, r as expoBinPath, s as findBinUpward } from "./server-expo-DsguMGUF.mjs";
7
- import { createRequire } from "node:module";
8
- import { existsSync, readFileSync } from "node:fs";
9
- import { join } from "node:path";
10
- import { pathToFileURL } from "node:url";
11
- import { format } from "node:util";
12
- import { AsyncLocalStorage } from "node:async_hooks";
13
- //#region src/engine/remote-cache.ts
14
- const EAS_PROVIDER_PACKAGE = "eas-build-cache-provider";
15
- const RESOLVE_TIMEOUT_MS = 3e4;
16
- const UPLOAD_TIMEOUT_MS = 6e4;
17
- const CONFIG_TIMEOUT_MS = 3e4;
18
- const DYNAMIC_CONFIG_FILES = [
19
- "app.config.ts",
20
- "app.config.js",
21
- "app.config.mjs",
22
- "app.config.cjs"
23
- ];
24
- const TIMED_OUT = Symbol("timed-out");
25
- function dynamicConfigFile(root) {
26
- for (const name of DYNAMIC_CONFIG_FILES) if (existsSync(join(root, name))) return name;
27
- return null;
28
- }
29
- function providerFromConfig(config) {
30
- if (!config || typeof config !== "object") return null;
31
- const expoField = config.expo;
32
- const exp = expoField && typeof expoField === "object" ? expoField : config;
33
- return exp.buildCacheProvider ?? exp.experiments?.buildCacheProvider ?? null;
34
- }
35
- function ownerFromConfig(config) {
36
- if (!config || typeof config !== "object") return null;
37
- const expoField = config.expo;
38
- const owner = (expoField && typeof expoField === "object" ? expoField : config).owner;
39
- return typeof owner === "string" && owner.trim() !== "" ? owner.trim() : null;
40
- }
41
- function normalizeProvider(raw) {
42
- if (raw === null || raw === void 0 || raw === "") return null;
43
- if (raw === "eas") return {
44
- name: "eas",
45
- reference: EAS_PROVIDER_PACKAGE,
46
- options: {}
47
- };
48
- if (typeof raw === "object") {
49
- const obj = raw;
50
- if (typeof obj.plugin === "string" && obj.plugin.trim() !== "") {
51
- const reference = obj.plugin.trim();
52
- return {
53
- name: reference,
54
- reference,
55
- options: obj.options && typeof obj.options === "object" ? obj.options : {}
56
- };
57
- }
58
- }
59
- return { invalid: typeof raw === "string" ? `"${raw}"` : JSON.stringify(raw) };
60
- }
61
- function runOptionsFor(platform) {
62
- return platform === "android" ? { variant: "debug" } : { configuration: "Debug" };
63
- }
64
- function isProviderPlugin(plugin) {
65
- if (!plugin || typeof plugin !== "object") return false;
66
- const p = plugin;
67
- const resolves = typeof p.resolveBuildCache === "function" || typeof p.resolveRemoteBuildCache === "function";
68
- const uploads = typeof p.uploadBuildCache === "function" || typeof p.uploadRemoteBuildCache === "function";
69
- return resolves && uploads;
70
- }
71
- function cacheLevel(value) {
72
- return value === "local" || value === "remote" ? value : false;
73
- }
74
- function exitAfterFlush(code = 0, { exit = (c) => process.exit(c), stream = process.stdout } = {}) {
75
- try {
76
- stream.write("", () => exit(code));
77
- } catch {
78
- exit(code);
79
- }
80
- }
81
- function readProjectConfig(root, { run = null, timeoutMs = CONFIG_TIMEOUT_MS } = {}) {
82
- const dynamic = dynamicConfigFile(root);
83
- if (!dynamic) {
84
- const file = join(root, "app.json");
85
- if (!existsSync(file)) return {
86
- config: null,
87
- source: null
88
- };
89
- try {
90
- return {
91
- config: JSON.parse(readFileSync(file, "utf-8")),
92
- source: "app.json"
93
- };
94
- } catch (err) {
95
- return { unavailable: `app.json could not be parsed: ${firstLine(err)}` };
96
- }
97
- }
98
- const bin = expoBinPath(root);
99
- if (!bin) return { unavailable: `${dynamic} is code, so it has to be evaluated to read its buildCacheProvider, and the \`expo\` package is not resolvable from this project (no expo/package.json to read a bin from, and no node_modules/.bin/expo here or in any parent)` };
100
- const exec = run || ((file, args, opts) => getExecutor().runFile(file, args, opts));
101
- let stdout;
102
- try {
103
- stdout = exec(bin, [
104
- "config",
105
- "--json",
106
- root
107
- ], { timeoutMs });
108
- } catch (err) {
109
- return { unavailable: `\`expo config --json\` failed: ${firstLine(err)}` };
110
- }
111
- try {
112
- return {
113
- config: JSON.parse(String(stdout)),
114
- source: dynamic
115
- };
116
- } catch (err) {
117
- return { unavailable: `\`expo config --json\` did not print JSON: ${firstLine(err)}` };
118
- }
119
- }
120
- async function loadPlugin(projectRoot, reference, { requireFrom = null } = {}) {
121
- const localRequire = requireFrom ? requireFrom(projectRoot) : createRequire(join(projectRoot, "package.json"));
122
- const file = localRequire.resolve(reference);
123
- let mod;
124
- try {
125
- mod = localRequire(file);
126
- } catch (err) {
127
- if (err?.code !== "ERR_REQUIRE_ESM") throw err;
128
- mod = await import(pathToFileURL(file).href);
129
- }
130
- const plugin = mod?.default ?? mod;
131
- if (!isProviderPlugin(plugin)) throw new Error(`"${reference}" does not export resolveBuildCache and uploadBuildCache functions`);
132
- return plugin;
133
- }
134
- async function loadProjectProvider(projectRoot, { isExpo = true, run = null, requireFrom = null, timeoutMs = CONFIG_TIMEOUT_MS } = {}) {
135
- if (!isExpo) return { none: true };
136
- const read = readProjectConfig(projectRoot, {
137
- run,
138
- timeoutMs
139
- });
140
- if (read.unavailable) return { unavailable: read.unavailable };
141
- const normalized = normalizeProvider(providerFromConfig(read.config));
142
- if (!normalized) return { none: true };
143
- if (normalized.invalid) return { unavailable: `buildCacheProvider is ${normalized.invalid}, which is not "eas" or { plugin: <module> }` };
144
- if (normalized.reference === "@stim-cli/expo-build-cache") return { none: true };
145
- let plugin;
146
- try {
147
- plugin = await loadPlugin(projectRoot, normalized.reference, { requireFrom });
148
- } catch (err) {
149
- const missing = err?.code === "MODULE_NOT_FOUND";
150
- return { unavailable: normalized.name === "eas" && missing ? `the EAS build cache needs the \`${EAS_PROVIDER_PACKAGE}\` package, which is not installed in this project` : `${normalized.name} could not be loaded: ${firstLine(err)}` };
151
- }
152
- return {
153
- provider: {
154
- plugin,
155
- options: normalized.options ?? {}
156
- },
157
- name: normalized.name,
158
- owner: ownerFromConfig(read.config)
159
- };
160
- }
161
- const WHOAMI_TIMEOUT_MS = 15e3;
162
- const EAS_CLI_PACKAGE = "eas-cli";
163
- const EAS_CLI_BIN = "eas";
164
- function parseWhoami({ stdout = "", stderr = "", exitCode = 0 } = {}) {
165
- const out = stripAnsi(stdout);
166
- const combined = `${out}\n${stripAnsi(stderr)}`;
167
- if (/^\s*Not logged in\s*$/m.test(combined)) return { loggedOut: true };
168
- if (exitCode !== 0) return { unknown: firstLine(combined.trim() || `eas whoami exited ${exitCode}`) };
169
- const lines = out.split("\n").map((line) => line.trim()).filter((line) => line !== "");
170
- if (lines.length === 0) return { unknown: "eas whoami printed nothing" };
171
- const raw = lines[0];
172
- if (raw === void 0) return { unknown: "eas whoami printed nothing" };
173
- const viaToken = /\(authenticated using EXPO_TOKEN\)\s*$/.test(raw);
174
- const display = raw.replace(/\s*\(authenticated using EXPO_TOKEN\)\s*$/, "").trim();
175
- const accounts = [];
176
- for (const line of lines) {
177
- const name = /^\u2022\s*(\S+)\s*\(Role:/.exec(line)?.[1];
178
- if (name !== void 0) accounts.push(name);
179
- }
180
- if (accounts.length === 0 && !display.endsWith("(robot)") && display !== "robot") accounts.push(display);
181
- return {
182
- loggedIn: true,
183
- account: display,
184
- accounts: accounts.length ? accounts : null,
185
- viaToken
186
- };
187
- }
188
- function isEasAuthFailureText(text) {
189
- const t = stripAnsi(text || "");
190
- if (t.trim() === "") return false;
191
- return /not logged in/i.test(t) || /\beas login\b/i.test(t) || /EXPO_TOKEN/.test(t) || /unauthorized/i.test(t) || /not authorized/i.test(t) || /authentication (failed|required)/i.test(t);
192
- }
193
- function easAuthNote(status) {
194
- const { code, account, owner, reason, phase = "resolve" } = status || {};
195
- const because = reason ? ` (${reason})` : "";
196
- if (code === "logged-out") return `eas is not authenticated${because} -- run \`eas login\` (or set EXPO_TOKEN); ` + (phase === "upload" ? "this build stayed in the local cache" : "building with the local cache only");
197
- if (code === "wrong-account") return `eas is authenticated as ${account}, and this project's owner is ${owner} -- run \`eas login\` as a member of ${owner} (or set EXPO_TOKEN); consulting the EAS cache anyway`;
198
- return null;
199
- }
200
- function resolveEasCliBin(projectRoot, { lookupPath = null } = {}) {
201
- const fromPackage = expoBinFromPackage(resolvePackageJson(projectRoot, EAS_CLI_PACKAGE), EAS_CLI_BIN);
202
- if (fromPackage) return {
203
- file: fromPackage,
204
- source: "project"
205
- };
206
- const shim = findBinUpward(projectRoot, EAS_CLI_BIN);
207
- if (shim) return {
208
- file: shim,
209
- source: "project"
210
- };
211
- const onPath = lookupPath ? lookupPath() : getExecutor().findExecutable(EAS_CLI_BIN);
212
- const file = (String(onPath || "").split("\n")[0] ?? "").trim();
213
- return file ? {
214
- file,
215
- source: "path"
216
- } : null;
217
- }
218
- const easAuthCache = /* @__PURE__ */ new Map();
219
- function checkEasAuth({ projectRoot, owner = null, run = null, resolveBin = null, timeoutMs = WHOAMI_TIMEOUT_MS, cache = easAuthCache }) {
220
- const key = `${projectRoot}::${owner || ""}`;
221
- if (cache?.has(key)) return cache.get(key);
222
- const answer = probeEasAuth({
223
- projectRoot,
224
- owner,
225
- run,
226
- resolveBin,
227
- timeoutMs
228
- });
229
- cache?.set(key, answer);
230
- return answer;
231
- }
232
- function probeEasAuth({ projectRoot, owner, run, resolveBin, timeoutMs }) {
233
- const bin = (resolveBin || resolveEasCliBin)(projectRoot);
234
- if (!bin) return {
235
- failed: true,
236
- code: "no-cli",
237
- reason: "no `eas` executable is resolvable from this project or on PATH",
238
- remedy: "Install eas-cli (`npm i -g eas-cli`, or as a project devDependency), then run `eas login`."
239
- };
240
- const exec = run || ((file, args, opts) => getExecutor().runFile(file, args, opts));
241
- let result;
242
- try {
243
- result = {
244
- stdout: String(exec(bin.file, ["whoami"], { timeoutMs }) ?? ""),
245
- exitCode: 0
246
- };
247
- } catch (e) {
248
- const err = e;
249
- if (err?.code === "ETIMEDOUT" || err?.signal === "SIGTERM" || err?.killed) return { unknown: `eas whoami timed out after ${timeoutMs}ms` };
250
- result = {
251
- stdout: String(err?.stdout ?? ""),
252
- stderr: String(err?.stderr ?? err?.message ?? ""),
253
- exitCode: typeof err?.status === "number" ? err.status : 1
254
- };
255
- }
256
- const parsed = parseWhoami(result);
257
- if (parsed.loggedOut) return {
258
- failed: true,
259
- code: "logged-out",
260
- reason: "eas whoami says \"Not logged in\"",
261
- remedy: "Run `eas login` (or set EXPO_TOKEN)."
262
- };
263
- if (parsed.unknown) return { unknown: parsed.unknown };
264
- if (owner && Array.isArray(parsed.accounts) && !parsed.accounts.includes(owner)) return {
265
- failed: true,
266
- code: "wrong-account",
267
- account: parsed.account,
268
- accounts: parsed.accounts,
269
- owner,
270
- reason: `eas is authenticated as ${parsed.account} (accounts: ${parsed.accounts.join(", ")}), which does not include this project's owner ${owner}`,
271
- remedy: `Run \`eas login\` as a member of ${owner}, or set EXPO_TOKEN to a token for it.`
272
- };
273
- return {
274
- ok: true,
275
- account: parsed.account,
276
- accounts: parsed.accounts,
277
- viaToken: parsed.viaToken,
278
- source: bin.source
279
- };
280
- }
281
- const capturing = [];
282
- const abandoned = /* @__PURE__ */ new Set();
283
- let patched = null;
284
- const PROVIDER_CONTEXT = new AsyncLocalStorage();
285
- function uploadDestination(lines) {
286
- const text = (lines || []).map(stripAnsi);
287
- for (const line of text) {
288
- const url = /(https?:\/\/[^\s'"]+)/.exec(line)?.[1];
289
- if (url !== void 0) return url.replace(/[.,)\]]+$/, "");
290
- }
291
- for (const line of text) {
292
- const slug = /\bto\s+(@?[\w.-]+\/[\w.-]+)/i.exec(line)?.[1];
293
- if (slug !== void 0) return slug.replace(/[.,)\]]+$/, "");
294
- }
295
- return null;
296
- }
297
- function providerNote(text) {
298
- return `${"cache".padEnd(11)} ${text}`;
299
- }
300
- function currentFrame() {
301
- const store = PROVIDER_CONTEXT.getStore();
302
- return store && (capturing.includes(store) || abandoned.has(store)) ? store : null;
303
- }
304
- function install() {
305
- if (patched && process.stdout.write === patched.patchedWrite) return;
306
- const stdout = process.stdout;
307
- const write = stdout.write.bind(stdout);
308
- const log = console.log;
309
- const passthrough = write;
310
- const patchedWrite = ((chunk, encoding, callback) => {
311
- const frame = currentFrame();
312
- if (!frame) return passthrough(chunk, encoding, callback);
313
- const cb = typeof encoding === "function" ? encoding : callback;
314
- absorb(frame, typeof chunk === "string" ? chunk : String(chunk));
315
- if (typeof cb === "function") cb();
316
- return true;
317
- });
318
- const patchedLog = (...args) => {
319
- const frame = currentFrame();
320
- if (!frame) return log(...args);
321
- absorb(frame, `${format(...args)}\n`);
322
- };
323
- stdout.write = patchedWrite;
324
- console.log = patchedLog;
325
- patched = {
326
- stdout,
327
- write,
328
- log,
329
- patchedWrite,
330
- patchedLog
331
- };
332
- }
333
- function uninstall() {
334
- if (!patched || capturing.length || abandoned.size) return;
335
- if (patched.stdout.write === patched.patchedWrite) patched.stdout.write = patched.write;
336
- if (console.log === patched.patchedLog) console.log = patched.log;
337
- patched = null;
338
- }
339
- function absorb(frame, chunk) {
340
- try {
341
- process.stderr.write(chunk);
342
- } catch {}
343
- frame.pending += chunk;
344
- let index = frame.pending.indexOf("\n");
345
- while (index !== -1) {
346
- emitLine(frame, frame.pending.slice(0, index));
347
- frame.pending = frame.pending.slice(index + 1);
348
- index = frame.pending.indexOf("\n");
349
- }
350
- }
351
- function emitLine(frame, raw) {
352
- const line = stripAnsi(raw).trim();
353
- if (line === "") return;
354
- frame.lines.push(line);
355
- const writer = frame.writer();
356
- try {
357
- writer?.write({
358
- src: "build",
359
- level: "debug",
360
- event: "provider",
361
- msg: line
362
- });
363
- } catch {}
364
- frame.onLine?.(line);
365
- }
366
- function beginCapture({ logWriter = null, projectRoot = null, platform = null, onLine = null } = {}) {
367
- let own = null;
368
- const frame = {
369
- lines: [],
370
- pending: "",
371
- onLine,
372
- writer: () => {
373
- if (logWriter) return logWriter;
374
- if (own) return own;
375
- if (!projectRoot || !platform) return null;
376
- own = createNdjsonWriter(join(workspaceLogsDir(projectRoot), `build-${platform}.ndjson`));
377
- return own;
378
- },
379
- close: () => {
380
- own?.close?.();
381
- own = null;
382
- }
383
- };
384
- capturing.push(frame);
385
- install();
386
- return frame;
387
- }
388
- function endCapture(frame) {
389
- if (!frame) return;
390
- const at = capturing.lastIndexOf(frame);
391
- if (at !== -1) capturing.splice(at, 1);
392
- abandoned.delete(frame);
393
- if (frame.pending !== "") {
394
- const rest = frame.pending;
395
- frame.pending = "";
396
- emitLine(frame, rest);
397
- }
398
- frame.close();
399
- uninstall();
400
- }
401
- function abandonCapture(frame, work) {
402
- if (!frame) return;
403
- const at = capturing.lastIndexOf(frame);
404
- if (at !== -1) capturing.splice(at, 1);
405
- abandoned.add(frame);
406
- Promise.resolve(work).then(() => endCapture(frame), () => endCapture(frame));
407
- }
408
- async function resolveRemote({ provider, platform, projectRoot, fingerprintHash, runOptions = null, timeoutMs = RESOLVE_TIMEOUT_MS, logWriter = null } = {}) {
409
- if (!provider?.plugin || !fingerprintHash) return null;
410
- const opts = runOptions || runOptionsFor(platform);
411
- const outcome = await withBudget(async () => {
412
- const props = {
413
- fingerprintHash: await providerFingerprint({
414
- provider,
415
- platform,
416
- projectRoot,
417
- runOptions: opts
418
- }) ?? fingerprintHash,
419
- platform,
420
- runOptions: opts,
421
- projectRoot
422
- };
423
- return typeof provider.plugin.resolveBuildCache === "function" ? provider.plugin.resolveBuildCache(props, provider.options) : provider.plugin.resolveRemoteBuildCache(props, provider.options);
424
- }, timeoutMs, {
425
- logWriter,
426
- projectRoot,
427
- platform
428
- });
429
- if (outcome.timedOut) return { timedOut: true };
430
- if (outcome.error) return { failed: firstLine(outcome.error) };
431
- const appPath = typeof outcome.value === "string" ? outcome.value.trim() : "";
432
- if (!appPath) return null;
433
- if (!existsSync(appPath)) return { failed: `returned ${appPath}, which does not exist` };
434
- return { appPath };
435
- }
436
- async function uploadRemote({ provider, platform, projectRoot, fingerprintHash, buildPath, runOptions = null, timeoutMs = UPLOAD_TIMEOUT_MS, logWriter = null, note = (line) => console.error(line) } = {}) {
437
- if (!provider?.plugin || !fingerprintHash || !buildPath) return { skipped: true };
438
- const opts = runOptions || runOptionsFor(platform);
439
- let announced = false;
440
- const onLine = (line) => {
441
- if (announced) return;
442
- const dest = uploadDestination([line]);
443
- if (!dest) return;
444
- announced = true;
445
- note(providerNote(`uploading to ${dest}`));
446
- };
447
- const outcome = await withBudget(async () => {
448
- const props = {
449
- projectRoot,
450
- platform,
451
- fingerprintHash: await providerFingerprint({
452
- provider,
453
- platform,
454
- projectRoot,
455
- runOptions: opts
456
- }) ?? fingerprintHash,
457
- buildPath,
458
- runOptions: opts
459
- };
460
- return typeof provider.plugin.uploadBuildCache === "function" ? provider.plugin.uploadBuildCache(props, provider.options) : provider.plugin.uploadRemoteBuildCache(props, provider.options);
461
- }, timeoutMs, {
462
- logWriter,
463
- projectRoot,
464
- platform,
465
- onLine
466
- });
467
- if (outcome.timedOut) return { timedOut: true };
468
- if (outcome.error) return { failed: firstLine(outcome.error) };
469
- if (typeof outcome.value !== "string" || outcome.value.trim() === "") {
470
- const authLine = outcome.lines.find((line) => isEasAuthFailureText(line));
471
- return { failed: authLine ? firstLine(authLine) : "the provider returned no upload destination" };
472
- }
473
- const destination = uploadDestination(outcome.lines);
474
- return destination ? {
475
- uploaded: true,
476
- destination
477
- } : { uploaded: true };
478
- }
479
- async function providerFingerprint({ provider, platform, projectRoot, runOptions }) {
480
- if (typeof provider.plugin.calculateFingerprintHash !== "function") return null;
481
- try {
482
- const hash = await provider.plugin.calculateFingerprintHash({
483
- projectRoot,
484
- platform,
485
- runOptions
486
- }, provider.options);
487
- return typeof hash === "string" && hash.trim() !== "" ? hash.trim() : null;
488
- } catch {
489
- return null;
490
- }
491
- }
492
- async function withBudget(factory, ms, capture) {
493
- let timer = null;
494
- const timeout = new Promise((resolve) => {
495
- timer = setTimeout(() => resolve(TIMED_OUT), ms);
496
- timer?.unref?.();
497
- });
498
- const frame = beginCapture(capture || {});
499
- const work = Promise.resolve().then(() => PROVIDER_CONTEXT.run(frame, factory)).then((value) => ({ value }), (error) => ({ error }));
500
- try {
501
- const settled = await Promise.race([work, timeout]);
502
- if (settled === TIMED_OUT) {
503
- abandonCapture(frame, work);
504
- return {
505
- timedOut: true,
506
- lines: frame.lines
507
- };
508
- }
509
- endCapture(frame);
510
- return {
511
- ...settled,
512
- lines: frame.lines
513
- };
514
- } catch (err) {
515
- endCapture(frame);
516
- throw err;
517
- } finally {
518
- if (timer) clearTimeout(timer);
519
- }
520
- }
521
- function firstLine(err) {
522
- const line = (String(err?.message || err || "unknown error").trim().split("\n")[0] ?? "").trim();
523
- return line.length > 200 ? `${line.slice(0, 197)}...` : line;
524
- }
525
- //#endregion
526
- export { easAuthNote as a, loadProjectProvider as c, readProjectConfig as d, resolveEasCliBin as f, checkEasAuth as i, ownerFromConfig as l, uploadRemote as m, UPLOAD_TIMEOUT_MS as n, exitAfterFlush as o, resolveRemote as p, cacheLevel as r, isEasAuthFailureText as s, RESOLVE_TIMEOUT_MS as t, providerFromConfig as u };