nuxt-og-image 5.1.7 → 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 +5 -5
- package/dist/client/404.html +5 -5
- package/dist/client/_nuxt/{DK6ySO-b.js → BM0SGHtW.js} +1 -1
- package/dist/client/_nuxt/{BuG-6Qss.js → Cl0GRg1F.js} +112 -112
- package/dist/client/_nuxt/{CN8iCxzm.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/index.html +5 -5
- 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 +3 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +3 -2
- 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 +19 -18
- package/{virtual.d.ts → types/virtual.d.ts} +11 -2
- package/dist/client/_nuxt/builds/meta/a8d773e2-13ae-466e-b246-42e9659ce587.json +0 -1
- package/dist/runtime/pure.d.ts +0 -9
- package/dist/runtime/pure.js +0 -105
package/dist/runtime/pure.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { defu } from "defu";
|
|
2
|
-
function detectBase64MimeType(data) {
|
|
3
|
-
const signatures = {
|
|
4
|
-
"R0lGODdh": "image/gif",
|
|
5
|
-
"R0lGODlh": "image/gif",
|
|
6
|
-
"iVBORw0KGgo": "image/png",
|
|
7
|
-
"/9j/": "image/jpeg",
|
|
8
|
-
"UklGR": "image/webp",
|
|
9
|
-
"AAABAA": "image/x-icon"
|
|
10
|
-
};
|
|
11
|
-
for (const s in signatures) {
|
|
12
|
-
if (data.startsWith(s)) {
|
|
13
|
-
return signatures[s];
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return "image/svg+xml";
|
|
17
|
-
}
|
|
18
|
-
export function toBase64Image(data) {
|
|
19
|
-
const base64 = typeof data === "string" ? data : Buffer.from(data).toString("base64");
|
|
20
|
-
const type = detectBase64MimeType(base64);
|
|
21
|
-
return `data:${type};base64,${base64}`;
|
|
22
|
-
}
|
|
23
|
-
export function isInternalRoute(path) {
|
|
24
|
-
return path.startsWith("/_") || path.startsWith("@");
|
|
25
|
-
}
|
|
26
|
-
function filterIsOgImageOption(key) {
|
|
27
|
-
const keys = [
|
|
28
|
-
"url",
|
|
29
|
-
"extension",
|
|
30
|
-
"width",
|
|
31
|
-
"height",
|
|
32
|
-
"fonts",
|
|
33
|
-
"alt",
|
|
34
|
-
"props",
|
|
35
|
-
"renderer",
|
|
36
|
-
"html",
|
|
37
|
-
"component",
|
|
38
|
-
"renderer",
|
|
39
|
-
"emojis",
|
|
40
|
-
"_query",
|
|
41
|
-
"satori",
|
|
42
|
-
"resvg",
|
|
43
|
-
"sharp",
|
|
44
|
-
"screenshot",
|
|
45
|
-
"cacheMaxAgeSeconds"
|
|
46
|
-
];
|
|
47
|
-
return keys.includes(key);
|
|
48
|
-
}
|
|
49
|
-
export function separateProps(options, ignoreKeys = []) {
|
|
50
|
-
options = options || {};
|
|
51
|
-
const _props = defu(options.props, Object.fromEntries(
|
|
52
|
-
Object.entries({ ...options }).filter(([k]) => !filterIsOgImageOption(k) && !ignoreKeys.includes(k))
|
|
53
|
-
));
|
|
54
|
-
const props = {};
|
|
55
|
-
Object.entries(_props).forEach(([key, val]) => {
|
|
56
|
-
props[key.replace(/-([a-z])/g, (g) => g[1].toUpperCase())] = val;
|
|
57
|
-
});
|
|
58
|
-
return {
|
|
59
|
-
...Object.fromEntries(
|
|
60
|
-
Object.entries({ ...options }).filter(([k]) => filterIsOgImageOption(k) || ignoreKeys.includes(k))
|
|
61
|
-
),
|
|
62
|
-
props
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
export function normaliseFontInput(fonts) {
|
|
66
|
-
return fonts.map((f) => {
|
|
67
|
-
if (typeof f === "string") {
|
|
68
|
-
const vals = f.split(":");
|
|
69
|
-
const includesStyle = vals.length === 3;
|
|
70
|
-
let name, weight, style;
|
|
71
|
-
if (includesStyle) {
|
|
72
|
-
name = vals[0];
|
|
73
|
-
style = vals[1];
|
|
74
|
-
weight = vals[2];
|
|
75
|
-
} else {
|
|
76
|
-
name = vals[0];
|
|
77
|
-
weight = vals[1];
|
|
78
|
-
}
|
|
79
|
-
return {
|
|
80
|
-
cacheKey: f,
|
|
81
|
-
name,
|
|
82
|
-
weight: weight || 400,
|
|
83
|
-
style: style || "normal",
|
|
84
|
-
path: void 0
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
return {
|
|
88
|
-
cacheKey: f.key || `${f.name}:${f.style}:${f.weight}`,
|
|
89
|
-
style: "normal",
|
|
90
|
-
weight: 400,
|
|
91
|
-
...f
|
|
92
|
-
};
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
export function withoutQuery(path) {
|
|
96
|
-
return path.split("?")[0];
|
|
97
|
-
}
|
|
98
|
-
export function getExtension(path) {
|
|
99
|
-
path = withoutQuery(path);
|
|
100
|
-
const lastSegment = path.split("/").pop() || path;
|
|
101
|
-
const extension = lastSegment.split(".").pop() || lastSegment;
|
|
102
|
-
if (extension === "jpg")
|
|
103
|
-
return "jpeg";
|
|
104
|
-
return extension;
|
|
105
|
-
}
|