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.
- package/README.md +141 -8
- package/dist/acquire-artifact-Co2k4f7O.mjs +171 -0
- package/dist/act-DsuqEkiM.mjs +2801 -0
- package/dist/activity-CMLmzp7o.mjs +1397 -0
- package/dist/{agent-device-usage-output-Dzgv6lgR.mjs → agent-device-usage-output-DUFaTMdd.mjs} +23 -67
- package/dist/{android-DCKZrNvV.mjs → android-ByRMUoiJ.mjs} +157 -93
- package/dist/{android-Mz_Inn3w.mjs → android-C7sVmyI9.mjs} +299 -116
- package/dist/{android-Dlzxshgp.mjs → android-DGkNqa_c.mjs} +5 -5
- package/dist/{android-HqP1_vB_.mjs → android-DR5lZ2Az.mjs} +2 -2
- package/dist/android-cas-compiler.mjs +2 -2
- package/dist/{android-cas-Bl-cLJBk.mjs → android-cas-ngferVq2.mjs} +7 -6
- package/dist/android-project-BCAAmMwz.mjs +12 -0
- package/dist/android-project-DVWyCbWU.d.mts +391 -0
- package/dist/api.d.mts +810 -64
- package/dist/api.mjs +782 -1
- package/dist/{artifact-HSwkIWEQ.mjs → artifact-8EY8SAPw.mjs} +240 -213
- package/dist/{artifact-D3czlUvT.mjs → artifact-DJPy518Y.mjs} +203 -164
- package/dist/artifact-platform-CXcmX_j3.mjs +27 -0
- package/dist/{browser-web-CA-F1GQo.mjs → browser-web-Bcv99PBM.mjs} +194 -64
- package/dist/budget-Cvwn54qV.mjs +9285 -0
- package/dist/{build-DYDbfkk5.mjs → build-CabC3G23.mjs} +153 -98
- package/dist/build-cache-Dv7RN200.mjs +602 -0
- package/dist/build-plan-DUC8Ka9y.mjs +248 -0
- package/dist/{cache-manifest-XH-fvDUj.mjs → cache-manifest-DSeQjt-Q.mjs} +2 -2
- package/dist/cache-manifest.mjs +1 -1
- package/dist/{ccache-zdKiYQ3E.mjs → ccache-Btwc36-I.mjs} +10 -9
- package/dist/{cdp-Dq_ypAlJ.mjs → cdp-3fwICjzi.mjs} +18 -5
- package/dist/{chrome-BnzZMqsR.mjs → chrome-Bbw689-6.mjs} +7 -4
- package/dist/{cli-CLP3diBm.mjs → cli-CHZa9Lvk.mjs} +20 -20
- package/dist/cli.mjs +1 -1
- package/dist/client-OyRoEuSr.mjs +1577 -0
- package/dist/collector-run.d.mts +4 -40
- package/dist/collector-run.mjs +9 -8
- package/dist/{command-output-BTy8hZ0F.mjs → command-output-gwpm28fu.mjs} +1 -1
- package/dist/config-DlrsduwG.mjs +955 -0
- package/dist/{created-devices-Dzd5C2LF.mjs → created-devices-x9rN6bhs.mjs} +14 -4
- package/dist/{dependency-state-DG0p31-y.mjs → dependency-state-1I9KZT1Y.mjs} +20 -5
- package/dist/{detached-entry-B9C_zeQC.mjs → detached-entry-BwNEtIrP.mjs} +1 -1
- package/dist/{dev-client-DAWVIGBu.mjs → dev-client-BSDR5h3F.mjs} +2 -2
- package/dist/{device-BECOiufl.mjs → device-B-L3Fbxy.mjs} +91 -34
- package/dist/device-DklWZLqb.mjs +1068 -0
- package/dist/{device-capacity-CBUAcRyQ.mjs → device-capacity-DK5_EwRS.mjs} +42 -13
- package/dist/device-host-worker.mjs +76 -79
- package/dist/{device-ios-COSi6oS1.mjs → device-ios-DoB6KFCO.mjs} +77 -51
- package/dist/{device-lease-run-Cw2M4z51.mjs → device-lease-run-xJPQ_QQG.mjs} +14 -26
- package/dist/{device-pool-Bf-pOhSw.mjs → device-pool-BMkdsefq.mjs} +5 -5
- package/dist/{doctor-kfMBnUw6.mjs → doctor-Bo7BXLux.mjs} +271 -320
- package/dist/{doctor-CB8oZKCk.mjs → doctor-D5_EzwfA.mjs} +186 -91
- package/dist/doctor-fingerprint-DZLoYFVb.mjs +16 -0
- package/dist/doctor-fingerprint.mjs +19 -0
- package/dist/doctor-thjWAV0z.mjs +2 -0
- package/dist/{doctor-watchman-BRyV2adA.mjs → doctor-watchman-N2wDotwQ.mjs} +40 -21
- package/dist/{eas-build-JyfqyHfC.mjs → eas-build-CwknaQYj.mjs} +53 -20
- package/dist/{build-plan-B7SZsc2N.mjs → eas-fallback-CSgAulr5.mjs} +41 -214
- package/dist/{watchman-CPQFZLXY.mjs → eas-session-ledger-DlY_serQ.mjs} +230 -11
- package/dist/{error-diagnostics-BR677IDM.mjs → error-diagnostics-DBWO2rxE.mjs} +172 -82
- package/dist/exec-DEoAhcze.mjs +858 -0
- package/dist/exec-DnYc4HGH.d.mts +78 -0
- package/dist/{gc-qWOMdnER.mjs → gc-CXxN-4SE.mjs} +1091 -1029
- package/dist/gc-DnNDQyaP.mjs +3 -0
- package/dist/{guide-G9cAbVAc.mjs → guide-Br0LEfKy.mjs} +1165 -297
- package/dist/{hosted-android-C3MHGld1.mjs → hosted-android-B-9f-jkd.mjs} +10 -8
- package/dist/{hosted-client-ZEKpS9vw.mjs → hosted-client-DZAPrcro.mjs} +34 -19
- package/dist/{hosted-ios-l-o3iM9J.mjs → hosted-ios-CsCS21hn.mjs} +1 -1
- package/dist/{hosted-logs-EzQM7-3Z.mjs → hosted-logs-FIRx9X2f.mjs} +77 -43
- package/dist/{hosted-macos-BACVAVqE.mjs → hosted-macos-_awYSpfv.mjs} +35 -22
- package/dist/{hosted-native-A4s1QPXe.mjs → hosted-native-BdzE668-.mjs} +49 -27
- package/dist/idle-C4cZ757K.d.mts +24 -0
- package/dist/{idle-shutdown-DtxhPTKe.mjs → idle-shutdown-DDg3SdvY.mjs} +11 -10
- package/dist/ios-CDvlmUs7.d.mts +24 -0
- package/dist/{ios-BwVCF7oA.mjs → ios-Ds1clbIt.mjs} +8 -8
- package/dist/{ios-device-D7pi2Sca.mjs → ios-device--h_-8ENa.mjs} +51 -26
- package/dist/{ios-device-B5veSDDQ.mjs → ios-device-BXZ0c7Kb.mjs} +1 -1
- package/dist/{ios-RkW4pnQf.mjs → ios-hcBpnEGk.mjs} +200 -93
- package/dist/{ios-Ce7bc7br.mjs → ios-pm4nL6By.mjs} +160 -108
- package/dist/{ios-project-K9hY_Jab.mjs → ios-project-CZhKODF3.mjs} +13 -13
- package/dist/ios-signing-BtAffm0A.mjs +489 -0
- package/dist/{ios-state-CBLe1xYw.mjs → ios-state-Dtw5K2aI.mjs} +1 -1
- package/dist/{ios-nOLJGVdy.mjs → ios-xtlRHaeB.mjs} +1 -1
- package/dist/{js-swap-Bb3nsS07.mjs → js-swap-Bwhh4S7V.mjs} +30 -25
- package/dist/{launch-C3qJ6Agb.mjs → launch-BjxemNpK.mjs} +85 -543
- package/dist/{launch-F4sOqAhB.mjs → launch-CCzXlc8r.mjs} +91 -90
- package/dist/logs-BfwwadsZ.mjs +479 -0
- package/dist/logs-jTS_lHSo.mjs +248 -0
- package/dist/{macos-D7uDvO-z.mjs → macos-DVlSSyUg.mjs} +1 -1
- package/dist/macos-NfV2D7dO.mjs +694 -0
- package/dist/macos-run.mjs +1 -1
- package/dist/maintenance-run.mjs +123 -248
- package/dist/{metro-DnCEjCxs.mjs → metro-DiXtA3Ty.mjs} +107 -30
- package/dist/metro-gateway-CKZqKqx7.mjs +209 -0
- package/dist/{named-ports-4WopRPg-.mjs → named-ports-DkEzOfzO.mjs} +42 -90
- package/dist/native-android-CqgnOgsT.mjs +645 -0
- package/dist/native-gradle-artifact-inputs-DHFnmrVf.mjs +270 -0
- package/dist/native-gradle-inputs-Dnh84Zbd.mjs +211 -0
- package/dist/native-inputs-TRTTTRxt.mjs +91 -0
- package/dist/native-run-NwUuxbkg.mjs +276 -0
- package/dist/{native-runtime-k8dTIrbK.mjs → native-runtime-B7KIafpM.mjs} +11 -9
- package/dist/native-source-Y0yLhFyQ.mjs +133 -0
- package/dist/{native-xcode-inputs-CykopJdM.mjs → native-xcode-inputs-D_VOfFL7.mjs} +26 -18
- package/dist/{native-xcode-ios-Bbf30Gm0.mjs → native-xcode-ios-BYDOHWLN.mjs} +104 -60
- package/dist/{ndjson-GOnbyvso.mjs → ndjson-CgE_o3Dl.mjs} +3 -3
- package/dist/offload-worker.d.mts +59 -41
- package/dist/offload-worker.mjs +478 -115
- package/dist/operation-exec-BW0em61G.mjs +171 -0
- package/dist/{ownership-DCtw_2IA.mjs → ownership-C5fo5Edb.mjs} +3 -3
- package/dist/{page-DRHy329N.mjs → page-DBL2PiUU.mjs} +12 -5
- package/dist/paths-BsJMoPP2.mjs +12 -0
- package/dist/paths-DQtTgsBf.mjs +42 -0
- package/dist/{placement-log-MOfPVgaM.mjs → placement-log-BnGgJRRZ.mjs} +5 -5
- package/dist/{plan-placement-V0TdzYXp.mjs → plan-placement-DIsMtN-d.mjs} +15 -11
- package/dist/{ports-DdSUicVo.mjs → ports-Cy1RkmuQ.mjs} +3 -3
- package/dist/prebuild-D4JoEAEs.mjs +484 -0
- package/dist/{project-_phNIJfs.mjs → project-wM_XFTvE.mjs} +65 -37
- package/dist/{pull-request-CQ8sPbZa.mjs → pull-request-W1IuLXDt.mjs} +102 -20
- package/dist/pull-request-eODyIqZF.d.mts +124 -0
- package/dist/pull-requests.d.mts +2 -120
- package/dist/pull-requests.mjs +2 -2
- package/dist/{react-native-android-CM1XRDwv.mjs → react-native-android-6OZ7MSM7.mjs} +121 -72
- package/dist/{gradle-DSrXb6lG.mjs → react-native-build-Dvd8hC21.mjs} +292 -15
- package/dist/react-native-doctor-DsoSF1Y9.mjs +234 -0
- package/dist/{react-native-ios-Dhq_eiYQ.mjs → react-native-ios-4u1Rn-GR.mjs} +71 -39
- package/dist/{recordings-D0d5aQt0.mjs → recordings-CQmfzAh7.mjs} +12 -9
- package/dist/registration-BcRgF6Ox.mjs +51 -0
- package/dist/{reload-C8JhxjSh.mjs → reload-BzkYabB-.mjs} +94 -47
- package/dist/reload-D7AVlb8N.mjs +2 -0
- package/dist/{remote-BiR6aYjy.mjs → remote-DjGDmlTZ.mjs} +26 -18
- package/dist/result-D2Ykz_iD.mjs +435 -0
- package/dist/{run-BtPgpKks.mjs → run-DidHghD1.mjs} +5 -5
- package/dist/selection-DSMbWEX2.mjs +620 -0
- package/dist/{server-bare-R2m_gsH8.mjs → server-bare-CafzuyFB.mjs} +3 -4
- package/dist/{server-command-CTtCkmcQ.mjs → server-command-C6QjeupS.mjs} +14 -7
- package/dist/{server-expo-DsguMGUF.mjs → server-expo-CrjB29pq.mjs} +54 -11
- package/dist/server-expo-D58c9L0M.mjs +2 -0
- package/dist/{settings-B717odTD.mjs → settings-C7O8A6ZI.mjs} +309 -119
- package/dist/settings-DpR-1Wnn.mjs +114 -0
- package/dist/settings-write-CzD60rOD.mjs +360 -0
- package/dist/settings.schema.json +176 -16
- package/dist/{simslim-CCr3rE-A.mjs → simslim-BNckWpXi.mjs} +14 -12
- package/dist/{slot-launch-DPt0m9Nd.mjs → slot-launch-CbfmNgM6.mjs} +15 -20
- package/dist/{spawn-entry-Dcb7sDUz.mjs → spawn-entry-jw19m8Nl.mjs} +0 -1
- package/dist/stage-Bps5oius.mjs +200 -0
- package/dist/{start-TXeMmmO2.mjs → start-Br-oxqMD.mjs} +1 -1
- package/dist/start-EojN4WFz.mjs +1364 -0
- package/dist/{state-D1Icyjlu.mjs → state--smjFSTL.mjs} +55 -13
- package/dist/{state-CG_OFoaA.mjs → state-08I3hw3_.mjs} +3 -2
- package/dist/{stats-BoY5sEPU.mjs → stats-D3GerlFW.mjs} +7 -13
- package/dist/stats-report-BzaPrRm6.mjs +16 -0
- package/dist/{status-BTA7kKiQ.mjs → status-BRROykC8.mjs} +7 -5
- package/dist/status-EvrK72L2.mjs +2 -0
- package/dist/{status-WgFbkRzj.mjs → status-WBDajew2.mjs} +554 -452
- package/dist/{status-watch-C23ILtf9.mjs → status-watch-Bg_u-pwR.mjs} +222 -25
- package/dist/status-worker.d.mts +1 -0
- package/dist/status-worker.mjs +19 -0
- package/dist/stim-desktop-D5OGpYZM.mjs +112 -0
- package/dist/{stop-DR6VoDIk.mjs → stop-DTZ9uTw3.mjs} +2 -2
- package/dist/{stop-DPEhunlw.mjs → stop-Dky10AEJ.mjs} +33 -23
- package/dist/{stop-BNmBMi1F.mjs → stop-Mv6W9FAk.mjs} +137 -98
- package/dist/supervisor-run.d.mts +8 -17
- package/dist/supervisor-run.mjs +56 -28
- package/dist/{support-CwjbFs9H.mjs → support-CNioewsd.mjs} +14 -14
- package/dist/{support-DMTqj3Hm.mjs → support-yUiOjnVY.mjs} +20 -13
- package/dist/swiftpm-artifact-inputs-DFcGsXDP.mjs +153 -0
- package/dist/swiftpm-macos-BIak-Rxv.mjs +532 -0
- package/dist/toolchain-BY8X8HXx.mjs +2 -0
- package/dist/toolchain-DpJMHq0n.mjs +876 -0
- package/dist/{trigger-CigAYjeL.mjs → trigger-Cbyc41d_.mjs} +21 -6
- package/dist/trigger-yb_nFzPF.mjs +2 -0
- package/dist/{warm-progress-BuY-Fvfn.mjs → warm-progress-CA3TgT3-.mjs} +263 -156
- package/dist/web-CZ07gd77.mjs +2 -0
- package/dist/{web-BDBMxDpx.mjs → web-DKx6yoFA.mjs} +20 -14
- package/dist/web-run.mjs +13 -12
- package/dist/windows-report.d.mts +1 -0
- package/dist/windows-report.mjs +18 -0
- package/dist/windows-report.ps1 +43 -0
- package/dist/{workspace-state-DJt_MMvf.mjs → workspace-state-U08dEzhG.mjs} +62 -58
- package/dist/{workspaces-C36s2jb9.mjs → workspaces-CpANmBlq.mjs} +1723 -1286
- package/dist/{worktree-CgvJYJ-Q.mjs → worktree-CHecZ4Oq.mjs} +1097 -547
- package/dist/worktree-ZqZVjD9K.mjs +2 -0
- package/dist/xcode-BXn9-xYx.mjs +896 -0
- package/package.json +7 -5
- package/shim/android-audio/Main.java +24 -0
- package/shim/android-audio/README.md +17 -0
- package/shim/android-audio.jar +0 -0
- package/shim/android-optimizations.gradle +7 -5
- package/dist/activity-BSV745Kz.mjs +0 -629
- package/dist/api-qvOzWyfO.mjs +0 -154
- package/dist/api-run.mjs +0 -294
- package/dist/app-install-BIKtMfPq.mjs +0 -896
- package/dist/artifact-lifecycle-DzPpBYvK.mjs +0 -30
- package/dist/budget-f7516Zk0.mjs +0 -4106
- package/dist/build-facts-DcLv2HSd.d.mts +0 -111
- package/dist/cancellation-C_22VQTH.mjs +0 -24
- package/dist/client-qQAaXSUs.mjs +0 -1771
- package/dist/config-BYDxlMY3.mjs +0 -562
- package/dist/device-DuiPJQSn.mjs +0 -290
- package/dist/device-lease-BX1sJQ2E.mjs +0 -1224
- package/dist/device-remote-xRT0Vmo9.mjs +0 -1272
- package/dist/eas-session-ledger-Cm0Gwq2F.mjs +0 -207
- package/dist/exec-DqKo9GKJ.mjs +0 -268
- package/dist/git-DDfFzkMm.mjs +0 -45
- package/dist/launch-verify-B6Q8hZP-.mjs +0 -428
- package/dist/logs-BGrEUaEs.mjs +0 -383
- package/dist/macos-Ch5VJmcS.mjs +0 -584
- package/dist/metro-gateway-CX9Xlkq2.mjs +0 -103
- package/dist/miss-reason-mKzZ4VvN.mjs +0 -238
- package/dist/native-android-D5qc3-_v.mjs +0 -226
- package/dist/native-gradle-inputs-BsLRrl7u.mjs +0 -349
- package/dist/ndjson-Du3j0AQ9.d.mts +0 -17
- package/dist/plan-C4TjdPsR.mjs +0 -260
- package/dist/prebuild-DYbucPXy.mjs +0 -212
- package/dist/preview-78a9kR_-.mjs +0 -1011
- package/dist/react-native-build-CtCccJtb.mjs +0 -239
- package/dist/react-native-doctor-CfRnFfjs.mjs +0 -78
- package/dist/remote-cache-OyOyVIS3.mjs +0 -526
- package/dist/result-CaJg5Iat.mjs +0 -186
- package/dist/server-expo-Bigriskl.mjs +0 -2
- package/dist/settings-BORNaaCO.mjs +0 -402
- package/dist/settings-vk3mJGSm.d.mts +0 -13
- package/dist/spawn-claims-DVS5RkMS.mjs +0 -72
- package/dist/stage-KNTQopqv.mjs +0 -157
- package/dist/start-BWqzODpb.mjs +0 -1116
- package/dist/stim-desktop-BzBN2Em2.mjs +0 -63
- package/dist/swiftpm-macos-DRNVJWlb.mjs +0 -119
- package/dist/tailnet-Dh-qiYzG.mjs +0 -265
- package/dist/toolchain-BFkAcstd.mjs +0 -2
- package/dist/toolchain-DxSsNssu.mjs +0 -1657
- package/dist/trigger-9_USgmxz.mjs +0 -2
- package/dist/web-Dq-i3wzJ.mjs +0 -2
- package/dist/worktree-DpLdCHga.mjs +0 -2
- package/dist/{api-run.d.mts → doctor-fingerprint.d.mts} +0 -0
- package/dist/{errors-DzkMYh8Q.mjs → errors-ccaPc4ox.mjs} +2 -2
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
import { d as spawnDeclared, t as getExecutor } from "./exec-DEoAhcze.mjs";
|
|
2
|
+
import { i as sharedBuildCache } from "./paths-DQtTgsBf.mjs";
|
|
3
|
+
import { n as stripAnsi, r as waitForChild, t as createLineReader } from "./process-output-Fpl8PYi8.mjs";
|
|
4
|
+
import { o as git, s as gitAsync } from "./operation-exec-BW0em61G.mjs";
|
|
5
|
+
import { o as updateWorkspaceState, r as readWorkspaceState$1 } from "./workspace-state-U08dEzhG.mjs";
|
|
6
|
+
import { yt as gitCommonDirOnDisk } from "./settings-C7O8A6ZI.mjs";
|
|
7
|
+
import { v as detectIsExpo } from "./project-wM_XFTvE.mjs";
|
|
8
|
+
import { Zn as remoteCliInvocation } from "./budget-Cvwn54qV.mjs";
|
|
9
|
+
import { a as diffFingerprintSources, v as storedSources } from "./build-cache-Dv7RN200.mjs";
|
|
10
|
+
import { i as expoBinRefusal, r as expoBinPath } from "./server-expo-CrjB29pq.mjs";
|
|
11
|
+
import { existsSync, realpathSync } from "node:fs";
|
|
12
|
+
import { dirname, join, relative } from "node:path";
|
|
13
|
+
import { ambientContext } from "@stim-cli/core";
|
|
14
|
+
import { LAST_BUILD_KEYS, loadConfig, readWorkspaceState } from "@stim-cli/core/state";
|
|
15
|
+
import * as expoFingerprint from "@expo/fingerprint";
|
|
16
|
+
//#region src/cache/miss-reason.ts
|
|
17
|
+
const MISS_CHANGE_CAP = 20;
|
|
18
|
+
function recordedBuilds(state, platform) {
|
|
19
|
+
const builds = [];
|
|
20
|
+
for (const value of [state?.[LAST_BUILD_KEYS[platform]], state?.lastBuild]) {
|
|
21
|
+
const record = value;
|
|
22
|
+
if (record?.platform !== platform) continue;
|
|
23
|
+
const startedAt = typeof record.startedAt === "string" ? record.startedAt : "";
|
|
24
|
+
if (typeof record.fingerprint === "string" && typeof record.cacheKey === "string") builds.push({
|
|
25
|
+
fingerprint: record.fingerprint,
|
|
26
|
+
cacheKey: record.cacheKey,
|
|
27
|
+
startedAt
|
|
28
|
+
});
|
|
29
|
+
const carried = record.missReason?.baseline;
|
|
30
|
+
if (typeof carried?.fingerprint === "string" && typeof carried.cacheKey === "string") builds.push({
|
|
31
|
+
fingerprint: carried.fingerprint,
|
|
32
|
+
cacheKey: carried.cacheKey,
|
|
33
|
+
startedAt
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return builds;
|
|
37
|
+
}
|
|
38
|
+
function projectIdentity(root) {
|
|
39
|
+
let real;
|
|
40
|
+
try {
|
|
41
|
+
real = realpathSync.native(root);
|
|
42
|
+
} catch {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
for (let dir = real;; dir = dirname(dir)) {
|
|
46
|
+
if (existsSync(join(dir, ".git"))) {
|
|
47
|
+
const common = gitCommonDirOnDisk(dir);
|
|
48
|
+
return common ? `${common}\n${relative(dir, real)}` : null;
|
|
49
|
+
}
|
|
50
|
+
if (dirname(dir) === dir) return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function findMissBaseline(root, platform, { readState = readWorkspaceState, projectRoots = () => Object.keys(loadConfig()?.projects ?? {}), identity = projectIdentity, sourcesOf = (p, key) => storedSources(p, key, sharedBuildCache()) } = {}) {
|
|
54
|
+
for (const build of recordedBuilds(readState(root), platform)) {
|
|
55
|
+
const sources = sourcesOf(platform, build.cacheKey);
|
|
56
|
+
if (sources) return {
|
|
57
|
+
fingerprint: build.fingerprint,
|
|
58
|
+
cacheKey: build.cacheKey,
|
|
59
|
+
sources,
|
|
60
|
+
from: "workspace"
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const project = identity(root);
|
|
64
|
+
if (!project) return null;
|
|
65
|
+
const others = [];
|
|
66
|
+
for (const other of projectRoots()) {
|
|
67
|
+
if (other === root || identity(other) !== project) continue;
|
|
68
|
+
others.push(...recordedBuilds(readState(other), platform));
|
|
69
|
+
}
|
|
70
|
+
for (const build of others.toSorted((a, b) => (Date.parse(b.startedAt) || 0) - (Date.parse(a.startedAt) || 0))) {
|
|
71
|
+
const sources = sourcesOf(platform, build.cacheKey);
|
|
72
|
+
if (sources) return {
|
|
73
|
+
fingerprint: build.fingerprint,
|
|
74
|
+
cacheKey: build.cacheKey,
|
|
75
|
+
sources,
|
|
76
|
+
from: "project"
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
const CATEGORY_RANK = {
|
|
82
|
+
"native-dependency": 0,
|
|
83
|
+
"app-config": 1,
|
|
84
|
+
"config-plugin": 2,
|
|
85
|
+
package: 3,
|
|
86
|
+
"native-dir": 4,
|
|
87
|
+
file: 5,
|
|
88
|
+
"app-asset": 6,
|
|
89
|
+
other: 7,
|
|
90
|
+
"package-scripts": 8,
|
|
91
|
+
autolinking: 9
|
|
92
|
+
};
|
|
93
|
+
function packageIn(path) {
|
|
94
|
+
return [...path.matchAll(/(?:^|\/)node_modules\/((?:@[^/]+\/)?[^/]+)/g)].at(-1)?.[1] ?? null;
|
|
95
|
+
}
|
|
96
|
+
function describeChange({ name, change, reasons }) {
|
|
97
|
+
const pkg = packageIn(name);
|
|
98
|
+
if (name === "expoConfig" || reasons.includes("expoConfig")) return {
|
|
99
|
+
category: "app-config",
|
|
100
|
+
label: "app config changed"
|
|
101
|
+
};
|
|
102
|
+
if (pkg && reasons.some((reason) => /^(expo|rncore)Autolinking(Ios|Android)?$/.test(reason))) return {
|
|
103
|
+
category: "native-dependency",
|
|
104
|
+
label: `native dependency ${change}: ${pkg}`
|
|
105
|
+
};
|
|
106
|
+
if (pkg && reasons.includes("expoConfigPlugins")) return {
|
|
107
|
+
category: "config-plugin",
|
|
108
|
+
label: `config plugin ${change}: ${pkg}`
|
|
109
|
+
};
|
|
110
|
+
if (/^(expoAutolinkingConfig|rncoreAutolinkingConfig)(:|$)/.test(name)) return {
|
|
111
|
+
category: "autolinking",
|
|
112
|
+
label: "autolinking config changed"
|
|
113
|
+
};
|
|
114
|
+
if (name.startsWith("package:")) return {
|
|
115
|
+
category: "package",
|
|
116
|
+
label: `${name.slice(8)} ${change}`
|
|
117
|
+
};
|
|
118
|
+
if (name === "packageJson:scripts") return {
|
|
119
|
+
category: "package-scripts",
|
|
120
|
+
label: "package.json scripts changed"
|
|
121
|
+
};
|
|
122
|
+
if (reasons.includes("expoConfigExternalFile")) return {
|
|
123
|
+
category: "app-asset",
|
|
124
|
+
label: `app asset ${change}: ${name}`
|
|
125
|
+
};
|
|
126
|
+
if (reasons.includes("bareNativeDir")) return {
|
|
127
|
+
category: "native-dir",
|
|
128
|
+
label: `${name}/ ${change}`
|
|
129
|
+
};
|
|
130
|
+
if (reasons.length || name.includes("/") || name.includes(".")) return {
|
|
131
|
+
category: "file",
|
|
132
|
+
label: `${name} ${change}`
|
|
133
|
+
};
|
|
134
|
+
return {
|
|
135
|
+
category: "other",
|
|
136
|
+
label: `${name} ${change}`
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function rekeyPrefix(rekeyedBy) {
|
|
140
|
+
return rekeyedBy.length ? `${rekeyedBy.join(" and ")} changed native inputs; ` : "";
|
|
141
|
+
}
|
|
142
|
+
function missReasonFromChanges({ changes, baseline, rekeyedBy = [] }) {
|
|
143
|
+
const prefix = rekeyPrefix(rekeyedBy);
|
|
144
|
+
if (!baseline) return {
|
|
145
|
+
kind: "no-baseline",
|
|
146
|
+
summary: `${prefix}no earlier build of this project in the cache to compare with`,
|
|
147
|
+
changes: [],
|
|
148
|
+
changeCount: 0,
|
|
149
|
+
baseline: null,
|
|
150
|
+
rekeyedBy
|
|
151
|
+
};
|
|
152
|
+
if (!changes.length) return {
|
|
153
|
+
kind: "same-sources",
|
|
154
|
+
summary: `${prefix}native inputs match the last build; no cached app for this configuration or target`,
|
|
155
|
+
changes: [],
|
|
156
|
+
changeCount: 0,
|
|
157
|
+
baseline,
|
|
158
|
+
rekeyedBy
|
|
159
|
+
};
|
|
160
|
+
const described = changes.map((change, index) => ({
|
|
161
|
+
change,
|
|
162
|
+
index,
|
|
163
|
+
...describeChange(change)
|
|
164
|
+
})).toSorted((a, b) => CATEGORY_RANK[a.category] - CATEGORY_RANK[b.category] || a.index - b.index);
|
|
165
|
+
const dependencyMoved = described.some((entry) => entry.category === "native-dependency");
|
|
166
|
+
const labels = [...new Set(described.filter((entry) => !(dependencyMoved && entry.category === "autolinking")).map((entry) => entry.label))];
|
|
167
|
+
const more = labels.length > 1 ? ` (+${labels.length - 1} more)` : "";
|
|
168
|
+
return {
|
|
169
|
+
kind: "changed",
|
|
170
|
+
summary: `${prefix}${labels[0]}${more}`,
|
|
171
|
+
changes: described.slice(0, MISS_CHANGE_CAP).map(({ change, category }) => ({
|
|
172
|
+
source: change.name,
|
|
173
|
+
change: change.change,
|
|
174
|
+
category
|
|
175
|
+
})),
|
|
176
|
+
changeCount: changes.length,
|
|
177
|
+
baseline,
|
|
178
|
+
rekeyedBy
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
function explainBuildMiss({ root, platform, current, rekeyedBy = [], baselineDeps, differ = expoFingerprint.diffFingerprints }) {
|
|
182
|
+
const baseline = findMissBaseline(root, platform, baselineDeps);
|
|
183
|
+
const changes = baseline ? diffFingerprintSources({
|
|
184
|
+
previous: baseline.sources,
|
|
185
|
+
previousHash: baseline.fingerprint,
|
|
186
|
+
current,
|
|
187
|
+
differ
|
|
188
|
+
}) : [];
|
|
189
|
+
return {
|
|
190
|
+
reason: missReasonFromChanges({
|
|
191
|
+
changes,
|
|
192
|
+
baseline: baseline ? {
|
|
193
|
+
fingerprint: baseline.fingerprint,
|
|
194
|
+
cacheKey: baseline.cacheKey,
|
|
195
|
+
from: baseline.from
|
|
196
|
+
} : null,
|
|
197
|
+
rekeyedBy
|
|
198
|
+
}),
|
|
199
|
+
changedNames: changes.map((change) => change.name),
|
|
200
|
+
previousHash: baseline?.fingerprint ?? null
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
function predictBuildMiss({ root, platform, current, prebuild }) {
|
|
204
|
+
const { reason } = explainBuildMiss({
|
|
205
|
+
root,
|
|
206
|
+
platform,
|
|
207
|
+
current
|
|
208
|
+
});
|
|
209
|
+
const baseline = reason.baseline && {
|
|
210
|
+
fingerprint: reason.baseline.fingerprint,
|
|
211
|
+
from: reason.baseline.from
|
|
212
|
+
};
|
|
213
|
+
if (!prebuild || !baseline) return {
|
|
214
|
+
...reason,
|
|
215
|
+
baseline
|
|
216
|
+
};
|
|
217
|
+
const dir = platform === "ios" ? "ios/" : "android/";
|
|
218
|
+
return {
|
|
219
|
+
...reason,
|
|
220
|
+
kind: "prebuild-pending",
|
|
221
|
+
summary: `${reason.summary} (before prebuild ${prebuild}s ${dir})`,
|
|
222
|
+
baseline
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
function skippedMissReason(summary) {
|
|
226
|
+
return {
|
|
227
|
+
kind: "cache-skipped",
|
|
228
|
+
summary,
|
|
229
|
+
changes: [],
|
|
230
|
+
changeCount: 0,
|
|
231
|
+
baseline: null,
|
|
232
|
+
rekeyedBy: []
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
function fingerprintErrorMissReason(message) {
|
|
236
|
+
return {
|
|
237
|
+
kind: "fingerprint-error",
|
|
238
|
+
summary: `fingerprinting failed: ${message}`,
|
|
239
|
+
changes: [],
|
|
240
|
+
changeCount: 0,
|
|
241
|
+
baseline: null,
|
|
242
|
+
rekeyedBy: []
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
//#endregion
|
|
246
|
+
//#region src/engine/prebuild.ts
|
|
247
|
+
const PREBUILD_ERROR = "STIM_PREBUILD_FAILED";
|
|
248
|
+
const LAST_LINES = 20;
|
|
249
|
+
function nativeDirName(platform) {
|
|
250
|
+
return platform === "android" ? "android" : "ios";
|
|
251
|
+
}
|
|
252
|
+
function nativeDir(root, platform) {
|
|
253
|
+
return join(root, nativeDirName(platform));
|
|
254
|
+
}
|
|
255
|
+
function nativeDirInFingerprint(sources, platform) {
|
|
256
|
+
const dir = nativeDirName(platform);
|
|
257
|
+
return sources.some((source) => source.type === "dir" && source.filePath === dir && source.hash != null);
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* @expo/fingerprint leaves a native directory out of the hash when git ignores it (CNG), so the cache
|
|
261
|
+
* key only covers that directory when this workspace's recorded prebuild ran on the same fingerprint.
|
|
262
|
+
*/
|
|
263
|
+
function prebuildAction({ isExpo, nativeDirExists, nativeDirFingerprinted, nativeDirTracked, generatedFrom, fingerprint }) {
|
|
264
|
+
if (!isExpo) return "none";
|
|
265
|
+
if (!nativeDirExists) return "generate";
|
|
266
|
+
if (nativeDirFingerprinted || generatedFrom === fingerprint) return "none";
|
|
267
|
+
return nativeDirTracked ? "refuse" : "regenerate";
|
|
268
|
+
}
|
|
269
|
+
function prebuildRecord(state) {
|
|
270
|
+
const record = state?.prebuild;
|
|
271
|
+
return record && typeof record === "object" ? record : {};
|
|
272
|
+
}
|
|
273
|
+
function unreadableGitTracksNativeDir(error) {
|
|
274
|
+
if (error instanceof Error && "code" in error && error.code === "ENOENT") return false;
|
|
275
|
+
return !/not a git repository \(or any (of the parent directories|parent up to mount point)/.test(error instanceof Error ? error.message : String(error));
|
|
276
|
+
}
|
|
277
|
+
function gitTracksNativeDir(root, platform) {
|
|
278
|
+
try {
|
|
279
|
+
return git(root, [
|
|
280
|
+
"ls-files",
|
|
281
|
+
"--",
|
|
282
|
+
nativeDirName(platform)
|
|
283
|
+
], { env: {
|
|
284
|
+
LC_ALL: "C",
|
|
285
|
+
LANGUAGE: "C"
|
|
286
|
+
} }).trim() !== "";
|
|
287
|
+
} catch (error) {
|
|
288
|
+
return unreadableGitTracksNativeDir(error);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
function prebuildInputs(root, platform, { isExpo, fingerprint, sources }) {
|
|
292
|
+
const nativeDirExists = existsSync(nativeDir(root, platform));
|
|
293
|
+
const fingerprinted = nativeDirInFingerprint(sources, platform);
|
|
294
|
+
const generatedFrom = prebuildRecord(readWorkspaceState$1(root))[platform];
|
|
295
|
+
return {
|
|
296
|
+
isExpo,
|
|
297
|
+
nativeDirExists,
|
|
298
|
+
nativeDirFingerprinted: fingerprinted,
|
|
299
|
+
generatedFrom: typeof generatedFrom === "string" ? generatedFrom : null,
|
|
300
|
+
fingerprint
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
function planPrebuild(root, platform, options) {
|
|
304
|
+
const inputs = prebuildInputs(root, platform, options);
|
|
305
|
+
return prebuildAction({
|
|
306
|
+
...inputs,
|
|
307
|
+
nativeDirTracked: inputs.nativeDirExists && !inputs.nativeDirFingerprinted && gitTracksNativeDir(root, platform)
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
async function planPrebuildAsync(root, platform, options, signal) {
|
|
311
|
+
signal?.throwIfAborted();
|
|
312
|
+
const untracked = prebuildAction({
|
|
313
|
+
...prebuildInputs(root, platform, options),
|
|
314
|
+
nativeDirTracked: false
|
|
315
|
+
});
|
|
316
|
+
if (untracked !== "regenerate") return untracked;
|
|
317
|
+
let tracked;
|
|
318
|
+
try {
|
|
319
|
+
tracked = (await gitAsync(root, [
|
|
320
|
+
"ls-files",
|
|
321
|
+
"--",
|
|
322
|
+
nativeDirName(platform)
|
|
323
|
+
], {
|
|
324
|
+
env: {
|
|
325
|
+
LC_ALL: "C",
|
|
326
|
+
LANGUAGE: "C"
|
|
327
|
+
},
|
|
328
|
+
signal
|
|
329
|
+
})).trim() !== "";
|
|
330
|
+
} catch (error) {
|
|
331
|
+
signal?.throwIfAborted();
|
|
332
|
+
tracked = unreadableGitTracksNativeDir(error);
|
|
333
|
+
}
|
|
334
|
+
return tracked ? "refuse" : "regenerate";
|
|
335
|
+
}
|
|
336
|
+
function recordPrebuild(root, platform, fingerprint) {
|
|
337
|
+
updateWorkspaceState(root, (state) => ({
|
|
338
|
+
...state,
|
|
339
|
+
prebuild: {
|
|
340
|
+
...prebuildRecord(state),
|
|
341
|
+
[platform]: fingerprint
|
|
342
|
+
}
|
|
343
|
+
}));
|
|
344
|
+
}
|
|
345
|
+
function staleNativeDirRefusal(platform) {
|
|
346
|
+
const dir = nativeDirName(platform);
|
|
347
|
+
return {
|
|
348
|
+
code: PREBUILD_ERROR,
|
|
349
|
+
message: `The fingerprint leaves ${dir}/ out of the cache key, and Stim cannot show that ${dir}/ was generated from the current app config. Git tracks files in it, or could not say whether it does, so Stim will not regenerate it with \`expo prebuild --clean\`.`,
|
|
350
|
+
remedy: `Stop excluding ${dir}/ from the fingerprint (check .fingerprintignore) so the cache key covers its files, or add ${dir}/ to .gitignore and untrack it so Stim regenerates it from the app config.`
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
function prebuildRefusal({ isExpo, platform, nativeDirExists }) {
|
|
354
|
+
if (nativeDirExists || isExpo) return null;
|
|
355
|
+
const dir = nativeDirName(platform);
|
|
356
|
+
return {
|
|
357
|
+
code: PREBUILD_ERROR,
|
|
358
|
+
message: `This project has no ${dir}/ directory and is not an Expo (CNG) project, so Stim cannot generate one.`,
|
|
359
|
+
remedy: `Check out or generate the native project (\`npx @react-native-community/cli init\` produced one originally), or add \`expo\` to the project so \`expo prebuild\` can create ${dir}/.`
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
function prebuildFailure(logWriter, result) {
|
|
363
|
+
logWriter?.write?.({
|
|
364
|
+
src: "build",
|
|
365
|
+
level: "error",
|
|
366
|
+
msg: result.reason || "Expo prebuild failed.",
|
|
367
|
+
event: "prebuild_failed"
|
|
368
|
+
});
|
|
369
|
+
return result;
|
|
370
|
+
}
|
|
371
|
+
async function runPrebuild(root, platform, logWriter, { spawnFn = null, now = Date.now, isExpo = null, clean = false } = {}) {
|
|
372
|
+
const dirExists = existsSync(nativeDir(root, platform));
|
|
373
|
+
const refusal = prebuildRefusal({
|
|
374
|
+
isExpo: isExpo === null ? detectIsExpo(root) : isExpo,
|
|
375
|
+
platform,
|
|
376
|
+
nativeDirExists: dirExists
|
|
377
|
+
});
|
|
378
|
+
if (refusal) return prebuildFailure(logWriter, {
|
|
379
|
+
failed: true,
|
|
380
|
+
code: refusal.code,
|
|
381
|
+
reason: refusal.message,
|
|
382
|
+
remedy: refusal.remedy,
|
|
383
|
+
error: refusal,
|
|
384
|
+
lastLines: []
|
|
385
|
+
});
|
|
386
|
+
const bin = expoBinPath(root);
|
|
387
|
+
if (!bin) {
|
|
388
|
+
const binRefusal = expoBinRefusal(root, "prebuild");
|
|
389
|
+
return prebuildFailure(logWriter, {
|
|
390
|
+
failed: true,
|
|
391
|
+
code: PREBUILD_ERROR,
|
|
392
|
+
reason: binRefusal.message,
|
|
393
|
+
remedy: binRefusal.remedy,
|
|
394
|
+
lastLines: []
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
const spawn = spawnFn || ((cmd, args, opts) => getExecutor().spawn(cmd, args, opts));
|
|
398
|
+
const startedAt = now();
|
|
399
|
+
const tail = [];
|
|
400
|
+
const push = (line) => {
|
|
401
|
+
const msg = stripAnsi(String(line)).trimEnd();
|
|
402
|
+
if (!msg.trim()) return;
|
|
403
|
+
tail.push(msg);
|
|
404
|
+
if (tail.length > LAST_LINES) tail.shift();
|
|
405
|
+
logWriter?.write?.({
|
|
406
|
+
src: "build",
|
|
407
|
+
level: "debug",
|
|
408
|
+
msg,
|
|
409
|
+
raw: true,
|
|
410
|
+
event: "prebuild"
|
|
411
|
+
});
|
|
412
|
+
};
|
|
413
|
+
let child;
|
|
414
|
+
try {
|
|
415
|
+
const invocation = remoteCliInvocation(bin, [
|
|
416
|
+
"prebuild",
|
|
417
|
+
"-p",
|
|
418
|
+
platform,
|
|
419
|
+
"--no-install",
|
|
420
|
+
...clean ? ["--clean"] : []
|
|
421
|
+
], "expo");
|
|
422
|
+
child = spawnDeclared(ambientContext(), () => spawn(invocation.file, invocation.args, {
|
|
423
|
+
cwd: root,
|
|
424
|
+
stdio: [
|
|
425
|
+
"ignore",
|
|
426
|
+
"pipe",
|
|
427
|
+
"pipe"
|
|
428
|
+
],
|
|
429
|
+
env: {
|
|
430
|
+
...ambientContext()?.env ?? process.env,
|
|
431
|
+
FORCE_COLOR: "0",
|
|
432
|
+
CI: "1"
|
|
433
|
+
}
|
|
434
|
+
}));
|
|
435
|
+
} catch (err) {
|
|
436
|
+
return prebuildFailure(logWriter, {
|
|
437
|
+
failed: true,
|
|
438
|
+
code: PREBUILD_ERROR,
|
|
439
|
+
reason: `Could not run \`expo prebuild\`: ${err?.message || err}`,
|
|
440
|
+
lastLines: []
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
const outReader = createLineReader(push);
|
|
444
|
+
const errReader = createLineReader(push);
|
|
445
|
+
child.stdout?.setEncoding?.("utf-8");
|
|
446
|
+
child.stderr?.setEncoding?.("utf-8");
|
|
447
|
+
child.stdout?.on("data", (chunk) => outReader.push(chunk));
|
|
448
|
+
child.stderr?.on("data", (chunk) => errReader.push(chunk));
|
|
449
|
+
const result = await waitForChild(child);
|
|
450
|
+
outReader.flush();
|
|
451
|
+
errReader.flush();
|
|
452
|
+
const durationMs = now() - startedAt;
|
|
453
|
+
if (result.error) return prebuildFailure(logWriter, {
|
|
454
|
+
failed: true,
|
|
455
|
+
code: PREBUILD_ERROR,
|
|
456
|
+
reason: `Could not run \`expo prebuild\`: ${result.error?.message || result.error}`,
|
|
457
|
+
lastLines: tail.slice(),
|
|
458
|
+
durationMs
|
|
459
|
+
});
|
|
460
|
+
if (result.code !== 0) {
|
|
461
|
+
const how = result.signal ? `signal ${result.signal}` : `exit code ${result.code}`;
|
|
462
|
+
return prebuildFailure(logWriter, {
|
|
463
|
+
failed: true,
|
|
464
|
+
code: PREBUILD_ERROR,
|
|
465
|
+
reason: `\`expo prebuild -p ${platform}\` failed (${how}).`,
|
|
466
|
+
lastLines: tail.slice(),
|
|
467
|
+
durationMs
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
if (!existsSync(nativeDir(root, platform))) return prebuildFailure(logWriter, {
|
|
471
|
+
failed: true,
|
|
472
|
+
code: PREBUILD_ERROR,
|
|
473
|
+
reason: `\`expo prebuild -p ${platform}\` succeeded but did not create ${nativeDirName(platform)}/.`,
|
|
474
|
+
lastLines: tail.slice(),
|
|
475
|
+
durationMs
|
|
476
|
+
});
|
|
477
|
+
return {
|
|
478
|
+
ok: true,
|
|
479
|
+
durationMs,
|
|
480
|
+
nativeDir: nativeDir(root, platform)
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
//#endregion
|
|
484
|
+
export { staleNativeDirRefusal as a, predictBuildMiss as c, runPrebuild as i, skippedMissReason as l, planPrebuildAsync as n, explainBuildMiss as o, recordPrebuild as r, fingerprintErrorMissReason as s, planPrebuild as t };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { g as process_identity_exports } from "./exec-DEoAhcze.mjs";
|
|
2
|
+
import { c as supervisorPidFile, g as workspaceStateFile$1 } from "./paths-DQtTgsBf.mjs";
|
|
3
|
+
import { U as parseDeviceSlotKey, V as deviceSlotKey, _ as loadConfig$1, g as isPathPrefix, l as findEnclosingWorktreeRoot, p as getProject } from "./config-DlrsduwG.mjs";
|
|
4
|
+
import { c as withWorkspaceStateLock, o as updateWorkspaceState, r as readWorkspaceState$1, t as clearWorkspaceStateKey } from "./workspace-state-U08dEzhG.mjs";
|
|
5
|
+
import { K as resolveIosProjectDir, Mt as repoRoot, W as resolveAndroidLayout, at as webSettings, tt as settingValueAt } from "./settings-C7O8A6ZI.mjs";
|
|
4
6
|
import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
5
7
|
import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
6
|
-
import { basename as basename$1, dirname as dirname$1, join as join$1, resolve as resolve$1 } from "path";
|
|
7
8
|
import { projectRootDirectories } from "@stim-cli/core/state";
|
|
9
|
+
import { basename as basename$1, dirname as dirname$1, join as join$1, resolve as resolve$1 } from "path";
|
|
8
10
|
import { existsSync as existsSync$1, readFileSync as readFileSync$1, realpathSync as realpathSync$1 } from "fs";
|
|
9
11
|
import { DOMParser } from "@xmldom/xmldom";
|
|
10
12
|
//#region src/supervisor/state.ts
|
|
@@ -133,7 +135,7 @@ function clearExpoMetroTunnel(root) {
|
|
|
133
135
|
});
|
|
134
136
|
}
|
|
135
137
|
function clearManagedMetroTunnel(root, expected) {
|
|
136
|
-
if (!existsSync(workspaceStateFile(root))) return true;
|
|
138
|
+
if (!existsSync(workspaceStateFile$1(root))) return true;
|
|
137
139
|
return clearWorkspaceStateKey(root, "metroTunnel", (value) => {
|
|
138
140
|
if (typeof value !== "object" || value === null) return false;
|
|
139
141
|
const record = value;
|
|
@@ -306,8 +308,8 @@ const nativeAndroidIntegration = {
|
|
|
306
308
|
application: true,
|
|
307
309
|
platforms: () => ["android"],
|
|
308
310
|
validate: (operation) => operation === "android" ? null : void 0,
|
|
309
|
-
android: async () => (await import("./native-android-
|
|
310
|
-
doctor: async () => (await import("./native-android-
|
|
311
|
+
android: async () => (await import("./native-android-CqgnOgsT.mjs")).nativeAndroidProject(root),
|
|
312
|
+
doctor: async () => (await import("./native-android-CqgnOgsT.mjs")).nativeAndroidDoctor(root)
|
|
311
313
|
};
|
|
312
314
|
}
|
|
313
315
|
};
|
|
@@ -735,8 +737,8 @@ const nativeXcodeProjectIntegration = {
|
|
|
735
737
|
application: problem === null,
|
|
736
738
|
platforms: () => problem ? [] : ["ios"],
|
|
737
739
|
validate: (operation) => operation === "ios" ? problem : void 0,
|
|
738
|
-
ios: async () => (await import("./native-xcode-ios-
|
|
739
|
-
doctor: async () => (await import("./native-xcode-ios-
|
|
740
|
+
ios: async () => (await import("./native-xcode-ios-BYDOHWLN.mjs")).nativeXcodeIosProject(root),
|
|
741
|
+
doctor: async () => (await import("./native-xcode-ios-BYDOHWLN.mjs")).nativeXcodeDoctor(root)
|
|
740
742
|
};
|
|
741
743
|
}
|
|
742
744
|
};
|
|
@@ -941,7 +943,7 @@ function createProjectRegistry(integrations) {
|
|
|
941
943
|
//#region src/integrations/projects.ts
|
|
942
944
|
const expo = {
|
|
943
945
|
mode: MODE_EXPO,
|
|
944
|
-
loadDevServer: async () => (await import("./server-expo-
|
|
946
|
+
loadDevServer: async () => (await import("./server-expo-D58c9L0M.mjs")).startExpoServer,
|
|
945
947
|
platforms(root) {
|
|
946
948
|
const appJson = readAppJson(root);
|
|
947
949
|
const config = appJson?.expo ?? appJson;
|
|
@@ -961,7 +963,7 @@ const expo = {
|
|
|
961
963
|
};
|
|
962
964
|
const reactNative = {
|
|
963
965
|
mode: MODE_BARE,
|
|
964
|
-
loadDevServer: async () => (await import("./server-bare-
|
|
966
|
+
loadDevServer: async () => (await import("./server-bare-CafzuyFB.mjs")).startBareServer,
|
|
965
967
|
platforms(root, { context, settings }) {
|
|
966
968
|
if (!declaresAppDependency(readPackageJson(root))) return [];
|
|
967
969
|
const platforms = [];
|
|
@@ -991,9 +993,9 @@ const projectRegistry = createProjectRegistry([
|
|
|
991
993
|
ownedRoots: problem === null ? [join(root, "ios"), join(root, "android")] : [],
|
|
992
994
|
platforms: (resolved) => nativeProjectIntegration(root).platforms(root, resolved),
|
|
993
995
|
validate: (operation) => operation === "ios" || operation === "android" || operation === "dev-server" ? problem : void 0,
|
|
994
|
-
ios: async (settings) => (await import("./react-native-ios-
|
|
995
|
-
android: async (resolved) => (await import("./react-native-android-
|
|
996
|
-
doctor: async () => (await import("./react-native-doctor-
|
|
996
|
+
ios: async (settings) => (await import("./react-native-ios-4u1Rn-GR.mjs")).reactNativeIosProject(root, settings),
|
|
997
|
+
android: async (resolved) => (await import("./react-native-android-6OZ7MSM7.mjs")).reactNativeAndroidProject(root, resolved),
|
|
998
|
+
doctor: async () => (await import("./react-native-doctor-DsoSF1Y9.mjs")).reactNativeProjectDoctor(root)
|
|
997
999
|
};
|
|
998
1000
|
}
|
|
999
1001
|
},
|
|
@@ -1007,14 +1009,14 @@ const projectRegistry = createProjectRegistry([
|
|
|
1007
1009
|
application: true,
|
|
1008
1010
|
platforms: ({ settings }) => settingValueAt(settings, "macos.product") && settingValueAt(settings, "macos.infoPlist") ? ["macos"] : [],
|
|
1009
1011
|
validate: (operation) => operation === "macos" ? null : void 0,
|
|
1010
|
-
macos: async () => (await import("./swiftpm-macos-
|
|
1012
|
+
macos: async () => (await import("./swiftpm-macos-BIak-Rxv.mjs")).swiftpmMacosProject(root),
|
|
1011
1013
|
doctor: async () => {
|
|
1012
|
-
const { macosToolchain } = await import("./toolchain-
|
|
1014
|
+
const { macosToolchain, macosToolchainAsync } = await import("./toolchain-BY8X8HXx.mjs");
|
|
1013
1015
|
return {
|
|
1014
1016
|
inspect: () => [],
|
|
1015
|
-
offloadTargets: ({ options: { host = process.platform, platform } }) => host === "darwin" && platform === void 0 ? async () => [{
|
|
1017
|
+
offloadTargets: ({ options: { host = process.platform, platform, operation } }) => host === "darwin" && platform === void 0 ? async () => [{
|
|
1016
1018
|
platform: "macos",
|
|
1017
|
-
local: macosToolchain()
|
|
1019
|
+
local: operation ? await macosToolchainAsync() : macosToolchain()
|
|
1018
1020
|
}] : null
|
|
1019
1021
|
};
|
|
1020
1022
|
}
|
|
@@ -1029,7 +1031,7 @@ const projectRegistry = createProjectRegistry([
|
|
|
1029
1031
|
application: false,
|
|
1030
1032
|
platforms: ({ settings }) => webSettings(settings).url !== null ? ["web"] : [],
|
|
1031
1033
|
validate: (operation) => operation === "web" ? null : void 0,
|
|
1032
|
-
web: async () => (await import("./browser-web-
|
|
1034
|
+
web: async () => (await import("./browser-web-Bcv99PBM.mjs")).browserWebProject(root)
|
|
1033
1035
|
};
|
|
1034
1036
|
}
|
|
1035
1037
|
},
|
|
@@ -1062,7 +1064,7 @@ function literalPlatforms(text) {
|
|
|
1062
1064
|
}
|
|
1063
1065
|
//#endregion
|
|
1064
1066
|
//#region src/workspace/project.ts
|
|
1065
|
-
const findProjectRoot = projectRegistry.findProjectRoot;
|
|
1067
|
+
const findProjectRoot$1 = projectRegistry.findProjectRoot;
|
|
1066
1068
|
const projectProblem = projectRegistry.projectProblem;
|
|
1067
1069
|
const isMobileProject = projectRegistry.isMobileProject;
|
|
1068
1070
|
function projectShortcut(path, proj) {
|
|
@@ -1084,27 +1086,28 @@ const NO_PROJECT_REFUSAL = {
|
|
|
1084
1086
|
message: "No supported app project was found from this directory.",
|
|
1085
1087
|
remedy: "Run this from the directory of a supported app."
|
|
1086
1088
|
};
|
|
1087
|
-
function
|
|
1089
|
+
function startServerWorkspace(startDir, registry) {
|
|
1088
1090
|
const nearest = registry.findProjectRoot(startDir);
|
|
1089
|
-
if (!nearest) return null;
|
|
1090
|
-
if (registry.keepsWorkspace(nearest)) return {
|
|
1091
|
-
root: nearest,
|
|
1092
|
-
from: null
|
|
1093
|
-
};
|
|
1094
|
-
if (Object.keys(getProject(nearest)?.ports ?? {}).length) return {
|
|
1091
|
+
if (!nearest) return { found: null };
|
|
1092
|
+
if (registry.keepsWorkspace(nearest)) return { found: {
|
|
1095
1093
|
root: nearest,
|
|
1096
1094
|
from: null
|
|
1097
|
-
};
|
|
1098
|
-
|
|
1099
|
-
if (!top) return {
|
|
1095
|
+
} };
|
|
1096
|
+
if (Object.keys(getProject(nearest)?.ports ?? {}).length) return { found: {
|
|
1100
1097
|
root: nearest,
|
|
1101
1098
|
from: null
|
|
1102
|
-
};
|
|
1099
|
+
} };
|
|
1100
|
+
return { nearest };
|
|
1101
|
+
}
|
|
1102
|
+
function sameRepositoryApps(nearest, top, registry) {
|
|
1103
|
+
const worktree = expandedRealpath(top);
|
|
1104
|
+
return Object.keys(loadConfig$1()?.projects ?? {}).filter((path) => path !== nearest && isPathPrefix(worktree, expandedRealpath(path)) && registry.isMobileProject(path));
|
|
1105
|
+
}
|
|
1106
|
+
function chooseServerWorkspace(nearest, top, candidates, owners) {
|
|
1103
1107
|
const worktree = expandedRealpath(top);
|
|
1104
|
-
const apps =
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
return owner !== null && expandedRealpath(owner) === worktree;
|
|
1108
|
+
const apps = candidates.filter((_, index) => {
|
|
1109
|
+
const owner = owners[index];
|
|
1110
|
+
return owner !== null && owner !== void 0 && expandedRealpath(owner) === worktree;
|
|
1108
1111
|
});
|
|
1109
1112
|
return apps.length === 1 ? {
|
|
1110
1113
|
root: apps[0],
|
|
@@ -1114,9 +1117,34 @@ function findServerWorkspace(startDir, registry = projectRegistry) {
|
|
|
1114
1117
|
from: null
|
|
1115
1118
|
};
|
|
1116
1119
|
}
|
|
1120
|
+
function findServerWorkspace(startDir, registry = projectRegistry) {
|
|
1121
|
+
const start = startServerWorkspace(startDir, registry);
|
|
1122
|
+
if ("found" in start) return start.found;
|
|
1123
|
+
const top = repoRoot(start.nearest);
|
|
1124
|
+
if (!top) return {
|
|
1125
|
+
root: start.nearest,
|
|
1126
|
+
from: null
|
|
1127
|
+
};
|
|
1128
|
+
const candidates = sameRepositoryApps(start.nearest, top, registry);
|
|
1129
|
+
return chooseServerWorkspace(start.nearest, top, candidates, candidates.map(repoRoot));
|
|
1130
|
+
}
|
|
1131
|
+
/** `findCommandWorkspace` with the repository roots read by `repoRootOf`, so no Git call blocks the event loop. */
|
|
1132
|
+
async function findCommandWorkspaceAsync(startDir, repoRootOf, note) {
|
|
1133
|
+
const start = startServerWorkspace(startDir, projectRegistry);
|
|
1134
|
+
if ("found" in start) return start.found?.root ?? null;
|
|
1135
|
+
const top = await repoRootOf(start.nearest);
|
|
1136
|
+
if (!top) return start.nearest;
|
|
1137
|
+
const candidates = sameRepositoryApps(start.nearest, top, projectRegistry);
|
|
1138
|
+
const workspace = chooseServerWorkspace(start.nearest, top, candidates, await Promise.all(candidates.map(repoRootOf)));
|
|
1139
|
+
if (workspace.from) noteWorkspace(workspace, note);
|
|
1140
|
+
return workspace.root;
|
|
1141
|
+
}
|
|
1142
|
+
function noteWorkspace(workspace, note) {
|
|
1143
|
+
note(`Using the Stim workspace ${workspace.root}: ${workspace.from} is not a React Native or Expo app.`);
|
|
1144
|
+
}
|
|
1117
1145
|
function findCommandWorkspace(startDir, note = (line) => console.error(line)) {
|
|
1118
1146
|
const workspace = findServerWorkspace(startDir);
|
|
1119
|
-
if (workspace?.from)
|
|
1147
|
+
if (workspace?.from) noteWorkspace(workspace, note);
|
|
1120
1148
|
return workspace?.root ?? null;
|
|
1121
1149
|
}
|
|
1122
1150
|
function expandedRealpath(path) {
|
|
@@ -1127,4 +1155,4 @@ function expandedRealpath(path) {
|
|
|
1127
1155
|
}
|
|
1128
1156
|
}
|
|
1129
1157
|
//#endregion
|
|
1130
|
-
export {
|
|
1158
|
+
export { clearWorkspaceLaunches as A, resolvePackageJson as C, clearExpoMetroTunnel as D, MODE_EXPO as E, readRemoteSessionId as F, readWorkspaceLaunches as I, workspaceDevServerMode as L, readMetroTunnel as M, readPidFile as N, clearManagedMetroTunnel as O, readRemoteSession as P, writePidFile as R, readAppJson as S, MODE_COMMAND as T, appProjectProblem as _, findServerWorkspace as a, isPackageResolvable as b, projectProblem as c, nativeProjectIntegration as d, projectRegistry as f, selectNativeXcodeProject as g, pbxString as h, findProjectRoot$1 as i, clearWorkspaceSupervisor as j, clearRemoteSession as k, projectShortcut as l, pbxReferences as m, findCommandWorkspace as n, isMobileProject as o, NativeXcodeError as p, findCommandWorkspaceAsync as r, ownedDeviceLabel as s, NO_PROJECT_REFUSAL as t, detectPlatforms as u, detectIsExpo as v, MODE_BARE as w, readAppConfigText as x, detectTutorial as y, writeWorkspaceLaunch as z };
|