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,489 @@
|
|
|
1
|
+
import { t as getExecutor } from "./exec-DEoAhcze.mjs";
|
|
2
|
+
import { a as killOnAbort, f as throwIfCancelled, r as childEnvironment } from "./operation-exec-BW0em61G.mjs";
|
|
3
|
+
import { X509Certificate } from "node:crypto";
|
|
4
|
+
import { existsSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
//#region src/engine/ios-profile.ts
|
|
8
|
+
const TAG = /<(\/?)\s*([A-Za-z0-9_]+)(?:\s[^>]*?)?(\/?)>/g;
|
|
9
|
+
const ENTITIES = {
|
|
10
|
+
amp: "&",
|
|
11
|
+
lt: "<",
|
|
12
|
+
gt: ">",
|
|
13
|
+
quot: "\"",
|
|
14
|
+
apos: "'"
|
|
15
|
+
};
|
|
16
|
+
var PlistError = class extends Error {};
|
|
17
|
+
function codePoint(value) {
|
|
18
|
+
if (!Number.isInteger(value) || value < 0 || value > 1114111 || value >= 55296 && value <= 57343) throw new PlistError(`character reference out of range: ${value}`);
|
|
19
|
+
return String.fromCodePoint(value);
|
|
20
|
+
}
|
|
21
|
+
function decodeEntities(raw) {
|
|
22
|
+
return raw.replace(/&(#x?[0-9A-Fa-f]+|[a-z]+);/g, (match, body) => {
|
|
23
|
+
if (body.startsWith("#x") || body.startsWith("#X")) return codePoint(Number.parseInt(body.slice(2), 16));
|
|
24
|
+
if (body.startsWith("#")) return codePoint(Number.parseInt(body.slice(1), 10));
|
|
25
|
+
return ENTITIES[body] ?? match;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function peekTag(cursor) {
|
|
29
|
+
TAG.lastIndex = cursor.pos;
|
|
30
|
+
const match = TAG.exec(cursor.xml);
|
|
31
|
+
if (!match) return null;
|
|
32
|
+
return {
|
|
33
|
+
name: (match[2] ?? "").toLowerCase(),
|
|
34
|
+
closing: match[1] === "/",
|
|
35
|
+
selfClosing: match[3] === "/",
|
|
36
|
+
end: TAG.lastIndex
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function takeTag(cursor) {
|
|
40
|
+
const tag = peekTag(cursor);
|
|
41
|
+
if (tag) cursor.pos = tag.end;
|
|
42
|
+
return tag;
|
|
43
|
+
}
|
|
44
|
+
function takeText(cursor, name) {
|
|
45
|
+
const close = cursor.xml.indexOf(`</${name}>`, cursor.pos);
|
|
46
|
+
if (close < 0) {
|
|
47
|
+
cursor.pos = cursor.xml.length;
|
|
48
|
+
return "";
|
|
49
|
+
}
|
|
50
|
+
const raw = cursor.xml.slice(cursor.pos, close);
|
|
51
|
+
cursor.pos = close + name.length + 3;
|
|
52
|
+
return raw;
|
|
53
|
+
}
|
|
54
|
+
function parseValue(cursor) {
|
|
55
|
+
const peeked = peekTag(cursor);
|
|
56
|
+
if (!peeked || peeked.closing) return void 0;
|
|
57
|
+
const tag = takeTag(cursor);
|
|
58
|
+
if (tag.selfClosing) {
|
|
59
|
+
if (tag.name === "true") return true;
|
|
60
|
+
if (tag.name === "false") return false;
|
|
61
|
+
if (tag.name === "array") return [];
|
|
62
|
+
if (tag.name === "dict") return {};
|
|
63
|
+
return "";
|
|
64
|
+
}
|
|
65
|
+
switch (tag.name) {
|
|
66
|
+
case "plist": return parseValue(cursor);
|
|
67
|
+
case "dict": {
|
|
68
|
+
const out = {};
|
|
69
|
+
for (;;) {
|
|
70
|
+
const next = peekTag(cursor);
|
|
71
|
+
if (!next) break;
|
|
72
|
+
if (next.closing) {
|
|
73
|
+
cursor.pos = next.end;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
cursor.pos = next.end;
|
|
77
|
+
if (next.name !== "key") continue;
|
|
78
|
+
const key = decodeEntities(next.selfClosing ? "" : takeText(cursor, "key"));
|
|
79
|
+
const value = parseValue(cursor);
|
|
80
|
+
if (value !== void 0) out[key] = value;
|
|
81
|
+
}
|
|
82
|
+
return out;
|
|
83
|
+
}
|
|
84
|
+
case "array": {
|
|
85
|
+
const out = [];
|
|
86
|
+
for (;;) {
|
|
87
|
+
const next = peekTag(cursor);
|
|
88
|
+
if (!next) break;
|
|
89
|
+
if (next.closing) {
|
|
90
|
+
cursor.pos = next.end;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
const value = parseValue(cursor);
|
|
94
|
+
if (value === void 0) break;
|
|
95
|
+
out.push(value);
|
|
96
|
+
}
|
|
97
|
+
return out;
|
|
98
|
+
}
|
|
99
|
+
case "string":
|
|
100
|
+
case "key": return decodeEntities(takeText(cursor, tag.name));
|
|
101
|
+
case "integer": return Number.parseInt(takeText(cursor, "integer").trim(), 10);
|
|
102
|
+
case "real": return Number.parseFloat(takeText(cursor, "real").trim());
|
|
103
|
+
case "date": return new Date(takeText(cursor, "date").trim());
|
|
104
|
+
case "data": return Buffer.from(takeText(cursor, "data").replace(/\s+/g, ""), "base64");
|
|
105
|
+
case "true":
|
|
106
|
+
takeText(cursor, "true");
|
|
107
|
+
return true;
|
|
108
|
+
case "false":
|
|
109
|
+
takeText(cursor, "false");
|
|
110
|
+
return false;
|
|
111
|
+
default:
|
|
112
|
+
takeText(cursor, tag.name);
|
|
113
|
+
return "";
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function parsePlist(xml) {
|
|
117
|
+
if (typeof xml !== "string" || xml.trim() === "") return null;
|
|
118
|
+
const stripped = xml.replace(/<!--[\s\S]*?-->/g, "");
|
|
119
|
+
const start = stripped.indexOf("<plist");
|
|
120
|
+
const cursor = {
|
|
121
|
+
xml: stripped,
|
|
122
|
+
pos: start < 0 ? 0 : start
|
|
123
|
+
};
|
|
124
|
+
try {
|
|
125
|
+
const value = parseValue(cursor);
|
|
126
|
+
return value === void 0 ? null : value;
|
|
127
|
+
} catch {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function isDict(value) {
|
|
132
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) && !Buffer.isBuffer(value) && !(value instanceof Date);
|
|
133
|
+
}
|
|
134
|
+
function stringsOf(value) {
|
|
135
|
+
if (!Array.isArray(value)) return null;
|
|
136
|
+
return value.filter((v) => typeof v === "string");
|
|
137
|
+
}
|
|
138
|
+
function parseProvisioningProfilePlist(xml) {
|
|
139
|
+
const root = parsePlist(xml);
|
|
140
|
+
if (!isDict(root)) return null;
|
|
141
|
+
const entitlements = isDict(root.Entitlements ?? null) ? root.Entitlements : {};
|
|
142
|
+
const teamIdentifier = stringsOf(root.TeamIdentifier);
|
|
143
|
+
const expiration = root.ExpirationDate;
|
|
144
|
+
const certificates = Array.isArray(root.DeveloperCertificates) ? root.DeveloperCertificates.filter((v) => Buffer.isBuffer(v)) : [];
|
|
145
|
+
return {
|
|
146
|
+
name: typeof root.Name === "string" ? root.Name : null,
|
|
147
|
+
uuid: typeof root.UUID === "string" ? root.UUID : null,
|
|
148
|
+
teamIdentifier: teamIdentifier?.[0] ?? null,
|
|
149
|
+
expirationDate: expiration instanceof Date && !Number.isNaN(expiration.getTime()) ? expiration : null,
|
|
150
|
+
provisionedDevices: stringsOf(root.ProvisionedDevices),
|
|
151
|
+
provisionsAllDevices: root.ProvisionsAllDevices === true,
|
|
152
|
+
getTaskAllow: entitlements["get-task-allow"] === true,
|
|
153
|
+
certificates
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function provisioningProfileKind(profile) {
|
|
157
|
+
if (profile.provisionedDevices) return profile.getTaskAllow ? "development" : "ad hoc";
|
|
158
|
+
return profile.provisionsAllDevices ? "enterprise" : "App Store";
|
|
159
|
+
}
|
|
160
|
+
function certificateCommonName(der) {
|
|
161
|
+
if (!Buffer.isBuffer(der) || der.length === 0) return null;
|
|
162
|
+
let subject;
|
|
163
|
+
try {
|
|
164
|
+
subject = new X509Certificate(der).subject;
|
|
165
|
+
} catch {
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
for (const part of String(subject).split(/\r?\n/)) {
|
|
169
|
+
const trimmed = part.trim();
|
|
170
|
+
if (trimmed.startsWith("CN=")) return trimmed.slice(3).trim() || null;
|
|
171
|
+
}
|
|
172
|
+
return /(?:^|,)\s*CN=([^,]+)/.exec(String(subject))?.[1]?.trim() || null;
|
|
173
|
+
}
|
|
174
|
+
const IDENTITY_LINE = /^\s*\d+\)\s+([0-9A-Fa-f]{40})\s+"(.+)"\s*$/;
|
|
175
|
+
function parseSigningIdentities(text) {
|
|
176
|
+
if (typeof text !== "string") return [];
|
|
177
|
+
const out = [];
|
|
178
|
+
for (const line of text.split(/\r?\n/)) {
|
|
179
|
+
const match = IDENTITY_LINE.exec(line);
|
|
180
|
+
if (!match) continue;
|
|
181
|
+
out.push({
|
|
182
|
+
sha1: match[1].toUpperCase(),
|
|
183
|
+
name: match[2]
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
return out;
|
|
187
|
+
}
|
|
188
|
+
const SIGNING_CODES = {
|
|
189
|
+
noProfile: "STIM_NO_PROFILE",
|
|
190
|
+
profileMismatch: "STIM_PROFILE_MISMATCH",
|
|
191
|
+
noIdentity: "STIM_NO_SIGNING_IDENTITY",
|
|
192
|
+
codesignFailed: "STIM_CODESIGN_FAILED"
|
|
193
|
+
};
|
|
194
|
+
const XCODE_STEP = "run `stim device provision ios`, which asks before it registers the device or creates the profile (agents run it only with the user's go-ahead), or build once from Xcode to install it. A build never does this, because registering a device or minting a profile changes your Apple Developer account.";
|
|
195
|
+
const KEYCHAIN_REMEDY = "Open Xcode > Settings > Accounts and download your certificates, or unlock the login keychain with `security unlock-keychain`. `security find-identity -v -p codesigning` should list `Apple Development: ...`.";
|
|
196
|
+
function signingConfiguration(input) {
|
|
197
|
+
return input.configuration ?? "Debug";
|
|
198
|
+
}
|
|
199
|
+
function profileGate(input) {
|
|
200
|
+
const now = input.now ?? Date.now();
|
|
201
|
+
if (!input.profilePresent) return {
|
|
202
|
+
ok: false,
|
|
203
|
+
code: SIGNING_CODES.noProfile,
|
|
204
|
+
reason: "The app bundle has no embedded.mobileprovision, so it was built unsigned or for the simulator.",
|
|
205
|
+
remedy: `Set a team and profile for the target's ${signingConfiguration(input)} configuration in Xcode > Signing & Capabilities, then ${XCODE_STEP}`
|
|
206
|
+
};
|
|
207
|
+
if (!input.profile) return {
|
|
208
|
+
ok: false,
|
|
209
|
+
code: SIGNING_CODES.noProfile,
|
|
210
|
+
reason: "`openssl smime` could not decode the app bundle's embedded.mobileprovision.",
|
|
211
|
+
remedy: `The profile inside the app is corrupt. Delete the build cache entry with \`stim gc --delete\`, then ${XCODE_STEP}`
|
|
212
|
+
};
|
|
213
|
+
const profile = input.profile;
|
|
214
|
+
const named = profile.name ? `"${profile.name}"` : "the embedded profile";
|
|
215
|
+
if (!profile.expirationDate || profile.expirationDate.getTime() <= now) return {
|
|
216
|
+
ok: false,
|
|
217
|
+
code: SIGNING_CODES.profileMismatch,
|
|
218
|
+
reason: profile.expirationDate ? `The ${provisioningProfileKind(profile)} profile ${named} expired on ${profile.expirationDate.toISOString()}.` : `The ${provisioningProfileKind(profile)} profile ${named} carries no ExpirationDate, so Stim cannot prove it is still valid.`,
|
|
219
|
+
remedy: `Renew the profile under Signing & Capabilities, then ${XCODE_STEP}`
|
|
220
|
+
};
|
|
221
|
+
if (!profile.provisionedDevices) {
|
|
222
|
+
const kind = provisioningProfileKind(profile);
|
|
223
|
+
return {
|
|
224
|
+
ok: false,
|
|
225
|
+
code: SIGNING_CODES.profileMismatch,
|
|
226
|
+
reason: `${named} is an ${kind} profile, which carries no ProvisionedDevices list, so Stim cannot prove ${input.udid ?? "the target device"} is admitted.`,
|
|
227
|
+
remedy: `Local device runs need a development profile. Select one under Signing & Capabilities, then ${XCODE_STEP}`
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
const udid = input.udid;
|
|
231
|
+
if (!udid || !profile.provisionedDevices.some((d) => d.toLowerCase() === udid.toLowerCase())) return {
|
|
232
|
+
ok: false,
|
|
233
|
+
code: SIGNING_CODES.profileMismatch,
|
|
234
|
+
reason: `The ${provisioningProfileKind(profile)} profile ${named} lists ${profile.provisionedDevices.length} device(s) and ${udid ?? "the target device"} is not one of them.`,
|
|
235
|
+
remedy: `Run \`stim device provision ios${udid ? ` ${udid}` : ""}\`, which asks before it registers the device and refreshes the profile (agents run it only with the user's go-ahead), or register it at developer.apple.com, regenerate the profile and build once from Xcode. A build never does this, because registering a device or minting a profile changes your Apple Developer account.`
|
|
236
|
+
};
|
|
237
|
+
return {
|
|
238
|
+
ok: true,
|
|
239
|
+
profile
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
function signingGate(input) {
|
|
243
|
+
const gated = profileGate(input);
|
|
244
|
+
if (!gated.ok) return gated;
|
|
245
|
+
const profile = gated.profile;
|
|
246
|
+
const named = profile.name ? `"${profile.name}"` : "the embedded profile";
|
|
247
|
+
const identities = Array.isArray(input.identities) ? input.identities : [];
|
|
248
|
+
if (identities.length === 0) return {
|
|
249
|
+
ok: false,
|
|
250
|
+
code: SIGNING_CODES.noIdentity,
|
|
251
|
+
reason: "`security find-identity -v -p codesigning` lists no codesigning identity on this machine.",
|
|
252
|
+
remedy: KEYCHAIN_REMEDY
|
|
253
|
+
};
|
|
254
|
+
if (input.pinnedSha1) {
|
|
255
|
+
const wanted = input.pinnedSha1.trim().toUpperCase();
|
|
256
|
+
const match = identities.find((i) => i.sha1 === wanted);
|
|
257
|
+
if (match) return {
|
|
258
|
+
ok: true,
|
|
259
|
+
identity: match
|
|
260
|
+
};
|
|
261
|
+
return {
|
|
262
|
+
ok: false,
|
|
263
|
+
code: SIGNING_CODES.noIdentity,
|
|
264
|
+
reason: `ios.signingIdentitySha1 is ${wanted}, which is not in the keychain. Available: ${identities.map((i) => `${i.sha1} "${i.name}"`).join(", ")}.`,
|
|
265
|
+
remedy: KEYCHAIN_REMEDY
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
const wantedName = input.pinnedName?.trim() || certificateCommonName(profile.certificates[0] ?? null);
|
|
269
|
+
if (!wantedName) return {
|
|
270
|
+
ok: false,
|
|
271
|
+
code: SIGNING_CODES.noIdentity,
|
|
272
|
+
reason: `Stim could not read a signing-identity name out of ${named}: its DeveloperCertificates entry has no readable subject CN.`,
|
|
273
|
+
remedy: "Set ios.signingIdentity in .stim.json to the identity name to re-sign with, or ios.signingIdentitySha1 to its SHA-1 hash."
|
|
274
|
+
};
|
|
275
|
+
const matches = identities.filter((i) => i.name === wantedName);
|
|
276
|
+
if (matches.length === 1) return {
|
|
277
|
+
ok: true,
|
|
278
|
+
identity: matches[0]
|
|
279
|
+
};
|
|
280
|
+
if (matches.length === 0) return {
|
|
281
|
+
ok: false,
|
|
282
|
+
code: SIGNING_CODES.noIdentity,
|
|
283
|
+
reason: `The app was signed by "${wantedName}", which is not in this machine's keychain. Available: ${identities.map((i) => `"${i.name}"`).join(", ")}.`,
|
|
284
|
+
remedy: `${KEYCHAIN_REMEDY} Or set ios.signingIdentity in .stim.json to one of the identities listed above.`
|
|
285
|
+
};
|
|
286
|
+
return {
|
|
287
|
+
ok: false,
|
|
288
|
+
code: SIGNING_CODES.noIdentity,
|
|
289
|
+
reason: `${matches.length} keychain identities share the name "${wantedName}", so Stim cannot pick one: ${matches.map((i) => i.sha1).join(", ")}.`,
|
|
290
|
+
remedy: "Set ios.signingIdentitySha1 in .stim.json to the SHA-1 hash of the certificate to sign with."
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
//#endregion
|
|
294
|
+
//#region src/engine/ios-signing.ts
|
|
295
|
+
const EMBEDDED_PROFILE = "embedded.mobileprovision";
|
|
296
|
+
const SIGNING_TIMEOUT_MS = 12e4;
|
|
297
|
+
function lastLines(text, count = 5) {
|
|
298
|
+
return String(text ?? "").split(/\r?\n/).map((line) => line.trimEnd()).filter((line) => line.trim() !== "").slice(-count);
|
|
299
|
+
}
|
|
300
|
+
function errorText(error) {
|
|
301
|
+
const withOutput = error;
|
|
302
|
+
const stderr = String(withOutput?.stderr ?? "").trim();
|
|
303
|
+
const stdout = String(withOutput?.stdout ?? "").trim();
|
|
304
|
+
return stderr || stdout || String(withOutput?.message ?? error);
|
|
305
|
+
}
|
|
306
|
+
async function signingCommand(file, args, { exec, env, signal }) {
|
|
307
|
+
throwIfCancelled(signal, "iOS signing");
|
|
308
|
+
try {
|
|
309
|
+
const output = await (exec || getExecutor()).runFileAsync(file, args, {
|
|
310
|
+
timeoutMs: SIGNING_TIMEOUT_MS,
|
|
311
|
+
...env ? childEnvironment(env) : {},
|
|
312
|
+
onSpawn: killOnAbort(signal)
|
|
313
|
+
});
|
|
314
|
+
throwIfCancelled(signal, "iOS signing");
|
|
315
|
+
return output;
|
|
316
|
+
} catch (error) {
|
|
317
|
+
throwIfCancelled(signal, "iOS signing");
|
|
318
|
+
throw error;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
async function readEmbeddedProfile(appPath, options = {}) {
|
|
322
|
+
throwIfCancelled(options.signal, "iOS signing");
|
|
323
|
+
const path = join(appPath, EMBEDDED_PROFILE);
|
|
324
|
+
if (!existsSync(path)) return {
|
|
325
|
+
present: false,
|
|
326
|
+
profile: null
|
|
327
|
+
};
|
|
328
|
+
const plist = await decodeProvisioningProfile(path, options);
|
|
329
|
+
return {
|
|
330
|
+
present: true,
|
|
331
|
+
profile: plist === null ? null : parseProvisioningProfilePlist(plist)
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
async function decodeProvisioningProfile(path, options = {}) {
|
|
335
|
+
try {
|
|
336
|
+
return await signingCommand("/usr/bin/openssl", [
|
|
337
|
+
"smime",
|
|
338
|
+
"-verify",
|
|
339
|
+
"-noverify",
|
|
340
|
+
"-inform",
|
|
341
|
+
"DER",
|
|
342
|
+
"-in",
|
|
343
|
+
path
|
|
344
|
+
], options);
|
|
345
|
+
} catch {
|
|
346
|
+
throwIfCancelled(options.signal, "iOS signing");
|
|
347
|
+
return null;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
async function findSigningIdentities(options = {}) {
|
|
351
|
+
return await probeSigningIdentities(options) ?? [];
|
|
352
|
+
}
|
|
353
|
+
/** The keychain's code signing identities, or null when `security find-identity` itself failed. */
|
|
354
|
+
async function probeSigningIdentities(options = {}) {
|
|
355
|
+
try {
|
|
356
|
+
return parseSigningIdentities(await signingCommand("security", [
|
|
357
|
+
"find-identity",
|
|
358
|
+
"-v",
|
|
359
|
+
"-p",
|
|
360
|
+
"codesigning"
|
|
361
|
+
], options));
|
|
362
|
+
} catch {
|
|
363
|
+
throwIfCancelled(options.signal, "iOS signing");
|
|
364
|
+
return null;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
async function gateProfileForDevice(options) {
|
|
368
|
+
const read = await readEmbeddedProfile(options.appPath, options);
|
|
369
|
+
return profileGate({
|
|
370
|
+
profilePresent: read.present,
|
|
371
|
+
profile: read.profile,
|
|
372
|
+
identities: [],
|
|
373
|
+
udid: options.udid,
|
|
374
|
+
configuration: options.configuration ?? null,
|
|
375
|
+
...options.now === void 0 ? {} : { now: options.now }
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
async function gateAppForDevice(options) {
|
|
379
|
+
const read = await readEmbeddedProfile(options.appPath, options);
|
|
380
|
+
return signingGate({
|
|
381
|
+
profilePresent: read.present,
|
|
382
|
+
profile: read.profile,
|
|
383
|
+
identities: read.present ? await findSigningIdentities(options) : [],
|
|
384
|
+
udid: options.udid,
|
|
385
|
+
configuration: options.configuration ?? null,
|
|
386
|
+
pinnedName: options.pinnedName ?? null,
|
|
387
|
+
pinnedSha1: options.pinnedSha1 ?? null,
|
|
388
|
+
...options.now === void 0 ? {} : { now: options.now }
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
async function extractEntitlements(appPath, options) {
|
|
392
|
+
try {
|
|
393
|
+
return String(await signingCommand("codesign", [
|
|
394
|
+
"-d",
|
|
395
|
+
"--entitlements",
|
|
396
|
+
"-",
|
|
397
|
+
"--xml",
|
|
398
|
+
appPath
|
|
399
|
+
], options)).trim();
|
|
400
|
+
} catch {
|
|
401
|
+
throwIfCancelled(options.signal, "iOS signing");
|
|
402
|
+
return "";
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
async function resealBundle({ appPath, identity, ...options }) {
|
|
406
|
+
const signAs = identity.sha1 || identity.name;
|
|
407
|
+
let mode = "preserve-metadata";
|
|
408
|
+
let preserveError = null;
|
|
409
|
+
try {
|
|
410
|
+
await signingCommand("codesign", [
|
|
411
|
+
"--force",
|
|
412
|
+
"--sign",
|
|
413
|
+
signAs,
|
|
414
|
+
"--preserve-metadata=identifier,entitlements,flags,runtime",
|
|
415
|
+
appPath
|
|
416
|
+
], options);
|
|
417
|
+
} catch (error) {
|
|
418
|
+
throwIfCancelled(options.signal, "iOS signing");
|
|
419
|
+
preserveError = error;
|
|
420
|
+
}
|
|
421
|
+
let tempDir = null;
|
|
422
|
+
if (preserveError) {
|
|
423
|
+
const entitlements = await extractEntitlements(appPath, options);
|
|
424
|
+
const args = [
|
|
425
|
+
"--force",
|
|
426
|
+
"--sign",
|
|
427
|
+
signAs
|
|
428
|
+
];
|
|
429
|
+
if (entitlements !== "") {
|
|
430
|
+
tempDir = mkdtempSync(join(tmpdir(), "stim-entitlements-"));
|
|
431
|
+
const plist = join(tempDir, "entitlements.plist");
|
|
432
|
+
writeFileSync(plist, `${entitlements}\n`, "utf-8");
|
|
433
|
+
args.push("--entitlements", plist);
|
|
434
|
+
mode = "entitlements";
|
|
435
|
+
} else mode = "no-entitlements";
|
|
436
|
+
args.push(appPath);
|
|
437
|
+
try {
|
|
438
|
+
await signingCommand("codesign", args, options);
|
|
439
|
+
} catch (error) {
|
|
440
|
+
throwIfCancelled(options.signal, "iOS signing");
|
|
441
|
+
return {
|
|
442
|
+
ok: false,
|
|
443
|
+
code: SIGNING_CODES.codesignFailed,
|
|
444
|
+
reason: `codesign could not re-seal ${appPath} with "${identity.name}": ${errorText(error)}`,
|
|
445
|
+
remedy: `Unlock the login keychain (\`security unlock-keychain\`) and confirm exactly one identity matches "${identity.name}".`,
|
|
446
|
+
lastLines: [...lastLines(errorText(preserveError)), ...lastLines(errorText(error))]
|
|
447
|
+
};
|
|
448
|
+
} finally {
|
|
449
|
+
if (tempDir) rmSync(tempDir, {
|
|
450
|
+
recursive: true,
|
|
451
|
+
force: true
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
try {
|
|
456
|
+
await signingCommand("codesign", [
|
|
457
|
+
"--verify",
|
|
458
|
+
"--strict",
|
|
459
|
+
appPath
|
|
460
|
+
], options);
|
|
461
|
+
} catch (error) {
|
|
462
|
+
throwIfCancelled(options.signal, "iOS signing");
|
|
463
|
+
return {
|
|
464
|
+
ok: false,
|
|
465
|
+
code: SIGNING_CODES.codesignFailed,
|
|
466
|
+
reason: `codesign --verify --strict rejected ${appPath} after re-sealing it with "${identity.name}": ${errorText(error)}`,
|
|
467
|
+
remedy: "The bundle signed but did not seal. Delete the cached artifact with `stim gc --delete` and build fresh, then retry.",
|
|
468
|
+
lastLines: lastLines(errorText(error))
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
return {
|
|
472
|
+
ok: true,
|
|
473
|
+
identity,
|
|
474
|
+
mode
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
async function sealAppForDevice(options) {
|
|
478
|
+
const gate = await gateAppForDevice(options);
|
|
479
|
+
if (!gate.ok) return {
|
|
480
|
+
...gate,
|
|
481
|
+
lastLines: []
|
|
482
|
+
};
|
|
483
|
+
return resealBundle({
|
|
484
|
+
...options,
|
|
485
|
+
identity: gate.identity
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
//#endregion
|
|
489
|
+
export { sealAppForDevice as a, probeSigningIdentities as i, findSigningIdentities as n, parsePlist as o, gateProfileForDevice as r, parseProvisioningProfilePlist as s, decodeProvisioningProfile as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as updateWorkspaceState, r as readWorkspaceState$1 } from "./workspace-state-U08dEzhG.mjs";
|
|
2
2
|
import { HOSTED_METRO_REQUESTS_KEY, hostedMetroRequests, hostedNativeRecords, isJsonObject, parseHostedNativePlacement, unreadableHostedNative } from "@stim-cli/core/state";
|
|
3
3
|
//#region src/device-host/ios-state.ts
|
|
4
4
|
function readHostedNative(root, platform, slot) {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { t as getExecutor } from "./exec-
|
|
2
|
-
import { Ft as makeTemporaryDirectory, It as removeTemporaryEntry } from "./settings-B717odTD.mjs";
|
|
1
|
+
import { d as spawnDeclared, m as operationState, t as getExecutor } from "./exec-DEoAhcze.mjs";
|
|
3
2
|
import { r as waitForChild, t as createLineReader } from "./process-output-Fpl8PYi8.mjs";
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
3
|
+
import { a as killOnAbort, f as throwIfCancelled, t as runOperationFile } from "./operation-exec-BW0em61G.mjs";
|
|
4
|
+
import { Ht as makeTemporaryDirectory, Ut as removeTemporaryEntry } from "./settings-C7O8A6ZI.mjs";
|
|
5
|
+
import { Xn as bundleInvocation } from "./budget-Cvwn54qV.mjs";
|
|
6
|
+
import { t as cleanLine } from "./server-expo-CrjB29pq.mjs";
|
|
7
|
+
import { _ as tailLines, h as startBuildHeartbeat, r as HEARTBEAT_INTERVAL_MS } from "./xcode-BXn9-xYx.mjs";
|
|
8
|
+
import { randomUUID } from "node:crypto";
|
|
6
9
|
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
7
10
|
import { basename, join } from "node:path";
|
|
8
|
-
import { randomUUID } from "node:crypto";
|
|
9
11
|
//#region src/engine/js-swap.ts
|
|
10
12
|
const JS_BUNDLE_NAME = "main.jsbundle";
|
|
11
13
|
const LAST_LINES = 5;
|
|
@@ -107,9 +109,9 @@ function assetCatalogTarget(infoPlist) {
|
|
|
107
109
|
targetDevices: targetDevices.length ? targetDevices : ["iphone"]
|
|
108
110
|
};
|
|
109
111
|
}
|
|
110
|
-
function readPlistKey(e, plist, key, format) {
|
|
112
|
+
async function readPlistKey(context, e, plist, key, format) {
|
|
111
113
|
try {
|
|
112
|
-
return e
|
|
114
|
+
return await runOperationFile(context, e, "plutil", [
|
|
113
115
|
"-extract",
|
|
114
116
|
key,
|
|
115
117
|
format,
|
|
@@ -122,14 +124,14 @@ function readPlistKey(e, plist, key, format) {
|
|
|
122
124
|
throw err;
|
|
123
125
|
}
|
|
124
126
|
}
|
|
125
|
-
function readAssetCatalogTarget(e, plist) {
|
|
126
|
-
const flag = readPlistKey(e, plist, "RCTUseAssetCatalog", "raw");
|
|
127
|
+
async function readAssetCatalogTarget(context, e, plist) {
|
|
128
|
+
const flag = await readPlistKey(context, e, plist, "RCTUseAssetCatalog", "raw");
|
|
127
129
|
if (flag === null) return null;
|
|
128
|
-
const families = readPlistKey(e, plist, "UIDeviceFamily", "json");
|
|
130
|
+
const families = await readPlistKey(context, e, plist, "UIDeviceFamily", "json");
|
|
129
131
|
return assetCatalogTarget({
|
|
130
132
|
RCTUseAssetCatalog: flag,
|
|
131
|
-
DTPlatformName: readPlistKey(e, plist, "DTPlatformName", "raw"),
|
|
132
|
-
MinimumOSVersion: readPlistKey(e, plist, "MinimumOSVersion", "raw"),
|
|
133
|
+
DTPlatformName: await readPlistKey(context, e, plist, "DTPlatformName", "raw"),
|
|
134
|
+
MinimumOSVersion: await readPlistKey(context, e, plist, "MinimumOSVersion", "raw"),
|
|
133
135
|
UIDeviceFamily: families === null ? void 0 : JSON.parse(families)
|
|
134
136
|
});
|
|
135
137
|
}
|
|
@@ -206,7 +208,7 @@ function hermescArgs({ bundle, out }) {
|
|
|
206
208
|
bundle
|
|
207
209
|
];
|
|
208
210
|
}
|
|
209
|
-
async function swapJsBundle({ root, iosDir, isExpo, cachedAppPath, logWriter = null, exec = null, spawnFn = null, mkdtemp = () => makeTemporaryDirectory(cachedAppPath, "stim-js-swap-"), exists = existsSync, hermesEnabled = null, now = Date.now, heartbeatMs = HEARTBEAT_INTERVAL_MS, onHeartbeat = (line) => console.error(line) }) {
|
|
211
|
+
async function swapJsBundle({ context, root, iosDir, isExpo, cachedAppPath, logWriter = null, exec = null, spawnFn = null, mkdtemp = () => makeTemporaryDirectory(cachedAppPath, "stim-js-swap-"), exists = existsSync, hermesEnabled = null, now = Date.now, heartbeatMs = HEARTBEAT_INTERVAL_MS, onHeartbeat = (line) => console.error(line) }) {
|
|
210
212
|
const e = exec || getExecutor();
|
|
211
213
|
const startedAt = now();
|
|
212
214
|
const elapsed = () => now() - startedAt;
|
|
@@ -232,15 +234,16 @@ async function swapJsBundle({ root, iosDir, isExpo, cachedAppPath, logWriter = n
|
|
|
232
234
|
tmp = mkdtemp();
|
|
233
235
|
appCopy = join(tmp, basename(cachedAppPath));
|
|
234
236
|
try {
|
|
235
|
-
e
|
|
237
|
+
await runOperationFile(context, e, "cp", [
|
|
236
238
|
"-c",
|
|
237
239
|
"-R",
|
|
238
240
|
cachedAppPath,
|
|
239
241
|
appCopy
|
|
240
242
|
], { timeoutMs: "unbounded" });
|
|
241
243
|
} catch {
|
|
244
|
+
throwIfCancelled(context ? operationState(context).runSignal ?? context.signal : void 0, "JS swap");
|
|
242
245
|
removeTemporaryEntry(appCopy);
|
|
243
|
-
e
|
|
246
|
+
await runOperationFile(context, e, "cp", [
|
|
244
247
|
"-R",
|
|
245
248
|
cachedAppPath,
|
|
246
249
|
appCopy
|
|
@@ -252,7 +255,7 @@ async function swapJsBundle({ root, iosDir, isExpo, cachedAppPath, logWriter = n
|
|
|
252
255
|
let catalogTarget;
|
|
253
256
|
const infoPlistPath = join(appCopy, "Info.plist");
|
|
254
257
|
try {
|
|
255
|
-
catalogTarget = readAssetCatalogTarget(e, infoPlistPath);
|
|
258
|
+
catalogTarget = await readAssetCatalogTarget(context, e, infoPlistPath);
|
|
256
259
|
} catch (err) {
|
|
257
260
|
return fail("catalog", `could not read ${infoPlistPath}: ${describe(err)}`);
|
|
258
261
|
}
|
|
@@ -299,7 +302,8 @@ async function swapJsBundle({ root, iosDir, isExpo, cachedAppPath, logWriter = n
|
|
|
299
302
|
};
|
|
300
303
|
let child;
|
|
301
304
|
try {
|
|
302
|
-
|
|
305
|
+
const invocation = bundleInvocation(root, isExpo, command.args.slice(1));
|
|
306
|
+
child = spawnDeclared(context, () => spawn(invocation.file, invocation.args, {
|
|
303
307
|
cwd: root,
|
|
304
308
|
stdio: [
|
|
305
309
|
"ignore",
|
|
@@ -307,10 +311,11 @@ async function swapJsBundle({ root, iosDir, isExpo, cachedAppPath, logWriter = n
|
|
|
307
311
|
"pipe"
|
|
308
312
|
],
|
|
309
313
|
env: {
|
|
310
|
-
...process.env,
|
|
314
|
+
...context?.env ?? process.env,
|
|
311
315
|
FORCE_COLOR: "0"
|
|
312
316
|
}
|
|
313
|
-
});
|
|
317
|
+
}));
|
|
318
|
+
killOnAbort(context ? operationState(context).runSignal ?? context.signal : void 0)(child);
|
|
314
319
|
} catch (err) {
|
|
315
320
|
return fail("bundle", `could not run ${command.file} ${command.args[0]}: ${describe(err)}`);
|
|
316
321
|
}
|
|
@@ -350,11 +355,11 @@ async function swapJsBundle({ root, iosDir, isExpo, cachedAppPath, logWriter = n
|
|
|
350
355
|
else {
|
|
351
356
|
const hbc = join(tmp, `${JS_BUNDLE_NAME}.hbc`);
|
|
352
357
|
try {
|
|
353
|
-
e
|
|
358
|
+
await runOperationFile(context, e, hermesc, hermescArgs({
|
|
354
359
|
bundle: bundleOutput,
|
|
355
360
|
out: hbc
|
|
356
361
|
}), { timeoutMs: "unbounded" });
|
|
357
|
-
e
|
|
362
|
+
await runOperationFile(context, e, "mv", [hbc, bundleOutput], { timeoutMs: 3e4 });
|
|
358
363
|
hermes = true;
|
|
359
364
|
} catch (err) {
|
|
360
365
|
return fail("hermesc", `hermesc failed on ${bundleOutput}: ${describe(err)}`);
|
|
@@ -362,8 +367,8 @@ async function swapJsBundle({ root, iosDir, isExpo, cachedAppPath, logWriter = n
|
|
|
362
367
|
}
|
|
363
368
|
}
|
|
364
369
|
try {
|
|
365
|
-
e
|
|
366
|
-
e
|
|
370
|
+
await runOperationFile(context, e, "cp", [bundleOutput, join(appCopy, JS_BUNDLE_NAME)], { timeoutMs: "unbounded" });
|
|
371
|
+
await runOperationFile(context, e, "cp", [
|
|
367
372
|
"-R",
|
|
368
373
|
`${assetsDest}/.`,
|
|
369
374
|
`${appCopy}/`
|
|
@@ -380,7 +385,7 @@ async function swapJsBundle({ root, iosDir, isExpo, cachedAppPath, logWriter = n
|
|
|
380
385
|
});
|
|
381
386
|
if (readdirSync(catalogDir).some((name) => name.endsWith(".imageset"))) {
|
|
382
387
|
mkdirSync(catalogBundle);
|
|
383
|
-
const output = e
|
|
388
|
+
const output = await runOperationFile(context, e, "xcrun", actoolArgs({
|
|
384
389
|
catalog: catalogDir,
|
|
385
390
|
out: catalogBundle,
|
|
386
391
|
target: catalogTarget
|
|
@@ -400,7 +405,7 @@ async function swapJsBundle({ root, iosDir, isExpo, cachedAppPath, logWriter = n
|
|
|
400
405
|
return fail("updates", `could not refresh the expo-updates manifest ${manifest}: ${describe(err)}`);
|
|
401
406
|
}
|
|
402
407
|
try {
|
|
403
|
-
e
|
|
408
|
+
await runOperationFile(context, e, "codesign", [
|
|
404
409
|
"--force",
|
|
405
410
|
"--sign",
|
|
406
411
|
"-",
|