nuxt-og-image 3.0.0-rc.4 → 3.0.0-rc.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.
Files changed (27) hide show
  1. package/dist/client/200.html +4 -4
  2. package/dist/client/404.html +4 -4
  3. package/dist/client/_nuxt/{IconCSS.921d8bb4.js → IconCSS.220290da.js} +1 -1
  4. package/dist/client/_nuxt/builds/latest.json +1 -1
  5. package/dist/client/_nuxt/builds/meta/e73d18b8-bd07-4a22-971c-e8ba17519e8f.json +1 -0
  6. package/dist/client/_nuxt/{entry.81e38674.js → entry.5d0abb3d.js} +3 -3
  7. package/dist/client/_nuxt/{error-404.3430ff98.js → error-404.e6048d23.js} +1 -1
  8. package/dist/client/_nuxt/{error-500.17781b5f.js → error-500.3bcefba1.js} +1 -1
  9. package/dist/client/index.html +4 -4
  10. package/dist/module.d.mts +1 -0
  11. package/dist/module.d.ts +1 -0
  12. package/dist/module.json +1 -1
  13. package/dist/module.mjs +7 -3
  14. package/dist/runtime/components/Templates/Community/NuxtSeo.vue +1 -1
  15. package/dist/runtime/composables/defineOgImage.mjs +2 -2
  16. package/dist/runtime/core/utils/resolveRendererContext.mjs +2 -1
  17. package/dist/runtime/nitro/utils.mjs +1 -2
  18. package/dist/runtime/nuxt/utils.mjs +5 -3
  19. package/dist/runtime/server/routes/__og-image__/debug.json.d.ts +0 -4
  20. package/dist/runtime/server/routes/__og-image__/debug.json.mjs +0 -6
  21. package/dist/runtime/server/routes/__og-image__/font-[name]-[weight].[extension].mjs +9 -7
  22. package/dist/runtime/server/routes/__og-image__/image.mjs +0 -2
  23. package/dist/runtime/types.d.ts +1 -0
  24. package/dist/runtime/utils.pure.d.ts +2 -0
  25. package/dist/runtime/utils.pure.mjs +8 -0
  26. package/package.json +6 -5
  27. package/dist/client/_nuxt/builds/meta/f3272063-a39c-4336-ba58-ab7e348c7608.json +0 -1
