nuxt-og-image 3.0.0-rc.3 → 3.0.0-rc.5

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.
@@ -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.dd086114.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.006451f1.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.dd086114.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.006451f1.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.dd086114.js">
6
+ <link rel="modulepreload" as="script" crossorigin href="/__nuxt-og-image/_nuxt/entry.006451f1.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.b7c0506a.js">
9
+ <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/error-404.d6ff1eb0.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.c45b2f29.js">
12
- <script type="module" src="/__nuxt-og-image/_nuxt/entry.dd086114.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.3acec475.js">
12
+ <script type="module" src="/__nuxt-og-image/_nuxt/entry.006451f1.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.json CHANGED
@@ -5,5 +5,5 @@
5
5
  "bridge": false
6
6
  },
7
7
  "configKey": "ogImage",
8
- "version": "3.0.0-rc.3"
8
+ "version": "3.0.0-rc.5"
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.3";
17
+ const version = "3.0.0-rc.5";
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;
@@ -628,7 +631,7 @@ declare module 'nitropack' {
628
631
  }
629
632
  interface NitroRuntimeHooks {
630
633
  'nuxt-og-image:context': (ctx: import('${typesPath}').OgImageRenderEventContext) => void | Promise<void>
631
- 'nuxt-og-image:satori:vnodes': (vnodes: import('${typesPath}').VNode, ctx: ctx: import('${typesPath}').OgImageRenderEventContext) => void | Promise<void>
634
+ 'nuxt-og-image:satori:vnodes': (vnodes: import('${typesPath}').VNode, ctx: import('${typesPath}').OgImageRenderEventContext) => void | Promise<void>
632
635
  }
633
636
  }
634
637
 
@@ -650,11 +653,18 @@ ${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
- normalisedFonts.filter((f) => !f.path && !f.key).forEach(({ name, weight }) => {
657
- nuxt.options.nitro.prerender.routes.push(`/__og-image__/font/${name}/${weight}.ttf`);
660
+ normalisedFonts.filter((f) => !f.path && !f.key).forEach(({ name, weight }, key) => {
661
+ const path = `/__og-image__/font/${name.toLowerCase()}/${weight}.ttf`;
662
+ nuxt.options.nitro.prerender.routes.push(path);
663
+ normalisedFonts[key] = {
664
+ path,
665
+ name,
666
+ weight
667
+ };
658
668
  });
659
669
  }
660
670
  const hasColorModeModule = hasNuxtModule("@nuxtjs/color-mode");
@@ -685,7 +695,7 @@ ${componentImports}
685
695
  if (nuxt.options.dev) {
686
696
  setupDevHandler(config, resolve);
687
697
  setupDevToolsUI(config, resolve);
688
- } else if (nuxt.options._generate) {
698
+ } else if (isNuxtGenerate()) {
689
699
  setupGenerateHandler(config, resolve);
690
700
  } else if (nuxt.options.build) {
691
701
  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
@@ -2,9 +2,11 @@ import { createError, defineEventHandler, proxyRequest, sendRedirect } 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.
@@ -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
  }
@@ -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.3",
4
+ "version": "3.0.0-rc.5",
5
5
  "packageManager": "pnpm@8.12.0",
6
6
  "description": "Enlightened OG Image generation for Nuxt.",
7
7
  "author": {
@@ -42,13 +42,13 @@
42
42
  "@unocss/preset-wind": "^0.58.0",
43
43
  "@vueuse/core": "^10.7.0",
44
44
  "chrome-launcher": "^1.1.0",
45
- "css-inline": "^0.11.0",
45
+ "css-inline": "^0.11.2",
46
46
  "defu": "^6.1.3",
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,17 +64,18 @@
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
- "bumpp": "^9.2.0",
78
+ "bumpp": "^9.2.1",
78
79
  "eslint": "8.55.0",
79
80
  "jest-image-snapshot": "^6.3.0",
80
81
  "nuxt": "^3.8.2",
@@ -82,7 +83,7 @@
82
83
  "playwright": "^1.40.1",
83
84
  "sass": "^1.69.5",
84
85
  "sharp": "^0.33.0",
85
- "vitest": "^1.0.2"
86
+ "vitest": "^1.0.4"
86
87
  },
87
88
  "build": {
88
89
  "externals": [
@@ -1 +0,0 @@
1
- {"id":"f6f30fc8-72d3-4090-90f8-10aeee14e041","timestamp":1702116320967,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}