@growth-labs/opengraph 0.3.0 → 0.4.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/options.d.ts +10 -73
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +3 -5
- package/dist/options.js.map +1 -1
- package/package.json +5 -5
- package/src/options.ts +3 -5
package/dist/options.d.ts
CHANGED
|
@@ -10,87 +10,24 @@ export declare const opengraphOptionsSchema: z.ZodObject<{
|
|
|
10
10
|
accent: z.ZodOptional<z.ZodString>;
|
|
11
11
|
background: z.ZodOptional<z.ZodString>;
|
|
12
12
|
text: z.ZodOptional<z.ZodString>;
|
|
13
|
-
},
|
|
14
|
-
primary: string;
|
|
15
|
-
accent?: string | undefined;
|
|
16
|
-
background?: string | undefined;
|
|
17
|
-
text?: string | undefined;
|
|
18
|
-
}, {
|
|
19
|
-
primary: string;
|
|
20
|
-
accent?: string | undefined;
|
|
21
|
-
background?: string | undefined;
|
|
22
|
-
text?: string | undefined;
|
|
23
|
-
}>>;
|
|
13
|
+
}, z.core.$strip>>;
|
|
24
14
|
logoUrl: z.ZodOptional<z.ZodString>;
|
|
25
15
|
defaultSubtitle: z.ZodOptional<z.ZodString>;
|
|
26
16
|
fontFamily: z.ZodDefault<z.ZodString>;
|
|
27
17
|
fontWeight: z.ZodDefault<z.ZodString>;
|
|
28
|
-
template: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny],
|
|
29
|
-
route: z.
|
|
18
|
+
template: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodAny], null>, z.ZodString>>;
|
|
19
|
+
route: z.ZodPrefault<z.ZodObject<{
|
|
30
20
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
31
21
|
regenerateSecret: z.ZodOptional<z.ZodString>;
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
regenerateSecret?: string | undefined;
|
|
35
|
-
}, {
|
|
36
|
-
enabled?: boolean | undefined;
|
|
37
|
-
regenerateSecret?: string | undefined;
|
|
38
|
-
}>>;
|
|
39
|
-
contentProvider: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodString, z.ZodAny], z.ZodUnknown>, z.ZodPromise<z.ZodNullable<z.ZodAny>>>>;
|
|
22
|
+
}, z.core.$strip>>;
|
|
23
|
+
contentProvider: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodString, z.ZodAny], null>, z.ZodPromise<z.ZodNullable<z.ZodAny>>>>;
|
|
40
24
|
quality: z.ZodDefault<z.ZodNumber>;
|
|
41
|
-
format: z.ZodDefault<z.ZodEnum<
|
|
25
|
+
format: z.ZodDefault<z.ZodEnum<{
|
|
26
|
+
png: "png";
|
|
27
|
+
jpeg: "jpeg";
|
|
28
|
+
}>>;
|
|
42
29
|
timeout: z.ZodDefault<z.ZodNumber>;
|
|
43
|
-
},
|
|
44
|
-
publicDomain: string;
|
|
45
|
-
r2Binding: string;
|
|
46
|
-
r2Prefix: string;
|
|
47
|
-
browserBinding: string;
|
|
48
|
-
fontFamily: string;
|
|
49
|
-
fontWeight: string;
|
|
50
|
-
route: {
|
|
51
|
-
enabled: boolean;
|
|
52
|
-
regenerateSecret?: string | undefined;
|
|
53
|
-
};
|
|
54
|
-
quality: number;
|
|
55
|
-
format: "png" | "jpeg";
|
|
56
|
-
timeout: number;
|
|
57
|
-
brandName?: string | undefined;
|
|
58
|
-
brandColors?: {
|
|
59
|
-
primary: string;
|
|
60
|
-
accent?: string | undefined;
|
|
61
|
-
background?: string | undefined;
|
|
62
|
-
text?: string | undefined;
|
|
63
|
-
} | undefined;
|
|
64
|
-
logoUrl?: string | undefined;
|
|
65
|
-
defaultSubtitle?: string | undefined;
|
|
66
|
-
template?: ((args_0: any, ...args: unknown[]) => string) | undefined;
|
|
67
|
-
contentProvider?: ((args_0: string, args_1: any, ...args: unknown[]) => Promise<any>) | undefined;
|
|
68
|
-
}, {
|
|
69
|
-
publicDomain: string;
|
|
70
|
-
r2Binding?: string | undefined;
|
|
71
|
-
r2Prefix?: string | undefined;
|
|
72
|
-
browserBinding?: string | undefined;
|
|
73
|
-
brandName?: string | undefined;
|
|
74
|
-
brandColors?: {
|
|
75
|
-
primary: string;
|
|
76
|
-
accent?: string | undefined;
|
|
77
|
-
background?: string | undefined;
|
|
78
|
-
text?: string | undefined;
|
|
79
|
-
} | undefined;
|
|
80
|
-
logoUrl?: string | undefined;
|
|
81
|
-
defaultSubtitle?: string | undefined;
|
|
82
|
-
fontFamily?: string | undefined;
|
|
83
|
-
fontWeight?: string | undefined;
|
|
84
|
-
template?: ((args_0: any, ...args: unknown[]) => string) | undefined;
|
|
85
|
-
route?: {
|
|
86
|
-
enabled?: boolean | undefined;
|
|
87
|
-
regenerateSecret?: string | undefined;
|
|
88
|
-
} | undefined;
|
|
89
|
-
contentProvider?: ((args_0: string, args_1: any, ...args: unknown[]) => Promise<any>) | undefined;
|
|
90
|
-
quality?: number | undefined;
|
|
91
|
-
format?: "png" | "jpeg" | undefined;
|
|
92
|
-
timeout?: number | undefined;
|
|
93
|
-
}>;
|
|
30
|
+
}, z.core.$strip>;
|
|
94
31
|
export type OpengraphOptions = z.input<typeof opengraphOptionsSchema>;
|
|
95
32
|
export type ResolvedOpengraphOptions = z.output<typeof opengraphOptionsSchema>;
|
|
96
33
|
//# sourceMappingURL=options.d.ts.map
|
package/dist/options.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AASvB,eAAO,MAAM,sBAAsB
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AASvB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuCjC,CAAA;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AACrE,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAA"}
|
package/dist/options.js
CHANGED
|
@@ -21,19 +21,17 @@ export const opengraphOptionsSchema = z.object({
|
|
|
21
21
|
fontFamily: z.string().default('Inter'),
|
|
22
22
|
fontWeight: z.string().default('600'),
|
|
23
23
|
// Custom template
|
|
24
|
-
template: z.function(
|
|
24
|
+
template: z.function({ input: [z.any()], output: z.string() }).optional(),
|
|
25
25
|
// Route
|
|
26
26
|
route: z
|
|
27
27
|
.object({
|
|
28
28
|
enabled: z.boolean().default(true),
|
|
29
29
|
regenerateSecret: z.string().optional(),
|
|
30
30
|
})
|
|
31
|
-
.
|
|
31
|
+
.prefault({}),
|
|
32
32
|
// Content provider (for on-demand generation)
|
|
33
33
|
contentProvider: z
|
|
34
|
-
.function()
|
|
35
|
-
.args(z.string(), z.any())
|
|
36
|
-
.returns(z.promise(z.any().nullable()))
|
|
34
|
+
.function({ input: [z.string(), z.any()], output: z.promise(z.any().nullable()) })
|
|
37
35
|
.optional(),
|
|
38
36
|
// Generation
|
|
39
37
|
quality: z.number().min(1).max(100).default(90),
|
package/dist/options.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,E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CAA8C;IAC9C,eAAe,EAAE,CAAC;SAChB,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC;SACjF,QAAQ,EAAE;IAEZ,aAAa;IACb,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IAC/C,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAC9C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;CACnC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@growth-labs/opengraph",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -37,16 +37,16 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@cloudflare/puppeteer": "^1.0.4",
|
|
40
|
-
"zod": "^
|
|
40
|
+
"zod": "^4.6.7"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"astro": "^6.1.10"
|
|
43
|
+
"astro": "^6.1.10 || ^7.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@cloudflare/workers-types": "^4.20241230.0",
|
|
47
|
-
"astro": "
|
|
47
|
+
"astro": "7.3.1",
|
|
48
48
|
"typescript": "^5.7.0",
|
|
49
|
-
"vite": "
|
|
49
|
+
"vite": "8.0.16",
|
|
50
50
|
"vitest": "^4.1.8"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
package/src/options.ts
CHANGED
|
@@ -27,7 +27,7 @@ export const opengraphOptionsSchema = z.object({
|
|
|
27
27
|
fontWeight: z.string().default('600'),
|
|
28
28
|
|
|
29
29
|
// Custom template
|
|
30
|
-
template: z.function(
|
|
30
|
+
template: z.function({ input: [z.any()], output: z.string() }).optional(),
|
|
31
31
|
|
|
32
32
|
// Route
|
|
33
33
|
route: z
|
|
@@ -35,13 +35,11 @@ export const opengraphOptionsSchema = z.object({
|
|
|
35
35
|
enabled: z.boolean().default(true),
|
|
36
36
|
regenerateSecret: z.string().optional(),
|
|
37
37
|
})
|
|
38
|
-
.
|
|
38
|
+
.prefault({}),
|
|
39
39
|
|
|
40
40
|
// Content provider (for on-demand generation)
|
|
41
41
|
contentProvider: z
|
|
42
|
-
.function()
|
|
43
|
-
.args(z.string(), z.any())
|
|
44
|
-
.returns(z.promise(z.any().nullable()))
|
|
42
|
+
.function({ input: [z.string(), z.any()], output: z.promise(z.any().nullable()) })
|
|
45
43
|
.optional(),
|
|
46
44
|
|
|
47
45
|
// Generation
|