stim 1.23.1 → 1.25.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 +3 -2
- package/dist/{acquire-artifact-BzYRDgaP.mjs → acquire-artifact-zA4S7RHE.mjs} +2 -2
- package/dist/{act-vxiMwdf5.mjs → act-BbHS3oV8.mjs} +41 -26
- package/dist/{activity-BpWUPgUm.mjs → activity-BpjwrQXU.mjs} +6 -6
- package/dist/{agent-device-usage-output-CUlLsbRt.mjs → agent-device-usage-output-Bnkerfod.mjs} +5 -5
- package/dist/{android-DtfRGLcc.mjs → android-BGwuK3Mc.mjs} +75 -50
- package/dist/{android-CLi6DSiS.mjs → android-CNZgRC-4.mjs} +5 -5
- package/dist/{android-C7sVmyI9.mjs → android-Cjcj8MCw.mjs} +140 -46
- package/dist/{android-cas-ngferVq2.mjs → android-cas-BVqh2Zep.mjs} +3 -3
- package/dist/android-cas-compiler.mjs +1 -1
- package/dist/{android-project-DVWyCbWU.d.mts → android-project-CTYaETc0.d.mts} +6 -2
- package/dist/{android-DR5lZ2Az.mjs → android-saBeB4lr.mjs} +13 -3
- package/dist/api.d.mts +22 -5
- package/dist/api.mjs +32 -31
- package/dist/{artifact-Xvgibgzq.mjs → artifact-Co8zixVx.mjs} +19 -17
- package/dist/{artifact-DBI3DALs.mjs → artifact-DN8JNwqS.mjs} +18 -17
- package/dist/{artifact-platform-CXcmX_j3.mjs → artifact-platform-CMRc0M_r.mjs} +3 -3
- package/dist/{browser-web-BJN9ZHxB.mjs → browser-web-CCgZsHmI.mjs} +16 -17
- package/dist/{budget-3ivAK99e.mjs → budget-HyShrIpL.mjs} +149 -47
- package/dist/{build-Dv9s8Fz-.mjs → build-CAiw8Ezm.mjs} +33 -29
- package/dist/{build-cache-Dv7RN200.mjs → build-cache-CKCzxzxA.mjs} +172 -21
- package/dist/{build-plan-BmbdHQbr.mjs → build-plan-zCuHGlA8.mjs} +8 -7
- package/dist/{cache-manifest-DSeQjt-Q.mjs → cache-manifest-BPXRONJz.mjs} +1 -1
- package/dist/cache-manifest.mjs +1 -1
- package/dist/{ccache-CH2EWGPB.mjs → ccache-h1FKhZeg.mjs} +6 -6
- package/dist/{cdp-3fwICjzi.mjs → cdp-BG3FJCCx.mjs} +1 -1
- package/dist/{chrome-Bbw689-6.mjs → chrome-BvV8ssI3.mjs} +1 -1
- package/dist/{cli-BkK6Wr5i.mjs → cli-C4w607Pz.mjs} +20 -20
- package/dist/cli.mjs +1 -1
- package/dist/{client-B4MMzfo_.mjs → client-BQsmyp_-.mjs} +274 -39
- package/dist/collector-run.mjs +6 -6
- package/dist/{command-output-YKGWivpG.mjs → command-output-BBvS1H6v.mjs} +3 -2
- package/dist/{config-DlrsduwG.mjs → config-BZhXY15H.mjs} +3 -3
- package/dist/{created-devices-x9rN6bhs.mjs → created-devices-D2Aca-xu.mjs} +6 -2
- package/dist/{dependency-state-1I9KZT1Y.mjs → dependency-state-BwNCYG5Q.mjs} +2 -2
- package/dist/{detached-entry-BwNEtIrP.mjs → detached-entry-KmieOKgN.mjs} +1 -1
- package/dist/{dev-client-BFxiDpkf.mjs → dev-client-CHoXXZeg.mjs} +3 -3
- package/dist/{device-CiNYxqp6.mjs → device-B9FqTBYW.mjs} +81 -54
- package/dist/{device-B7ljwccX.mjs → device-F5-4z9ef.mjs} +16 -16
- package/dist/{device-capacity-DH0QsZYZ.mjs → device-capacity-ZYaRALv5.mjs} +20 -16
- package/dist/device-host-worker.mjs +17 -17
- package/dist/{device-ios-CbVDtDIy.mjs → device-ios-DkHBrmvH.mjs} +32 -50
- package/dist/{device-lease-run-DXPSwdbb.mjs → device-lease-run-ogEeJ62K.mjs} +6 -6
- package/dist/{device-pool-B4iOXIrD.mjs → device-pool-BIg8MU8l.mjs} +3 -3
- package/dist/{doctor-DRu-8ld6.mjs → doctor-A_Nr_fDe.mjs} +1 -1
- package/dist/{doctor-HUC1igzw.mjs → doctor-Bm8TVpGn.mjs} +37 -31
- package/dist/{doctor-fingerprint-DZLoYFVb.mjs → doctor-fingerprint-zlujA1Gs.mjs} +1 -1
- package/dist/doctor-fingerprint.mjs +1 -1
- package/dist/{doctor-C6t4Maue.mjs → doctor-k3P3PizH.mjs} +14 -14
- package/dist/{doctor-watchman-iGBpC6KM.mjs → doctor-watchman-BovI1y3-.mjs} +5 -5
- package/dist/{eas-build-DMWSSvxq.mjs → eas-build-CyDKNTBP.mjs} +4 -4
- package/dist/{eas-fallback-vKlrqxgE.mjs → eas-fallback-gaZi-dJL.mjs} +16 -15
- package/dist/{eas-session-ledger-BQF9Yyy9.mjs → eas-session-ledger-BMCA1gdO.mjs} +12 -8
- package/dist/{error-diagnostics-DYsjJIHz.mjs → error-diagnostics-B1Mj_-7h.mjs} +17 -42
- package/dist/{errors-ccaPc4ox.mjs → errors-DHm_U5gv.mjs} +2 -1
- package/dist/{exec-DEoAhcze.mjs → exec-VFRpu1iA.mjs} +116 -28
- package/dist/{gc-BW8E1uSC.mjs → gc-B9jcnmIk.mjs} +205 -28
- package/dist/{gc-dDE4QPVu.mjs → gc-eaz403W6.mjs} +2 -2
- package/dist/{guide-DYYEO3Wz.mjs → guide-DR0K0xW9.mjs} +328 -89
- package/dist/{hosted-android-xcfgCgSF.mjs → hosted-android-Bvb2-ZxD.mjs} +4 -4
- package/dist/{hosted-client-Bt-tndxV.mjs → hosted-client-rsRqysJc.mjs} +4 -4
- package/dist/{hosted-ios-y19jCYFF.mjs → hosted-ios-RtVcJH3u.mjs} +1 -1
- package/dist/{hosted-logs-DzJKzKlj.mjs → hosted-logs-CWKGYWNX.mjs} +11 -6
- package/dist/{hosted-macos-BJusKvqL.mjs → hosted-macos-d0pv9Tth.mjs} +7 -7
- package/dist/{hosted-native-BmQC6U_x.mjs → hosted-native-BxTizGU2.mjs} +58 -11
- package/dist/{idle-shutdown-CJmUOV5x.mjs → idle-shutdown-BIyfl0Zj.mjs} +10 -10
- package/dist/{ios-hcBpnEGk.mjs → ios-BQzvJlzw.mjs} +122 -17
- package/dist/{ios-CWjqfSm_.mjs → ios-BRVM8b0P.mjs} +81 -49
- package/dist/{ios-DTOYZGMJ.mjs → ios-Dvt97HgQ.mjs} +8 -8
- package/dist/{ios-xtlRHaeB.mjs → ios-ENC4sRPA.mjs} +1 -1
- package/dist/{ios-device-BXZ0c7Kb.mjs → ios-device-B6HK951C.mjs} +1 -1
- package/dist/{ios-device-DFGuwF4U.mjs → ios-device-CKSvk0bu.mjs} +3 -3
- package/dist/{ios-project-CSZYI1iu.mjs → ios-project-DCUDo06I.mjs} +5 -5
- package/dist/{ios-signing-BtAffm0A.mjs → ios-signing-4c_qXvQm.mjs} +2 -2
- package/dist/{ios-state-Dtw5K2aI.mjs → ios-state-CT9nV5SP.mjs} +15 -7
- package/dist/{js-swap-BSBHldmm.mjs → js-swap-Z9HbC4cj.mjs} +7 -6
- package/dist/{launch-D-zq8SHG.mjs → launch-D0lPvFFu.mjs} +49 -30
- package/dist/{launch-CP2wDCVd.mjs → launch-DscF1QfM.mjs} +52 -50
- package/dist/{logs-pNvA2hHK.mjs → logs-BsIRre8x.mjs} +16 -9
- package/dist/{logs-By5aw3g9.mjs → logs-Crs9y34Z.mjs} +8 -6
- package/dist/{macos-CPMahOC2.mjs → macos-CcUlJPMu.mjs} +1 -1
- package/dist/{macos-C67FZ2ft.mjs → macos-D477nfzH.mjs} +49 -42
- package/dist/macos-run.mjs +1 -1
- package/dist/maintenance-run.mjs +7 -7
- package/dist/{metro-DiXtA3Ty.mjs → metro-1pJgCX4U.mjs} +4 -4
- package/dist/{metro-gateway-CKZqKqx7.mjs → metro-gateway-Bp9gJQAN.mjs} +3 -4
- package/dist/{named-ports-DkEzOfzO.mjs → named-ports-BVbn8SvC.mjs} +3 -3
- package/dist/{native-android-_MWSs3PP.mjs → native-android-BvMizJn1.mjs} +17 -17
- package/dist/{native-gradle-artifact-inputs-DHFnmrVf.mjs → native-gradle-artifact-inputs-BJscK4vN.mjs} +5 -5
- package/dist/{native-run-Dv88i0aU.mjs → native-run-D5OJsGwA.mjs} +6 -6
- package/dist/{native-runtime-DBRfY_PN.mjs → native-runtime-B9w_Qyz3.mjs} +10 -9
- package/dist/{native-source-Y0yLhFyQ.mjs → native-source-D-4Dh4JU.mjs} +7 -4
- package/dist/{native-xcode-inputs-CqViUh3r.mjs → native-xcode-inputs-Cv4l-obn.mjs} +2 -2
- package/dist/{native-xcode-ios-vFgqL_yS.mjs → native-xcode-ios-DGrg90hE.mjs} +21 -20
- package/dist/offload-worker.d.mts +12 -4
- package/dist/offload-worker.mjs +78 -43
- package/dist/{operation-exec-BW0em61G.mjs → operation-exec-CUZifp6Z.mjs} +2 -25
- package/dist/{ownership-C5fo5Edb.mjs → ownership-jxxz-19m.mjs} +3 -3
- package/dist/{page-DBL2PiUU.mjs → page-CzEA_-5_.mjs} +2 -3
- package/dist/phone-reverses-CYb7RRAx.mjs +57 -0
- package/dist/{placement-log-BnGgJRRZ.mjs → placement-log-DjOXJRIH.mjs} +1 -1
- package/dist/{plan-placement-cr0fEU7b.mjs → plan-placement-BqKgKHCi.mjs} +3 -3
- package/dist/{ports-DpXjKkSV.mjs → ports-DtS1Amb0.mjs} +3 -3
- package/dist/{prebuild-BligW0QS.mjs → prebuild-JUaqOLpc.mjs} +14 -9
- package/dist/{project-DhCtQWWU.mjs → project-BiC68mIp.mjs} +21 -17
- package/dist/{pull-request-W1IuLXDt.mjs → pull-request-CbNlkFok.mjs} +2 -2
- package/dist/pull-requests.mjs +1 -1
- package/dist/{react-native-android-ZlhQfhvq.mjs → react-native-android-DRYqoJc4.mjs} +76 -32
- package/dist/{react-native-build-CelbTO_y.mjs → react-native-build-CwZB-agu.mjs} +23 -20
- package/dist/{react-native-doctor-LTIaP7lv.mjs → react-native-doctor-BCrytK7h.mjs} +10 -9
- package/dist/{react-native-ios-C5W0SA6f.mjs → react-native-ios-Cr1buNFo.mjs} +41 -24
- package/dist/{recordings-CQmfzAh7.mjs → recordings-BaoQ0t-J.mjs} +1 -1
- package/dist/{registration-BcRgF6Ox.mjs → registration-CN6nlhcD.mjs} +1 -1
- package/dist/{reload-QcwnYLYV.mjs → reload-Beftw2X3.mjs} +1 -1
- package/dist/{reload-COJWTbae.mjs → reload-FbSgMF8x.mjs} +144 -42
- package/dist/{remote-DR8qUERM.mjs → remote-BuZj6AyU.mjs} +16 -7
- package/dist/{result-utnBea7x.mjs → result-CR2vk2cj.mjs} +41 -18
- package/dist/{run-DidHghD1.mjs → run-BtzE09Dl.mjs} +2 -2
- package/dist/{selection-DSMbWEX2.mjs → selection-D5cxEl3t.mjs} +13 -7
- package/dist/{server-bare-CafzuyFB.mjs → server-bare-CH9X0RLn.mjs} +56 -4
- package/dist/{server-command-B9o92sLM.mjs → server-command-CaBbDNU2.mjs} +5 -5
- package/dist/server-expo-C16Zf2k7.mjs +2 -0
- package/dist/{server-expo-BXrWxNYh.mjs → server-expo-Ck8EIidM.mjs} +14 -9
- package/dist/{settings-C7O8A6ZI.mjs → settings-B5tCoq9N.mjs} +132 -39
- package/dist/{settings-PfJx8uK1.mjs → settings-DzH9mGQZ.mjs} +1 -1
- package/dist/{settings-write-Chuy7Cte.mjs → settings-write-n0zwfohx.mjs} +7 -7
- package/dist/settings.schema.json +51 -0
- package/dist/{simslim-BNckWpXi.mjs → simslim-BjxszUAb.mjs} +22 -7
- package/dist/{slot-launch-B7AuoWJv.mjs → slot-launch-QeuJMlnJ.mjs} +6 -6
- package/dist/{stage-C4u17aES.mjs → stage-D8xlRU2D.mjs} +2 -3
- package/dist/{start-BL_BsiWt.mjs → start-C1JLjkNw.mjs} +1 -1
- package/dist/{start-CU8mCPC7.mjs → start-YMpNwLhh.mjs} +75 -35
- package/dist/{state--smjFSTL.mjs → state-DMRNP7-4.mjs} +4 -4
- package/dist/{state-08I3hw3_.mjs → state-DPaM3u5K.mjs} +2 -2
- package/dist/{stats-CO6sK0Nh.mjs → stats-CP7STzZw.mjs} +5 -5
- package/dist/{stats-report-BzaPrRm6.mjs → stats-report-n2U5plhk.mjs} +1 -1
- package/dist/{status-_WPHzVft.mjs → status-CRLiJ-O_.mjs} +24 -24
- package/dist/{status-BRROykC8.mjs → status-Fect2w9R.mjs} +1 -1
- package/dist/{status-CrJutl6-.mjs → status-cNw6i0_t.mjs} +1 -1
- package/dist/{status-watch-BHFasOZN.mjs → status-watch-Bc2J4TZn.mjs} +5 -5
- package/dist/status-worker.mjs +1 -1
- package/dist/stim-clonefile.c +18 -0
- package/dist/{stim-desktop-D5OGpYZM.mjs → stim-desktop-DS0mzR8U.mjs} +2 -2
- package/dist/{stop-iuFHjUST.mjs → stop-Br7LKxBE.mjs} +2 -2
- package/dist/{stop-CR5689oB.mjs → stop-COP6PQqw.mjs} +5 -5
- package/dist/{stop-BJ06ipTZ.mjs → stop-Db9Kh-UA.mjs} +109 -56
- package/dist/supervisor-run.mjs +17 -17
- package/dist/{support-CbXPbUMJ.mjs → support-Cxj9CmII.mjs} +6 -6
- package/dist/{support-TWuQlHQo.mjs → support-qKcbgmI5.mjs} +14 -11
- package/dist/{swiftpm-artifact-inputs-DFcGsXDP.mjs → swiftpm-artifact-inputs-iY9fsmOc.mjs} +4 -4
- package/dist/{swiftpm-macos-DbwGCpZg.mjs → swiftpm-macos-Bp_sn9P4.mjs} +15 -14
- package/dist/{toolchain-XkA2PfJZ.mjs → toolchain-DB1aeqxO.mjs} +1 -1
- package/dist/{toolchain-B9hCFCQw.mjs → toolchain-VzLJzZ7O.mjs} +69 -37
- package/dist/trigger-BLsHgAGR.mjs +2 -0
- package/dist/{trigger-Cbyc41d_.mjs → trigger-CBMe2YLH.mjs} +2 -2
- package/dist/{warm-progress-CA3TgT3-.mjs → warm-progress-BV3ZPmcY.mjs} +6 -6
- package/dist/{web-DRF_oFXk.mjs → web-B4Yjyt1G.mjs} +12 -10
- package/dist/web-DS4UDWvf.mjs +2 -0
- package/dist/web-run.mjs +8 -9
- package/dist/windows-report.mjs +12 -1
- package/dist/windows-report.ps1 +1 -1
- package/dist/{workspace-state-U08dEzhG.mjs → workspace-state-CPSp3mav.mjs} +11 -4
- package/dist/{workspaces-e41xsjKr.mjs → workspaces-C9w4aeXF.mjs} +36 -32
- package/dist/{worktree-B4Nj3EGS.mjs → worktree-CclFIe1Z.mjs} +324 -99
- package/dist/{worktree-BEwxVwKF.mjs → worktree-Ct9Gk3KL.mjs} +1 -1
- package/dist/{xcode-Rq744mBF.mjs → xcode-CiIIDnuD.mjs} +42 -28
- package/package.json +7 -7
- package/shim/bundle-response.cjs +53 -1
- package/shim/bundle-response.d.cts +1 -1
- package/shim/expo-metro-config.cjs +23 -1
- package/dist/native-gradle-inputs-Dnh84Zbd.mjs +0 -211
- package/dist/server-expo-Ddr8cG_c.mjs +0 -2
- package/dist/trigger-yb_nFzPF.mjs +0 -2
- package/dist/web-kDE9Myoy.mjs +0 -2
|
@@ -1,41 +1,21 @@
|
|
|
1
|
-
import { t as getExecutor } from "./exec-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { d as resolveProjectMetro } from "./metro-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { r as deviceConsoleLevel } from "./ios-device-
|
|
11
|
-
import { n as parseLogcatLine } from "./android-DR5lZ2Az.mjs";
|
|
1
|
+
import { t as getExecutor } from "./exec-VFRpu1iA.mjs";
|
|
2
|
+
import { H as deviceSlotPlatforms, V as deviceSlotKey, p as getProject } from "./config-BZhXY15H.mjs";
|
|
3
|
+
import { v as launchErrorPreview } from "./command-output-BBvS1H6v.mjs";
|
|
4
|
+
import { r as readWorkspaceState$1 } from "./workspace-state-CPSp3mav.mjs";
|
|
5
|
+
import { I as readWorkspaceLaunches } from "./project-BiC68mIp.mjs";
|
|
6
|
+
import { o as androidHome, u as androidToolCwd } from "./android-Cjcj8MCw.mjs";
|
|
7
|
+
import { d as resolveProjectMetro } from "./metro-1pJgCX4U.mjs";
|
|
8
|
+
import { i as parseLogcatLine, n as androidLogGroups, r as isAndroidCrashText } from "./android-saBeB4lr.mjs";
|
|
9
|
+
import { S as parseLease, v as deviceLeasePath, y as fileLeaseIo } from "./activity-BpjwrQXU.mjs";
|
|
10
|
+
import { r as deviceConsoleLevel } from "./ios-device-B6HK951C.mjs";
|
|
12
11
|
import { createHash, randomUUID } from "node:crypto";
|
|
13
|
-
import { existsSync,
|
|
12
|
+
import { existsSync, readFileSync, renameSync } from "node:fs";
|
|
14
13
|
import { homedir } from "node:os";
|
|
15
14
|
import { basename, dirname, join, resolve, sep } from "node:path";
|
|
16
15
|
import { withDirLockAsync } from "@stim-cli/core";
|
|
17
16
|
import { NATIVE_CRASH_LOG_PREFIX, attachExpoErrorContext, readLogRecords, readLogTimeline } from "@stim-cli/core/state";
|
|
18
17
|
import { mkdir, readFile, readdir, stat, unlink, writeFile } from "node:fs/promises";
|
|
19
18
|
//#region src/diagnostics/diagnostic-store.ts
|
|
20
|
-
/** Publishes an immutable diagnostic snapshot atomically; existing evidence wins. */
|
|
21
|
-
function writeDiagnosticOnce(path, content) {
|
|
22
|
-
mkdirSync(dirname(path), { recursive: true });
|
|
23
|
-
withDirLock$1(`${path}.lock`, () => {
|
|
24
|
-
if (existsSync(path)) return;
|
|
25
|
-
const temporary = `${path}.${randomUUID()}.tmp`;
|
|
26
|
-
try {
|
|
27
|
-
writeFileSync(temporary, content, { flag: "wx" });
|
|
28
|
-
renameSync(temporary, path);
|
|
29
|
-
} finally {
|
|
30
|
-
try {
|
|
31
|
-
unlinkSync(temporary);
|
|
32
|
-
} catch {}
|
|
33
|
-
}
|
|
34
|
-
}, {
|
|
35
|
-
waitMs: 100,
|
|
36
|
-
pollMs: 10
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
19
|
/** Publishes an immutable diagnostic snapshot without blocking on content writes or lock contention. */
|
|
40
20
|
async function writeDiagnosticOnceAsync(path, content, signal) {
|
|
41
21
|
signal?.throwIfAborted();
|
|
@@ -111,19 +91,13 @@ function parseIosCrash(text, target) {
|
|
|
111
91
|
/** Extracts crash-buffer groups only when their own process header names the target app. */
|
|
112
92
|
function parseAndroidCrashes(text, target, clockOffsetMs) {
|
|
113
93
|
const entries = text.split("\n").map((line) => parseLogcatLine(line, { clockOffsetMs })).filter((record) => record !== null && Number(record.ts) >= target.since && Number(record.ts) <= (target.until ?? Infinity));
|
|
114
|
-
|
|
115
|
-
for (const entry of entries) {
|
|
116
|
-
const last = groups.at(-1);
|
|
117
|
-
if (!last || entry.proc !== last.at(-1)?.proc || /^\s*(?:FATAL EXCEPTION:|\*\*\* \*\*\*)/.test(entry.msg ?? "")) groups.push([entry]);
|
|
118
|
-
else last.push(entry);
|
|
119
|
-
}
|
|
120
|
-
return groups.flatMap((group) => {
|
|
94
|
+
return androidLogGroups(entries).flatMap((group) => {
|
|
121
95
|
const messages = group.map((record) => record.msg ?? "");
|
|
122
96
|
const process = messages.map((line) => /^\s*(?:Process: (.+?), PID: \d+|pid: \d+, tid: \d+, name: .*?>>> (.*?) <<<)/.exec(line)).find(Boolean);
|
|
123
97
|
const appId = process?.[1] ?? process?.[2];
|
|
124
98
|
if (appId !== target.appId) return [];
|
|
125
99
|
const msg = messages.join("\n");
|
|
126
|
-
if (
|
|
100
|
+
if (!isAndroidCrashText(msg)) return [];
|
|
127
101
|
return [{
|
|
128
102
|
ts: group[0].ts,
|
|
129
103
|
deviceTs: group[0].deviceTs,
|
|
@@ -590,6 +564,7 @@ async function symbolicateErrors(records, { port, timeoutMs = 2e3, request = fet
|
|
|
590
564
|
}
|
|
591
565
|
//#endregion
|
|
592
566
|
//#region src/diagnostics/error-diagnostics.ts
|
|
567
|
+
const SOURCE_LOCATION = /(?<![^\s()"\\])[^\s()"\\]+:\d+:\d+/g;
|
|
593
568
|
function key(record) {
|
|
594
569
|
return createHash("sha256").update(JSON.stringify(record)).digest("hex");
|
|
595
570
|
}
|
|
@@ -648,12 +623,12 @@ function mergeErrorCopies(records, root) {
|
|
|
648
623
|
record.msg,
|
|
649
624
|
record.stack,
|
|
650
625
|
record.componentStack
|
|
651
|
-
]).replaceAll(root ? `${root}/` : "\0", "").matchAll(
|
|
626
|
+
]).replaceAll(root ? `${root}/` : "\0", "").matchAll(SOURCE_LOCATION)].map(([location]) => location));
|
|
652
627
|
const existing = title && locations.size ? result.findIndex((other) => !(Array.isArray(other.mirroredSources) ? other.mirroredSources : [other.src]).includes(record.src) && (!other.platform || !record.platform || other.platform === record.platform) && errorTitle(other) === title && typeof other.ts === "number" && typeof record.ts === "number" && Math.abs(other.ts - record.ts) < 1e3 && [...JSON.stringify([
|
|
653
628
|
other.msg,
|
|
654
629
|
other.stack,
|
|
655
630
|
other.componentStack
|
|
656
|
-
]).replaceAll(root ? `${root}/` : "\0", "").matchAll(
|
|
631
|
+
]).replaceAll(root ? `${root}/` : "\0", "").matchAll(SOURCE_LOCATION)].some(([location]) => locations.has(location))) : -1;
|
|
657
632
|
if (existing < 0) result.push(record);
|
|
658
633
|
else {
|
|
659
634
|
const prior = result[existing];
|
|
@@ -732,7 +707,7 @@ async function errorDiagnostics(input, { root, logsDir, port, allowRequest = fal
|
|
|
732
707
|
rendered[entry.index] = value;
|
|
733
708
|
if (bundleLocations(value).length === bundleLocations(entry.record).length) continue;
|
|
734
709
|
try {
|
|
735
|
-
|
|
710
|
+
await writeDiagnosticOnceAsync(join(directory, `${key(entry.record)}.json`), JSON.stringify({
|
|
736
711
|
original: key(entry.record),
|
|
737
712
|
rendered: value
|
|
738
713
|
}));
|
|
@@ -179,11 +179,12 @@ function metroStoreConfirmedRoot(line) {
|
|
|
179
179
|
const root = line.slice(51).trim();
|
|
180
180
|
return root === "" ? null : root;
|
|
181
181
|
}
|
|
182
|
-
function expoMetroStoreEnv({ root, storeRoot, adapterPath, existingOverride }) {
|
|
182
|
+
function expoMetroStoreEnv({ root, port, storeRoot, adapterPath, existingOverride }) {
|
|
183
183
|
return {
|
|
184
184
|
EXPO_OVERRIDE_METRO_CONFIG: adapterPath,
|
|
185
185
|
STIM_METRO_STORE: storeRoot,
|
|
186
186
|
STIM_PROJECT_ROOT: root,
|
|
187
|
+
STIM_METRO_PORT: String(port),
|
|
187
188
|
...existingOverride ? { STIM_EXPO_METRO_CONFIG: existingOverride } : {}
|
|
188
189
|
};
|
|
189
190
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
|
+
import { existsSync, rmSync } from "node:fs";
|
|
4
|
+
import { availableParallelism, loadavg, tmpdir } from "node:os";
|
|
2
5
|
import { join } from "node:path";
|
|
3
6
|
import { ambientContext, ambientEnv } from "@stim-cli/core";
|
|
4
7
|
import { createDebugLog, runId } from "@stim-cli/core/state";
|
|
5
|
-
import { basename as basename$1, delimiter as delimiter$1, resolve as resolve$1 } from "path";
|
|
8
|
+
import { basename as basename$1, delimiter as delimiter$1, join as join$1, resolve as resolve$1 } from "path";
|
|
6
9
|
import { execSync } from "child_process";
|
|
7
10
|
import spawn from "cross-spawn";
|
|
8
11
|
import which from "which";
|
|
@@ -122,7 +125,8 @@ async function runReport(context, work, timeoutMs = 6e4) {
|
|
|
122
125
|
const expireCleanup = () => {
|
|
123
126
|
state.failure ??= [...pending.values()].find((failure) => failure !== void 0) ?? Object.assign(/* @__PURE__ */ new Error("Report cleanup did not finish within 35 seconds."), {
|
|
124
127
|
code: "STIM_CLAIM_UNAVAILABLE",
|
|
125
|
-
reportCleanup: true
|
|
128
|
+
reportCleanup: true,
|
|
129
|
+
remedy: "Check that the child processes the report started and their descendants have stopped"
|
|
126
130
|
});
|
|
127
131
|
};
|
|
128
132
|
let cleanupTimer;
|
|
@@ -346,10 +350,58 @@ async function withWorkspaceProcessLock(root, name, fn, { now = Date.now, signal
|
|
|
346
350
|
}
|
|
347
351
|
}
|
|
348
352
|
//#endregion
|
|
353
|
+
//#region src/cancellation.ts
|
|
354
|
+
function cancelledError(what, cause) {
|
|
355
|
+
return Object.assign(new Error(`The ${what} was cancelled.`, cause === void 0 ? void 0 : { cause }), { code: "STIM_CANCELLED" });
|
|
356
|
+
}
|
|
357
|
+
function throwIfCancelled(signal, what) {
|
|
358
|
+
if (signal?.aborted) throw cancelledError(what);
|
|
359
|
+
}
|
|
360
|
+
function cancellableSleep(ms, { signal, what = "wait", ref = true } = {}) {
|
|
361
|
+
return new Promise((resolve, reject) => {
|
|
362
|
+
if (signal?.aborted) return reject(cancelledError(what));
|
|
363
|
+
const onAbort = () => {
|
|
364
|
+
clearTimeout(timer);
|
|
365
|
+
reject(cancelledError(what));
|
|
366
|
+
};
|
|
367
|
+
const timer = setTimeout(() => {
|
|
368
|
+
signal?.removeEventListener("abort", onAbort);
|
|
369
|
+
resolve();
|
|
370
|
+
}, ms);
|
|
371
|
+
if (!ref) timer.unref();
|
|
372
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
//#endregion
|
|
376
|
+
//#region src/process-group-exit.ts
|
|
377
|
+
const BASE_MS = 5e3;
|
|
378
|
+
function loadScaledBudgetMs(baseMs, capMs) {
|
|
379
|
+
const loadPerCpu = (loadavg()[0] ?? 0) / availableParallelism();
|
|
380
|
+
return Math.min(capMs, baseMs * Math.max(1, loadPerCpu));
|
|
381
|
+
}
|
|
382
|
+
function groupExitBudgetMs(capMs = 6e4) {
|
|
383
|
+
return loadScaledBudgetMs(BASE_MS, capMs);
|
|
384
|
+
}
|
|
385
|
+
async function waitForGroupExit(pid, budgetMs) {
|
|
386
|
+
const deadline = performance.now() + budgetMs;
|
|
387
|
+
while ((0, ownership_claim_exports.processGroupAlive)(pid)) {
|
|
388
|
+
if (performance.now() >= deadline) return false;
|
|
389
|
+
await cancellableSleep(25);
|
|
390
|
+
}
|
|
391
|
+
return true;
|
|
392
|
+
}
|
|
393
|
+
//#endregion
|
|
349
394
|
//#region src/exec.ts
|
|
350
395
|
const MAX_BUFFER = 67108864;
|
|
396
|
+
const REPORT_CHILD_EXIT_CAP_MS = 15e3;
|
|
397
|
+
const REPORT_JOB_PHASE_MS = 3e4;
|
|
398
|
+
function startsInReportJob(file, opts, containProcessTree) {
|
|
399
|
+
return process.platform === "win32" && (containProcessTree || Boolean(reportSignal(ambientContext()))) && Boolean(executableIn(file, opts.env ?? ambientEnv(), opts.cwd ?? process.cwd()));
|
|
400
|
+
}
|
|
351
401
|
function spawnReportProbe(file, args, opts, containProcessTree = false) {
|
|
352
|
-
|
|
402
|
+
return startsInReportJob(file, opts, containProcessTree) ? spawnReportJob(file, args, opts) : spawn(file, args, opts);
|
|
403
|
+
}
|
|
404
|
+
function spawnReportJob(file, args, opts, markers) {
|
|
353
405
|
const env = opts.env ?? ambientEnv();
|
|
354
406
|
const systemRoot = process.env.SystemRoot ?? process.env.SYSTEMROOT;
|
|
355
407
|
if (!systemRoot) throw new Error("SystemRoot is required to contain Windows report probes.");
|
|
@@ -370,7 +422,8 @@ function spawnReportProbe(file, args, opts, containProcessTree = false) {
|
|
|
370
422
|
file,
|
|
371
423
|
args,
|
|
372
424
|
node: process.execPath,
|
|
373
|
-
entry: fileURLToPath(new URL("../dist/windows-report.mjs", import.meta.url))
|
|
425
|
+
entry: fileURLToPath(new URL("../dist/windows-report.mjs", import.meta.url)),
|
|
426
|
+
...markers
|
|
374
427
|
})
|
|
375
428
|
}
|
|
376
429
|
});
|
|
@@ -413,7 +466,8 @@ function reportChild(child, signal, failed) {
|
|
|
413
466
|
const refuse = (message) => {
|
|
414
467
|
const failure = Object.assign(new Error(message), {
|
|
415
468
|
code: "STIM_CLAIM_UNAVAILABLE",
|
|
416
|
-
reportCleanup: true
|
|
469
|
+
reportCleanup: true,
|
|
470
|
+
remedy: `Check whether the report child${pid === void 0 ? "" : ` ${pid}${process.platform === "win32" ? "" : ` (\`ps -p ${pid}\`)`}`} and its descendants are still running and stop them if they are`
|
|
417
471
|
});
|
|
418
472
|
const error = failed?.(failure) ?? failure;
|
|
419
473
|
child.stdin?.destroy();
|
|
@@ -466,16 +520,13 @@ function reportChild(child, signal, failed) {
|
|
|
466
520
|
if (!ended) {
|
|
467
521
|
let timer;
|
|
468
522
|
await Promise.race([nativeClosed, new Promise((resolve) => {
|
|
469
|
-
timer = setTimeout(resolve,
|
|
523
|
+
timer = setTimeout(resolve, groupExitBudgetMs(REPORT_CHILD_EXIT_CAP_MS));
|
|
470
524
|
})]);
|
|
471
525
|
clearTimeout(timer);
|
|
526
|
+
if (!ended) await new Promise((resolve) => setImmediate(resolve));
|
|
472
527
|
if (!ended) refuse(`Report child ${pid} did not close within the cleanup budget.`);
|
|
473
528
|
}
|
|
474
|
-
if (pid !== void 0 && process.platform !== "win32") {
|
|
475
|
-
const deadline = performance.now() + 1e3;
|
|
476
|
-
while ((0, ownership_claim_exports.processGroupAlive)(pid) && performance.now() < deadline) await setTimeout$1(25);
|
|
477
|
-
if ((0, ownership_claim_exports.processGroupAlive)(pid)) refuse(`Report child ${pid} still has descendants after cleanup.`);
|
|
478
|
-
}
|
|
529
|
+
if (pid !== void 0 && process.platform !== "win32" && !await waitForGroupExit(pid, groupExitBudgetMs(REPORT_CHILD_EXIT_CAP_MS))) refuse(`Report child ${pid} still has descendants after cleanup.`);
|
|
479
530
|
})();
|
|
480
531
|
if (report) trackReportResource(context, closed, cancel, signal);
|
|
481
532
|
else {
|
|
@@ -642,26 +693,42 @@ const defaultExecutor = {
|
|
|
642
693
|
clearDeclaration = resolveDeclaration;
|
|
643
694
|
retainDeclaration = rejectDeclaration;
|
|
644
695
|
}) : void 0;
|
|
645
|
-
const
|
|
696
|
+
const contained = startsInReportJob(file, opts, containProcessTree || Boolean(report));
|
|
697
|
+
const base = contained && timeout !== void 0 ? join$1(tmpdir(), `stim-report-${process.pid}-${randomUUID()}`) : null;
|
|
698
|
+
const markers = base ? {
|
|
699
|
+
started: `${base}.started`,
|
|
700
|
+
closed: `${base}.closed`
|
|
701
|
+
} : void 0;
|
|
702
|
+
const start = () => contained ? spawnReportJob(file, args, opts, markers) : spawn(file, args, opts);
|
|
646
703
|
const child = declareFor ? spawnDeclared(declareFor, start, declaration ? { until: declaration } : {}) : start();
|
|
647
704
|
let lifetime;
|
|
648
705
|
let cancel;
|
|
649
706
|
let timer;
|
|
707
|
+
let poll;
|
|
708
|
+
let phase = markers ? "starting" : "running";
|
|
709
|
+
const stopTimers = () => {
|
|
710
|
+
clearTimeout(timer);
|
|
711
|
+
clearInterval(poll);
|
|
712
|
+
for (const marker of Object.values(markers ?? {})) try {
|
|
713
|
+
rmSync(marker, { force: true });
|
|
714
|
+
} catch {}
|
|
715
|
+
};
|
|
650
716
|
try {
|
|
651
717
|
lifetime = reportChild(child, report, (error) => {
|
|
652
718
|
const failure = claims.length ? Object.assign(new WorkspaceProcessCleanupError(claims, error.message, "Verify the child and its descendants have stopped."), { reportCleanup: true }) : error;
|
|
653
|
-
|
|
719
|
+
stopTimers();
|
|
654
720
|
return failure;
|
|
655
721
|
});
|
|
656
722
|
cancel = lifetime?.cancel;
|
|
657
723
|
if (cleanupOnExit && cancel) child.once("exit", () => {
|
|
658
|
-
|
|
724
|
+
stopTimers();
|
|
659
725
|
cancel?.().catch(reject);
|
|
660
726
|
});
|
|
661
727
|
lifetime?.closed.catch(reject);
|
|
662
728
|
if (declaration) lifetime?.closed.then(clearDeclaration, retainDeclaration);
|
|
663
729
|
onSpawn?.(child);
|
|
664
730
|
} catch (error) {
|
|
731
|
+
stopTimers();
|
|
665
732
|
if (cancel) cancel().then(() => lifetime?.closed).then(() => reject(error), reject);
|
|
666
733
|
else {
|
|
667
734
|
if (!report) child.kill("SIGKILL");
|
|
@@ -697,24 +764,42 @@ const defaultExecutor = {
|
|
|
697
764
|
}
|
|
698
765
|
}
|
|
699
766
|
};
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
767
|
+
const arm = (ms) => {
|
|
768
|
+
clearTimeout(timer);
|
|
769
|
+
timer = setTimeout(() => {
|
|
770
|
+
timedOut = true;
|
|
771
|
+
clearInterval(poll);
|
|
772
|
+
if (cancel) cancel().catch(reject);
|
|
773
|
+
else {
|
|
774
|
+
child.kill(killSignal ?? "SIGTERM");
|
|
775
|
+
child.stdin?.destroy();
|
|
776
|
+
child.stdout?.destroy();
|
|
777
|
+
child.stderr?.destroy();
|
|
778
|
+
}
|
|
779
|
+
}, ms);
|
|
780
|
+
};
|
|
781
|
+
if (timeout !== void 0 && markers) {
|
|
782
|
+
arm(REPORT_JOB_PHASE_MS);
|
|
783
|
+
poll = setInterval(() => {
|
|
784
|
+
if (phase === "starting" && existsSync(markers.started)) {
|
|
785
|
+
phase = "running";
|
|
786
|
+
arm(timeout);
|
|
787
|
+
}
|
|
788
|
+
if (phase === "running" && existsSync(markers.closed)) {
|
|
789
|
+
phase = "closing";
|
|
790
|
+
arm(REPORT_JOB_PHASE_MS);
|
|
791
|
+
clearInterval(poll);
|
|
792
|
+
}
|
|
793
|
+
}, 50);
|
|
794
|
+
} else if (timeout !== void 0) arm(timeout);
|
|
710
795
|
child.stdout?.on("data", (chunk) => capture(stdout, chunk));
|
|
711
796
|
child.stderr?.on("data", (chunk) => capture(stderr, chunk));
|
|
712
797
|
child.on("error", (error) => {
|
|
713
|
-
|
|
798
|
+
stopTimers();
|
|
714
799
|
reject(redactError(error, redact));
|
|
715
800
|
});
|
|
716
801
|
const finish = async (status, signal) => {
|
|
717
|
-
|
|
802
|
+
stopTimers();
|
|
718
803
|
await lifetime?.closed;
|
|
719
804
|
const discardOutput = (timedOut || overflowed || report?.aborted) && redact?.some(Boolean);
|
|
720
805
|
const out = discardOutput ? "" : Buffer.concat(stdout).toString("utf-8");
|
|
@@ -726,7 +811,10 @@ const defaultExecutor = {
|
|
|
726
811
|
stderr: err
|
|
727
812
|
};
|
|
728
813
|
if (report?.aborted) reject(report.reason);
|
|
729
|
-
else if (timedOut
|
|
814
|
+
else if (timedOut && phase !== "running") {
|
|
815
|
+
const message = `The Windows report job did not ${phase === "starting" ? "start" : "exit"} within ${REPORT_JOB_PHASE_MS}ms: ${command}`;
|
|
816
|
+
reject(redactError(Object.assign(new Error(message), result, { code: "ETIMEDOUT" }), redact));
|
|
817
|
+
} else if (timedOut) reject(redactError(nameTimeout(Object.assign(new Error(command), result, { code: "ETIMEDOUT" }), command, timeoutMs), redact));
|
|
730
818
|
else if (overflowed) reject(redactError(Object.assign(/* @__PURE__ */ new Error(`Command output exceeded ${MAX_BUFFER} bytes: ${command}`), result, { code: "ENOBUFS" }), redact));
|
|
731
819
|
else if (status !== 0 || rejectStderr && err.trim()) reject(redactError(Object.assign(/* @__PURE__ */ new Error(`Command failed: ${command}${err ? `\n${err}` : ""}`), result), redact));
|
|
732
820
|
else resolve(detachedSilent ? "" : untrimmed ? out : out.trim());
|
|
@@ -855,4 +943,4 @@ function getExecutor() {
|
|
|
855
943
|
return active;
|
|
856
944
|
}
|
|
857
945
|
//#endregion
|
|
858
|
-
export {
|
|
946
|
+
export { reportSignal as C, ownership_claim_exports as D, debugLog as E, __commonJSMin as O, process_identity_exports as S, trackReportResource as T, spawnDeclared as _, waitForGroupExit as a, operationState as b, throwIfCancelled as c, workspaceProcessLockError as d, workspaceProcessLockPath as f, signalDeclaredSpawns as g, refuseDeclaredSpawns as h, loadScaledBudgetMs as i, __require as k, WorkspaceProcessCleanupError as l, declareSpawnsOn as m, isTimeoutError as n, cancellableSleep as o, allowDeclaredSpawns as p, groupExitBudgetMs as r, cancelledError as s, getExecutor as t, withWorkspaceProcessLock as u, stopDeclaringSpawnsOn as v, runReport as w, withDrainingCancellation as x, isTermination as y };
|