@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.js CHANGED
@@ -873,14 +873,14 @@ function createLoggers(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
873
873
  const logInfo8 = (0, import_debug.default)(`${namespace}:info`);
874
874
  const logTask5 = (0, import_debug.default)(`${namespace}:task`);
875
875
  const logError3 = (0, import_debug.default)(`${namespace}:error`);
876
- const logDetail2 = (0, import_debug.default)(`${namespace}:detail`);
876
+ const logDetail3 = (0, import_debug.default)(`${namespace}:detail`);
877
877
  const logDebug = (0, import_debug.default)(`${namespace}:debug`);
878
878
  const logWarning3 = (0, import_debug.default)(`${namespace}:warning`);
879
879
  const logColor = (0, import_debug.default)(`${namespace}:color`);
880
880
  logInfo8.color = "19";
881
881
  logTask5.color = "25";
882
882
  logError3.color = "1";
883
- logDetail2.color = "199";
883
+ logDetail3.color = "199";
884
884
  logWarning3.color = "186";
885
885
  logDebug.color = "211";
886
886
  logColor.enabled = true;
@@ -888,7 +888,7 @@ function createLoggers(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
888
888
  logInfo8.namespace = `${namespace2}:info`;
889
889
  logTask5.namespace = `${namespace2}:task`;
890
890
  logError3.namespace = `${namespace2}:error`;
891
- logDetail2.namespace = `${namespace2}:detail`;
891
+ logDetail3.namespace = `${namespace2}:detail`;
892
892
  logWarning3.namespace = `${namespace2}:warning`;
893
893
  logDebug.namespace = `${namespace2}:debug`;
894
894
  }
@@ -899,7 +899,7 @@ function createLoggers(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
899
899
  logTask5.enabled = true;
900
900
  logError3.enabled = true;
901
901
  logWarning3.enabled = true;
902
- logDetail2.enabled = false;
902
+ logDetail3.enabled = false;
903
903
  logDebug.enabled = false;
904
904
  break;
905
905
  case "debug":
@@ -907,7 +907,7 @@ function createLoggers(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
907
907
  logTask5.enabled = true;
908
908
  logError3.enabled = true;
909
909
  logWarning3.enabled = true;
910
- logDetail2.enabled = true;
910
+ logDetail3.enabled = true;
911
911
  logDebug.enabled = true;
912
912
  break;
913
913
  case "none":
@@ -915,7 +915,7 @@ function createLoggers(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
915
915
  logTask5.enabled = false;
916
916
  logError3.enabled = false;
917
917
  logWarning3.enabled = false;
918
- logDetail2.enabled = false;
918
+ logDetail3.enabled = false;
919
919
  logDebug.enabled = false;
920
920
  break;
921
921
  }
@@ -933,7 +933,7 @@ function createLoggers(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
933
933
  logError3.color = color;
934
934
  break;
935
935
  case "detail":
936
- logDetail2.color = color;
936
+ logDetail3.color = color;
937
937
  break;
938
938
  case "warning":
939
939
  logWarning3.color = color;
@@ -1000,7 +1000,7 @@ ${" ".repeat(padding)}${"=".repeat(80)}`;
1000
1000
  const functionName = functionMatch ? functionMatch[1] : "<anonymous>";
1001
1001
  callerDetails = `${functionName}`;
1002
1002
  }
1003
- logDetail2(`${header(`*${title}* ${callerDetails}`)}
1003
+ logDetail3(`${header(`*${title}* ${callerDetails}`)}
1004
1004
  ${args.reduce((acc, arg) => `${acc}
1005
1005
  ${logDataDetail(arg)}`, "")}
1006
1006
 
@@ -1023,7 +1023,7 @@ ${"=".repeat(80)}`);
1023
1023
  logInfo: logInfo8,
1024
1024
  logTask: logTask5,
1025
1025
  logError: logError3,
1026
- logDetail: logDetail2,
1026
+ logDetail: logDetail3,
1027
1027
  logDebug,
1028
1028
  logWarning: logWarning3,
1029
1029
  logColor,
@@ -1182,9 +1182,9 @@ function throwIfAborted(signal) {
1182
1182
  }
1183
1183
  }
1184
1184
  var { logTask, logInfo, setNamespace } = createLoggers("apple-kit:device");
1185
- function getAppleLockdownPath() {
1185
+ function getLockdownPath() {
1186
1186
  if (process.platform === "win32") {
1187
- return (0, import_node_path.join)(process.env.ProgramData ?? "C:\\ProgramData", "Apple", "Lockdown");
1187
+ return process.env.LOCKDOWN_WINDOWS_PATH || (0, import_node_path.join)(process.env.ProgramData ?? "C:\\ProgramData", "Apple", "Lockdown");
1188
1188
  }
1189
1189
  if (process.platform === "darwin") {
1190
1190
  return "/var/db/lockdown";
@@ -1278,7 +1278,7 @@ var DeviceActions = class {
1278
1278
  }
1279
1279
  async unpair() {
1280
1280
  logInfo(`Un-pairing device ${this.udid}`);
1281
- const lockdownDir = getAppleLockdownPath();
1281
+ const lockdownDir = getLockdownPath();
1282
1282
  if (!lockdownDir) {
1283
1283
  throw new Error("Cannot determine lockdown directory for this platform");
1284
1284
  }
@@ -36610,14 +36610,14 @@ function createLoggers2(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
36610
36610
  const logInfo222 = (0, import_debug2.default)(`${namespace}:info`);
36611
36611
  const logTask5 = (0, import_debug2.default)(`${namespace}:task`);
36612
36612
  const logError22 = (0, import_debug2.default)(`${namespace}:error`);
36613
- const logDetail2 = (0, import_debug2.default)(`${namespace}:detail`);
36613
+ const logDetail3 = (0, import_debug2.default)(`${namespace}:detail`);
36614
36614
  const logDebug = (0, import_debug2.default)(`${namespace}:debug`);
36615
36615
  const logWarning22 = (0, import_debug2.default)(`${namespace}:warning`);
36616
36616
  const logColor = (0, import_debug2.default)(`${namespace}:color`);
36617
36617
  logInfo222.color = "19";
36618
36618
  logTask5.color = "25";
36619
36619
  logError22.color = "1";
36620
- logDetail2.color = "199";
36620
+ logDetail3.color = "199";
36621
36621
  logWarning22.color = "186";
36622
36622
  logDebug.color = "211";
36623
36623
  logColor.enabled = true;
@@ -36625,7 +36625,7 @@ function createLoggers2(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
36625
36625
  logInfo222.namespace = `${namespace2}:info`;
36626
36626
  logTask5.namespace = `${namespace2}:task`;
36627
36627
  logError22.namespace = `${namespace2}:error`;
36628
- logDetail2.namespace = `${namespace2}:detail`;
36628
+ logDetail3.namespace = `${namespace2}:detail`;
36629
36629
  logWarning22.namespace = `${namespace2}:warning`;
36630
36630
  logDebug.namespace = `${namespace2}:debug`;
36631
36631
  }
@@ -36636,7 +36636,7 @@ function createLoggers2(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
36636
36636
  logTask5.enabled = true;
36637
36637
  logError22.enabled = true;
36638
36638
  logWarning22.enabled = true;
36639
- logDetail2.enabled = false;
36639
+ logDetail3.enabled = false;
36640
36640
  logDebug.enabled = false;
36641
36641
  break;
36642
36642
  case "debug":
@@ -36644,7 +36644,7 @@ function createLoggers2(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
36644
36644
  logTask5.enabled = true;
36645
36645
  logError22.enabled = true;
36646
36646
  logWarning22.enabled = true;
36647
- logDetail2.enabled = true;
36647
+ logDetail3.enabled = true;
36648
36648
  logDebug.enabled = true;
36649
36649
  break;
36650
36650
  case "none":
@@ -36652,7 +36652,7 @@ function createLoggers2(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
36652
36652
  logTask5.enabled = false;
36653
36653
  logError22.enabled = false;
36654
36654
  logWarning22.enabled = false;
36655
- logDetail2.enabled = false;
36655
+ logDetail3.enabled = false;
36656
36656
  logDebug.enabled = false;
36657
36657
  break;
36658
36658
  }
@@ -36670,7 +36670,7 @@ function createLoggers2(namespace, logLevel = process.env.LOG_LEVEL ?? "none") {
36670
36670
  logError22.color = color;
36671
36671
  break;
36672
36672
  case "detail":
36673
- logDetail2.color = color;
36673
+ logDetail3.color = color;
36674
36674
  break;
36675
36675
  case "warning":
36676
36676
  logWarning22.color = color;
@@ -36737,7 +36737,7 @@ ${" ".repeat(padding)}${"=".repeat(80)}`;
36737
36737
  const functionName = functionMatch ? functionMatch[1] : "<anonymous>";
36738
36738
  callerDetails = `${functionName}`;
36739
36739
  }
36740
- logDetail2(`${header(`*${title}* ${callerDetails}`)}
36740
+ logDetail3(`${header(`*${title}* ${callerDetails}`)}
36741
36741
  ${args.reduce((acc, arg) => `${acc}
36742
36742
  ${logDataDetail(arg)}`, "")}
36743
36743
 
@@ -36760,7 +36760,7 @@ ${"=".repeat(80)}`);
36760
36760
  logInfo: logInfo222,
36761
36761
  logTask: logTask5,
36762
36762
  logError: logError22,
36763
- logDetail: logDetail2,
36763
+ logDetail: logDetail3,
36764
36764
  logDebug,
36765
36765
  logWarning: logWarning22,
36766
36766
  logColor,
@@ -37707,14 +37707,14 @@ function createLoggers22(namespace, logLevel = process.env.LOG_LEVEL ?? "none")
37707
37707
  const logInfo32 = (0, import_debug22.default)(`${namespace}:info`);
37708
37708
  const logTask5 = (0, import_debug22.default)(`${namespace}:task`);
37709
37709
  const logError22 = (0, import_debug22.default)(`${namespace}:error`);
37710
- const logDetail2 = (0, import_debug22.default)(`${namespace}:detail`);
37710
+ const logDetail3 = (0, import_debug22.default)(`${namespace}:detail`);
37711
37711
  const logDebug = (0, import_debug22.default)(`${namespace}:debug`);
37712
37712
  const logWarning22 = (0, import_debug22.default)(`${namespace}:warning`);
37713
37713
  const logColor = (0, import_debug22.default)(`${namespace}:color`);
37714
37714
  logInfo32.color = "19";
37715
37715
  logTask5.color = "25";
37716
37716
  logError22.color = "1";
37717
- logDetail2.color = "199";
37717
+ logDetail3.color = "199";
37718
37718
  logWarning22.color = "186";
37719
37719
  logDebug.color = "211";
37720
37720
  logColor.enabled = true;
@@ -37722,7 +37722,7 @@ function createLoggers22(namespace, logLevel = process.env.LOG_LEVEL ?? "none")
37722
37722
  logInfo32.namespace = `${namespace2}:info`;
37723
37723
  logTask5.namespace = `${namespace2}:task`;
37724
37724
  logError22.namespace = `${namespace2}:error`;
37725
- logDetail2.namespace = `${namespace2}:detail`;
37725
+ logDetail3.namespace = `${namespace2}:detail`;
37726
37726
  logWarning22.namespace = `${namespace2}:warning`;
37727
37727
  logDebug.namespace = `${namespace2}:debug`;
37728
37728
  }
@@ -37733,7 +37733,7 @@ function createLoggers22(namespace, logLevel = process.env.LOG_LEVEL ?? "none")
37733
37733
  logTask5.enabled = true;
37734
37734
  logError22.enabled = true;
37735
37735
  logWarning22.enabled = true;
37736
- logDetail2.enabled = false;
37736
+ logDetail3.enabled = false;
37737
37737
  logDebug.enabled = false;
37738
37738
  break;
37739
37739
  case "debug":
@@ -37741,7 +37741,7 @@ function createLoggers22(namespace, logLevel = process.env.LOG_LEVEL ?? "none")
37741
37741
  logTask5.enabled = true;
37742
37742
  logError22.enabled = true;
37743
37743
  logWarning22.enabled = true;
37744
- logDetail2.enabled = true;
37744
+ logDetail3.enabled = true;
37745
37745
  logDebug.enabled = true;
37746
37746
  break;
37747
37747
  case "none":
@@ -37749,7 +37749,7 @@ function createLoggers22(namespace, logLevel = process.env.LOG_LEVEL ?? "none")
37749
37749
  logTask5.enabled = false;
37750
37750
  logError22.enabled = false;
37751
37751
  logWarning22.enabled = false;
37752
- logDetail2.enabled = false;
37752
+ logDetail3.enabled = false;
37753
37753
  logDebug.enabled = false;
37754
37754
  break;
37755
37755
  }
@@ -37767,7 +37767,7 @@ function createLoggers22(namespace, logLevel = process.env.LOG_LEVEL ?? "none")
37767
37767
  logError22.color = color;
37768
37768
  break;
37769
37769
  case "detail":
37770
- logDetail2.color = color;
37770
+ logDetail3.color = color;
37771
37771
  break;
37772
37772
  case "warning":
37773
37773
  logWarning22.color = color;
@@ -37834,7 +37834,7 @@ ${" ".repeat(padding)}${"=".repeat(80)}`;
37834
37834
  const functionName = functionMatch ? functionMatch[1] : "<anonymous>";
37835
37835
  callerDetails = `${functionName}`;
37836
37836
  }
37837
- logDetail2(`${header(`*${title}* ${callerDetails}`)}
37837
+ logDetail3(`${header(`*${title}* ${callerDetails}`)}
37838
37838
  ${args.reduce((acc, arg) => `${acc}
37839
37839
  ${logDataDetail(arg)}`, "")}
37840
37840
 
@@ -37857,7 +37857,7 @@ ${"=".repeat(80)}`);
37857
37857
  logInfo: logInfo32,
37858
37858
  logTask: logTask5,
37859
37859
  logError: logError22,
37860
- logDetail: logDetail2,
37860
+ logDetail: logDetail3,
37861
37861
  logDebug,
37862
37862
  logWarning: logWarning22,
37863
37863
  logColor,
@@ -38000,7 +38000,7 @@ var InstallActions = class {
38000
38000
  };
38001
38001
 
38002
38002
  // src/logic/actions/proxy.ts
38003
- var { logTask: logTask2, logInfo: logInfo4, setNamespace: setNamespace3 } = createLoggers("");
38003
+ var { logTask: logTask2, logInfo: logInfo4, setNamespace: setNamespace3, logDetail } = createLoggers("");
38004
38004
  var ProxyActions = class {
38005
38005
  constructor(udid, iosClient) {
38006
38006
  this.udid = udid;
@@ -38008,14 +38008,26 @@ var ProxyActions = class {
38008
38008
  setNamespace3(`apple-${udid}`);
38009
38009
  }
38010
38010
  childProcess = /* @__PURE__ */ new Map();
38011
- async startPortForward(localPort, devicePort) {
38011
+ async startPortForward(localPort, devicePort, timeoutMs = 1e4) {
38012
38012
  logInfo4(`Starting port forward ${localPort} -> ${devicePort} for device ${this.udid}`);
38013
- const result = await this.iosClient.forward({ fromPort: localPort, toPort: devicePort });
38013
+ const result = this.iosClient.forward({ fromPort: localPort, toPort: devicePort });
38014
+ this.childProcess.set(this.udid, result);
38014
38015
  return new Promise((resolve2, reject) => {
38015
38016
  const timeout2 = setTimeout(() => {
38016
38017
  reject(new Error("Port forwarding timed out"));
38017
- }, 1e4);
38018
+ }, timeoutMs);
38018
38019
  result.stdout?.on("data", (data) => {
38020
+ logDetail("port forward stdout", data.toString());
38021
+ if (data.toString().includes("Started")) {
38022
+ clearTimeout(timeout2);
38023
+ resolve2({
38024
+ localPort,
38025
+ devicePort
38026
+ });
38027
+ }
38028
+ });
38029
+ result.stderr?.on("data", (data) => {
38030
+ logDetail("port forward stderr", data.toString());
38019
38031
  if (data.toString().includes("Started")) {
38020
38032
  clearTimeout(timeout2);
38021
38033
  resolve2({
@@ -38626,7 +38638,7 @@ var ProfileParser = class {
38626
38638
  };
38627
38639
 
38628
38640
  // src/logic/iosClient.ts
38629
- var { logDetail, setNamespace: setNamespace5, logTask: logTask4 } = createLoggers("");
38641
+ var { logDetail: logDetail2, setNamespace: setNamespace5, logTask: logTask4 } = createLoggers("");
38630
38642
  var IosClient = class {
38631
38643
  constructor(iosPath, udid, _usbmuxdAddress) {
38632
38644
  this.iosPath = iosPath;
@@ -38753,7 +38765,7 @@ var IosClient = class {
38753
38765
  async pair() {
38754
38766
  return this.runIosCommand(["pair", "--udid", this.udid]);
38755
38767
  }
38756
- async forward({ fromPort, toPort }) {
38768
+ forward({ fromPort, toPort }) {
38757
38769
  return this.spawnIosCommand(["forward", `--port=${fromPort}:${toPort}`, "--udid", this.udid]);
38758
38770
  }
38759
38771
  async info() {
@@ -38786,7 +38798,7 @@ var IosClient = class {
38786
38798
  }
38787
38799
  async tunnelStart(userspace = false) {
38788
38800
  const args = ["tunnel", "start", "--udid", this.udid, ...userspace ? ["--userspace"] : []];
38789
- logDetail(`Spawning tunnel: ${this.iosPath} ${args.join(" ")}`);
38801
+ logDetail2(`Spawning tunnel: ${this.iosPath} ${args.join(" ")}`);
38790
38802
  const child = (0, import_node_child_process.spawn)(this.iosPath, args, {
38791
38803
  windowsHide: true,
38792
38804
  env: {
@@ -39039,11 +39051,11 @@ var AppleDeviceKit = class {
39039
39051
  * @param startupTimeout Time to wait for proxy to start (ms)
39040
39052
  * @returns The port forward result with the allocated local port
39041
39053
  */
39042
- async startPortForwardAsync(devicePort) {
39054
+ async startPortForwardAsync(devicePort, timeoutMs = 1e4) {
39043
39055
  this.ensureNotDisposed();
39044
39056
  this.killProxyProcess();
39045
39057
  this.localDevicePort = await getPorts({ port: portNumbers(3e4, 31e3) });
39046
- const result = await this.proxyActions.startPortForward(this.localDevicePort, devicePort);
39058
+ const result = await this.proxyActions.startPortForward(this.localDevicePort, devicePort, timeoutMs);
39047
39059
  return result;
39048
39060
  }
39049
39061
  /**