@mcesystems/apple-kit 1.0.85 → 1.0.87

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/index.mjs CHANGED
@@ -838,14 +838,14 @@ function createLoggers(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
838
838
  const logInfo8 = (0, import_debug.default)(`${namespace}:info`);
839
839
  const logTask5 = (0, import_debug.default)(`${namespace}:task`);
840
840
  const logError3 = (0, import_debug.default)(`${namespace}:error`);
841
- const logDetail2 = (0, import_debug.default)(`${namespace}:detail`);
841
+ const logDetail3 = (0, import_debug.default)(`${namespace}:detail`);
842
842
  const logDebug = (0, import_debug.default)(`${namespace}:debug`);
843
843
  const logWarning3 = (0, import_debug.default)(`${namespace}:warning`);
844
844
  const logColor = (0, import_debug.default)(`${namespace}:color`);
845
845
  logInfo8.color = "19";
846
846
  logTask5.color = "25";
847
847
  logError3.color = "1";
848
- logDetail2.color = "199";
848
+ logDetail3.color = "199";
849
849
  logWarning3.color = "186";
850
850
  logDebug.color = "211";
851
851
  logColor.enabled = true;
@@ -853,7 +853,7 @@ function createLoggers(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
853
853
  logInfo8.namespace = `${namespace2}:info`;
854
854
  logTask5.namespace = `${namespace2}:task`;
855
855
  logError3.namespace = `${namespace2}:error`;
856
- logDetail2.namespace = `${namespace2}:detail`;
856
+ logDetail3.namespace = `${namespace2}:detail`;
857
857
  logWarning3.namespace = `${namespace2}:warning`;
858
858
  logDebug.namespace = `${namespace2}:debug`;
859
859
  }
@@ -864,7 +864,7 @@ function createLoggers(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
864
864
  logTask5.enabled = true;
865
865
  logError3.enabled = true;
866
866
  logWarning3.enabled = true;
867
- logDetail2.enabled = false;
867
+ logDetail3.enabled = false;
868
868
  logDebug.enabled = false;
869
869
  break;
870
870
  case "debug":
@@ -872,7 +872,7 @@ function createLoggers(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
872
872
  logTask5.enabled = true;
873
873
  logError3.enabled = true;
874
874
  logWarning3.enabled = true;
875
- logDetail2.enabled = true;
875
+ logDetail3.enabled = true;
876
876
  logDebug.enabled = true;
877
877
  break;
878
878
  case "none":
@@ -880,7 +880,7 @@ function createLoggers(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
880
880
  logTask5.enabled = false;
881
881
  logError3.enabled = false;
882
882
  logWarning3.enabled = false;
883
- logDetail2.enabled = false;
883
+ logDetail3.enabled = false;
884
884
  logDebug.enabled = false;
885
885
  break;
886
886
  }
@@ -898,7 +898,7 @@ function createLoggers(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
898
898
  logError3.color = color;
899
899
  break;
900
900
  case "detail":
901
- logDetail2.color = color;
901
+ logDetail3.color = color;
902
902
  break;
903
903
  case "warning":
904
904
  logWarning3.color = color;
@@ -965,7 +965,7 @@ ${" ".repeat(padding)}${"=".repeat(80)}`;
965
965
  const functionName = functionMatch ? functionMatch[1] : "<anonymous>";
966
966
  callerDetails = `${functionName}`;
967
967
  }
968
- logDetail2(`${header(`*${title}* ${callerDetails}`)}
968
+ logDetail3(`${header(`*${title}* ${callerDetails}`)}
969
969
  ${args.reduce((acc, arg) => `${acc}
970
970
  ${logDataDetail(arg)}`, "")}
971
971
 
@@ -988,7 +988,7 @@ ${"=".repeat(80)}`);
988
988
  logInfo: logInfo8,
989
989
  logTask: logTask5,
990
990
  logError: logError3,
991
- logDetail: logDetail2,
991
+ logDetail: logDetail3,
992
992
  logDebug,
993
993
  logWarning: logWarning3,
994
994
  logColor,
@@ -1147,9 +1147,9 @@ function throwIfAborted(signal) {
1147
1147
  }
1148
1148
  }
1149
1149
  var { logTask, logInfo, setNamespace } = createLoggers("apple-kit:device");
1150
- function getAppleLockdownPath() {
1150
+ function getLockdownPath() {
1151
1151
  if (process.platform === "win32") {
1152
- return join(process.env.ProgramData ?? "C:\\ProgramData", "Apple", "Lockdown");
1152
+ return process.env.LOCKDOWN_WINDOWS_PATH || join(process.env.ProgramData ?? "C:\\ProgramData", "Apple", "Lockdown");
1153
1153
  }
1154
1154
  if (process.platform === "darwin") {
1155
1155
  return "/var/db/lockdown";
@@ -1243,7 +1243,7 @@ var DeviceActions = class {
1243
1243
  }
1244
1244
  async unpair() {
1245
1245
  logInfo(`Un-pairing device ${this.udid}`);
1246
- const lockdownDir = getAppleLockdownPath();
1246
+ const lockdownDir = getLockdownPath();
1247
1247
  if (!lockdownDir) {
1248
1248
  throw new Error("Cannot determine lockdown directory for this platform");
1249
1249
  }
@@ -36575,14 +36575,14 @@ function createLoggers2(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
36575
36575
  const logInfo222 = (0, import_debug2.default)(`${namespace}:info`);
36576
36576
  const logTask5 = (0, import_debug2.default)(`${namespace}:task`);
36577
36577
  const logError22 = (0, import_debug2.default)(`${namespace}:error`);
36578
- const logDetail2 = (0, import_debug2.default)(`${namespace}:detail`);
36578
+ const logDetail3 = (0, import_debug2.default)(`${namespace}:detail`);
36579
36579
  const logDebug = (0, import_debug2.default)(`${namespace}:debug`);
36580
36580
  const logWarning22 = (0, import_debug2.default)(`${namespace}:warning`);
36581
36581
  const logColor = (0, import_debug2.default)(`${namespace}:color`);
36582
36582
  logInfo222.color = "19";
36583
36583
  logTask5.color = "25";
36584
36584
  logError22.color = "1";
36585
- logDetail2.color = "199";
36585
+ logDetail3.color = "199";
36586
36586
  logWarning22.color = "186";
36587
36587
  logDebug.color = "211";
36588
36588
  logColor.enabled = true;
@@ -36590,7 +36590,7 @@ function createLoggers2(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
36590
36590
  logInfo222.namespace = `${namespace2}:info`;
36591
36591
  logTask5.namespace = `${namespace2}:task`;
36592
36592
  logError22.namespace = `${namespace2}:error`;
36593
- logDetail2.namespace = `${namespace2}:detail`;
36593
+ logDetail3.namespace = `${namespace2}:detail`;
36594
36594
  logWarning22.namespace = `${namespace2}:warning`;
36595
36595
  logDebug.namespace = `${namespace2}:debug`;
36596
36596
  }
@@ -36601,7 +36601,7 @@ function createLoggers2(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
36601
36601
  logTask5.enabled = true;
36602
36602
  logError22.enabled = true;
36603
36603
  logWarning22.enabled = true;
36604
- logDetail2.enabled = false;
36604
+ logDetail3.enabled = false;
36605
36605
  logDebug.enabled = false;
36606
36606
  break;
36607
36607
  case "debug":
@@ -36609,7 +36609,7 @@ function createLoggers2(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
36609
36609
  logTask5.enabled = true;
36610
36610
  logError22.enabled = true;
36611
36611
  logWarning22.enabled = true;
36612
- logDetail2.enabled = true;
36612
+ logDetail3.enabled = true;
36613
36613
  logDebug.enabled = true;
36614
36614
  break;
36615
36615
  case "none":
@@ -36617,7 +36617,7 @@ function createLoggers2(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
36617
36617
  logTask5.enabled = false;
36618
36618
  logError22.enabled = false;
36619
36619
  logWarning22.enabled = false;
36620
- logDetail2.enabled = false;
36620
+ logDetail3.enabled = false;
36621
36621
  logDebug.enabled = false;
36622
36622
  break;
36623
36623
  }
@@ -36635,7 +36635,7 @@ function createLoggers2(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
36635
36635
  logError22.color = color;
36636
36636
  break;
36637
36637
  case "detail":
36638
- logDetail2.color = color;
36638
+ logDetail3.color = color;
36639
36639
  break;
36640
36640
  case "warning":
36641
36641
  logWarning22.color = color;
@@ -36702,7 +36702,7 @@ ${" ".repeat(padding)}${"=".repeat(80)}`;
36702
36702
  const functionName = functionMatch ? functionMatch[1] : "<anonymous>";
36703
36703
  callerDetails = `${functionName}`;
36704
36704
  }
36705
- logDetail2(`${header(`*${title}* ${callerDetails}`)}
36705
+ logDetail3(`${header(`*${title}* ${callerDetails}`)}
36706
36706
  ${args.reduce((acc, arg) => `${acc}
36707
36707
  ${logDataDetail(arg)}`, "")}
36708
36708
 
@@ -36725,7 +36725,7 @@ ${"=".repeat(80)}`);
36725
36725
  logInfo: logInfo222,
36726
36726
  logTask: logTask5,
36727
36727
  logError: logError22,
36728
- logDetail: logDetail2,
36728
+ logDetail: logDetail3,
36729
36729
  logDebug,
36730
36730
  logWarning: logWarning22,
36731
36731
  logColor,
@@ -37672,14 +37672,14 @@ function createLoggers22(namespace, logLevel = process.env.LOG_LEVEL ?? "none")
37672
37672
  const logInfo32 = (0, import_debug22.default)(`${namespace}:info`);
37673
37673
  const logTask5 = (0, import_debug22.default)(`${namespace}:task`);
37674
37674
  const logError22 = (0, import_debug22.default)(`${namespace}:error`);
37675
- const logDetail2 = (0, import_debug22.default)(`${namespace}:detail`);
37675
+ const logDetail3 = (0, import_debug22.default)(`${namespace}:detail`);
37676
37676
  const logDebug = (0, import_debug22.default)(`${namespace}:debug`);
37677
37677
  const logWarning22 = (0, import_debug22.default)(`${namespace}:warning`);
37678
37678
  const logColor = (0, import_debug22.default)(`${namespace}:color`);
37679
37679
  logInfo32.color = "19";
37680
37680
  logTask5.color = "25";
37681
37681
  logError22.color = "1";
37682
- logDetail2.color = "199";
37682
+ logDetail3.color = "199";
37683
37683
  logWarning22.color = "186";
37684
37684
  logDebug.color = "211";
37685
37685
  logColor.enabled = true;
@@ -37687,7 +37687,7 @@ function createLoggers22(namespace, logLevel = process.env.LOG_LEVEL ?? "none")
37687
37687
  logInfo32.namespace = `${namespace2}:info`;
37688
37688
  logTask5.namespace = `${namespace2}:task`;
37689
37689
  logError22.namespace = `${namespace2}:error`;
37690
- logDetail2.namespace = `${namespace2}:detail`;
37690
+ logDetail3.namespace = `${namespace2}:detail`;
37691
37691
  logWarning22.namespace = `${namespace2}:warning`;
37692
37692
  logDebug.namespace = `${namespace2}:debug`;
37693
37693
  }
@@ -37698,7 +37698,7 @@ function createLoggers22(namespace, logLevel = process.env.LOG_LEVEL ?? "none")
37698
37698
  logTask5.enabled = true;
37699
37699
  logError22.enabled = true;
37700
37700
  logWarning22.enabled = true;
37701
- logDetail2.enabled = false;
37701
+ logDetail3.enabled = false;
37702
37702
  logDebug.enabled = false;
37703
37703
  break;
37704
37704
  case "debug":
@@ -37706,7 +37706,7 @@ function createLoggers22(namespace, logLevel = process.env.LOG_LEVEL ?? "none")
37706
37706
  logTask5.enabled = true;
37707
37707
  logError22.enabled = true;
37708
37708
  logWarning22.enabled = true;
37709
- logDetail2.enabled = true;
37709
+ logDetail3.enabled = true;
37710
37710
  logDebug.enabled = true;
37711
37711
  break;
37712
37712
  case "none":
@@ -37714,7 +37714,7 @@ function createLoggers22(namespace, logLevel = process.env.LOG_LEVEL ?? "none")
37714
37714
  logTask5.enabled = false;
37715
37715
  logError22.enabled = false;
37716
37716
  logWarning22.enabled = false;
37717
- logDetail2.enabled = false;
37717
+ logDetail3.enabled = false;
37718
37718
  logDebug.enabled = false;
37719
37719
  break;
37720
37720
  }
@@ -37732,7 +37732,7 @@ function createLoggers22(namespace, logLevel = process.env.LOG_LEVEL ?? "none")
37732
37732
  logError22.color = color;
37733
37733
  break;
37734
37734
  case "detail":
37735
- logDetail2.color = color;
37735
+ logDetail3.color = color;
37736
37736
  break;
37737
37737
  case "warning":
37738
37738
  logWarning22.color = color;
@@ -37799,7 +37799,7 @@ ${" ".repeat(padding)}${"=".repeat(80)}`;
37799
37799
  const functionName = functionMatch ? functionMatch[1] : "<anonymous>";
37800
37800
  callerDetails = `${functionName}`;
37801
37801
  }
37802
- logDetail2(`${header(`*${title}* ${callerDetails}`)}
37802
+ logDetail3(`${header(`*${title}* ${callerDetails}`)}
37803
37803
  ${args.reduce((acc, arg) => `${acc}
37804
37804
  ${logDataDetail(arg)}`, "")}
37805
37805
 
@@ -37822,7 +37822,7 @@ ${"=".repeat(80)}`);
37822
37822
  logInfo: logInfo32,
37823
37823
  logTask: logTask5,
37824
37824
  logError: logError22,
37825
- logDetail: logDetail2,
37825
+ logDetail: logDetail3,
37826
37826
  logDebug,
37827
37827
  logWarning: logWarning22,
37828
37828
  logColor,
@@ -37965,7 +37965,7 @@ var InstallActions = class {
37965
37965
  };
37966
37966
 
37967
37967
  // src/logic/actions/proxy.ts
37968
- var { logTask: logTask2, logInfo: logInfo4, setNamespace: setNamespace3 } = createLoggers("");
37968
+ var { logTask: logTask2, logInfo: logInfo4, setNamespace: setNamespace3, logDetail } = createLoggers("");
37969
37969
  var ProxyActions = class {
37970
37970
  constructor(udid, iosClient) {
37971
37971
  this.udid = udid;
@@ -37973,14 +37973,26 @@ var ProxyActions = class {
37973
37973
  setNamespace3(`apple-${udid}`);
37974
37974
  }
37975
37975
  childProcess = /* @__PURE__ */ new Map();
37976
- async startPortForward(localPort, devicePort) {
37976
+ async startPortForward(localPort, devicePort, timeoutMs = 1e4) {
37977
37977
  logInfo4(`Starting port forward ${localPort} -> ${devicePort} for device ${this.udid}`);
37978
- const result = await this.iosClient.forward({ fromPort: localPort, toPort: devicePort });
37978
+ const result = this.iosClient.forward({ fromPort: localPort, toPort: devicePort });
37979
+ this.childProcess.set(this.udid, result);
37979
37980
  return new Promise((resolve2, reject) => {
37980
37981
  const timeout2 = setTimeout(() => {
37981
37982
  reject(new Error("Port forwarding timed out"));
37982
- }, 1e4);
37983
+ }, timeoutMs);
37983
37984
  result.stdout?.on("data", (data) => {
37985
+ logDetail("port forward stdout", data.toString());
37986
+ if (data.toString().includes("Started")) {
37987
+ clearTimeout(timeout2);
37988
+ resolve2({
37989
+ localPort,
37990
+ devicePort
37991
+ });
37992
+ }
37993
+ });
37994
+ result.stderr?.on("data", (data) => {
37995
+ logDetail("port forward stderr", data.toString());
37984
37996
  if (data.toString().includes("Started")) {
37985
37997
  clearTimeout(timeout2);
37986
37998
  resolve2({
@@ -38590,7 +38602,7 @@ var ProfileParser = class {
38590
38602
  };
38591
38603
 
38592
38604
  // src/logic/iosClient.ts
38593
- var { logDetail, setNamespace: setNamespace5, logTask: logTask4 } = createLoggers("");
38605
+ var { logDetail: logDetail2, setNamespace: setNamespace5, logTask: logTask4 } = createLoggers("");
38594
38606
  var IosClient = class {
38595
38607
  constructor(iosPath, udid, _usbmuxdAddress) {
38596
38608
  this.iosPath = iosPath;
@@ -38717,7 +38729,7 @@ var IosClient = class {
38717
38729
  async pair() {
38718
38730
  return this.runIosCommand(["pair", "--udid", this.udid]);
38719
38731
  }
38720
- async forward({ fromPort, toPort }) {
38732
+ forward({ fromPort, toPort }) {
38721
38733
  return this.spawnIosCommand(["forward", `--port=${fromPort}:${toPort}`, "--udid", this.udid]);
38722
38734
  }
38723
38735
  async info() {
@@ -38750,7 +38762,7 @@ var IosClient = class {
38750
38762
  }
38751
38763
  async tunnelStart(userspace = false) {
38752
38764
  const args = ["tunnel", "start", "--udid", this.udid, ...userspace ? ["--userspace"] : []];
38753
- logDetail(`Spawning tunnel: ${this.iosPath} ${args.join(" ")}`);
38765
+ logDetail2(`Spawning tunnel: ${this.iosPath} ${args.join(" ")}`);
38754
38766
  const child = spawn(this.iosPath, args, {
38755
38767
  windowsHide: true,
38756
38768
  env: {
@@ -39003,11 +39015,11 @@ var AppleDeviceKit = class {
39003
39015
  * @param startupTimeout Time to wait for proxy to start (ms)
39004
39016
  * @returns The port forward result with the allocated local port
39005
39017
  */
39006
- async startPortForwardAsync(devicePort) {
39018
+ async startPortForwardAsync(devicePort, timeoutMs = 1e4) {
39007
39019
  this.ensureNotDisposed();
39008
39020
  this.killProxyProcess();
39009
39021
  this.localDevicePort = await getPorts({ port: portNumbers(3e4, 31e3) });
39010
- const result = await this.proxyActions.startPortForward(this.localDevicePort, devicePort);
39022
+ const result = await this.proxyActions.startPortForward(this.localDevicePort, devicePort, timeoutMs);
39011
39023
  return result;
39012
39024
  }
39013
39025
  /**