nuxt-og-image 6.10.0 → 6.10.1
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/chunks/tw4.mjs +1 -1
- package/dist/chunks/uno.mjs +2 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/app/client-utils.js +6 -3
- package/dist/runtime/app/utils/plugins.js +2 -2
- package/dist/runtime/app/utils.js +7 -3
- package/dist/runtime/logger.d.ts +0 -1
- package/dist/runtime/logger.js +0 -2
- package/dist/runtime/server/og-image/bindings/font-assets/dev-prerender.js +9 -1
- package/dist/runtime/shared.js +0 -5
- package/dist/shared/{nuxt-og-image.DWcVJOVy.mjs → nuxt-og-image.Bcegsloy.mjs} +1 -0
- package/package.json +2 -1
package/dist/chunks/tw4.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { readFile } from 'node:fs/promises';
|
|
|
2
2
|
import { pathToFileURL } from 'node:url';
|
|
3
3
|
import { resolveModulePath } from 'exsolve';
|
|
4
4
|
import { dirname, join } from 'pathe';
|
|
5
|
-
import { e as extractVariantBaseClasses, r as resolveVariantPrefixes, h as resolveExtractedVars, l as resolveVarsDeep, s as simplifyCss, p as postProcessStyles, m as loadLightningCss, a as extractCssVars, c as extractUniversalVars, d as extractPerClassVars, g as extractVarsFromCss, f as extractClassStyles } from '../shared/nuxt-og-image.
|
|
5
|
+
import { e as extractVariantBaseClasses, r as resolveVariantPrefixes, h as resolveExtractedVars, l as resolveVarsDeep, s as simplifyCss, p as postProcessStyles, m as loadLightningCss, a as extractCssVars, c as extractUniversalVars, d as extractPerClassVars, g as extractVarsFromCss, f as extractClassStyles } from '../shared/nuxt-og-image.Bcegsloy.mjs';
|
|
6
6
|
import 'node:crypto';
|
|
7
7
|
import 'node:fs';
|
|
8
8
|
import '@nuxt/kit';
|
package/dist/chunks/uno.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
2
|
import { defu } from 'defu';
|
|
3
3
|
import { logger } from '../../dist/runtime/logger.js';
|
|
4
|
-
import { e as extractVariantBaseClasses, s as simplifyCss, a as extractCssVars, b as extractPropertyInitialValues, c as extractUniversalVars, d as extractPerClassVars, f as extractClassStyles, p as postProcessStyles, r as resolveVariantPrefixes, i as importOptionalPeer, g as extractVarsFromCss, h as resolveExtractedVars } from '../shared/nuxt-og-image.
|
|
5
|
-
export { j as importResolvedModule, k as resolveOptionalModulePath } from '../shared/nuxt-og-image.
|
|
4
|
+
import { e as extractVariantBaseClasses, s as simplifyCss, a as extractCssVars, b as extractPropertyInitialValues, c as extractUniversalVars, d as extractPerClassVars, f as extractClassStyles, p as postProcessStyles, r as resolveVariantPrefixes, i as importOptionalPeer, g as extractVarsFromCss, h as resolveExtractedVars } from '../shared/nuxt-og-image.Bcegsloy.mjs';
|
|
5
|
+
export { j as importResolvedModule, k as resolveOptionalModulePath } from '../shared/nuxt-og-image.Bcegsloy.mjs';
|
|
6
6
|
import 'node:crypto';
|
|
7
7
|
import 'node:fs';
|
|
8
8
|
import 'node:url';
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import 'nuxt-site-config/kit';
|
|
|
9
9
|
import 'nuxtseo-shared/kit';
|
|
10
10
|
import 'pathe';
|
|
11
11
|
import 'pkg-types';
|
|
12
|
-
export { n as default } from './shared/nuxt-og-image.
|
|
12
|
+
export { n as default } from './shared/nuxt-og-image.Bcegsloy.mjs';
|
|
13
13
|
import '../dist/runtime/logger.js';
|
|
14
14
|
import 'magic-string';
|
|
15
15
|
import 'oxc-walker';
|
|
@@ -3,6 +3,7 @@ import { injectHead, useHead, useRuntimeConfig } from "nuxt/app";
|
|
|
3
3
|
import { joinURL, withQuery } from "ufo";
|
|
4
4
|
import { toValue } from "vue";
|
|
5
5
|
import { componentNames } from "#build/nuxt-og-image/components.mjs";
|
|
6
|
+
import { createSitePathResolver } from "#site-config/app/composables/utils";
|
|
6
7
|
import { buildOgImageUrl, generateMeta, separateProps } from "../shared.js";
|
|
7
8
|
const clientEntriesByHead = /* @__PURE__ */ new WeakMap();
|
|
8
9
|
function registerClientOgHead(ogKey, input, options) {
|
|
@@ -61,6 +62,7 @@ export function clientProcessOgImageOptions(input, route, basePath) {
|
|
|
61
62
|
const inputs = Array.isArray(input) ? input : [input];
|
|
62
63
|
const rc = useRuntimeConfig();
|
|
63
64
|
const baseURL = rc.app.baseURL;
|
|
65
|
+
const resolveImageUrl = createSitePathResolver({ absolute: true, withBase: true, canonical: false });
|
|
64
66
|
const publicCfg = rc.public?.["nuxt-og-image"] || {};
|
|
65
67
|
const defaults = publicCfg.defaults || {};
|
|
66
68
|
const metaOptions = { includeTwitter: publicCfg.includeTwitter };
|
|
@@ -79,13 +81,14 @@ export function clientProcessOgImageOptions(input, route, basePath) {
|
|
|
79
81
|
const ogKey = validOptions.key || "og";
|
|
80
82
|
if (validOptions.url) {
|
|
81
83
|
const url = validOptions.url;
|
|
82
|
-
|
|
84
|
+
const absoluteUrl = /^https?:\/\//.test(url) ? url : toValue(resolveImageUrl(url));
|
|
85
|
+
registerClientOgHead(ogKey, { meta: generateMeta(absoluteUrl, validOptions, metaOptions) }, { tagPriority: "high" });
|
|
83
86
|
paths.push(url);
|
|
84
87
|
continue;
|
|
85
88
|
}
|
|
86
89
|
if (publicCfg.hasServerRuntime) {
|
|
87
90
|
const finalUrl2 = buildResolverUrl(baseURL, basePath, ogKey, route.query);
|
|
88
|
-
registerClientOgHead(ogKey, { meta: generateMeta(finalUrl2, validOptions, metaOptions) }, { tagPriority:
|
|
91
|
+
registerClientOgHead(ogKey, { meta: generateMeta(toValue(resolveImageUrl(finalUrl2)), validOptions, metaOptions) }, { tagPriority: "high" });
|
|
89
92
|
paths.push(finalUrl2);
|
|
90
93
|
continue;
|
|
91
94
|
}
|
|
@@ -99,7 +102,7 @@ export function clientProcessOgImageOptions(input, route, basePath) {
|
|
|
99
102
|
const result = buildOgImageUrl(urlOpts, extension, true, defaults, void 0);
|
|
100
103
|
const resolvedUrl = joinURL("/", baseURL, result.url);
|
|
101
104
|
const finalUrl = opts._query && Object.keys(opts._query).length ? withQuery(resolvedUrl, { _query: opts._query }) : resolvedUrl;
|
|
102
|
-
registerClientOgHead(ogKey, { meta: generateMeta(finalUrl, opts, metaOptions) }, { processTemplateParams: true, tagPriority:
|
|
105
|
+
registerClientOgHead(ogKey, { meta: generateMeta(toValue(resolveImageUrl(finalUrl)), opts, metaOptions) }, { processTemplateParams: true, tagPriority: "high" });
|
|
103
106
|
paths.push(finalUrl);
|
|
104
107
|
}
|
|
105
108
|
return paths;
|
|
@@ -32,13 +32,13 @@ export const ogImageCanonicalUrls = defineNuxtPlugin((nuxtApp) => {
|
|
|
32
32
|
break;
|
|
33
33
|
}
|
|
34
34
|
for (const tag of ctx2.tags) {
|
|
35
|
-
if (tag.tag === "meta" && (tag.props.property === "og:image" ||
|
|
35
|
+
if (tag.tag === "meta" && (tag.props.property === "og:image" || tag.props.name === "twitter:image")) {
|
|
36
36
|
if (!tag.props.content) {
|
|
37
37
|
tag.props = {};
|
|
38
38
|
continue;
|
|
39
39
|
}
|
|
40
40
|
tag.props.content = tag.props.content.replaceAll("%title", title).replaceAll("%description", description).replaceAll(" ", "+");
|
|
41
|
-
if (
|
|
41
|
+
if (!/^https?:\/\//.test(tag.props.content || "")) {
|
|
42
42
|
nuxtApp.runWithContext(() => {
|
|
43
43
|
tag.props.content = toValue(withSiteUrl(tag.props.content || "", {
|
|
44
44
|
withBase: true,
|
|
@@ -4,6 +4,7 @@ import { useHead, useRequestEvent, useRuntimeConfig } from "nuxt/app";
|
|
|
4
4
|
import { joinURL, withQuery } from "ufo";
|
|
5
5
|
import { isRef, toValue } from "vue";
|
|
6
6
|
import { componentNames } from "#build/nuxt-og-image/components.mjs";
|
|
7
|
+
import { createSitePathResolver, withSiteUrl } from "#site-config/app/composables/utils";
|
|
7
8
|
import { buildOgImageUrl, generateMeta, separateProps } from "../shared.js";
|
|
8
9
|
function resolveUnrefHeadInput(input) {
|
|
9
10
|
if (input == null)
|
|
@@ -54,7 +55,9 @@ export function setHeadOgImagePrebuilt(input) {
|
|
|
54
55
|
if (!url)
|
|
55
56
|
return;
|
|
56
57
|
const { includeTwitter } = useOgImageRuntimeConfig();
|
|
57
|
-
const
|
|
58
|
+
const urlValue = toValue(url);
|
|
59
|
+
const absoluteUrl = /^https?:\/\//.test(urlValue) ? urlValue : toValue(withSiteUrl(urlValue, { withBase: true, canonical: !import.meta.dev }));
|
|
60
|
+
const meta = generateMeta(absoluteUrl, input, { includeTwitter });
|
|
58
61
|
useHead({ meta }, { tagPriority: "high" });
|
|
59
62
|
}
|
|
60
63
|
export function createOgImageMeta(src, input, ssrContext, pagePath, head) {
|
|
@@ -77,6 +80,7 @@ export function createOgImageMeta(src, input, ssrContext, pagePath, head) {
|
|
|
77
80
|
payloads[currentPayloadIdx] = [resolvedOptions.key, _input, basePath];
|
|
78
81
|
}
|
|
79
82
|
const baseURL = useRuntimeConfig().app.baseURL;
|
|
83
|
+
const resolveImageUrl = createSitePathResolver({ absolute: true, withBase: true, canonical: !import.meta.dev });
|
|
80
84
|
ssrContext._ogImageInstance?.dispose();
|
|
81
85
|
ssrContext._ogImageInstance = useHead({
|
|
82
86
|
// Meta is generated lazily so that title/description from useSeoMeta / useHead
|
|
@@ -118,12 +122,12 @@ export function createOgImageMeta(src, input, ssrContext, pagePath, head) {
|
|
|
118
122
|
prerenderPaths.set(ogKey, (finalUrl.split("?")[0] || finalUrl).replace(/,/g, "%2C"));
|
|
119
123
|
}
|
|
120
124
|
}
|
|
121
|
-
return generateMeta(finalUrl, opts, { includeTwitter: ogImageConfig.includeTwitter });
|
|
125
|
+
return generateMeta(toValue(resolveImageUrl(finalUrl)), opts, { includeTwitter: ogImageConfig.includeTwitter });
|
|
122
126
|
});
|
|
123
127
|
}
|
|
124
128
|
}, {
|
|
125
129
|
processTemplateParams: true,
|
|
126
|
-
tagPriority:
|
|
130
|
+
tagPriority: "high"
|
|
127
131
|
});
|
|
128
132
|
if (import.meta.dev || import.meta.prerender) {
|
|
129
133
|
ssrContext._ogImageDevtoolsInstance?.dispose();
|
package/dist/runtime/logger.d.ts
CHANGED
package/dist/runtime/logger.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { join } from "pathe";
|
|
2
|
+
import { basename, join } from "pathe";
|
|
3
3
|
import { withBase } from "ufo";
|
|
4
4
|
import { getRequestURL } from "#nuxtseo/h3";
|
|
5
5
|
import { fetchWithEvent, useRuntimeConfig } from "#nuxtseo/nitro";
|
|
@@ -40,6 +40,14 @@ export async function resolve(event, font) {
|
|
|
40
40
|
}
|
|
41
41
|
if (path && (isDataFontUrl(path) || isExternalFontUrl(path)))
|
|
42
42
|
return fetchSpecialFontUrl(path, getSiteConfig(event).url, timeout);
|
|
43
|
+
if ((import.meta.dev || import.meta.prerender) && path.startsWith("/_fonts/")) {
|
|
44
|
+
const filename = path.slice("/_fonts/".length);
|
|
45
|
+
if (filename && basename(filename) === filename) {
|
|
46
|
+
const cached = await readOptionalFile(join(buildDir, "cache", "fonts", filename));
|
|
47
|
+
if (cached?.length)
|
|
48
|
+
return cached;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
43
51
|
if (import.meta.prerender) {
|
|
44
52
|
if (path.startsWith("/_og-static-fonts/")) {
|
|
45
53
|
const filename2 = path.slice("/_og-static-fonts/".length);
|
package/dist/runtime/shared.js
CHANGED
|
@@ -11,7 +11,6 @@ export function generateMeta(url, resolvedOptions, metaOptions = {}) {
|
|
|
11
11
|
if (includeTwitter) {
|
|
12
12
|
meta.push({ name: "twitter:card", content: "summary_large_image" });
|
|
13
13
|
meta.push({ name: "twitter:image", content: url });
|
|
14
|
-
meta.push({ name: "twitter:image:src", content: url });
|
|
15
14
|
}
|
|
16
15
|
if (!isTwitterOnly) {
|
|
17
16
|
meta.push({ property: "og:image", content: url });
|
|
@@ -20,14 +19,10 @@ export function generateMeta(url, resolvedOptions, metaOptions = {}) {
|
|
|
20
19
|
if (resolvedOptions.width) {
|
|
21
20
|
if (!isTwitterOnly)
|
|
22
21
|
meta.push({ property: "og:image:width", content: resolvedOptions.width });
|
|
23
|
-
if (includeTwitter)
|
|
24
|
-
meta.push({ name: "twitter:image:width", content: resolvedOptions.width });
|
|
25
22
|
}
|
|
26
23
|
if (resolvedOptions.height) {
|
|
27
24
|
if (!isTwitterOnly)
|
|
28
25
|
meta.push({ property: "og:image:height", content: resolvedOptions.height });
|
|
29
|
-
if (includeTwitter)
|
|
30
|
-
meta.push({ name: "twitter:image:height", content: resolvedOptions.height });
|
|
31
26
|
}
|
|
32
27
|
if (resolvedOptions.alt) {
|
|
33
28
|
if (!isTwitterOnly)
|
|
@@ -5996,6 +5996,7 @@ export function getIslandHash({ name, props, context, source }) {
|
|
|
5996
5996
|
};
|
|
5997
5997
|
nuxt.options.nitro.publicAssets ||= [];
|
|
5998
5998
|
const staticFontCacheDir = getStaticFontCacheDir(nuxt.options.buildDir);
|
|
5999
|
+
await mkdir(staticFontCacheDir, { recursive: true });
|
|
5999
6000
|
nuxt.options.nitro.publicAssets.push({
|
|
6000
6001
|
dir: staticFontCacheDir,
|
|
6001
6002
|
baseURL: "/_og-static-fonts",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-og-image",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "6.10.
|
|
4
|
+
"version": "6.10.1",
|
|
5
5
|
"description": "Enlightened OG Image generation for Nuxt.",
|
|
6
6
|
"author": {
|
|
7
7
|
"website": "https://harlanzw.com",
|
|
@@ -209,6 +209,7 @@
|
|
|
209
209
|
"unifont": "^1.0.2",
|
|
210
210
|
"unifont-v0-7": "npm:unifont@0.7.0",
|
|
211
211
|
"unocss": "^66.10.5",
|
|
212
|
+
"vite": "8.3.0",
|
|
212
213
|
"vitest": "^5.0.2",
|
|
213
214
|
"vue": "^3.5.43",
|
|
214
215
|
"vue-tsc": "^3.3.11",
|