nuxt-og-image 2.1.2 → 2.2.0
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/client/200.html +5 -5
- package/dist/client/404.html +5 -5
- package/dist/client/_nuxt/IconCSS.6eedc0b4.js +1 -0
- package/dist/client/_nuxt/IconCSS.8633f909.css +1 -0
- package/dist/client/_nuxt/{ImageLoader.682373c6.js → ImageLoader.6c3db107.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -0
- package/dist/client/_nuxt/builds/meta/15300c75-cff7-4383-aee7-45e80c06223e.json +1 -0
- package/dist/client/_nuxt/entry.067759ab.css +1 -0
- package/dist/client/_nuxt/entry.30bfbdb0.js +135 -0
- package/dist/client/_nuxt/{error-404.c5898c31.js → error-404.f53be311.js} +1 -1
- package/dist/client/_nuxt/{error-500.7511bfcd.js → error-500.95a4e96b.js} +1 -1
- package/dist/client/_nuxt/{index.67924976.js → index.b84d405c.js} +1 -1
- package/dist/client/_nuxt/{options.83fcf8c7.js → options.ba272791.js} +1 -1
- package/dist/client/_nuxt/{png.75a03ade.js → png.7ba30b3a.js} +1 -1
- package/dist/client/_nuxt/{shiki.a54774e2.js → shiki.92298145.js} +1 -1
- package/dist/client/_nuxt/{svg.567b4db0.js → svg.be478a83.js} +1 -1
- package/dist/client/_nuxt/{vnodes.13ebaf4c.js → vnodes.7d9fa602.js} +1 -1
- package/dist/client/index.html +5 -5
- package/dist/client/options/index.html +5 -5
- package/dist/client/png/index.html +5 -5
- package/dist/client/svg/index.html +5 -5
- package/dist/client/vnodes/index.html +5 -5
- package/dist/module.d.mts +5 -3
- package/dist/module.d.ts +5 -3
- package/dist/module.json +1 -1
- package/dist/module.mjs +8 -13
- package/dist/runtime/nitro/middleware/og.png.mjs +2 -2
- package/dist/runtime/nitro/renderers/browser.mjs +9 -5
- package/dist/runtime/nitro/renderers/satori/index.mjs +2 -2
- package/dist/runtime/public-assets-optional/resvg/resvg.wasm +0 -0
- package/dist/runtime/types.d.ts +4 -0
- package/package.json +18 -18
- package/dist/client/_nuxt/IconCSS.28ef6808.css +0 -1
- package/dist/client/_nuxt/IconCSS.5401fcdb.js +0 -1
- package/dist/client/_nuxt/entry.0d40575d.js +0 -135
- package/dist/client/_nuxt/entry.53a0fc2f.css +0 -1
package/dist/module.mjs
CHANGED
|
@@ -21,7 +21,7 @@ import { createBirpcGroup } from 'birpc';
|
|
|
21
21
|
import { stringify, parse } from 'flatted';
|
|
22
22
|
import { addDependency } from 'nypm';
|
|
23
23
|
|
|
24
|
-
const version = "2.
|
|
24
|
+
const version = "2.2.0";
|
|
25
25
|
|
|
26
26
|
async function createBrowser() {
|
|
27
27
|
if (process.dev || process.env.prerender) {
|
|
@@ -265,7 +265,8 @@ const cloudflare = {
|
|
|
265
265
|
const awsLambda = {
|
|
266
266
|
browser: false,
|
|
267
267
|
// too difficult to support
|
|
268
|
-
wasm: "inline"
|
|
268
|
+
wasm: "inline",
|
|
269
|
+
cssInline: false
|
|
269
270
|
};
|
|
270
271
|
const RuntimeCompatibility = {
|
|
271
272
|
"nitro-dev": {
|
|
@@ -276,7 +277,8 @@ const RuntimeCompatibility = {
|
|
|
276
277
|
browser: false,
|
|
277
278
|
satori: "yoga-wasm",
|
|
278
279
|
wasm: "inline",
|
|
279
|
-
png: "resvg-wasm"
|
|
280
|
+
png: "resvg-wasm",
|
|
281
|
+
cssInline: false
|
|
280
282
|
},
|
|
281
283
|
"aws-lambda": awsLambda,
|
|
282
284
|
"netlify": awsLambda,
|
|
@@ -321,7 +323,7 @@ function detectTarget(options = {}) {
|
|
|
321
323
|
function getNitroPreset(nuxt = useNuxt()) {
|
|
322
324
|
return process.env.NITRO_PRESET || nuxt.options.nitro.preset || detectTarget() || "node-server";
|
|
323
325
|
}
|
|
324
|
-
function getNitroProviderCompatibility(
|
|
326
|
+
function getNitroProviderCompatibility(overrides, nuxt = useNuxt()) {
|
|
325
327
|
let compatibility;
|
|
326
328
|
if (provider === "stackblitz") {
|
|
327
329
|
compatibility = RuntimeCompatibility.stackblitz;
|
|
@@ -337,8 +339,7 @@ function getNitroProviderCompatibility(defaults, nuxt = useNuxt()) {
|
|
|
337
339
|
return false;
|
|
338
340
|
compatibility = lookup || {};
|
|
339
341
|
}
|
|
340
|
-
compatibility = defu$1(compatibility,
|
|
341
|
-
compatibility.cssInline = compatibility.cssInline || (compatibility.node ? "node" : "mock");
|
|
342
|
+
compatibility = defu$1(overrides, compatibility, DefaultRuntimeCompatibility);
|
|
342
343
|
return compatibility;
|
|
343
344
|
}
|
|
344
345
|
function ensureDependencies(nuxt, dep) {
|
|
@@ -390,7 +391,6 @@ const module = defineNuxtModule({
|
|
|
390
391
|
cache: true,
|
|
391
392
|
cacheTtl: 24 * 60 * 60 * 1e3
|
|
392
393
|
},
|
|
393
|
-
runtimeCompatibility: DefaultRuntimeCompatibility,
|
|
394
394
|
componentDirs: ["OgImage", "OgImageTemplate"],
|
|
395
395
|
runtimeSatori: true,
|
|
396
396
|
runtimeBrowser: nuxt.options.dev,
|
|
@@ -410,7 +410,7 @@ const module = defineNuxtModule({
|
|
|
410
410
|
}
|
|
411
411
|
const { resolve } = createResolver(import.meta.url);
|
|
412
412
|
logger.debug("Using Nitro preset", getNitroPreset());
|
|
413
|
-
const nitroCompatibility = getNitroProviderCompatibility(config.runtimeCompatibility);
|
|
413
|
+
const nitroCompatibility = getNitroProviderCompatibility(config.runtimeCompatibility || {});
|
|
414
414
|
logger.debug("Nitro compatibility", nitroCompatibility);
|
|
415
415
|
const nitroTarget = process.env.NITRO_PRESET || nuxt.options.nitro.preset || provider;
|
|
416
416
|
if (!nitroCompatibility) {
|
|
@@ -580,11 +580,6 @@ declare module 'nitropack' {
|
|
|
580
580
|
if (nitroCompatibility.satori === "yoga-wasm")
|
|
581
581
|
customAssetDirs.push(resolve("./runtime/public-assets-optional/yoga"));
|
|
582
582
|
}
|
|
583
|
-
nuxt.hooks.hook("vite:extend", async ({ config: config2 }) => {
|
|
584
|
-
config2.optimizeDeps = config2.optimizeDeps || {};
|
|
585
|
-
config2.optimizeDeps.include = config2.optimizeDeps.include || [];
|
|
586
|
-
config2.optimizeDeps.include.push("css-inline");
|
|
587
|
-
});
|
|
588
583
|
nuxt.hooks.hook("modules:done", async () => {
|
|
589
584
|
nuxt.hooks.callHook("og-image:config", config);
|
|
590
585
|
nuxt.options.runtimeConfig["nuxt-og-image"] = {
|
|
@@ -52,8 +52,8 @@ export default defineEventHandler(async (e) => {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
if (png) {
|
|
55
|
-
if (cacheEnabled) {
|
|
56
|
-
setHeader(e, "Cache-Control",
|
|
55
|
+
if (cacheEnabled && options.cacheTtl) {
|
|
56
|
+
setHeader(e, "Cache-Control", `public, max-age=${options.cacheTtl}`);
|
|
57
57
|
} else {
|
|
58
58
|
setHeader(e, "Cache-Control", "no-cache, no-store, must-revalidate");
|
|
59
59
|
setHeader(e, "Pragma", "no-cache");
|
|
@@ -17,11 +17,15 @@ const BrowserRenderer = {
|
|
|
17
17
|
let res = null;
|
|
18
18
|
if (browser) {
|
|
19
19
|
try {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
if (options.html) {
|
|
21
|
+
res = await screenshot(browser, options);
|
|
22
|
+
} else {
|
|
23
|
+
res = await screenshot(browser, {
|
|
24
|
+
...options,
|
|
25
|
+
host: options.requestOrigin,
|
|
26
|
+
path: `/api/og-image-html?path=${options.path}`
|
|
27
|
+
});
|
|
28
|
+
}
|
|
25
29
|
} finally {
|
|
26
30
|
await browser.close();
|
|
27
31
|
}
|
|
@@ -23,13 +23,13 @@ const SatoriRenderer = {
|
|
|
23
23
|
return pngCreator(svg, options);
|
|
24
24
|
},
|
|
25
25
|
createVNode: async function createVNode(options) {
|
|
26
|
-
const html = await globalThis.$fetch("/api/og-image-html", {
|
|
26
|
+
const html = options.html || await globalThis.$fetch("/api/og-image-html", {
|
|
27
27
|
params: {
|
|
28
28
|
path: options.path,
|
|
29
29
|
options: JSON.stringify(options)
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
|
-
const body = html.match(/<body[^>]*>([\s\S]*)<\/body>/)?.[1] ||
|
|
32
|
+
const body = html.match(/<body[^>]*>([\s\S]*)<\/body>/)?.[1] || html;
|
|
33
33
|
const satoriTree = convertHtmlToSatori(body);
|
|
34
34
|
await walkSatoriTree(satoriTree, [
|
|
35
35
|
emojis,
|
|
Binary file
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -25,6 +25,10 @@ export interface ScreenshotOptions {
|
|
|
25
25
|
}
|
|
26
26
|
export interface OgImageOptions extends Partial<ScreenshotOptions> {
|
|
27
27
|
provider?: 'browser' | 'satori';
|
|
28
|
+
/**
|
|
29
|
+
* Provide a static HTML template to render the OG Image instead of a component.
|
|
30
|
+
*/
|
|
31
|
+
html?: string;
|
|
28
32
|
title?: string;
|
|
29
33
|
description?: string;
|
|
30
34
|
component?: string | null;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-og-image",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
5
|
-
"packageManager": "pnpm@8.9.
|
|
4
|
+
"version": "2.2.0",
|
|
5
|
+
"packageManager": "pnpm@8.9.2",
|
|
6
6
|
"description": "Enlightened OG Image generation for Nuxt.",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"funding": "https://github.com/sponsors/harlan-zw",
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@nuxt/kit": "^3.
|
|
31
|
-
"@resvg/resvg-js": "^2.
|
|
32
|
-
"@resvg/resvg-wasm": "^2.
|
|
33
|
-
"@types/fs-extra": "^11.0.
|
|
30
|
+
"@nuxt/kit": "^3.8.0",
|
|
31
|
+
"@resvg/resvg-js": "^2.6.0",
|
|
32
|
+
"@resvg/resvg-wasm": "^2.6.0",
|
|
33
|
+
"@types/fs-extra": "^11.0.3",
|
|
34
34
|
"birpc": "0.2.14",
|
|
35
35
|
"chalk": "^5.3.0",
|
|
36
36
|
"chrome-launcher": "^1.1.0",
|
|
37
37
|
"css-inline": "^0.11.0",
|
|
38
|
-
"defu": "^6.1.
|
|
38
|
+
"defu": "^6.1.3",
|
|
39
39
|
"execa": "^8.0.1",
|
|
40
40
|
"fast-glob": "^3.3.1",
|
|
41
41
|
"flatted": "^3.2.9",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"ofetch": "^1.3.3",
|
|
50
50
|
"ohash": "^1.1.3",
|
|
51
51
|
"pathe": "^1.1.1",
|
|
52
|
-
"playwright-core": "^1.
|
|
52
|
+
"playwright-core": "^1.39.0",
|
|
53
53
|
"radix3": "^1.1.0",
|
|
54
54
|
"satori": "0.10.9",
|
|
55
55
|
"satori-html": "^0.3.2",
|
|
@@ -64,19 +64,19 @@
|
|
|
64
64
|
"yoga-wasm-web": "^0.3.3"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@antfu/eslint-config": "1.0.0-beta.
|
|
68
|
-
"@nuxt/devtools": "1.0.0
|
|
67
|
+
"@antfu/eslint-config": "1.0.0-beta.29",
|
|
68
|
+
"@nuxt/devtools": "1.0.0",
|
|
69
69
|
"@nuxt/module-builder": "^0.5.2",
|
|
70
|
-
"@nuxt/test-utils": "3.
|
|
70
|
+
"@nuxt/test-utils": "3.8.0",
|
|
71
71
|
"@nuxtjs/eslint-config-typescript": "^12.1.0",
|
|
72
|
-
"@types/ws": "^8.5.
|
|
72
|
+
"@types/ws": "^8.5.8",
|
|
73
73
|
"bumpp": "^9.2.0",
|
|
74
|
-
"eslint": "8.
|
|
74
|
+
"eslint": "8.52.0",
|
|
75
75
|
"jest-image-snapshot": "^6.2.0",
|
|
76
|
-
"nuxt": "^3.
|
|
77
|
-
"nuxt-icon": "
|
|
78
|
-
"playwright": "^1.
|
|
79
|
-
"sass": "^1.69.
|
|
76
|
+
"nuxt": "^3.8.0",
|
|
77
|
+
"nuxt-icon": "0.5.0",
|
|
78
|
+
"playwright": "^1.39.0",
|
|
79
|
+
"sass": "^1.69.5",
|
|
80
80
|
"vitest": "^0.34.6"
|
|
81
81
|
},
|
|
82
82
|
"scripts": {
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"lint": "eslint . --fix",
|
|
87
87
|
"dev": "nuxi dev .playground",
|
|
88
88
|
"dev:build": "nuxi build .playground",
|
|
89
|
-
"dev:prepare": "nuxt-module-build --stub && nuxi prepare .playground",
|
|
89
|
+
"dev:prepare": "nuxt-module-build build --stub && nuxi prepare .playground",
|
|
90
90
|
"release": "bumpp package.json --commit --push --tag",
|
|
91
91
|
"test": "vitest build"
|
|
92
92
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
span[data-v-ab9ed42e]{background-color:currentColor;display:inline-block;-webkit-mask-image:var(--7bad2e10);mask-image:var(--7bad2e10);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;vertical-align:middle}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as l,H as _,I as d,n as o,o as m,c as f,s as S,_ as g}from"./entry.0d40575d.js";const x=l({__name:"IconCSS",props:{name:{type:String,required:!0},size:{type:String,default:""}},setup(r){const n=r;_(e=>({"7bad2e10":u.value}));const s=d(),p=o(()=>{var e;return((((e=s.nuxtIcon)==null?void 0:e.aliases)||{})[n.name]||n.name).replace(/^i-/,"")}),u=o(()=>`url('https://api.iconify.design/${p.value.replace(":","/")}.svg')`),a=o(()=>{var t,c,i;if(!n.size&&typeof((t=s.nuxtIcon)==null?void 0:t.size)=="boolean"&&!((c=s.nuxtIcon)!=null&&c.size))return;const e=n.size||((i=s.nuxtIcon)==null?void 0:i.size)||"1em";return String(Number(e))===e?`${e}px`:e});return(e,t)=>(m(),f("span",{style:S({width:a.value,height:a.value})},null,4))}});const z=g(x,[["__scopeId","data-v-ab9ed42e"]]);export{z as default};
|