nuxt-og-image 5.1.4 → 5.1.6
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 +8 -8
- package/dist/client/404.html +8 -8
- package/dist/client/_nuxt/Bi6Y3qqE.js +4017 -0
- package/dist/client/_nuxt/{DriqWBeb.js → TAjbzagq.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/0f0cd98d-a6ee-47bf-a7c6-e295b96f29b9.json +1 -0
- package/dist/client/_nuxt/{Dr5ncp7f.js → eNJvB98b.js} +1 -1
- package/dist/client/_nuxt/{entry.B0gj-CgF.css → entry.BVkKIlAn.css} +1 -1
- package/dist/client/_nuxt/error-404.t9BbLQhb.css +1 -0
- package/dist/client/_nuxt/error-500.Bj4Q9dL1.css +1 -0
- package/dist/client/index.html +8 -8
- package/dist/module.cjs +21 -11
- package/dist/module.json +1 -1
- package/dist/module.mjs +21 -11
- package/dist/runtime/server/og-image/satori/renderer.js +26 -3
- package/dist/runtime/server/og-image/satori/transforms/inlineCss.js +2 -2
- package/dist/runtime/types.d.ts +2 -2
- package/package.json +28 -28
- package/dist/client/_nuxt/De-qQEWw.js +0 -4017
- package/dist/client/_nuxt/builds/meta/dev.json +0 -1
- package/dist/client/_nuxt/builds/meta/e8cf65e2-e6ce-426c-84bd-d6a74b10ae7a.json +0 -1
- package/dist/client/_nuxt/error-404.B8Wdqtfs.css +0 -1
- package/dist/client/_nuxt/error-500.Cj9Kfu8q.css +0 -1
- package/dist/runtime/server/og-image/satori/transforms/emojis/emoji-utils.d.ts +0 -24
- package/dist/runtime/server/og-image/satori/transforms/emojis/emoji-utils.js +0 -76
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { fontCache } from "#og-image-cache";
|
|
2
2
|
import { theme } from "#og-image-virtual/unocss-config.mjs";
|
|
3
|
+
import compatibility from "#og-image/compatibility";
|
|
3
4
|
import { defu } from "defu";
|
|
4
5
|
import { sendError } from "h3";
|
|
5
6
|
import { normaliseFontInput, useOgImageRuntimeConfig } from "../../../shared.js";
|
|
@@ -67,9 +68,31 @@ async function createPng(event) {
|
|
|
67
68
|
}
|
|
68
69
|
async function createJpeg(event) {
|
|
69
70
|
const { sharpOptions } = useOgImageRuntimeConfig();
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
if (compatibility.sharp === false) {
|
|
72
|
+
if (import.meta.dev) {
|
|
73
|
+
throw new Error("Sharp dependency is not accessible. Please check you have it installed and are using a compatible runtime.");
|
|
74
|
+
} else {
|
|
75
|
+
console.error("Sharp dependency is not accessible. Please check you have it installed and are using a compatible runtime. Falling back to png.");
|
|
76
|
+
}
|
|
77
|
+
return createPng(event);
|
|
78
|
+
}
|
|
79
|
+
const svg = await createSvg(event);
|
|
80
|
+
if (!svg) {
|
|
81
|
+
throw new Error("Failed to create SVG for JPEG rendering.");
|
|
82
|
+
}
|
|
83
|
+
const svgBuffer = Buffer.from(svg);
|
|
84
|
+
const sharp = await useSharp().catch(() => {
|
|
85
|
+
if (import.meta.dev) {
|
|
86
|
+
throw new Error("Sharp dependency could not be loaded. Please check you have it installed and are using a compatible runtime.");
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
});
|
|
90
|
+
if (!sharp) {
|
|
91
|
+
console.error("Sharp dependency is not accessible. Please check you have it installed and are using a compatible runtime. Falling back to png.");
|
|
92
|
+
return createPng(event);
|
|
93
|
+
}
|
|
94
|
+
const options = defu(event.options.sharp, sharpOptions);
|
|
95
|
+
return sharp(svgBuffer, options).jpeg(options).toBuffer();
|
|
73
96
|
}
|
|
74
97
|
const SatoriRenderer = {
|
|
75
98
|
name: "satori",
|
|
@@ -4,8 +4,8 @@ import { useCssInline } from "../instances.js";
|
|
|
4
4
|
export async function applyInlineCss(ctx, island) {
|
|
5
5
|
const { e } = ctx;
|
|
6
6
|
let html = island.html;
|
|
7
|
-
let css = island.head.style
|
|
8
|
-
const componentInlineStyles = island.head.link
|
|
7
|
+
let css = island.head.style?.map((s) => s.innerHTML).filter(Boolean).join("\n") || "";
|
|
8
|
+
const componentInlineStyles = island.head.link?.filter((l) => l.href.startsWith("/_nuxt/components") && l.href.replaceAll("/", "").includes(ctx.options.component)) || [];
|
|
9
9
|
if (!import.meta.prerender && !componentInlineStyles.length) {
|
|
10
10
|
return false;
|
|
11
11
|
}
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { NitroOptions } from 'nitropack';
|
|
|
7
7
|
import type { NitroApp } from 'nitropack/types';
|
|
8
8
|
import type { SatoriOptions } from 'satori';
|
|
9
9
|
import type { html } from 'satori-html';
|
|
10
|
-
import type { SharpOptions } from 'sharp';
|
|
10
|
+
import type { JpegOptions, SharpOptions } from 'sharp';
|
|
11
11
|
import type { Ref } from 'vue';
|
|
12
12
|
export interface OgImageRenderEventContext {
|
|
13
13
|
unocss: UnoGenerator;
|
|
@@ -116,7 +116,7 @@ export interface OgImageOptions<T extends keyof OgImageComponents = 'NuxtSeo'> {
|
|
|
116
116
|
resvg?: ResvgRenderOptions;
|
|
117
117
|
satori?: SatoriOptions;
|
|
118
118
|
screenshot?: Partial<ScreenshotOptions>;
|
|
119
|
-
sharp?: SharpOptions;
|
|
119
|
+
sharp?: SharpOptions & JpegOptions;
|
|
120
120
|
fonts?: InputFontConfig[];
|
|
121
121
|
cacheMaxAgeSeconds?: number;
|
|
122
122
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-og-image",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.1.
|
|
4
|
+
"version": "5.1.6",
|
|
5
5
|
"description": "Enlightened OG Image generation for Nuxt.",
|
|
6
6
|
"author": {
|
|
7
7
|
"website": "https://harlanzw.com",
|
|
@@ -48,16 +48,16 @@
|
|
|
48
48
|
"unstorage": "^1.15.0"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@nuxt/devtools-kit": "^2.
|
|
52
|
-
"@nuxt/kit": "^3.17.
|
|
51
|
+
"@nuxt/devtools-kit": "^2.5.0",
|
|
52
|
+
"@nuxt/kit": "^3.17.5",
|
|
53
53
|
"@resvg/resvg-js": "^2.6.2",
|
|
54
54
|
"@resvg/resvg-wasm": "^2.6.2",
|
|
55
|
-
"@unocss/core": "^66.1.
|
|
56
|
-
"@unocss/preset-wind3": "^66.1.
|
|
55
|
+
"@unocss/core": "^66.1.3",
|
|
56
|
+
"@unocss/preset-wind3": "^66.1.3",
|
|
57
57
|
"chrome-launcher": "^1.2.0",
|
|
58
58
|
"consola": "^3.4.2",
|
|
59
59
|
"defu": "^6.1.4",
|
|
60
|
-
"execa": "^9.
|
|
60
|
+
"execa": "^9.6.0",
|
|
61
61
|
"image-size": "^2.0.2",
|
|
62
62
|
"magic-string": "^0.30.17",
|
|
63
63
|
"mocked-exports": "^0.1.1",
|
|
@@ -69,52 +69,52 @@
|
|
|
69
69
|
"pkg-types": "^2.1.0",
|
|
70
70
|
"playwright-core": "^1.52.0",
|
|
71
71
|
"radix3": "^1.1.2",
|
|
72
|
-
"satori": "^0.13.
|
|
72
|
+
"satori": "^0.13.2",
|
|
73
73
|
"satori-html": "^0.3.2",
|
|
74
74
|
"sirv": "^3.0.1",
|
|
75
75
|
"std-env": "^3.9.0",
|
|
76
76
|
"strip-literal": "^3.0.0",
|
|
77
77
|
"ufo": "^1.6.1",
|
|
78
|
-
"unplugin": "^2.3.
|
|
78
|
+
"unplugin": "^2.3.5",
|
|
79
79
|
"unwasm": "^0.3.9",
|
|
80
80
|
"yoga-wasm-web": "^0.3.3"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@antfu/eslint-config": "^4.13.
|
|
83
|
+
"@antfu/eslint-config": "^4.13.3",
|
|
84
84
|
"@css-inline/css-inline": "^0.14.3",
|
|
85
85
|
"@headlessui/vue": "^1.7.23",
|
|
86
|
-
"@iconify-json/carbon": "^1.2.
|
|
86
|
+
"@iconify-json/carbon": "^1.2.9",
|
|
87
87
|
"@iconify-json/logos": "^1.2.4",
|
|
88
88
|
"@iconify-json/noto": "^1.2.3",
|
|
89
89
|
"@iconify-json/ri": "^1.2.5",
|
|
90
|
-
"@iconify-json/tabler": "^1.2.
|
|
91
|
-
"@img/sharp-linux-x64": "^0.34.
|
|
90
|
+
"@iconify-json/tabler": "^1.2.19",
|
|
91
|
+
"@img/sharp-linux-x64": "^0.34.2",
|
|
92
92
|
"@nuxt/content": "^3.5.1",
|
|
93
|
-
"@nuxt/devtools": "^2.
|
|
94
|
-
"@nuxt/devtools-ui-kit": "^2.
|
|
93
|
+
"@nuxt/devtools": "^2.5.0",
|
|
94
|
+
"@nuxt/devtools-ui-kit": "^2.5.0",
|
|
95
95
|
"@nuxt/icon": "^1.13.0",
|
|
96
96
|
"@nuxt/image": "^1.10.0",
|
|
97
97
|
"@nuxt/module-builder": "^1.0.1",
|
|
98
|
-
"@nuxt/test-utils": "^3.19.
|
|
99
|
-
"@nuxt/ui": "^3.1.
|
|
98
|
+
"@nuxt/test-utils": "^3.19.1",
|
|
99
|
+
"@nuxt/ui": "^3.1.3",
|
|
100
100
|
"@nuxtjs/color-mode": "^3.5.2",
|
|
101
101
|
"@nuxtjs/eslint-config-typescript": "^12.1.0",
|
|
102
|
-
"@nuxtjs/i18n": "^9.5.
|
|
102
|
+
"@nuxtjs/i18n": "^9.5.5",
|
|
103
103
|
"@nuxtjs/tailwindcss": "^6.14.0",
|
|
104
|
-
"@unocss/nuxt": "^66.1.
|
|
105
|
-
"@unocss/preset-icons": "^66.1.
|
|
106
|
-
"@unocss/runtime": "^66.1.
|
|
107
|
-
"@vueuse/nuxt": "^13.
|
|
104
|
+
"@unocss/nuxt": "^66.1.3",
|
|
105
|
+
"@unocss/preset-icons": "^66.1.3",
|
|
106
|
+
"@unocss/runtime": "^66.1.3",
|
|
107
|
+
"@vueuse/nuxt": "^13.3.0",
|
|
108
108
|
"bumpp": "^10.1.1",
|
|
109
|
-
"eslint": "9.
|
|
110
|
-
"jest-image-snapshot": "^6.5.
|
|
111
|
-
"nuxt": "^3.17.
|
|
109
|
+
"eslint": "9.28.0",
|
|
110
|
+
"jest-image-snapshot": "^6.5.1",
|
|
111
|
+
"nuxt": "^3.17.5",
|
|
112
112
|
"playwright": "^1.52.0",
|
|
113
|
-
"sass": "^1.89.
|
|
114
|
-
"sharp": "^0.34.
|
|
113
|
+
"sass": "^1.89.1",
|
|
114
|
+
"sharp": "^0.34.2",
|
|
115
115
|
"typescript": "^5.8.3",
|
|
116
|
-
"unocss": "^66.1.
|
|
117
|
-
"vitest": "^3.1
|
|
116
|
+
"unocss": "^66.1.3",
|
|
117
|
+
"vitest": "^3.2.1",
|
|
118
118
|
"vue-tsc": "^2.2.10"
|
|
119
119
|
},
|
|
120
120
|
"scripts": {
|