@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/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. Bundles Inter font by default.
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 fonts.
70
- * In serverless environments, falls back to fetching from upstream CDN.
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 { BUNDLED_FONTS, OG_HEIGHT, OG_WIDTH, OgEndpointOptions, OgFontConfig, OgGenerateOptions, OgNoiseConfig, type SvgToPngOptions, createOgEndpoint, createSatoriFonts, generateCircleNoiseDataUrl, generateNoiseDataUrl, generateOgImage, generateOgImageDataUrl, generateOgResponse, loadFonts, svgToPng, svgToPngDataUrl, svgToPngResponse };
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. Bundles Inter font by default.
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 fonts.
70
- * In serverless environments, falls back to fetching from upstream CDN.
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 { BUNDLED_FONTS, OG_HEIGHT, OG_WIDTH, OgEndpointOptions, OgFontConfig, OgGenerateOptions, OgNoiseConfig, type SvgToPngOptions, createOgEndpoint, createSatoriFonts, generateCircleNoiseDataUrl, generateNoiseDataUrl, generateOgImage, generateOgImageDataUrl, generateOgResponse, loadFonts, svgToPng, svgToPngDataUrl, svgToPngResponse };
130
+ export { OG_HEIGHT, OG_WIDTH, OgEndpointOptions, OgFontConfig, OgGenerateOptions, OgNoiseConfig, type SvgToPngOptions, createOgEndpoint, createSatoriFonts, generateCircleNoiseDataUrl, generateNoiseDataUrl, generateOgImage, generateOgImageDataUrl, generateOgResponse, loadFonts, svgToPng, svgToPngDataUrl, svgToPngResponse };