nuxt-og-image 5.1.10 → 5.1.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/dist/client/200.html +1 -0
- package/dist/client/404.html +1 -0
- package/dist/client/_nuxt/B8PEiB0p.js +1 -0
- package/dist/client/_nuxt/CD9VIl4i.js +4062 -0
- package/dist/client/_nuxt/CI_lqgv7.js +1 -0
- package/dist/client/_nuxt/CVO1_9PV.js +1 -0
- package/dist/client/_nuxt/Cp-IABpG.js +1 -0
- package/dist/client/_nuxt/D0r3Knsf.js +1 -0
- package/dist/client/_nuxt/Dz8kdfgF.js +1 -0
- package/dist/client/_nuxt/builds/latest.json +1 -0
- package/dist/client/_nuxt/builds/meta/71b0f7ea-9aae-4c28-bbd9-8eea71b82dfb.json +1 -0
- package/dist/client/_nuxt/entry.DNM8P-MU.css +1 -0
- package/dist/client/_nuxt/error-404.C2mGI6Vt.css +1 -0
- package/dist/client/_nuxt/error-500.ClHbVBiL.css +1 -0
- package/dist/client/_nuxt/l5rcX3cq.js +8 -0
- package/dist/client/index.html +1 -0
- package/dist/content.cjs +22 -0
- package/dist/content.d.cts +46 -0
- package/dist/content.d.mts +46 -0
- package/dist/content.d.ts +46 -0
- package/dist/content.mjs +18 -0
- package/dist/module.cjs +1027 -0
- package/dist/module.d.cts +109 -0
- package/dist/module.d.mts +109 -0
- package/dist/module.d.ts +109 -0
- package/dist/module.json +12 -0
- package/dist/module.mjs +1007 -0
- package/dist/runtime/app/components/OgImage/OgImage.d.ts +3 -0
- package/dist/runtime/app/components/OgImage/OgImage.js +10 -0
- package/dist/runtime/app/components/OgImage/OgImageScreenshot.d.ts +3 -0
- package/dist/runtime/app/components/OgImage/OgImageScreenshot.js +10 -0
- package/dist/runtime/app/components/Templates/Community/BrandedLogo.d.vue.ts +13 -0
- package/dist/runtime/app/components/Templates/Community/BrandedLogo.vue +22 -0
- package/dist/runtime/app/components/Templates/Community/BrandedLogo.vue.d.ts +13 -0
- package/dist/runtime/app/components/Templates/Community/Frame.d.vue.ts +21 -0
- package/dist/runtime/app/components/Templates/Community/Frame.vue +58 -0
- package/dist/runtime/app/components/Templates/Community/Frame.vue.d.ts +21 -0
- package/dist/runtime/app/components/Templates/Community/Nuxt.d.vue.ts +12 -0
- package/dist/runtime/app/components/Templates/Community/Nuxt.vue +179 -0
- package/dist/runtime/app/components/Templates/Community/Nuxt.vue.d.ts +12 -0
- package/dist/runtime/app/components/Templates/Community/NuxtSeo.d.vue.ts +15 -0
- package/dist/runtime/app/components/Templates/Community/NuxtSeo.vue +103 -0
- package/dist/runtime/app/components/Templates/Community/NuxtSeo.vue.d.ts +15 -0
- package/dist/runtime/app/components/Templates/Community/Pergel.d.vue.ts +12 -0
- package/dist/runtime/app/components/Templates/Community/Pergel.vue +98 -0
- package/dist/runtime/app/components/Templates/Community/Pergel.vue.d.ts +12 -0
- package/dist/runtime/app/components/Templates/Community/SimpleBlog.d.vue.ts +9 -0
- package/dist/runtime/app/components/Templates/Community/SimpleBlog.vue +27 -0
- package/dist/runtime/app/components/Templates/Community/SimpleBlog.vue.d.ts +9 -0
- package/dist/runtime/app/components/Templates/Community/UnJs.d.vue.ts +21 -0
- package/dist/runtime/app/components/Templates/Community/UnJs.vue +99 -0
- package/dist/runtime/app/components/Templates/Community/UnJs.vue.d.ts +21 -0
- package/dist/runtime/app/components/Templates/Community/Wave.d.vue.ts +11 -0
- package/dist/runtime/app/components/Templates/Community/Wave.vue +28 -0
- package/dist/runtime/app/components/Templates/Community/Wave.vue.d.ts +11 -0
- package/dist/runtime/app/components/Templates/Community/WithEmoji.d.vue.ts +13 -0
- package/dist/runtime/app/components/Templates/Community/WithEmoji.vue +21 -0
- package/dist/runtime/app/components/Templates/Community/WithEmoji.vue.d.ts +13 -0
- package/dist/runtime/app/composables/defineOgImage.d.ts +2 -0
- package/dist/runtime/app/composables/defineOgImage.js +43 -0
- package/dist/runtime/app/composables/defineOgImageComponent.d.ts +3 -0
- package/dist/runtime/app/composables/defineOgImageComponent.js +8 -0
- package/dist/runtime/app/composables/defineOgImageScreenshot.d.ts +2 -0
- package/dist/runtime/app/composables/defineOgImageScreenshot.js +14 -0
- package/dist/runtime/app/composables/mock.d.ts +5 -0
- package/dist/runtime/app/composables/mock.js +20 -0
- package/dist/runtime/app/plugins/__zero-runtime/og-image-canonical-urls.server.d.ts +2 -0
- package/dist/runtime/app/plugins/__zero-runtime/og-image-canonical-urls.server.js +9 -0
- package/dist/runtime/app/plugins/__zero-runtime/route-rule-og-image.server.d.ts +2 -0
- package/dist/runtime/app/plugins/__zero-runtime/route-rule-og-image.server.js +9 -0
- package/dist/runtime/app/plugins/og-image-canonical-urls.server.d.ts +2 -0
- package/dist/runtime/app/plugins/og-image-canonical-urls.server.js +7 -0
- package/dist/runtime/app/plugins/route-rule-og-image.server.d.ts +2 -0
- package/dist/runtime/app/plugins/route-rule-og-image.server.js +7 -0
- package/dist/runtime/app/utils/plugins.d.ts +3 -0
- package/dist/runtime/app/utils/plugins.js +92 -0
- package/dist/runtime/app/utils.d.ts +7 -0
- package/dist/runtime/app/utils.js +94 -0
- package/dist/runtime/assets/Inter-normal-400.ttf.base64 +1 -0
- package/dist/runtime/assets/Inter-normal-700.ttf.base64 +1 -0
- package/dist/runtime/logger.d.ts +2 -0
- package/dist/runtime/logger.js +8 -0
- package/dist/runtime/mock/empty.d.ts +2 -0
- package/dist/runtime/mock/empty.js +2 -0
- package/dist/runtime/mock/proxy-cjs.d.ts +2 -0
- package/dist/runtime/mock/proxy-cjs.js +2 -0
- package/dist/runtime/server/og-image/bindings/chromium/chrome-launcher.d.ts +2 -0
- package/dist/runtime/server/og-image/bindings/chromium/chrome-launcher.js +9 -0
- package/dist/runtime/server/og-image/bindings/chromium/on-demand.d.ts +2 -0
- package/dist/runtime/server/og-image/bindings/chromium/on-demand.js +40 -0
- package/dist/runtime/server/og-image/bindings/chromium/playwright.d.ts +2 -0
- package/dist/runtime/server/og-image/bindings/chromium/playwright.js +6 -0
- package/dist/runtime/server/og-image/bindings/css-inline/node.d.ts +8 -0
- package/dist/runtime/server/og-image/bindings/css-inline/node.js +7 -0
- package/dist/runtime/server/og-image/bindings/css-inline/wasm-fs.d.ts +7 -0
- package/dist/runtime/server/og-image/bindings/css-inline/wasm-fs.js +8 -0
- package/dist/runtime/server/og-image/bindings/css-inline/wasm.d.ts +7 -0
- package/dist/runtime/server/og-image/bindings/css-inline/wasm.js +7 -0
- package/dist/runtime/server/og-image/bindings/resvg/node.d.ts +6 -0
- package/dist/runtime/server/og-image/bindings/resvg/node.js +5 -0
- package/dist/runtime/server/og-image/bindings/resvg/wasm-fs.d.ts +40 -0
- package/dist/runtime/server/og-image/bindings/resvg/wasm-fs.js +6 -0
- package/dist/runtime/server/og-image/bindings/resvg/wasm.d.ts +40 -0
- package/dist/runtime/server/og-image/bindings/resvg/wasm.js +5 -0
- package/dist/runtime/server/og-image/bindings/satori/node.d.ts +6 -0
- package/dist/runtime/server/og-image/bindings/satori/node.js +5 -0
- package/dist/runtime/server/og-image/bindings/satori/wasm-fs.d.ts +6 -0
- package/dist/runtime/server/og-image/bindings/satori/wasm-fs.js +13 -0
- package/dist/runtime/server/og-image/bindings/satori/wasm.d.ts +6 -0
- package/dist/runtime/server/og-image/bindings/satori/wasm.js +13 -0
- package/dist/runtime/server/og-image/bindings/sharp/node.d.ts +2 -0
- package/dist/runtime/server/og-image/bindings/sharp/node.js +2 -0
- package/dist/runtime/server/og-image/cache/lru.d.ts +9 -0
- package/dist/runtime/server/og-image/cache/lru.js +15 -0
- package/dist/runtime/server/og-image/cache/mock.d.ts +9 -0
- package/dist/runtime/server/og-image/cache/mock.js +9 -0
- package/dist/runtime/server/og-image/chromium/renderer.d.ts +3 -0
- package/dist/runtime/server/og-image/chromium/renderer.js +24 -0
- package/dist/runtime/server/og-image/chromium/screenshot.d.ts +4 -0
- package/dist/runtime/server/og-image/chromium/screenshot.js +54 -0
- package/dist/runtime/server/og-image/context.d.ts +5 -0
- package/dist/runtime/server/og-image/context.js +283 -0
- package/dist/runtime/server/og-image/instances.d.ts +2 -0
- package/dist/runtime/server/og-image/instances.js +10 -0
- package/dist/runtime/server/og-image/satori/font.d.ts +3 -0
- package/dist/runtime/server/og-image/satori/font.js +40 -0
- package/dist/runtime/server/og-image/satori/instances.d.ts +41 -0
- package/dist/runtime/server/og-image/satori/instances.js +23 -0
- package/dist/runtime/server/og-image/satori/plugins/classes.d.ts +2 -0
- package/dist/runtime/server/og-image/satori/plugins/classes.js +17 -0
- package/dist/runtime/server/og-image/satori/plugins/emojis.d.ts +2 -0
- package/dist/runtime/server/og-image/satori/plugins/emojis.js +28 -0
- package/dist/runtime/server/og-image/satori/plugins/encoding.d.ts +2 -0
- package/dist/runtime/server/og-image/satori/plugins/encoding.js +17 -0
- package/dist/runtime/server/og-image/satori/plugins/flex.d.ts +2 -0
- package/dist/runtime/server/og-image/satori/plugins/flex.js +60 -0
- package/dist/runtime/server/og-image/satori/plugins/imageSrc.d.ts +2 -0
- package/dist/runtime/server/og-image/satori/plugins/imageSrc.js +107 -0
- package/dist/runtime/server/og-image/satori/plugins/nuxt-icon.d.ts +2 -0
- package/dist/runtime/server/og-image/satori/plugins/nuxt-icon.js +20 -0
- package/dist/runtime/server/og-image/satori/plugins/unocss.d.ts +2 -0
- package/dist/runtime/server/og-image/satori/plugins/unocss.js +55 -0
- package/dist/runtime/server/og-image/satori/renderer.d.ts +4 -0
- package/dist/runtime/server/og-image/satori/renderer.js +123 -0
- package/dist/runtime/server/og-image/satori/transforms/emojis.d.ts +3 -0
- package/dist/runtime/server/og-image/satori/transforms/emojis.js +3595 -0
- package/dist/runtime/server/og-image/satori/transforms/inlineCss.d.ts +3 -0
- package/dist/runtime/server/og-image/satori/transforms/inlineCss.js +51 -0
- package/dist/runtime/server/og-image/satori/utils.d.ts +3 -0
- package/dist/runtime/server/og-image/satori/utils.js +24 -0
- package/dist/runtime/server/og-image/satori/vnodes.d.ts +2 -0
- package/dist/runtime/server/og-image/satori/vnodes.js +40 -0
- package/dist/runtime/server/og-image/templates/html.d.ts +2 -0
- package/dist/runtime/server/og-image/templates/html.js +112 -0
- package/dist/runtime/server/plugins/__zero-runtime/nuxt-content-v2.d.ts +2 -0
- package/dist/runtime/server/plugins/__zero-runtime/nuxt-content-v2.js +9 -0
- package/dist/runtime/server/plugins/nuxt-content-v2.d.ts +2 -0
- package/dist/runtime/server/plugins/nuxt-content-v2.js +5 -0
- package/dist/runtime/server/plugins/prerender.d.ts +2 -0
- package/dist/runtime/server/plugins/prerender.js +38 -0
- package/dist/runtime/server/routes/__zero-runtime/font.d.ts +2 -0
- package/dist/runtime/server/routes/__zero-runtime/font.js +8 -0
- package/dist/runtime/server/routes/__zero-runtime/image.d.ts +2 -0
- package/dist/runtime/server/routes/__zero-runtime/image.js +8 -0
- package/dist/runtime/server/routes/debug.json.d.ts +7 -0
- package/dist/runtime/server/routes/debug.json.js +15 -0
- package/dist/runtime/server/routes/font.d.ts +2 -0
- package/dist/runtime/server/routes/font.js +3 -0
- package/dist/runtime/server/routes/image.d.ts +2 -0
- package/dist/runtime/server/routes/image.js +3 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/runtime/server/util/cache.d.ts +10 -0
- package/dist/runtime/server/util/cache.js +74 -0
- package/dist/runtime/server/util/encoding.d.ts +3 -0
- package/dist/runtime/server/util/encoding.js +15 -0
- package/dist/runtime/server/util/eventHandlers.d.ts +3 -0
- package/dist/runtime/server/util/eventHandlers.js +156 -0
- package/dist/runtime/server/util/kit.d.ts +6 -0
- package/dist/runtime/server/util/kit.js +32 -0
- package/dist/runtime/server/util/logger.d.ts +1 -0
- package/dist/runtime/server/util/logger.js +6 -0
- package/dist/runtime/server/util/options.d.ts +2 -0
- package/dist/runtime/server/util/options.js +18 -0
- package/dist/runtime/server/util/plugins.d.ts +2 -0
- package/dist/runtime/server/util/plugins.js +56 -0
- package/dist/runtime/server/util/wasm.d.ts +2 -0
- package/dist/runtime/server/util/wasm.js +16 -0
- package/dist/runtime/server/utils.d.ts +4 -0
- package/dist/runtime/server/utils.js +20 -0
- package/dist/runtime/shared.d.ts +15 -0
- package/dist/runtime/shared.js +132 -0
- package/dist/runtime/types.d.ts +187 -0
- package/dist/runtime/types.js +0 -0
- package/dist/types.d.mts +9 -0
- package/package.json +32 -32
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { useRequestEvent } from "#app";
|
|
2
|
+
import { withSiteUrl } from "#site-config/app/composables";
|
|
3
|
+
import { TemplateParamsPlugin } from "@unhead/vue/plugins";
|
|
4
|
+
import { defu } from "defu";
|
|
5
|
+
import { parse, stringify } from "devalue";
|
|
6
|
+
import { createRouter as createRadixRouter, toRouteMatcher } from "radix3";
|
|
7
|
+
import { parseURL, withoutBase } from "ufo";
|
|
8
|
+
import { toValue } from "vue";
|
|
9
|
+
import { createOgImageMeta } from "../../app/utils.js";
|
|
10
|
+
import { isInternalRoute, separateProps } from "../../shared.js";
|
|
11
|
+
import { getOgImagePath } from "../utils.js";
|
|
12
|
+
export function ogImageCanonicalUrls(nuxtApp) {
|
|
13
|
+
nuxtApp.hooks.hook("app:rendered", async (ctx) => {
|
|
14
|
+
const { ssrContext } = ctx;
|
|
15
|
+
const e = useRequestEvent();
|
|
16
|
+
const path = parseURL(e?.path || "").pathname;
|
|
17
|
+
if (isInternalRoute(path))
|
|
18
|
+
return;
|
|
19
|
+
ssrContext?.head.use(TemplateParamsPlugin);
|
|
20
|
+
ssrContext?.head.use({
|
|
21
|
+
key: "nuxt-og-image:overrides-and-canonical-urls",
|
|
22
|
+
hooks: {
|
|
23
|
+
"tags:resolve": async (ctx2) => {
|
|
24
|
+
const hasPrimaryPayload = ctx2.tags.some((tag) => tag.tag === "script" && tag.props.id === "nuxt-og-image-options");
|
|
25
|
+
let overrides;
|
|
26
|
+
for (const tag of ctx2.tags) {
|
|
27
|
+
if (tag.tag === "script" && tag.props.id === "nuxt-og-image-overrides") {
|
|
28
|
+
if (hasPrimaryPayload) {
|
|
29
|
+
overrides = separateProps(parse(tag.innerHTML || "{}"));
|
|
30
|
+
delete ctx2.tags[ctx2.tags.indexOf(tag)];
|
|
31
|
+
} else {
|
|
32
|
+
tag.props.id = "nuxt-og-image-options";
|
|
33
|
+
tag.innerHTML = stringify(separateProps(parse(tag.innerHTML || "{}")));
|
|
34
|
+
tag._d = "script:id:nuxt-og-image-options";
|
|
35
|
+
}
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
ctx2.tags = ctx2.tags.filter(Boolean);
|
|
40
|
+
for (const tag of ctx2.tags) {
|
|
41
|
+
if (tag.tag === "meta" && (tag.props.property === "og:image" || ["twitter:image:src", "twitter:image"].includes(tag.props.name || ""))) {
|
|
42
|
+
if (!tag.props.content) {
|
|
43
|
+
tag.props = {};
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (!tag.props.content?.startsWith("https")) {
|
|
47
|
+
await nuxtApp.runWithContext(() => {
|
|
48
|
+
tag.props.content = toValue(withSiteUrl(tag.props.content || "", {
|
|
49
|
+
withBase: true
|
|
50
|
+
}));
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
} else if (overrides && tag.tag === "script" && tag.props.id === "nuxt-og-image-options") {
|
|
54
|
+
tag.innerHTML = stringify(defu(overrides, parse(tag.innerHTML || "{}")));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
export function routeRuleOgImage(nuxtApp) {
|
|
63
|
+
nuxtApp.hooks.hook("app:rendered", async (ctx) => {
|
|
64
|
+
const { ssrContext } = ctx;
|
|
65
|
+
const e = useRequestEvent();
|
|
66
|
+
const path = parseURL(e?.path || "").pathname;
|
|
67
|
+
if (isInternalRoute(path))
|
|
68
|
+
return;
|
|
69
|
+
const _routeRulesMatcher = toRouteMatcher(
|
|
70
|
+
createRadixRouter({ routes: ssrContext?.runtimeConfig?.nitro?.routeRules })
|
|
71
|
+
);
|
|
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;
|
|
77
|
+
if (typeof routeRules === "undefined")
|
|
78
|
+
return;
|
|
79
|
+
const ogImageInstances = nuxtApp.ssrContext._ogImageInstances || [];
|
|
80
|
+
if (routeRules === false) {
|
|
81
|
+
ogImageInstances?.forEach((e2) => {
|
|
82
|
+
e2.dispose();
|
|
83
|
+
});
|
|
84
|
+
nuxtApp.ssrContext._ogImagePayload = void 0;
|
|
85
|
+
nuxtApp.ssrContext._ogImageInstances = void 0;
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
routeRules = defu(nuxtApp.ssrContext?.event?.context._nitro?.routeRules?.ogImage, routeRules);
|
|
89
|
+
const src = getOgImagePath(ssrContext.url, routeRules);
|
|
90
|
+
createOgImageMeta(src, routeRules, nuxtApp.ssrContext);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NuxtSSRContext } from 'nuxt/app';
|
|
2
|
+
import type { OgImageOptions, OgImagePrebuilt, OgImageRuntimeConfig } from '../types.js';
|
|
3
|
+
export declare function setHeadOgImagePrebuilt(input: OgImagePrebuilt): void;
|
|
4
|
+
export declare function createOgImageMeta(src: string, input: OgImageOptions | OgImagePrebuilt, ssrContext: NuxtSSRContext): void;
|
|
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;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { componentNames } from "#build/nuxt-og-image/components.mjs";
|
|
2
|
+
import { resolveUnrefHeadInput } from "@unhead/vue";
|
|
3
|
+
import { defu } from "defu";
|
|
4
|
+
import { stringify } from "devalue";
|
|
5
|
+
import { useHead, useRuntimeConfig } from "nuxt/app";
|
|
6
|
+
import { joinURL, withQuery } from "ufo";
|
|
7
|
+
import { generateMeta, separateProps } from "../shared.js";
|
|
8
|
+
export function setHeadOgImagePrebuilt(input) {
|
|
9
|
+
if (import.meta.client) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const url = input.url;
|
|
13
|
+
if (!url)
|
|
14
|
+
return;
|
|
15
|
+
const meta = generateMeta(url, input);
|
|
16
|
+
useHead({ meta }, { tagPriority: "high" });
|
|
17
|
+
}
|
|
18
|
+
export function createOgImageMeta(src, input, ssrContext) {
|
|
19
|
+
if (import.meta.client) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const { defaults } = useOgImageRuntimeConfig();
|
|
23
|
+
const _input = separateProps(defu(input, ssrContext._ogImagePayload));
|
|
24
|
+
if (input._query && Object.keys(input._query).length)
|
|
25
|
+
src = withQuery(src, { _query: input._query });
|
|
26
|
+
const meta = generateMeta(src, input);
|
|
27
|
+
ssrContext._ogImageInstances = ssrContext._ogImageInstances || [];
|
|
28
|
+
const script = [];
|
|
29
|
+
if (src) {
|
|
30
|
+
script.push({
|
|
31
|
+
id: "nuxt-og-image-options",
|
|
32
|
+
type: "application/json",
|
|
33
|
+
processTemplateParams: true,
|
|
34
|
+
innerHTML: () => {
|
|
35
|
+
const payload = resolveUnrefHeadInput(_input);
|
|
36
|
+
if (payload.props && typeof payload.props.title === "undefined")
|
|
37
|
+
payload.props.title = "%s";
|
|
38
|
+
payload.component = resolveComponentName(input.component, defaults.component || "");
|
|
39
|
+
delete payload.url;
|
|
40
|
+
if (payload._query && Object.keys(payload._query).length === 0) {
|
|
41
|
+
delete payload._query;
|
|
42
|
+
}
|
|
43
|
+
const final = {};
|
|
44
|
+
for (const k in payload) {
|
|
45
|
+
if (payload[k] !== defaults[k]) {
|
|
46
|
+
final[k] = payload[k];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return stringify(final);
|
|
50
|
+
},
|
|
51
|
+
// we want this to be last in our head
|
|
52
|
+
tagPosition: "bodyClose"
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
const instance = useHead({
|
|
56
|
+
script,
|
|
57
|
+
meta
|
|
58
|
+
}, {
|
|
59
|
+
tagPriority: "high"
|
|
60
|
+
});
|
|
61
|
+
ssrContext._ogImagePayload = _input;
|
|
62
|
+
ssrContext._ogImageInstances.push(instance);
|
|
63
|
+
}
|
|
64
|
+
export function resolveComponentName(component, fallback) {
|
|
65
|
+
component = component || fallback || componentNames?.[0]?.pascalName;
|
|
66
|
+
if (component && componentNames) {
|
|
67
|
+
const originalName = component;
|
|
68
|
+
for (const component2 of componentNames) {
|
|
69
|
+
if (component2.pascalName.endsWith(originalName) || component2.kebabName.endsWith(originalName)) {
|
|
70
|
+
return component2.pascalName;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return component;
|
|
75
|
+
}
|
|
76
|
+
export function getOgImagePath(pagePath, _options) {
|
|
77
|
+
const baseURL = useRuntimeConfig().app.baseURL;
|
|
78
|
+
const extension = _options?.extension || useOgImageRuntimeConfig().defaults?.extension || "png";
|
|
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
|
+
defaults: {},
|
|
89
|
+
...c["nuxt-og-image"],
|
|
90
|
+
app: {
|
|
91
|
+
baseURL: c.app.baseURL
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|