@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/README.md +5 -5
- package/dist/cli.js +319 -107
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +40 -14
- package/dist/index.js +77 -11
- package/dist/index.js.map +1 -1
- package/dist/vite.js +12 -0
- package/dist/vite.js.map +1 -1
- package/docs/localghost.1.md +16 -0
- package/package.json +1 -1
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) => {
|