nuxt-og-image 5.1.6 → 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 +7 -7
- package/dist/client/404.html +7 -7
- package/dist/client/_nuxt/{TAjbzagq.js → BM0SGHtW.js} +1 -1
- package/dist/client/_nuxt/{Bi6Y3qqE.js → Cl0GRg1F.js} +130 -130
- package/dist/client/_nuxt/{eNJvB98b.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/_nuxt/error-404.CWHu2lpK.css +1 -0
- package/dist/client/_nuxt/error-500.xMt3qmEl.css +1 -0
- package/dist/client/index.html +7 -7
- 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 +4 -3
- package/dist/module.json +1 -1
- package/dist/module.mjs +4 -3
- 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 +27 -25
- package/{virtual.d.ts → types/virtual.d.ts} +11 -2
- package/dist/client/_nuxt/builds/meta/0f0cd98d-a6ee-47bf-a7c6-e295b96f29b9.json +0 -1
- package/dist/client/_nuxt/error-404.t9BbLQhb.css +0 -1
- package/dist/client/_nuxt/error-500.Bj4Q9dL1.css +0 -1
- package/dist/runtime/pure.d.ts +0 -9
- package/dist/runtime/pure.js +0 -105
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.8",
|
|
5
5
|
"description": "Enlightened OG Image generation for Nuxt.",
|
|
6
6
|
"author": {
|
|
7
7
|
"website": "https://harlanzw.com",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"files": [
|
|
40
40
|
"dist",
|
|
41
|
-
"virtual.d.ts"
|
|
41
|
+
"types/virtual.d.ts"
|
|
42
42
|
],
|
|
43
43
|
"engines": {
|
|
44
44
|
"node": ">=18.0.0"
|
|
@@ -52,8 +52,8 @@
|
|
|
52
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.3.1",
|
|
56
|
+
"@unocss/preset-wind3": "^66.3.1",
|
|
57
57
|
"chrome-launcher": "^1.2.0",
|
|
58
58
|
"consola": "^3.4.2",
|
|
59
59
|
"defu": "^6.1.4",
|
|
@@ -61,15 +61,15 @@
|
|
|
61
61
|
"image-size": "^2.0.2",
|
|
62
62
|
"magic-string": "^0.30.17",
|
|
63
63
|
"mocked-exports": "^0.1.1",
|
|
64
|
-
"nuxt-site-config": "^3.2.
|
|
64
|
+
"nuxt-site-config": "^3.2.2",
|
|
65
65
|
"nypm": "^0.6.0",
|
|
66
66
|
"ofetch": "^1.4.1",
|
|
67
67
|
"ohash": "^2.0.11",
|
|
68
68
|
"pathe": "^2.0.3",
|
|
69
69
|
"pkg-types": "^2.1.0",
|
|
70
|
-
"playwright-core": "^1.
|
|
70
|
+
"playwright-core": "^1.53.1",
|
|
71
71
|
"radix3": "^1.1.2",
|
|
72
|
-
"satori": "^0.
|
|
72
|
+
"satori": "^0.15.2",
|
|
73
73
|
"satori-html": "^0.3.2",
|
|
74
74
|
"sirv": "^3.0.1",
|
|
75
75
|
"std-env": "^3.9.0",
|
|
@@ -80,41 +80,42 @@
|
|
|
80
80
|
"yoga-wasm-web": "^0.3.3"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@antfu/eslint-config": "^4.
|
|
84
|
-
"@css-inline/css-inline": "^0.
|
|
83
|
+
"@antfu/eslint-config": "^4.16.1",
|
|
84
|
+
"@css-inline/css-inline": "^0.15.0",
|
|
85
85
|
"@headlessui/vue": "^1.7.23",
|
|
86
|
-
"@iconify-json/carbon": "^1.2.
|
|
86
|
+
"@iconify-json/carbon": "^1.2.10",
|
|
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
90
|
"@iconify-json/tabler": "^1.2.19",
|
|
91
91
|
"@img/sharp-linux-x64": "^0.34.2",
|
|
92
|
-
"@nuxt/content": "^3.
|
|
92
|
+
"@nuxt/content": "^3.6.1",
|
|
93
93
|
"@nuxt/devtools": "^2.5.0",
|
|
94
94
|
"@nuxt/devtools-ui-kit": "^2.5.0",
|
|
95
|
-
"@nuxt/icon": "^1.
|
|
95
|
+
"@nuxt/icon": "^1.14.0",
|
|
96
96
|
"@nuxt/image": "^1.10.0",
|
|
97
97
|
"@nuxt/module-builder": "^1.0.1",
|
|
98
98
|
"@nuxt/test-utils": "^3.19.1",
|
|
99
|
-
"@nuxt/ui": "^3.
|
|
99
|
+
"@nuxt/ui": "^3.2.0",
|
|
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.6",
|
|
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.
|
|
108
|
-
"bumpp": "^10.
|
|
109
|
-
"eslint": "9.
|
|
104
|
+
"@unocss/nuxt": "^66.3.1",
|
|
105
|
+
"@unocss/preset-icons": "^66.3.1",
|
|
106
|
+
"@unocss/runtime": "^66.3.1",
|
|
107
|
+
"@vueuse/nuxt": "^13.4.0",
|
|
108
|
+
"bumpp": "^10.2.0",
|
|
109
|
+
"eslint": "^9.29.0",
|
|
110
|
+
"happy-dom": "^18.0.1",
|
|
110
111
|
"jest-image-snapshot": "^6.5.1",
|
|
111
112
|
"nuxt": "^3.17.5",
|
|
112
|
-
"playwright": "^1.
|
|
113
|
-
"sass": "^1.89.
|
|
113
|
+
"playwright": "^1.53.1",
|
|
114
|
+
"sass": "^1.89.2",
|
|
114
115
|
"sharp": "^0.34.2",
|
|
115
116
|
"typescript": "^5.8.3",
|
|
116
|
-
"unocss": "^66.1
|
|
117
|
-
"vitest": "^3.2.
|
|
117
|
+
"unocss": "^66.3.1",
|
|
118
|
+
"vitest": "^3.2.4",
|
|
118
119
|
"vue-tsc": "^2.2.10"
|
|
119
120
|
},
|
|
120
121
|
"scripts": {
|
|
@@ -123,7 +124,8 @@
|
|
|
123
124
|
"build:client": "nuxi generate client",
|
|
124
125
|
"build:module": "nuxt-build-module build",
|
|
125
126
|
"client:dev": "nuxi dev client --port 3030",
|
|
126
|
-
"lint": "eslint .
|
|
127
|
+
"lint": "eslint .",
|
|
128
|
+
"lint:fix": "eslint . --fix",
|
|
127
129
|
"dev": "nuxi dev playground",
|
|
128
130
|
"dev:build": "nuxi build playground",
|
|
129
131
|
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground && nuxi prepare client",
|
|
@@ -5,13 +5,13 @@ declare module '#og-image/components' {
|
|
|
5
5
|
export default components
|
|
6
6
|
}
|
|
7
7
|
declare module '#og-image/renderers/satori' {
|
|
8
|
-
import type Renderer from '
|
|
8
|
+
import type Renderer from '#og-image/types'
|
|
9
9
|
|
|
10
10
|
const renderer: Renderer | { __mock__: true } | undefined
|
|
11
11
|
export default renderer
|
|
12
12
|
}
|
|
13
13
|
declare module '#og-image/renderers/chromium' {
|
|
14
|
-
import type Renderer from '
|
|
14
|
+
import type Renderer from '#og-image/types'
|
|
15
15
|
|
|
16
16
|
const renderer: Renderer | { __mock__: true } | undefined
|
|
17
17
|
export default renderer
|
|
@@ -69,3 +69,12 @@ declare module '#og-image-cache' {
|
|
|
69
69
|
|
|
70
70
|
export const emojiCache: Storage<string>
|
|
71
71
|
}
|
|
72
|
+
|
|
73
|
+
declare module '@css-inline/css-inline-wasm' {
|
|
74
|
+
export function inline(css: string, html: string): string
|
|
75
|
+
export default function init(): Promise<void>
|
|
76
|
+
const cssInline: {
|
|
77
|
+
inline: (css: string, html: string) => string
|
|
78
|
+
}
|
|
79
|
+
export { cssInline }
|
|
80
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"id":"0f0cd98d-a6ee-47bf-a7c6-e295b96f29b9","timestamp":1749118443588,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.spotlight[data-v-dd42f242]{background:linear-gradient(45deg,#00dc82,#36e4da 50%,#0047e1);bottom:-30vh;filter:blur(20vh);height:40vh}.gradient-border[data-v-dd42f242]{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border-radius:.5rem;position:relative}@media (prefers-color-scheme:light){.gradient-border[data-v-dd42f242]{background-color:#ffffff4d}.gradient-border[data-v-dd42f242]:before{background:linear-gradient(90deg,#e2e2e2,#e2e2e2 25%,#00dc82,#36e4da 75%,#0047e1)}}@media (prefers-color-scheme:dark){.gradient-border[data-v-dd42f242]{background-color:#1414144d}.gradient-border[data-v-dd42f242]:before{background:linear-gradient(90deg,#303030,#303030 25%,#00dc82,#36e4da 75%,#0047e1)}}.gradient-border[data-v-dd42f242]:before{background-size:400% auto;border-radius:.5rem;bottom:0;content:"";left:0;-webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude;opacity:.5;padding:2px;position:absolute;right:0;top:0;transition:background-position .3s ease-in-out,opacity .2s ease-in-out;width:100%}.gradient-border[data-v-dd42f242]:hover:before{background-position:-50% 0;opacity:1}.fixed[data-v-dd42f242]{position:fixed}.left-0[data-v-dd42f242]{left:0}.right-0[data-v-dd42f242]{right:0}.z-10[data-v-dd42f242]{z-index:10}.z-20[data-v-dd42f242]{z-index:20}.grid[data-v-dd42f242]{display:grid}.mb-16[data-v-dd42f242]{margin-bottom:4rem}.mb-8[data-v-dd42f242]{margin-bottom:2rem}.max-w-520px[data-v-dd42f242]{max-width:520px}.min-h-screen[data-v-dd42f242]{min-height:100vh}.w-full[data-v-dd42f242]{width:100%}.flex[data-v-dd42f242]{display:flex}.cursor-pointer[data-v-dd42f242]{cursor:pointer}.place-content-center[data-v-dd42f242]{place-content:center}.items-center[data-v-dd42f242]{align-items:center}.justify-center[data-v-dd42f242]{justify-content:center}.overflow-hidden[data-v-dd42f242]{overflow:hidden}.bg-white[data-v-dd42f242]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-4[data-v-dd42f242]{padding-left:1rem;padding-right:1rem}.px-8[data-v-dd42f242]{padding-left:2rem;padding-right:2rem}.py-2[data-v-dd42f242]{padding-bottom:.5rem;padding-top:.5rem}.text-center[data-v-dd42f242]{text-align:center}.text-8xl[data-v-dd42f242]{font-size:6rem;line-height:1}.text-xl[data-v-dd42f242]{font-size:1.25rem;line-height:1.75rem}.text-black[data-v-dd42f242]{--un-text-opacity:1;color:rgb(0 0 0/var(--un-text-opacity))}.font-light[data-v-dd42f242]{font-weight:300}.font-medium[data-v-dd42f242]{font-weight:500}.leading-tight[data-v-dd42f242]{line-height:1.25}.font-sans[data-v-dd42f242]{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.antialiased[data-v-dd42f242]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){.dark\:bg-black[data-v-dd42f242]{--un-bg-opacity:1;background-color:rgb(0 0 0/var(--un-bg-opacity))}.dark\:text-white[data-v-dd42f242]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media (min-width:640px){.sm\:px-0[data-v-dd42f242]{padding-left:0;padding-right:0}.sm\:px-6[data-v-dd42f242]{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-3[data-v-dd42f242]{padding-bottom:.75rem;padding-top:.75rem}.sm\:text-4xl[data-v-dd42f242]{font-size:2.25rem;line-height:2.5rem}.sm\:text-xl[data-v-dd42f242]{font-size:1.25rem;line-height:1.75rem}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.spotlight[data-v-d5ca0c90]{background:linear-gradient(45deg,#00dc82,#36e4da 50%,#0047e1);filter:blur(20vh)}.fixed[data-v-d5ca0c90]{position:fixed}.-bottom-1\/2[data-v-d5ca0c90]{bottom:-50%}.left-0[data-v-d5ca0c90]{left:0}.right-0[data-v-d5ca0c90]{right:0}.grid[data-v-d5ca0c90]{display:grid}.mb-16[data-v-d5ca0c90]{margin-bottom:4rem}.mb-8[data-v-d5ca0c90]{margin-bottom:2rem}.h-1\/2[data-v-d5ca0c90]{height:50%}.max-w-520px[data-v-d5ca0c90]{max-width:520px}.min-h-screen[data-v-d5ca0c90]{min-height:100vh}.place-content-center[data-v-d5ca0c90]{place-content:center}.overflow-hidden[data-v-d5ca0c90]{overflow:hidden}.bg-white[data-v-d5ca0c90]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-8[data-v-d5ca0c90]{padding-left:2rem;padding-right:2rem}.text-center[data-v-d5ca0c90]{text-align:center}.text-8xl[data-v-d5ca0c90]{font-size:6rem;line-height:1}.text-xl[data-v-d5ca0c90]{font-size:1.25rem;line-height:1.75rem}.text-black[data-v-d5ca0c90]{--un-text-opacity:1;color:rgb(0 0 0/var(--un-text-opacity))}.font-light[data-v-d5ca0c90]{font-weight:300}.font-medium[data-v-d5ca0c90]{font-weight:500}.leading-tight[data-v-d5ca0c90]{line-height:1.25}.font-sans[data-v-d5ca0c90]{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.antialiased[data-v-d5ca0c90]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (prefers-color-scheme:dark){.dark\:bg-black[data-v-d5ca0c90]{--un-bg-opacity:1;background-color:rgb(0 0 0/var(--un-bg-opacity))}.dark\:text-white[data-v-d5ca0c90]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media (min-width:640px){.sm\:px-0[data-v-d5ca0c90]{padding-left:0;padding-right:0}.sm\:text-4xl[data-v-d5ca0c90]{font-size:2.25rem;line-height:2.5rem}}
|
package/dist/runtime/pure.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { InputFontConfig, OgImageOptions, ResolvedFontConfig } from './types.js';
|
|
2
|
-
export declare function toBase64Image(data: string | ArrayBuffer): string;
|
|
3
|
-
export declare function isInternalRoute(path: string): boolean;
|
|
4
|
-
export declare function separateProps(options: OgImageOptions | undefined, ignoreKeys?: string[]): {
|
|
5
|
-
props: Record<string, any>;
|
|
6
|
-
};
|
|
7
|
-
export declare function normaliseFontInput(fonts: InputFontConfig[]): ResolvedFontConfig[];
|
|
8
|
-
export declare function withoutQuery(path: string): string;
|
|
9
|
-
export declare function getExtension(path: string): string;
|
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
|
-
}
|