stim 1.21.0 → 1.23.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 +60 -7
- package/dist/{acquire-artifact-CD4lbiWE.mjs → acquire-artifact-ybouwJSR.mjs} +21 -3
- package/dist/{act-DHAw2A2S.mjs → act-DG54PWtJ.mjs} +298 -164
- package/dist/{activity-BzVfHSrY.mjs → activity-B5RtpFda.mjs} +33 -12
- package/dist/{agent-device-usage-output-zh1vhbLp.mjs → agent-device-usage-output-UJ5gC80l.mjs} +7 -7
- package/dist/{android-BLgbNqox.mjs → android-BoUJKbfz.mjs} +66 -52
- package/dist/{android-DUYkNF4u.mjs → android-C7sVmyI9.mjs} +160 -59
- package/dist/{android-CV_GCELZ.mjs → android-CHH4KLOR.mjs} +5 -5
- package/dist/{android-BEJ8Jpl7.mjs → android-DR5lZ2Az.mjs} +2 -2
- package/dist/android-cas-compiler.mjs +1 -1
- package/dist/{android-cas-Ct5b1xCK.mjs → android-cas-ngferVq2.mjs} +3 -3
- package/dist/{client-B7QVOlCr.d.mts → android-project-DVWyCbWU.d.mts} +145 -7
- package/dist/api.d.mts +132 -118
- package/dist/api.mjs +239 -42
- package/dist/{artifact-DAuZ-FNU.mjs → artifact-5RteZem7.mjs} +69 -40
- package/dist/{artifact-B8T3S5gi.mjs → artifact-Dwdo7k1E.mjs} +40 -35
- package/dist/artifact-platform-CXcmX_j3.mjs +27 -0
- package/dist/{browser-web-QQzVjz3O.mjs → browser-web-CeEVlGug.mjs} +187 -59
- package/dist/{budget-Bs6SxxzO.mjs → budget-DnPX3DXj.mjs} +830 -699
- package/dist/{build-CoPzQRNw.mjs → build-CqufZFqy.mjs} +34 -27
- package/dist/{build-cache-DmyR9Zzc.mjs → build-cache-Dv7RN200.mjs} +4 -4
- package/dist/{build-plan-CaFskB7_.mjs → build-plan-C8CIvRyi.mjs} +74 -14
- package/dist/{cache-manifest-DkkqguoK.mjs → cache-manifest-DSeQjt-Q.mjs} +1 -1
- package/dist/cache-manifest.mjs +1 -1
- package/dist/{ccache-BJRZ9pG3.mjs → ccache-RcAy92gH.mjs} +6 -6
- package/dist/{cdp-CWmIUMbw.mjs → cdp-3fwICjzi.mjs} +1 -1
- package/dist/{chrome-B6tfCta1.mjs → chrome-Bbw689-6.mjs} +1 -1
- package/dist/{cli-0DYf8QhQ.mjs → cli-D-J9fWGV.mjs} +20 -20
- package/dist/cli.mjs +1 -1
- package/dist/{client-UXD70ZbM.mjs → client-yyso1bwi.mjs} +218 -47
- package/dist/collector-run.d.mts +1 -1
- package/dist/collector-run.mjs +6 -6
- package/dist/{command-output-B1UrjZHL.mjs → command-output-Db8BqzxH.mjs} +1 -1
- package/dist/{config-CYcBF478.mjs → config-DlrsduwG.mjs} +17 -11
- package/dist/{created-devices-CqeBlrEn.mjs → created-devices-x9rN6bhs.mjs} +13 -3
- package/dist/{dependency-state-BbKQW83h.mjs → dependency-state-1I9KZT1Y.mjs} +2 -2
- package/dist/{detached-entry-DFRyG1_o.mjs → detached-entry-BwNEtIrP.mjs} +1 -1
- package/dist/{dev-client-UOeESKm6.mjs → dev-client-BnYSDiKa.mjs} +2 -2
- package/dist/{device-DCxH7_By.mjs → device-BvzPUBs3.mjs} +16 -16
- package/dist/{device-ExJq8Ei7.mjs → device-CCkWmkAA.mjs} +71 -14
- package/dist/{device-capacity-CMlqEcvw.mjs → device-capacity-CjaSdrhg.mjs} +9 -10
- package/dist/device-host-worker.mjs +25 -32
- package/dist/{device-ios-DRUeKaFV.mjs → device-ios-uOiEETX2.mjs} +39 -16
- package/dist/{device-lease-run-C8raGFoP.mjs → device-lease-run-BgwPHc6u.mjs} +5 -5
- package/dist/{device-pool-DMRpVX9a.mjs → device-pool-C-ptmZTa.mjs} +3 -3
- package/dist/{doctor-DTvaDOda.mjs → doctor-8sr2tFOL.mjs} +24 -37
- package/dist/{doctor-Dhqebm0q.mjs → doctor-D2SN3Ltx.mjs} +19 -16
- package/dist/doctor-fingerprint-DZLoYFVb.mjs +16 -0
- package/dist/doctor-fingerprint.mjs +1 -1
- package/dist/{doctor-BLHCYxzi.mjs → doctor-pxxvipYC.mjs} +1 -1
- package/dist/{doctor-watchman-Cv1F10Kj.mjs → doctor-watchman-sy_RNhFt.mjs} +5 -5
- package/dist/{eas-build-BomfRnFT.mjs → eas-build-CyjU5K7E.mjs} +4 -4
- package/dist/{eas-fallback-DJwZpy0c.mjs → eas-fallback-DV3Wytf1.mjs} +27 -18
- package/dist/{eas-session-ledger-op6A54yi.mjs → eas-session-ledger-BzzsX97d.mjs} +8 -7
- package/dist/{error-diagnostics-Bf0rZvG9.mjs → error-diagnostics-C6sVoeqO.mjs} +10 -10
- package/dist/{exec-_UbtCQcG.mjs → exec-DEoAhcze.mjs} +155 -47
- package/dist/{exec-H20xSg2T.d.mts → exec-DnYc4HGH.d.mts} +17 -4
- package/dist/{gc-_-dCXdyL.mjs → gc-CDoogxAI.mjs} +587 -313
- package/dist/gc-DLbzvTP2.mjs +3 -0
- package/dist/{guide-Yqwt2bd6.mjs → guide-BC37GcDG.mjs} +288 -59
- package/dist/{hosted-android-Bw-honsd.mjs → hosted-android-CkclQig_.mjs} +6 -6
- package/dist/{hosted-client-DB_gBPfY.mjs → hosted-client-ByuMMO5s.mjs} +4 -4
- package/dist/{hosted-ios-CUvOf4Vr.mjs → hosted-ios-DtYHeuYR.mjs} +1 -1
- package/dist/{hosted-logs-DL_P5AdN.mjs → hosted-logs-Br84qWy1.mjs} +5 -5
- package/dist/{hosted-macos-QI141yKk.mjs → hosted-macos-DdtYajZt.mjs} +21 -12
- package/dist/{hosted-native-Ksyjgzq-.mjs → hosted-native-UPI9zdZ4.mjs} +27 -14
- package/dist/{idle-BVeRGroT.d.mts → idle-C4cZ757K.d.mts} +3 -3
- package/dist/{idle-shutdown-DaKmZi0z.mjs → idle-shutdown-DO7oIRlc.mjs} +7 -7
- package/dist/ios-CDvlmUs7.d.mts +24 -0
- package/dist/{ios-ubFsBzwq.mjs → ios-DZZbNYlY.mjs} +59 -50
- package/dist/{ios-device-CXGP1bsD.mjs → ios-device-BXZ0c7Kb.mjs} +1 -1
- package/dist/{ios-device-CwFMehUS.mjs → ios-device-JC3uWM4K.mjs} +3 -3
- package/dist/{ios-CpByZy12.mjs → ios-hcBpnEGk.mjs} +81 -34
- package/dist/{ios-project-WuwwBdvW.mjs → ios-project-CVyNwjAF.mjs} +5 -5
- package/dist/{ios-signing-DTTIChGs.mjs → ios-signing-BtAffm0A.mjs} +2 -2
- package/dist/{ios-state-DvFX-K_l.mjs → ios-state-Dtw5K2aI.mjs} +1 -1
- package/dist/{ios-CQ68hG9s.mjs → ios-vbUOqGXu.mjs} +8 -8
- package/dist/{ios-qNJt4dFm.mjs → ios-xtlRHaeB.mjs} +1 -1
- package/dist/{js-swap-Cc1dttps.mjs → js-swap-C3QxUFJR.mjs} +7 -29
- package/dist/{launch-CD1yVc7U.mjs → launch-Bz7JtaC4.mjs} +16 -16
- package/dist/{launch-Zq2mOSDy.mjs → launch-CHY3p-yz.mjs} +40 -39
- package/dist/{logs-CMm05HxN.mjs → logs-CtNeNDuq.mjs} +10 -17
- package/dist/{logs-BS00Anxf.mjs → logs-mxqsWpJs.mjs} +151 -24
- package/dist/{macos-B65--pPd.mjs → macos-inNFbBWc.mjs} +1 -1
- package/dist/macos-run.mjs +1 -1
- package/dist/{macos-C-0qJ6zq.mjs → macos-u0BoHKnO.mjs} +143 -46
- package/dist/maintenance-run.mjs +8 -8
- package/dist/{metro-DEXpIhHC.mjs → metro-DiXtA3Ty.mjs} +59 -37
- package/dist/{metro-gateway-BMJNlj3E.mjs → metro-gateway-CKZqKqx7.mjs} +120 -22
- package/dist/{named-ports-BWTzt6mu.mjs → named-ports-DkEzOfzO.mjs} +40 -33
- package/dist/{native-android-JACyjTZs.mjs → native-android-CdCSylTn.mjs} +43 -242
- package/dist/native-gradle-artifact-inputs-DHFnmrVf.mjs +270 -0
- package/dist/{native-gradle-inputs-Bep9JcSF.mjs → native-gradle-inputs-Dnh84Zbd.mjs} +3 -129
- package/dist/{native-run-DY_RLx3C.mjs → native-run-BUTu8T7A.mjs} +4 -5
- package/dist/{native-runtime-Dg1Q7tfF.mjs → native-runtime-CRSOZxKY.mjs} +8 -7
- package/dist/native-source-Y0yLhFyQ.mjs +133 -0
- package/dist/{native-xcode-inputs-CB2iQeWq.mjs → native-xcode-inputs-G6rkkhxu.mjs} +2 -3
- package/dist/{native-xcode-ios-CXX39F7o.mjs → native-xcode-ios-_os2PlCD.mjs} +27 -32
- package/dist/offload-worker.d.mts +65 -2
- package/dist/offload-worker.mjs +305 -73
- package/dist/operation-exec-BW0em61G.mjs +171 -0
- package/dist/{ownership-DEmM5vhh.mjs → ownership-C5fo5Edb.mjs} +3 -3
- package/dist/{page-CPaHeYqj.mjs → page-DBL2PiUU.mjs} +8 -4
- package/dist/{placement-log-BqGbTa61.mjs → placement-log-BnGgJRRZ.mjs} +1 -1
- package/dist/{plan-placement-Bwj-IjY1.mjs → plan-placement-BU42oOyT.mjs} +12 -8
- package/dist/{ports-D-MmCTdv.mjs → ports-BSmQKzW7.mjs} +3 -3
- package/dist/{prebuild-uD_ipCxF.mjs → prebuild-BFm63bQ0.mjs} +63 -16
- package/dist/{project-BZNjmW_8.mjs → project-CTLNHCfE.mjs} +16 -16
- package/dist/{pull-request-Lfetn8Kr.mjs → pull-request-W1IuLXDt.mjs} +102 -20
- package/dist/{pull-request-zjCSAryH.d.mts → pull-request-eODyIqZF.d.mts} +6 -2
- package/dist/pull-requests.d.mts +2 -2
- package/dist/pull-requests.mjs +2 -2
- package/dist/{react-native-android-DuzH0cn3.mjs → react-native-android-CFgUroxW.mjs} +73 -53
- package/dist/{react-native-build-rhk4smwQ.mjs → react-native-build-CmJkTljQ.mjs} +8 -8
- package/dist/{react-native-doctor-CQpuIMso.mjs → react-native-doctor-LTF-Xt8l.mjs} +7 -7
- package/dist/{react-native-ios-Bhq1rJeV.mjs → react-native-ios-ChBF1MkB.mjs} +43 -29
- package/dist/{recordings-DYteQSu4.mjs → recordings-CQmfzAh7.mjs} +1 -1
- package/dist/registration-BcRgF6Ox.mjs +51 -0
- package/dist/{reload-CmTRFJaX.mjs → reload-DF9hqUUB.mjs} +16 -15
- package/dist/{reload-DzjSl5P_.mjs → reload-RBi1nj6Z.mjs} +1 -1
- package/dist/{remote-ByYkXdGD.mjs → remote-BmvMCcJw.mjs} +18 -15
- package/dist/{result-DNiS-tTP.mjs → result-Cx5CRLvS.mjs} +24 -23
- package/dist/{run-D23HmJMs.mjs → run-DidHghD1.mjs} +3 -2
- package/dist/{selection-CSl9i5qU.mjs → selection-DSMbWEX2.mjs} +6 -5
- package/dist/{server-bare-CxTrvDg8.mjs → server-bare-CafzuyFB.mjs} +2 -2
- package/dist/{server-command-CtzloH3v.mjs → server-command-BTiGPEjS.mjs} +5 -5
- package/dist/server-expo-C-Buqvn_.mjs +2 -0
- package/dist/{server-expo-DT_F_uVI.mjs → server-expo-D9lEz4aq.mjs} +7 -5
- package/dist/{settings-CsJDEXgK.mjs → settings-C7O8A6ZI.mjs} +223 -243
- package/dist/{settings-T1gtc3bf.mjs → settings-eKF_vJJs.mjs} +1 -1
- package/dist/{settings-write-HyVZ8eQ8.mjs → settings-write-79mQRr9C.mjs} +7 -6
- package/dist/settings.schema.json +13 -0
- package/dist/{simslim-Cgk17SXV.mjs → simslim-BNckWpXi.mjs} +2 -2
- package/dist/{slot-launch-DF8VfT64.mjs → slot-launch-D7M2nE4b.mjs} +6 -6
- package/dist/{stage-BIS0ydsV.mjs → stage-DKNM4ZPd.mjs} +21 -4
- package/dist/{start-RChynRDp.mjs → start-CRfN1kWV.mjs} +1 -1
- package/dist/{start-7lpH7hmN.mjs → start-bjfiScgz.mjs} +622 -393
- package/dist/{state-C4ZtUisW.mjs → state--smjFSTL.mjs} +22 -7
- package/dist/{state-XMziexv2.mjs → state-08I3hw3_.mjs} +2 -2
- package/dist/{stats-53T7OTb9.mjs → stats-DioA6cBU.mjs} +5 -5
- package/dist/{stats-report-BFfMpWWF.mjs → stats-report-BzaPrRm6.mjs} +1 -1
- package/dist/{status-DqEUSSxs.mjs → status-BRROykC8.mjs} +2 -2
- package/dist/{status-CSi6tlRq.mjs → status-Eqx_20WC.mjs} +1 -1
- package/dist/{status-BL7jVyAB.mjs → status-kzbeWk4x.mjs} +43 -29
- package/dist/{status-watch-GDCfqpTE.mjs → status-watch-BIqqbJ6q.mjs} +48 -16
- package/dist/status-worker.mjs +1 -1
- package/dist/{stim-desktop-C12we7lz.mjs → stim-desktop-D5OGpYZM.mjs} +2 -2
- package/dist/{stop-Bk_1qiV6.mjs → stop-B18d8KDw.mjs} +2 -2
- package/dist/{stop-CPzlM1L-.mjs → stop-B2uLQfoM.mjs} +15 -16
- package/dist/{stop-D7h6jAXQ.mjs → stop-DzLJc7Ei.mjs} +31 -22
- package/dist/supervisor-run.d.mts +3 -3
- package/dist/supervisor-run.mjs +28 -36
- package/dist/{support-Dlu37g6H.mjs → support-BTpZ6RAJ.mjs} +15 -11
- package/dist/{support-67vraa1Q.mjs → support-DTBV56gy.mjs} +8 -8
- package/dist/swiftpm-artifact-inputs-DFcGsXDP.mjs +153 -0
- package/dist/swiftpm-macos-r_WSKlXr.mjs +532 -0
- package/dist/{toolchain-Hp9sCpK4.mjs → toolchain-CWeGJgCc.mjs} +9 -6
- package/dist/toolchain-GVgnf8d1.mjs +2 -0
- package/dist/{trigger-BAahxUPq.mjs → trigger-Cbyc41d_.mjs} +3 -3
- package/dist/trigger-yb_nFzPF.mjs +2 -0
- package/dist/{warm-progress-BHX5r0Ei.mjs → warm-progress-CA3TgT3-.mjs} +29 -16
- package/dist/web-Cduk0NSE.mjs +2 -0
- package/dist/{web-CJmIj6AI.mjs → web-CwREhjD-.mjs} +11 -10
- package/dist/web-run.mjs +11 -9
- package/dist/windows-report.mjs +1 -1
- package/dist/{workspace-state-Cjuigeeu.mjs → workspace-state-U08dEzhG.mjs} +3 -3
- package/dist/{workspaces-BccMFmGQ.mjs → workspaces-BxzYlo3P.mjs} +594 -266
- package/dist/{worktree-DQ6Zi2Mv.mjs → worktree-8lqn_lBp.mjs} +850 -551
- package/dist/worktree-BxfVxG_b.mjs +2 -0
- package/dist/{xcode-Zlx3qjEs.mjs → xcode-iQnROM5o.mjs} +5 -5
- package/package.json +7 -7
- package/shim/android-audio/Main.java +24 -0
- package/shim/android-audio/README.md +17 -0
- package/shim/android-audio.jar +0 -0
- package/dist/gc-C-WwL0yi.mjs +0 -3
- package/dist/git-C3iTsJaZ.mjs +0 -73
- package/dist/server-expo-C-90EhcG.mjs +0 -2
- package/dist/settings-DkdmlelE.d.mts +0 -15
- package/dist/swiftpm-macos-p8WZbxKU.mjs +0 -130
- package/dist/toolchain-DhKwp9iI.mjs +0 -2
- package/dist/trigger-Bf3uDcpv.mjs +0 -2
- package/dist/web-DknQETPs.mjs +0 -2
- package/dist/workspace-process-lock-1_1OoVW5.mjs +0 -57
- package/dist/worktree-CK2MpJW5.mjs +0 -2
|
@@ -0,0 +1,532 @@
|
|
|
1
|
+
import { d as spawnDeclared, t as getExecutor, y as trackReportResource } from "./exec-DEoAhcze.mjs";
|
|
2
|
+
import { i as sharedBuildCache } from "./paths-DQtTgsBf.mjs";
|
|
3
|
+
import { G as resolveCacheProviderConfig, L as projectSettingsContextAsync, Nt as repoRootAsync, tt as settingValueAt } from "./settings-C7O8A6ZI.mjs";
|
|
4
|
+
import { r as register } from "./cache-manifest-DSeQjt-Q.mjs";
|
|
5
|
+
import { d as runCancellationSignal } from "./native-run-BUTu8T7A.mjs";
|
|
6
|
+
import "./build-cache-Dv7RN200.mjs";
|
|
7
|
+
import { l as artifactCachePolicy, p as resolveOptimizations } from "./errors-ccaPc4ox.mjs";
|
|
8
|
+
import { l as macosToolchainAsync } from "./toolchain-CWeGJgCc.mjs";
|
|
9
|
+
import { r as nativeFileDigest } from "./native-source-Y0yLhFyQ.mjs";
|
|
10
|
+
import { a as validateInfoPlist, i as stageBundle, n as resolveBundleExtras, r as setBundleName, t as reidentifyBundle } from "./stage-DKNM4ZPd.mjs";
|
|
11
|
+
import { t as validateMacosArtifactPlatform } from "./artifact-platform-CXcmX_j3.mjs";
|
|
12
|
+
import { t as logLines } from "./run-DidHghD1.mjs";
|
|
13
|
+
import { n as swiftpmArtifactInputs, r as swiftpmArtifactSnapshot, t as readSwiftpmArtifactToolchain } from "./swiftpm-artifact-inputs-DFcGsXDP.mjs";
|
|
14
|
+
import { createHash } from "node:crypto";
|
|
15
|
+
import { createReadStream, createWriteStream, existsSync, realpathSync } from "node:fs";
|
|
16
|
+
import { tmpdir } from "node:os";
|
|
17
|
+
import { dirname, isAbsolute, join, posix, relative, resolve, sep } from "node:path";
|
|
18
|
+
import { parseHostedAppManifest } from "@stim-cli/core/state";
|
|
19
|
+
import { cp, lstat, mkdir, mkdtemp, open, readdir, readlink, realpath, rm, symlink, writeFile } from "node:fs/promises";
|
|
20
|
+
import { buildResolveTimeoutMs, buildUploadTimeoutMs, createFilesystemFileCache, loadCacheProvider } from "@stim-cli/cache";
|
|
21
|
+
import { pipeline } from "node:stream/promises";
|
|
22
|
+
import { Readable } from "node:stream";
|
|
23
|
+
//#region src/macos/artifact-file.ts
|
|
24
|
+
const MAGIC = Buffer.from("STIMMAC1\n");
|
|
25
|
+
const MAX_HEADER_BYTES = 16777216;
|
|
26
|
+
const canonical = (path) => path.normalize("NFC").toLowerCase();
|
|
27
|
+
async function bundleFiles(bundle, signal) {
|
|
28
|
+
const files = [];
|
|
29
|
+
const directories = [];
|
|
30
|
+
const walk = async (path) => {
|
|
31
|
+
signal.throwIfAborted();
|
|
32
|
+
const absolute = join(bundle, path);
|
|
33
|
+
const info = await lstat(absolute);
|
|
34
|
+
if (info.isDirectory()) {
|
|
35
|
+
if (path) directories.push(path);
|
|
36
|
+
for (const entry of await readdir(absolute)) await walk(path ? `${path}/${entry}` : entry);
|
|
37
|
+
} else if (info.isFile()) files.push({
|
|
38
|
+
path,
|
|
39
|
+
kind: info.mode & 73 ? "exec" : "file",
|
|
40
|
+
...await nativeFileDigest(absolute, signal)
|
|
41
|
+
});
|
|
42
|
+
else if (info.isSymbolicLink()) {
|
|
43
|
+
const bytes = Buffer.from(await readlink(absolute));
|
|
44
|
+
files.push({
|
|
45
|
+
path,
|
|
46
|
+
kind: "link",
|
|
47
|
+
size: bytes.length,
|
|
48
|
+
sha256: createHash("sha256").update(bytes).digest("hex")
|
|
49
|
+
});
|
|
50
|
+
} else throw new Error("The cached macOS bundle contains an unsupported file.");
|
|
51
|
+
};
|
|
52
|
+
await walk("");
|
|
53
|
+
const parsed = parseHostedAppManifest(files);
|
|
54
|
+
if (!parsed || directories.length > 2e4) throw new Error("The cached macOS bundle has an invalid file inventory.");
|
|
55
|
+
return {
|
|
56
|
+
files: parsed,
|
|
57
|
+
directories: directories.toSorted()
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
async function packMacosArtifact(bundle, key, output, signal) {
|
|
61
|
+
const { files, directories } = await bundleFiles(bundle, signal);
|
|
62
|
+
const metadata = Buffer.from(JSON.stringify({
|
|
63
|
+
key,
|
|
64
|
+
files,
|
|
65
|
+
directories
|
|
66
|
+
}));
|
|
67
|
+
if (metadata.length > MAX_HEADER_BYTES) throw new Error("The cached macOS bundle receipt is too large.");
|
|
68
|
+
const header = Buffer.alloc(MAGIC.length + 4);
|
|
69
|
+
MAGIC.copy(header);
|
|
70
|
+
header.writeUInt32BE(metadata.length, MAGIC.length);
|
|
71
|
+
const payload = async function* () {
|
|
72
|
+
yield header;
|
|
73
|
+
yield metadata;
|
|
74
|
+
for (const file of files) {
|
|
75
|
+
signal.throwIfAborted();
|
|
76
|
+
const hash = createHash("sha256");
|
|
77
|
+
let size = 0;
|
|
78
|
+
const path = join(bundle, file.path);
|
|
79
|
+
const input = file.kind === "link" ? [Buffer.from(await readlink(path))] : createReadStream(path, { signal });
|
|
80
|
+
for await (const bytes of input) {
|
|
81
|
+
hash.update(bytes);
|
|
82
|
+
size += bytes.length;
|
|
83
|
+
yield bytes;
|
|
84
|
+
}
|
|
85
|
+
if (size !== file.size || hash.digest("hex") !== file.sha256) throw new Error("The macOS bundle changed while its cache entry was packed.");
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
await pipeline(Readable.from(payload()), createWriteStream(output, {
|
|
89
|
+
flags: "wx",
|
|
90
|
+
mode: 384
|
|
91
|
+
}), { signal });
|
|
92
|
+
}
|
|
93
|
+
async function readExactly(file, size, position, signal) {
|
|
94
|
+
const bytes = Buffer.alloc(size);
|
|
95
|
+
let offset = 0;
|
|
96
|
+
while (offset < size) {
|
|
97
|
+
signal.throwIfAborted();
|
|
98
|
+
const read = await file.read(bytes, offset, size - offset, position + offset);
|
|
99
|
+
if (!read.bytesRead) throw new Error("The cached macOS entry is truncated.");
|
|
100
|
+
offset += read.bytesRead;
|
|
101
|
+
}
|
|
102
|
+
return bytes;
|
|
103
|
+
}
|
|
104
|
+
async function unpackMacosArtifact(source, key, bundle, signal) {
|
|
105
|
+
signal.throwIfAborted();
|
|
106
|
+
const file = await open(source, "r");
|
|
107
|
+
try {
|
|
108
|
+
const header = await readExactly(file, MAGIC.length + 4, 0, signal);
|
|
109
|
+
const size = header.readUInt32BE(MAGIC.length);
|
|
110
|
+
if (!header.subarray(0, MAGIC.length).equals(MAGIC) || size === 0 || size > MAX_HEADER_BYTES) throw new Error("The cached macOS entry has an unsupported header.");
|
|
111
|
+
const metadata = JSON.parse((await readExactly(file, size, header.length, signal)).toString("utf8"));
|
|
112
|
+
const files = parseHostedAppManifest(metadata?.files);
|
|
113
|
+
if (metadata?.key !== key || !files) throw new Error("The cached macOS entry has an invalid identity or inventory.");
|
|
114
|
+
const directories = metadata.directories;
|
|
115
|
+
if (!Array.isArray(directories) || directories.length > 2e4 || !directories.every((path) => typeof path === "string" && path.length > 0 && path.length <= 1024 && !/[\\\0\r\n]/.test(path) && path.split("/").every((part) => part && part !== "." && part !== ".."))) throw new Error("The cached macOS entry has invalid directories.");
|
|
116
|
+
const filePaths = new Set(files.map((entry) => canonical(entry.path)));
|
|
117
|
+
for (const path of directories) {
|
|
118
|
+
let ancestor = canonical(path);
|
|
119
|
+
while (ancestor !== ".") {
|
|
120
|
+
if (filePaths.has(ancestor)) throw new Error("A cached macOS directory overlaps a file or link.");
|
|
121
|
+
ancestor = posix.dirname(ancestor);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
let position = header.length + size;
|
|
125
|
+
if ((await file.stat()).size !== position + files.reduce((sum, entry) => sum + entry.size, 0)) throw new Error("The cached macOS entry has an invalid payload length.");
|
|
126
|
+
await mkdir(bundle, { mode: 448 });
|
|
127
|
+
for (const path of directories) {
|
|
128
|
+
signal.throwIfAborted();
|
|
129
|
+
await mkdir(join(bundle, path), {
|
|
130
|
+
recursive: true,
|
|
131
|
+
mode: 493
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
const links = [];
|
|
135
|
+
for (const entry of files) {
|
|
136
|
+
signal.throwIfAborted();
|
|
137
|
+
const path = join(bundle, entry.path);
|
|
138
|
+
await mkdir(dirname(path), {
|
|
139
|
+
recursive: true,
|
|
140
|
+
mode: 448
|
|
141
|
+
});
|
|
142
|
+
if (entry.kind === "link") {
|
|
143
|
+
const bytes = await readExactly(file, entry.size, position, signal);
|
|
144
|
+
if (createHash("sha256").update(bytes).digest("hex") !== entry.sha256) throw new Error("A cached macOS link differs from its digest.");
|
|
145
|
+
const target = bytes.toString("utf8");
|
|
146
|
+
const destination = posix.normalize(posix.join(posix.dirname(entry.path), target));
|
|
147
|
+
if (!target || !Buffer.from(target).equals(bytes) || /[\\\0\r\n]/.test(target) || posix.isAbsolute(target) || destination === "." || destination === ".." || destination.startsWith("../") || entry.path.startsWith(`${destination}/`)) throw new Error("A cached macOS link leaves its bundle or forms an ancestor cycle.");
|
|
148
|
+
links.push({
|
|
149
|
+
path,
|
|
150
|
+
target
|
|
151
|
+
});
|
|
152
|
+
} else {
|
|
153
|
+
const hash = createHash("sha256");
|
|
154
|
+
if (entry.size === 0) await writeFile(path, "", {
|
|
155
|
+
flag: "wx",
|
|
156
|
+
mode: entry.kind === "exec" ? 493 : 420,
|
|
157
|
+
signal
|
|
158
|
+
});
|
|
159
|
+
else {
|
|
160
|
+
const bytes = async function* () {
|
|
161
|
+
for await (const chunk of file.createReadStream({
|
|
162
|
+
start: position,
|
|
163
|
+
end: position + entry.size - 1,
|
|
164
|
+
autoClose: false
|
|
165
|
+
})) {
|
|
166
|
+
signal.throwIfAborted();
|
|
167
|
+
hash.update(chunk);
|
|
168
|
+
yield chunk;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
await pipeline(Readable.from(bytes()), createWriteStream(path, {
|
|
172
|
+
flags: "wx",
|
|
173
|
+
mode: entry.kind === "exec" ? 493 : 420
|
|
174
|
+
}), { signal });
|
|
175
|
+
}
|
|
176
|
+
if (hash.digest("hex") !== entry.sha256) throw new Error("A cached macOS file differs from its digest.");
|
|
177
|
+
}
|
|
178
|
+
position += entry.size;
|
|
179
|
+
}
|
|
180
|
+
for (const link of links) await symlink(link.target, link.path);
|
|
181
|
+
const root = await realpath(bundle);
|
|
182
|
+
for (const link of links) {
|
|
183
|
+
signal.throwIfAborted();
|
|
184
|
+
const path = relative(root, await realpath(link.path));
|
|
185
|
+
if (isAbsolute(path) || path === ".." || path.startsWith(`..${sep}`)) throw new Error("A cached macOS link leaves its bundle.");
|
|
186
|
+
}
|
|
187
|
+
} finally {
|
|
188
|
+
await file.close();
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
//#endregion
|
|
192
|
+
//#region src/macos/artifact-cache.ts
|
|
193
|
+
async function providerCall(call, timeoutMs, context, directory, signal) {
|
|
194
|
+
signal.throwIfAborted();
|
|
195
|
+
const controller = new AbortController();
|
|
196
|
+
const failure = Object.assign(/* @__PURE__ */ new Error(`SwiftPM cache provider cleanup did not finish within 35 seconds. Retained ${directory}.`), {
|
|
197
|
+
code: "STIM_CLAIM_UNAVAILABLE",
|
|
198
|
+
reportCleanup: true,
|
|
199
|
+
remedy: "Confirm that the provider has stopped using the retained directory before removing it and retrying."
|
|
200
|
+
});
|
|
201
|
+
const pending = Promise.resolve().then(() => {
|
|
202
|
+
controller.signal.throwIfAborted();
|
|
203
|
+
return call(controller.signal);
|
|
204
|
+
}).then((value) => ({ value }), (error) => ({ error }));
|
|
205
|
+
let close;
|
|
206
|
+
const closed = new Promise((settleClosed) => {
|
|
207
|
+
close = settleClosed;
|
|
208
|
+
});
|
|
209
|
+
let cleanup;
|
|
210
|
+
const finish = () => cleanup ??= (async () => {
|
|
211
|
+
let timer;
|
|
212
|
+
if (!await Promise.race([pending.then(() => true), new Promise((settleDrain) => {
|
|
213
|
+
timer = setTimeout(() => settleDrain(false), 35e3);
|
|
214
|
+
})]).finally(() => clearTimeout(timer))) throw failure;
|
|
215
|
+
const result = await pending;
|
|
216
|
+
if ("error" in result && result.error instanceof Error && "reportCleanup" in result.error) throw result.error;
|
|
217
|
+
})().finally(() => close());
|
|
218
|
+
let notifyAbort;
|
|
219
|
+
const aborted = new Promise((settleAbort) => {
|
|
220
|
+
notifyAbort = () => settleAbort({ aborted: true });
|
|
221
|
+
});
|
|
222
|
+
const childAborted = () => notifyAbort();
|
|
223
|
+
controller.signal.addEventListener("abort", childAborted, { once: true });
|
|
224
|
+
const abort = () => controller.abort(signal.reason);
|
|
225
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
226
|
+
trackReportResource(context, closed, finish, signal, failure);
|
|
227
|
+
const deadline = setTimeout(() => controller.abort(), timeoutMs);
|
|
228
|
+
if (signal.aborted) abort();
|
|
229
|
+
const outcome = await Promise.race([pending, aborted]);
|
|
230
|
+
clearTimeout(deadline);
|
|
231
|
+
signal.removeEventListener("abort", abort);
|
|
232
|
+
controller.signal.removeEventListener("abort", childAborted);
|
|
233
|
+
await finish();
|
|
234
|
+
signal.throwIfAborted();
|
|
235
|
+
if ("aborted" in outcome) throw new Error("SwiftPM cache provider timed out.");
|
|
236
|
+
if ("error" in outcome) throw outcome.error;
|
|
237
|
+
return outcome.value;
|
|
238
|
+
}
|
|
239
|
+
const fileKey = (key) => `swiftpm/v1/${key}`;
|
|
240
|
+
async function contained(path, directory) {
|
|
241
|
+
const rel = relative(await realpath(directory), await realpath(path));
|
|
242
|
+
if (!rel || isAbsolute(rel) || rel === ".." || rel.startsWith(`..${sep}`) || !(await lstat(path)).isFile()) throw new Error("The shared SwiftPM cache file is outside its download directory or is not a regular file.");
|
|
243
|
+
}
|
|
244
|
+
function swiftpmArtifactCache(context, root, settings, recipe, build) {
|
|
245
|
+
const declaration = settingValueAt(settings, "macos.artifactInputs");
|
|
246
|
+
if (!declaration) return void 0;
|
|
247
|
+
const policy = artifactCachePolicy(resolveOptimizations(settings, context.env), true, false);
|
|
248
|
+
if (!policy.read) return void 0;
|
|
249
|
+
const activeSignal = () => runCancellationSignal(context) ?? context.signal;
|
|
250
|
+
const localRoot = sharedBuildCache();
|
|
251
|
+
const local = createFilesystemFileCache(join(localRoot, "macos"));
|
|
252
|
+
const storeLocal = async (key, sourcePath, signal) => {
|
|
253
|
+
register({
|
|
254
|
+
dir: localRoot,
|
|
255
|
+
registeredBy: root,
|
|
256
|
+
name: "Build cache",
|
|
257
|
+
prune: "entries",
|
|
258
|
+
entriesDepth: 2,
|
|
259
|
+
note: "completed native artifacts keyed on build inputs"
|
|
260
|
+
});
|
|
261
|
+
await local.store({
|
|
262
|
+
key: fileKey(key),
|
|
263
|
+
sourcePath,
|
|
264
|
+
overwrite: true,
|
|
265
|
+
signal
|
|
266
|
+
});
|
|
267
|
+
};
|
|
268
|
+
let provider;
|
|
269
|
+
const shared = () => provider ??= (async () => {
|
|
270
|
+
const signal = activeSignal();
|
|
271
|
+
if (!policy.remote) return null;
|
|
272
|
+
const settingsContext = await projectSettingsContextAsync(root, void 0, {
|
|
273
|
+
env: context.env,
|
|
274
|
+
signal,
|
|
275
|
+
declareFor: context
|
|
276
|
+
});
|
|
277
|
+
const loaded = await loadCacheProvider({
|
|
278
|
+
projectRoot: root,
|
|
279
|
+
config: resolveCacheProviderConfig(settingsContext),
|
|
280
|
+
env: context.env
|
|
281
|
+
});
|
|
282
|
+
if (loaded.unavailable) throw new Error(loaded.unavailable);
|
|
283
|
+
return loaded.provider?.files ?? null;
|
|
284
|
+
})();
|
|
285
|
+
const unpack = async (path, key, directory) => {
|
|
286
|
+
const signal = activeSignal();
|
|
287
|
+
const bundle = join(directory, "Cached.app");
|
|
288
|
+
await unpackMacosArtifact(path, key, bundle, signal);
|
|
289
|
+
await recipe.validateFetched(bundle, recipe.bundleId);
|
|
290
|
+
await validateMacosArtifactPlatform(context, bundle, recipe.product, signal);
|
|
291
|
+
return bundle;
|
|
292
|
+
};
|
|
293
|
+
const identity = async () => {
|
|
294
|
+
const signal = activeSignal();
|
|
295
|
+
return swiftpmArtifactSnapshot(root, declaration, build, await readSwiftpmArtifactToolchain(context, signal, root), context.env, signal);
|
|
296
|
+
};
|
|
297
|
+
return {
|
|
298
|
+
peer: () => policy.remote ? {
|
|
299
|
+
inputs: swiftpmArtifactInputs(declaration),
|
|
300
|
+
write: policy.write
|
|
301
|
+
} : null,
|
|
302
|
+
identity,
|
|
303
|
+
async has(key) {
|
|
304
|
+
const signal = activeSignal();
|
|
305
|
+
if (!await local.stat({
|
|
306
|
+
key: fileKey(key),
|
|
307
|
+
signal
|
|
308
|
+
})) return false;
|
|
309
|
+
const directory = await mkdtemp(join(tmpdir(), "stim-macos-cache-plan-"));
|
|
310
|
+
let retainDirectory = false;
|
|
311
|
+
try {
|
|
312
|
+
const source = await local.resolve({
|
|
313
|
+
key: fileKey(key),
|
|
314
|
+
destinationDir: directory,
|
|
315
|
+
signal
|
|
316
|
+
});
|
|
317
|
+
if (!source) return false;
|
|
318
|
+
await unpack(source, key, directory);
|
|
319
|
+
return true;
|
|
320
|
+
} catch (error) {
|
|
321
|
+
if (error instanceof Error && "reportCleanup" in error) {
|
|
322
|
+
retainDirectory = true;
|
|
323
|
+
throw error;
|
|
324
|
+
}
|
|
325
|
+
signal.throwIfAborted();
|
|
326
|
+
return false;
|
|
327
|
+
} finally {
|
|
328
|
+
if (!retainDirectory) await rm(directory, {
|
|
329
|
+
recursive: true,
|
|
330
|
+
force: true
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
async restore(key, directory) {
|
|
335
|
+
const signal = activeSignal();
|
|
336
|
+
await mkdir(directory, { recursive: true });
|
|
337
|
+
const cached = await local.resolve({
|
|
338
|
+
key: fileKey(key),
|
|
339
|
+
destinationDir: directory,
|
|
340
|
+
signal
|
|
341
|
+
});
|
|
342
|
+
if (cached) try {
|
|
343
|
+
return {
|
|
344
|
+
bundle: await unpack(cached, key, directory),
|
|
345
|
+
tier: "local"
|
|
346
|
+
};
|
|
347
|
+
} catch (error) {
|
|
348
|
+
if (error instanceof Error && "reportCleanup" in error) throw error;
|
|
349
|
+
signal.throwIfAborted();
|
|
350
|
+
await rm(join(directory, "Cached.app"), {
|
|
351
|
+
recursive: true,
|
|
352
|
+
force: true
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
const files = await shared();
|
|
356
|
+
if (!files) return null;
|
|
357
|
+
const result = await providerCall((childSignal) => files.resolve({
|
|
358
|
+
key: fileKey(key),
|
|
359
|
+
destinationDir: directory,
|
|
360
|
+
signal: childSignal
|
|
361
|
+
}), buildResolveTimeoutMs(context.env), context, directory, signal);
|
|
362
|
+
signal.throwIfAborted();
|
|
363
|
+
if (!result) return null;
|
|
364
|
+
await contained(result, directory);
|
|
365
|
+
const bundle = await unpack(result, key, directory);
|
|
366
|
+
await storeLocal(key, result, signal);
|
|
367
|
+
return {
|
|
368
|
+
bundle,
|
|
369
|
+
tier: "provider"
|
|
370
|
+
};
|
|
371
|
+
},
|
|
372
|
+
async store(key, bundle, directory) {
|
|
373
|
+
const signal = activeSignal();
|
|
374
|
+
const canonical = join(directory, "Canonical.app");
|
|
375
|
+
await cp(bundle, canonical, {
|
|
376
|
+
recursive: true,
|
|
377
|
+
verbatimSymlinks: true,
|
|
378
|
+
filter: () => {
|
|
379
|
+
signal.throwIfAborted();
|
|
380
|
+
return true;
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
await cp(resolve(root, build.infoPlist), join(canonical, "Contents", "Info.plist"));
|
|
384
|
+
await reidentifyBundle(context, canonical, recipe.bundleId);
|
|
385
|
+
await recipe.validateFetched(canonical, recipe.bundleId);
|
|
386
|
+
const sourcePath = join(directory, "artifact.cache");
|
|
387
|
+
await packMacosArtifact(canonical, key, sourcePath, signal);
|
|
388
|
+
if ((await identity()).key !== key) throw new Error("SwiftPM inputs changed while the cache entry was packed.");
|
|
389
|
+
await storeLocal(key, sourcePath, signal);
|
|
390
|
+
const files = await shared();
|
|
391
|
+
if (!files) return;
|
|
392
|
+
await providerCall((childSignal) => files.store({
|
|
393
|
+
key: fileKey(key),
|
|
394
|
+
sourcePath,
|
|
395
|
+
overwrite: true,
|
|
396
|
+
signal: childSignal
|
|
397
|
+
}), buildUploadTimeoutMs(context.env), context, directory, signal);
|
|
398
|
+
signal.throwIfAborted();
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
//#endregion
|
|
403
|
+
//#region src/integrations/swiftpm-macos.ts
|
|
404
|
+
function swiftpmMacosProject(root) {
|
|
405
|
+
return { async prepare(context, settings) {
|
|
406
|
+
const macos = settings.macos;
|
|
407
|
+
if (!macos?.product || !macos.infoPlist) throw Object.assign(/* @__PURE__ */ new Error("Set macos.product and macos.infoPlist explicitly in .stim.json. See stim guide macos."), { code: "STIM_BAD_ARG" });
|
|
408
|
+
const { product, infoPlist } = macos;
|
|
409
|
+
const { bundleId } = await validateInfoPlist(context, root, product, infoPlist);
|
|
410
|
+
const repository = realpathSync(await repoRootAsync(root, {
|
|
411
|
+
env: context.env,
|
|
412
|
+
signal: context.signal
|
|
413
|
+
}) ?? root);
|
|
414
|
+
const extras = resolveBundleExtras(root, repository, macos.resources, macos.assetCatalog);
|
|
415
|
+
const recipe = {
|
|
416
|
+
product,
|
|
417
|
+
arguments: macos.arguments ?? [],
|
|
418
|
+
bundleId,
|
|
419
|
+
async compile({ scratch, writer, note }) {
|
|
420
|
+
await tool(context, root, [
|
|
421
|
+
"build",
|
|
422
|
+
"-c",
|
|
423
|
+
"debug",
|
|
424
|
+
"--product",
|
|
425
|
+
product,
|
|
426
|
+
"--scratch-path",
|
|
427
|
+
scratch,
|
|
428
|
+
"--jobs",
|
|
429
|
+
"2"
|
|
430
|
+
], writer, note);
|
|
431
|
+
return tool(context, root, [
|
|
432
|
+
"build",
|
|
433
|
+
"-c",
|
|
434
|
+
"debug",
|
|
435
|
+
"--scratch-path",
|
|
436
|
+
scratch,
|
|
437
|
+
"--show-bin-path"
|
|
438
|
+
], writer, () => {}, true);
|
|
439
|
+
},
|
|
440
|
+
stage: (bin, bundle, id, displayName) => stageBundle(context, root, product, infoPlist, bin, bundle, id, extras, displayName),
|
|
441
|
+
async validateFetched(bundle, id, displayName) {
|
|
442
|
+
const executable = join(bundle, "Contents", "MacOS", product);
|
|
443
|
+
const plist = JSON.parse(await getExecutor().runFileAsync("plutil", [
|
|
444
|
+
"-convert",
|
|
445
|
+
"json",
|
|
446
|
+
"-o",
|
|
447
|
+
"-",
|
|
448
|
+
join(bundle, "Contents", "Info.plist")
|
|
449
|
+
], {
|
|
450
|
+
timeoutMs: 1e4,
|
|
451
|
+
declareFor: context
|
|
452
|
+
}));
|
|
453
|
+
if (plist.CFBundleIdentifier !== id || plist.CFBundleExecutable !== product || !existsSync(executable)) throw new Error("The fetched macOS bundle does not match the requested identity and executable.");
|
|
454
|
+
for (const destination of [...Object.keys(extras.resources), ...extras.assetCatalog ? ["Assets.car"] : []]) if (!existsSync(join(bundle, "Contents", "Resources", destination))) throw new Error(`The fetched macOS bundle lacks declared resource ${destination}.`);
|
|
455
|
+
if (displayName !== void 0) {
|
|
456
|
+
await setBundleName(context, join(bundle, "Contents", "Info.plist"), displayName);
|
|
457
|
+
await getExecutor().runFileAsync("codesign", [
|
|
458
|
+
"--force",
|
|
459
|
+
"--sign",
|
|
460
|
+
"-",
|
|
461
|
+
bundle
|
|
462
|
+
], {
|
|
463
|
+
timeoutMs: "unbounded",
|
|
464
|
+
declareFor: context
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
await getExecutor().runFileAsync("codesign", [
|
|
468
|
+
"--verify",
|
|
469
|
+
"--strict",
|
|
470
|
+
bundle
|
|
471
|
+
], {
|
|
472
|
+
timeoutMs: "unbounded",
|
|
473
|
+
declareFor: context
|
|
474
|
+
});
|
|
475
|
+
},
|
|
476
|
+
offload: {
|
|
477
|
+
target: async () => ({
|
|
478
|
+
platform: "macos",
|
|
479
|
+
local: await macosToolchainAsync()
|
|
480
|
+
}),
|
|
481
|
+
request: (id) => ({
|
|
482
|
+
platform: "macos",
|
|
483
|
+
product,
|
|
484
|
+
infoPlist: relative(root, resolve(root, infoPlist)),
|
|
485
|
+
bundleId: id,
|
|
486
|
+
resources: Object.fromEntries(Object.entries(extras.resources).map(([destination, source]) => [destination, relative(repository, source)])),
|
|
487
|
+
assetCatalog: extras.assetCatalog ? relative(repository, extras.assetCatalog) : null
|
|
488
|
+
})
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
recipe.cache = swiftpmArtifactCache(context, root, settings, recipe, {
|
|
492
|
+
product,
|
|
493
|
+
infoPlist,
|
|
494
|
+
resources: Object.fromEntries(Object.entries(extras.resources).map(([destination, source]) => [destination, relative(root, source)])),
|
|
495
|
+
assetCatalog: extras.assetCatalog ? relative(root, extras.assetCatalog) : null
|
|
496
|
+
});
|
|
497
|
+
return recipe;
|
|
498
|
+
} };
|
|
499
|
+
}
|
|
500
|
+
async function tool(context, root, args, writer, note, capture = false) {
|
|
501
|
+
const child = spawnDeclared(context, () => getExecutor().spawn("swift", args, {
|
|
502
|
+
cwd: root,
|
|
503
|
+
detached: true,
|
|
504
|
+
stdio: [
|
|
505
|
+
"ignore",
|
|
506
|
+
"pipe",
|
|
507
|
+
"pipe"
|
|
508
|
+
]
|
|
509
|
+
}));
|
|
510
|
+
let stdout = "";
|
|
511
|
+
child.stdout?.on("data", (chunk) => {
|
|
512
|
+
if (capture) stdout += chunk.toString("utf8");
|
|
513
|
+
});
|
|
514
|
+
const write = (msg) => {
|
|
515
|
+
writer.write({
|
|
516
|
+
src: "build",
|
|
517
|
+
platform: "macos",
|
|
518
|
+
level: "debug",
|
|
519
|
+
msg
|
|
520
|
+
});
|
|
521
|
+
note(msg);
|
|
522
|
+
};
|
|
523
|
+
if (child.stdout) logLines(child.stdout, write);
|
|
524
|
+
if (child.stderr) logLines(child.stderr, write);
|
|
525
|
+
await new Promise((done, reject) => {
|
|
526
|
+
child.once("error", reject);
|
|
527
|
+
child.once("close", (code) => code === 0 ? done() : reject(/* @__PURE__ */ new Error(`swift ${args[0]} failed (${code}). See stim logs --source build.`)));
|
|
528
|
+
});
|
|
529
|
+
return stdout.trim();
|
|
530
|
+
}
|
|
531
|
+
//#endregion
|
|
532
|
+
export { swiftpmMacosProject };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as spawnDeclared, t as getExecutor } from "./exec-DEoAhcze.mjs";
|
|
2
2
|
import { n as stripAnsi, r as waitForChild, t as createLineReader } from "./process-output-Fpl8PYi8.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { o as androidHome } from "./android-
|
|
5
|
-
import { b as bundlerPin, h as startBuildHeartbeat, r as HEARTBEAT_INTERVAL_MS } from "./xcode-
|
|
3
|
+
import { a as killOnAbort } from "./operation-exec-BW0em61G.mjs";
|
|
4
|
+
import { o as androidHome } from "./android-C7sVmyI9.mjs";
|
|
5
|
+
import { b as bundlerPin, h as startBuildHeartbeat, r as HEARTBEAT_INTERVAL_MS } from "./xcode-iQnROM5o.mjs";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import { existsSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync } from "node:fs";
|
|
8
8
|
import { homedir, tmpdir } from "node:os";
|
|
@@ -727,7 +727,10 @@ function androidRequirements(projectRoot) {
|
|
|
727
727
|
function iphoneRuntimes(listed) {
|
|
728
728
|
const devices = listed?.devices;
|
|
729
729
|
if (!devices || typeof devices !== "object") return [];
|
|
730
|
-
return Object.entries(devices).filter(([, list]) => (Array.isArray(list) ? list : []).some(
|
|
730
|
+
return Object.entries(devices).filter(([, list]) => (Array.isArray(list) ? list : []).some(availableIphone)).map(([runtime]) => runtime).toSorted();
|
|
731
|
+
}
|
|
732
|
+
function availableIphone(device) {
|
|
733
|
+
return device.isAvailable === true && typeof device.deviceTypeIdentifier === "string" && device.deviceTypeIdentifier.startsWith("com.apple.CoreSimulator.SimDeviceType.iPhone-");
|
|
731
734
|
}
|
|
732
735
|
function listDir(path) {
|
|
733
736
|
try {
|
|
@@ -870,4 +873,4 @@ function toolchainMismatches(target, worker) {
|
|
|
870
873
|
return out;
|
|
871
874
|
}
|
|
872
875
|
//#endregion
|
|
873
|
-
export {
|
|
876
|
+
export { runCaptured as _, iosToolchainAsync as a, macosToolchain as c, toolchainMismatches as d, workerToolchain as f, readRubyVersion as g, readPodState as h, availableIphone as i, macosToolchainAsync as l, podsAreStale as m, androidToolchain as n, iphoneRuntimes as o, DEPS_ERROR as p, androidToolchainAsync as r, jdkMajor as s, androidRequirements as t, parseAndroidRequirements as u, runPodInstall as v };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { t as getExecutor } from "./exec-
|
|
1
|
+
import { t as getExecutor } from "./exec-DEoAhcze.mjs";
|
|
2
2
|
import { t as resolveMaintenanceSettings } from "./settings-Djl-mpjX.mjs";
|
|
3
3
|
import { t as spawnEntry } from "./spawn-entry-jw19m8Nl.mjs";
|
|
4
|
-
import { n as windowsLauncherArgs } from "./detached-entry-
|
|
4
|
+
import { n as windowsLauncherArgs } from "./detached-entry-BwNEtIrP.mjs";
|
|
5
5
|
import { n as stampAttempt, r as due, t as capChildLog } from "./attempt-DW-mQqM7.mjs";
|
|
6
|
+
import { readClaimSet } from "@stim-cli/core/ownership-claim";
|
|
6
7
|
import { closeSync, openSync } from "node:fs";
|
|
7
8
|
import { maintenanceChildLogFile, maintenanceRunClaims, readMaintenanceAttempt, readMaintenanceState } from "@stim-cli/core/state";
|
|
8
|
-
import { readClaimSet } from "@stim-cli/core/ownership-claim";
|
|
9
9
|
//#region src/maintenance/trigger.ts
|
|
10
10
|
const WARNING_FRESH_MS = 6e5;
|
|
11
11
|
function warnCriticalDisk() {
|