@@ -1 +1 @@
1
- import{_ as a,u as n,o as r,c as l,a as e,t as s,b as d,w as c,d as p,e as f,p as x,f as h}from"./entry.81e38674.js";const m=t=>(x("data-v-05a2b8a3"),t=t(),h(),t),u={class:"font-sans antialiased bg-white dark:bg-black text-black dark:text-white grid min-h-screen place-content-center overflow-hidden"},g=m(()=>e("div",{class:"fixed left-0 right-0 spotlight z-10"},null,-1)),b={class:"max-w-520px text-center z-20"},_=["textContent"],w=["textContent"],y={class:"w-full flex items-center justify-center"},S={__name:"error-404",props:{appName:{type:String,default:"Nuxt"},version:{type:String,default:""},statusCode:{type:Number,default:404},statusMessage:{type:String,default:"Not Found"},description:{type:String,default:"Sorry, the page you are looking for could not be found."},backHome:{type:String,default:"Go back home"}},setup(t){const o=t;return n({title:`${o.statusCode} - ${o.statusMessage} | ${o.appName}`,script:[],style:[{children:'*,:before,:after{-webkit-box-sizing:border-box;box-sizing:border-box;border-width:0;border-style:solid;border-color:#e0e0e0}*{--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(14, 165, 233, .5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000}:root{-moz-tab-size:4;-o-tab-size:4;tab-size:4}a{color:inherit;text-decoration:inherit}body{margin:0;font-family:inherit;line-height:inherit}html{-webkit-text-size-adjust:100%;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";line-height:1.5}h1,p{margin:0}h1{font-size:inherit;font-weight:inherit}'}]}),(k,v)=>{const i=f;return r(),l("div",u,[g,e("div",b,[e("h1",{class:"text-8xl sm:text-10xl font-medium mb-8",textContent:s(t.statusCode)},null,8,_),e("p",{class:"text-xl px-8 sm:px-0 sm:text-4xl font-light mb-16 leading-tight",textContent:s(t.description)},null,8,w),e("div",y,[d(i,{to:"/",class:"gradient-border text-md sm:text-xl py-2 px-4 sm:py-3 sm:px-6 cursor-pointer"},{default:c(()=>[p(s(t.backHome),1)]),_:1})])])])}}},z=a(S,[["__scopeId","data-v-05a2b8a3"]]);export{z as default};
1
+ import{_ as a,u as n,o as r,c as l,a as e,t as s,b as d,w as c,d as p,e as f,p as x,f as h}from"./entry.5d0abb3d.js";const m=t=>(x("data-v-05a2b8a3"),t=t(),h(),t),u={class:"font-sans antialiased bg-white dark:bg-black text-black dark:text-white grid min-h-screen place-content-center overflow-hidden"},g=m(()=>e("div",{class:"fixed left-0 right-0 spotlight z-10"},null,-1)),b={class:"max-w-520px text-center z-20"},_=["textContent"],w=["textContent"],y={class:"w-full flex items-center justify-center"},S={__name:"error-404",props:{appName:{type:String,default:"Nuxt"},version:{type:String,default:""},statusCode:{type:Number,default:404},statusMessage:{type:String,default:"Not Found"},description:{type:String,default:"Sorry, the page you are looking for could not be found."},backHome:{type:String,default:"Go back home"}},setup(t){const o=t;return n({title:`${o.statusCode} - ${o.statusMessage} | ${o.appName}`,script:[],style:[{children:'*,:before,:after{-webkit-box-sizing:border-box;box-sizing:border-box;border-width:0;border-style:solid;border-color:#e0e0e0}*{--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(14, 165, 233, .5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000}:root{-moz-tab-size:4;-o-tab-size:4;tab-size:4}a{color:inherit;text-decoration:inherit}body{margin:0;font-family:inherit;line-height:inherit}html{-webkit-text-size-adjust:100%;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";line-height:1.5}h1,p{margin:0}h1{font-size:inherit;font-weight:inherit}'}]}),(k,v)=>{const i=f;return r(),l("div",u,[g,e("div",b,[e("h1",{class:"text-8xl sm:text-10xl font-medium mb-8",textContent:s(t.statusCode)},null,8,_),e("p",{class:"text-xl px-8 sm:px-0 sm:text-4xl font-light mb-16 leading-tight",textContent:s(t.description)},null,8,w),e("div",y,[d(i,{to:"/",class:"gradient-border text-md sm:text-xl py-2 px-4 sm:py-3 sm:px-6 cursor-pointer"},{default:c(()=>[p(s(t.backHome),1)]),_:1})])])])}}},z=a(S,[["__scopeId","data-v-05a2b8a3"]]);export{z as default};
@@ -1 +1 @@
1
- import{_ as i,u as a,o as r,c as n,a as e,t as s,p as l,f as d}from"./entry.81e38674.js";const c=t=>(l("data-v-c967d9a9"),t=t(),d(),t),p={class:"font-sans antialiased bg-white dark:bg-black text-black dark:text-white grid min-h-screen place-content-center overflow-hidden"},h=c(()=>e("div",{class:"fixed -bottom-1/2 left-0 right-0 h-1/2 spotlight"},null,-1)),f={class:"max-w-520px text-center"},g=["textContent"],m=["textContent"],x={__name:"error-500",props:{appName:{type:String,default:"Nuxt"},version:{type:String,default:""},statusCode:{type:Number,default:500},statusMessage:{type:String,default:"Server error"},description:{type:String,default:"This page is temporarily unavailable."}},setup(t){const o=t;return a({title:`${o.statusCode} - ${o.statusMessage} | ${o.appName}`,script:[],style:[{children:'*,:before,:after{-webkit-box-sizing:border-box;box-sizing:border-box;border-width:0;border-style:solid;border-color:#e0e0e0}*{--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(14, 165, 233, .5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000}:root{-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{margin:0;font-family:inherit;line-height:inherit}html{-webkit-text-size-adjust:100%;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";line-height:1.5}h1,p{margin:0}h1{font-size:inherit;font-weight:inherit}'}]}),(u,b)=>(r(),n("div",p,[h,e("div",f,[e("h1",{class:"text-8xl sm:text-10xl font-medium mb-8",textContent:s(t.statusCode)},null,8,g),e("p",{class:"text-xl px-8 sm:px-0 sm:text-4xl font-light mb-16 leading-tight",textContent:s(t.description)},null,8,m)])]))}},w=i(x,[["__scopeId","data-v-c967d9a9"]]);export{w as default};
1
+ import{_ as i,u as a,o as r,c as n,a as e,t as s,p as l,f as d}from"./entry.5d0abb3d.js";const c=t=>(l("data-v-c967d9a9"),t=t(),d(),t),p={class:"font-sans antialiased bg-white dark:bg-black text-black dark:text-white grid min-h-screen place-content-center overflow-hidden"},h=c(()=>e("div",{class:"fixed -bottom-1/2 left-0 right-0 h-1/2 spotlight"},null,-1)),f={class:"max-w-520px text-center"},g=["textContent"],m=["textContent"],x={__name:"error-500",props:{appName:{type:String,default:"Nuxt"},version:{type:String,default:""},statusCode:{type:Number,default:500},statusMessage:{type:String,default:"Server error"},description:{type:String,default:"This page is temporarily unavailable."}},setup(t){const o=t;return a({title:`${o.statusCode} - ${o.statusMessage} | ${o.appName}`,script:[],style:[{children:'*,:before,:after{-webkit-box-sizing:border-box;box-sizing:border-box;border-width:0;border-style:solid;border-color:#e0e0e0}*{--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(14, 165, 233, .5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000}:root{-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{margin:0;font-family:inherit;line-height:inherit}html{-webkit-text-size-adjust:100%;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";line-height:1.5}h1,p{margin:0}h1{font-size:inherit;font-weight:inherit}'}]}),(u,b)=>(r(),n("div",p,[h,e("div",f,[e("h1",{class:"text-8xl sm:text-10xl font-medium mb-8",textContent:s(t.statusCode)},null,8,g),e("p",{class:"text-xl px-8 sm:px-0 sm:text-4xl font-light mb-16 leading-tight",textContent:s(t.description)},null,8,m)])]))}},w=i(x,[["__scopeId","data-v-c967d9a9"]]);export{w as default};
@@ -3,13 +3,13 @@
3
3
  <head><meta charset="utf-8">
