stim 1.18.0 → 1.20.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 +21 -4
- package/dist/{activity-BxnkDZDi.mjs → activity-BrGh9EAI.mjs} +3 -3
- package/dist/{agent-device-usage-output-CZ66YA4T.mjs → agent-device-usage-output-DVyv_hWj.mjs} +7 -7
- package/dist/android-0vv-OruW.mjs +6 -0
- package/dist/android-Brx6EKvJ.mjs +1258 -0
- package/dist/{android-DC3ZLuw0.mjs → android-BsYNR81W.mjs} +103 -45
- package/dist/{android-CBwCNicO.mjs → android-CK3fpEyZ.mjs} +2 -2
- package/dist/{android-cas-BBFyr9CA.mjs → android-cas-DCAuXryb.mjs} +9 -5
- package/dist/android-cas-compiler.mjs +1 -1
- package/dist/api-run.mjs +159 -8
- package/dist/{api-D0VtFhqk.mjs → api-zuX3ynYN.mjs} +9 -7
- package/dist/api.d.mts +104 -4
- package/dist/api.mjs +1 -1
- package/dist/{app-install-D-PUENug.mjs → app-install-0LgaQRT7.mjs} +39 -18
- package/dist/artifact-CnC0mfov.mjs +807 -0
- package/dist/artifact-DClXJNWx.mjs +772 -0
- package/dist/artifact-lifecycle-DzPpBYvK.mjs +30 -0
- package/dist/{web-DTU0uiWj.mjs → browser-web-CzBmhmgs.mjs} +136 -174
- package/dist/{budget-DIhL2BKx.mjs → budget-BONq9vXY.mjs} +3096 -3244
- package/dist/build-BixRI6sB.mjs +462 -0
- package/dist/build-plan-CP0tckNU.mjs +553 -0
- package/dist/{cache-manifest-BI7ozfmH.mjs → cache-manifest-qA3dT2x2.mjs} +1 -1
- package/dist/cache-manifest.mjs +1 -1
- package/dist/ccache-CjHQ5F8g.mjs +142 -0
- package/dist/{chrome-DJnmnS5q.mjs → chrome-Dp2lMLBe.mjs} +1 -1
- package/dist/{cli-DNJMwADx.mjs → cli-B2R8wH1F.mjs} +20 -20
- package/dist/cli.mjs +1 -1
- package/dist/{client-DzhapoMB.mjs → client-BLy1Pw2V.mjs} +172 -165
- package/dist/collector-run.d.mts +10 -0
- package/dist/collector-run.mjs +7 -7
- package/dist/{command-output-CBtzyIgF.mjs → command-output-BjPN99ZB.mjs} +2 -2
- package/dist/{config-CgYMahz7.mjs → config-D0LhTY3S.mjs} +13 -13
- package/dist/{created-devices-DKbeWsiK.mjs → created-devices-HU_DAb_Q.mjs} +7 -6
- package/dist/{dependency-state-xKoOypBm.mjs → dependency-state-B2m8eqsS.mjs} +2 -2
- package/dist/{detached-entry-BLfcgc4O.mjs → detached-entry-BXq4fIl-.mjs} +1 -1
- package/dist/{dev-client-CLnIH02x.mjs → dev-client-ClATaJoH.mjs} +2 -2
- package/dist/{device-D7oCHGWi.mjs → device-B7lsC0K1.mjs} +8 -8
- package/dist/device-DVCwAFlX.mjs +727 -0
- package/dist/{device-capacity-EUOOYr8T.mjs → device-capacity-Ca_ke1LE.mjs} +25 -15
- package/dist/device-host-worker.mjs +38 -18
- package/dist/{device-ios-6MewKKnc.mjs → device-ios-CRUqPxKw.mjs} +12 -11
- package/dist/{device-lease-Co-EwifR.mjs → device-lease-DHOBXGgS.mjs} +135 -22
- package/dist/{device-lease-run-w1xhCqIW.mjs → device-lease-run-CvDeHTkG.mjs} +4 -4
- package/dist/{device-pool-F5WvRPtD.mjs → device-pool-L2-5GxMy.mjs} +3 -3
- package/dist/{device-remote-tHbd1fKy.mjs → device-remote-Bmg42063.mjs} +17 -69
- package/dist/doctor-C2MSuMMg.mjs +515 -0
- package/dist/{doctor-B9ckYUoU.mjs → doctor-DPAqhVCK.mjs} +334 -721
- package/dist/doctor-watchman-CB4NnVZm.mjs +260 -0
- package/dist/{simslim-EHBQ2R4G.mjs → eas-build-Dw_ec2Km.mjs} +6 -152
- package/dist/{stim-installations-aR_WsNOA.mjs → eas-session-ledger-DZlC-Fq3.mjs} +57 -4
- package/dist/{error-diagnostics-BRXOqDzG.mjs → error-diagnostics-Du7I_GuY.mjs} +17 -12
- package/dist/errors-DzkMYh8Q.mjs +205 -0
- package/dist/{exec-DWhCZDGm.mjs → exec-B81Qodjn.mjs} +69 -15
- package/dist/{gc-Dh6mXOKC.mjs → gc-PWp34zGb.mjs} +23 -22
- package/dist/{gradle-C6GKnunQ.mjs → gradle-C2OEKCCI.mjs} +50 -125
- package/dist/{guide-tm6igAaa.mjs → guide-Dai9lphv.mjs} +862 -538
- package/dist/{hosted-android-Bv285t_t.mjs → hosted-android-DQ-Agsd8.mjs} +5 -5
- package/dist/{hosted-client-C-rMtppF.mjs → hosted-client-Io01s5By.mjs} +9 -3
- package/dist/{hosted-ios-D5mNmtj4.mjs → hosted-ios-DIxFnYp-.mjs} +3 -3
- package/dist/{hosted-logs-DN8Iz4mJ.mjs → hosted-logs-DP-ABU_M.mjs} +8 -8
- package/dist/{hosted-macos-B-wEjlwG.mjs → hosted-macos-Aziw9T_9.mjs} +7 -6
- package/dist/{hosted-native-DeeOG8xZ.mjs → hosted-native-BdAQi21M.mjs} +23 -16
- package/dist/{idle-shutdown-jjtxAn5C.mjs → idle-shutdown-DdMqoSUB.mjs} +7 -7
- package/dist/ios-BZ9dg2Fr.mjs +9 -0
- package/dist/{ios-B3SbOWdw.mjs → ios-CXLIUxXJ.mjs} +180 -24
- package/dist/ios-CZuv6gRv.mjs +1112 -0
- package/dist/{ios-Bvbf0SGY.mjs → ios-VGvNdsv2.mjs} +1 -1
- package/dist/{ios-device-Bn7jWDB1.mjs → ios-device-B1B14xND.mjs} +1 -1
- package/dist/{ios-device-vOaByMhw.mjs → ios-device-BreZOpM0.mjs} +3 -3
- package/dist/ios-project-B9drt_aY.mjs +197 -0
- package/dist/{ios-state-B2pES6Vs.mjs → ios-state-CjrL2qv-.mjs} +1 -1
- package/dist/js-swap-C8icNYIY.mjs +432 -0
- package/dist/launch-DxH0THLP.mjs +745 -0
- package/dist/launch-YrbqaIFj.mjs +1530 -0
- package/dist/{launch-verify-hskNcWkZ.mjs → launch-verify-BzRdbuO1.mjs} +26 -7
- package/dist/{logs-1Ylc1Ri6.mjs → logs-DHaRNfg7.mjs} +11 -11
- package/dist/macos-C0iljhsN.mjs +2 -0
- package/dist/{macos-DF6C7wUU.mjs → macos-V_3Ui7g4.mjs} +125 -155
- package/dist/macos-run.mjs +1 -1
- package/dist/maintenance-run.mjs +13 -10
- package/dist/{metro-Dh8T4Ytd.mjs → metro-D_j9sN-B.mjs} +209 -43
- package/dist/{metro-gateway-CEUw9RMH.mjs → metro-gateway-BBJldOdi.mjs} +2 -2
- package/dist/miss-reason-BPAzZS0r.mjs +238 -0
- package/dist/{named-ports-BFIz1Shz.mjs → named-ports-C2lvoPsb.mjs} +12 -5
- package/dist/native-android-lHzaew7r.mjs +226 -0
- package/dist/native-gradle-inputs-BQnIdAlL.mjs +356 -0
- package/dist/{native-runtime-D_603JiC.mjs → native-runtime-BRmWL7ru.mjs} +9 -8
- package/dist/native-xcode-inputs-eutS19jU.mjs +307 -0
- package/dist/native-xcode-ios-DP3cHLwu.mjs +434 -0
- package/dist/{ndjson-LGZAMsqa.mjs → ndjson-GOnbyvso.mjs} +6 -6
- package/dist/offload-worker.d.mts +12 -6
- package/dist/offload-worker.mjs +409 -73
- package/dist/{ownership-D6Se7gg_.mjs → ownership-DXzMMSx6.mjs} +2 -2
- package/dist/{placement-log-BcPhRwR4.mjs → placement-log-reFbjqEr.mjs} +7 -3
- package/dist/plan-BDk2AeY_.mjs +260 -0
- package/dist/plan-placement-D_YYlE6N.mjs +73 -0
- package/dist/{ports-BLTtfBq-.mjs → ports-jzvAJXXL.mjs} +3 -3
- package/dist/{prebuild-juCyreaR.mjs → prebuild-Bw44QxVh.mjs} +4 -4
- package/dist/{preview-D5V07Nrl.mjs → preview-BaBJ72Al.mjs} +51 -34
- package/dist/project-B8_duAzW.mjs +1067 -0
- package/dist/project-plan-BPwbLwQu.mjs +10 -0
- package/dist/{pull-request-u4vp7zmK.mjs → pull-request-vOhLNmIb.mjs} +1 -1
- package/dist/pull-requests.mjs +1 -1
- package/dist/react-native-android-chm1DMlA.mjs +921 -0
- package/dist/react-native-build-oAw6gQeW.mjs +239 -0
- package/dist/react-native-doctor-DYXoh-6I.mjs +78 -0
- package/dist/react-native-ios-SCTK_CT5.mjs +595 -0
- package/dist/{recordings-BAWltsVt.mjs → recordings-Bk-VivUV.mjs} +1 -1
- package/dist/{reload-DvyWzVjJ.mjs → reload-D34GkY78.mjs} +17 -14
- package/dist/remote-BU9UyhCJ.mjs +192 -0
- package/dist/{remote-cache-BGg7aGIZ.mjs → remote-cache-Bsts6f6Y.mjs} +5 -5
- package/dist/result-BDoRk1k3.mjs +186 -0
- package/dist/{run-vhtDgpHO.mjs → run-qvff78hv.mjs} +3 -3
- package/dist/{server-bare-B9E7S1aR.mjs → server-bare-dWjAarki.mjs} +6 -6
- package/dist/server-command-7XIKlWtO.mjs +69 -0
- package/dist/{server-expo-DoBHhuzK.mjs → server-expo-CsYu2aKL.mjs} +107 -82
- package/dist/server-expo-DV43vep4.mjs +2 -0
- package/dist/settings-Bbztm4oV.mjs +1503 -0
- package/dist/{settings-Byp2AQ_E.mjs → settings-CT3E71-i.mjs} +6 -7
- package/dist/{state-lKh8shBp.d.mts → settings-vk3mJGSm.d.mts} +4 -2
- package/dist/settings.schema.json +156 -6
- package/dist/simslim-ChMfe8rg.mjs +149 -0
- package/dist/{slot-launch-C1nqh4mu.mjs → slot-launch-B9hn96wd.mjs} +6 -6
- package/dist/{stage-g_WqWeaE.mjs → stage-BNKKdDNc.mjs} +6 -3
- package/dist/start-CbQCSnXQ.mjs +2 -0
- package/dist/{start-D-IeOyoK.mjs → start-CdvcTaXr.mjs} +113 -77
- package/dist/{state-xnqpx3AD.mjs → state-Boo0IMJq.mjs} +4 -2
- package/dist/{state-BG-aAk4k.mjs → state-DI84A-uu.mjs} +29 -10
- package/dist/{stats-DY6ekz8F.mjs → stats-BIIDrjA8.mjs} +6 -6
- package/dist/{status-BEeL6IKz.mjs → status-BDGHwkCs.mjs} +3 -1
- package/dist/{status-DCjZeE-K.mjs → status-DARMkc9q.mjs} +80 -294
- package/dist/status-watch-DvmI3SmN.mjs +296 -0
- package/dist/{stim-desktop-Behws_fi.mjs → stim-desktop-8GQX2OV8.mjs} +1 -1
- package/dist/{stop-DIJtD2GL.mjs → stop-CCZS-C9m.mjs} +2 -2
- package/dist/stop-WQPQHLuy.mjs +72 -0
- package/dist/{stop-BTjs3xbc.mjs → stop-iNemHsJC.mjs} +81 -33
- package/dist/supervisor-run.d.mts +7 -2
- package/dist/supervisor-run.mjs +32 -20
- package/dist/{support-Bwvbrq5-.mjs → support-CnE_SIjt.mjs} +17 -7
- package/dist/{support-BaayeYCf.mjs → support-DCco5fut.mjs} +61 -8
- package/dist/swiftpm-macos-afeNUExW.mjs +119 -0
- package/dist/{native-run-B06FkmZx.mjs → tailnet-CoJUb2tB.mjs} +113 -6
- package/dist/toolchain-BIupIro1.mjs +2 -0
- package/dist/{toolchain-Bnyd_K3A.mjs → toolchain-DqyDXs30.mjs} +225 -315
- package/dist/{trigger-CJMhwXe8.mjs → trigger-C0MWBi8O.mjs} +3 -3
- package/dist/trigger-SHLOWJ4O.mjs +2 -0
- package/dist/{warm-progress-CjB-MP6H.mjs → warm-progress-C3ASD6z5.mjs} +134 -37
- package/dist/{status-Dcr0Qexd.mjs → watchman-CQl51YZu.mjs} +75 -7
- package/dist/web-B3eldHFH.mjs +123 -0
- package/dist/web-BLXpOe6b.mjs +2 -0
- package/dist/web-run.mjs +10 -10
- package/dist/{workspace-state-C59dqG-Z.mjs → workspace-state-CSIFuuDa.mjs} +33 -33
- package/dist/{workspaces-xXItD8Dj.mjs → workspaces-D2xSHBDY.mjs} +1297 -1211
- package/dist/{worktree-BSYlofkq.mjs → worktree-BxDqaTev.mjs} +102 -63
- package/dist/worktree-q7_OZNY0.mjs +2 -0
- package/package.json +8 -6
- package/shim/bundle-response.cjs +2 -1
- package/shim/bundle-response.d.cts +1 -1
- package/shim/expo-metro-config.cjs +1 -1
- package/shim/native-android.gradle +101 -0
- package/dist/android-BKA16DTf.mjs +0 -4
- package/dist/android-BvwuMUJ9.mjs +0 -3572
- package/dist/guide-status-Bhf9SJXc.mjs +0 -125
- package/dist/ios-CPdkoKaa.mjs +0 -3953
- package/dist/ios-DNpdygiv.mjs +0 -7
- package/dist/macos-Ck7OBMNY.mjs +0 -2
- package/dist/metro-store-BAHFcJm6.mjs +0 -106
- package/dist/plan-placement-CtxkCO54.mjs +0 -1859
- package/dist/project-C3ChRLZy.mjs +0 -212
- package/dist/projects-DD7dBTCj.mjs +0 -92
- package/dist/server-expo-Db9HBUoa.mjs +0 -2
- package/dist/settings-CQyMElEP.mjs +0 -701
- package/dist/start-NTc1Ifqs.mjs +0 -2
- package/dist/stop-BGhKMOuH.mjs +0 -48
- package/dist/trigger-DWAq9hkw.mjs +0 -2
- package/dist/web-B6_bFDn7.mjs +0 -2
- package/dist/worktree-BJfnU6r5.mjs +0 -2
- package/dist/worktree-CsKYexJM.mjs +0 -753
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as getExecutor } from "./exec-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { t as getExecutor } from "./exec-B81Qodjn.mjs";
|
|
2
|
+
import { n as TOOL_ERROR_PREFIX } from "./ios-device-B1B14xND.mjs";
|
|
3
|
+
import { i as INSTALL_ERROR } from "./app-install-0LgaQRT7.mjs";
|
|
4
4
|
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
|
|
5
5
|
import { join } from "node:path";
|
|
6
6
|
import { tmpdir } from "node:os";
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { y as workspaceAgentDeviceDir } from "./workspace-state-CSIFuuDa.mjs";
|
|
2
|
+
import { i as formatDuration, l as phaseLine } from "./command-output-BjPN99ZB.mjs";
|
|
3
|
+
import { i as workspaceLinkLine } from "./stim-desktop-8GQX2OV8.mjs";
|
|
4
|
+
import { Dt as recordFinishedBuild } from "./budget-BONq9vXY.mjs";
|
|
5
|
+
import { a as easAuthNote, n as UPLOAD_TIMEOUT_MS, r as cacheLevel, s as isEasAuthFailureText } from "./remote-cache-Bsts6f6Y.mjs";
|
|
6
|
+
import "./launch-verify-BzRdbuO1.mjs";
|
|
7
|
+
import { S as compilationCacheActivityLine, _ as COMPILATION_CACHE_NOT_RUN } from "./toolchain-DqyDXs30.mjs";
|
|
8
|
+
import { i as deviceLabel } from "./support-DCco5fut.mjs";
|
|
9
|
+
import { buildDiagnostics } from "@stim-cli/core/state";
|
|
10
|
+
import chalk from "chalk";
|
|
11
|
+
//#region src/commands/ios/result.ts
|
|
12
|
+
function lastBuildRecord({ devicePlacement, fingerprint = null, cacheKey = null, cacheHit = false, cacheSkipped = false, durationMs = 0, appPath = null, bundleId = null, startedAt, status, errorCode = null, missReason = null, diagnostics = null, configuration = null, buildMachine = "auto", builtOn, offloadedTo = null, offloadFallback = null }) {
|
|
13
|
+
const record = {
|
|
14
|
+
platform: "ios",
|
|
15
|
+
fingerprint,
|
|
16
|
+
cacheKey,
|
|
17
|
+
cacheHit: cacheLevel(cacheHit),
|
|
18
|
+
cacheSkipped: Boolean(cacheSkipped),
|
|
19
|
+
durationMs,
|
|
20
|
+
appPath,
|
|
21
|
+
bundleId,
|
|
22
|
+
startedAt,
|
|
23
|
+
status,
|
|
24
|
+
configuration
|
|
25
|
+
};
|
|
26
|
+
if (errorCode) record.errorCode = errorCode;
|
|
27
|
+
if (devicePlacement) record.devicePlacement = devicePlacement;
|
|
28
|
+
record.buildMachine = buildMachine;
|
|
29
|
+
if (builtOn) record.builtOn = builtOn;
|
|
30
|
+
if (offloadedTo) record.offloadedTo = offloadedTo;
|
|
31
|
+
if (offloadFallback) record.offloadFallback = offloadFallback;
|
|
32
|
+
if (missReason && !cacheLevel(cacheHit)) record.missReason = missReason;
|
|
33
|
+
const recorded = status === "failed" ? buildDiagnostics(diagnostics) : [];
|
|
34
|
+
if (recorded.length) record.diagnostics = recorded;
|
|
35
|
+
return record;
|
|
36
|
+
}
|
|
37
|
+
function iosFacts({ root, slot, udid, deviceName, deviceType = null, runtime = null, fingerprint, configuration = null, scheme = null, cacheKey, cacheHit, cacheSkipped = false, compilationCache = COMPILATION_CACHE_NOT_RUN, waitedForBuild = null, appPath, bundleId, installSkipped = false, metroPort, logsDir, durationMs, launched = true, webPreviewUrl = null, lease, devServer = null, buildMachine = "auto", builtOn, offloadedTo = null, offloadFallback = null }) {
|
|
38
|
+
return {
|
|
39
|
+
platform: "ios",
|
|
40
|
+
...slot && slot !== "default" ? { slot } : {},
|
|
41
|
+
udid,
|
|
42
|
+
deviceName: deviceName ?? null,
|
|
43
|
+
deviceType: deviceType ?? null,
|
|
44
|
+
runtime: runtime ?? null,
|
|
45
|
+
fingerprint,
|
|
46
|
+
configuration: configuration ?? null,
|
|
47
|
+
...scheme ? { scheme } : {},
|
|
48
|
+
cacheKey,
|
|
49
|
+
cacheHit: cacheLevel(cacheHit),
|
|
50
|
+
cacheSkipped: Boolean(cacheSkipped),
|
|
51
|
+
buildMachine,
|
|
52
|
+
...builtOn ? { builtOn } : {},
|
|
53
|
+
...offloadedTo ? { offloadedTo } : {},
|
|
54
|
+
...offloadFallback ? { offloadFallback } : {},
|
|
55
|
+
compilationCache,
|
|
56
|
+
waitedForBuild: waitedForBuild ? {
|
|
57
|
+
pid: waitedForBuild.pid ?? null,
|
|
58
|
+
ms: waitedForBuild.ms ?? 0
|
|
59
|
+
} : null,
|
|
60
|
+
appPath,
|
|
61
|
+
bundleId,
|
|
62
|
+
installSkipped: Boolean(installSkipped),
|
|
63
|
+
launched: launched === "unverified" || launched === "bundling" ? launched : Boolean(launched),
|
|
64
|
+
metroPort,
|
|
65
|
+
logs: { dir: logsDir },
|
|
66
|
+
...root ? { agentDevice: { stateDir: workspaceAgentDeviceDir(root) } } : {},
|
|
67
|
+
durationMs,
|
|
68
|
+
...webPreviewUrl ? { webPreviewUrl } : {},
|
|
69
|
+
...lease === void 0 ? {} : { lease },
|
|
70
|
+
...devServer ? { devServer } : {}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function writeLastBuild(root, record, { record: recordBuild = recordFinishedBuild } = {}) {
|
|
74
|
+
try {
|
|
75
|
+
recordBuild(root, record);
|
|
76
|
+
} catch {}
|
|
77
|
+
return record;
|
|
78
|
+
}
|
|
79
|
+
async function finishIosUpload(uploadPending, remote, phase, note) {
|
|
80
|
+
if (!uploadPending) return false;
|
|
81
|
+
const upload = await uploadPending;
|
|
82
|
+
if (upload?.uploaded) phase("cache", `uploaded (${remote?.name})`);
|
|
83
|
+
else if (upload?.timedOut) {
|
|
84
|
+
note(chalk.yellow(phaseLine("cache", `${remote?.name} upload still running after ${formatDuration(UPLOAD_TIMEOUT_MS)}; not waiting`)));
|
|
85
|
+
return true;
|
|
86
|
+
} else if (upload?.failed) {
|
|
87
|
+
const authNote = remote?.name === "eas" && isEasAuthFailureText(upload.failed) ? easAuthNote({
|
|
88
|
+
code: "logged-out",
|
|
89
|
+
reason: upload.failed,
|
|
90
|
+
phase: "upload"
|
|
91
|
+
}) : null;
|
|
92
|
+
note(chalk.yellow(phaseLine("cache", authNote || `${remote?.name} upload failed: ${upload.failed}`)));
|
|
93
|
+
}
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
function reportIosResult({ devicePlacement, host, slot, root, json, release, runtimeKind = release ? "embedded-js" : "metro", configuration, buildScheme = null, metroCheck, metroPort, logsDir, device, udid, appPath, bundleId, installSkipped, elapsed, startedAt, storeHash, storeKey, cacheHit, missReason, compilationCache, useBuildCache, waitedForBuild, launchState, launchWarning, providerName, buildMachine = "auto", builtOn, offloadedTo = null, offloadFallback = null, closeWriter, webPreviewUrl, lease, recordRun, reclaimed = [], devServer = null, links }) {
|
|
97
|
+
const durationMs = elapsed();
|
|
98
|
+
recordRun({
|
|
99
|
+
failed: false,
|
|
100
|
+
cacheHit,
|
|
101
|
+
waited: waitedForBuild,
|
|
102
|
+
durationMs,
|
|
103
|
+
offloadedTo
|
|
104
|
+
});
|
|
105
|
+
writeLastBuild(root, lastBuildRecord({
|
|
106
|
+
devicePlacement,
|
|
107
|
+
fingerprint: storeHash,
|
|
108
|
+
cacheKey: storeKey,
|
|
109
|
+
cacheHit,
|
|
110
|
+
cacheSkipped: !useBuildCache,
|
|
111
|
+
missReason,
|
|
112
|
+
durationMs,
|
|
113
|
+
appPath,
|
|
114
|
+
bundleId,
|
|
115
|
+
startedAt,
|
|
116
|
+
status: "ok",
|
|
117
|
+
configuration: configuration ?? "Debug",
|
|
118
|
+
buildMachine,
|
|
119
|
+
builtOn,
|
|
120
|
+
offloadedTo,
|
|
121
|
+
offloadFallback
|
|
122
|
+
}));
|
|
123
|
+
closeWriter();
|
|
124
|
+
const facts = iosFacts({
|
|
125
|
+
root,
|
|
126
|
+
slot,
|
|
127
|
+
udid,
|
|
128
|
+
deviceName: device?.deviceName ?? null,
|
|
129
|
+
deviceType: device?.deviceType,
|
|
130
|
+
runtime: device?.runtime,
|
|
131
|
+
fingerprint: storeHash,
|
|
132
|
+
configuration,
|
|
133
|
+
scheme: buildScheme,
|
|
134
|
+
cacheKey: storeKey,
|
|
135
|
+
cacheHit,
|
|
136
|
+
compilationCache,
|
|
137
|
+
cacheSkipped: !useBuildCache,
|
|
138
|
+
waitedForBuild,
|
|
139
|
+
appPath,
|
|
140
|
+
bundleId,
|
|
141
|
+
installSkipped,
|
|
142
|
+
metroPort,
|
|
143
|
+
logsDir,
|
|
144
|
+
durationMs,
|
|
145
|
+
launched: launchState,
|
|
146
|
+
webPreviewUrl,
|
|
147
|
+
lease,
|
|
148
|
+
devServer,
|
|
149
|
+
buildMachine,
|
|
150
|
+
builtOn,
|
|
151
|
+
offloadedTo,
|
|
152
|
+
offloadFallback
|
|
153
|
+
});
|
|
154
|
+
if (devicePlacement) facts.devicePlacement = devicePlacement;
|
|
155
|
+
if (host) facts.host = host;
|
|
156
|
+
if (json) console.log(JSON.stringify({
|
|
157
|
+
...facts,
|
|
158
|
+
...links ? { links } : {},
|
|
159
|
+
...reclaimed.length ? { reclaimed } : {}
|
|
160
|
+
}));
|
|
161
|
+
else {
|
|
162
|
+
const summary = `${launchWarning ? "WARNING" : "OK"}: ${bundleId} on ${host ? `${device.deviceName} (iOS ${device.runtime?.replace(/^iOS /, "")}) on ${host.machine}` : deviceLabel(device, udid)}, ` + (runtimeKind === "process" ? `${configuration ?? "Debug"} (native process, no Metro)` : runtimeKind === "embedded-js" ? `${configuration} (embedded JS, no Metro)` : `Metro port ${metroPort}`) + ` (${cacheDescription(cacheHit, providerName, offloadedTo)}, ${formatDuration(durationMs)})`;
|
|
163
|
+
const outcome = launchWarning ? chalk.yellow(`${summary} -- ${launchWarning}`) : launchState === "unverified" ? chalk.yellow(`${summary} -- launch UNVERIFIED`) : launchState === "bundling" ? chalk.green(`${summary} -- bundle requested, still building`) : chalk.green(summary);
|
|
164
|
+
const deviceName = device?.deviceName ?? device?.name ?? udid;
|
|
165
|
+
const cacheResult = useBuildCache ? cacheDescription(cacheHit, providerName, offloadedTo) : `bypassed; ${cacheDescription(false, null, offloadedTo)}`;
|
|
166
|
+
const metroResult = runtimeKind === "process" ? "native process (no Metro)" : runtimeKind === "embedded-js" ? `embedded (${configuration})` : !metroCheck ? `check skipped on port ${metroPort}` : launchState === "unverified" ? `state unverified on port ${metroPort}` : `running on port ${metroPort}${devServer ? ` (started: ${devServer.reason})` : ""}`;
|
|
167
|
+
console.log([
|
|
168
|
+
outcome,
|
|
169
|
+
phaseLine("device", host ? `${deviceName} (iOS ${device.runtime?.replace(/^iOS /, "")}) on ${host.machine}` : `${deviceName} (${udid})`),
|
|
170
|
+
phaseLine("app", bundleId),
|
|
171
|
+
phaseLine(runtimeKind === "process" ? "runtime" : "metro", metroResult),
|
|
172
|
+
phaseLine("cache", cacheResult),
|
|
173
|
+
...compilationCache.status === "not-run" ? [phaseLine("compilation cache", compilationCacheActivityLine(compilationCache))] : [],
|
|
174
|
+
phaseLine("logs", logsDir),
|
|
175
|
+
phaseLine("agent-device", `AGENT_DEVICE_STATE_DIR=${workspaceAgentDeviceDir(root)}`)
|
|
176
|
+
].join("\n"));
|
|
177
|
+
if (facts.webPreviewUrl) console.error(chalk.dim(`Watch this device: ${facts.webPreviewUrl}`));
|
|
178
|
+
if (links) console.error(chalk.dim(workspaceLinkLine(links)));
|
|
179
|
+
}
|
|
180
|
+
return facts;
|
|
181
|
+
}
|
|
182
|
+
function cacheDescription(cacheHit, providerName = null, offloadedTo = null) {
|
|
183
|
+
if (cacheHit === "remote") return `from ${providerName || "the remote cache"}`;
|
|
184
|
+
if (cacheHit === "local") return "from cache";
|
|
185
|
+
return offloadedTo ? `built on ${offloadedTo}` : "built";
|
|
186
|
+
}
|
|
187
|
+
//#endregion
|
|
188
|
+
//#region src/integrations/ios-project.ts
|
|
189
|
+
var IosRecipeRefusal = class extends Error {
|
|
190
|
+
failure;
|
|
191
|
+
constructor(failure) {
|
|
192
|
+
super(failure.message ?? failure.code);
|
|
193
|
+
this.failure = failure;
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
//#endregion
|
|
197
|
+
export { lastBuildRecord as a, iosFacts as i, cacheDescription as n, reportIosResult as o, finishIosUpload as r, writeLastBuild as s, IosRecipeRefusal as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as updateWorkspaceState, r as readWorkspaceState$1 } from "./workspace-state-
|
|
1
|
+
import { a as updateWorkspaceState, r as readWorkspaceState$1 } from "./workspace-state-CSIFuuDa.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) {
|
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
import { t as getExecutor } from "./exec-B81Qodjn.mjs";
|
|
2
|
+
import { Ft as removeTemporaryEntry, Pt as makeTemporaryDirectory } from "./settings-Bbztm4oV.mjs";
|
|
3
|
+
import { r as waitForChild, t as createLineReader } from "./process-output-Fpl8PYi8.mjs";
|
|
4
|
+
import { t as cleanLine } from "./server-expo-CsYu2aKL.mjs";
|
|
5
|
+
import { M as startBuildHeartbeat, P as tailLines, y as HEARTBEAT_INTERVAL_MS } from "./toolchain-DqyDXs30.mjs";
|
|
6
|
+
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
7
|
+
import { basename, join } from "node:path";
|
|
8
|
+
import { randomUUID } from "node:crypto";
|
|
9
|
+
//#region src/engine/js-swap.ts
|
|
10
|
+
const JS_BUNDLE_NAME = "main.jsbundle";
|
|
11
|
+
const LAST_LINES = 5;
|
|
12
|
+
function hermesEnabledFromProperties(text) {
|
|
13
|
+
if (typeof text !== "string") return true;
|
|
14
|
+
let data;
|
|
15
|
+
try {
|
|
16
|
+
data = JSON.parse(text);
|
|
17
|
+
} catch {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
if (!data || typeof data !== "object") return true;
|
|
21
|
+
const raw = data.hermesEnabled;
|
|
22
|
+
return raw !== "false" && raw !== false;
|
|
23
|
+
}
|
|
24
|
+
function readHermesEnabled(iosDir) {
|
|
25
|
+
try {
|
|
26
|
+
return hermesEnabledFromProperties(readFileSync(join(iosDir, "Podfile.properties.json"), "utf-8"));
|
|
27
|
+
} catch {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const ENTRY_CANDIDATES = [
|
|
32
|
+
"index.js",
|
|
33
|
+
"index.ts",
|
|
34
|
+
"index.tsx",
|
|
35
|
+
"index.jsx"
|
|
36
|
+
];
|
|
37
|
+
function pickEntryFile(entries) {
|
|
38
|
+
const names = new Set((Array.isArray(entries) ? entries : []).filter((e) => typeof e === "string"));
|
|
39
|
+
return ENTRY_CANDIDATES.find((c) => names.has(c)) ?? "index.js";
|
|
40
|
+
}
|
|
41
|
+
function detectEntryFile(root) {
|
|
42
|
+
let entries;
|
|
43
|
+
try {
|
|
44
|
+
entries = readdirSync(root);
|
|
45
|
+
} catch {
|
|
46
|
+
return "index.js";
|
|
47
|
+
}
|
|
48
|
+
return pickEntryFile(entries);
|
|
49
|
+
}
|
|
50
|
+
function bundleCommand({ isExpo, entryFile, bundleOutput, assetsDest, assetCatalogDest = null }) {
|
|
51
|
+
const catalogArgs = assetCatalogDest ? ["--asset-catalog-dest", assetCatalogDest] : [];
|
|
52
|
+
if (isExpo) return {
|
|
53
|
+
file: "npx",
|
|
54
|
+
args: [
|
|
55
|
+
"expo",
|
|
56
|
+
"export:embed",
|
|
57
|
+
"--platform",
|
|
58
|
+
"ios",
|
|
59
|
+
"--dev",
|
|
60
|
+
"false",
|
|
61
|
+
"--bundle-output",
|
|
62
|
+
bundleOutput,
|
|
63
|
+
"--assets-dest",
|
|
64
|
+
assetsDest,
|
|
65
|
+
...catalogArgs
|
|
66
|
+
]
|
|
67
|
+
};
|
|
68
|
+
return {
|
|
69
|
+
file: "npx",
|
|
70
|
+
args: [
|
|
71
|
+
"react-native",
|
|
72
|
+
"bundle",
|
|
73
|
+
"--platform",
|
|
74
|
+
"ios",
|
|
75
|
+
"--dev",
|
|
76
|
+
"false",
|
|
77
|
+
"--entry-file",
|
|
78
|
+
entryFile,
|
|
79
|
+
"--bundle-output",
|
|
80
|
+
bundleOutput,
|
|
81
|
+
"--assets-dest",
|
|
82
|
+
assetsDest,
|
|
83
|
+
...catalogArgs
|
|
84
|
+
]
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const ASSET_CATALOG_BUNDLE = "RNAssets.bundle";
|
|
88
|
+
/**
|
|
89
|
+
* Where React Native 0.88+ keeps the app's packager images. With the `RCTUseAssetCatalog` Info.plist
|
|
90
|
+
* key, `react-native-xcode.sh` compiles them with actool into RNAssets.bundle and the native image
|
|
91
|
+
* loader reads only that catalog, so a swap has to rebuild it. Null means loose files under assets/.
|
|
92
|
+
*/
|
|
93
|
+
function assetCatalogTarget(infoPlist) {
|
|
94
|
+
if (!infoPlist || typeof infoPlist !== "object") return null;
|
|
95
|
+
const plist = infoPlist;
|
|
96
|
+
const flag = plist.RCTUseAssetCatalog;
|
|
97
|
+
if (!(flag === true || flag === 1 || typeof flag === "string" && [
|
|
98
|
+
"true",
|
|
99
|
+
"yes",
|
|
100
|
+
"1"
|
|
101
|
+
].includes(flag.toLowerCase()))) return null;
|
|
102
|
+
const families = Array.isArray(plist.UIDeviceFamily) ? plist.UIDeviceFamily : [1];
|
|
103
|
+
const targetDevices = [...families.includes(1) ? ["iphone"] : [], ...families.includes(2) ? ["ipad"] : []];
|
|
104
|
+
return {
|
|
105
|
+
platform: typeof plist.DTPlatformName === "string" ? plist.DTPlatformName : "iphoneos",
|
|
106
|
+
minimumDeploymentTarget: typeof plist.MinimumOSVersion === "string" ? plist.MinimumOSVersion : "15.1",
|
|
107
|
+
targetDevices: targetDevices.length ? targetDevices : ["iphone"]
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function readPlistKey(e, plist, key, format) {
|
|
111
|
+
try {
|
|
112
|
+
return e.runFile("plutil", [
|
|
113
|
+
"-extract",
|
|
114
|
+
key,
|
|
115
|
+
format,
|
|
116
|
+
"-o",
|
|
117
|
+
"-",
|
|
118
|
+
plist
|
|
119
|
+
]);
|
|
120
|
+
} catch (err) {
|
|
121
|
+
if (/No value at that key path/.test(describe(err))) return null;
|
|
122
|
+
throw err;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function readAssetCatalogTarget(e, plist) {
|
|
126
|
+
const flag = readPlistKey(e, plist, "RCTUseAssetCatalog", "raw");
|
|
127
|
+
if (flag === null) return null;
|
|
128
|
+
const families = readPlistKey(e, plist, "UIDeviceFamily", "json");
|
|
129
|
+
return assetCatalogTarget({
|
|
130
|
+
RCTUseAssetCatalog: flag,
|
|
131
|
+
DTPlatformName: readPlistKey(e, plist, "DTPlatformName", "raw"),
|
|
132
|
+
MinimumOSVersion: readPlistKey(e, plist, "MinimumOSVersion", "raw"),
|
|
133
|
+
UIDeviceFamily: families === null ? void 0 : JSON.parse(families)
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function actoolArgs({ catalog, out, target }) {
|
|
137
|
+
return [
|
|
138
|
+
"actool",
|
|
139
|
+
catalog,
|
|
140
|
+
"--compile",
|
|
141
|
+
out,
|
|
142
|
+
"--output-format",
|
|
143
|
+
"human-readable-text",
|
|
144
|
+
"--errors",
|
|
145
|
+
"--warnings",
|
|
146
|
+
"--notices",
|
|
147
|
+
"--platform",
|
|
148
|
+
target.platform,
|
|
149
|
+
"--minimum-deployment-target",
|
|
150
|
+
target.minimumDeploymentTarget,
|
|
151
|
+
...target.targetDevices.flatMap((device) => ["--target-device", device])
|
|
152
|
+
];
|
|
153
|
+
}
|
|
154
|
+
const ASSET_CATALOG_BUNDLE_INFO_PLIST = `<?xml version="1.0" encoding="UTF-8"?>
|
|
155
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
156
|
+
<plist version="1.0">
|
|
157
|
+
<dict>
|
|
158
|
+
<key>CFBundleIdentifier</key>
|
|
159
|
+
<string>org.reactjs.RNAssets</string>
|
|
160
|
+
<key>CFBundleInfoDictionaryVersion</key>
|
|
161
|
+
<string>6.0</string>
|
|
162
|
+
<key>CFBundleName</key>
|
|
163
|
+
<string>RNAssets</string>
|
|
164
|
+
<key>CFBundlePackageType</key>
|
|
165
|
+
<string>BNDL</string>
|
|
166
|
+
</dict>
|
|
167
|
+
</plist>
|
|
168
|
+
`;
|
|
169
|
+
const UPDATES_MANIFEST_NAME = "app.manifest";
|
|
170
|
+
/**
|
|
171
|
+
* expo-updates launches the update with the newest `commitTime` among those built for the binary's
|
|
172
|
+
* runtime version, and the embedded one is only a row in that race. A swapped copy keeps the id and
|
|
173
|
+
* `commitTime` the cached build wrote, so an update downloaded after that build would launch instead
|
|
174
|
+
* of the injected bundle. A full build writes a fresh id and `commitTime`; this does the same.
|
|
175
|
+
*/
|
|
176
|
+
function refreshUpdatesManifest(text, { id, commitTime }) {
|
|
177
|
+
const manifest = JSON.parse(text);
|
|
178
|
+
if (!manifest || typeof manifest !== "object" || Array.isArray(manifest)) throw new Error(`${UPDATES_MANIFEST_NAME} is not a JSON object`);
|
|
179
|
+
return JSON.stringify({
|
|
180
|
+
...manifest,
|
|
181
|
+
id,
|
|
182
|
+
commitTime
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
function refreshUpdatesManifestFile(path, commitTime) {
|
|
186
|
+
writeFileSync(path, refreshUpdatesManifest(readFileSync(path, "utf-8"), {
|
|
187
|
+
id: randomUUID(),
|
|
188
|
+
commitTime
|
|
189
|
+
}));
|
|
190
|
+
}
|
|
191
|
+
const IOS_UPDATES_MANIFESTS = [join("EXUpdates.bundle", UPDATES_MANIFEST_NAME), UPDATES_MANIFEST_NAME];
|
|
192
|
+
const IOS_FRAMEWORK_UPDATES_MANIFEST = join("Frameworks", "EXUpdates.framework", "EXUpdates.bundle", UPDATES_MANIFEST_NAME);
|
|
193
|
+
function hermescPath(root, iosDir, { exists = existsSync } = {}) {
|
|
194
|
+
const candidates = [
|
|
195
|
+
join(root, "node_modules", "hermes-compiler", "hermesc", "osx-bin", "hermesc"),
|
|
196
|
+
join(iosDir, "Pods", "hermes-engine", "destroot", "bin", "hermesc"),
|
|
197
|
+
join(root, "node_modules", "react-native", "sdks", "hermesc", "osx-bin", "hermesc")
|
|
198
|
+
];
|
|
199
|
+
return candidates.find(exists) ?? candidates[candidates.length - 1];
|
|
200
|
+
}
|
|
201
|
+
function hermescArgs({ bundle, out }) {
|
|
202
|
+
return [
|
|
203
|
+
"-emit-binary",
|
|
204
|
+
"-out",
|
|
205
|
+
out,
|
|
206
|
+
bundle
|
|
207
|
+
];
|
|
208
|
+
}
|
|
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) }) {
|
|
210
|
+
const e = exec || getExecutor();
|
|
211
|
+
const startedAt = now();
|
|
212
|
+
const elapsed = () => now() - startedAt;
|
|
213
|
+
let tmp;
|
|
214
|
+
const fail = (step, reason, lastLines = []) => {
|
|
215
|
+
logWriter?.write?.({
|
|
216
|
+
src: "build",
|
|
217
|
+
level: "error",
|
|
218
|
+
msg: `JS swap failed at ${step}: ${reason}`,
|
|
219
|
+
event: "js_swap"
|
|
220
|
+
});
|
|
221
|
+
if (tmp) removeTemporaryEntry(tmp);
|
|
222
|
+
return {
|
|
223
|
+
failed: true,
|
|
224
|
+
step,
|
|
225
|
+
reason,
|
|
226
|
+
lastLines,
|
|
227
|
+
durationMs: elapsed()
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
let appCopy;
|
|
231
|
+
try {
|
|
232
|
+
tmp = mkdtemp();
|
|
233
|
+
appCopy = join(tmp, basename(cachedAppPath));
|
|
234
|
+
try {
|
|
235
|
+
e.runFile("cp", [
|
|
236
|
+
"-c",
|
|
237
|
+
"-R",
|
|
238
|
+
cachedAppPath,
|
|
239
|
+
appCopy
|
|
240
|
+
]);
|
|
241
|
+
} catch {
|
|
242
|
+
removeTemporaryEntry(appCopy);
|
|
243
|
+
e.runFile("cp", [
|
|
244
|
+
"-R",
|
|
245
|
+
cachedAppPath,
|
|
246
|
+
appCopy
|
|
247
|
+
]);
|
|
248
|
+
}
|
|
249
|
+
} catch (err) {
|
|
250
|
+
return fail("copy", `could not copy ${cachedAppPath} aside: ${describe(err)}`);
|
|
251
|
+
}
|
|
252
|
+
let catalogTarget;
|
|
253
|
+
const infoPlistPath = join(appCopy, "Info.plist");
|
|
254
|
+
try {
|
|
255
|
+
catalogTarget = readAssetCatalogTarget(e, infoPlistPath);
|
|
256
|
+
} catch (err) {
|
|
257
|
+
return fail("catalog", `could not read ${infoPlistPath}: ${describe(err)}`);
|
|
258
|
+
}
|
|
259
|
+
const bundleOutput = join(tmp, JS_BUNDLE_NAME);
|
|
260
|
+
const assetsDest = join(tmp, "assets");
|
|
261
|
+
const catalogStaging = catalogTarget ? join(tmp, "rn-assets") : null;
|
|
262
|
+
const catalogDir = catalogStaging ? join(catalogStaging, "RNAssets.xcassets") : null;
|
|
263
|
+
const command = bundleCommand({
|
|
264
|
+
isExpo,
|
|
265
|
+
entryFile: isExpo ? "index.js" : detectEntryFile(root),
|
|
266
|
+
bundleOutput,
|
|
267
|
+
assetsDest,
|
|
268
|
+
assetCatalogDest: catalogStaging
|
|
269
|
+
});
|
|
270
|
+
try {
|
|
271
|
+
mkdirSync(assetsDest, { recursive: true });
|
|
272
|
+
} catch (err) {
|
|
273
|
+
return fail("bundle", `could not create ${assetsDest}: ${describe(err)}`);
|
|
274
|
+
}
|
|
275
|
+
if (catalogDir) try {
|
|
276
|
+
mkdirSync(catalogDir, { recursive: true });
|
|
277
|
+
} catch (err) {
|
|
278
|
+
return fail("bundle", `could not create ${catalogDir}: ${describe(err)}`);
|
|
279
|
+
}
|
|
280
|
+
logWriter?.write?.({
|
|
281
|
+
src: "build",
|
|
282
|
+
level: "info",
|
|
283
|
+
msg: `${command.file} ${command.args.join(" ")}`,
|
|
284
|
+
event: "js_swap"
|
|
285
|
+
});
|
|
286
|
+
const spawn = spawnFn || ((cmd, args, opts) => e.spawn(cmd, args, opts));
|
|
287
|
+
const transcript = [];
|
|
288
|
+
const push = (line) => {
|
|
289
|
+
const msg = cleanLine(line);
|
|
290
|
+
if (msg.trim() === "") return;
|
|
291
|
+
transcript.push(msg);
|
|
292
|
+
logWriter?.write?.({
|
|
293
|
+
src: "build",
|
|
294
|
+
level: "debug",
|
|
295
|
+
msg,
|
|
296
|
+
raw: true,
|
|
297
|
+
event: "js_swap"
|
|
298
|
+
});
|
|
299
|
+
};
|
|
300
|
+
let child;
|
|
301
|
+
try {
|
|
302
|
+
child = spawn(command.file, command.args, {
|
|
303
|
+
cwd: root,
|
|
304
|
+
stdio: [
|
|
305
|
+
"ignore",
|
|
306
|
+
"pipe",
|
|
307
|
+
"pipe"
|
|
308
|
+
],
|
|
309
|
+
env: {
|
|
310
|
+
...process.env,
|
|
311
|
+
FORCE_COLOR: "0"
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
} catch (err) {
|
|
315
|
+
return fail("bundle", `could not run ${command.file} ${command.args[0]}: ${describe(err)}`);
|
|
316
|
+
}
|
|
317
|
+
const reader = {
|
|
318
|
+
out: createLineReader(push),
|
|
319
|
+
err: createLineReader(push)
|
|
320
|
+
};
|
|
321
|
+
child.stdout?.setEncoding?.("utf-8");
|
|
322
|
+
child.stderr?.setEncoding?.("utf-8");
|
|
323
|
+
child.stdout?.on("data", (chunk) => reader.out.push(chunk));
|
|
324
|
+
child.stderr?.on("data", (chunk) => reader.err.push(chunk));
|
|
325
|
+
const stopHeartbeat = startBuildHeartbeat({
|
|
326
|
+
intervalMs: heartbeatMs,
|
|
327
|
+
elapsed,
|
|
328
|
+
emit: onHeartbeat,
|
|
329
|
+
label: "swap"
|
|
330
|
+
});
|
|
331
|
+
let outcome;
|
|
332
|
+
try {
|
|
333
|
+
outcome = await waitForChild(child);
|
|
334
|
+
} finally {
|
|
335
|
+
stopHeartbeat();
|
|
336
|
+
}
|
|
337
|
+
reader.out.flush();
|
|
338
|
+
reader.err.flush();
|
|
339
|
+
if (outcome.error) return fail("bundle", `could not run ${command.file} ${command.args[0]}: ${describe(outcome.error)}`);
|
|
340
|
+
if (outcome.code !== 0) {
|
|
341
|
+
const how = outcome.signal ? `signal ${outcome.signal}` : `exit code ${outcome.code}`;
|
|
342
|
+
return fail("bundle", `\`${command.args.slice(0, 2).join(" ")}\` failed (${how})`, tailLines(transcript, LAST_LINES));
|
|
343
|
+
}
|
|
344
|
+
if (!exists(bundleOutput)) return fail("bundle", `the bundle command exited 0 but wrote no ${JS_BUNDLE_NAME} at ${bundleOutput}`);
|
|
345
|
+
let hermes = false;
|
|
346
|
+
let note;
|
|
347
|
+
if (hermesEnabled ?? readHermesEnabled(iosDir)) {
|
|
348
|
+
const hermesc = hermescPath(root, iosDir);
|
|
349
|
+
if (!exists(hermesc)) note = `hermesc not found at ${hermesc}; embedding the plain JS bundle instead of Hermes bytecode`;
|
|
350
|
+
else {
|
|
351
|
+
const hbc = join(tmp, `${JS_BUNDLE_NAME}.hbc`);
|
|
352
|
+
try {
|
|
353
|
+
e.runFile(hermesc, hermescArgs({
|
|
354
|
+
bundle: bundleOutput,
|
|
355
|
+
out: hbc
|
|
356
|
+
}));
|
|
357
|
+
e.runFile("mv", [hbc, bundleOutput]);
|
|
358
|
+
hermes = true;
|
|
359
|
+
} catch (err) {
|
|
360
|
+
return fail("hermesc", `hermesc failed on ${bundleOutput}: ${describe(err)}`);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
try {
|
|
365
|
+
e.runFile("cp", [bundleOutput, join(appCopy, JS_BUNDLE_NAME)]);
|
|
366
|
+
e.runFile("cp", [
|
|
367
|
+
"-R",
|
|
368
|
+
`${assetsDest}/.`,
|
|
369
|
+
`${appCopy}/`
|
|
370
|
+
]);
|
|
371
|
+
} catch (err) {
|
|
372
|
+
return fail("replace", `could not replace the JS bundle inside ${appCopy}: ${describe(err)}`);
|
|
373
|
+
}
|
|
374
|
+
if (catalogTarget && catalogDir) {
|
|
375
|
+
const catalogBundle = join(appCopy, ASSET_CATALOG_BUNDLE);
|
|
376
|
+
try {
|
|
377
|
+
rmSync(catalogBundle, {
|
|
378
|
+
recursive: true,
|
|
379
|
+
force: true
|
|
380
|
+
});
|
|
381
|
+
if (readdirSync(catalogDir).some((name) => name.endsWith(".imageset"))) {
|
|
382
|
+
mkdirSync(catalogBundle);
|
|
383
|
+
const output = e.runFile("xcrun", actoolArgs({
|
|
384
|
+
catalog: catalogDir,
|
|
385
|
+
out: catalogBundle,
|
|
386
|
+
target: catalogTarget
|
|
387
|
+
}));
|
|
388
|
+
if (!exists(join(catalogBundle, "Assets.car"))) return fail("actool", `actool wrote no Assets.car into ${catalogBundle}`, tailLines(output.split("\n"), LAST_LINES));
|
|
389
|
+
writeFileSync(join(catalogBundle, "Info.plist"), ASSET_CATALOG_BUNDLE_INFO_PLIST);
|
|
390
|
+
}
|
|
391
|
+
} catch (err) {
|
|
392
|
+
const stdout = String(err?.stdout ?? "");
|
|
393
|
+
return fail("actool", `could not compile the image asset catalog into ${catalogBundle}: ${describe(err)}`, tailLines(stdout.split("\n"), LAST_LINES));
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
if (exists(join(appCopy, IOS_FRAMEWORK_UPDATES_MANIFEST))) return fail("updates", `the expo-updates manifest sits inside a nested framework (${IOS_FRAMEWORK_UPDATES_MANIFEST}), where a swap cannot refresh it without re-signing that framework`);
|
|
397
|
+
for (const manifest of IOS_UPDATES_MANIFESTS.map((name) => join(appCopy, name)).filter(exists)) try {
|
|
398
|
+
refreshUpdatesManifestFile(manifest, now());
|
|
399
|
+
} catch (err) {
|
|
400
|
+
return fail("updates", `could not refresh the expo-updates manifest ${manifest}: ${describe(err)}`);
|
|
401
|
+
}
|
|
402
|
+
try {
|
|
403
|
+
e.runFile("codesign", [
|
|
404
|
+
"--force",
|
|
405
|
+
"--sign",
|
|
406
|
+
"-",
|
|
407
|
+
appCopy
|
|
408
|
+
]);
|
|
409
|
+
} catch (err) {
|
|
410
|
+
return fail("codesign", `codesign --force --sign - ${appCopy} failed: ${describe(err)}`);
|
|
411
|
+
}
|
|
412
|
+
logWriter?.write?.({
|
|
413
|
+
src: "build",
|
|
414
|
+
level: "info",
|
|
415
|
+
msg: `JS swap done: ${hermes ? "hermes bytecode" : "plain JS"} into ${appCopy} in ${elapsed()}ms`,
|
|
416
|
+
event: "js_swap"
|
|
417
|
+
});
|
|
418
|
+
const result = {
|
|
419
|
+
ok: true,
|
|
420
|
+
appPath: appCopy,
|
|
421
|
+
tmpDir: tmp,
|
|
422
|
+
hermes,
|
|
423
|
+
durationMs: elapsed()
|
|
424
|
+
};
|
|
425
|
+
if (note) result.note = note;
|
|
426
|
+
return result;
|
|
427
|
+
}
|
|
428
|
+
function describe(err) {
|
|
429
|
+
return String(err?.message || err);
|
|
430
|
+
}
|
|
431
|
+
//#endregion
|
|
432
|
+
export { swapJsBundle as i, detectEntryFile as n, refreshUpdatesManifestFile as r, UPDATES_MANIFEST_NAME as t };
|