@swmansion/argent 0.14.1-next.8 → 0.14.1-next.9

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.
@@ -132908,26 +132908,29 @@ function waitForXctraceReady(child, { notify, timeoutMs }) {
132908
132908
  });
132909
132909
  }
132910
132910
 
132911
- // ../tool-server/src/utils/ios-profiler/export.ts
132912
- var path20 = __toESM(require("path"));
132913
-
132914
132911
  // ../tool-server/src/utils/ios-profiler/run-with-timeout.ts
132915
132912
  var import_child_process2 = require("child_process");
132916
132913
  var import_util6 = require("util");
132917
132914
  var DEFAULT_EXEC_TIMEOUT_MS = 6e4;
132918
132915
  var DEFAULT_EXEC_MAX_BUFFER = 256 * 1024 * 1024;
132919
- async function execAsyncWithTimeout(command, options = {}) {
132920
- const execAsync = (0, import_util6.promisify)(import_child_process2.exec);
132921
- const { stdout, stderr } = await execAsync(command, {
132922
- timeout: DEFAULT_EXEC_TIMEOUT_MS,
132923
- maxBuffer: DEFAULT_EXEC_MAX_BUFFER,
132916
+ async function execFileAsyncWithTimeout(file2, args, options = {}) {
132917
+ const execFileAsync20 = (0, import_util6.promisify)(import_child_process2.execFile);
132918
+ const { stdout, stderr } = await execFileAsync20(file2, args, {
132924
132919
  encoding: "utf-8",
132925
- ...options
132920
+ ...options,
132921
+ // The timeout and maxBuffer are this wrapper's whole purpose (the
132922
+ // event-loop-freeze and ENOBUFS guards documented above), so they are
132923
+ // applied AFTER ...options — a caller can never silently weaken them by
132924
+ // passing its own. maxBuffer stays a floor: a caller may raise it for an
132925
+ // even larger capture, but never drop below the 256 MiB guard.
132926
+ timeout: DEFAULT_EXEC_TIMEOUT_MS,
132927
+ maxBuffer: Math.max(options.maxBuffer ?? 0, DEFAULT_EXEC_MAX_BUFFER)
132926
132928
  });
132927
132929
  return { stdout, stderr };
132928
132930
  }
132929
132931
 
132930
132932
  // ../tool-server/src/utils/ios-profiler/export.ts
132933
+ var path20 = __toESM(require("path"));
132931
132934
  var CPU_SCHEMA_CANDIDATES = ["time-profile", "cpu-profile", "time-sample"];
132932
132935
  var EXPORTS = {
132933
132936
  cpu: {
@@ -132945,9 +132948,12 @@ var EXPORTS = {
132945
132948
  };
132946
132949
  async function discoverTraceSchemas(traceFile, diagnostics) {
132947
132950
  try {
132948
- const { stdout: toc } = await execAsyncWithTimeout(
132949
- `xctrace export --input "${traceFile}" --toc`
132950
- );
132951
+ const { stdout: toc } = await execFileAsyncWithTimeout("xctrace", [
132952
+ "export",
132953
+ "--input",
132954
+ traceFile,
132955
+ "--toc"
132956
+ ]);
132951
132957
  const schemas = [];
132952
132958
  const schemaRe = /schema="([^"]+)"/g;
132953
132959
  let m;
@@ -132982,9 +132988,15 @@ async function tryCpuExportFallback(traceFile, outPath, diagnostics) {
132982
132988
  for (const candidate of CPU_SCHEMA_CANDIDATES) {
132983
132989
  const xpath = `/trace-toc/run[@number="1"]/data/table[@schema="${candidate}"]`;
132984
132990
  try {
132985
- await execAsyncWithTimeout(
132986
- `xctrace export --input "${traceFile}" --output "${outPath}" --xpath '${xpath}'`
132987
- );
132991
+ await execFileAsyncWithTimeout("xctrace", [
132992
+ "export",
132993
+ "--input",
132994
+ traceFile,
132995
+ "--output",
132996
+ outPath,
132997
+ "--xpath",
132998
+ xpath
132999
+ ]);
132988
133000
  diagnostics.cpuSchemaUsed = candidate;
132989
133001
  return true;
132990
133002
  } catch {
@@ -133009,9 +133021,15 @@ async function exportIosTraceData(traceFile) {
133009
133021
  const resolvedXpath = await resolveCpuXpath(traceFile, diagnostics);
133010
133022
  if (resolvedXpath) {
133011
133023
  try {
133012
- await execAsyncWithTimeout(
133013
- `xctrace export --input "${traceFile}" --output "${outPath}" --xpath '${resolvedXpath}'`
133014
- );
133024
+ await execFileAsyncWithTimeout("xctrace", [
133025
+ "export",
133026
+ "--input",
133027
+ traceFile,
133028
+ "--output",
133029
+ outPath,
133030
+ "--xpath",
133031
+ resolvedXpath
133032
+ ]);
133015
133033
  exportedFiles[key] = outPath;
133016
133034
  continue;
133017
133035
  } catch (err) {
@@ -133028,9 +133046,15 @@ async function exportIosTraceData(traceFile) {
133028
133046
  continue;
133029
133047
  }
133030
133048
  try {
133031
- await execAsyncWithTimeout(
133032
- `xctrace export --input "${traceFile}" --output "${outPath}" --xpath '${config2.xpath}'`
133033
- );
133049
+ await execFileAsyncWithTimeout("xctrace", [
133050
+ "export",
133051
+ "--input",
133052
+ traceFile,
133053
+ "--output",
133054
+ outPath,
133055
+ "--xpath",
133056
+ config2.xpath
133057
+ ]);
133034
133058
  exportedFiles[key] = outPath;
133035
133059
  } catch (err) {
133036
133060
  const msg = err instanceof Error ? err.message : String(err);
@@ -133684,7 +133708,7 @@ var import_child_process3 = require("child_process");
133684
133708
  var ENV_OVERRIDE = "ARGENT_IOS_CAPTURE";
133685
133709
  function readActiveXcodeVersion() {
133686
133710
  try {
133687
- const out = (0, import_child_process3.execSync)("xcodebuild -version", {
133711
+ const out = (0, import_child_process3.execFileSync)("xcodebuild", ["-version"], {
133688
133712
  encoding: "utf-8",
133689
133713
  timeout: 5e3,
133690
133714
  stdio: ["ignore", "pipe", "ignore"]
@@ -134345,9 +134369,10 @@ var STOP_KILL_MS = 5e3;
134345
134369
  function enumerateRunningUserApps(udid) {
134346
134370
  let launchctlOutput;
134347
134371
  try {
134348
- launchctlOutput = (0, import_child_process4.execSync)(`xcrun simctl spawn ${udid} launchctl list`, {
134372
+ launchctlOutput = (0, import_child_process4.execFileSync)("xcrun", ["simctl", "spawn", udid, "launchctl", "list"], {
134349
134373
  encoding: "utf-8",
134350
- timeout: DETECT_RUNNING_APP_TIMEOUT_MS
134374
+ timeout: DETECT_RUNNING_APP_TIMEOUT_MS,
134375
+ maxBuffer: DEFAULT_EXEC_MAX_BUFFER
134351
134376
  });
134352
134377
  } catch (err) {
134353
134378
  const msg = err instanceof Error ? err.message : String(err);
@@ -134383,9 +134408,16 @@ function enumerateRunningUserApps(udid) {
134383
134408
  }
134384
134409
  let listAppsOutput;
134385
134410
  try {
134386
- listAppsOutput = (0, import_child_process4.execSync)(`xcrun simctl listapps ${udid} | plutil -convert json -o - -`, {
134411
+ const rawPlist = (0, import_child_process4.execFileSync)("xcrun", ["simctl", "listapps", udid], {
134412
+ encoding: "utf-8",
134413
+ timeout: DETECT_RUNNING_APP_TIMEOUT_MS,
134414
+ maxBuffer: DEFAULT_EXEC_MAX_BUFFER
134415
+ });
134416
+ listAppsOutput = (0, import_child_process4.execFileSync)("plutil", ["-convert", "json", "-o", "-", "--", "-"], {
134387
134417
  encoding: "utf-8",
134388
- timeout: DETECT_RUNNING_APP_TIMEOUT_MS
134418
+ input: rawPlist,
134419
+ timeout: DETECT_RUNNING_APP_TIMEOUT_MS,
134420
+ maxBuffer: DEFAULT_EXEC_MAX_BUFFER
134389
134421
  });
134390
134422
  } catch (err) {
134391
134423
  const msg = err instanceof Error ? err.message : String(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.14.1-next.8",
3
+ "version": "0.14.1-next.9",
4
4
  "description": "MCP server for iOS Simulator and Android Emulator control",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {