nuxt-og-image 2.0.0-beta.38 → 2.0.0-beta.40

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
@@ -52,16 +52,15 @@ Both Satori and Browser will work in Node based environments. Prerendering is fu
52
52
 
53
53
  When you want to generate dynamic images at runtime there are certain Nitro runtime limitations.
54
54
 
55
- | Provider | Satori | Browser |
56
- |---------------------------------------------------------------------------------|--------|---------|
57
- | Node | ✅ | ✅ |
58
- | [Vercel](https://nuxt-og-image-playground.vercel.app/) | ✅ | Soon |
59
- | [Vercel Edge](https://nuxt-og-image-playground-gkdt.vercel.app/) | ✅ | ❌ |
60
- | Cloudflare Workers (requires paid) | ✅ | ❌ |
61
- | [Cloudflare Pages](https://nuxt-og-image-playground.pages.dev/) | | ❌ |
62
- | [Netlify](https://nuxt-og-image-playground-netlify.netlify.app/) | Soon | ❌ |
63
- | [Netlify Edge](https://nuxt-og-image-playground-netlify-edge.netlify.app/) | Soon | ❌ |
64
- | [StackBlitz](https://stackblitz.com/edit/nuxt-starter-pxs3wk?file=package.json) | ✅ | ❌ |
55
+ | Provider | Satori | Browser |
56
+ |---------------------------------------------------------------------------------|----------|---------|
57
+ | Node | ✅ | ✅ |
58
+ | [Vercel](https://nuxt-og-image-playground.vercel.app/) | ✅ | |
59
+ | [Vercel Edge](https://nuxt-og-image-playground-gkdt.vercel.app/) | ✅ | ❌ |
60
+ | [Cloudflare Pages](https://nuxt-og-image-playground.pages.dev/) | ✅ | ❌ |
61
+ | [Netlify](https://nuxt-og-image-playground-netlify.netlify.app/) | Soon | ❌ |
62
+ | [Netlify Edge](https://nuxt-og-image-playground-netlify-edge.netlify.app/) | ❌ (Soon) | ❌ |
63
+ | [StackBlitz](https://stackblitz.com/edit/nuxt-starter-pxs3wk?file=package.json) | | ❌ |
65
64
 
66
65
  Other providers are yet to be tested. Please create an issue if your nitro preset is not listed.
67
66
 
package/dist/module.json CHANGED
@@ -5,5 +5,5 @@
5
5
  "bridge": false
6
6
  },
7
7
  "configKey": "ogImage",
8
- "version": "2.0.0-beta.38"
8
+ "version": "2.0.0-beta.40"
9
9
  }
package/dist/module.mjs CHANGED
@@ -235,7 +235,7 @@ const DefaultRuntimeCompatibility = {
235
235
  browser: "playwright",
236
236
  satori: "default",
237
237
  wasm: "fetch",
238
- png: "resvg"
238
+ png: "resvg-node"
239
239
  };
240
240
  const RuntimeCompatibility = {
241
241
  "nitro-dev": {
@@ -245,30 +245,35 @@ const RuntimeCompatibility = {
245
245
  "stackblitz": {
246
246
  browser: false,
247
247
  satori: "yoga-wasm",
248
- wasm: "inline"
248
+ wasm: "inline",
249
+ png: "resvg-wasm"
249
250
  },
250
251
  "netlify": {
251
252
  browser: "lambda",
252
253
  wasm: "inline"
253
254
  },
254
255
  "netlify-edge": {
255
- wasm: "inline"
256
+ wasm: "inline",
257
+ png: "resvg-wasm"
256
258
  },
257
259
  "vercel": {
258
- browser: "lambda"
260
+ // exceeds 50mb limit
261
+ browser: false
262
+ },
263
+ "vercel-edge": {
264
+ browser: false,
265
+ wasm: "import",
266
+ wasmImportQuery: "?module",
267
+ png: "resvg-wasm"
259
268
  },
260
269
  "cloudflare-pages": {
261
270
  browser: false,
262
- wasm: "import"
271
+ wasm: "import",
272
+ png: "resvg-wasm"
263
273
  },
264
274
  "cloudflare": {
265
275
  browser: false,
266
276
  wasm: "import"
267
- },
268
- "vercel-edge": {
269
- browser: false,
270
- wasm: "import",
271
- wasmImportQuery: "?module"
272
277
  }
273
278
  };
274
279
 
@@ -469,7 +474,7 @@ export {}
469
474
  if (config.runtimeSatori) {
470
475
  if (config.fonts.includes("Inter:400"))
471
476
  customAssetDirs.push(resolve("./runtime/public-assets-optional/inter-font"));
472
- if (nitroCompatibility.png === "resvg" && nitroCompatibility.wasm === "fetch")
477
+ if (nitroCompatibility.png === "resvg-wasm" && nitroCompatibility.wasm === "fetch")
473
478
  customAssetDirs.push(resolve("./runtime/public-assets-optional/resvg"));
474
479
  else if (nitroCompatibility.png === "svg2png" && nitroCompatibility.wasm === "fetch")
475
480
  customAssetDirs.push(resolve("./runtime/public-assets-optional/svg2png"));
@@ -570,7 +575,7 @@ export async function useProvider(provider) {
570
575
  contents = contents.replace(wasm.placeholder, `import("./${wasm.file}${nitroCompatibility.wasmImportQuery || ""}").then(m => m.default || m)`);
571
576
  await copy(resolve(`./runtime/public-assets-optional/${wasm.path}`), resolve(dirname(path), wasm.file));
572
577
  } else if (nitroCompatibility.wasm === "inline") {
573
- const wasmBuffer = await readFile(resolve(`./runtime/public-assets-optional/${wasm.path}`), "base64");
578
+ const wasmBuffer = await readFile(resolve(`./runtime/public-assets-optional/${wasm.path}`));
574
579
  contents = contents.replace(wasm.placeholder, `Buffer.from("${wasmBuffer}", "base64")`);
575
580
  }
576
581
  updated = true;
@@ -0,0 +1,5 @@
1
+ /// <reference types="node" />
2
+ import { ResvgRenderOptions } from '@resvg/resvg-js';
3
+ export default function (svg: string, options: ResvgRenderOptions & {
4
+ baseUrl: string;
5
+ }): Promise<Buffer>;
@@ -0,0 +1,6 @@
1
+ import { Resvg } from "@resvg/resvg-js";
2
+ export default async function(svg, options) {
3
+ const resvgJS = new Resvg(svg, {});
4
+ const pngData = resvgJS.render();
5
+ return pngData.asPng();
6
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-og-image",
3
3
  "type": "module",
4
- "version": "2.0.0-beta.38",
4
+ "version": "2.0.0-beta.40",
5
5
  "packageManager": "pnpm@8.1.0",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -27,6 +27,7 @@
27
27
  ],
28
28
  "dependencies": {
29
29
  "@nuxt/kit": "^3.4.3",
30
+ "@resvg/resvg-js": "^2.4.1",
30
31
  "@resvg/resvg-wasm": "^2.4.1",
31
32
  "@types/fs-extra": "^11.0.1",
32
33
  "birpc": "^0.2.11",