4
4
  <meta name="viewport" content="width=device-width, initial-scale=1">
5
5
  <link rel="stylesheet" href="/__nuxt-og-image/_nuxt/entry.a30f63d0.css">
6
- <link rel="modulepreload" as="script" crossorigin href="/__nuxt-og-image/_nuxt/entry.81e38674.js">
6
+ <link rel="modulepreload" as="script" crossorigin href="/__nuxt-og-image/_nuxt/entry.5d0abb3d.js">
7
7
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/vanilla-picker-NKbIFE8h.23409a58.js">
8
8
  <link rel="prefetch" as="style" href="/__nuxt-og-image/_nuxt/error-404.b751fa02.css">
9
- <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/error-404.3430ff98.js">
9
+ <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/error-404.e6048d23.js">
10
10
  <link rel="prefetch" as="style" href="/__nuxt-og-image/_nuxt/error-500.69009e70.css">
11
- <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/error-500.17781b5f.js">
12
- <script type="module" src="/__nuxt-og-image/_nuxt/entry.81e38674.js" crossorigin></script><script>"use strict";(()=>{const a=window,e=document.documentElement,m=["dark","light"],c=window&&window.localStorage&&window.localStorage.getItem&&window.localStorage.getItem("nuxt-color-mode")||"system";let n=c==="system"?d():c;const l=e.getAttribute("data-color-mode-forced");l&&(n=l),i(n),a["__NUXT_COLOR_MODE__"]={preference:c,value:n,getColorScheme:d,addColorScheme:i,removeColorScheme:f};function i(o){const t=""+o+"",s="";e.classList?e.classList.add(t):e.className+=" "+t,s&&e.setAttribute("data-"+s,o)}function f(o){const t=""+o+"",s="";e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp(t,"g"),""),s&&e.removeAttribute("data-"+s)}function r(o){return a.matchMedia("(prefers-color-scheme"+o+")")}function d(){if(a.matchMedia&&r("").media!=="not all"){for(const o of m)if(r(":"+o).matches)return o}return"light"}})();
11
+ <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/error-500.3bcefba1.js">
12
+ <script type="module" src="/__nuxt-og-image/_nuxt/entry.5d0abb3d.js" crossorigin></script><script>"use strict";(()=>{const a=window,e=document.documentElement,m=["dark","light"],c=window&&window.localStorage&&window.localStorage.getItem&&window.localStorage.getItem("nuxt-color-mode")||"system";let n=c==="system"?d():c;const l=e.getAttribute("data-color-mode-forced");l&&(n=l),i(n),a["__NUXT_COLOR_MODE__"]={preference:c,value:n,getColorScheme:d,addColorScheme:i,removeColorScheme:f};function i(o){const t=""+o+"",s="";e.classList?e.classList.add(t):e.className+=" "+t,s&&e.setAttribute("data-"+s,o)}function f(o){const t=""+o+"",s="";e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp(t,"g"),""),s&&e.removeAttribute("data-"+s)}function r(o){return a.matchMedia("(prefers-color-scheme"+o+")")}function d(){if(a.matchMedia&&r("").media!=="not all"){for(const o of m)if(r(":"+o).matches)return o}return"light"}})();
13
13
  </script></head>
