@ewanc26/og 0.1.4 → 0.1.6
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/chunk-CM6746HS.js +360 -0
- package/dist/chunk-CM6746HS.js.map +1 -0
- package/dist/index.cjs +205 -153
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -12
- package/dist/index.d.ts +7 -12
- package/dist/index.js +27 -75
- package/dist/index.js.map +1 -1
- package/dist/templates/index.cjs +179 -77
- package/dist/templates/index.cjs.map +1 -1
- package/dist/templates/index.d.cts +208 -85
- package/dist/templates/index.d.ts +208 -85
- package/dist/templates/index.js +1 -1
- package/package.json +63 -62
- package/src/endpoint.ts +4 -2
- package/src/fonts-base64.ts +7 -0
- package/src/fonts.ts +31 -109
- package/src/index.ts +1 -1
- package/src/templates/blog.ts +70 -36
- package/src/templates/default.ts +67 -33
- package/src/templates/profile.ts +40 -6
- package/dist/chunk-EPPJ2HBS.js +0 -258
- package/dist/chunk-EPPJ2HBS.js.map +0 -1
- package/dist/fonts/Inter-Bold.ttf +0 -0
- package/dist/fonts/Inter-Regular.ttf +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -51,23 +51,19 @@ declare function generateCircleNoiseDataUrl(options: CircleNoiseOptions): string
|
|
|
51
51
|
/**
|
|
52
52
|
* @ewanc26/og fonts
|
|
53
53
|
*
|
|
54
|
-
* Font loading utilities.
|
|
54
|
+
* Font loading utilities. Fonts are inlined as base64 at build time so this
|
|
55
|
+
* works in serverless environments (Vercel, Netlify, etc.) without any
|
|
56
|
+
* filesystem access to node_modules.
|
|
55
57
|
*/
|
|
56
58
|
|
|
57
|
-
/**
|
|
58
|
-
* Resolve bundled font paths. Uses getters to defer resolution until runtime.
|
|
59
|
-
*/
|
|
60
|
-
declare const BUNDLED_FONTS: {
|
|
61
|
-
readonly heading: string;
|
|
62
|
-
readonly body: string;
|
|
63
|
-
};
|
|
64
59
|
interface LoadedFonts {
|
|
65
60
|
heading: ArrayBuffer;
|
|
66
61
|
body: ArrayBuffer;
|
|
67
62
|
}
|
|
68
63
|
/**
|
|
69
|
-
* Load fonts from config, falling back to bundled
|
|
70
|
-
*
|
|
64
|
+
* Load fonts from config, falling back to the bundled Inter font.
|
|
65
|
+
* If custom paths are provided they are loaded from disk; otherwise the
|
|
66
|
+
* pre-inlined base64 data is used (safe in any serverless runtime).
|
|
71
67
|
*/
|
|
72
68
|
declare function loadFonts(config?: OgFontConfig): Promise<LoadedFonts>;
|
|
73
69
|
type SatoriFontConfig = {
|
|
@@ -78,7 +74,6 @@ type SatoriFontConfig = {
|
|
|
78
74
|
};
|
|
79
75
|
/**
|
|
80
76
|
* Create Satori-compatible font config from loaded fonts.
|
|
81
|
-
* Uses Inter font family with weight 700 for headings and 400 for body.
|
|
82
77
|
*/
|
|
83
78
|
declare function createSatoriFonts(fonts: LoadedFonts): SatoriFontConfig[];
|
|
84
79
|
|
|
@@ -132,4 +127,4 @@ declare function svgToPngDataUrl(svg: string, options?: SvgToPngOptions): string
|
|
|
132
127
|
*/
|
|
133
128
|
declare function svgToPngResponse(svg: string, options?: SvgToPngOptions, cacheMaxAge?: number): Response;
|
|
134
129
|
|
|
135
|
-
export {
|
|
130
|
+
export { OG_HEIGHT, OG_WIDTH, OgEndpointOptions, OgFontConfig, OgGenerateOptions, OgNoiseConfig, type SvgToPngOptions, createOgEndpoint, createSatoriFonts, generateCircleNoiseDataUrl, generateNoiseDataUrl, generateOgImage, generateOgImageDataUrl, generateOgResponse, loadFonts, svgToPng, svgToPngDataUrl, svgToPngResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -51,23 +51,19 @@ declare function generateCircleNoiseDataUrl(options: CircleNoiseOptions): string
|
|
|
51
51
|
/**
|
|
52
52
|
* @ewanc26/og fonts
|
|
53
53
|
*
|
|
54
|
-
* Font loading utilities.
|
|
54
|
+
* Font loading utilities. Fonts are inlined as base64 at build time so this
|
|
55
|
+
* works in serverless environments (Vercel, Netlify, etc.) without any
|
|
56
|
+
* filesystem access to node_modules.
|
|
55
57
|
*/
|
|
56
58
|
|
|
57
|
-
/**
|
|
58
|
-
* Resolve bundled font paths. Uses getters to defer resolution until runtime.
|
|
59
|
-
*/
|
|
60
|
-
declare const BUNDLED_FONTS: {
|
|
61
|
-
readonly heading: string;
|
|
62
|
-
readonly body: string;
|
|
63
|
-
};
|
|
64
59
|
interface LoadedFonts {
|
|
65
60
|
heading: ArrayBuffer;
|
|
66
61
|
body: ArrayBuffer;
|
|
67
62
|
}
|
|
68
63
|
/**
|
|
69
|
-
* Load fonts from config, falling back to bundled
|
|
70
|
-
*
|
|
64
|
+
* Load fonts from config, falling back to the bundled Inter font.
|
|
65
|
+
* If custom paths are provided they are loaded from disk; otherwise the
|
|
66
|
+
* pre-inlined base64 data is used (safe in any serverless runtime).
|
|
71
67
|
*/
|
|
72
68
|
declare function loadFonts(config?: OgFontConfig): Promise<LoadedFonts>;
|
|
73
69
|
type SatoriFontConfig = {
|
|
@@ -78,7 +74,6 @@ type SatoriFontConfig = {
|
|
|
78
74
|
};
|
|
79
75
|
/**
|
|
80
76
|
* Create Satori-compatible font config from loaded fonts.
|
|
81
|
-
* Uses Inter font family with weight 700 for headings and 400 for body.
|
|
82
77
|
*/
|
|
83
78
|
declare function createSatoriFonts(fonts: LoadedFonts): SatoriFontConfig[];
|
|
84
79
|
|
|
@@ -132,4 +127,4 @@ declare function svgToPngDataUrl(svg: string, options?: SvgToPngOptions): string
|
|
|
132
127
|
*/
|
|
133
128
|
declare function svgToPngResponse(svg: string, options?: SvgToPngOptions, cacheMaxAge?: number): Response;
|
|
134
129
|
|
|
135
|
-
export {
|
|
130
|
+
export { OG_HEIGHT, OG_WIDTH, OgEndpointOptions, OgFontConfig, OgGenerateOptions, OgNoiseConfig, type SvgToPngOptions, createOgEndpoint, createSatoriFonts, generateCircleNoiseDataUrl, generateNoiseDataUrl, generateOgImage, generateOgImageDataUrl, generateOgResponse, loadFonts, svgToPng, svgToPngDataUrl, svgToPngResponse };
|