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,157 +0,0 @@
1
- import { t as getExecutor } from "./exec-DqKo9GKJ.mjs";
2
- import { cpSync, existsSync, lstatSync, mkdirSync, readdirSync, realpathSync, rmSync, statSync } from "node:fs";
3
- import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
4
- import { validMacosResourceDestination } from "@stim-cli/core";
5
- //#region src/macos/stage.ts
6
- function validateInfoPlist(root, product, infoPlist) {
7
- const source = resolve(root, infoPlist);
8
- const inside = relative(realpathSync(root), realpathSync(source));
9
- if (!lstatSync(source).isFile() || inside === ".." || inside.startsWith(`..${sep}`) || isAbsolute(inside)) throw new Error("macos.infoPlist must be a regular file inside the project, not a symbolic link. See stim guide macos.");
10
- const plist = JSON.parse(getExecutor().runFile("plutil", [
11
- "-convert",
12
- "json",
13
- "-o",
14
- "-",
15
- source
16
- ], { timeoutMs: 1e4 }));
17
- if (typeof plist.CFBundleIdentifier !== "string" || plist.CFBundleExecutable !== product) throw new Error("macos.infoPlist must name a CFBundleIdentifier and the selected product as CFBundleExecutable.");
18
- if (plist.CFBundleURLTypes || plist.SUFeedURL) throw new Error("Use a development Info.plist without shared URL schemes or an update feed.");
19
- if (plist.LSMinimumSystemVersion !== void 0 && typeof plist.LSMinimumSystemVersion !== "string") throw new Error("macos.infoPlist LSMinimumSystemVersion must be a string. See stim guide macos.");
20
- return {
21
- bundleId: plist.CFBundleIdentifier,
22
- minimumSystemVersion: plist.LSMinimumSystemVersion
23
- };
24
- }
25
- function setBundleName(plistPath, name) {
26
- const exec = getExecutor();
27
- for (const key of ["CFBundleDisplayName", "CFBundleName"]) exec.runFile("plutil", [
28
- "-replace",
29
- key,
30
- "-string",
31
- name,
32
- plistPath
33
- ], { timeoutMs: 1e4 });
34
- }
35
- function resourceError(key, entry, reason) {
36
- throw new Error(`${key} entry ${JSON.stringify(entry)}: ${reason}. See stim guide macos.`);
37
- }
38
- function containsSymlink(dir) {
39
- return readdirSync(dir, { withFileTypes: true }).some((entry) => entry.isSymbolicLink() || entry.isDirectory() && containsSymlink(join(dir, entry.name)));
40
- }
41
- function overlaps(a, b) {
42
- a = a.normalize("NFC").toLowerCase();
43
- b = b.normalize("NFC").toLowerCase();
44
- return a === b || a.startsWith(`${b}/`) || b.startsWith(`${a}/`);
45
- }
46
- function resolveBundleExtras(root, repository, resources = {}, assetCatalog) {
47
- const boundary = realpathSync(repository);
48
- const sourcePath = (key, entry) => {
49
- if (typeof entry !== "string" || !entry || isAbsolute(entry) || entry.includes("\0")) resourceError(key, entry, "source must be a non-empty relative path");
50
- let source;
51
- try {
52
- source = realpathSync(resolve(root, entry));
53
- } catch {
54
- resourceError(key, entry, "source does not exist");
55
- }
56
- const path = relative(boundary, source);
57
- if (path === ".." || path.startsWith(`..${sep}`) || isAbsolute(path)) resourceError(key, entry, "source leaves the repository");
58
- if (path === "") resourceError(key, entry, "source is the repository root");
59
- const stat = statSync(source);
60
- if (!stat.isFile() && !stat.isDirectory()) resourceError(key, entry, "source must be a regular file or directory");
61
- if (stat.isDirectory() && containsSymlink(source)) resourceError(key, entry, "source directory contains a symbolic link");
62
- return source;
63
- };
64
- let catalog;
65
- if (assetCatalog !== void 0 && assetCatalog !== null) {
66
- catalog = sourcePath("macos.assetCatalog", assetCatalog);
67
- if (!catalog.endsWith(".xcassets") || !statSync(catalog).isDirectory()) resourceError("macos.assetCatalog", assetCatalog, "catalog must be a .xcassets directory");
68
- }
69
- if (!resources || typeof resources !== "object" || Array.isArray(resources)) resourceError("macos.resources", resources, "expected an object");
70
- const entries = Object.entries(resources);
71
- if (entries.length > 256) {
72
- const [destination, source] = entries[256];
73
- resourceError(`macos.resources[${JSON.stringify(destination)}]`, source, "at most 256 entries are allowed");
74
- }
75
- const reserved = catalog ? ["Assets.car"] : [];
76
- const resolved = [];
77
- for (const [destination, source] of entries) {
78
- const key = `macos.resources[${JSON.stringify(destination)}]`;
79
- if (!validMacosResourceDestination(destination)) resourceError(key, source, "invalid destination");
80
- if (reserved.some((other) => overlaps(destination, other))) resourceError(key, source, "destination collides with another resource");
81
- reserved.push(destination);
82
- resolved.push([destination, sourcePath(key, source)]);
83
- }
84
- return {
85
- resources: Object.fromEntries(resolved),
86
- assetCatalog: catalog
87
- };
88
- }
89
- function stageBundle(root, product, infoPlist, bin, bundle, bundleId, extras = { resources: {} }, displayName) {
90
- const { minimumSystemVersion } = validateInfoPlist(root, product, infoPlist);
91
- for (const entry of readdirSync(bin).filter((name) => name.endsWith(".bundle"))) for (const [destination, source] of Object.entries(extras.resources)) if (overlaps(destination, entry)) resourceError(`macos.resources[${JSON.stringify(destination)}]`, source, `destination collides with ${entry}`);
92
- const exec = getExecutor();
93
- rmSync(bundle, {
94
- recursive: true,
95
- force: true
96
- });
97
- const contents = join(bundle, "Contents");
98
- mkdirSync(join(contents, "MacOS"), { recursive: true });
99
- mkdirSync(join(contents, "Resources"), { recursive: true });
100
- mkdirSync(join(contents, "Frameworks"), { recursive: true });
101
- const executable = join(contents, "MacOS", product);
102
- cpSync(join(bin, product), executable);
103
- cpSync(resolve(root, infoPlist), join(contents, "Info.plist"));
104
- exec.runFile("/usr/libexec/PlistBuddy", [
105
- "-c",
106
- `Set :CFBundleIdentifier ${bundleId}`,
107
- join(contents, "Info.plist")
108
- ], { timeoutMs: 1e4 });
109
- if (displayName !== void 0) setBundleName(join(contents, "Info.plist"), displayName);
110
- for (const entry of readdirSync(bin)) if (entry.endsWith(".framework")) {
111
- const target = join(contents, "Frameworks", entry);
112
- cpSync(join(bin, entry), target, {
113
- recursive: true,
114
- dereference: false,
115
- verbatimSymlinks: true
116
- });
117
- exec.runFile("codesign", [
118
- "--force",
119
- "--sign",
120
- "-",
121
- target
122
- ], { timeoutMs: "unbounded" });
123
- } else if (entry.endsWith(".bundle")) cpSync(join(bin, entry), join(contents, "Resources", entry), { recursive: true });
124
- const frameworkPath = "@executable_path/../Frameworks";
125
- if (!exec.runFile("otool", ["-l", executable], { timeoutMs: 3e4 }).includes(frameworkPath)) exec.runFile("install_name_tool", [
126
- "-add_rpath",
127
- frameworkPath,
128
- executable
129
- ], { timeoutMs: 3e4 });
130
- for (const [destination, source] of Object.entries(extras.resources)) {
131
- const target = join(contents, "Resources", destination);
132
- mkdirSync(dirname(target), { recursive: true });
133
- cpSync(source, target, { recursive: true });
134
- }
135
- if (extras.assetCatalog) {
136
- exec.runFile("xcrun", [
137
- "actool",
138
- extras.assetCatalog,
139
- "--compile",
140
- join(contents, "Resources"),
141
- "--platform",
142
- "macosx",
143
- ...minimumSystemVersion === void 0 ? [] : ["--minimum-deployment-target", minimumSystemVersion],
144
- "--output-partial-info-plist",
145
- "/dev/null"
146
- ], { timeoutMs: "unbounded" });
147
- if (!existsSync(join(contents, "Resources", "Assets.car"))) resourceError("macos.assetCatalog", extras.assetCatalog, "actool did not produce Assets.car");
148
- }
149
- exec.runFile("codesign", [
150
- "--force",
151
- "--sign",
152
- "-",
153
- bundle
154
- ], { timeoutMs: "unbounded" });
155
- }
156
- //#endregion
157
- export { validateInfoPlist as i, setBundleName as n, stageBundle as r, resolveBundleExtras as t };
@@ -1,63 +0,0 @@
1
- import { t as getExecutor } from "./exec-DqKo9GKJ.mjs";
2
- //#region src/devices/stim-desktop.ts
3
- const LAUNCH_SERVICES_LOOKUP = `ObjC.import('AppKit'); const url = $.NSWorkspace.sharedWorkspace.URLForApplicationWithBundleIdentifier('dev.stim.desktop'); url.isNil() ? '' : url.path.js`;
4
- const SCHEME_HANDLER_LOOKUP = `ObjC.import('AppKit'); const url = $.NSWorkspace.sharedWorkspace.URLForApplicationToOpenURL($.NSURL.URLWithString('stim-desktop://workspace')); url.isNil() ? '' : url.path.js`;
5
- const STIM_DESKTOP_INSTALLED = "Stim Desktop installed";
6
- /**
7
- * macOS `open` passes its environment to an app it launches, so Stim Desktop
8
- * started by a command run under a scoped `STIM_HOME` would serve that home.
9
- */
10
- const STIM_DESKTOP_OPEN_OPTIONS = {
11
- timeoutMs: 5e3,
12
- killSignal: "SIGKILL",
13
- omitEnv: ["STIM_HOME"]
14
- };
15
- /** Stim Desktop sets `STIM_DESKTOP_APP` to its bundle path for every command it runs; a non-empty value means Desktop is installed. */
16
- function stimDesktopInstalled(platform = process.platform, env = process.env) {
17
- if (platform !== "darwin") return false;
18
- if (env.STIM_DESKTOP_APP) return true;
19
- return launchServicesFinds(LAUNCH_SERVICES_LOOKUP);
20
- }
21
- function launchServicesFinds(script) {
22
- return Boolean(getExecutor().runFileQuiet("osascript", [
23
- "-l",
24
- "JavaScript",
25
- "-e",
26
- script
27
- ], {
28
- timeoutMs: 5e3,
29
- killSignal: "SIGKILL"
30
- }));
31
- }
32
- function stimDesktopHandlesLinks(platform = process.platform, env = process.env) {
33
- if (platform !== "darwin") return false;
34
- if (env.STIM_DESKTOP_APP) return true;
35
- return launchServicesFinds(SCHEME_HANDLER_LOOKUP);
36
- }
37
- /**
38
- * The links that open this workspace for a human, or undefined when no app on this Mac handles
39
- * `stim-desktop://`. `target` names the device Stim Desktop focuses when the user opens the workspace.
40
- */
41
- function workspaceLinks(root, target, handlesLinks = stimDesktopHandlesLinks) {
42
- if (!handlesLinks()) return void 0;
43
- let desktop = `stim-desktop://workspace?path=${linkParam(root)}`;
44
- if (target) desktop += `&platform=${target.platform}`;
45
- if (target?.slot && target.slot !== "default") desktop += `&slot=${linkParam(target.slot)}`;
46
- return { desktop };
47
- }
48
- const linkParam = (value) => encodeURIComponent(value).replaceAll("%2F", "/");
49
- function workspaceLinkLine(links) {
50
- return `Open in Stim Desktop: ${links.desktop}`;
51
- }
52
- function settingDefault(setting, desktopInstalled = stimDesktopInstalled) {
53
- if (setting.desktopDefault !== void 0 && desktopInstalled()) return {
54
- value: setting.desktopDefault,
55
- reason: STIM_DESKTOP_INSTALLED
56
- };
57
- return {
58
- value: setting.default,
59
- reason: null
60
- };
61
- }
62
- //#endregion
63
- export { workspaceLinks as a, workspaceLinkLine as i, settingDefault as n, stimDesktopInstalled as r, STIM_DESKTOP_OPEN_OPTIONS as t };
@@ -1,265 +0,0 @@
1
- import { t as getExecutor } from "./exec-DqKo9GKJ.mjs";
2
- import { a as updateWorkspaceState, r as readWorkspaceState$1, t as clearWorkspaceStateKey, x as workspaceDir } from "./workspace-state-DJt_MMvf.mjs";
3
- import { a as formatElapsed } from "./command-output-BTy8hZ0F.mjs";
4
- import { i as signalDeclaredSpawns, r as refuseDeclaredSpawns, t as allowDeclaredSpawns } from "./spawn-claims-DVS5RkMS.mjs";
5
- import { a as withWorkspaceProcessLock } from "./named-ports-4WopRPg-.mjs";
6
- import { endpoint, findPeer as findPeer$1, isJsonObject, parseMachine, parseMachine as parseMachine$1, pinnedEndpoint } from "@stim-cli/core/state";
7
- import { WebSocket } from "ws";
8
- //#region src/engine/native-run.ts
9
- const NATIVE_RUN_LOCK = "native-run";
10
- const NATIVE_RUN_WAIT_MS = 18e5;
11
- const WAIT_HEARTBEAT_MS = 3e4;
12
- const CANCEL_REQUEST_KEY = "nativeRunCancel";
13
- function nativeRunHolder(holder) {
14
- const { command, platform, slot } = holder.details;
15
- return {
16
- command: typeof command === "string" ? command : null,
17
- platform: typeof platform === "string" ? platform : null,
18
- slot: typeof slot === "string" ? slot : "default"
19
- };
20
- }
21
- function describeNativeRunHolder(holder, now) {
22
- const { command, slot } = nativeRunHolder(holder);
23
- const started = Date.parse(holder.startedAt);
24
- const facts = [`pid ${holder.owner.pid}`];
25
- if (Number.isFinite(started)) facts.push(`running for ${formatElapsed(now - started)}`);
26
- if (command === null) return `another Stim run (${facts.join(", ")})`;
27
- if (command === "build") return `an artifact build (${facts.join(", ")})`;
28
- return `\`stim ${command}${slot === "default" ? "" : ` --slot ${slot}`}\` (${facts.join(", ")})`;
29
- }
30
- /**
31
- * Report a wait on the native-run lock: one line as soon as a holder is seen, a line for each new
32
- * holder, and a heartbeat every WAIT_HEARTBEAT_MS while the same holder keeps it.
33
- */
34
- function nativeRunWaitNotice({ write, now = Date.now, describe = describeNativeRunHolder }) {
35
- let claimId = null;
36
- let lastAt = 0;
37
- return (holder, firstLine) => {
38
- const at = now();
39
- if (holder.claimId !== claimId) {
40
- claimId = holder.claimId;
41
- lastAt = at;
42
- write(firstLine ?? `waiting for ${describe(holder, at)} in this workspace to finish`);
43
- return;
44
- }
45
- if (at - lastAt < WAIT_HEARTBEAT_MS) return;
46
- lastAt = at;
47
- write(`still waiting for ${describe(holder, at)}`);
48
- };
49
- }
50
- /**
51
- * What `stop` does about the run holding the native-run lock. A build is interrupted only when the stop
52
- * leaves it nothing to deploy to: the whole workspace stops, the build targets the stopped slot, or the
53
- * stopped slot is the workspace's only device. A build for another slot that stays is left running and
54
- * the stop proceeds without the lock. Only an owner whose identity is proven live is signalled.
55
- */
56
- function decideStopAction({ stopSlot, holder, ownerIdentity, deviceSlots }) {
57
- if (holder.command === "macos" || holder.command === "build") {
58
- if (stopSlot !== void 0) return { action: "proceed" };
59
- return ownerIdentity === "same" ? { action: "interrupt" } : { action: "refuse" };
60
- }
61
- if (holder.command !== "ios" && holder.command !== "android") return { action: "wait" };
62
- if (!(stopSlot === void 0 || holder.slot === stopSlot || deviceSlots.includes(stopSlot) && deviceSlots.every((slot) => slot === stopSlot))) return { action: "proceed" };
63
- return ownerIdentity === "same" ? { action: "interrupt" } : { action: "refuse" };
64
- }
65
- function requestNativeRunCancel(root, claimId, pid = process.pid) {
66
- updateWorkspaceState(root, (state) => ({
67
- ...state,
68
- [CANCEL_REQUEST_KEY]: {
69
- claimId,
70
- pid,
71
- at: (/* @__PURE__ */ new Date()).toISOString()
72
- }
73
- }));
74
- }
75
- function cancelRequestFor(root, claimId) {
76
- const request = readWorkspaceState$1(root)?.[CANCEL_REQUEST_KEY];
77
- if (request?.claimId !== claimId || typeof request.pid !== "number") return null;
78
- return { pid: request.pid };
79
- }
80
- function clearNativeRunCancel(root, claimId) {
81
- try {
82
- clearWorkspaceStateKey(root, CANCEL_REQUEST_KEY, (value) => value?.claimId === claimId);
83
- } catch {}
84
- }
85
- let cancelled = null;
86
- let cancellationSignal;
87
- /** The active native run aborts this signal when it is cancelled. */
88
- function runCancellationSignal() {
89
- return cancellationSignal;
90
- }
91
- /** Why this process's native run was cancelled, or null while it was not. */
92
- function runCancellation() {
93
- return cancelled;
94
- }
95
- function cancelledFailure(platform, { code, message }) {
96
- if (cancelled === null) return null;
97
- return {
98
- code: "STIM_CANCELLED",
99
- message: `The ${platform} run was ${cancelled} before it finished.`,
100
- remedy: `Run \`stim ${platform}\` again when you want the app on a device.`,
101
- lines: [`it stopped at ${code ?? "an unfinished step"}${message ? `: ${message}` : ""}`]
102
- };
103
- }
104
- function cancelOnInterrupt({ root, claim, write, exit, controller }) {
105
- let signals = 0;
106
- const onInterrupt = () => {
107
- signals += 1;
108
- if (signals > 1) {
109
- exit(130);
110
- return;
111
- }
112
- const request = cancelRequestFor(root, claim.claimId);
113
- cancelled = request ? `cancelled by \`stim stop\` (pid ${request.pid})` : "cancelled by an interrupt";
114
- controller.abort();
115
- refuseDeclaredSpawns(`the run was ${cancelled}`);
116
- const signalled = signalDeclaredSpawns("SIGINT");
117
- write(signalled > 0 ? `${cancelled}; stopping the running build tool` : request ? `${cancelled}; stopping before the next build tool or install` : cancelled);
118
- if (signalled === 0 && !request) exit(130);
119
- };
120
- process.on("SIGINT", onInterrupt);
121
- return () => {
122
- process.off("SIGINT", onInterrupt);
123
- allowDeclaredSpawns();
124
- clearNativeRunCancel(root, claim.claimId);
125
- };
126
- }
127
- /**
128
- * Run an `ios`, `android` or `macos` invocation under the workspace's native-run lock: the claim records the
129
- * command, platform and slot, and a wait for another holder is reported on `write`. The first SIGINT
130
- * forwards the interrupt to the running declared build tool; a run `stim stop` cancelled between build
131
- * tools starts no further one; a terminal interrupt with no build tool running, or a second SIGINT, exits
132
- * with 130 at once.
133
- */
134
- function withNativeBuildRun(root, details, fn, { write, exit = (code) => process.exit(code) }) {
135
- const notice = nativeRunWaitNotice({ write });
136
- return withWorkspaceProcessLock(workspaceDir(root), NATIVE_RUN_LOCK, async (claim) => {
137
- cancelled = null;
138
- const controller = new AbortController();
139
- cancellationSignal = controller.signal;
140
- const dispose = cancelOnInterrupt({
141
- root,
142
- claim,
143
- write,
144
- exit,
145
- controller
146
- });
147
- try {
148
- return await fn(claim);
149
- } finally {
150
- dispose();
151
- cancellationSignal = void 0;
152
- }
153
- }, {
154
- external: true,
155
- waitMs: NATIVE_RUN_WAIT_MS,
156
- declareSpawns: true,
157
- details: { ...details },
158
- onHeld: (holder) => notice(holder)
159
- });
160
- }
161
- //#endregion
162
- //#region src/offload/tailnet.ts
163
- const MAC_APP_TAILSCALE = "/Applications/Tailscale.app/Contents/MacOS/Tailscale";
164
- const HELLO_TIMEOUT_MS = 1e4;
165
- function isLapsed(credential) {
166
- return credential.state === "pending" && !!credential.expiresAt && Date.parse(credential.expiresAt) <= Date.now();
167
- }
168
- function markApproved(credential) {
169
- const { expiresAt: _expiresAt, ...rest } = credential;
170
- return {
171
- ...rest,
172
- state: "approved"
173
- };
174
- }
175
- function pendingReport(credential) {
176
- return {
177
- state: "pending",
178
- ...credential.expiresAt ? { expiresAt: credential.expiresAt } : {}
179
- };
180
- }
181
- function lapsedLine(machine, credential) {
182
- return `${machine} did not approve this Mac before the request lapsed at ${credential.expiresAt}.`;
183
- }
184
- function requestedLine(credential) {
185
- return `Requested at ${credential.requestedAt}${credential.expiresAt ? `; the request lapses at ${credential.expiresAt}` : ""}.`;
186
- }
187
- function parseTailscaleStatus(output) {
188
- try {
189
- const status = JSON.parse(output);
190
- return isJsonObject(status) && status.BackendState === "Running" ? status : null;
191
- } catch {
192
- return null;
193
- }
194
- }
195
- function tailscaleStatus() {
196
- for (const binary of ["tailscale", MAC_APP_TAILSCALE]) {
197
- const output = getExecutor().runFileQuiet(binary, ["status", "--json"], { timeoutMs: 5e3 });
198
- if (output !== null) return parseTailscaleStatus(output);
199
- }
200
- return null;
201
- }
202
- async function tailscaleStatusAsync() {
203
- for (const binary of ["tailscale", MAC_APP_TAILSCALE]) {
204
- let output;
205
- try {
206
- output = await getExecutor().runFileAsync(binary, ["status", "--json"], { timeoutMs: 5e3 });
207
- } catch {
208
- continue;
209
- }
210
- return parseTailscaleStatus(output);
211
- }
212
- return null;
213
- }
214
- function hello({ url, servername, host }, auth) {
215
- return new Promise((resolve) => {
216
- const socket = new WebSocket(url, {
217
- handshakeTimeout: HELLO_TIMEOUT_MS,
218
- servername,
219
- headers: { Host: host }
220
- });
221
- const done = (reply) => {
222
- clearTimeout(timer);
223
- socket.removeAllListeners();
224
- socket.on("error", () => {});
225
- socket.close();
226
- resolve(reply);
227
- };
228
- const timer = setTimeout(() => done({ failed: "no reply in time" }), HELLO_TIMEOUT_MS);
229
- socket.on("open", () => {
230
- socket.send(JSON.stringify({
231
- id: 1,
232
- method: "hello",
233
- params: {
234
- protocol: 1,
235
- client: {
236
- name: "stim",
237
- version: "1"
238
- },
239
- auth
240
- }
241
- }));
242
- });
243
- socket.on("message", (data) => {
244
- let message;
245
- try {
246
- message = JSON.parse(String(data));
247
- } catch {
248
- message = null;
249
- }
250
- if (isJsonObject(message) && ("result" in message || "error" in message)) return done(message);
251
- done({ failed: "the reply was not a hello result" });
252
- });
253
- socket.on("error", (error) => done({ failed: error.message }));
254
- socket.on("close", () => done({ failed: "the connection closed before a reply" }));
255
- });
256
- }
257
- const realIo = {
258
- status: tailscaleStatus,
259
- hello
260
- };
261
- async function pinnedEndpoint$1(credential, status = tailscaleStatusAsync) {
262
- return pinnedEndpoint(credential, parseMachine(credential.machine) ? await status() : null);
263
- }
264
- //#endregion
265
- export { withNativeBuildRun as S, nativeRunHolder as _, markApproved as a, runCancellation as b, pinnedEndpoint$1 as c, NATIVE_RUN_LOCK as d, NATIVE_RUN_WAIT_MS as f, describeNativeRunHolder as g, decideStopAction as h, lapsedLine as i, realIo as l, clearNativeRunCancel as m, findPeer$1 as n, parseMachine$1 as o, cancelledFailure as p, isLapsed as r, pendingReport as s, endpoint as t, requestedLine as u, nativeRunWaitNotice as v, runCancellationSignal as x, requestNativeRunCancel as y };
@@ -1,2 +0,0 @@
1
- import { s as macosToolchain } from "./toolchain-DxSsNssu.mjs";
2
- export { macosToolchain };