@swmansion/argent 0.30.2-next.16 → 0.30.2-next.18

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/dist/cli-cmds.mjs CHANGED
@@ -35594,7 +35594,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
35594
35594
  var SESSION_ID2 = randomUUID5();
35595
35595
  function readCliVersion() {
35596
35596
  if (true) {
35597
- return "0.30.2-next.15";
35597
+ return "0.30.2-next.18";
35598
35598
  }
35599
35599
  return "0.0.0";
35600
35600
  }
@@ -16900,7 +16900,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
16900
16900
  var SESSION_ID = randomUUID4();
16901
16901
  function readCliVersion() {
16902
16902
  if (true) {
16903
- return "0.30.2-next.15";
16903
+ return "0.30.2-next.18";
16904
16904
  }
16905
16905
  return "0.0.0";
16906
16906
  }
@@ -100945,7 +100945,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
100945
100945
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
100946
100946
  function readCliVersion() {
100947
100947
  if (true) {
100948
- return "0.30.2-next.15";
100948
+ return "0.30.2-next.18";
100949
100949
  }
100950
100950
  return "0.0.0";
100951
100951
  }
@@ -137870,9 +137870,12 @@ var BOOT_POLL_INTERVALS_MS = {
137870
137870
  // findSerialByAvdName: re-scan when >1 new emulator appeared
137871
137871
  adbRegister: 1e3,
137872
137872
  // attemptBoot stage 2: re-scan adb devices for the new serial
137873
- earlyExit: 500
137873
+ earlyExit: 500,
137874
137874
  // createEarlyExitRacer: re-check the crash latch during a blocking adb call
137875
+ serialGone: 500
137876
+ // awaitEmulatorsGone: re-scan adb devices for a killed emulator
137875
137877
  };
137878
+ var EMULATOR_GONE_BUDGET_MS = 3e4;
137876
137879
  var FRAME_PROBE = "screencap -p 2>/dev/null | wc -c | awk '$1>20000{print 1;exit} {print 0}'";
137877
137880
  async function killEmulatorQuietly(serial, child) {
137878
137881
  if (serial) {
@@ -137952,18 +137955,28 @@ async function findSerialByAvdName(avdName, deadline) {
137952
137955
  }
137953
137956
  return null;
137954
137957
  }
137955
- async function listNewEmulatorSerials(before) {
137958
+ async function listEmulatorSerials() {
137956
137959
  const { stdout } = await runAdb(["devices"], { timeoutMs: 3e3 }).catch(() => ({
137957
137960
  stdout: "",
137958
137961
  stderr: ""
137959
137962
  }));
137960
- const lines = stdout.split("\n");
137961
137963
  const now = [];
137962
- for (const line of lines) {
137964
+ for (const line of stdout.split("\n")) {
137963
137965
  const m = line.match(/^(emulator-\d+)\s+/);
137964
137966
  if (m) now.push(m[1]);
137965
137967
  }
137966
- return now.filter((s) => !before.has(s));
137968
+ return now;
137969
+ }
137970
+ async function listNewEmulatorSerials(before) {
137971
+ return (await listEmulatorSerials()).filter((s) => !before.has(s));
137972
+ }
137973
+ async function awaitEmulatorsGone(serials) {
137974
+ const deadline = Date.now() + EMULATOR_GONE_BUDGET_MS;
137975
+ while (serials.length > 0 && Date.now() < deadline) {
137976
+ const listed = await listEmulatorSerials();
137977
+ if (!serials.some((s) => listed.includes(s))) return;
137978
+ await new Promise((r) => setTimeout(r, BOOT_POLL_INTERVALS_MS.serialGone));
137979
+ }
137967
137980
  }
137968
137981
  async function bootIos(udid, registry2, force, headless) {
137969
137982
  if (process.platform !== "darwin") {
@@ -138312,14 +138325,18 @@ async function bootAndroidImpl(params) {
138312
138325
  });
138313
138326
  const existingDevices = await listAndroidDevices().catch(() => []);
138314
138327
  let hotBootFailureReason;
138328
+ const dropKilledEmulator = async (serial) => {
138329
+ await awaitEmulatorsGone([serial]);
138330
+ const refreshed = await listAndroidDevices().catch(() => existingDevices);
138331
+ existingDevices.splice(0, existingDevices.length, ...refreshed);
138332
+ };
138315
138333
  const alreadyRunning = existingDevices.find(
138316
138334
  (d) => d.isEmulator && d.avdName === params.avdName && d.state === "device"
138317
138335
  );
138318
138336
  if (alreadyRunning) {
138319
138337
  if (params.force) {
138320
138338
  await killEmulatorQuietly(alreadyRunning.serial);
138321
- const refreshed = await listAndroidDevices().catch(() => existingDevices);
138322
- existingDevices.splice(0, existingDevices.length, ...refreshed);
138339
+ await dropKilledEmulator(alreadyRunning.serial);
138323
138340
  } else {
138324
138341
  try {
138325
138342
  await assertScreencapAlive(alreadyRunning.serial);
@@ -138330,8 +138347,7 @@ async function bootAndroidImpl(params) {
138330
138347
  booted: true
138331
138348
  };
138332
138349
  } catch (_err) {
138333
- const refreshed = await listAndroidDevices().catch(() => existingDevices);
138334
- existingDevices.splice(0, existingDevices.length, ...refreshed);
138350
+ await dropKilledEmulator(alreadyRunning.serial);
138335
138351
  }
138336
138352
  }
138337
138353
  }
@@ -138384,6 +138400,7 @@ async function bootAndroidImpl(params) {
138384
138400
  };
138385
138401
  } catch (err) {
138386
138402
  hotBootFailureReason = err instanceof Error ? err.message : String(err);
138403
+ await awaitEmulatorsGone(await listNewEmulatorSerials(serialsBefore));
138387
138404
  const refreshed = new Set(
138388
138405
  (await listAndroidDevices().catch(() => [])).map((d) => d.serial)
138389
138406
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.30.2-next.16",
3
+ "version": "0.30.2-next.18",
4
4
  "mcpName": "io.github.software-mansion/argent",
5
5
  "description": "MCP server for iOS Simulator and Android Emulator control",
6
6
  "license": "Apache-2.0",