vite-plugin-caddy-multiple-tls 1.7.0 → 1.7.1

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.
Files changed (2) hide show
  1. package/dist/index.js +10 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -272,7 +272,10 @@ function isProcessAlive(pid) {
272
272
  }
273
273
  }
274
274
  function isRouteOwnershipActive(record, now = Date.now()) {
275
- return isProcessAlive(record.pid) || now - record.lastSeenAt <= ROUTE_OWNERSHIP_STALE_AFTER_MS;
275
+ if (isProcessAlive(record.pid)) {
276
+ return true;
277
+ }
278
+ return record.pid <= 0 && now - record.lastSeenAt <= ROUTE_OWNERSHIP_STALE_AFTER_MS;
276
279
  }
277
280
  async function claimRouteOwnership(record) {
278
281
  const normalizedRecord = normalizeRouteOwnershipRecord(record);
@@ -1189,11 +1192,16 @@ function viteCaddyTlsPlugin({
1189
1192
  function onServerClose() {
1190
1193
  void cleanupRoute();
1191
1194
  }
1195
+ function getSignalExitCode(signal) {
1196
+ if (signal === "SIGINT") return 130;
1197
+ if (signal === "SIGTERM") return 143;
1198
+ return 1;
1199
+ }
1192
1200
  function handleSignal(signal) {
1193
1201
  process.off("SIGINT", onSigint);
1194
1202
  process.off("SIGTERM", onSigterm);
1195
1203
  void cleanupRoute().finally(() => {
1196
- process.kill(process.pid, signal);
1204
+ process.exit(getSignalExitCode(signal));
1197
1205
  });
1198
1206
  }
1199
1207
  function onSigint() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-caddy-multiple-tls",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "Vite plugin that uses Caddy to provide local HTTPS with derived domains.",
5
5
  "keywords": [
6
6
  "vite",