@hamedb89/localghost 0.4.0 → 0.5.0

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/vite.js CHANGED
@@ -439,6 +439,18 @@ function createLocalghostRegistry(options = {}) {
439
439
  return lease;
440
440
  });
441
441
  },
442
+ async renewPort(renewOptions) {
443
+ const projectCwd = canonicalizeLocalghostProjectCwd(renewOptions.projectCwd ?? cwd);
444
+ return withLock(async (registry) => {
445
+ const lease = registry.leases.find(
446
+ (candidate) => candidate.projectCwd === projectCwd && candidate.instanceKey === renewOptions.instanceKey && candidate.ownerToken === ownerToken
447
+ );
448
+ if (!lease || lease.expiresAt <= now() || !isRunning(lease.pid)) return void 0;
449
+ lease.expiresAt = now() + (renewOptions.leaseTtlMs ?? 30 * 60 * 1e3);
450
+ await writeRegistry(registry);
451
+ return lease;
452
+ });
453
+ },
442
454
  async releasePort(releaseOptions) {
443
455
  const projectCwd = canonicalizeLocalghostProjectCwd(releaseOptions.projectCwd ?? cwd);
444
456
  return withLock(async (registry) => {