@percher/toml 0.1.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.
@@ -0,0 +1,18 @@
1
+ export type PercherTomlErrorCode = "PARSE_ERROR" | "VALIDATION_ERROR" | "FILE_NOT_FOUND";
2
+ export interface PercherTomlIssue {
3
+ path: (string | number)[];
4
+ message: string;
5
+ }
6
+ export interface PercherTomlErrorOptions {
7
+ code: PercherTomlErrorCode;
8
+ issues?: PercherTomlIssue[];
9
+ tomlLine?: number;
10
+ cause?: unknown;
11
+ }
12
+ export declare class PercherTomlError extends Error {
13
+ readonly code: PercherTomlErrorCode;
14
+ readonly issues?: PercherTomlIssue[];
15
+ readonly tomlLine?: number;
16
+ constructor(message: string, options: PercherTomlErrorOptions);
17
+ }
18
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG,kBAAkB,GAAG,gBAAgB,CAAC;AAEzF,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACrC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAEf,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB;CAO9D"}
package/dist/errors.js ADDED
@@ -0,0 +1,13 @@
1
+ export class PercherTomlError extends Error {
2
+ code;
3
+ issues;
4
+ tomlLine;
5
+ constructor(message, options) {
6
+ super(message, { cause: options.cause });
7
+ this.name = "PercherTomlError";
8
+ this.code = options.code;
9
+ this.issues = options.issues;
10
+ this.tomlLine = options.tomlLine;
11
+ }
12
+ }
13
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAcA,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAChC,IAAI,CAAuB;IAC3B,MAAM,CAAsB;IAC5B,QAAQ,CAAU;IAE3B,YAAY,OAAe,EAAE,OAAgC;QAC3D,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IACnC,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export declare function generateName(input: string): string;
2
+ //# sourceMappingURL=generate-name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-name.d.ts","sourceRoot":"","sources":["../src/generate-name.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAclD"}
@@ -0,0 +1,19 @@
1
+ import { PercherTomlError } from "./errors";
2
+ export function generateName(input) {
3
+ let result = input.toLowerCase();
4
+ result = result.replace(/[\s_]+/g, "-");
5
+ result = result.replace(/[^a-z0-9-]/g, "");
6
+ result = result.replace(/-+/g, "-");
7
+ result = result.replace(/^-+|-+$/g, "");
8
+ if (/^\d/.test(result))
9
+ result = `app-${result}`;
10
+ if (result.length > 40)
11
+ result = result.slice(0, 40).replace(/-+$/g, "");
12
+ if (result.length < 3) {
13
+ throw new PercherTomlError(`cannot generate a valid app name from ${JSON.stringify(input)}`, {
14
+ code: "VALIDATION_ERROR",
15
+ });
16
+ }
17
+ return result;
18
+ }
19
+ //# sourceMappingURL=generate-name.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-name.js","sourceRoot":"","sources":["../src/generate-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,IAAI,MAAM,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IACjC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IACxC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;IAC3C,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACpC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IACxC,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,MAAM,GAAG,OAAO,MAAM,EAAE,CAAC;IACjD,IAAI,MAAM,CAAC,MAAM,GAAG,EAAE;QAAE,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACzE,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,gBAAgB,CAAC,yCAAyC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,EAAE;YAC3F,IAAI,EAAE,kBAAkB;SACzB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { parse, parseFile, validate } from "./parse";
2
+ export { serialize } from "./serialize";
3
+ export { generateName } from "./generate-name";
4
+ export { PercherTomlError, type PercherTomlErrorCode, type PercherTomlIssue, } from "./errors";
5
+ export { percherConfigSchema, appSchema, buildSchema, webSchema, dataSchema, envSchema, domainSchema, resourcesSchema, type PercherConfig, } from "./schema";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACL,gBAAgB,EAChB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,GACtB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,mBAAmB,EACnB,SAAS,EACT,WAAW,EACX,SAAS,EACT,UAAU,EACV,SAAS,EACT,YAAY,EACZ,eAAe,EACf,KAAK,aAAa,GACnB,MAAM,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export { parse, parseFile, validate } from "./parse";
2
+ export { serialize } from "./serialize";
3
+ export { generateName } from "./generate-name";
4
+ export { PercherTomlError, } from "./errors";
5
+ export { percherConfigSchema, appSchema, buildSchema, webSchema, dataSchema, envSchema, domainSchema, resourcesSchema, } from "./schema";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACL,gBAAgB,GAGjB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,mBAAmB,EACnB,SAAS,EACT,WAAW,EACX,SAAS,EACT,UAAU,EACV,SAAS,EACT,YAAY,EACZ,eAAe,GAEhB,MAAM,UAAU,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { type PercherConfig } from "./schema";
2
+ export declare function parse(source: string): PercherConfig;
3
+ export declare function validate(raw: unknown): PercherConfig;
4
+ export declare function parseFile(path: string): Promise<PercherConfig>;
5
+ //# sourceMappingURL=parse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,aAAa,EAAuB,MAAM,UAAU,CAAC;AAEnE,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAYnD;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,aAAa,CAgBpD;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAcpE"}
package/dist/parse.js ADDED
@@ -0,0 +1,51 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import TOML from "@iarna/toml";
3
+ import { ZodError } from "zod";
4
+ import { PercherTomlError } from "./errors";
5
+ import { percherConfigSchema } from "./schema";
6
+ export function parse(source) {
7
+ let raw;
8
+ try {
9
+ raw = TOML.parse(source);
10
+ }
11
+ catch (err) {
12
+ const line = err.line;
13
+ throw new PercherTomlError(`invalid TOML syntax${line !== undefined ? ` (line ${line})` : ""}: ${err.message}`, { code: "PARSE_ERROR", tomlLine: line, cause: err });
14
+ }
15
+ return validate(raw);
16
+ }
17
+ export function validate(raw) {
18
+ try {
19
+ return percherConfigSchema.parse(raw);
20
+ }
21
+ catch (err) {
22
+ if (err instanceof ZodError) {
23
+ throw new PercherTomlError("percher.toml failed validation", {
24
+ code: "VALIDATION_ERROR",
25
+ issues: err.issues.map((i) => ({
26
+ path: i.path,
27
+ message: i.message,
28
+ })),
29
+ cause: err,
30
+ });
31
+ }
32
+ throw err;
33
+ }
34
+ }
35
+ export async function parseFile(path) {
36
+ let source;
37
+ try {
38
+ source = await readFile(path, "utf8");
39
+ }
40
+ catch (err) {
41
+ if (err.code === "ENOENT") {
42
+ throw new PercherTomlError(`percher.toml not found at ${path}`, {
43
+ code: "FILE_NOT_FOUND",
44
+ cause: err,
45
+ });
46
+ }
47
+ throw err;
48
+ }
49
+ return parse(source);
50
+ }
51
+ //# sourceMappingURL=parse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.js","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAsB,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEnE,MAAM,UAAU,KAAK,CAAC,MAAc;IAClC,IAAI,GAAY,CAAC;IACjB,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,GAAI,GAAyB,CAAC,IAAI,CAAC;QAC7C,MAAM,IAAI,gBAAgB,CACxB,sBAAsB,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,KAAM,GAAa,CAAC,OAAO,EAAE,EAC9F,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,CACpD,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,GAAY;IACnC,IAAI,CAAC;QACH,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,QAAQ,EAAE,CAAC;YAC5B,MAAM,IAAI,gBAAgB,CAAC,gCAAgC,EAAE;gBAC3D,IAAI,EAAE,kBAAkB;gBACxB,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;oBAC7B,IAAI,EAAE,CAAC,CAAC,IAA2B;oBACnC,OAAO,EAAE,CAAC,CAAC,OAAO;iBACnB,CAAC,CAAC;gBACH,KAAK,EAAE,GAAG;aACX,CAAC,CAAC;QACL,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,IAAY;IAC1C,IAAI,MAAc,CAAC;IACnB,IAAI,CAAC;QACH,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACrD,MAAM,IAAI,gBAAgB,CAAC,6BAA6B,IAAI,EAAE,EAAE;gBAC9D,IAAI,EAAE,gBAAgB;gBACtB,KAAK,EAAE,GAAG;aACX,CAAC,CAAC;QACL,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;IACD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC;AACvB,CAAC"}
@@ -0,0 +1,552 @@
1
+ import { z } from "zod";
2
+ export declare const appSchema: z.ZodObject<{
3
+ name: z.ZodString;
4
+ runtime: z.ZodEnum<["node", "python", "static", "docker"]>;
5
+ framework: z.ZodOptional<z.ZodEnum<["nextjs", "sveltekit", "astro", "remix", "vite", "express", "fastify", "hono", "fastapi", "flask", "django", "docker"]>>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ name: string;
8
+ runtime: "node" | "python" | "static" | "docker";
9
+ framework?: "docker" | "nextjs" | "sveltekit" | "astro" | "remix" | "vite" | "express" | "fastify" | "hono" | "fastapi" | "flask" | "django" | undefined;
10
+ }, {
11
+ name: string;
12
+ runtime: "node" | "python" | "static" | "docker";
13
+ framework?: "docker" | "nextjs" | "sveltekit" | "astro" | "remix" | "vite" | "express" | "fastify" | "hono" | "fastapi" | "flask" | "django" | undefined;
14
+ }>;
15
+ export declare const buildSchema: z.ZodObject<{
16
+ command: z.ZodOptional<z.ZodString>;
17
+ output: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
18
+ }, "strip", z.ZodTypeAny, {
19
+ command?: string | undefined;
20
+ output?: string | undefined;
21
+ }, {
22
+ command?: string | undefined;
23
+ output?: string | undefined;
24
+ }>;
25
+ export declare const webSchema: z.ZodObject<{
26
+ port: z.ZodNumber;
27
+ health: z.ZodOptional<z.ZodString>;
28
+ }, "strip", z.ZodTypeAny, {
29
+ port: number;
30
+ health?: string | undefined;
31
+ }, {
32
+ port: number;
33
+ health?: string | undefined;
34
+ }>;
35
+ export declare const convexConfigSchema: z.ZodObject<{
36
+ deployment_url: z.ZodString;
37
+ }, "strip", z.ZodTypeAny, {
38
+ deployment_url: string;
39
+ }, {
40
+ deployment_url: string;
41
+ }>;
42
+ export declare const supabaseConfigSchema: z.ZodObject<{
43
+ url: z.ZodString;
44
+ anon_key: z.ZodOptional<z.ZodString>;
45
+ }, "strip", z.ZodTypeAny, {
46
+ url: string;
47
+ anon_key?: string | undefined;
48
+ }, {
49
+ url: string;
50
+ anon_key?: string | undefined;
51
+ }>;
52
+ export declare const dataSchema: z.ZodEffects<z.ZodObject<{
53
+ mode: z.ZodEnum<["pocketbase", "postgres", "sqlite", "convex", "supabase", "none"]>;
54
+ file: z.ZodOptional<z.ZodString>;
55
+ convex: z.ZodOptional<z.ZodObject<{
56
+ deployment_url: z.ZodString;
57
+ }, "strip", z.ZodTypeAny, {
58
+ deployment_url: string;
59
+ }, {
60
+ deployment_url: string;
61
+ }>>;
62
+ supabase: z.ZodOptional<z.ZodObject<{
63
+ url: z.ZodString;
64
+ anon_key: z.ZodOptional<z.ZodString>;
65
+ }, "strip", z.ZodTypeAny, {
66
+ url: string;
67
+ anon_key?: string | undefined;
68
+ }, {
69
+ url: string;
70
+ anon_key?: string | undefined;
71
+ }>>;
72
+ }, "strip", z.ZodTypeAny, {
73
+ mode: "pocketbase" | "postgres" | "sqlite" | "convex" | "supabase" | "none";
74
+ convex?: {
75
+ deployment_url: string;
76
+ } | undefined;
77
+ supabase?: {
78
+ url: string;
79
+ anon_key?: string | undefined;
80
+ } | undefined;
81
+ file?: string | undefined;
82
+ }, {
83
+ mode: "pocketbase" | "postgres" | "sqlite" | "convex" | "supabase" | "none";
84
+ convex?: {
85
+ deployment_url: string;
86
+ } | undefined;
87
+ supabase?: {
88
+ url: string;
89
+ anon_key?: string | undefined;
90
+ } | undefined;
91
+ file?: string | undefined;
92
+ }>, {
93
+ mode: "pocketbase" | "postgres" | "sqlite" | "convex" | "supabase" | "none";
94
+ convex?: {
95
+ deployment_url: string;
96
+ } | undefined;
97
+ supabase?: {
98
+ url: string;
99
+ anon_key?: string | undefined;
100
+ } | undefined;
101
+ file?: string | undefined;
102
+ }, {
103
+ mode: "pocketbase" | "postgres" | "sqlite" | "convex" | "supabase" | "none";
104
+ convex?: {
105
+ deployment_url: string;
106
+ } | undefined;
107
+ supabase?: {
108
+ url: string;
109
+ anon_key?: string | undefined;
110
+ } | undefined;
111
+ file?: string | undefined;
112
+ }>;
113
+ export declare const domainSchema: z.ZodObject<{
114
+ subdomain: z.ZodOptional<z.ZodString>;
115
+ custom: z.ZodOptional<z.ZodString>;
116
+ }, "strip", z.ZodTypeAny, {
117
+ custom?: string | undefined;
118
+ subdomain?: string | undefined;
119
+ }, {
120
+ custom?: string | undefined;
121
+ subdomain?: string | undefined;
122
+ }>;
123
+ export declare const resourcesSchema: z.ZodObject<{
124
+ memory: z.ZodOptional<z.ZodEnum<["256mb", "512mb", "1gb", "2gb"]>>;
125
+ cpu: z.ZodOptional<z.ZodNumber>;
126
+ }, "strip", z.ZodTypeAny, {
127
+ memory?: "256mb" | "512mb" | "1gb" | "2gb" | undefined;
128
+ cpu?: number | undefined;
129
+ }, {
130
+ memory?: "256mb" | "512mb" | "1gb" | "2gb" | undefined;
131
+ cpu?: number | undefined;
132
+ }>;
133
+ export declare const envSchema: z.ZodRecord<z.ZodString, z.ZodString>;
134
+ export declare const devSchema: z.ZodObject<{
135
+ ignore: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
136
+ debounce: z.ZodOptional<z.ZodNumber>;
137
+ auto_open: z.ZodOptional<z.ZodBoolean>;
138
+ }, "strip", z.ZodTypeAny, {
139
+ ignore?: string[] | undefined;
140
+ debounce?: number | undefined;
141
+ auto_open?: boolean | undefined;
142
+ }, {
143
+ ignore?: string[] | undefined;
144
+ debounce?: number | undefined;
145
+ auto_open?: boolean | undefined;
146
+ }>;
147
+ export declare const requiredEnvSchema: z.ZodRecord<z.ZodString, z.ZodEnum<["secret", "url", "string"]>>;
148
+ export declare const cronSchema: z.ZodObject<{
149
+ schedule: z.ZodString;
150
+ command: z.ZodString;
151
+ }, "strip", z.ZodTypeAny, {
152
+ command: string;
153
+ schedule: string;
154
+ }, {
155
+ command: string;
156
+ schedule: string;
157
+ }>;
158
+ export declare const addonsSchema: z.ZodObject<{
159
+ pocketbase: z.ZodOptional<z.ZodObject<{
160
+ enabled: z.ZodOptional<z.ZodBoolean>;
161
+ }, "strip", z.ZodTypeAny, {
162
+ enabled?: boolean | undefined;
163
+ }, {
164
+ enabled?: boolean | undefined;
165
+ }>>;
166
+ cron: z.ZodOptional<z.ZodObject<{
167
+ enabled: z.ZodOptional<z.ZodBoolean>;
168
+ }, "strip", z.ZodTypeAny, {
169
+ enabled?: boolean | undefined;
170
+ }, {
171
+ enabled?: boolean | undefined;
172
+ }>>;
173
+ storage: z.ZodOptional<z.ZodObject<{
174
+ mode: z.ZodOptional<z.ZodEnum<["pocketbase", "volume"]>>;
175
+ max_size: z.ZodOptional<z.ZodString>;
176
+ }, "strip", z.ZodTypeAny, {
177
+ mode?: "pocketbase" | "volume" | undefined;
178
+ max_size?: string | undefined;
179
+ }, {
180
+ mode?: "pocketbase" | "volume" | undefined;
181
+ max_size?: string | undefined;
182
+ }>>;
183
+ }, "strip", z.ZodTypeAny, {
184
+ pocketbase?: {
185
+ enabled?: boolean | undefined;
186
+ } | undefined;
187
+ cron?: {
188
+ enabled?: boolean | undefined;
189
+ } | undefined;
190
+ storage?: {
191
+ mode?: "pocketbase" | "volume" | undefined;
192
+ max_size?: string | undefined;
193
+ } | undefined;
194
+ }, {
195
+ pocketbase?: {
196
+ enabled?: boolean | undefined;
197
+ } | undefined;
198
+ cron?: {
199
+ enabled?: boolean | undefined;
200
+ } | undefined;
201
+ storage?: {
202
+ mode?: "pocketbase" | "volume" | undefined;
203
+ max_size?: string | undefined;
204
+ } | undefined;
205
+ }>;
206
+ export declare const checkSchema: z.ZodObject<{
207
+ path: z.ZodString;
208
+ interval: z.ZodOptional<z.ZodNumber>;
209
+ timeout: z.ZodOptional<z.ZodNumber>;
210
+ initial_delay: z.ZodOptional<z.ZodNumber>;
211
+ }, "strip", z.ZodTypeAny, {
212
+ path: string;
213
+ interval?: number | undefined;
214
+ timeout?: number | undefined;
215
+ initial_delay?: number | undefined;
216
+ }, {
217
+ path: string;
218
+ interval?: number | undefined;
219
+ timeout?: number | undefined;
220
+ initial_delay?: number | undefined;
221
+ }>;
222
+ export declare const percherConfigSchema: z.ZodObject<{
223
+ app: z.ZodObject<{
224
+ name: z.ZodString;
225
+ runtime: z.ZodEnum<["node", "python", "static", "docker"]>;
226
+ framework: z.ZodOptional<z.ZodEnum<["nextjs", "sveltekit", "astro", "remix", "vite", "express", "fastify", "hono", "fastapi", "flask", "django", "docker"]>>;
227
+ }, "strip", z.ZodTypeAny, {
228
+ name: string;
229
+ runtime: "node" | "python" | "static" | "docker";
230
+ framework?: "docker" | "nextjs" | "sveltekit" | "astro" | "remix" | "vite" | "express" | "fastify" | "hono" | "fastapi" | "flask" | "django" | undefined;
231
+ }, {
232
+ name: string;
233
+ runtime: "node" | "python" | "static" | "docker";
234
+ framework?: "docker" | "nextjs" | "sveltekit" | "astro" | "remix" | "vite" | "express" | "fastify" | "hono" | "fastapi" | "flask" | "django" | undefined;
235
+ }>;
236
+ build: z.ZodOptional<z.ZodObject<{
237
+ command: z.ZodOptional<z.ZodString>;
238
+ output: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
239
+ }, "strip", z.ZodTypeAny, {
240
+ command?: string | undefined;
241
+ output?: string | undefined;
242
+ }, {
243
+ command?: string | undefined;
244
+ output?: string | undefined;
245
+ }>>;
246
+ web: z.ZodOptional<z.ZodObject<{
247
+ port: z.ZodNumber;
248
+ health: z.ZodOptional<z.ZodString>;
249
+ }, "strip", z.ZodTypeAny, {
250
+ port: number;
251
+ health?: string | undefined;
252
+ }, {
253
+ port: number;
254
+ health?: string | undefined;
255
+ }>>;
256
+ data: z.ZodOptional<z.ZodEffects<z.ZodObject<{
257
+ mode: z.ZodEnum<["pocketbase", "postgres", "sqlite", "convex", "supabase", "none"]>;
258
+ file: z.ZodOptional<z.ZodString>;
259
+ convex: z.ZodOptional<z.ZodObject<{
260
+ deployment_url: z.ZodString;
261
+ }, "strip", z.ZodTypeAny, {
262
+ deployment_url: string;
263
+ }, {
264
+ deployment_url: string;
265
+ }>>;
266
+ supabase: z.ZodOptional<z.ZodObject<{
267
+ url: z.ZodString;
268
+ anon_key: z.ZodOptional<z.ZodString>;
269
+ }, "strip", z.ZodTypeAny, {
270
+ url: string;
271
+ anon_key?: string | undefined;
272
+ }, {
273
+ url: string;
274
+ anon_key?: string | undefined;
275
+ }>>;
276
+ }, "strip", z.ZodTypeAny, {
277
+ mode: "pocketbase" | "postgres" | "sqlite" | "convex" | "supabase" | "none";
278
+ convex?: {
279
+ deployment_url: string;
280
+ } | undefined;
281
+ supabase?: {
282
+ url: string;
283
+ anon_key?: string | undefined;
284
+ } | undefined;
285
+ file?: string | undefined;
286
+ }, {
287
+ mode: "pocketbase" | "postgres" | "sqlite" | "convex" | "supabase" | "none";
288
+ convex?: {
289
+ deployment_url: string;
290
+ } | undefined;
291
+ supabase?: {
292
+ url: string;
293
+ anon_key?: string | undefined;
294
+ } | undefined;
295
+ file?: string | undefined;
296
+ }>, {
297
+ mode: "pocketbase" | "postgres" | "sqlite" | "convex" | "supabase" | "none";
298
+ convex?: {
299
+ deployment_url: string;
300
+ } | undefined;
301
+ supabase?: {
302
+ url: string;
303
+ anon_key?: string | undefined;
304
+ } | undefined;
305
+ file?: string | undefined;
306
+ }, {
307
+ mode: "pocketbase" | "postgres" | "sqlite" | "convex" | "supabase" | "none";
308
+ convex?: {
309
+ deployment_url: string;
310
+ } | undefined;
311
+ supabase?: {
312
+ url: string;
313
+ anon_key?: string | undefined;
314
+ } | undefined;
315
+ file?: string | undefined;
316
+ }>>;
317
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
318
+ domain: z.ZodOptional<z.ZodObject<{
319
+ subdomain: z.ZodOptional<z.ZodString>;
320
+ custom: z.ZodOptional<z.ZodString>;
321
+ }, "strip", z.ZodTypeAny, {
322
+ custom?: string | undefined;
323
+ subdomain?: string | undefined;
324
+ }, {
325
+ custom?: string | undefined;
326
+ subdomain?: string | undefined;
327
+ }>>;
328
+ resources: z.ZodOptional<z.ZodObject<{
329
+ memory: z.ZodOptional<z.ZodEnum<["256mb", "512mb", "1gb", "2gb"]>>;
330
+ cpu: z.ZodOptional<z.ZodNumber>;
331
+ }, "strip", z.ZodTypeAny, {
332
+ memory?: "256mb" | "512mb" | "1gb" | "2gb" | undefined;
333
+ cpu?: number | undefined;
334
+ }, {
335
+ memory?: "256mb" | "512mb" | "1gb" | "2gb" | undefined;
336
+ cpu?: number | undefined;
337
+ }>>;
338
+ dev: z.ZodOptional<z.ZodObject<{
339
+ ignore: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
340
+ debounce: z.ZodOptional<z.ZodNumber>;
341
+ auto_open: z.ZodOptional<z.ZodBoolean>;
342
+ }, "strip", z.ZodTypeAny, {
343
+ ignore?: string[] | undefined;
344
+ debounce?: number | undefined;
345
+ auto_open?: boolean | undefined;
346
+ }, {
347
+ ignore?: string[] | undefined;
348
+ debounce?: number | undefined;
349
+ auto_open?: boolean | undefined;
350
+ }>>;
351
+ required_env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<["secret", "url", "string"]>>>;
352
+ crons: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
353
+ schedule: z.ZodString;
354
+ command: z.ZodString;
355
+ }, "strip", z.ZodTypeAny, {
356
+ command: string;
357
+ schedule: string;
358
+ }, {
359
+ command: string;
360
+ schedule: string;
361
+ }>>>;
362
+ addons: z.ZodOptional<z.ZodObject<{
363
+ pocketbase: z.ZodOptional<z.ZodObject<{
364
+ enabled: z.ZodOptional<z.ZodBoolean>;
365
+ }, "strip", z.ZodTypeAny, {
366
+ enabled?: boolean | undefined;
367
+ }, {
368
+ enabled?: boolean | undefined;
369
+ }>>;
370
+ cron: z.ZodOptional<z.ZodObject<{
371
+ enabled: z.ZodOptional<z.ZodBoolean>;
372
+ }, "strip", z.ZodTypeAny, {
373
+ enabled?: boolean | undefined;
374
+ }, {
375
+ enabled?: boolean | undefined;
376
+ }>>;
377
+ storage: z.ZodOptional<z.ZodObject<{
378
+ mode: z.ZodOptional<z.ZodEnum<["pocketbase", "volume"]>>;
379
+ max_size: z.ZodOptional<z.ZodString>;
380
+ }, "strip", z.ZodTypeAny, {
381
+ mode?: "pocketbase" | "volume" | undefined;
382
+ max_size?: string | undefined;
383
+ }, {
384
+ mode?: "pocketbase" | "volume" | undefined;
385
+ max_size?: string | undefined;
386
+ }>>;
387
+ }, "strip", z.ZodTypeAny, {
388
+ pocketbase?: {
389
+ enabled?: boolean | undefined;
390
+ } | undefined;
391
+ cron?: {
392
+ enabled?: boolean | undefined;
393
+ } | undefined;
394
+ storage?: {
395
+ mode?: "pocketbase" | "volume" | undefined;
396
+ max_size?: string | undefined;
397
+ } | undefined;
398
+ }, {
399
+ pocketbase?: {
400
+ enabled?: boolean | undefined;
401
+ } | undefined;
402
+ cron?: {
403
+ enabled?: boolean | undefined;
404
+ } | undefined;
405
+ storage?: {
406
+ mode?: "pocketbase" | "volume" | undefined;
407
+ max_size?: string | undefined;
408
+ } | undefined;
409
+ }>>;
410
+ checks: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
411
+ path: z.ZodString;
412
+ interval: z.ZodOptional<z.ZodNumber>;
413
+ timeout: z.ZodOptional<z.ZodNumber>;
414
+ initial_delay: z.ZodOptional<z.ZodNumber>;
415
+ }, "strip", z.ZodTypeAny, {
416
+ path: string;
417
+ interval?: number | undefined;
418
+ timeout?: number | undefined;
419
+ initial_delay?: number | undefined;
420
+ }, {
421
+ path: string;
422
+ interval?: number | undefined;
423
+ timeout?: number | undefined;
424
+ initial_delay?: number | undefined;
425
+ }>>>;
426
+ }, "strip", z.ZodTypeAny, {
427
+ app: {
428
+ name: string;
429
+ runtime: "node" | "python" | "static" | "docker";
430
+ framework?: "docker" | "nextjs" | "sveltekit" | "astro" | "remix" | "vite" | "express" | "fastify" | "hono" | "fastapi" | "flask" | "django" | undefined;
431
+ };
432
+ build?: {
433
+ command?: string | undefined;
434
+ output?: string | undefined;
435
+ } | undefined;
436
+ web?: {
437
+ port: number;
438
+ health?: string | undefined;
439
+ } | undefined;
440
+ data?: {
441
+ mode: "pocketbase" | "postgres" | "sqlite" | "convex" | "supabase" | "none";
442
+ convex?: {
443
+ deployment_url: string;
444
+ } | undefined;
445
+ supabase?: {
446
+ url: string;
447
+ anon_key?: string | undefined;
448
+ } | undefined;
449
+ file?: string | undefined;
450
+ } | undefined;
451
+ env?: Record<string, string> | undefined;
452
+ domain?: {
453
+ custom?: string | undefined;
454
+ subdomain?: string | undefined;
455
+ } | undefined;
456
+ resources?: {
457
+ memory?: "256mb" | "512mb" | "1gb" | "2gb" | undefined;
458
+ cpu?: number | undefined;
459
+ } | undefined;
460
+ dev?: {
461
+ ignore?: string[] | undefined;
462
+ debounce?: number | undefined;
463
+ auto_open?: boolean | undefined;
464
+ } | undefined;
465
+ required_env?: Record<string, "string" | "url" | "secret"> | undefined;
466
+ crons?: Record<string, {
467
+ command: string;
468
+ schedule: string;
469
+ }> | undefined;
470
+ addons?: {
471
+ pocketbase?: {
472
+ enabled?: boolean | undefined;
473
+ } | undefined;
474
+ cron?: {
475
+ enabled?: boolean | undefined;
476
+ } | undefined;
477
+ storage?: {
478
+ mode?: "pocketbase" | "volume" | undefined;
479
+ max_size?: string | undefined;
480
+ } | undefined;
481
+ } | undefined;
482
+ checks?: Record<string, {
483
+ path: string;
484
+ interval?: number | undefined;
485
+ timeout?: number | undefined;
486
+ initial_delay?: number | undefined;
487
+ }> | undefined;
488
+ }, {
489
+ app: {
490
+ name: string;
491
+ runtime: "node" | "python" | "static" | "docker";
492
+ framework?: "docker" | "nextjs" | "sveltekit" | "astro" | "remix" | "vite" | "express" | "fastify" | "hono" | "fastapi" | "flask" | "django" | undefined;
493
+ };
494
+ build?: {
495
+ command?: string | undefined;
496
+ output?: string | undefined;
497
+ } | undefined;
498
+ web?: {
499
+ port: number;
500
+ health?: string | undefined;
501
+ } | undefined;
502
+ data?: {
503
+ mode: "pocketbase" | "postgres" | "sqlite" | "convex" | "supabase" | "none";
504
+ convex?: {
505
+ deployment_url: string;
506
+ } | undefined;
507
+ supabase?: {
508
+ url: string;
509
+ anon_key?: string | undefined;
510
+ } | undefined;
511
+ file?: string | undefined;
512
+ } | undefined;
513
+ env?: Record<string, string> | undefined;
514
+ domain?: {
515
+ custom?: string | undefined;
516
+ subdomain?: string | undefined;
517
+ } | undefined;
518
+ resources?: {
519
+ memory?: "256mb" | "512mb" | "1gb" | "2gb" | undefined;
520
+ cpu?: number | undefined;
521
+ } | undefined;
522
+ dev?: {
523
+ ignore?: string[] | undefined;
524
+ debounce?: number | undefined;
525
+ auto_open?: boolean | undefined;
526
+ } | undefined;
527
+ required_env?: Record<string, "string" | "url" | "secret"> | undefined;
528
+ crons?: Record<string, {
529
+ command: string;
530
+ schedule: string;
531
+ }> | undefined;
532
+ addons?: {
533
+ pocketbase?: {
534
+ enabled?: boolean | undefined;
535
+ } | undefined;
536
+ cron?: {
537
+ enabled?: boolean | undefined;
538
+ } | undefined;
539
+ storage?: {
540
+ mode?: "pocketbase" | "volume" | undefined;
541
+ max_size?: string | undefined;
542
+ } | undefined;
543
+ } | undefined;
544
+ checks?: Record<string, {
545
+ path: string;
546
+ interval?: number | undefined;
547
+ timeout?: number | undefined;
548
+ initial_delay?: number | undefined;
549
+ }> | undefined;
550
+ }>;
551
+ export type PercherConfig = z.infer<typeof percherConfigSchema>;
552
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,SAAS;;;;;;;;;;;;EAqBpB,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;EAMtB,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;;;;;EAGpB,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;EAE7B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;EAG/B,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BnB,CAAC;AAIL,eAAO,MAAM,YAAY;;;;;;;;;EAGvB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;EAG1B,CAAC;AAEH,eAAO,MAAM,SAAS,uCAAmC,CAAC;AAE1D,eAAO,MAAM,SAAS;;;;;;;;;;;;EAIpB,CAAC;AAEH,eAAO,MAAM,iBAAiB,kEAA4D,CAAC;AAE3F,eAAO,MAAM,UAAU;;;;;;;;;EAGrB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASvB,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;EAKtB,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
package/dist/schema.js ADDED
@@ -0,0 +1,123 @@
1
+ import { z } from "zod";
2
+ const APP_NAME_RE = /^[a-z][a-z0-9-]{2,39}$/;
3
+ export const appSchema = z.object({
4
+ name: z
5
+ .string()
6
+ .regex(APP_NAME_RE, "must be 3–40 chars, lowercase, start with a letter, [a-z0-9-] only"),
7
+ runtime: z.enum(["node", "python", "static", "docker"]),
8
+ framework: z
9
+ .enum([
10
+ "nextjs",
11
+ "sveltekit",
12
+ "astro",
13
+ "remix",
14
+ "vite",
15
+ "express",
16
+ "fastify",
17
+ "hono",
18
+ "fastapi",
19
+ "flask",
20
+ "django",
21
+ "docker",
22
+ ])
23
+ .optional(),
24
+ });
25
+ export const buildSchema = z.object({
26
+ command: z.string().optional(),
27
+ output: z
28
+ .string()
29
+ .refine((v) => !v.startsWith("/"), "must be a relative path (no leading slash)")
30
+ .optional(),
31
+ });
32
+ export const webSchema = z.object({
33
+ port: z.number().int().min(1024).max(65535),
34
+ health: z.string().optional(),
35
+ });
36
+ export const convexConfigSchema = z.object({
37
+ deployment_url: z.string().url(),
38
+ });
39
+ export const supabaseConfigSchema = z.object({
40
+ url: z.string().url(),
41
+ anon_key: z.string().min(1).optional(),
42
+ });
43
+ export const dataSchema = z
44
+ .object({
45
+ mode: z.enum(["pocketbase", "postgres", "sqlite", "convex", "supabase", "none"]),
46
+ file: z.string().min(1).optional(),
47
+ convex: convexConfigSchema.optional(),
48
+ supabase: supabaseConfigSchema.optional(),
49
+ })
50
+ .superRefine((value, ctx) => {
51
+ if (value.mode === "sqlite" && !value.file) {
52
+ ctx.addIssue({
53
+ code: z.ZodIssueCode.custom,
54
+ path: ["file"],
55
+ message: "required when mode = 'sqlite'",
56
+ });
57
+ }
58
+ if (value.mode === "convex" && !value.convex?.deployment_url) {
59
+ ctx.addIssue({
60
+ code: z.ZodIssueCode.custom,
61
+ path: ["convex", "deployment_url"],
62
+ message: "required when mode = 'convex'",
63
+ });
64
+ }
65
+ if (value.mode === "supabase" && !value.supabase?.url) {
66
+ ctx.addIssue({
67
+ code: z.ZodIssueCode.custom,
68
+ path: ["supabase", "url"],
69
+ message: "required when mode = 'supabase'",
70
+ });
71
+ }
72
+ });
73
+ const FQDN_RE = /^(?!-)[a-z0-9-]{1,63}(?<!-)(\.(?!-)[a-z0-9-]{1,63}(?<!-))+$/i;
74
+ export const domainSchema = z.object({
75
+ subdomain: z.string().regex(APP_NAME_RE).optional(),
76
+ custom: z.string().regex(FQDN_RE, "must be a valid FQDN (no protocol)").optional(),
77
+ });
78
+ export const resourcesSchema = z.object({
79
+ memory: z.enum(["256mb", "512mb", "1gb", "2gb"]).optional(),
80
+ cpu: z.number().min(0.25).max(2.0).optional(),
81
+ });
82
+ export const envSchema = z.record(z.string(), z.string());
83
+ export const devSchema = z.object({
84
+ ignore: z.array(z.string()).optional(),
85
+ debounce: z.number().int().min(100).max(10000).optional(),
86
+ auto_open: z.boolean().optional(),
87
+ });
88
+ export const requiredEnvSchema = z.record(z.string(), z.enum(["secret", "url", "string"]));
89
+ export const cronSchema = z.object({
90
+ schedule: z.string().min(1),
91
+ command: z.string().min(1),
92
+ });
93
+ export const addonsSchema = z.object({
94
+ pocketbase: z.object({ enabled: z.boolean().optional() }).optional(),
95
+ cron: z.object({ enabled: z.boolean().optional() }).optional(),
96
+ storage: z
97
+ .object({
98
+ mode: z.enum(["pocketbase", "volume"]).optional(),
99
+ max_size: z.string().optional(),
100
+ })
101
+ .optional(),
102
+ });
103
+ export const checkSchema = z.object({
104
+ path: z.string().min(1),
105
+ interval: z.number().int().min(1).optional(),
106
+ timeout: z.number().int().min(1).optional(),
107
+ initial_delay: z.number().int().min(0).optional(),
108
+ });
109
+ export const percherConfigSchema = z.object({
110
+ app: appSchema,
111
+ build: buildSchema.optional(),
112
+ web: webSchema.optional(),
113
+ data: dataSchema.optional(),
114
+ env: envSchema.optional(),
115
+ domain: domainSchema.optional(),
116
+ resources: resourcesSchema.optional(),
117
+ dev: devSchema.optional(),
118
+ required_env: requiredEnvSchema.optional(),
119
+ crons: z.record(z.string(), cronSchema).optional(),
120
+ addons: addonsSchema.optional(),
121
+ checks: z.record(z.string(), checkSchema).optional(),
122
+ });
123
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,GAAG,wBAAwB,CAAC;AAE7C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,KAAK,CAAC,WAAW,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AAC,QAAQ,EAAE;IAC5C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC3C,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CAClD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,GAAG,EAAE,SAAS;IACd,KAAK,EAAE,WAAW,CAAC,QAAQ,EAAE;IAC7B,GAAG,EAAE,SAAS,CAAC,QAAQ,EAAE;IACzB,IAAI,EAAE,UAAU,CAAC,QAAQ,EAAE;IAC3B,GAAG,EAAE,SAAS,CAAC,QAAQ,EAAE;IACzB,MAAM,EAAE,YAAY,CAAC,QAAQ,EAAE;IAC/B,SAAS,EAAE,eAAe,CAAC,QAAQ,EAAE;IACrC,GAAG,EAAE,SAAS,CAAC,QAAQ,EAAE;IACzB,YAAY,EAAE,iBAAiB,CAAC,QAAQ,EAAE;IAC1C,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,UAAU,CAAC,CAAC,QAAQ,EAAE;IAClD,MAAM,EAAE,YAAY,CAAC,QAAQ,EAAE;IAC/B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,WAAW,CAAC,CAAC,QAAQ,EAAE;CACrD,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { PercherConfig } from "./schema";
2
+ export declare function serialize(config: PercherConfig): string;
3
+ //# sourceMappingURL=serialize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../src/serialize.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,wBAAgB,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAGvD"}
@@ -0,0 +1,6 @@
1
+ import TOML from "@iarna/toml";
2
+ export function serialize(config) {
3
+ // @iarna/toml requires a JsonMap (plain object tree). PercherConfig is already one.
4
+ return TOML.stringify(config);
5
+ }
6
+ //# sourceMappingURL=serialize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serialize.js","sourceRoot":"","sources":["../src/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,aAAa,CAAC;AAG/B,MAAM,UAAU,SAAS,CAAC,MAAqB;IAC7C,oFAAoF;IACpF,OAAO,IAAI,CAAC,SAAS,CAAC,MAAiC,CAAC,CAAC;AAC3D,CAAC"}
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@percher/toml",
3
+ "version": "0.1.0",
4
+ "description": "percher.toml parser and validator for the Percher hosting platform",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "default": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": ["dist"],
16
+ "scripts": {
17
+ "build": "tsc -p tsconfig.json",
18
+ "test": "bun test",
19
+ "typecheck": "tsc --noEmit"
20
+ },
21
+ "dependencies": {
22
+ "@iarna/toml": "^2.2.5",
23
+ "zod": "^3.23.8"
24
+ },
25
+ "devDependencies": {
26
+ "@types/iarna__toml": "^2.0.5",
27
+ "bun-types": "^1.1.0"
28
+ },
29
+ "license": "MIT",
30
+ "author": "Mattias Malmborg",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/mattiasmalmborg/percher",
34
+ "directory": "packages/toml"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ }
39
+ }