locadot 1.5.5 → 1.5.7

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.
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useDebounce = useDebounce;
4
+ const debounceStore = new WeakMap();
5
+ function useDebounce(timeout, fn) {
6
+ if (debounceStore.has(fn)) {
7
+ clearTimeout(debounceStore.get(fn));
8
+ }
9
+ const timer = setTimeout(() => {
10
+ fn();
11
+ debounceStore.delete(fn); // cleanup
12
+ }, timeout);
13
+ debounceStore.set(fn, timer);
14
+ }
package/dist/lib/http.js CHANGED
@@ -13,6 +13,13 @@ class HttpModule {
13
13
  if (!targetPort) {
14
14
  res.writeHead(502, { "Content-Type": "text/html" });
15
15
  res.end((0, template_1.proxyNotFound)(host));
16
+ // logger.warn(
17
+ // `${
18
+ // host || ""
19
+ // } warn: Connection failed. Host not found. ${targetPort}. Total host available : ${
20
+ // Object.keys(domainMap).length
21
+ // }`
22
+ // );
16
23
  }
17
24
  proxy.web(req, res, {
18
25
  target: `http://localhost:${targetPort}`,
@@ -21,7 +28,7 @@ class HttpModule {
21
28
  "X-Original-Host": host || "localhost",
22
29
  },
23
30
  }, (err) => {
24
- logger_1.default.warn(host || "", "warn", `${err.name}=> ${err.message}`);
31
+ logger_1.default.warn(`${host || ""} warn ${err.name}=> ${JSON.stringify(err, null, 2)}`);
25
32
  res.writeHead(502);
26
33
  res.end("Connection failed. Host not found.");
27
34
  });
@@ -102,7 +102,10 @@ class locadotFile {
102
102
  await locadotFile.clearLogs();
103
103
  await watcher?.close();
104
104
  if (pid) {
105
- process.kill(parseInt(pid));
105
+ try {
106
+ process.kill(parseInt(pid));
107
+ }
108
+ catch (error) { }
106
109
  }
107
110
  }
108
111
  catch (error) {
package/dist/proxy.js CHANGED
@@ -30,10 +30,10 @@ class ProxyHandler {
30
30
  logger_1.default.error("🛑 Proxy stopped. Proxy soft destroyed as process SIGTERM", err);
31
31
  await locadot_file_1.default.softDestroy(watcher);
32
32
  });
33
- process.on("exit", (code, signal) => {
34
- logger_1.default.error(`Process exited with error ${code} and signal ${signal}`);
35
- locadot_file_1.default.softDestroy(watcher);
36
- });
33
+ // process.on("exit", (code: string, signal: string) => {
34
+ // logger.error(`Process exited with error ${code} and signal ${signal}`);
35
+ // locadotFile.softDestroy(watcher);
36
+ // });
37
37
  const httpsServer = https_1.default.createServer(defaultCert, (req, res) => {
38
38
  http_2.default.requestHandler(req, res, proxy, domainMap);
39
39
  });
@@ -34,7 +34,7 @@ class Startup {
34
34
  let cmd = "";
35
35
  switch (platform) {
36
36
  case "windows":
37
- cmd = `schtasks /Create /TN "${SERVICE_NAME}" /TR "${command} ${commandArgs.join(" ")}" /SC ONSTART /F`;
37
+ cmd = `schtasks /Create /TN "${SERVICE_NAME}" /TR "${command} ${commandArgs.join(" ")}" /SC ONSTART /RL HIGHEST /RU SYSTEM /F`;
38
38
  break;
39
39
  case "linux":
40
40
  const cronLine = `@reboot ${command} ${commandArgs.join(" ")}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "locadot",
3
- "version": "1.5.5",
3
+ "version": "1.5.7",
4
4
  "description": "Secure your local development environment with HTTPS and custom domains like dev.localhost.",
5
5
  "homepage": "https://www.npmjs.com/package/locadot",
6
6
  "main": "dist/index.js",
@@ -43,5 +43,6 @@
43
43
  "devDependencies": {
44
44
  "tsx": "^4.19.3",
45
45
  "typescript": "^5.8.3"
46
- }
46
+ },
47
+ "packageManager": "pnpm@10.11.1+sha512.e519b9f7639869dc8d5c3c5dfef73b3f091094b0a006d7317353c72b124e80e1afd429732e28705ad6bfa1ee879c1fce46c128ccebd3192101f43dd67c667912"
47
48
  }