pid1 0.0.0-dev.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/cli.d.mts +1 -0
- package/dist/cli.mjs +119 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/client-Bdt88RU-.d.mts +217 -0
- package/dist/client-Bdt88RU-.d.mts.map +1 -0
- package/dist/client.d.mts +2 -0
- package/dist/client.mjs +12 -0
- package/dist/client.mjs.map +1 -0
- package/dist/config-BgRb4pSG.mjs +186 -0
- package/dist/config-BgRb4pSG.mjs.map +1 -0
- package/dist/config.d.mts +84 -0
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +3 -0
- package/dist/index.d.mts +36 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +5 -0
- package/dist/process-manager-gO56266Q.mjs +643 -0
- package/dist/process-manager-gO56266Q.mjs.map +1 -0
- package/package.json +52 -0
- package/src/api/client.ts +20 -0
- package/src/api/router.ts +150 -0
- package/src/api/server.ts +66 -0
- package/src/cli.ts +168 -0
- package/src/config.ts +89 -0
- package/src/env.ts +74 -0
- package/src/exec.ts +85 -0
- package/src/index.ts +14 -0
- package/src/logger.ts +155 -0
- package/src/process-manager.ts +632 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import * as v from "valibot";
|
|
2
|
+
|
|
3
|
+
//#region src/config.d.ts
|
|
4
|
+
declare const Config: v.ObjectSchema<{
|
|
5
|
+
readonly envFile: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.LiteralSchema<false, undefined>], undefined>, undefined>;
|
|
6
|
+
readonly restartOnEnvChange: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
|
|
7
|
+
readonly restartMinDelayMs: v.OptionalSchema<v.NumberSchema<undefined>, 5000>;
|
|
8
|
+
readonly restartMaxDelayMs: v.OptionalSchema<v.NumberSchema<undefined>, 60000>;
|
|
9
|
+
readonly tasks: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
10
|
+
readonly name: v.StringSchema<undefined>;
|
|
11
|
+
readonly command: v.StringSchema<undefined>;
|
|
12
|
+
readonly args: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, readonly []>;
|
|
13
|
+
readonly env: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>, {}>;
|
|
14
|
+
readonly cwd: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
15
|
+
readonly envFile: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.LiteralSchema<false, undefined>], undefined>, undefined>;
|
|
16
|
+
readonly restartOnEnvChange: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
|
|
17
|
+
readonly restartPolicy: v.OptionalSchema<v.PicklistSchema<["never", "always", "on-failure"], undefined>, "on-failure">;
|
|
18
|
+
readonly maxRestarts: v.OptionalSchema<v.NumberSchema<undefined>, 10>;
|
|
19
|
+
readonly restartMinDelayMs: v.OptionalSchema<v.NumberSchema<undefined>, 5000>;
|
|
20
|
+
readonly restartMaxDelayMs: v.OptionalSchema<v.NumberSchema<undefined>, 60000>;
|
|
21
|
+
readonly restartResetSeconds: v.OptionalSchema<v.NumberSchema<undefined>, 300>;
|
|
22
|
+
}, undefined>, undefined>, readonly []>;
|
|
23
|
+
readonly processes: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
24
|
+
readonly name: v.StringSchema<undefined>;
|
|
25
|
+
readonly command: v.StringSchema<undefined>;
|
|
26
|
+
readonly args: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, readonly []>;
|
|
27
|
+
readonly env: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>, {}>;
|
|
28
|
+
readonly cwd: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
29
|
+
readonly envFile: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.LiteralSchema<false, undefined>], undefined>, undefined>;
|
|
30
|
+
readonly restartOnEnvChange: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
|
|
31
|
+
readonly restartPolicy: v.OptionalSchema<v.PicklistSchema<["never", "always", "on-failure"], undefined>, "on-failure">;
|
|
32
|
+
readonly maxRestarts: v.OptionalSchema<v.NumberSchema<undefined>, 10>;
|
|
33
|
+
readonly restartMinDelayMs: v.OptionalSchema<v.NumberSchema<undefined>, 5000>;
|
|
34
|
+
readonly restartMaxDelayMs: v.OptionalSchema<v.NumberSchema<undefined>, 60000>;
|
|
35
|
+
readonly restartResetSeconds: v.OptionalSchema<v.NumberSchema<undefined>, 300>;
|
|
36
|
+
}, undefined>, undefined>, readonly []>;
|
|
37
|
+
}, undefined>;
|
|
38
|
+
type ConfigInput = v.InferInput<typeof Config>;
|
|
39
|
+
type LoadedConfig = v.InferOutput<typeof Config> & {
|
|
40
|
+
configPath: string;
|
|
41
|
+
};
|
|
42
|
+
declare function loadConfigFile(path?: string, cwd?: string): Promise<LoadedConfig>;
|
|
43
|
+
declare function findConfigFile(cwd: string): string | null;
|
|
44
|
+
declare function defineConfig(config: ConfigInput): {
|
|
45
|
+
envFile?: string | false | undefined;
|
|
46
|
+
restartOnEnvChange?: boolean | undefined;
|
|
47
|
+
restartMinDelayMs?: number | undefined;
|
|
48
|
+
restartMaxDelayMs?: number | undefined;
|
|
49
|
+
tasks?: {
|
|
50
|
+
name: string;
|
|
51
|
+
command: string;
|
|
52
|
+
args?: string[] | undefined;
|
|
53
|
+
env?: {
|
|
54
|
+
[x: string]: string;
|
|
55
|
+
} | undefined;
|
|
56
|
+
cwd?: string | undefined;
|
|
57
|
+
envFile?: string | false | undefined;
|
|
58
|
+
restartOnEnvChange?: boolean | undefined;
|
|
59
|
+
restartPolicy?: "never" | "always" | "on-failure" | undefined;
|
|
60
|
+
maxRestarts?: number | undefined;
|
|
61
|
+
restartMinDelayMs?: number | undefined;
|
|
62
|
+
restartMaxDelayMs?: number | undefined;
|
|
63
|
+
restartResetSeconds?: number | undefined;
|
|
64
|
+
}[] | undefined;
|
|
65
|
+
processes?: {
|
|
66
|
+
name: string;
|
|
67
|
+
command: string;
|
|
68
|
+
args?: string[] | undefined;
|
|
69
|
+
env?: {
|
|
70
|
+
[x: string]: string;
|
|
71
|
+
} | undefined;
|
|
72
|
+
cwd?: string | undefined;
|
|
73
|
+
envFile?: string | false | undefined;
|
|
74
|
+
restartOnEnvChange?: boolean | undefined;
|
|
75
|
+
restartPolicy?: "never" | "always" | "on-failure" | undefined;
|
|
76
|
+
maxRestarts?: number | undefined;
|
|
77
|
+
restartMinDelayMs?: number | undefined;
|
|
78
|
+
restartMaxDelayMs?: number | undefined;
|
|
79
|
+
restartResetSeconds?: number | undefined;
|
|
80
|
+
}[] | undefined;
|
|
81
|
+
};
|
|
82
|
+
//#endregion
|
|
83
|
+
export { LoadedConfig, defineConfig, findConfigFile, loadConfigFile };
|
|
84
|
+
//# sourceMappingURL=config.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.mts","names":[],"sources":["../src/config.ts"],"mappings":";;;cAyBM,MAAA,EAAM,CAAA,CAAA,YAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KASP,WAAA,GAAc,CAAA,CAAE,UAAA,QAAkB,MAAA;AAAA,KAE3B,YAAA,GAAe,CAAA,CAAE,WAAA,QAAmB,MAAA;EAC9C,UAAA;AAAA;AAAA,iBAGoB,cAAA,CACpB,IAAA,WACA,GAAA,YACC,OAAA,CAAQ,YAAA;AAAA,iBAmCK,cAAA,CAAe,GAAA;AAAA,iBAQf,YAAA,CAAa,MAAA,EAAQ,WAAA"}
|
package/dist/config.mjs
ADDED
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { a as router, c as ProcessInfo, d as ProcessStatus, f as ServerOptions, h as spawnWithLogging, i as Router, l as ProcessManager, m as SpawnedProcess, n as ClientOptions, o as ManagedProcess, p as createServer, r as createClient, s as ProcessConfig, t as Client, u as ProcessManagerOptions } from "./client-Bdt88RU-.mjs";
|
|
2
|
+
import { defineConfig, loadConfigFile } from "./config.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/logger.d.ts
|
|
5
|
+
declare const LOG_LEVELS: {
|
|
6
|
+
readonly debug: 0;
|
|
7
|
+
readonly info: 1;
|
|
8
|
+
readonly warn: 2;
|
|
9
|
+
readonly error: 3;
|
|
10
|
+
};
|
|
11
|
+
type LogLevel = keyof typeof LOG_LEVELS;
|
|
12
|
+
type LoggerOptions = {
|
|
13
|
+
name: string;
|
|
14
|
+
level?: LogLevel;
|
|
15
|
+
prettyLogFile?: string | null;
|
|
16
|
+
jsonLogFile?: string | null;
|
|
17
|
+
stdout?: boolean;
|
|
18
|
+
};
|
|
19
|
+
declare class Logger {
|
|
20
|
+
private name;
|
|
21
|
+
private level;
|
|
22
|
+
private prettyLogFile?;
|
|
23
|
+
private jsonLogFile?;
|
|
24
|
+
private stdout;
|
|
25
|
+
constructor(options: LoggerOptions);
|
|
26
|
+
private log;
|
|
27
|
+
debug(message: string): void;
|
|
28
|
+
info(message: string): void;
|
|
29
|
+
warn(message: string): void;
|
|
30
|
+
error(message: string): void;
|
|
31
|
+
child(name: string, options?: Partial<LoggerOptions>): Logger;
|
|
32
|
+
}
|
|
33
|
+
declare const globalLogger: Logger;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { type Client, type ClientOptions, type ManagedProcess, type ProcessConfig, type ProcessInfo, ProcessManager, type ProcessManagerOptions, type ProcessStatus, type Router, type ServerOptions, type SpawnedProcess, createClient, createServer, defineConfig, globalLogger, loadConfigFile, router, spawnWithLogging };
|
|
36
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/logger.ts"],"mappings":";;;;cAsBM,UAAA;EAAA;;;;;KAOD,QAAA,gBAAwB,UAAA;AAAA,KAiBjB,aAAA;EACV,IAAA;EACA,KAAA,GAAQ,QAAA;EACR,aAAA;EACA,WAAA;EACA,MAAA;AAAA;AAAA,cAGW,MAAA;EAAA,QACH,IAAA;EAAA,QACA,KAAA;EAAA,QACA,aAAA;EAAA,QACA,WAAA;EAAA,QACA,MAAA;cAEI,OAAA,EAAS,aAAA;EAAA,QAeb,GAAA;EA6BR,KAAA,CAAM,OAAA;EAIN,IAAA,CAAK,OAAA;EAIL,IAAA,CAAK,OAAA;EAIL,KAAA,CAAM,OAAA;EAIN,KAAA,CAAM,IAAA,UAAc,OAAA,GAAS,OAAA,CAAQ,aAAA,IAAsB,MAAA;AAAA;AAAA,cAgBhD,YAAA,EAAY,MAAA"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { i as globalLogger, r as loadConfigFile, t as defineConfig } from "./config-BgRb4pSG.mjs";
|
|
2
|
+
import { i as spawnWithLogging, n as createServer, r as router, t as ProcessManager } from "./process-manager-gO56266Q.mjs";
|
|
3
|
+
import { createClient } from "./client.mjs";
|
|
4
|
+
|
|
5
|
+
export { ProcessManager, createClient, createServer, defineConfig, globalLogger, loadConfigFile, router, spawnWithLogging };
|