stim 1.14.0 → 1.15.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 +2 -0
- package/dist/{activity-CYVDcrt3.mjs → activity-B2-kb7k0.mjs} +281 -41
- package/dist/{android-XpvCrV7q.mjs → android-CYmq0jNi.mjs} +2 -2
- package/dist/{android-LbPFRWVL.mjs → android-Cu_L4RpL.mjs} +502 -407
- package/dist/{android-d6rGq1pA.mjs → android-Db2eEMaf.mjs} +152 -65
- package/dist/android-cas-PnKfAdB2.mjs +167 -0
- package/dist/android-cas-compiler.mjs +2 -2
- package/dist/{app-install-BpgSgkJj.mjs → app-install-CAAplXAt.mjs} +95 -161
- package/dist/{budget-CGDkhvv_.mjs → budget-CMiqghig.mjs} +1038 -73
- package/dist/{build-plan-Dcr-3ie0.mjs → build-plan-aeGMFX7e.mjs} +193 -653
- package/dist/build-progress-C2Jv1AtA.mjs +872 -0
- package/dist/build-slots-Df1ApSuH.mjs +127 -0
- package/dist/{cache-manifest-C68QQ0ua.mjs → cache-manifest-DnUHBJaU.mjs} +2 -2
- package/dist/cache-manifest.mjs +1 -1
- package/dist/{chrome-BPCiC3ZX.mjs → chrome-BrcVWQyD.mjs} +1 -1
- package/dist/cli-0cX5s4NM.mjs +45 -0
- package/dist/cli.mjs +6 -42
- package/dist/client-C2IS36Qf.mjs +1333 -0
- package/dist/collector-run.mjs +8 -7
- package/dist/{command-output-DVcpw6eE.mjs → command-output-CliHHn7a.mjs} +1 -1
- package/dist/{config-lvc7d3C2.mjs → config-D0DbpZtM.mjs} +28 -29
- package/dist/{created-devices-CllH_8eb.mjs → created-devices-BwVb3liH.mjs} +2 -2
- package/dist/{dependency-state-DsT7aKeo.mjs → dependency-state-BmsjKZ2H.mjs} +2 -2
- package/dist/{deps-D9IcKqXS.mjs → deps-BFlKbOIp.mjs} +3 -3
- package/dist/{detached-entry-DJHoca49.mjs → detached-entry-CiTEgMR1.mjs} +1 -1
- package/dist/dev-client-CjzLoNs0.mjs +80 -0
- package/dist/{device-CjuuAJjQ.mjs → device-BZ1IyS5A.mjs} +7 -7
- package/dist/device-capacity-DMuKC7nx.mjs +136 -0
- package/dist/device-host-worker.d.mts +1 -0
- package/dist/device-host-worker.mjs +769 -0
- package/dist/device-ios-DMQBUPus.mjs +381 -0
- package/dist/{device-lease-5c3WrVRm.mjs → device-lease-W5Pi1q38.mjs} +43 -36
- package/dist/{device-pool-BiyDyPP-.mjs → device-pool-B2r38YjS.mjs} +4 -4
- package/dist/{device-remote-D87zEzaq.mjs → device-remote-9ulPsdhY.mjs} +68 -162
- package/dist/{doctor-x9pnU9fq.mjs → doctor-BcE5xsBn.mjs} +191 -99
- package/dist/{error-diagnostics-C5HzcwCW.mjs → error-diagnostics-Cb0P1WLS.mjs} +12 -11
- package/dist/{exec-DK8KaVHK.mjs → exec-CaErVv7t.mjs} +5 -1
- package/dist/{gc-ko6mUAYD.mjs → gc-BuL1Genr.mjs} +429 -101
- package/dist/{android-cas-iZK3DOCr.mjs → gradle-CmdOBq1d.mjs} +8 -294
- package/dist/{guide-6R0VNFqI.mjs → guide-cCSGRFd3.mjs} +1959 -222
- package/dist/{guide-status-BZrFPIA_.mjs → guide-status-CIoWK6mG.mjs} +3 -3
- package/dist/hosted-macos-DwowNU7W.mjs +447 -0
- package/dist/idle-shutdown-B5LPaNyY.mjs +122 -0
- package/dist/in-use-CndPMilN.mjs +110 -0
- package/dist/{ios-BwDPrnYQ.mjs → ios-3CtCRhwr.mjs} +201 -10
- package/dist/{ios-P1f5nm2n.mjs → ios-Chob8ny7.mjs} +512 -263
- package/dist/{ios-device-DGglU3E_.mjs → ios-device-DERmMmk-.mjs} +12 -7
- package/dist/{ios-device-BiOsSVzd.mjs → ios-device-Ee7sDXfp.mjs} +1 -1
- package/dist/{launch-verify-Deg4tB3Z.mjs → launch-verify-CLlofxRt.mjs} +4 -4
- package/dist/{logs-Civ4gbBH.mjs → logs-h9h6MUvE.mjs} +95 -13
- package/dist/machine-usage-D_YYMzfR.mjs +283 -0
- package/dist/machines-CYtOCqcj.mjs +259 -0
- package/dist/macos-BwtbUtTN.mjs +468 -0
- package/dist/macos-run.d.mts +5 -0
- package/dist/macos-run.mjs +2 -0
- package/dist/{merge-state-ytFQCeh4.mjs → merge-state-BnxLNQiM.mjs} +22 -12
- package/dist/{metro-CcEo8Fl8.mjs → metro-Di8EN2Tb.mjs} +20 -120
- package/dist/{named-ports-Blg8IxOh.mjs → named-ports-Dj_XBNaL.mjs} +6 -59
- package/dist/native-run-DFDoIRbY.mjs +147 -0
- package/dist/{native-runtime-DjBHRg5m.mjs → native-runtime-i6OkVg-w.mjs} +9 -5
- package/dist/offload-worker.d.mts +121 -0
- package/dist/offload-worker.mjs +601 -0
- package/dist/{ownership-DyYDF5ww.mjs → ownership-BkYxUtuj.mjs} +3 -2
- package/dist/{page-BHUzTDFt.mjs → page-QF_Ke10s.mjs} +7 -2
- package/dist/{ports-BguS83ex.mjs → ports-DddwttKM.mjs} +3 -3
- package/dist/prebuild-BvxDlD6C.mjs +213 -0
- package/dist/process-identity-BmRm1qV0.mjs +12 -0
- package/dist/{project-CWlvEaeN.mjs → project-CV3tDFHl.mjs} +9 -18
- package/dist/pull-request-pxnDCQzn.mjs +322 -0
- package/dist/pull-requests.d.mts +120 -0
- package/dist/pull-requests.mjs +2 -0
- package/dist/recordings-GEXp4iBT.mjs +37 -0
- package/dist/{reload-BiniwsSZ.mjs → reload-ChPiwvot.mjs} +70 -22
- package/dist/{remote-cache-CcR6o6lI.mjs → remote-cache-CO2elm_b.mjs} +4 -4
- package/dist/run-B-xqRrsg.mjs +119 -0
- package/dist/{server-bare-DGfgyJ5J.mjs → server-bare-X7PUgizL.mjs} +33 -15
- package/dist/{server-expo-BVuwQ65v.mjs → server-expo-DhtX6bom.mjs} +6 -10
- package/dist/server-expo-KJeD109I.mjs +2 -0
- package/dist/{settings-D61iNOsB.mjs → settings-CduVcoxj.mjs} +77 -26
- package/dist/{settings-B-fsC-Om.mjs → settings-DbL6uhH8.mjs} +16 -10
- package/dist/settings.schema.json +357 -2
- package/dist/{simslim-DrDN4WuV.mjs → simslim-Ciluxlq4.mjs} +8 -132
- package/dist/{slot-launch-D5t8EiMf.mjs → slot-launch-BY0BrOLh.mjs} +6 -6
- package/dist/{spawn-claims-Drw_o-Fb.mjs → spawn-claims-D0XfSe8u.mjs} +1 -1
- package/dist/spawn-entry-DncpJvWL.mjs +16 -0
- package/dist/stage-CzaiwFsI.mjs +143 -0
- package/dist/start-CPO4wRg7.mjs +2 -0
- package/dist/{start-s4RXp1wy.mjs → start-CUD9nasA.mjs} +108 -61
- package/dist/state-B4PQFXMW.d.mts +12 -0
- package/dist/state-BxCgeTQu.mjs +41 -0
- package/dist/{state-DHqvsbqC.mjs → state-CaeaHbDA.mjs} +7 -4
- package/dist/{state-Dk9RVXI7.mjs → state-DFm77wRn.mjs} +67 -5
- package/dist/stats-DBLLFmKd.mjs +66 -0
- package/dist/{status-BsPAnfOI.mjs → status-DYXxNOT0.mjs} +423 -268
- package/dist/{status-BgAuxESg.mjs → status-l84Gbvp2.mjs} +116 -20
- package/dist/stdout-reader-C8yjre1x.mjs +23 -0
- package/dist/stim-desktop-Cnz8CPnl.mjs +63 -0
- package/dist/stim-footprint.swift +32 -0
- package/dist/{stim-installations-CINXy_su.mjs → stim-installations-QMEI32v1.mjs} +1 -1
- package/dist/{stop-BzreOWJp.mjs → stop-Bad61z_2.mjs} +38 -12
- package/dist/stop-Bvf1MflS.mjs +48 -0
- package/dist/{stop-BWIF_6BK.mjs → stop-CceYh1yG.mjs} +2 -2
- package/dist/stop-cause-CZ_Mr-v9.mjs +665 -0
- package/dist/supervisor-run.d.mts +43 -11
- package/dist/supervisor-run.mjs +227 -19
- package/dist/support-CDQbDkL5.mjs +315 -0
- package/dist/support-WLOzVKUv.mjs +176 -0
- package/dist/teardown-BYuQafiA.mjs +718 -0
- package/dist/{xcode-Cp5KvK9x.mjs → toolchain-DmeYjXD9.mjs} +363 -13
- package/dist/warm-progress-DVHLN4uC.mjs +463 -0
- package/dist/{idle-DXtx3RbX.mjs → watchman-Bx0wceoF.mjs} +55 -8
- package/dist/{web-BsQs1WlO.mjs → web-k6w8-HnE.mjs} +37 -20
- package/dist/web-run.mjs +309 -12
- package/dist/workspace-process-lock-BL7Q0HCO.mjs +57 -0
- package/dist/workspace-state-CL2V2Ons.mjs +371 -0
- package/dist/worktree-BT_uULFx.mjs +2 -0
- package/dist/{worktree-BVrHsYZG.mjs → worktree-C0c5Udwa.mjs} +55 -54
- package/dist/{worktree-UrQWXSeb.mjs → worktree-qXKzADSC.mjs} +154 -252
- package/package.json +10 -5
- package/shim/bundle-response.cjs +28 -12
- package/dist/build-progress-DxKpwnaS.mjs +0 -247
- package/dist/in-use-DlqBDKqY.mjs +0 -249
- package/dist/server-expo-DIHDhvGg.mjs +0 -2
- package/dist/start-Cetfvy8l.mjs +0 -2
- package/dist/stats-CFpFGlJV.mjs +0 -62
- package/dist/stats-CX1Z8Tca.mjs +0 -368
- package/dist/stim-desktop-CXt8-Z3J.mjs +0 -40
- package/dist/stop-cause-hjGBOZTG.mjs +0 -1231
- package/dist/worktree-CHWWvm5v.mjs +0 -2
- package/dist/{metro-store-DzeWkfqW.mjs → metro-store-CDDZHtPl.mjs} +1 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { n as settingDefault, r as stimDesktopInstalled, t as STIM_DESKTOP_OPEN_OPTIONS } from "./stim-desktop-
|
|
5
|
-
import { n as readCreatedDevices$1, r as recordCreatedDevice, t as forgetCreatedDevice } from "./created-devices-
|
|
6
|
-
import {
|
|
1
|
+
import { t as getExecutor } from "./exec-CaErVv7t.mjs";
|
|
2
|
+
import { C as saveConfig, D as withConfigLock$1, H as projectDeviceSlots, I as assignSlotDevice, U as removeSlotDevice, _ as loadConfig$1, c as ensureConfig, d as getConfigDir, f as getConfigPath$1, z as deviceSlotPlatforms } from "./config-D0DbpZtM.mjs";
|
|
3
|
+
import { n as ownership_claim_exports, t as process_identity_exports } from "./process-identity-BmRm1qV0.mjs";
|
|
4
|
+
import { n as settingDefault, r as stimDesktopInstalled, t as STIM_DESKTOP_OPEN_OPTIONS } from "./stim-desktop-Cnz8CPnl.mjs";
|
|
5
|
+
import { n as readCreatedDevices$1, r as recordCreatedDevice, t as forgetCreatedDevice } from "./created-devices-BwVb3liH.mjs";
|
|
6
|
+
import { o as pidExists, u as signalProcessTree } from "./metro-Di8EN2Tb.mjs";
|
|
7
|
+
import { c as androidDataPartitionSizeBytes } from "./settings-CduVcoxj.mjs";
|
|
8
|
+
import { join } from "node:path";
|
|
7
9
|
import { existsSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "fs";
|
|
8
|
-
import { dirname, isAbsolute, join, resolve } from "path";
|
|
9
|
-
import { ANDROID_EMULATOR_APPS, loadConfig, settingDefinition } from "@stim-cli/core/state";
|
|
10
|
-
import { join as join$1 } from "node:path";
|
|
11
10
|
import { homedir, tmpdir } from "os";
|
|
11
|
+
import { dirname as dirname$1, isAbsolute as isAbsolute$1, join as join$1, resolve as resolve$1 } from "path";
|
|
12
|
+
import { ANDROID_EMULATOR_APPS, loadConfig, settingDefinition } from "@stim-cli/core/state";
|
|
12
13
|
import { isDeepStrictEqual } from "node:util";
|
|
13
14
|
//#region src/devices/android-emulator-viewer.ts
|
|
14
15
|
function configuredAndroidEmulatorApp(platform = process.platform) {
|
|
@@ -70,7 +71,7 @@ function parkedMaxSetting(platform, { config, env = process.env } = {}) {
|
|
|
70
71
|
function isParkedRecord(value, platform) {
|
|
71
72
|
if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
|
|
72
73
|
const record = value;
|
|
73
|
-
return typeof record.udid === "string" && typeof record.name === "string" && record.name.startsWith("stim-") && typeof record.parkedAt === "string" && (platform === "android" ? record.udid === record.name && /^stim-[A-Za-z0-9._-]+$/.test(record.name) && typeof record.systemImage === "string" && typeof record.configuration === "string" : typeof record.deviceTypeIdentifier === "string" && typeof record.runtimeIdentifier === "string" && typeof record.simslimManaged === "boolean" && (record.bundleId === void 0 || typeof record.bundleId === "string") && (record.cacheKey === void 0 || typeof record.cacheKey === "string"));
|
|
74
|
+
return typeof record.udid === "string" && typeof record.name === "string" && record.name.startsWith("stim-") && typeof record.parkedAt === "string" && (platform === "android" ? record.udid === record.name && /^stim-[A-Za-z0-9._-]+$/.test(record.name) && typeof record.systemImage === "string" && typeof record.configuration === "string" && (record.packageName === void 0 || typeof record.packageName === "string") && (record.cacheKey === void 0 || typeof record.cacheKey === "string") : typeof record.deviceTypeIdentifier === "string" && typeof record.runtimeIdentifier === "string" && typeof record.simslimManaged === "boolean" && (record.bundleId === void 0 || typeof record.bundleId === "string") && (record.cacheKey === void 0 || typeof record.cacheKey === "string") && (record.schemeApprovals === void 0 || Array.isArray(record.schemeApprovals) && record.schemeApprovals.every((v) => typeof v === "string")));
|
|
74
75
|
}
|
|
75
76
|
function poolBlock(config) {
|
|
76
77
|
const raw = config?.parked;
|
|
@@ -124,7 +125,13 @@ function parkSim({ platform, projectPath, slot = "default", record, max }) {
|
|
|
124
125
|
const current = deviceSlotPlatforms(cfg.projects[projectPath], slot)?.[platform];
|
|
125
126
|
const currentId = platform === "ios" ? current?.deviceUdid : current?.avdName;
|
|
126
127
|
if (!current?.owned || currentId !== record.udid) throw new Error(`The ${platform === "ios" ? "simulator" : "emulator"} assignment changed before parking.`);
|
|
127
|
-
const
|
|
128
|
+
const currentApprovals = platform === "ios" ? current.schemeApprovals : void 0;
|
|
129
|
+
const schemeApprovals = Array.isArray(currentApprovals) && currentApprovals.every((v) => typeof v === "string") ? currentApprovals : void 0;
|
|
130
|
+
const carried = schemeApprovals && schemeApprovals.length > 0 ? {
|
|
131
|
+
...record,
|
|
132
|
+
schemeApprovals
|
|
133
|
+
} : record;
|
|
134
|
+
const { keep, evicted } = evictOverflow([...readParked(platform, { config: cfg }).filter((r) => r.udid !== record.udid), carried], max);
|
|
128
135
|
writeParked(cfg, platform, [...keep, ...evicted]);
|
|
129
136
|
const project = cfg.projects[projectPath];
|
|
130
137
|
if (project) removeSlotDevice(project, platform, slot);
|
|
@@ -145,10 +152,15 @@ function adoptParked({ platform, projectPath, slot = "default", udid, device })
|
|
|
145
152
|
writeParked(cfg, platform, records.filter((r) => r.udid !== udid));
|
|
146
153
|
const project = cfg.projects[projectPath];
|
|
147
154
|
if (!project) throw new Error(`Project not registered: ${projectPath}`);
|
|
148
|
-
|
|
149
|
-
saveConfig(cfg);
|
|
150
|
-
const adopted = { ...taken };
|
|
155
|
+
const adopted = taken.deletionClaim === void 0 ? { ...taken } : erasedRecord(taken);
|
|
151
156
|
delete adopted.deletionClaim;
|
|
157
|
+
const takenApprovals = platform === "ios" ? adopted.schemeApprovals : void 0;
|
|
158
|
+
const assigned = takenApprovals && takenApprovals.length > 0 ? {
|
|
159
|
+
...device,
|
|
160
|
+
schemeApprovals: takenApprovals
|
|
161
|
+
} : device;
|
|
162
|
+
assignSlotDevice(project, platform, assigned, slot);
|
|
163
|
+
saveConfig(cfg);
|
|
152
164
|
return adopted;
|
|
153
165
|
});
|
|
154
166
|
} finally {
|
|
@@ -157,7 +169,7 @@ function adoptParked({ platform, projectPath, slot = "default", udid, device })
|
|
|
157
169
|
}
|
|
158
170
|
function claimParkedOperation(platform, udid) {
|
|
159
171
|
const attempt = (0, ownership_claim_exports.tryAcquireClaim)({
|
|
160
|
-
root: join
|
|
172
|
+
root: join(getConfigDir(), "pool-locks", platform, `${encodeURIComponent(udid.toLowerCase())}.lock`),
|
|
161
173
|
mode: "exclusive",
|
|
162
174
|
label: `parked ${platform} device ${udid}`
|
|
163
175
|
});
|
|
@@ -165,6 +177,20 @@ function claimParkedOperation(platform, udid) {
|
|
|
165
177
|
return attempt.acquired ?? null;
|
|
166
178
|
}
|
|
167
179
|
function removeParkedAfter(platform, udid, beforeRemove) {
|
|
180
|
+
return settleParkedAfter(platform, udid, beforeRemove, null);
|
|
181
|
+
}
|
|
182
|
+
function eraseParkedAfter(platform, udid, erase) {
|
|
183
|
+
return settleParkedAfter(platform, udid, erase, erasedRecord);
|
|
184
|
+
}
|
|
185
|
+
function erasedRecord(record) {
|
|
186
|
+
const erased = { ...record };
|
|
187
|
+
delete erased.bundleId;
|
|
188
|
+
delete erased.packageName;
|
|
189
|
+
delete erased.cacheKey;
|
|
190
|
+
delete erased.schemeApprovals;
|
|
191
|
+
return erased;
|
|
192
|
+
}
|
|
193
|
+
function settleParkedAfter(platform, udid, action, keep) {
|
|
168
194
|
const claim = claimParkedOperation(platform, udid);
|
|
169
195
|
if (!claim) return null;
|
|
170
196
|
try {
|
|
@@ -193,11 +219,14 @@ function removeParkedAfter(platform, udid, beforeRemove) {
|
|
|
193
219
|
});
|
|
194
220
|
if (!claimed) return null;
|
|
195
221
|
let completed = false;
|
|
196
|
-
let
|
|
222
|
+
let started = false;
|
|
223
|
+
let settled = null;
|
|
197
224
|
try {
|
|
198
225
|
(0, ownership_claim_exports.markClaimChildPending)(claim);
|
|
199
226
|
try {
|
|
200
|
-
|
|
227
|
+
action(claimed.record, () => {
|
|
228
|
+
started = true;
|
|
229
|
+
});
|
|
201
230
|
} finally {
|
|
202
231
|
(0, ownership_claim_exports.clearClaimChild)(claim);
|
|
203
232
|
}
|
|
@@ -209,12 +238,13 @@ function removeParkedAfter(platform, udid, beforeRemove) {
|
|
|
209
238
|
const records = readParked(platform, { config: cfg });
|
|
210
239
|
const current = records.find((candidate) => candidate.udid === udid);
|
|
211
240
|
if (!isDeepStrictEqual(current, claimed.marked)) return;
|
|
212
|
-
|
|
241
|
+
const after = (completed || started) && keep ? keep(claimed.record) : claimed.record;
|
|
242
|
+
writeParked(cfg, platform, completed && !keep ? records.filter((candidate) => candidate.udid !== udid) : records.map((candidate) => candidate.udid === udid ? after : candidate));
|
|
213
243
|
saveConfig(cfg);
|
|
214
|
-
if (completed)
|
|
244
|
+
if (completed) settled = claimed.record;
|
|
215
245
|
});
|
|
216
246
|
}
|
|
217
|
-
return
|
|
247
|
+
return settled;
|
|
218
248
|
} finally {
|
|
219
249
|
(0, ownership_claim_exports.releaseClaim)(claim);
|
|
220
250
|
}
|
|
@@ -263,8 +293,8 @@ const DEFAULT_AVD_DEVICE_PROFILE = String(settingDefinition("android.deviceProfi
|
|
|
263
293
|
function androidHome(env = process.env) {
|
|
264
294
|
const configured = env.ANDROID_HOME || env.ANDROID_SDK_ROOT;
|
|
265
295
|
if (configured) return configured;
|
|
266
|
-
if (process.platform === "win32") return join(env.LOCALAPPDATA || join(homedir(), "AppData", "Local"), "Android", "Sdk");
|
|
267
|
-
return join(homedir(), "Library", "Android", "sdk");
|
|
296
|
+
if (process.platform === "win32") return join$1(env.LOCALAPPDATA || join$1(homedir(), "AppData", "Local"), "Android", "Sdk");
|
|
297
|
+
return join$1(homedir(), "Library", "Android", "sdk");
|
|
268
298
|
}
|
|
269
299
|
const SDK_TOOL_LOCATIONS = {
|
|
270
300
|
emulator: ["emulator", "emulator"],
|
|
@@ -292,7 +322,7 @@ function androidToolPath(tool, platform = process.platform) {
|
|
|
292
322
|
const location = SDK_TOOL_LOCATIONS[tool];
|
|
293
323
|
const bare = location.at(-1);
|
|
294
324
|
const name = platform === "win32" ? `${bare}${WINDOWS_SDK_TOOL_EXTENSIONS[tool]}` : bare;
|
|
295
|
-
const abs = join(androidHome(), ...location.slice(0, -1), name);
|
|
325
|
+
const abs = join$1(androidHome(), ...location.slice(0, -1), name);
|
|
296
326
|
return existsSync(abs) ? abs : bare;
|
|
297
327
|
}
|
|
298
328
|
const WINDOWS_BUILD_TOOL_EXTENSIONS = { apksigner: ".bat" };
|
|
@@ -316,7 +346,7 @@ function buildToolsMajor(version) {
|
|
|
316
346
|
return Number.isFinite(major) ? major : 0;
|
|
317
347
|
}
|
|
318
348
|
function findBuildTool(tools, { home = androidHome(), readDir = readdirSync, exists = existsSync, platform = process.platform } = {}) {
|
|
319
|
-
const root = join(home, "build-tools");
|
|
349
|
+
const root = join$1(home, "build-tools");
|
|
320
350
|
let versions = [];
|
|
321
351
|
try {
|
|
322
352
|
versions = readDir(root);
|
|
@@ -327,7 +357,7 @@ function findBuildTool(tools, { home = androidHome(), readDir = readdirSync, exi
|
|
|
327
357
|
const version = newestBuildTools(versions);
|
|
328
358
|
if (!version) return null;
|
|
329
359
|
for (const tool of tools) {
|
|
330
|
-
const path = join(root, version, androidBuildToolName(tool, platform));
|
|
360
|
+
const path = join$1(root, version, androidBuildToolName(tool, platform));
|
|
331
361
|
if (exists(path)) return {
|
|
332
362
|
path,
|
|
333
363
|
tool,
|
|
@@ -344,7 +374,7 @@ function androidTool(tool) {
|
|
|
344
374
|
return resolved === tool ? tool : `"${resolved}"`;
|
|
345
375
|
}
|
|
346
376
|
function listInstalledSystemImages(onUnreadable) {
|
|
347
|
-
const root = join(androidHome(), "system-images");
|
|
377
|
+
const root = join$1(androidHome(), "system-images");
|
|
348
378
|
const images = [];
|
|
349
379
|
const list = (dir) => {
|
|
350
380
|
try {
|
|
@@ -358,8 +388,8 @@ function listInstalledSystemImages(onUnreadable) {
|
|
|
358
388
|
for (const apiDir of list(root)) {
|
|
359
389
|
const m = apiDir.match(/^android-(\d+)$/);
|
|
360
390
|
if (!m) continue;
|
|
361
|
-
const apiPath = join(root, apiDir);
|
|
362
|
-
for (const tag of list(apiPath)) for (const arch of list(join(apiPath, tag))) images.push({
|
|
391
|
+
const apiPath = join$1(root, apiDir);
|
|
392
|
+
for (const tag of list(apiPath)) for (const arch of list(join$1(apiPath, tag))) images.push({
|
|
363
393
|
api: Number(m[1]),
|
|
364
394
|
tag,
|
|
365
395
|
arch,
|
|
@@ -387,7 +417,7 @@ function profileNeedsFoldFeature(profile) {
|
|
|
387
417
|
}
|
|
388
418
|
function systemImageSupportsFold(pkg, home = androidHome()) {
|
|
389
419
|
try {
|
|
390
|
-
const ini = readFileSync(join(home, ...pkg.split(";"), "advancedFeatures.ini"), "utf8");
|
|
420
|
+
const ini = readFileSync(join$1(home, ...pkg.split(";"), "advancedFeatures.ini"), "utf8");
|
|
391
421
|
return /^\s*SupportPixelFold\s*=\s*on\s*$/im.test(ini);
|
|
392
422
|
} catch {
|
|
393
423
|
return false;
|
|
@@ -412,13 +442,23 @@ async function createOwnedAvd(label, { systemImage, deviceProfile = DEFAULT_AVD_
|
|
|
412
442
|
"--device",
|
|
413
443
|
deviceProfile
|
|
414
444
|
];
|
|
445
|
+
let env = process.env;
|
|
446
|
+
if (!env.ANDROID_AVD_HOME) {
|
|
447
|
+
const root = avdLookupRoots(env, homedir())[0];
|
|
448
|
+
mkdirSync(root, { recursive: true });
|
|
449
|
+
env = {
|
|
450
|
+
...env,
|
|
451
|
+
ANDROID_AVD_HOME: root
|
|
452
|
+
};
|
|
453
|
+
}
|
|
415
454
|
const child = spawn(tool, args, {
|
|
416
455
|
detached: true,
|
|
417
456
|
stdio: [
|
|
418
457
|
"pipe",
|
|
419
458
|
"pipe",
|
|
420
459
|
"pipe"
|
|
421
|
-
]
|
|
460
|
+
],
|
|
461
|
+
env
|
|
422
462
|
});
|
|
423
463
|
let stderr = "";
|
|
424
464
|
child.stdout?.on("data", () => {});
|
|
@@ -463,7 +503,7 @@ function ownedAvdSystemImage(avdName, { avdDirectory = ownedAvdDirectory, readFi
|
|
|
463
503
|
const directory = avdDirectory(avdName);
|
|
464
504
|
if (!directory) return null;
|
|
465
505
|
try {
|
|
466
|
-
return parseAvdSystemImage(readFile(join(directory, "config.ini")));
|
|
506
|
+
return parseAvdSystemImage(readFile(join$1(directory, "config.ini")));
|
|
467
507
|
} catch {
|
|
468
508
|
return null;
|
|
469
509
|
}
|
|
@@ -486,7 +526,7 @@ function sanitizeAvdLabel(label) {
|
|
|
486
526
|
function avdConfigIni(avdName, directory = ownedAvdDirectory(avdName)) {
|
|
487
527
|
if (!directory) return null;
|
|
488
528
|
try {
|
|
489
|
-
return readFileSync(join(directory, "config.ini"), "utf8");
|
|
529
|
+
return readFileSync(join$1(directory, "config.ini"), "utf8");
|
|
490
530
|
} catch {
|
|
491
531
|
return null;
|
|
492
532
|
}
|
|
@@ -498,9 +538,11 @@ function ownedAvdName(label) {
|
|
|
498
538
|
const AVDMANAGER_DELETE_TIMEOUT_MS = 12e4;
|
|
499
539
|
function deleteAvd(avdName) {
|
|
500
540
|
if (!isStimOwnedAvd(avdName)) throw new Error(`Refusing to delete AVD "${avdName}": not a Stim-owned AVD; Stim has no record of creating it.`);
|
|
541
|
+
const root = process.env.ANDROID_AVD_HOME ? void 0 : avdStorageRoots().find((candidate) => avdPathExists(join$1(candidate, `${avdName}.ini`)));
|
|
501
542
|
getExecutor().run(`${androidTool("avdmanager")} delete avd -n "${avdName}"`, {
|
|
502
543
|
timeoutMs: AVDMANAGER_DELETE_TIMEOUT_MS,
|
|
503
|
-
killSignal: "SIGKILL"
|
|
544
|
+
killSignal: "SIGKILL",
|
|
545
|
+
...root ? { env: { ANDROID_AVD_HOME: root } } : {}
|
|
504
546
|
});
|
|
505
547
|
forgetCreatedDevice("android", avdName);
|
|
506
548
|
}
|
|
@@ -703,17 +745,17 @@ function parseAvdRootIni(contents) {
|
|
|
703
745
|
}
|
|
704
746
|
function avdIniPaths(root, ini) {
|
|
705
747
|
const parsed = parseAvdRootIni(ini);
|
|
706
|
-
return [parsed.relativePath && !isAbsolute(parsed.relativePath) ? resolve(dirname(root), parsed.relativePath) : null, parsed.path && isAbsolute(parsed.path) ? parsed.path : null].filter((candidate) => candidate !== null);
|
|
748
|
+
return [parsed.relativePath && !isAbsolute$1(parsed.relativePath) ? resolve$1(dirname$1(root), parsed.relativePath) : null, parsed.path && isAbsolute$1(parsed.path) ? parsed.path : null].filter((candidate) => candidate !== null);
|
|
707
749
|
}
|
|
708
750
|
function avdStorageRoots() {
|
|
709
751
|
const env = process.env;
|
|
710
752
|
return [...new Set([
|
|
711
753
|
env.ANDROID_AVD_HOME,
|
|
712
|
-
env.ANDROID_EMULATOR_HOME ? join(env.ANDROID_EMULATOR_HOME, "avd") : null,
|
|
713
|
-
env.ANDROID_USER_HOME ? join(env.ANDROID_USER_HOME, "avd") : null,
|
|
714
|
-
env.ANDROID_SDK_HOME ? join(env.ANDROID_SDK_HOME, ".android", "avd") : null,
|
|
715
|
-
env.ANDROID_SDK_HOME ? join(env.ANDROID_SDK_HOME, "avd") : null,
|
|
716
|
-
join(homedir(), ".android", "avd")
|
|
754
|
+
env.ANDROID_EMULATOR_HOME ? join$1(env.ANDROID_EMULATOR_HOME, "avd") : null,
|
|
755
|
+
env.ANDROID_USER_HOME ? join$1(env.ANDROID_USER_HOME, "avd") : null,
|
|
756
|
+
env.ANDROID_SDK_HOME ? join$1(env.ANDROID_SDK_HOME, ".android", "avd") : null,
|
|
757
|
+
env.ANDROID_SDK_HOME ? join$1(env.ANDROID_SDK_HOME, "avd") : null,
|
|
758
|
+
join$1(homedir(), ".android", "avd")
|
|
717
759
|
].filter((value) => Boolean(value)))];
|
|
718
760
|
}
|
|
719
761
|
function avdPathExists(path) {
|
|
@@ -732,7 +774,7 @@ function avdPathExists(path) {
|
|
|
732
774
|
*/
|
|
733
775
|
function avdNameAbsent(avdName, roots = avdStorageRoots()) {
|
|
734
776
|
if (!roots[0] || !isDirectoryPath(roots[0])) return false;
|
|
735
|
-
return roots.every((root) => !avdPathExists(join(root, `${avdName}.ini`)) && !avdPathExists(join(root, `${avdName}.avd`)));
|
|
777
|
+
return roots.every((root) => !avdPathExists(join$1(root, `${avdName}.ini`)) && !avdPathExists(join$1(root, `${avdName}.avd`)));
|
|
736
778
|
}
|
|
737
779
|
function isDirectoryPath(path) {
|
|
738
780
|
try {
|
|
@@ -751,7 +793,7 @@ function listOrphanedAvdDirectories(avdName) {
|
|
|
751
793
|
}));
|
|
752
794
|
const registered = /* @__PURE__ */ new Set();
|
|
753
795
|
for (const { root, canonicalRoot, names } of stores) for (const name of names.filter((entry) => entry.endsWith(".ini"))) {
|
|
754
|
-
const path = join(root, name);
|
|
796
|
+
const path = join$1(root, name);
|
|
755
797
|
const ini = readFileSync(path, "utf8");
|
|
756
798
|
const targets = /* @__PURE__ */ new Set([...avdIniPaths(root, ini), ...avdIniPaths(canonicalRoot, ini)]);
|
|
757
799
|
if (!targets.size) throw new Error(`Cannot verify AVD registration at ${path}; its data was kept.`);
|
|
@@ -768,8 +810,8 @@ function listOrphanedAvdDirectories(avdName) {
|
|
|
768
810
|
for (const entry of names) {
|
|
769
811
|
if (!/^stim-[A-Za-z0-9._-]+\.avd$/.test(entry)) continue;
|
|
770
812
|
const name = entry.slice(0, -4);
|
|
771
|
-
if (roots.some((candidate) => avdPathExists(join(candidate, `${name}.ini`)))) continue;
|
|
772
|
-
const directory = join(canonicalRoot, entry);
|
|
813
|
+
if (roots.some((candidate) => avdPathExists(join$1(candidate, `${name}.ini`)))) continue;
|
|
814
|
+
const directory = join$1(canonicalRoot, entry);
|
|
773
815
|
if (registered.has(directory) || !avdPathExists(directory)) continue;
|
|
774
816
|
const stat = lstatSync(directory);
|
|
775
817
|
if (!stat.isDirectory() || stat.isSymbolicLink() || realpathSync(directory) !== directory) throw new Error(`Cannot verify AVD data at ${directory}; it was kept.`);
|
|
@@ -783,17 +825,20 @@ function listOrphanedAvdDirectories(avdName) {
|
|
|
783
825
|
}
|
|
784
826
|
return orphaned;
|
|
785
827
|
}
|
|
786
|
-
function
|
|
787
|
-
if (!/^stim-[A-Za-z0-9._-]+$/.test(avdName)) return null;
|
|
828
|
+
function avdLookupRoots(env, home) {
|
|
788
829
|
const roots = [
|
|
789
830
|
env.ANDROID_AVD_HOME,
|
|
790
|
-
env.ANDROID_SDK_HOME ? join(env.ANDROID_SDK_HOME, "avd") : null,
|
|
791
|
-
join(home, ".android", "avd")
|
|
831
|
+
env.ANDROID_SDK_HOME ? join$1(env.ANDROID_SDK_HOME, "avd") : null,
|
|
832
|
+
join$1(home, ".android", "avd")
|
|
792
833
|
];
|
|
793
|
-
|
|
834
|
+
return [...new Set(roots.filter((value) => Boolean(value)))];
|
|
835
|
+
}
|
|
836
|
+
function ownedAvdDirectory(avdName, { env = process.env, home = homedir(), readFile = (path) => readFileSync(path, "utf8"), realpath = realpathSync, isDirectory = (path) => statSync(path).isDirectory() } = {}) {
|
|
837
|
+
if (!/^stim-[A-Za-z0-9._-]+$/.test(avdName)) return null;
|
|
838
|
+
for (const root of avdLookupRoots(env, home)) {
|
|
794
839
|
let ini;
|
|
795
840
|
try {
|
|
796
|
-
ini = readFile(join(root, `${avdName}.ini`));
|
|
841
|
+
ini = readFile(join$1(root, `${avdName}.ini`));
|
|
797
842
|
} catch (error) {
|
|
798
843
|
const code = error.code;
|
|
799
844
|
if (code === "ENOENT" || code === "ENOTDIR") continue;
|
|
@@ -817,7 +862,7 @@ const AVD_USER_DATA = [
|
|
|
817
862
|
"snapshots"
|
|
818
863
|
];
|
|
819
864
|
function wipeAvdUserData(directory) {
|
|
820
|
-
for (const name of AVD_USER_DATA) rmSync(join(directory, name), {
|
|
865
|
+
for (const name of AVD_USER_DATA) rmSync(join$1(directory, name), {
|
|
821
866
|
recursive: true,
|
|
822
867
|
force: true
|
|
823
868
|
});
|
|
@@ -850,14 +895,14 @@ function configureNewOwnedAvd(avdName, { dataPartitionSizeGb, avdConfig = {} },
|
|
|
850
895
|
const sizeBytes = androidDataPartitionSizeBytes(dataPartitionSizeGb);
|
|
851
896
|
const directory = avdDirectory(avdName);
|
|
852
897
|
if (!directory) throw new Error(`Could not resolve the content directory for newly created AVD ${avdName}.`);
|
|
853
|
-
const configPath = join(directory, "config.ini");
|
|
898
|
+
const configPath = join$1(directory, "config.ini");
|
|
854
899
|
const original = readFile(configPath);
|
|
855
900
|
const expected = {
|
|
856
901
|
...avdConfig,
|
|
857
902
|
"disk.dataPartition.size": String(sizeBytes)
|
|
858
903
|
};
|
|
859
904
|
const updated = withAvdConfigOverrides(original, expected);
|
|
860
|
-
const tempPath = join(directory, `.config.ini.stim-${process.pid}-${++avdConfigWriteSequence}.tmp`);
|
|
905
|
+
const tempPath = join$1(directory, `.config.ini.stim-${process.pid}-${++avdConfigWriteSequence}.tmp`);
|
|
861
906
|
try {
|
|
862
907
|
writeFile(tempPath, updated);
|
|
863
908
|
rename(tempPath, configPath);
|
|
@@ -886,7 +931,7 @@ function avdPoolConfiguration(dataPartitionSizeGb, avdConfig, deviceProfile = DE
|
|
|
886
931
|
function ownedAvdMatchesConfiguration(avdName, configuration) {
|
|
887
932
|
const directory = ownedAvdDirectory(avdName);
|
|
888
933
|
if (!directory) return false;
|
|
889
|
-
const contents = readFileSync(join(directory, "config.ini"), "utf8");
|
|
934
|
+
const contents = readFileSync(join$1(directory, "config.ini"), "utf8");
|
|
890
935
|
const expected = JSON.parse(configuration);
|
|
891
936
|
return Array.isArray(expected) && expected.length > 0 && expected.every((entry) => Array.isArray(entry) && entry.length === 2 && entry.every((value) => typeof value === "string") && contents.split(/\r?\n/).some((line) => line.trim() === `${entry[0]}=${entry[1]}`));
|
|
892
937
|
}
|
|
@@ -953,6 +998,35 @@ async function resetAdoptedAvd(avdName, serial, keepPackage) {
|
|
|
953
998
|
}
|
|
954
999
|
}
|
|
955
1000
|
}
|
|
1001
|
+
function parseDfAvailableBytes(text) {
|
|
1002
|
+
const lines = String(text ?? "").split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
1003
|
+
if (lines.length !== 2 || !/^Filesystem\s/.test(lines[0])) return null;
|
|
1004
|
+
const available = lines[1].split(/\s+/)[3];
|
|
1005
|
+
return available && /^\d+$/.test(available) ? Number(available) * 1024 : null;
|
|
1006
|
+
}
|
|
1007
|
+
function androidDataFreeBytes(serial) {
|
|
1008
|
+
return parseDfAvailableBytes(getExecutor().runFileQuiet("adb", [
|
|
1009
|
+
"-s",
|
|
1010
|
+
serial,
|
|
1011
|
+
"shell",
|
|
1012
|
+
"df",
|
|
1013
|
+
"-k",
|
|
1014
|
+
"/data"
|
|
1015
|
+
], { timeoutMs: 3e4 }));
|
|
1016
|
+
}
|
|
1017
|
+
function trimAndroidCaches(serial, desiredFreeBytes) {
|
|
1018
|
+
getExecutor().runFile("adb", [
|
|
1019
|
+
"-s",
|
|
1020
|
+
serial,
|
|
1021
|
+
"shell",
|
|
1022
|
+
"pm",
|
|
1023
|
+
"trim-caches",
|
|
1024
|
+
String(desiredFreeBytes)
|
|
1025
|
+
], {
|
|
1026
|
+
timeoutMs: 12e4,
|
|
1027
|
+
killSignal: "SIGKILL"
|
|
1028
|
+
});
|
|
1029
|
+
}
|
|
956
1030
|
function parseEmulatorVersion(text) {
|
|
957
1031
|
const match = /Android emulator version (\d+)\./.exec(String(text ?? ""));
|
|
958
1032
|
return match ? Number(match[1]) : null;
|
|
@@ -967,9 +1041,9 @@ const CRASH_REPORT_MODE_EMULATOR_VERSION = 37;
|
|
|
967
1041
|
* under GetTempPath, which reads TMP before TEMP.
|
|
968
1042
|
*/
|
|
969
1043
|
function emulatorCrashDatabases(env = process.env) {
|
|
970
|
-
const root = join(env.TMP || env.TEMP || tmpdir(), "AndroidEmulator");
|
|
1044
|
+
const root = join$1(env.TMP || env.TEMP || tmpdir(), "AndroidEmulator");
|
|
971
1045
|
try {
|
|
972
|
-
return readdirSync(root).filter((name) => /^emu-crash-.*\.db$/.test(name)).map((name) => join(root, name));
|
|
1046
|
+
return readdirSync(root).filter((name) => /^emu-crash-.*\.db$/.test(name)).map((name) => join$1(root, name));
|
|
973
1047
|
} catch {
|
|
974
1048
|
return [];
|
|
975
1049
|
}
|
|
@@ -995,7 +1069,7 @@ function suppressEmulatorCrashConsent({ platform = process.platform, version = e
|
|
|
995
1069
|
} catch {}
|
|
996
1070
|
return [];
|
|
997
1071
|
}
|
|
998
|
-
function bootAndroidEmulator(avdName, consolePort, { logFile, platform = process.platform } = {}) {
|
|
1072
|
+
function bootAndroidEmulator(avdName, consolePort, { logFile, platform = process.platform, openViewer = true } = {}) {
|
|
999
1073
|
const exec = getExecutor();
|
|
1000
1074
|
const app = configuredAndroidEmulatorApp(platform);
|
|
1001
1075
|
const child = exec.spawn(androidToolPath("emulator"), [
|
|
@@ -1006,7 +1080,7 @@ function bootAndroidEmulator(avdName, consolePort, { logFile, platform = process
|
|
|
1006
1080
|
"-grpc",
|
|
1007
1081
|
String(consolePort + 3e3),
|
|
1008
1082
|
"-grpc-use-token",
|
|
1009
|
-
...headlessEmulatorArgs(process.env, platform, app),
|
|
1083
|
+
...headlessEmulatorArgs(process.env, platform, openViewer ? app : "stim-desktop"),
|
|
1010
1084
|
...suppressEmulatorCrashConsent({ platform })
|
|
1011
1085
|
], {
|
|
1012
1086
|
cwd: androidToolCwd(platform),
|
|
@@ -1015,13 +1089,13 @@ function bootAndroidEmulator(avdName, consolePort, { logFile, platform = process
|
|
|
1015
1089
|
});
|
|
1016
1090
|
child?.unref?.();
|
|
1017
1091
|
const pid = child?.pid ?? null;
|
|
1018
|
-
if (pid !== null && platform === "darwin" && app === "stim-desktop") openEmulatorInStimDesktop(`emulator-${consolePort}`);
|
|
1092
|
+
if (openViewer && pid !== null && platform === "darwin" && app === "stim-desktop") openEmulatorInStimDesktop(`emulator-${consolePort}`);
|
|
1019
1093
|
return pid;
|
|
1020
1094
|
}
|
|
1021
1095
|
function emulatorStdio(logFile) {
|
|
1022
1096
|
if (!logFile) return "ignore";
|
|
1023
1097
|
try {
|
|
1024
|
-
mkdirSync(dirname(logFile), { recursive: true });
|
|
1098
|
+
mkdirSync(dirname$1(logFile), { recursive: true });
|
|
1025
1099
|
const fd = openSync(logFile, "w");
|
|
1026
1100
|
return [
|
|
1027
1101
|
"ignore",
|
|
@@ -1123,7 +1197,7 @@ function sleepSync(ms) {
|
|
|
1123
1197
|
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
1124
1198
|
}
|
|
1125
1199
|
function avdProcessLockPaths(avdDirectory, platform) {
|
|
1126
|
-
return ["hardware-qemu.ini.lock", "userdata-qemu.img.lock"].map((name) => join(avdDirectory, name, ...platform === "win32" ? ["pid"] : []));
|
|
1200
|
+
return ["hardware-qemu.ini.lock", "userdata-qemu.img.lock"].map((name) => join$1(avdDirectory, name, ...platform === "win32" ? ["pid"] : []));
|
|
1127
1201
|
}
|
|
1128
1202
|
function readAvdProcessId(path) {
|
|
1129
1203
|
try {
|
|
@@ -1177,7 +1251,18 @@ function scanAvdEmulatorProcesses(avdName, platform, listProcesses) {
|
|
|
1177
1251
|
if (pids === null) throw new Error(`Could not read the process table to verify that owned AVD ${avdName} stopped.`);
|
|
1178
1252
|
return pids;
|
|
1179
1253
|
}
|
|
1180
|
-
function
|
|
1254
|
+
function emulatorProcessRunning(pid) {
|
|
1255
|
+
if (!pidExists(pid)) return false;
|
|
1256
|
+
if (process.platform === "win32") return true;
|
|
1257
|
+
const stat = getExecutor().runFileQuiet("ps", [
|
|
1258
|
+
"-o",
|
|
1259
|
+
"stat=",
|
|
1260
|
+
"-p",
|
|
1261
|
+
String(pid)
|
|
1262
|
+
], { timeoutMs: 5e3 });
|
|
1263
|
+
return stat === null || !stat.trim().startsWith("Z");
|
|
1264
|
+
}
|
|
1265
|
+
function assertOwnedAvdStopped(avdName, { processAlive = emulatorProcessRunning, listProcesses = listAvdEmulatorProcesses, ...resolveOptions } = {}) {
|
|
1181
1266
|
const { processId } = resolveAvdProcess(avdName, resolveOptions);
|
|
1182
1267
|
const live = new Set(scanAvdEmulatorProcesses(avdName, resolveOptions.platform ?? process.platform, listProcesses));
|
|
1183
1268
|
if (processId !== null && processAlive(processId)) live.add(processId);
|
|
@@ -1312,20 +1397,22 @@ function once(read) {
|
|
|
1312
1397
|
return result.value;
|
|
1313
1398
|
};
|
|
1314
1399
|
}
|
|
1400
|
+
/** Floor for a single `listAvds`, `adb devices`, or `emu avd name` call in {@link ownedAvdSerialResolver}. */
|
|
1401
|
+
const MIN_LOOKUP_TIMEOUT_MS = 1e3;
|
|
1315
1402
|
/**
|
|
1316
1403
|
* `resolveOwnedAvdSerial` for several AVDs against one reading of the AVD list, `adb devices`, and
|
|
1317
1404
|
* each emulator's AVD name. The timeout budget starts when the resolver is created.
|
|
1318
1405
|
*/
|
|
1319
1406
|
function ownedAvdSerialResolver({ timeoutMs } = {}) {
|
|
1320
1407
|
const started = Date.now();
|
|
1321
|
-
const remaining = () => ({ timeoutMs: timeoutMs === void 0 ? void 0 : Math.max(
|
|
1408
|
+
const remaining = () => ({ timeoutMs: timeoutMs === void 0 ? void 0 : Math.max(MIN_LOOKUP_TIMEOUT_MS, timeoutMs - (Date.now() - started)) });
|
|
1322
1409
|
const avds = once(() => listAvds(remaining()));
|
|
1323
1410
|
const adb = once(() => listAdbDevices(remaining()));
|
|
1324
1411
|
const names = /* @__PURE__ */ new Map();
|
|
1325
1412
|
const avdNameOf = (serial) => {
|
|
1326
|
-
if (names.has(serial)) return names.get(serial);
|
|
1413
|
+
if (names.has(serial)) return names.get(serial) ?? null;
|
|
1327
1414
|
const name = getAvdNameForSerial(serial, remaining());
|
|
1328
|
-
|
|
1415
|
+
names.set(serial, name);
|
|
1329
1416
|
return name;
|
|
1330
1417
|
};
|
|
1331
1418
|
return (avdName) => {
|
|
@@ -1338,4 +1425,4 @@ function ownedAvdSerialResolver({ timeoutMs } = {}) {
|
|
|
1338
1425
|
};
|
|
1339
1426
|
}
|
|
1340
1427
|
//#endregion
|
|
1341
|
-
export {
|
|
1428
|
+
export { trimAndroidCaches as $, listAvds as A, ownedAvdSystemImage as B, emulatorFailureRemedy as C, hostSystemImageArch as D, getAvdNameForSerial as E, ownedAvdDeviceProfile as F, probeEmulatorSerial as G, parseAvdSystemImage as H, ownedAvdDirectory as I, resolveOwnedAvdSerial as J, profileNeedsFoldFeature as K, ownedAvdMatchesConfiguration as L, listOrphanedAvdDirectories as M, memoizeEmulatorProbe as N, listAdbDevices as O, nextConsolePort as P, systemImageSupportsFold as Q, ownedAvdName as R, emulatorDiskSpaceRemedy as S, findBuildTool as T, physicalDeviceModel as U, parseAvdDeviceProfile as V, pickDefaultSystemImage as W, shutdownAndroidEmulator as X, resolvePhysicalDevice as Y, sleepSync as Z, avdStorageRoots as _, androidDeviceAbi as a, POOL_SETTING_REMEDY as at, createOwnedAvd as b, androidPoolNoCandidatesRefusal as c, eraseParkedAfter as ct, androidToolPath as d, parkedMaxSetting as dt, waitForAndroidEmulatorShutdown as et, assertOwnedAvdStopped as f, readParked as ft, avdPoolConfiguration as g, avdPathExists as h, configuredAndroidEmulatorApp as ht, androidDataFreeBytes as i, isStimOwnedSim as it, listInstalledSystemImages as j, listAvdDeviceProfiles as k, androidSystemImageAbi as l, isLegacyDeletionClaim as lt, avdNameAbsent as m, selectParked as mt, OWNED_AVD_CONFIG_DEFAULTS as n, wipeAvdUserData as nt, androidHome as o, adoptParked as ot, avdIniPaths as p, removeParkedAfter as pt, resetAdoptedAvd as q, androidBuildToolName as r, isStimOwnedAvd as rt, androidPoolCandidates as s, dropParked as st, DEFAULT_AVD_DEVICE_PROFILE as t, waitForBoot as tt, androidToolCwd as u, parkSim as ut, bootAndroidEmulator as v, extractEmulatorFailure as w, deleteAvd as x, configureNewOwnedAvd as y, ownedAvdSerialResolver as z };
|