nuxt-og-image 5.1.6 → 5.1.8
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 +7 -7
- package/dist/client/404.html +7 -7
- package/dist/client/_nuxt/{TAjbzagq.js → BM0SGHtW.js} +1 -1
- package/dist/client/_nuxt/{Bi6Y3qqE.js → Cl0GRg1F.js} +130 -130
- package/dist/client/_nuxt/{eNJvB98b.js → DH3TEEXq.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/32731774-300b-4e2d-acf2-4e94bbd66b89.json +1 -0
- package/dist/client/_nuxt/error-404.CWHu2lpK.css +1 -0
- package/dist/client/_nuxt/error-500.xMt3qmEl.css +1 -0
- package/dist/client/index.html +7 -7
- package/dist/content.cjs +7 -5
- package/dist/content.d.cts +18 -2
- package/dist/content.d.mts +18 -2
- package/dist/content.d.ts +18 -2
- package/dist/content.mjs +7 -6
- package/dist/module.cjs +4 -3
- package/dist/module.json +1 -1
- package/dist/module.mjs +4 -3
- package/dist/runtime/app/components/OgImage/OgImage.js +1 -1
- package/dist/runtime/app/components/OgImage/OgImageScreenshot.js +1 -1
- package/dist/runtime/app/components/Templates/Community/NuxtSeo.vue +2 -2
- package/dist/runtime/app/components/Templates/Community/SimpleBlog.vue +2 -1
- package/dist/runtime/app/components/Templates/Community/UnJs.vue +1 -1
- package/dist/runtime/app/composables/defineOgImage.js +11 -23
- package/dist/runtime/app/composables/defineOgImageScreenshot.js +2 -1
- package/dist/runtime/app/plugins/__zero-runtime/og-image-canonical-urls.server.js +1 -1
- package/dist/runtime/app/plugins/__zero-runtime/route-rule-og-image.server.js +1 -1
- package/dist/runtime/app/plugins/og-image-canonical-urls.server.js +4 -2
- package/dist/runtime/app/plugins/route-rule-og-image.server.js +4 -2
- package/dist/runtime/app/utils/plugins.d.ts +3 -3
- package/dist/runtime/app/utils/plugins.js +13 -10
- package/dist/runtime/app/utils.d.ts +3 -1
- package/dist/runtime/app/utils.js +23 -5
- package/dist/runtime/server/og-image/bindings/chromium/on-demand.js +8 -3
- package/dist/runtime/server/og-image/chromium/screenshot.js +5 -4
- package/dist/runtime/server/og-image/context.js +13 -8
- package/dist/runtime/server/og-image/satori/font.js +4 -3
- package/dist/runtime/server/og-image/satori/plugins/flex.js +1 -1
- package/dist/runtime/server/og-image/satori/plugins/imageSrc.js +11 -6
- package/dist/runtime/server/og-image/satori/renderer.js +5 -2
- package/dist/runtime/server/og-image/satori/transforms/emojis.d.ts +2 -2
- package/dist/runtime/server/og-image/satori/transforms/inlineCss.d.ts +1 -1
- package/dist/runtime/server/og-image/satori/transforms/inlineCss.js +6 -5
- package/dist/runtime/server/og-image/templates/html.js +2 -1
- package/dist/runtime/server/plugins/__zero-runtime/nuxt-content-v2.d.ts +1 -1
- package/dist/runtime/server/plugins/__zero-runtime/nuxt-content-v2.js +1 -1
- package/dist/runtime/server/plugins/nuxt-content-v2.d.ts +1 -1
- package/dist/runtime/server/plugins/nuxt-content-v2.js +1 -1
- package/dist/runtime/server/plugins/prerender.d.ts +1 -1
- package/dist/runtime/server/plugins/prerender.js +2 -2
- package/dist/runtime/server/routes/debug.json.js +2 -2
- package/dist/runtime/server/util/cache.js +2 -2
- package/dist/runtime/server/util/eventHandlers.js +2 -1
- package/dist/runtime/server/util/kit.d.ts +1 -1
- package/dist/runtime/server/util/kit.js +1 -1
- package/dist/runtime/server/util/plugins.js +2 -1
- package/dist/runtime/server/utils.d.ts +4 -0
- package/dist/runtime/server/utils.js +20 -0
- package/dist/runtime/shared.d.ts +13 -4
- package/dist/runtime/shared.js +103 -17
- package/dist/runtime/types.d.ts +15 -1
- package/package.json +27 -25
- package/{virtual.d.ts → types/virtual.d.ts} +11 -2
- package/dist/client/_nuxt/builds/meta/0f0cd98d-a6ee-47bf-a7c6-e295b96f29b9.json +0 -1
- package/dist/client/_nuxt/error-404.t9BbLQhb.css +0 -1
- package/dist/client/_nuxt/error-500.Bj4Q9dL1.css +0 -1
- package/dist/runtime/pure.d.ts +0 -9
- package/dist/runtime/pure.js +0 -105
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as s,u as a,c as i,o as u,a as e,t as o}from"./
|
|
1
|
+
import{_ as s,u as a,c as i,o as u,a as e,t as o}from"./Cl0GRg1F.js";const l={class:"antialiased bg-white dark:bg-black dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-black"},c={class:"max-w-520px text-center"},d=["textContent"],p=["textContent"],f={__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 n=t;return a({title:`${n.statusCode} - ${n.statusMessage} | ${n.appName}`,script:[{innerHTML:`!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))r(e);new MutationObserver((e=>{for(const o of e)if("childList"===o.type)for(const e of o.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&r(e)})).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;const r=function(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?r.credentials="include":"anonymous"===e.crossOrigin?r.credentials="omit":r.credentials="same-origin",r}(e);fetch(e.href,r)}}();`}],style:[{innerHTML:'*,:after,:before{border-color:var(--un-default-border-color,#e5e7eb);border-style:solid;border-width:0;box-sizing:border-box}:after,:before{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}h1{font-size:inherit;font-weight:inherit}h1,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 transparent;--un-ring-shadow:0 0 transparent;--un-shadow-inset: ;--un-shadow:0 0 transparent;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }'}]}),(g,r)=>(u(),i("div",l,[r[0]||(r[0]=e("div",{class:"-bottom-1/2 fixed h-1/2 left-0 right-0 spotlight"},null,-1)),e("div",c,[e("h1",{class:"font-medium mb-8 sm:text-10xl text-8xl",textContent:o(t.statusCode)},null,8,d),e("p",{class:"font-light leading-tight mb-16 px-8 sm:px-0 sm:text-4xl text-xl",textContent:o(t.description)},null,8,p)])]))}},h=s(f,[["__scopeId","data-v-78dd430a"]]);export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"32731774-300b-4e2d-acf2-4e94bbd66b89","timestamp":1750905317414}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"32731774-300b-4e2d-acf2-4e94bbd66b89","timestamp":1750905317414,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.spotlight[data-v-66c28054]{background:linear-gradient(45deg,#00dc82,#36e4da 50%,#0047e1);bottom:-30vh;filter:blur(20vh);height:40vh}.gradient-border[data-v-66c28054]{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border-radius:.5rem;position:relative}@media (prefers-color-scheme:light){.gradient-border[data-v-66c28054]{background-color:#ffffff4d}.gradient-border[data-v-66c28054]:before{background:linear-gradient(90deg,#e2e2e2,#e2e2e2 25%,#00dc82,#36e4da 75%,#0047e1)}}@media (prefers-color-scheme:dark){.gradient-border[data-v-66c28054]{background-color:#1414144d}.gradient-border[data-v-66c28054]:before{background:linear-gradient(90deg,#303030,#303030 25%,#00dc82,#36e4da 75%,#0047e1)}}.gradient-border[data-v-66c28054]:before{background-size:400% auto;border-radius:.5rem;bottom:0;content:"";left:0;-webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude;opacity:.5;padding:2px;position:absolute;right:0;top:0;transition:background-position .3s ease-in-out,opacity .2s ease-in-out;width:100%}.gradient-border[data-v-66c28054]:hover:before{background-position:-50% 0;opacity:1}.fixed[data-v-66c28054]{position:fixed}.left-0[data-v-66c28054]{left:0}.right-0[data-v-66c28054]{right:0}.z-10[data-v-66c28054]{z-index:10}.z-20[data-v-66c28054]{z-index:20}.grid[data-v-66c28054]{display:grid}.mb-16[data-v-66c28054]{margin-bottom:4rem}.mb-8[data-v-66c28054]{margin-bottom:2rem}.max-w-520px[data-v-66c28054]{max-width:520px}.min-h-screen[data-v-66c28054]{min-height:100vh}.w-full[data-v-66c28054]{width:100%}.flex[data-v-66c28054]{display:flex}.cursor-pointer[data-v-66c28054]{cursor:pointer}.place-content-center[data-v-66c28054]{place-content:center}.items-center[data-v-66c28054]{align-items:center}.justify-center[data-v-66c28054]{justify-content:center}.overflow-hidden[data-v-66c28054]{overflow:hidden}.bg-white[data-v-66c28054]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-4[data-v-66c28054]{padding-left:1rem;padding-right:1rem}.px-8[data-v-66c28054]{padding-left:2rem;padding-right:2rem}.py-2[data-v-66c28054]{padding-bottom:.5rem;padding-top:.5rem}.text-center[data-v-66c28054]{text-align:center}.text-8xl[data-v-66c28054]{font-size:6rem;line-height:1}.text-xl[data-v-66c28054]{font-size:1.25rem;line-height:1.75rem}.text-black[data-v-66c28054]{--un-text-opacity:1;color:rgb(0 0 0/var(--un-text-opacity))}.font-light[data-v-66c28054]{font-weight:300}.font-medium[data-v-66c28054]{font-weight:500}.leading-tight[data-v-66c28054]{line-height:1.25}.font-sans[data-v-66c28054]{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}.antialiased[data-v-66c28054]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){.dark\:bg-black[data-v-66c28054]{--un-bg-opacity:1;background-color:rgb(0 0 0/var(--un-bg-opacity))}.dark\:text-white[data-v-66c28054]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media (min-width:640px){.sm\:px-0[data-v-66c28054]{padding-left:0;padding-right:0}.sm\:px-6[data-v-66c28054]{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-3[data-v-66c28054]{padding-bottom:.75rem;padding-top:.75rem}.sm\:text-4xl[data-v-66c28054]{font-size:2.25rem;line-height:2.5rem}.sm\:text-xl[data-v-66c28054]{font-size:1.25rem;line-height:1.75rem}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.spotlight[data-v-78dd430a]{background:linear-gradient(45deg,#00dc82,#36e4da 50%,#0047e1);filter:blur(20vh)}.fixed[data-v-78dd430a]{position:fixed}.-bottom-1\/2[data-v-78dd430a]{bottom:-50%}.left-0[data-v-78dd430a]{left:0}.right-0[data-v-78dd430a]{right:0}.grid[data-v-78dd430a]{display:grid}.mb-16[data-v-78dd430a]{margin-bottom:4rem}.mb-8[data-v-78dd430a]{margin-bottom:2rem}.h-1\/2[data-v-78dd430a]{height:50%}.max-w-520px[data-v-78dd430a]{max-width:520px}.min-h-screen[data-v-78dd430a]{min-height:100vh}.place-content-center[data-v-78dd430a]{place-content:center}.overflow-hidden[data-v-78dd430a]{overflow:hidden}.bg-white[data-v-78dd430a]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-8[data-v-78dd430a]{padding-left:2rem;padding-right:2rem}.text-center[data-v-78dd430a]{text-align:center}.text-8xl[data-v-78dd430a]{font-size:6rem;line-height:1}.text-xl[data-v-78dd430a]{font-size:1.25rem;line-height:1.75rem}.text-black[data-v-78dd430a]{--un-text-opacity:1;color:rgb(0 0 0/var(--un-text-opacity))}.font-light[data-v-78dd430a]{font-weight:300}.font-medium[data-v-78dd430a]{font-weight:500}.leading-tight[data-v-78dd430a]{line-height:1.25}.font-sans[data-v-78dd430a]{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}.antialiased[data-v-78dd430a]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){.dark\:bg-black[data-v-78dd430a]{--un-bg-opacity:1;background-color:rgb(0 0 0/var(--un-bg-opacity))}.dark\:text-white[data-v-78dd430a]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media (min-width:640px){.sm\:px-0[data-v-78dd430a]{padding-left:0;padding-right:0}.sm\:text-4xl[data-v-78dd430a]{font-size:2.25rem;line-height:2.5rem}}
|
package/dist/client/index.html
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<!DOCTYPE html><html><head><meta charset="utf-8">
|
|
2
2
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
3
3
|
<link rel="stylesheet" href="/__nuxt-og-image/_nuxt/entry.BVkKIlAn.css" crossorigin>
|
|
4
|
-
<link rel="modulepreload" as="script" crossorigin href="/__nuxt-og-image/_nuxt/
|
|
4
|
+
<link rel="modulepreload" as="script" crossorigin href="/__nuxt-og-image/_nuxt/Cl0GRg1F.js">
|
|
5
5
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/CVO1_9PV.js">
|
|
6
6
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/D0r3Knsf.js">
|
|
7
7
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/B8PEiB0p.js">
|
|
8
8
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/Cp-IABpG.js">
|
|
9
9
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/B6E6ObS_.js">
|
|
10
|
-
<link rel="prefetch" as="style" crossorigin href="/__nuxt-og-image/_nuxt/error-404.
|
|
11
|
-
<link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/
|
|
12
|
-
<link rel="prefetch" as="style" crossorigin href="/__nuxt-og-image/_nuxt/error-500.
|
|
13
|
-
<link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/
|
|
14
|
-
<script type="module" src="/__nuxt-og-image/_nuxt/
|
|
15
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-og-image",buildId:"
|
|
10
|
+
<link rel="prefetch" as="style" crossorigin href="/__nuxt-og-image/_nuxt/error-404.CWHu2lpK.css">
|
|
11
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/BM0SGHtW.js">
|
|
12
|
+
<link rel="prefetch" as="style" crossorigin href="/__nuxt-og-image/_nuxt/error-500.xMt3qmEl.css">
|
|
13
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/DH3TEEXq.js">
|
|
14
|
+
<script type="module" src="/__nuxt-og-image/_nuxt/Cl0GRg1F.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1750905323198,false]</script>
|
|
15
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-og-image",buildId:"32731774-300b-4e2d-acf2-4e94bbd66b89",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/content.cjs
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
const content = require('@nuxt/content');
|
|
4
4
|
|
|
5
|
+
const ogImageSchema = content.z.object({
|
|
6
|
+
url: content.z.string().optional(),
|
|
7
|
+
component: content.z.string().optional(),
|
|
8
|
+
props: content.z.record(content.z.string(), content.z.any())
|
|
9
|
+
}).optional();
|
|
5
10
|
const schema = content.z.object({
|
|
6
|
-
ogImage:
|
|
7
|
-
url: content.z.string().optional(),
|
|
8
|
-
component: content.z.string().optional(),
|
|
9
|
-
props: content.z.record(content.z.string(), content.z.any())
|
|
10
|
-
}).optional()
|
|
11
|
+
ogImage: ogImageSchema
|
|
11
12
|
});
|
|
12
13
|
function asOgImageCollection(collection) {
|
|
13
14
|
if (collection.type === "page") {
|
|
@@ -17,4 +18,5 @@ function asOgImageCollection(collection) {
|
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
exports.asOgImageCollection = asOgImageCollection;
|
|
21
|
+
exports.ogImageSchema = ogImageSchema;
|
|
20
22
|
exports.schema = schema;
|
package/dist/content.d.cts
CHANGED
|
@@ -2,6 +2,19 @@ import * as zod from 'zod';
|
|
|
2
2
|
import { TypeOf, ZodRawShape } from 'zod';
|
|
3
3
|
import { Collection } from '@nuxt/content';
|
|
4
4
|
|
|
5
|
+
declare const ogImageSchema: zod.ZodOptional<zod.ZodObject<{
|
|
6
|
+
url: zod.ZodOptional<zod.ZodString>;
|
|
7
|
+
component: zod.ZodOptional<zod.ZodString>;
|
|
8
|
+
props: zod.ZodRecord<zod.ZodString, zod.ZodAny>;
|
|
9
|
+
}, "strip", zod.ZodTypeAny, {
|
|
10
|
+
props: Record<string, any>;
|
|
11
|
+
url?: string | undefined;
|
|
12
|
+
component?: string | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
props: Record<string, any>;
|
|
15
|
+
url?: string | undefined;
|
|
16
|
+
component?: string | undefined;
|
|
17
|
+
}>>;
|
|
5
18
|
declare const schema: zod.ZodObject<{
|
|
6
19
|
ogImage: zod.ZodOptional<zod.ZodObject<{
|
|
7
20
|
url: zod.ZodOptional<zod.ZodString>;
|
|
@@ -30,7 +43,10 @@ declare const schema: zod.ZodObject<{
|
|
|
30
43
|
} | undefined;
|
|
31
44
|
}>;
|
|
32
45
|
type OgImageSchema = TypeOf<typeof schema>;
|
|
33
|
-
|
|
46
|
+
type ExtendedSchema<T extends ZodRawShape> = T & {
|
|
47
|
+
ogImage: typeof ogImageSchema;
|
|
48
|
+
};
|
|
49
|
+
declare function asOgImageCollection<T extends ZodRawShape>(collection: Collection<T>): Collection<ExtendedSchema<T>>;
|
|
34
50
|
|
|
35
|
-
export { asOgImageCollection, schema };
|
|
51
|
+
export { asOgImageCollection, ogImageSchema, schema };
|
|
36
52
|
export type { OgImageSchema };
|
package/dist/content.d.mts
CHANGED
|
@@ -2,6 +2,19 @@ import * as zod from 'zod';
|
|
|
2
2
|
import { TypeOf, ZodRawShape } from 'zod';
|
|
3
3
|
import { Collection } from '@nuxt/content';
|
|
4
4
|
|
|
5
|
+
declare const ogImageSchema: zod.ZodOptional<zod.ZodObject<{
|
|
6
|
+
url: zod.ZodOptional<zod.ZodString>;
|
|
7
|
+
component: zod.ZodOptional<zod.ZodString>;
|
|
8
|
+
props: zod.ZodRecord<zod.ZodString, zod.ZodAny>;
|
|
9
|
+
}, "strip", zod.ZodTypeAny, {
|
|
10
|
+
props: Record<string, any>;
|
|
11
|
+
url?: string | undefined;
|
|
12
|
+
component?: string | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
props: Record<string, any>;
|
|
15
|
+
url?: string | undefined;
|
|
16
|
+
component?: string | undefined;
|
|
17
|
+
}>>;
|
|
5
18
|
declare const schema: zod.ZodObject<{
|
|
6
19
|
ogImage: zod.ZodOptional<zod.ZodObject<{
|
|
7
20
|
url: zod.ZodOptional<zod.ZodString>;
|
|
@@ -30,7 +43,10 @@ declare const schema: zod.ZodObject<{
|
|
|
30
43
|
} | undefined;
|
|
31
44
|
}>;
|
|
32
45
|
type OgImageSchema = TypeOf<typeof schema>;
|
|
33
|
-
|
|
46
|
+
type ExtendedSchema<T extends ZodRawShape> = T & {
|
|
47
|
+
ogImage: typeof ogImageSchema;
|
|
48
|
+
};
|
|
49
|
+
declare function asOgImageCollection<T extends ZodRawShape>(collection: Collection<T>): Collection<ExtendedSchema<T>>;
|
|
34
50
|
|
|
35
|
-
export { asOgImageCollection, schema };
|
|
51
|
+
export { asOgImageCollection, ogImageSchema, schema };
|
|
36
52
|
export type { OgImageSchema };
|
package/dist/content.d.ts
CHANGED
|
@@ -2,6 +2,19 @@ import * as zod from 'zod';
|
|
|
2
2
|
import { TypeOf, ZodRawShape } from 'zod';
|
|
3
3
|
import { Collection } from '@nuxt/content';
|
|
4
4
|
|
|
5
|
+
declare const ogImageSchema: zod.ZodOptional<zod.ZodObject<{
|
|
6
|
+
url: zod.ZodOptional<zod.ZodString>;
|
|
7
|
+
component: zod.ZodOptional<zod.ZodString>;
|
|
8
|
+
props: zod.ZodRecord<zod.ZodString, zod.ZodAny>;
|
|
9
|
+
}, "strip", zod.ZodTypeAny, {
|
|
10
|
+
props: Record<string, any>;
|
|
11
|
+
url?: string | undefined;
|
|
12
|
+
component?: string | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
props: Record<string, any>;
|
|
15
|
+
url?: string | undefined;
|
|
16
|
+
component?: string | undefined;
|
|
17
|
+
}>>;
|
|
5
18
|
declare const schema: zod.ZodObject<{
|
|
6
19
|
ogImage: zod.ZodOptional<zod.ZodObject<{
|
|
7
20
|
url: zod.ZodOptional<zod.ZodString>;
|
|
@@ -30,7 +43,10 @@ declare const schema: zod.ZodObject<{
|
|
|
30
43
|
} | undefined;
|
|
31
44
|
}>;
|
|
32
45
|
type OgImageSchema = TypeOf<typeof schema>;
|
|
33
|
-
|
|
46
|
+
type ExtendedSchema<T extends ZodRawShape> = T & {
|
|
47
|
+
ogImage: typeof ogImageSchema;
|
|
48
|
+
};
|
|
49
|
+
declare function asOgImageCollection<T extends ZodRawShape>(collection: Collection<T>): Collection<ExtendedSchema<T>>;
|
|
34
50
|
|
|
35
|
-
export { asOgImageCollection, schema };
|
|
51
|
+
export { asOgImageCollection, ogImageSchema, schema };
|
|
36
52
|
export type { OgImageSchema };
|
package/dist/content.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { z } from '@nuxt/content';
|
|
2
2
|
|
|
3
|
+
const ogImageSchema = z.object({
|
|
4
|
+
url: z.string().optional(),
|
|
5
|
+
component: z.string().optional(),
|
|
6
|
+
props: z.record(z.string(), z.any())
|
|
7
|
+
}).optional();
|
|
3
8
|
const schema = z.object({
|
|
4
|
-
ogImage:
|
|
5
|
-
url: z.string().optional(),
|
|
6
|
-
component: z.string().optional(),
|
|
7
|
-
props: z.record(z.string(), z.any())
|
|
8
|
-
}).optional()
|
|
9
|
+
ogImage: ogImageSchema
|
|
9
10
|
});
|
|
10
11
|
function asOgImageCollection(collection) {
|
|
11
12
|
if (collection.type === "page") {
|
|
@@ -14,4 +15,4 @@ function asOgImageCollection(collection) {
|
|
|
14
15
|
return collection;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
export { asOgImageCollection, schema };
|
|
18
|
+
export { asOgImageCollection, ogImageSchema, schema };
|
package/dist/module.cjs
CHANGED
|
@@ -149,6 +149,7 @@ const RuntimeCompatibility = {
|
|
|
149
149
|
"satori": "node",
|
|
150
150
|
"sharp": false,
|
|
151
151
|
"wasm": {
|
|
152
|
+
// @ts-expect-error untyped
|
|
152
153
|
rollup: {
|
|
153
154
|
targetEnv: "auto-inline",
|
|
154
155
|
sync: ["@resvg/resvg-wasm/index_bg.wasm"]
|
|
@@ -183,7 +184,7 @@ function resolveNitroPreset(nitroConfig) {
|
|
|
183
184
|
const nuxt = kit.useNuxt();
|
|
184
185
|
if (nuxt.options.dev)
|
|
185
186
|
return "nitro-dev";
|
|
186
|
-
if (nuxt.options._generate)
|
|
187
|
+
if (nuxt.options._generate || nuxt.options.nitro.static)
|
|
187
188
|
return "nitro-prerender";
|
|
188
189
|
let preset;
|
|
189
190
|
if (nitroConfig && nitroConfig?.preset)
|
|
@@ -309,7 +310,7 @@ async function setupBuildHandler(config, resolve, nuxt = kit.useNuxt()) {
|
|
|
309
310
|
}
|
|
310
311
|
async function resolveFilePathSha1(path) {
|
|
311
312
|
const _path = await kit.resolvePath(path);
|
|
312
|
-
return sha1(fs.existsSync(_path) ? await promises.readFile(_path) : path);
|
|
313
|
+
return sha1(fs.existsSync(_path) ? await promises.readFile(_path) : Buffer.from(path));
|
|
313
314
|
}
|
|
314
315
|
function sha1(source) {
|
|
315
316
|
return node_crypto.createHash("sha1").update(source).digest("hex").slice(0, 16);
|
|
@@ -899,7 +900,7 @@ const module$1 = kit.defineNuxtModule({
|
|
|
899
900
|
hash: ohash.hash(componentFile).replaceAll("_", "-"),
|
|
900
901
|
pascalName: component.pascalName,
|
|
901
902
|
kebabName: component.kebabName,
|
|
902
|
-
path:
|
|
903
|
+
path: component.filePath,
|
|
903
904
|
category,
|
|
904
905
|
credits
|
|
905
906
|
});
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -129,6 +129,7 @@ const RuntimeCompatibility = {
|
|
|
129
129
|
"satori": "node",
|
|
130
130
|
"sharp": false,
|
|
131
131
|
"wasm": {
|
|
132
|
+
// @ts-expect-error untyped
|
|
132
133
|
rollup: {
|
|
133
134
|
targetEnv: "auto-inline",
|
|
134
135
|
sync: ["@resvg/resvg-wasm/index_bg.wasm"]
|
|
@@ -163,7 +164,7 @@ function resolveNitroPreset(nitroConfig) {
|
|
|
163
164
|
const nuxt = useNuxt();
|
|
164
165
|
if (nuxt.options.dev)
|
|
165
166
|
return "nitro-dev";
|
|
166
|
-
if (nuxt.options._generate)
|
|
167
|
+
if (nuxt.options._generate || nuxt.options.nitro.static)
|
|
167
168
|
return "nitro-prerender";
|
|
168
169
|
let preset;
|
|
169
170
|
if (nitroConfig && nitroConfig?.preset)
|
|
@@ -289,7 +290,7 @@ async function setupBuildHandler(config, resolve, nuxt = useNuxt()) {
|
|
|
289
290
|
}
|
|
290
291
|
async function resolveFilePathSha1(path) {
|
|
291
292
|
const _path = await resolvePath(path);
|
|
292
|
-
return sha1(existsSync(_path) ? await readFile(_path) : path);
|
|
293
|
+
return sha1(existsSync(_path) ? await readFile(_path) : Buffer.from(path));
|
|
293
294
|
}
|
|
294
295
|
function sha1(source) {
|
|
295
296
|
return createHash("sha1").update(source).digest("hex").slice(0, 16);
|
|
@@ -879,7 +880,7 @@ const module = defineNuxtModule({
|
|
|
879
880
|
hash: hash(componentFile).replaceAll("_", "-"),
|
|
880
881
|
pascalName: component.pascalName,
|
|
881
882
|
kebabName: component.kebabName,
|
|
882
|
-
path:
|
|
883
|
+
path: component.filePath,
|
|
883
884
|
category,
|
|
884
885
|
credits
|
|
885
886
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineOgImageScreenshot } from "#imports";
|
|
2
1
|
import { defineComponent } from "vue";
|
|
2
|
+
import { defineOgImageScreenshot } from "../../composables/defineOgImageScreenshot.js";
|
|
3
3
|
export default defineComponent({
|
|
4
4
|
name: "OgImageScreenshot",
|
|
5
5
|
async setup(_, { attrs }) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useOgImageRuntimeConfig } from "#og-image/app/utils";
|
|
3
|
+
import { useSiteConfig } from "#site-config/app/composables";
|
|
4
4
|
import { computed, defineComponent, h, resolveComponent } from "vue";
|
|
5
5
|
const props = defineProps({
|
|
6
6
|
colorMode: { type: String, required: false },
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
2
|
+
import { useSiteConfig } from "#site-config/app/composables";
|
|
3
3
|
import { parseURL } from "ufo";
|
|
4
|
+
import { computed } from "vue";
|
|
4
5
|
const props = defineProps({
|
|
5
6
|
title: { type: String, required: false, default: "title" },
|
|
6
7
|
website: { type: String, required: false }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from "
|
|
2
|
+
import { computed } from "vue";
|
|
3
3
|
const props = defineProps({
|
|
4
4
|
title: { type: String, required: false, default: "unjs/h3" },
|
|
5
5
|
description: { type: String, required: false, default: "Minimal H(TTP) framework built for high performance and portability" },
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { appendHeader } from "h3";
|
|
2
2
|
import { createError, useNuxtApp, useRequestEvent, useRoute, useState } from "nuxt/app";
|
|
3
3
|
import { ref, toValue } from "vue";
|
|
4
|
-
import {
|
|
5
|
-
import { getOgImagePath, useOgImageRuntimeConfig } from "../../shared.js";
|
|
6
|
-
import { createOgImageMeta, setHeadOgImagePrebuilt } from "../utils.js";
|
|
4
|
+
import { createOgImageMeta, getOgImagePath, setHeadOgImagePrebuilt, useOgImageRuntimeConfig } from "../utils.js";
|
|
7
5
|
export function defineOgImage(_options = {}) {
|
|
8
6
|
const nuxtApp = useNuxtApp();
|
|
9
7
|
const route = useRoute();
|
|
@@ -21,35 +19,25 @@ export function defineOgImage(_options = {}) {
|
|
|
21
19
|
if (!import.meta.server) {
|
|
22
20
|
return;
|
|
23
21
|
}
|
|
24
|
-
const ogImageInstances = nuxtApp.ssrContext._ogImageInstances || [];
|
|
25
|
-
const routeRuleMatcher = createNitroRouteRuleMatcher();
|
|
26
|
-
const routeRules = routeRuleMatcher(basePath).ogImage;
|
|
27
|
-
if (!_options || nuxtApp.ssrContext?.event.context._nitro?.routeRules?.ogImage === false || typeof routeRules !== "undefined" && routeRules === false) {
|
|
28
|
-
ogImageInstances.forEach((e) => {
|
|
29
|
-
e.dispose();
|
|
30
|
-
});
|
|
31
|
-
nuxtApp.ssrContext._ogImageInstances = void 0;
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
22
|
const { defaults } = useOgImageRuntimeConfig();
|
|
35
23
|
const options = toValue(_options);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
options[key] = routeRules[key];
|
|
24
|
+
if (options === false) {
|
|
25
|
+
return;
|
|
39
26
|
}
|
|
27
|
+
const validOptions = options;
|
|
40
28
|
for (const key in defaults) {
|
|
41
|
-
if (
|
|
42
|
-
|
|
29
|
+
if (validOptions[key] === void 0)
|
|
30
|
+
validOptions[key] = defaults[key];
|
|
43
31
|
}
|
|
44
32
|
if (route.query)
|
|
45
|
-
|
|
46
|
-
if (
|
|
47
|
-
setHeadOgImagePrebuilt(
|
|
33
|
+
validOptions._query = route.query;
|
|
34
|
+
if (validOptions.url) {
|
|
35
|
+
setHeadOgImagePrebuilt(validOptions);
|
|
48
36
|
return;
|
|
49
37
|
}
|
|
50
|
-
const path = getOgImagePath(basePath,
|
|
38
|
+
const path = getOgImagePath(basePath, validOptions);
|
|
51
39
|
if (import.meta.prerender) {
|
|
52
40
|
appendHeader(useRequestEvent(nuxtApp), "x-nitro-prerender", path);
|
|
53
41
|
}
|
|
54
|
-
createOgImageMeta(path,
|
|
42
|
+
createOgImageMeta(path, validOptions, nuxtApp.ssrContext);
|
|
55
43
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useRouter } from "#app";
|
|
2
|
+
import { defineOgImage } from "./defineOgImage.js";
|
|
2
3
|
export function defineOgImageScreenshot(options = {}) {
|
|
3
4
|
const router = useRouter();
|
|
4
5
|
const route = router.currentRoute.value?.path || "/";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function ogImageCanonicalUrls(nuxtApp:
|
|
3
|
-
export declare function routeRuleOgImage(nuxtApp:
|
|
1
|
+
import type { NuxtSSRContext } from '#app/nuxt';
|
|
2
|
+
export declare function ogImageCanonicalUrls(nuxtApp: NuxtSSRContext['nuxt']): void;
|
|
3
|
+
export declare function routeRuleOgImage(nuxtApp: NuxtSSRContext['nuxt']): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { useRequestEvent
|
|
1
|
+
import { useRequestEvent } from "#app";
|
|
2
|
+
import { withSiteUrl } from "#site-config/app/composables";
|
|
2
3
|
import { TemplateParamsPlugin } from "@unhead/vue/plugins";
|
|
3
4
|
import { defu } from "defu";
|
|
4
5
|
import { parse, stringify } from "devalue";
|
|
@@ -6,13 +7,13 @@ import { createRouter as createRadixRouter, toRouteMatcher } from "radix3";
|
|
|
6
7
|
import { parseURL, withoutBase } from "ufo";
|
|
7
8
|
import { toValue } from "vue";
|
|
8
9
|
import { createOgImageMeta } from "../../app/utils.js";
|
|
9
|
-
import { isInternalRoute, separateProps } from "../../
|
|
10
|
-
import { getOgImagePath } from "
|
|
10
|
+
import { isInternalRoute, separateProps } from "../../shared.js";
|
|
11
|
+
import { getOgImagePath } from "../utils.js";
|
|
11
12
|
export function ogImageCanonicalUrls(nuxtApp) {
|
|
12
13
|
nuxtApp.hooks.hook("app:rendered", async (ctx) => {
|
|
13
14
|
const { ssrContext } = ctx;
|
|
14
15
|
const e = useRequestEvent();
|
|
15
|
-
const path = parseURL(e
|
|
16
|
+
const path = parseURL(e?.path || "").pathname;
|
|
16
17
|
if (isInternalRoute(path))
|
|
17
18
|
return;
|
|
18
19
|
ssrContext?.head.use(TemplateParamsPlugin);
|
|
@@ -50,7 +51,7 @@ export function ogImageCanonicalUrls(nuxtApp) {
|
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
53
|
} else if (overrides && tag.tag === "script" && tag.props.id === "nuxt-og-image-options") {
|
|
53
|
-
tag.innerHTML = stringify(defu(overrides, parse(tag.innerHTML)));
|
|
54
|
+
tag.innerHTML = stringify(defu(overrides, parse(tag.innerHTML || "{}")));
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
}
|
|
@@ -62,15 +63,17 @@ export function routeRuleOgImage(nuxtApp) {
|
|
|
62
63
|
nuxtApp.hooks.hook("app:rendered", async (ctx) => {
|
|
63
64
|
const { ssrContext } = ctx;
|
|
64
65
|
const e = useRequestEvent();
|
|
65
|
-
const path = parseURL(e
|
|
66
|
+
const path = parseURL(e?.path || "").pathname;
|
|
66
67
|
if (isInternalRoute(path))
|
|
67
68
|
return;
|
|
68
69
|
const _routeRulesMatcher = toRouteMatcher(
|
|
69
70
|
createRadixRouter({ routes: ssrContext?.runtimeConfig?.nitro?.routeRules })
|
|
70
71
|
);
|
|
71
|
-
|
|
72
|
-
withoutBase(path.split("?")[0], ssrContext?.runtimeConfig?.app.baseURL)
|
|
73
|
-
).reverse()
|
|
72
|
+
const matchedRules = _routeRulesMatcher.matchAll(
|
|
73
|
+
withoutBase(path.split("?")[0], ssrContext?.runtimeConfig?.app.baseURL || "")
|
|
74
|
+
).reverse();
|
|
75
|
+
const combinedRules = defu({}, ...matchedRules);
|
|
76
|
+
let routeRules = combinedRules?.ogImage;
|
|
74
77
|
if (typeof routeRules === "undefined")
|
|
75
78
|
return;
|
|
76
79
|
const ogImageInstances = nuxtApp.ssrContext._ogImageInstances || [];
|
|
@@ -82,7 +85,7 @@ export function routeRuleOgImage(nuxtApp) {
|
|
|
82
85
|
nuxtApp.ssrContext._ogImageInstances = void 0;
|
|
83
86
|
return;
|
|
84
87
|
}
|
|
85
|
-
routeRules = defu(nuxtApp.ssrContext?.event
|
|
88
|
+
routeRules = defu(nuxtApp.ssrContext?.event?.context._nitro?.routeRules?.ogImage, routeRules);
|
|
86
89
|
const src = getOgImagePath(ssrContext.url, routeRules);
|
|
87
90
|
createOgImageMeta(src, routeRules, nuxtApp.ssrContext);
|
|
88
91
|
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { NuxtSSRContext } from 'nuxt/app';
|
|
2
|
-
import type { OgImageOptions, OgImagePrebuilt } from '../types.js';
|
|
2
|
+
import type { OgImageOptions, OgImagePrebuilt, OgImageRuntimeConfig } from '../types.js';
|
|
3
3
|
export declare function setHeadOgImagePrebuilt(input: OgImagePrebuilt): void;
|
|
4
4
|
export declare function createOgImageMeta(src: string, input: OgImageOptions | OgImagePrebuilt, ssrContext: NuxtSSRContext): void;
|
|
5
5
|
export declare function resolveComponentName(component: OgImageOptions['component'], fallback: string): OgImageOptions['component'];
|
|
6
|
+
export declare function getOgImagePath(pagePath: string, _options?: Partial<OgImageOptions>): string;
|
|
7
|
+
export declare function useOgImageRuntimeConfig(): OgImageRuntimeConfig;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { useHead, useRuntimeConfig } from "#app";
|
|
1
2
|
import { componentNames } from "#build/nuxt-og-image/components.mjs";
|
|
2
|
-
import { useHead } from "#imports";
|
|
3
3
|
import { resolveUnrefHeadInput } from "@unhead/vue";
|
|
4
4
|
import { defu } from "defu";
|
|
5
5
|
import { stringify } from "devalue";
|
|
6
|
-
import { withQuery } from "ufo";
|
|
7
|
-
import { generateMeta, separateProps
|
|
6
|
+
import { joinURL, withQuery } from "ufo";
|
|
7
|
+
import { generateMeta, separateProps } from "../shared.js";
|
|
8
8
|
export function setHeadOgImagePrebuilt(input) {
|
|
9
9
|
if (import.meta.client) {
|
|
10
10
|
return;
|
|
@@ -33,9 +33,9 @@ export function createOgImageMeta(src, input, ssrContext) {
|
|
|
33
33
|
processTemplateParams: true,
|
|
34
34
|
innerHTML: () => {
|
|
35
35
|
const payload = resolveUnrefHeadInput(_input);
|
|
36
|
-
if (typeof payload.props.title === "undefined")
|
|
36
|
+
if (payload.props && typeof payload.props.title === "undefined")
|
|
37
37
|
payload.props.title = "%s";
|
|
38
|
-
payload.component = resolveComponentName(input.component, defaults.component);
|
|
38
|
+
payload.component = resolveComponentName(input.component, defaults.component || "");
|
|
39
39
|
delete payload.url;
|
|
40
40
|
if (payload._query && Object.keys(payload._query).length === 0) {
|
|
41
41
|
delete payload._query;
|
|
@@ -73,3 +73,21 @@ export function resolveComponentName(component, fallback) {
|
|
|
73
73
|
}
|
|
74
74
|
return component;
|
|
75
75
|
}
|
|
76
|
+
export function getOgImagePath(pagePath, _options) {
|
|
77
|
+
const baseURL = useRuntimeConfig().app.baseURL;
|
|
78
|
+
const extension = _options?.extension || useOgImageRuntimeConfig().defaults.extension;
|
|
79
|
+
const path = joinURL("/", baseURL, `__og-image__/${import.meta.prerender ? "static" : "image"}`, pagePath, `og.${extension}`);
|
|
80
|
+
if (Object.keys(_options?._query || {}).length) {
|
|
81
|
+
return withQuery(path, _options._query);
|
|
82
|
+
}
|
|
83
|
+
return path;
|
|
84
|
+
}
|
|
85
|
+
export function useOgImageRuntimeConfig() {
|
|
86
|
+
const c = useRuntimeConfig();
|
|
87
|
+
return {
|
|
88
|
+
...c["nuxt-og-image"],
|
|
89
|
+
app: {
|
|
90
|
+
baseURL: c.app.baseURL
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
@@ -11,14 +11,19 @@ export async function createBrowser() {
|
|
|
11
11
|
const logger = createConsola().withTag("Nuxt OG Image");
|
|
12
12
|
logger.info("Installing Chromium install for og:image generation...");
|
|
13
13
|
const installChromeProcess = execa("npx", ["playwright", "install", "chromium"], {
|
|
14
|
-
stdio: "
|
|
14
|
+
stdio: "pipe"
|
|
15
15
|
});
|
|
16
|
-
installChromeProcess.stderr
|
|
16
|
+
if (installChromeProcess.stderr) {
|
|
17
|
+
installChromeProcess.stderr.pipe(process.stderr);
|
|
18
|
+
}
|
|
19
|
+
if (installChromeProcess.stdout) {
|
|
20
|
+
installChromeProcess.stdout.pipe(process.stdout);
|
|
21
|
+
}
|
|
17
22
|
new Promise((resolve) => {
|
|
18
23
|
installChromeProcess.on("exit", (e) => {
|
|
19
24
|
if (e !== 0)
|
|
20
25
|
logger.error("Failed to install Playwright dependency for og:image generation. Trying anyway...");
|
|
21
|
-
resolve(
|
|
26
|
+
resolve();
|
|
22
27
|
});
|
|
23
28
|
}).then(() => {
|
|
24
29
|
installChromeProcess.kill();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { useNitroOrigin } from "#
|
|
1
|
+
import { useNitroOrigin } from "#site-config/server/composables";
|
|
2
2
|
import { joinURL, withQuery } from "ufo";
|
|
3
|
-
import {
|
|
3
|
+
import { toValue } from "vue";
|
|
4
|
+
import { useOgImageRuntimeConfig } from "../../utils.js";
|
|
4
5
|
export async function createScreenshot({ basePath, e, options, extension }, browser) {
|
|
5
6
|
const { colorPreference } = useOgImageRuntimeConfig();
|
|
6
7
|
const path = options.component === "PageScreenshot" ? basePath : joinURL("/__og-image__/image", basePath, `og.html`);
|
|
@@ -13,8 +14,8 @@ export async function createScreenshot({ basePath, e, options, extension }, brow
|
|
|
13
14
|
options.html = await e.$fetch(path).catch(() => void 0);
|
|
14
15
|
}
|
|
15
16
|
await page.setViewportSize({
|
|
16
|
-
width: options.width || 1200,
|
|
17
|
-
height: options.height || 630
|
|
17
|
+
width: toValue(options.width) || 1200,
|
|
18
|
+
height: toValue(options.height) || 630
|
|
18
19
|
});
|
|
19
20
|
if (options.html) {
|
|
20
21
|
const html = options.html;
|