@patchstack/connect 0.5.24 → 0.5.26

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.
@@ -4638,7 +4638,7 @@ async function cacheWrite(dir, env) {
4638
4638
  try {
4639
4639
  fs.renameSync(temporary, target);
4640
4640
  } catch (error) {
4641
- if (typeof process === "undefined" || process.platform !== "win32" || error?.code !== "EEXIST" && error?.code !== "EPERM") throw error;
4641
+ if (typeof process === "undefined" || true) throw error;
4642
4642
  try {
4643
4643
  fs.unlinkSync(target);
4644
4644
  } catch (unlinkError) {
@@ -7368,7 +7368,7 @@ async function createProtection(options = {}) {
7368
7368
  allowHosts
7369
7369
  });
7370
7370
  }
7371
- const cwd = options.cwd ?? (typeof process !== "undefined" ? process.cwd() : void 0);
7371
+ const cwd = workingDirectory(options);
7372
7372
  const live = Boolean(options.siteUuid || options.token);
7373
7373
  const refreshSecret = options.refreshSecret ?? (typeof process !== "undefined" ? process.env.PATCHSTACK_REFRESH_SECRET : void 0);
7374
7374
  const refreshable = live && (options.refreshMs > 0 || Boolean(refreshSecret));
@@ -7462,8 +7462,17 @@ function resolveMode(options, bundle) {
7462
7462
  return "dry-run";
7463
7463
  }
7464
7464
  var CREDENTIAL_FILES = [".patchstackrc.local.json", ".patchstackrc.json"];
7465
+ function workingDirectory(options) {
7466
+ if (options?.cwd !== void 0) return options.cwd;
7467
+ try {
7468
+ return typeof process !== "undefined" && false ? (void 0)() : void 0;
7469
+ } catch {
7470
+ return void 0;
7471
+ }
7472
+ }
7465
7473
  async function readCredentialField(options, field) {
7466
- if (typeof process === "undefined" || typeof process.cwd !== "function") return void 0;
7474
+ const cwd = workingDirectory(options);
7475
+ if (!cwd) return void 0;
7467
7476
  let readFileSync;
7468
7477
  let join;
7469
7478
  try {
@@ -7473,7 +7482,6 @@ async function readCredentialField(options, field) {
7473
7482
  } catch {
7474
7483
  return void 0;
7475
7484
  }
7476
- const cwd = options?.cwd ?? process.cwd();
7477
7485
  for (const filename of CREDENTIAL_FILES) {
7478
7486
  try {
7479
7487
  const value = JSON.parse(readFileSync(join(cwd, filename), "utf8"))?.[field];