nuxt-og-image 2.0.28 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/200.html +5 -5
- package/dist/client/404.html +5 -5
- package/dist/client/_nuxt/{IconCSS.d3e12840.js → IconCSS.cacabbab.js} +1 -1
- package/dist/client/_nuxt/{ImageLoader.ad92439f.js → ImageLoader.d1e647a8.js} +1 -1
- package/dist/client/_nuxt/entry.4bb8901d.js +135 -0
- package/dist/client/_nuxt/entry.53a0fc2f.css +1 -0
- package/dist/client/_nuxt/{error-404.95b4b668.js → error-404.d3cf3af1.js} +1 -1
- package/dist/client/_nuxt/{error-500.d22f8b54.js → error-500.6d5569a5.js} +1 -1
- package/dist/client/_nuxt/{index.f2702f88.js → index.ddad1278.js} +1 -1
- package/dist/client/_nuxt/{options.ddf310be.js → options.fab4cd78.js} +1 -1
- package/dist/client/_nuxt/{png.51e9bf00.js → png.8b9dc853.js} +1 -1
- package/dist/client/_nuxt/{shiki.721a43ba.js → shiki.704b4c6f.js} +1 -1
- package/dist/client/_nuxt/{svg.f31a00cf.js → svg.3f7376fc.js} +1 -1
- package/dist/client/_nuxt/{vnodes.89b4b57e.js → vnodes.17fcf779.js} +1 -1
- package/dist/client/index.html +5 -5
- package/dist/client/options/index.html +5 -5
- package/dist/client/png/index.html +5 -5
- package/dist/client/svg/index.html +5 -5
- package/dist/client/vnodes/index.html +5 -5
- package/dist/module.d.mts +1 -1
- package/dist/module.d.ts +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +14 -10
- package/dist/runtime/components/OgImageTemplate/Fallback.vue +6 -0
- package/dist/runtime/nitro/routes/html.mjs +6 -2
- package/dist/runtime/nitro/utils-pure.mjs +1 -1
- package/package.json +23 -23
- package/dist/client/_nuxt/entry.00dd4948.js +0 -136
- package/dist/client/_nuxt/entry.0b89ffd3.css +0 -1
- /package/dist/runtime/nitro/providers/css-inline/{node.d.ts → css-inline.d.ts} +0 -0
- /package/dist/runtime/nitro/providers/css-inline/{node.mjs → css-inline.mjs} +0 -0
package/dist/module.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ interface RuntimeCompatibilitySchema {
|
|
|
49
49
|
satori: false | 'default' | 'yoga-wasm';
|
|
50
50
|
wasm: 'inline' | 'import' | 'fetch';
|
|
51
51
|
png: 'resvg-wasm' | 'svg2png' | 'resvg-node';
|
|
52
|
-
cssInline?:
|
|
52
|
+
cssInline?: boolean;
|
|
53
53
|
node?: boolean;
|
|
54
54
|
wasmImportQuery?: string;
|
|
55
55
|
}
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { execa } from 'execa';
|
|
|
6
6
|
import chalk from 'chalk';
|
|
7
7
|
import defu$1, { defu } from 'defu';
|
|
8
8
|
import { toRouteMatcher, createRouter } from 'radix3';
|
|
9
|
-
import { withBase, joinURL } from 'ufo';
|
|
9
|
+
import { withBase, parsePath, joinURL } from 'ufo';
|
|
10
10
|
import { resolve, relative, dirname } from 'pathe';
|
|
11
11
|
import { tinyws } from 'tinyws';
|
|
12
12
|
import sirv from 'sirv';
|
|
@@ -21,7 +21,7 @@ import { createBirpcGroup } from 'birpc';
|
|
|
21
21
|
import { stringify, parse } from 'flatted';
|
|
22
22
|
import { addDependency } from 'nypm';
|
|
23
23
|
|
|
24
|
-
const version = "2.0
|
|
24
|
+
const version = "2.1.0";
|
|
25
25
|
|
|
26
26
|
async function createBrowser() {
|
|
27
27
|
if (process.dev || process.env.prerender) {
|
|
@@ -192,7 +192,7 @@ function decodeObjectHtmlEntities(obj) {
|
|
|
192
192
|
return obj;
|
|
193
193
|
}
|
|
194
194
|
function extractAndNormaliseOgImageOptions(path, html, routeRules, defaults) {
|
|
195
|
-
const htmlPayload = html.match(/<script
|
|
195
|
+
const htmlPayload = html.match(/<script.+id="nuxt-og-image-options"[^>]*>(.+?)<\/script>/)?.[1];
|
|
196
196
|
if (!htmlPayload)
|
|
197
197
|
return false;
|
|
198
198
|
let options;
|
|
@@ -252,7 +252,8 @@ const DefaultRuntimeCompatibility = {
|
|
|
252
252
|
satori: "default",
|
|
253
253
|
wasm: "fetch",
|
|
254
254
|
png: "resvg-node",
|
|
255
|
-
node: true
|
|
255
|
+
node: true,
|
|
256
|
+
cssInline: true
|
|
256
257
|
};
|
|
257
258
|
const cloudflare = {
|
|
258
259
|
browser: false,
|
|
@@ -629,6 +630,11 @@ declare module 'nitropack' {
|
|
|
629
630
|
nitroConfig.publicAssets.push({ dir, maxAge: 31536e3 });
|
|
630
631
|
});
|
|
631
632
|
const providerPath = `${runtimeDir}/nitro/providers`;
|
|
633
|
+
nitroConfig.virtual["#nuxt-og-image/css-inline"] = `import cssInline from '${providerPath}/css-inline/${nitroCompatibility.cssInline ? "css-inline" : "mock"}'
|
|
634
|
+
export default function() {
|
|
635
|
+
return cssInline
|
|
636
|
+
}
|
|
637
|
+
`;
|
|
632
638
|
if (config.runtimeBrowser) {
|
|
633
639
|
nitroConfig.virtual["#nuxt-og-image/browser"] = `
|
|
634
640
|
let browser
|
|
@@ -647,11 +653,6 @@ export default function() {
|
|
|
647
653
|
export default function() {
|
|
648
654
|
return png
|
|
649
655
|
}
|
|
650
|
-
`;
|
|
651
|
-
nitroConfig.virtual["#nuxt-og-image/css-inline"] = `import cssInline from '${providerPath}/css-inline/${nitroCompatibility.cssInline || "mock"}'
|
|
652
|
-
export default function() {
|
|
653
|
-
return cssInline
|
|
654
|
-
}
|
|
655
656
|
`;
|
|
656
657
|
}
|
|
657
658
|
nitroConfig.virtual["#nuxt-og-image/provider"] = `
|
|
@@ -717,10 +718,13 @@ export async function useProvider(provider) {
|
|
|
717
718
|
return;
|
|
718
719
|
const isPageScreenshot = extractedOptions.component === "PageScreenshot";
|
|
719
720
|
const entry = {
|
|
720
|
-
route: ctx.route,
|
|
721
|
+
route: parsePath(ctx.route).pathname,
|
|
722
|
+
// drop hash and query
|
|
721
723
|
path: !isPageScreenshot ? `/api/og-image-html?path=${ctx.route}` : ctx.route,
|
|
722
724
|
...extractedOptions
|
|
723
725
|
};
|
|
726
|
+
if (screenshotQueue.some((r) => r.route === entry.route))
|
|
727
|
+
return;
|
|
724
728
|
if ((nuxt.options._generate || entry.cache) && entry.provider === "browser")
|
|
725
729
|
screenshotQueue.push(entry);
|
|
726
730
|
});
|
|
@@ -127,6 +127,12 @@ const siteLogo = computed(() => {
|
|
|
127
127
|
})
|
|
128
128
|
|
|
129
129
|
const MaybeIconComponent = resolveComponent('Icon')
|
|
130
|
+
if (typeof props.icon === 'string' && typeof MaybeIconComponent === 'string' && process.dev) {
|
|
131
|
+
// eslint-disable-next-line no-console
|
|
132
|
+
console.warn('Please install `nuxt-icon` to use icons with the fallback OG Image component.')
|
|
133
|
+
// eslint-disable-next-line no-console
|
|
134
|
+
console.log('npm add -D nuxt-icon')
|
|
135
|
+
}
|
|
130
136
|
</script>
|
|
131
137
|
|
|
132
138
|
<template>
|
|
@@ -4,7 +4,7 @@ import { createHeadCore } from "@unhead/vue";
|
|
|
4
4
|
import { createError, defineEventHandler, getQuery, sendRedirect } from "h3";
|
|
5
5
|
import { hash } from "ohash";
|
|
6
6
|
import twemoji from "twemoji";
|
|
7
|
-
import {
|
|
7
|
+
import { createDefu } from "defu";
|
|
8
8
|
import { fetchOptionsCached } from "../utils.mjs";
|
|
9
9
|
import { useNitroOrigin, useRuntimeConfig } from "#imports";
|
|
10
10
|
import loadCSSInline from "#nuxt-og-image/css-inline";
|
|
@@ -23,8 +23,12 @@ export default defineEventHandler(async (e) => {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
let options = await fetchOptionsCached(e, path);
|
|
26
|
+
const merger = createDefu((object, key, value) => {
|
|
27
|
+
if (Array.isArray(value))
|
|
28
|
+
return value;
|
|
29
|
+
});
|
|
26
30
|
if (queryOptions)
|
|
27
|
-
options =
|
|
31
|
+
options = merger(queryOptions, options);
|
|
28
32
|
if (options.provider === "browser" && options.component === "PageScreenshot") {
|
|
29
33
|
const pathWithoutBase = path.replace(new RegExp(`^${useRuntimeConfig().app.baseURL}`), "");
|
|
30
34
|
return sendRedirect(e, withBase(pathWithoutBase, nitroOrigin));
|
|
@@ -12,7 +12,7 @@ function decodeObjectHtmlEntities(obj) {
|
|
|
12
12
|
return obj;
|
|
13
13
|
}
|
|
14
14
|
export function extractAndNormaliseOgImageOptions(path, html, routeRules, defaults) {
|
|
15
|
-
const htmlPayload = html.match(/<script
|
|
15
|
+
const htmlPayload = html.match(/<script.+id="nuxt-og-image-options"[^>]*>(.+?)<\/script>/)?.[1];
|
|
16
16
|
if (!htmlPayload)
|
|
17
17
|
return false;
|
|
18
18
|
let options;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-og-image",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0
|
|
5
|
-
"packageManager": "pnpm@8.
|
|
4
|
+
"version": "2.1.0",
|
|
5
|
+
"packageManager": "pnpm@8.8.0",
|
|
6
6
|
"description": "Enlightened OG Image generation for Nuxt.",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"funding": "https://github.com/sponsors/harlan-zw",
|
|
@@ -27,31 +27,31 @@
|
|
|
27
27
|
"dist"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@nuxt/kit": "^3.7.
|
|
30
|
+
"@nuxt/kit": "^3.7.4",
|
|
31
31
|
"@resvg/resvg-js": "^2.4.1",
|
|
32
32
|
"@resvg/resvg-wasm": "^2.4.1",
|
|
33
|
-
"@types/fs-extra": "^11.0.
|
|
33
|
+
"@types/fs-extra": "^11.0.2",
|
|
34
34
|
"birpc": "0.2.14",
|
|
35
35
|
"chalk": "^5.3.0",
|
|
36
|
-
"chrome-launcher": "^1.
|
|
37
|
-
"css-inline": "^0.
|
|
36
|
+
"chrome-launcher": "^1.1.0",
|
|
37
|
+
"css-inline": "^0.11.0",
|
|
38
38
|
"defu": "^6.1.2",
|
|
39
39
|
"execa": "^8.0.1",
|
|
40
40
|
"fast-glob": "^3.3.1",
|
|
41
|
-
"flatted": "^3.2.
|
|
41
|
+
"flatted": "^3.2.9",
|
|
42
42
|
"fs-extra": "^11.1.1",
|
|
43
43
|
"globby": "^13.2.2",
|
|
44
44
|
"image-size": "^1.0.2",
|
|
45
45
|
"launch-editor": "^2.6.0",
|
|
46
|
-
"nuxt-site-config": "^1.
|
|
47
|
-
"nuxt-site-config-kit": "^1.
|
|
46
|
+
"nuxt-site-config": "^1.4.0",
|
|
47
|
+
"nuxt-site-config-kit": "^1.4.0",
|
|
48
48
|
"nypm": "^0.3.3",
|
|
49
49
|
"ofetch": "^1.3.3",
|
|
50
50
|
"ohash": "^1.1.3",
|
|
51
51
|
"pathe": "^1.1.1",
|
|
52
|
-
"playwright-core": "^1.38.
|
|
52
|
+
"playwright-core": "^1.38.1",
|
|
53
53
|
"radix3": "^1.1.0",
|
|
54
|
-
"satori": "0.10.
|
|
54
|
+
"satori": "0.10.8",
|
|
55
55
|
"satori-html": "^0.3.2",
|
|
56
56
|
"sirv": "^2.0.3",
|
|
57
57
|
"std-env": "^3.4.3",
|
|
@@ -59,25 +59,25 @@
|
|
|
59
59
|
"terminate": "^2.6.1",
|
|
60
60
|
"tinyws": "^0.1.0",
|
|
61
61
|
"twemoji": "^14.0.2",
|
|
62
|
-
"ufo": "^1.3.
|
|
63
|
-
"ws": "^8.14.
|
|
62
|
+
"ufo": "^1.3.1",
|
|
63
|
+
"ws": "^8.14.2",
|
|
64
64
|
"yoga-wasm-web": "^0.3.3"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@antfu/eslint-config": "
|
|
68
|
-
"@nuxt/devtools": "0.
|
|
69
|
-
"@nuxt/module-builder": "^0.5.
|
|
70
|
-
"@nuxt/test-utils": "3.7.
|
|
67
|
+
"@antfu/eslint-config": "1.0.0-beta.18",
|
|
68
|
+
"@nuxt/devtools": "1.0.0-beta.0",
|
|
69
|
+
"@nuxt/module-builder": "^0.5.2",
|
|
70
|
+
"@nuxt/test-utils": "3.7.4",
|
|
71
71
|
"@nuxtjs/eslint-config-typescript": "^12.1.0",
|
|
72
|
-
"@types/ws": "^8.5.
|
|
72
|
+
"@types/ws": "^8.5.6",
|
|
73
73
|
"bumpp": "^9.2.0",
|
|
74
|
-
"eslint": "8.
|
|
74
|
+
"eslint": "8.50.0",
|
|
75
75
|
"jest-image-snapshot": "^6.2.0",
|
|
76
|
-
"nuxt": "^3.7.
|
|
76
|
+
"nuxt": "^3.7.4",
|
|
77
77
|
"nuxt-icon": "^0.5.0",
|
|
78
|
-
"playwright": "^1.38.
|
|
79
|
-
"sass": "^1.
|
|
80
|
-
"vitest": "^0.34.
|
|
78
|
+
"playwright": "^1.38.1",
|
|
79
|
+
"sass": "^1.68.0",
|
|
80
|
+
"vitest": "^0.34.6"
|
|
81
81
|
},
|
|
82
82
|
"scripts": {
|
|
83
83
|
"build": "pnpm dev:prepare && pnpm build:module && pnpm build:client",
|