nuxt-og-image 3.0.0-beta.40 → 3.0.0-beta.41
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 +4 -4
- package/dist/client/404.html +4 -4
- package/dist/client/_nuxt/{IconCSS.783314f6.js → IconCSS.aa1d279a.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/fa0d9e15-6d49-41d0-bdff-8eca0446edd7.json +1 -0
- package/dist/client/_nuxt/{entry.e11cb5fa.js → entry.16c420c7.js} +3 -3
- package/dist/client/_nuxt/{error-404.c187917f.js → error-404.26fce296.js} +1 -1
- package/dist/client/_nuxt/{error-500.a1ce074a.js → error-500.89729d99.js} +1 -1
- package/dist/client/index.html +4 -4
- package/dist/module.d.mts +1 -1
- package/dist/module.d.ts +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +20 -4
- package/dist/runtime/cache.d.ts +2 -2
- package/dist/runtime/core/font/fetch.d.ts +2 -2
- package/dist/runtime/core/html/applyEmojis.d.ts +2 -2
- package/dist/runtime/core/html/applyInlineCss.d.ts +2 -2
- package/dist/runtime/core/html/devIframeTemplate.d.ts +2 -2
- package/dist/runtime/core/html/fetchIsland.d.ts +2 -2
- package/dist/runtime/core/renderers/chromium/screenshot.d.ts +2 -2
- package/dist/runtime/core/renderers/satori/fonts.d.ts +2 -2
- package/dist/runtime/core/renderers/satori/index.d.ts +2 -2
- package/dist/runtime/core/renderers/satori/index.mjs +1 -0
- package/dist/runtime/core/renderers/satori/utils.d.ts +2 -2
- package/dist/runtime/core/renderers/satori/vnodes.d.ts +2 -2
- package/dist/runtime/core/utils/resolveRendererContext.d.ts +2 -2
- package/dist/runtime/core/utils/resolveRendererContext.mjs +6 -3
- package/dist/runtime/types.d.ts +6 -4
- package/package.json +1 -1
- package/dist/client/_nuxt/builds/meta/88cd699e-6f5a-4788-a59e-8158fb29f04b.json +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as a,u as n,o as r,c as l,a as e,t as s,b as d,w as c,d as p,e as f,p as x,f as h}from"./entry.
|
|
1
|
+
import{_ as a,u as n,o as r,c as l,a as e,t as s,b as d,w as c,d as p,e as f,p as x,f as h}from"./entry.16c420c7.js";const m=t=>(x("data-v-05a2b8a3"),t=t(),h(),t),u={class:"font-sans antialiased bg-white dark:bg-black text-black dark:text-white grid min-h-screen place-content-center overflow-hidden"},g=m(()=>e("div",{class:"fixed left-0 right-0 spotlight z-10"},null,-1)),b={class:"max-w-520px text-center z-20"},_=["textContent"],w=["textContent"],y={class:"w-full flex items-center justify-center"},S={__name:"error-404",props:{appName:{type:String,default:"Nuxt"},version:{type:String,default:""},statusCode:{type:Number,default:404},statusMessage:{type:String,default:"Not Found"},description:{type:String,default:"Sorry, the page you are looking for could not be found."},backHome:{type:String,default:"Go back home"}},setup(t){const o=t;return n({title:`${o.statusCode} - ${o.statusMessage} | ${o.appName}`,script:[],style:[{children:'*,:before,:after{-webkit-box-sizing:border-box;box-sizing:border-box;border-width:0;border-style:solid;border-color:#e0e0e0}*{--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(14, 165, 233, .5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000}:root{-moz-tab-size:4;-o-tab-size:4;tab-size:4}a{color:inherit;text-decoration:inherit}body{margin:0;font-family:inherit;line-height:inherit}html{-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";line-height:1.5}h1,p{margin:0}h1{font-size:inherit;font-weight:inherit}'}]}),(k,v)=>{const i=f;return r(),l("div",u,[g,e("div",b,[e("h1",{class:"text-8xl sm:text-10xl font-medium mb-8",textContent:s(t.statusCode)},null,8,_),e("p",{class:"text-xl px-8 sm:px-0 sm:text-4xl font-light mb-16 leading-tight",textContent:s(t.description)},null,8,w),e("div",y,[d(i,{to:"/",class:"gradient-border text-md sm:text-xl py-2 px-4 sm:py-3 sm:px-6 cursor-pointer"},{default:c(()=>[p(s(t.backHome),1)]),_:1})])])])}}},z=a(S,[["__scopeId","data-v-05a2b8a3"]]);export{z as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as i,u as a,o as r,c as n,a as e,t as s,p as l,f as d}from"./entry.
|
|
1
|
+
import{_ as i,u as a,o as r,c as n,a as e,t as s,p as l,f as d}from"./entry.16c420c7.js";const c=t=>(l("data-v-c967d9a9"),t=t(),d(),t),p={class:"font-sans antialiased bg-white dark:bg-black text-black dark:text-white grid min-h-screen place-content-center overflow-hidden"},h=c(()=>e("div",{class:"fixed -bottom-1/2 left-0 right-0 h-1/2 spotlight"},null,-1)),f={class:"max-w-520px text-center"},g=["textContent"],m=["textContent"],x={__name:"error-500",props:{appName:{type:String,default:"Nuxt"},version:{type:String,default:""},statusCode:{type:Number,default:500},statusMessage:{type:String,default:"Server error"},description:{type:String,default:"This page is temporarily unavailable."}},setup(t){const o=t;return a({title:`${o.statusCode} - ${o.statusMessage} | ${o.appName}`,script:[],style:[{children:'*,:before,:after{-webkit-box-sizing:border-box;box-sizing:border-box;border-width:0;border-style:solid;border-color:#e0e0e0}*{--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(14, 165, 233, .5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000}:root{-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{margin:0;font-family:inherit;line-height:inherit}html{-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";line-height:1.5}h1,p{margin:0}h1{font-size:inherit;font-weight:inherit}'}]}),(u,b)=>(r(),n("div",p,[h,e("div",f,[e("h1",{class:"text-8xl sm:text-10xl font-medium mb-8",textContent:s(t.statusCode)},null,8,g),e("p",{class:"text-xl px-8 sm:px-0 sm:text-4xl font-light mb-16 leading-tight",textContent:s(t.description)},null,8,m)])]))}},w=i(x,[["__scopeId","data-v-c967d9a9"]]);export{w as default};
|
package/dist/client/index.html
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
<head><meta charset="utf-8">
|
|
4
4
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
5
5
|
<link rel="stylesheet" href="/__nuxt-og-image/_nuxt/entry.47aab0b4.css">
|
|
6
|
-
<link rel="modulepreload" as="script" crossorigin href="/__nuxt-og-image/_nuxt/entry.
|
|
6
|
+
<link rel="modulepreload" as="script" crossorigin href="/__nuxt-og-image/_nuxt/entry.16c420c7.js">
|
|
7
7
|
<link rel="prefetch" as="style" href="/__nuxt-og-image/_nuxt/error-404.b751fa02.css">
|
|
8
|
-
<link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/error-404.
|
|
8
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/error-404.26fce296.js">
|
|
9
9
|
<link rel="prefetch" as="style" href="/__nuxt-og-image/_nuxt/error-500.69009e70.css">
|
|
10
|
-
<link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/error-500.
|
|
11
|
-
<script type="module" src="/__nuxt-og-image/_nuxt/entry.
|
|
10
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/error-500.89729d99.js">
|
|
11
|
+
<script type="module" src="/__nuxt-og-image/_nuxt/entry.16c420c7.js" crossorigin></script><script>"use strict";(()=>{const a=window,e=document.documentElement,m=["dark","light"],c=window&&window.localStorage&&window.localStorage.getItem&&window.localStorage.getItem("nuxt-color-mode")||"system";let n=c==="system"?d():c;const l=e.getAttribute("data-color-mode-forced");l&&(n=l),i(n),a["__NUXT_COLOR_MODE__"]={preference:c,value:n,getColorScheme:d,addColorScheme:i,removeColorScheme:f};function i(o){const t=""+o+"",s="";e.classList?e.classList.add(t):e.className+=" "+t,s&&e.setAttribute("data-"+s,o)}function f(o){const t=""+o+"",s="";e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp(t,"g"),""),s&&e.removeAttribute("data-"+s)}function r(o){return a.matchMedia("(prefers-color-scheme"+o+")")}function d(){if(a.matchMedia&&r("").media!=="not all"){for(const o of m)if(r(":"+o).matches)return o}return"light"}})();
|
|
12
12
|
</script></head>
|
|
13
13
|
<body ><div id="__nuxt"></div><script type="application/json" id="__NUXT_DATA__" data-ssr="false">[{"_errors":1,"serverRendered":2,"data":3,"state":4},{},false,{},{}]</script>
|
|
14
14
|
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-og-image",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body>
|
package/dist/module.d.mts
CHANGED
|
@@ -185,7 +185,7 @@ interface ModuleHooks {
|
|
|
185
185
|
'nuxt-og-image:components': (ctx: {
|
|
186
186
|
components: OgImageComponent[];
|
|
187
187
|
}) => Promise<void> | void;
|
|
188
|
-
'og-image:config': (config: ModuleOptions) => Promise<void> | void;
|
|
188
|
+
'nuxt-og-image:runtime-config': (config: ModuleOptions) => Promise<void> | void;
|
|
189
189
|
}
|
|
190
190
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
|
|
191
191
|
|
package/dist/module.d.ts
CHANGED
|
@@ -185,7 +185,7 @@ interface ModuleHooks {
|
|
|
185
185
|
'nuxt-og-image:components': (ctx: {
|
|
186
186
|
components: OgImageComponent[];
|
|
187
187
|
}) => Promise<void> | void;
|
|
188
|
-
'og-image:config': (config: ModuleOptions) => Promise<void> | void;
|
|
188
|
+
'nuxt-og-image:runtime-config': (config: ModuleOptions) => Promise<void> | void;
|
|
189
189
|
}
|
|
190
190
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
|
|
191
191
|
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as fs from 'node:fs';
|
|
2
2
|
import { existsSync } from 'node:fs';
|
|
3
3
|
import { loadNuxtModuleInstance, useNuxt, createResolver, addTemplate, resolvePath, defineNuxtModule, useLogger, hasNuxtModule, addServerPlugin, addServerHandler, addImports, addComponentsDir, addComponent, addPlugin } from '@nuxt/kit';
|
|
4
|
-
import { installNuxtSiteConfig } from 'nuxt-site-config-kit';
|
|
4
|
+
import { assertSiteConfig, installNuxtSiteConfig } from 'nuxt-site-config-kit';
|
|
5
5
|
import { provider, env, isDevelopment } from 'std-env';
|
|
6
6
|
import { hash } from 'ohash';
|
|
7
7
|
import { relative, dirname } from 'pathe';
|
|
@@ -11,7 +11,7 @@ import { onDevToolsInitialized, extendServerRpc } from '@nuxt/devtools-kit';
|
|
|
11
11
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
12
12
|
import { createHash } from 'node:crypto';
|
|
13
13
|
|
|
14
|
-
const version = "3.0.0-beta.
|
|
14
|
+
const version = "3.0.0-beta.41";
|
|
15
15
|
|
|
16
16
|
const autodetectableProviders = {
|
|
17
17
|
azure_static: "azure",
|
|
@@ -275,6 +275,11 @@ function setupGenerateHandler(options, resolve, nuxt = useNuxt()) {
|
|
|
275
275
|
},
|
|
276
276
|
resolve
|
|
277
277
|
});
|
|
278
|
+
assertSiteConfig("nuxt-og-image", {
|
|
279
|
+
url: "OG Image tags are required to be absolute URLs."
|
|
280
|
+
}, {
|
|
281
|
+
throwError: true
|
|
282
|
+
});
|
|
278
283
|
});
|
|
279
284
|
}
|
|
280
285
|
|
|
@@ -286,6 +291,12 @@ function setupPrerenderHandler(options, resolve, nuxt = useNuxt()) {
|
|
|
286
291
|
applyNitroPresetCompatibility(nitroConfig, { resolve });
|
|
287
292
|
nitroConfig.wasm = nitroConfig.wasm || {};
|
|
288
293
|
nitroConfig.wasm.esmImport = false;
|
|
294
|
+
const prerenderingPages = (nuxt.options.nitro.prerender?.routes || []).some((r) => r && (!r.includes(".") || r.includes("*")));
|
|
295
|
+
prerenderingPages && assertSiteConfig("nuxt-og-image", {
|
|
296
|
+
url: "OG Image tags are required to be absolute URLs."
|
|
297
|
+
}, {
|
|
298
|
+
throwError: false
|
|
299
|
+
});
|
|
289
300
|
});
|
|
290
301
|
});
|
|
291
302
|
}
|
|
@@ -517,6 +528,10 @@ declare module 'nitropack' {
|
|
|
517
528
|
interface NitroRouteConfig {
|
|
518
529
|
ogImage?: false | import('${typesPath}').OgImageOptions & Record<string, any>
|
|
519
530
|
}
|
|
531
|
+
interface NitroRuntimeHooks {
|
|
532
|
+
'nuxt-og-image:context': (ctx: import('${typesPath}').OgImageRenderEventContext) => void | Promise<void>
|
|
533
|
+
'nuxt-og-image:satori:vnodes': (vnodes: import('${typesPath}').VNode) => void | Promise<void>
|
|
534
|
+
}
|
|
520
535
|
}
|
|
521
536
|
|
|
522
537
|
declare module '#nuxt-og-image/components' {
|
|
@@ -532,7 +547,6 @@ ${componentImports}
|
|
|
532
547
|
if (!cacheEnabled)
|
|
533
548
|
baseCacheKey = false;
|
|
534
549
|
nuxt.hooks.hook("modules:done", async () => {
|
|
535
|
-
nuxt.hooks.callHook("og-image:config", config);
|
|
536
550
|
const normalisedFonts = config.fonts.map((f) => {
|
|
537
551
|
if (typeof f === "string") {
|
|
538
552
|
const [name, weight] = f.split(":");
|
|
@@ -554,7 +568,7 @@ ${componentImports}
|
|
|
554
568
|
let colorPreference = hasNuxtModule("@nuxtjs/color-mode") ? (await getNuxtModuleOptions("@nuxtjs/color-mode")).preference : "light";
|
|
555
569
|
if (!colorPreference || !["dark", "light"].includes(colorPreference))
|
|
556
570
|
colorPreference = "light";
|
|
557
|
-
|
|
571
|
+
const runtimeConfig = {
|
|
558
572
|
version,
|
|
559
573
|
// binding options
|
|
560
574
|
satoriOptions: config.satoriOptions || {},
|
|
@@ -571,6 +585,8 @@ ${componentImports}
|
|
|
571
585
|
hasNuxtIcon: hasNuxtModule("nuxt-icon"),
|
|
572
586
|
colorPreference
|
|
573
587
|
};
|
|
588
|
+
nuxt.hooks.callHook("nuxt-og-image:runtime-config", runtimeConfig);
|
|
589
|
+
nuxt.options.runtimeConfig["nuxt-og-image"] = runtimeConfig;
|
|
574
590
|
});
|
|
575
591
|
if (nuxt.options.dev) {
|
|
576
592
|
setupDevHandler(config, resolve);
|
package/dist/runtime/cache.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function useOgImageBufferCache(ctx:
|
|
1
|
+
import type { OgImageRenderEventContext } from './types';
|
|
2
|
+
export declare function useOgImageBufferCache(ctx: OgImageRenderEventContext, options: {
|
|
3
3
|
baseCacheKey: string | false;
|
|
4
4
|
cacheMaxAgeSeconds?: number;
|
|
5
5
|
}): Promise<void | {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { FontConfig,
|
|
2
|
-
export declare function loadFont({ e }:
|
|
1
|
+
import type { FontConfig, OgImageRenderEventContext } from '../../types';
|
|
2
|
+
export declare function loadFont({ e }: OgImageRenderEventContext, font: FontConfig): Promise<any>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { NuxtIslandResponse } from 'nuxt/dist/core/runtime/nitro/renderer';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function applyEmojis(ctx:
|
|
2
|
+
import type { OgImageRenderEventContext } from '../../types';
|
|
3
|
+
export declare function applyEmojis(ctx: OgImageRenderEventContext, island: NuxtIslandResponse): Promise<string | boolean>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { NuxtIslandResponse } from 'nuxt/dist/core/runtime/nitro/renderer';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function applyInlineCss({ e }:
|
|
2
|
+
import type { OgImageRenderEventContext } from '../../types';
|
|
3
|
+
export declare function applyInlineCss({ e }: OgImageRenderEventContext, island: NuxtIslandResponse): Promise<boolean>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function devIframeTemplate(ctx:
|
|
1
|
+
import type { OgImageRenderEventContext } from '../../types';
|
|
2
|
+
export declare function devIframeTemplate(ctx: OgImageRenderEventContext): Promise<string>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { NuxtIslandResponse } from 'nuxt/dist/core/runtime/nitro/renderer';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function fetchIsland({ options, e }:
|
|
2
|
+
import type { OgImageRenderEventContext } from '../../types';
|
|
3
|
+
export declare function fetchIsland({ options, e }: OgImageRenderEventContext): Promise<NuxtIslandResponse>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { Buffer } from 'node:buffer';
|
|
3
3
|
import type { Browser } from 'playwright-core';
|
|
4
|
-
import type {
|
|
5
|
-
export declare function createScreenshot({ basePath, e, options, extension }:
|
|
4
|
+
import type { OgImageRenderEventContext } from '../../../types';
|
|
5
|
+
export declare function createScreenshot({ basePath, e, options, extension }: OgImageRenderEventContext, browser: Browser): Promise<Buffer>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { FontConfig,
|
|
1
|
+
import type { FontConfig, OgImageRenderEventContext } from '../../../types';
|
|
2
2
|
export declare const satoriFonts: any[];
|
|
3
|
-
export declare function loadFonts(e:
|
|
3
|
+
export declare function loadFonts(e: OgImageRenderEventContext, fonts: FontConfig[]): Promise<any>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function createSvg(event:
|
|
1
|
+
import type { OgImageRenderEventContext, Renderer } from '../../../types';
|
|
2
|
+
export declare function createSvg(event: OgImageRenderEventContext): Promise<string>;
|
|
3
3
|
declare const SatoriRenderer: Renderer;
|
|
4
4
|
export default SatoriRenderer;
|
|
@@ -7,6 +7,7 @@ export async function createSvg(event) {
|
|
|
7
7
|
const { options } = event;
|
|
8
8
|
const { fonts, satoriOptions } = useOgImageRuntimeConfig();
|
|
9
9
|
const vnodes = await createVNodes(event);
|
|
10
|
+
await event._nitro.hooks.callHook("nuxt-og-image:satori:vnodes", vnodes);
|
|
10
11
|
if (!satoriFonts.length)
|
|
11
12
|
satoriFonts.push(...await loadFonts(event, fonts));
|
|
12
13
|
const satori = await useSatori();
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function walkSatoriTree(e:
|
|
1
|
+
import type { OgImageRenderEventContext, SatoriTransformer, VNode } from '../../../types';
|
|
2
|
+
export declare function walkSatoriTree(e: OgImageRenderEventContext, node: VNode, plugins: (SatoriTransformer | SatoriTransformer[])[]): Promise<void>;
|
|
3
3
|
export declare function defineSatoriTransformer(transformer: SatoriTransformer | SatoriTransformer[]): SatoriTransformer | SatoriTransformer[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function createVNodes(ctx:
|
|
1
|
+
import type { OgImageRenderEventContext, VNode } from '../../../types';
|
|
2
|
+
export declare function createVNodes(ctx: OgImageRenderEventContext): Promise<VNode>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { H3Error, H3Event } from 'h3';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function resolveRendererContext(e: H3Event): Promise<H3Error |
|
|
2
|
+
import type { OgImageRenderEventContext } from '../../types';
|
|
3
|
+
export declare function resolveRendererContext(e: H3Event): Promise<H3Error | OgImageRenderEventContext>;
|
|
@@ -7,7 +7,7 @@ import { prerenderOptionsCache } from "../cache/prerender.mjs";
|
|
|
7
7
|
import { useChromiumRenderer, useSatoriRenderer } from "../renderers/satori/instances.mjs";
|
|
8
8
|
import { separateProps, useOgImageRuntimeConfig } from "../../utils.mjs";
|
|
9
9
|
import { resolvePathCacheKey } from "../../nitro/utils.mjs";
|
|
10
|
-
import { useRuntimeConfig } from "#imports";
|
|
10
|
+
import { useNitroApp, useRuntimeConfig } from "#imports";
|
|
11
11
|
export async function resolveRendererContext(e) {
|
|
12
12
|
const runtimeConfig = useOgImageRuntimeConfig();
|
|
13
13
|
const path = parseURL(e.path).pathname;
|
|
@@ -79,13 +79,16 @@ export async function resolveRendererContext(e) {
|
|
|
79
79
|
statusMessage: `Renderer ${options.renderer} is missing.`
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
const ctx = {
|
|
83
83
|
e,
|
|
84
84
|
key,
|
|
85
85
|
renderer,
|
|
86
86
|
isDebugJsonPayload,
|
|
87
87
|
extension,
|
|
88
88
|
basePath,
|
|
89
|
-
options
|
|
89
|
+
options,
|
|
90
|
+
_nitro: useNitroApp()
|
|
90
91
|
};
|
|
92
|
+
await ctx._nitro.hooks.callHook("nuxt-og-image:context", ctx);
|
|
93
|
+
return ctx;
|
|
91
94
|
}
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -4,8 +4,9 @@ import type { ResvgRenderOptions } from '@resvg/resvg-js';
|
|
|
4
4
|
import type { SatoriOptions } from 'satori';
|
|
5
5
|
import type { AllowedComponentProps, Component, ComponentCustomProps, VNodeProps } from '@vue/runtime-core';
|
|
6
6
|
import type { SharpOptions } from 'sharp';
|
|
7
|
+
import type { NitroApp } from 'nitropack';
|
|
7
8
|
import type { OgImageComponents } from '#nuxt-og-image/components';
|
|
8
|
-
export interface
|
|
9
|
+
export interface OgImageRenderEventContext {
|
|
9
10
|
e: H3Event;
|
|
10
11
|
extension: 'png' | 'jpeg' | 'jpg' | 'svg' | 'html' | 'json';
|
|
11
12
|
key: string;
|
|
@@ -13,6 +14,7 @@ export interface H3EventOgImageRender {
|
|
|
13
14
|
renderer: Renderer;
|
|
14
15
|
options: OgImageOptions;
|
|
15
16
|
isDebugJsonPayload: boolean;
|
|
17
|
+
_nitro: NitroApp;
|
|
16
18
|
}
|
|
17
19
|
export type IconifyEmojiIconSets = 'twemoji' | 'noto' | 'fluent-emoji' | 'fluent-emoji-flat' | 'fluent-emoji-high-contrast' | 'noto-v1' | 'emojione' | 'emojione-monotone' | 'emojione-v1' | 'streamline-emojis' | 'openmoji';
|
|
18
20
|
export interface OgImageRuntimeConfig {
|
|
@@ -119,13 +121,13 @@ export type RendererOptions = Omit<OgImageOptions, 'extension'> & {
|
|
|
119
121
|
export interface Renderer {
|
|
120
122
|
name: 'chromium' | 'satori';
|
|
121
123
|
supportedFormats: Partial<RendererOptions['extension']>[];
|
|
122
|
-
createImage: (e:
|
|
123
|
-
debug: (e:
|
|
124
|
+
createImage: (e: OgImageRenderEventContext) => Promise<H3Error | BufferSource | void>;
|
|
125
|
+
debug: (e: OgImageRenderEventContext) => Promise<Record<string, any>>;
|
|
124
126
|
}
|
|
125
127
|
export type ExtractComponentProps<T extends Component> = T extends new (...args: any) => any ? Omit<InstanceType<T>['$props'], keyof ComponentCustomProps | keyof VNodeProps | keyof AllowedComponentProps> : never;
|
|
126
128
|
export type OgImagePageScreenshotOptions = Omit<OgImageOptions, 'html' | 'renderer' | 'component' | 'satori' | 'resvg' | 'sharp'>;
|
|
127
129
|
export type VNode = ReturnType<typeof html>;
|
|
128
130
|
export interface SatoriTransformer {
|
|
129
131
|
filter: (node: VNode) => boolean;
|
|
130
|
-
transform: (node: VNode, e:
|
|
132
|
+
transform: (node: VNode, e: OgImageRenderEventContext) => Promise<void>;
|
|
131
133
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"id":"88cd699e-6f5a-4788-a59e-8158fb29f04b","timestamp":1701839441443,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|