@ethercorps/sveltekit-og 4.3.0-next.11 → 4.3.0-next.12

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/README.md CHANGED
@@ -4,7 +4,12 @@
4
4
 
5
5
  # SvelteKit Open Graph Image Generation
6
6
 
7
- Dynamically generate Open Graph images from an HTML+CSS template or Svelte component using fast and efficient conversion from HTML > SVG > PNG. Based on [Satori](https://github.com/vercel/satori#documentation). No headless browser required.
7
+ Dynamically generate Open Graph images from an HTML+CSS template or Svelte component. No headless browser required.
8
+
9
+ Pick the rendering engine that fits your needs:
10
+
11
+ - **Satori** (default) — HTML → SVG → PNG, based on [Satori](https://github.com/vercel/satori#documentation).
12
+ - **[Takumi](https://takumi.kane.tw)** — a Rust/WASM engine with more output formats (`webp`, `jpeg`, `ico`, `svg`, …) and a built-in font, available from `@ethercorps/sveltekit-og/takumi` (v4.3.0+).
8
13
 
9
14
  ## Table of Contents
10
15
 
@@ -35,6 +40,8 @@ pnpm install @ethercorps/sveltekit-og
35
40
 
36
41
  For detailed usage instructions, please see the [Getting Started](https://sveltekit-og.dev/docs/getting-started) section of our documentation.
37
42
 
43
+ Prefer the Takumi engine — more output formats and a built-in font? See the [Takumi Engine](https://sveltekit-og.dev/docs/usage/takumi) guide.
44
+
38
45
  ## Examples
39
46
 
40
47
  - **ImageResponse**: [_source_](/src/routes/+server.ts) · [_demo_](https://vercel.sveltekit-og.dev)
@@ -57,6 +64,7 @@ This project is licensed under the [MIT License](LICENSE).
57
64
  This project would not be possible without the following projects:
58
65
 
59
66
  - [Satori & @vercel/og](https://github.com/vercel/satori)
67
+ - [Takumi](https://takumi.kane.tw)
60
68
  - [Noto by Google Fonts](https://fonts.google.com/noto)
61
69
  - [fineshopdesign](https://github.com/fineshopdesign/cf-wasm)
62
70
 
@@ -15,7 +15,7 @@ function elementToHtml(element, props) {
15
15
  /** Render an HTML string or Svelte component to image bytes (or an svg string). */
16
16
  export async function createTakumiImage(element, options, props) {
17
17
  const log = createLogger(options.debug ?? false);
18
- const html = handleSync(() => elementToHtml(element, props), ErrorCodes.VNODE_CREATION_FAILED, "Failed to create HTML for Takumi");
18
+ const vNode = handleSync(() => elementToHtml(element, props), ErrorCodes.VNODE_CREATION_FAILED, "Failed to create HTML for Takumi");
19
19
  const renderer = await useTakumiRenderer(options.debug);
20
20
  if (options.fonts?.length) {
21
21
  const fonts = await resolveTakumiFonts(options.fonts);
@@ -25,7 +25,7 @@ export async function createTakumiImage(element, options, props) {
25
25
  const shared = { renderer: renderer, width, height, stylesheets, emoji };
26
26
  log.debug(`Rendering ${format.toUpperCase()} with Takumi`);
27
27
  if (format === "svg") {
28
- return handleAsync(() => renderSvg(html, shared), ErrorCodes.TAKUMI_RENDER_FAILED, "Failed to render SVG with Takumi");
28
+ return handleAsync(() => renderSvg(vNode, shared), ErrorCodes.TAKUMI_RENDER_FAILED, "Failed to render SVG with Takumi");
29
29
  }
30
- return handleAsync(() => takumiRender(html, { ...shared, format, quality }), ErrorCodes.TAKUMI_RENDER_FAILED, "Failed to render image with Takumi");
30
+ return handleAsync(() => takumiRender(vNode, { ...shared, format, quality }), ErrorCodes.TAKUMI_RENDER_FAILED, "Failed to render image with Takumi");
31
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ethercorps/sveltekit-og",
3
- "version": "4.3.0-next.11",
3
+ "version": "4.3.0-next.12",
4
4
  "license": "MIT",
5
5
  "homepage": "https://sveltekit-og.dev",
6
6
  "repository": "github:ethercorps/sveltekit-og",