-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.d.ts
82 lines (56 loc) · 1.75 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import { SatoriOptions } from 'satori';
import { FormatEnum, Sharp } from 'sharp';
import TemplateConfig from '@11ty/eleventy/src/TemplateConfig';
export interface OgImage {
inputPath: string;
data: Record<string, any>;
options: EleventyPluginOgImageMergedOptions;
templateConfig: typeof TemplateConfig;
results: {
html?: string;
svg?: string;
pngBuffer?: Buffer;
};
html(): Promise<string>;
svg(): Promise<string>;
pngBuffer(): Promise<Buffer>;
render(): Promise<Sharp>;
hash(): Promise<string>;
outputFileSlug(): Promise<string>;
outputFileName(): Promise<string>;
outputFilePath(): Promise<string>;
outputUrl(): Promise<string>;
cacheFilePath(): Promise<string>;
shortcodeOutput(): Promise<string>;
previewFilePath(): string;
previewHtml(): Promise<string>;
}
type DirectoriesConfig = {
input: string;
includes: string;
data: string;
layouts?: string;
output: string;
};
type SharpFormatOptions = Parameters<Sharp['toFormat']>[1];
type EleventyPluginOgImageOptions = {
inputFileGlob?: string;
hashLength?: number;
outputFileExtension?: keyof FormatEnum;
outputDir?: string;
previewDir?: string;
urlPath?: string;
outputFileSlug?(ogImage: OgImage): Promise<string>;
shortcodeOutput?(ogImage: OgImage): Promise<string>;
OgImage?: OgImage;
satoriOptions?: Partial<SatoriOptions>;
sharpOptions?: SharpFormatOptions;
};
type EleventyPluginOgImageMergedOptions = Omit<
Required<EleventyPluginOgImageOptions>,
'OgImage' | 'satoriOptions' | 'sharpOptions'
> &
Pick<EleventyPluginOgImageOptions, 'sharpOptions'> & {
satoriOptions: SatoriOptions & { width: number; height: number };
};
export { EleventyPluginOgImageOptions, EleventyPluginOgImageMergedOptions, DirectoriesConfig };