14
14
  <body ><div id="__nuxt"></div><script type="application/json" id="__NUXT_DATA__" data-ssr="false">[{"_errors":1,"serverRendered":2,"data":3,"state":4},{},false,{},{}]</script>
15
15
  <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-og-image",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body>
package/dist/module.d.mts CHANGED
@@ -87,6 +87,7 @@ interface OgImageOptions<T extends keyof OgImageComponents = 'NuxtSeo'> {
87
87
  }
88
88
  interface FontConfig {
89
89
  name: string;
90
+ style?: string;
90
91
  weight?: string | number;
91
92
  path?: string;
92
93
  key?: string;
package/dist/module.d.ts CHANGED
@@ -87,6 +87,7 @@ interface OgImageOptions<T extends keyof OgImageComponents = 'NuxtSeo'> {
87
87
  }
88
88
  interface FontConfig {
89
89
  name: string;
90
+ style?: string;
90
91
  weight?: string | number;
91
92
  path?: string;
92
93
  key?: string;
package/dist/module.json CHANGED
@@ -5,5 +5,5 @@
5
5
  "bridge": false
6
6
  },
7
7
  "configKey": "ogImage",
8
- "version": "3.0.0-rc.4"
8
+ "version": "3.0.0-rc.6"
9
9
  }
package/dist/module.mjs CHANGED
@@ -14,7 +14,7 @@ import { createHash } from 'node:crypto';
14
14
  import { execa } from 'execa';
15
15
  import terminate from 'terminate';
16
16
 
17
- const version = "3.0.0-rc.4";
17
+ const version = "3.0.0-rc.6";
18
18
 
19
19
  const autodetectableProviders = {
20
20
  azure_static: "azure",
@@ -205,6 +205,9 @@ export {}
205
205
  references.push({ path: resolve(nuxt.options.buildDir, `module/${module}.d.ts`) });
206
206
  });
207
207
  }
208
+ function isNuxtGenerate(nuxt = useNuxt()) {
209
+ return nuxt.options._generate || nuxt.options.nitro.static || nuxt.options.nitro.preset === "static";
210
+ }
208
211
 
209
212
  const DEVTOOLS_UI_ROUTE = "/__nuxt-og-image";
210
213
  const DEVTOOLS_UI_LOCAL_PORT = 3030;
@@ -650,7 +653,8 @@ ${componentImports}
650
653
  }
