@kevisual/router 0.0.26-alpha.5 → 0.0.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@kevisual/router",
4
- "version": "0.0.26-alpha.5",
4
+ "version": "0.0.26",
5
5
  "description": "",
6
6
  "type": "module",
7
7
  "main": "./dist/router.js",
@@ -80,6 +80,10 @@
80
80
  "require": "./dist/router-define.js",
81
81
  "types": "./dist/router-define.d.ts"
82
82
  },
83
+ "./auto": {
84
+ "import": "./dist/auto.js",
85
+ "types": "./dist/auto.d.ts"
86
+ },
83
87
  "./mod.ts": {
84
88
  "import": "./mod.ts",
85
89
  "require": "./mod.ts",
@@ -5,6 +5,7 @@ export const getPid = async () => {
5
5
 
6
6
  let pid = 0;
7
7
  if (runtime.isDeno) {
8
+ // @ts-ignore
8
9
  pid = Deno.pid;
9
10
  } else {
10
11
  pid = process.pid;
@@ -29,7 +30,7 @@ export const getPidFromFileAndStop = async () => {
29
30
  process.kill(pid);
30
31
  console.log(`Stopped process with PID ${pid}`);
31
32
  } catch (error) {
32
- console.error(`Failed to stop process with PID ${pid}:`, error);
33
+ console.error(`Failed to stop process with PID ${pid}:`);
33
34
  }
34
35
  }
35
36
  }
@@ -6,9 +6,19 @@ import { cleanup } from './listen/cleanup.ts';
6
6
  import { ServerTimer } from './listen/server-time.ts';
7
7
 
8
8
  type ListenSocketOptions = {
9
+ /**
10
+ * Unix socket path, defaults to './app.sock'
11
+ */
9
12
  path?: string;
10
13
  app?: QueryRouterServer;
14
+ /**
15
+ * Unix socket path, defaults to './app.pid'
16
+ */
11
17
  pidPath?: string;
18
+ /**
19
+ * Timeout for the server, defaults to 15 minutes.
20
+ * If the server is not responsive for this duration, it will be terminated
21
+ */
12
22
  timeout?: number;
13
23
  };
14
24
 
@@ -38,7 +48,7 @@ export const serverTimer = new ServerTimer();
38
48
  export const listenSocket = async (options?: ListenSocketOptions) => {
39
49
  const path = options?.path || './app.sock';
40
50
  const pidPath = options?.pidPath || './app.pid';
41
- const timeout = options?.timeout || 10 * 1000; // 10 seconds
51
+ const timeout = options?.timeout || 24 * 60 * 60 * 1000; // 24 hours
42
52
  const runtime = getRuntime();
43
53
 
44
54
  serverTimer.timeout = timeout;