651
654
  nuxt.hooks.hook("modules:done", async () => {
652
655
  const normalisedFonts = normaliseFontInput(config.fonts);
653
- if (!nuxt.options._generate && nuxt.options.build) {
656
+ if (!isNuxtGenerate() && nuxt.options.build) {
657
+ nuxt.options.nitro = nuxt.options.nitro || {};
654
658
  nuxt.options.nitro.prerender = nuxt.options.nitro.prerender || {};
655
659
  nuxt.options.nitro.prerender.routes = nuxt.options.nitro.prerender.routes || [];
656
660
  normalisedFonts.filter((f) => !f.path && !f.key).forEach(({ name, weight }) => {
@@ -685,7 +689,7 @@ ${componentImports}
685
689
  if (nuxt.options.dev) {
686
690
  setupDevHandler(config, resolve);
687
691
  setupDevToolsUI(config, resolve);
688
- } else if (nuxt.options._generate) {
692
+ } else if (isNuxtGenerate()) {
689
693
  setupGenerateHandler(config, resolve);
690
694
  } else if (nuxt.options.build) {
691
695
  await setupBuildHandler(config, resolve);
@@ -117,7 +117,7 @@ if (typeof props.icon === 'string' && !runtimeConfig.hasNuxtIcon && process.dev)
117
117
  {{ description }}
118
118
  </p>
119
119
  </div>
120
- <div v-if="icon" style="width: 30%;" class="flex justify-end">
120
+ <div v-if="Boolean(icon)" style="width: 30%;" class="flex justify-end">
121
121
  <IconComponent :name="icon" size="250px" style="margin: 0 auto; opacity: 0.7;" />
122
122
  </div>
123
123
  </div>
@@ -2,7 +2,7 @@ import { defu } from "defu";
2
2
  import { appendHeader } from "h3";
3
3
  import { createRouter as createRadixRouter, toRouteMatcher } from "radix3";
4
4
  import { withoutBase } from "ufo";
5
- import { getOgImagePath, separateProps, useOgImageRuntimeConfig } from "../utils.mjs";
5
+ import { getOgImagePath, separateProps, useOgImageRuntimeConfig, withoutQuery } from "../utils.mjs";
6
6
  import { createOgImageMeta, normaliseOptions } from "../nuxt/utils.mjs";
7
7
  import { useNuxtApp, useRequestEvent, useRoute, useRuntimeConfig } from "#imports";
8
8
  export function defineOgImage(_options = {}) {
@@ -16,7 +16,7 @@ export function defineOgImage(_options = {}) {
16
16
  createRadixRouter({ routes: useRuntimeConfig().nitro?.routeRules })
17
17
  );
18
18
  const routeRules = defu({}, ..._routeRulesMatcher.matchAll(
19
- withoutBase(basePath.split("?")[0], useRuntimeConfig().app.baseURL)
19
+ withoutBase(withoutQuery(basePath), useRuntimeConfig().app.baseURL)
20
20
  ).reverse()).ogImage;
21
21
  if (!_options || nuxtApp.ssrContext?.event.context._nitro?.routeRules?.ogImage === false || typeof routeRules !== "undefined" && routeRules === false) {
22
22
  ogImageInstances.forEach((e) => {
@@ -7,7 +7,8 @@ import { prerenderOptionsCache } from "../cache/prerender.mjs";
7
7
  import { useChromiumRenderer, useSatoriRenderer } from "../renderers/satori/instances.mjs";
8
8
  import { separateProps, useOgImageRuntimeConfig } from "../../utils.mjs";
9
9
  import { resolvePathCacheKey } from "../../nitro/utils.mjs";
10
- import { useNitroApp, useRuntimeConfig } from "#internal/nitro";
10
+ import { useRuntimeConfig } from "#internal/nitro";
11
+ import { useNitroApp } from "#internal/nitro/app";
11
12
  export async function resolveRendererContext(e) {
12
13
  const runtimeConfig = useOgImageRuntimeConfig();
13
14
  const path = parseURL(e.path).pathname;
@@ -2,9 +2,8 @@ import { withoutLeadingSlash, withoutTrailingSlash } from "ufo";
2
2
  import { hash } from "ohash";
3
3
  import { normalizeKey } from "unstorage";
4
4
  import { getQuery } from "h3";
5
- import { useSiteConfig } from "#imports";
6
5
  export function resolvePathCacheKey(e, path) {
7
- const siteConfig = useSiteConfig(e);
6
+ const siteConfig = e.context.siteConfig.get();
8
7
  const basePath = withoutTrailingSlash(withoutLeadingSlash(normalizeKey(path || e.path)));
9
8
  return [
10
9
  !basePath || basePath === "/" ? "index" : basePath,
@@ -1,14 +1,16 @@
1
1
  import { defu } from "defu";
2
2
  import { withQuery } from "ufo";
3
- import { separateProps } from "../utils.mjs";
3
+ import { getExtension, separateProps } from "../utils.mjs";
4
4
  import { unref, useServerHead } from "#imports";
5
5
  import { componentNames } from "#build/nuxt-og-image/components.mjs";
6
6
  export function createOgImageMeta(src, input, resolvedOptions, ssrContext) {
7
7
  const _input = separateProps(defu(input, ssrContext._ogImagePayload));
8
8
  let url = src || input.url || resolvedOptions.url;
9
- if (input._query && url)
9
+ if (!url)
10
+ return;
11
+ if (input._query && Object.keys(input._query).length && url)
10
12
  url = withQuery(url, { _query: input._query });
11
- let urlExtension = (url.split("/").pop() || url).split(".").pop() || resolvedOptions.extension;
13
+ let urlExtension = getExtension(url) || resolvedOptions.extension;
12
14
  if (urlExtension === "jpg")
13
15
  urlExtension = "jpeg";
14
16
  const meta = [
@@ -1,8 +1,4 @@
1
1
  declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<{
2
- siteConfigUrl: {
3
- value: any;
4
- source: any;
5
- };
6
2
  componentNames: any;
7
3
  runtimeConfig: import("../../../types").OgImageRuntimeConfig;
8
4
  compatibility: any;
@@ -1,17 +1,11 @@
1
1
  import { defineEventHandler, setHeader } from "h3";
2
2
  import { useOgImageRuntimeConfig } from "../../../utils.mjs";
3
- import { useSiteConfig } from "#imports";
4
3
  import compatibility from "#nuxt-og-image/compatibility";
5
4
  import { componentNames } from "#nuxt-og-image/component-names.mjs";
6
5
  export default defineEventHandler(async (e) => {
7
6
  setHeader(e, "Content-Type", "application/json");
8
7
  const runtimeConfig = useOgImageRuntimeConfig();
9
- const siteConfig = await useSiteConfig(e, { debug: true });
10
8
  return {
11
- siteConfigUrl: {
12
- value: siteConfig.url,
13
- source: siteConfig._context.url || "unknown"
14
- },
15
9
  componentNames,
16
10
  runtimeConfig,
17
11
  compatibility
@@ -1,10 +1,12 @@
1
- import { createError, defineEventHandler, proxyRequest, sendRedirect } from "h3";
1
+ import { createError, defineEventHandler } from "h3";
2
2
  import { parseURL } from "ufo";
3
3
  export default defineEventHandler(async (e) => {
4
4
  const path = parseURL(e.path).pathname;
5
- const [name, weight] = path.split("/font/")[1].split(".")[0].split("/");
6
- if (!name || !weight)
5
+ const [_name, _weight] = path.split("/font/")[1].split(".")[0].split("/");
6
+ if (!_name || !_weight)
7
7
  return "Provide a font name and weight";
8
+ const name = _name[0].toUpperCase() + _name.slice(1);
9
+ const weight = Math.round(Number.parseInt(_weight) / 100) * 100;
8
10
  const css = await globalThis.$fetch(`https://fonts.googleapis.com/css2?family=${name}:wght@${weight}`, {
9
11
  headers: {
10
12
  // Make sure it returns TTF.
@@ -18,11 +20,11 @@ export default defineEventHandler(async (e) => {
18
20
  });
19
21
  }
20
22
  const ttfResource = css.match(/src: url\((.+)\) format\('(opentype|truetype)'\)/);
21
- if (ttfResource?.[1])
22
- return proxyRequest(e, ttfResource[1], {});
23
+ if (ttfResource[1])
24
+ return globalThis.$fetch(ttfResource[1], { responseType: "arrayBuffer" });
23
25
  const woff2Resource = css.match(/src: url\((.+)\) format\('woff2'\)/);
24
- if (woff2Resource?.[1])
25
- return sendRedirect(e, woff2Resource[1]);
26
+ if (woff2Resource[1])
27
+ return globalThis.$fetch(woff2Resource[1], { responseType: "arrayBuffer" });
26
28
  return createError({
27
29
  statusCode: 500,
28
30
  statusMessage: `[Nuxt OG Image] Malformed Google Font CSS ${css}`
@@ -5,7 +5,6 @@ import { devIframeTemplate } from "../../../core/html/devIframeTemplate.mjs";
5
5
  import { applyInlineCss } from "../../../core/html/applyInlineCss.mjs";
6
6
  import { useOgImageBufferCache } from "../../../cache.mjs";
7
7
  import { useOgImageRuntimeConfig } from "../../../utils.mjs";
8
- import { useSiteConfig } from "#imports";
9
8
  export default defineEventHandler(async (e) => {
10
9
  const ctx = await resolveRendererContext(e);
11
10
  if (ctx instanceof H3Error)
@@ -26,7 +25,6 @@ export default defineEventHandler(async (e) => {
26
25
  compatibilityHints,
27
26
  cacheKey: ctx.key,
28
27
  options: ctx.options,
29
- siteConfig: useSiteConfig(e),
30
28
  ...options.renderer === "satori" ? await renderer.debug(ctx) : void 0
31
29
  };
32
30
  }
@@ -113,6 +113,7 @@ export interface OgImageOptions<T extends keyof OgImageComponents = 'NuxtSeo'> {
113
113
  }
114
114
  export interface FontConfig {
115
115
  name: string;
116
+ style?: string;
116
117
  weight?: string | number;
117
118
  path?: string;
118
119
  key?: string;
@@ -4,3 +4,5 @@ export declare function separateProps(options: OgImageOptions | undefined, ignor
4
4
  props: Record<string, any>;
5
5
  };
6
6
  export declare function normaliseFontInput(fonts: InputFontConfig[]): ResolvedFontConfig[];
7
+ export declare function withoutQuery(path: string): string;
8
+ export declare function getExtension(path: string): string;
@@ -62,3 +62,11 @@ export function normaliseFontInput(fonts) {
62
62
  };
63
63
  });
64
64
  }
65
+ export function withoutQuery(path) {
66
+ return path.split("?")[0];
67
+ }
68
+ export function getExtension(path) {
69
+ path = withoutQuery(path);
70
+ const lastSegment = path.split("/").pop() || path;
71
+ return lastSegment.split(".").pop() || lastSegment;
72
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-og-image",
3
3
  "type": "module",
4
- "version": "3.0.0-rc.4",
4
+ "version": "3.0.0-rc.6",
5
5
  "packageManager": "pnpm@8.12.0",
6
6
  "description": "Enlightened OG Image generation for Nuxt.",
7
7
  "author": {
@@ -47,8 +47,8 @@
47
47
  "execa": "^8.0.1",
48
48
  "floating-vue": "2.0.0-beta.24",
49
49
  "image-size": "^1.0.2",
50
- "nuxt-site-config": "^1.6.6",
51
- "nuxt-site-config-kit": "^1.6.6",
50
+ "nuxt-site-config": "^1.6.7",
51
+ "nuxt-site-config-kit": "^1.6.7",
52
52
  "nypm": "^0.3.3",
53
53
  "ofetch": "^1.3.3",
54
54
  "ohash": "^1.1.3",
@@ -64,14 +64,15 @@
64
64
  "yoga-wasm-web": "^0.3.3"
65
65
  },
66
66
  "devDependencies": {
67
- "@antfu/eslint-config": "2.4.3",
67
+ "@antfu/eslint-config": "2.4.4",
68
+ "@img/sharp-linux-x64": "0.33.0",
68
69
  "@nuxt/content": "^2.9.0",
69
70
  "@nuxt/devtools": "1.0.5",
70
71
  "@nuxt/module-builder": "^0.5.4",
71
72
  "@nuxt/test-utils": "3.8.1",
72
73
  "@nuxt/ui": "^2.11.0",
73
74
  "@nuxtjs/eslint-config-typescript": "^12.1.0",
74
- "@nuxtjs/i18n": "8.0.0-rc.8",
75
+ "@nuxtjs/i18n": "8.0.0-rc.9",
75
76
  "@nuxtjs/tailwindcss": "^6.10.1",
76
77
  "@unocss/nuxt": "^0.58.0",
77
78
  "bumpp": "^9.2.1",
@@ -1 +0,0 @@
1
- {"id":"f3272063-a39c-4336-ba58-ab7e348c7608","timestamp":1702172470270,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}