nuxt-og-image 3.0.0-rc.31 → 3.0.0-rc.33

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 h,f as m}from"./entry.LuO6Nylf.js";const x=t=>(h("data-v-05a2b8a3"),t=t(),m(),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=x(()=>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,N)=>{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 h,f as m}from"./entry.H7kEJXEj.js";const x=t=>(h("data-v-05a2b8a3"),t=t(),m(),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=x(()=>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,N)=>{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.LuO6Nylf.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}'}]}),(b,u)=>(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)])]))}},_=i(x,[["__scopeId","data-v-c967d9a9"]]);export{_ 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.H7kEJXEj.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}'}]}),(b,u)=>(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)])]))}},_=i(x,[["__scopeId","data-v-c967d9a9"]]);export{_ as default};
@@ -1,7 +1,7 @@
1
1
  <!DOCTYPE html><html><head><meta charset="utf-8">
2
2
  <meta name="viewport" content="width=device-width, initial-scale=1">
3
3
  <link rel="stylesheet" href="/__nuxt-og-image/_nuxt/entry.DjkITzvC.css">
4
- <link rel="modulepreload" as="script" crossorigin href="/__nuxt-og-image/_nuxt/entry.LuO6Nylf.js">
4
+ <link rel="modulepreload" as="script" crossorigin href="/__nuxt-og-image/_nuxt/entry.H7kEJXEj.js">
5
5
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/onig.mBJmD8D5.js">
6
6
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/abap.bJqzlTLD.js">
7
7
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/actionscript-3.NUzLYz6e.js">
@@ -221,9 +221,9 @@
221
221
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/vitesse-light.HOMMxGxw.js">
222
222
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/vanilla-picker.P0dws0ou.js">
223
223
  <link rel="prefetch" as="style" href="/__nuxt-og-image/_nuxt/error-404.DkXpI38i.css">
224
- <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/error-404.DE_aZn4X.js">
224
+ <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/error-404.XhlITiCK.js">
225
225
  <link rel="prefetch" as="style" href="/__nuxt-og-image/_nuxt/error-500.SLhS9LVu.css">
226
- <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/error-500.4nIEY5y_.js">
227
- <script type="module" src="/__nuxt-og-image/_nuxt/entry.LuO6Nylf.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"}})();
226
+ <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/error-500.5hiwVASh.js">
227
+ <script type="module" src="/__nuxt-og-image/_nuxt/entry.H7kEJXEj.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"}})();
228
228
  </script></head><body><div id="__nuxt"></div><script type="application/json" id="__NUXT_DATA__" data-ssr="false">[{"_errors":1,"serverRendered":2,"data":3,"state":4,"once":5},{},false,{},{},["Set"]]</script>
229
229
  <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-og-image",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
package/dist/module.d.mts CHANGED
@@ -91,6 +91,7 @@ interface FontConfig {
91
91
  weight?: string | number;
92
92
  path?: string;
93
93
  key?: string;
94
+ absolutePath?: boolean;
94
95
  }
95
96
  type InputFontConfig = (`${string}:${number}` | string | FontConfig);
96
97
  interface RuntimeCompatibilitySchema {
package/dist/module.d.ts CHANGED
@@ -91,6 +91,7 @@ interface FontConfig {
91
91
  weight?: string | number;
92
92
  path?: string;
93
93
  key?: string;
94
+ absolutePath?: boolean;
94
95
  }
95
96
  type InputFontConfig = (`${string}:${number}` | string | FontConfig);
96
97
  interface RuntimeCompatibilitySchema {
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.30"
8
+ "version": "3.0.0-rc.32"
9
9
  }
package/dist/module.mjs CHANGED
@@ -5,11 +5,12 @@ import { useNuxt, addTemplate, loadNuxtModuleInstance, createResolver, resolvePa
5
5
  import { assertSiteConfig, installNuxtSiteConfig } from 'nuxt-site-config-kit';
6
6
  import { provider, env, isCI, isDevelopment } from 'std-env';
7
7
  import { hash } from 'ohash';
8
- import { relative, dirname, basename, isAbsolute, join } from 'pathe';
8
+ import { relative, dirname, basename, join } from 'pathe';
9
9
  import { defu } from 'defu';
10
10
  import { readPackageJSON } from 'pkg-types';
11
11
  import { createStorage } from 'unstorage';
12
12
  import fsDriver from 'unstorage/drivers/fs';
13
+ import { withoutLeadingSlash } from 'ufo';
13
14
  import { ensureDependencyInstalled } from 'nypm';
14
15
  import { onDevToolsInitialized, extendServerRpc } from '@nuxt/devtools-kit';
15
16
  import { createHash } from 'node:crypto';
@@ -532,8 +533,8 @@ const module = defineNuxtModule({
532
533
  addServerPlugin(resolve("./runtime/nitro/plugins/nuxt-content"));
533
534
  if (!config.fonts.length) {
534
535
  config.fonts = [
535
- { name: "Inter", weight: 400, path: resolve("./assets/Inter-400.ttf.base64") },
536
- { name: "Inter", weight: 700, path: resolve("./assets/Inter-700.ttf.base64") }
536
+ { name: "Inter", weight: 400, path: resolve("./assets/Inter-400.ttf.base64"), absolutePath: true },
537
+ { name: "Inter", weight: 700, path: resolve("./assets/Inter-700.ttf.base64"), absolutePath: true }
537
538
  ];
538
539
  }
539
540
  const serverFontsDir = resolve(nuxt.options.buildDir, "cache", `nuxt-og-image@${version}`, "_fonts");
@@ -555,22 +556,22 @@ const module = defineNuxtModule({
555
556
  return false;
556
557
  }
557
558
  } else if (f.path) {
558
- const extension = basename(f.path).split(".").pop();
559
- if (!["woff", "ttf", "otf", "base64"].includes(extension)) {
559
+ const extension = basename(f.path.replace(".base64", "")).split(".").pop();
560
+ if (!["woff", "ttf", "otf"].includes(extension)) {
560
561
  logger.warn(`The ${f.name}:${f.weight} font was skipped because the file extension ${extension} is not supported. Only woff, ttf and otf are supported.`);
561
562
  return false;
562
563
  }
563
- if (!isAbsolute(f.path)) {
564
- f.path = join(nuxt.options.rootDir, nuxt.options.dir.public, f.path);
565
- }
564
+ if (!f.absolutePath)
565
+ f.path = join(nuxt.options.rootDir, nuxt.options.dir.public, withoutLeadingSlash(f.path));
566
566
  if (!existsSync(f.path)) {
567
567
  logger.warn(`The ${f.name}:${f.weight} font was skipped because the file does not exist at path ${f.path}.`);
568
568
  return false;
569
569
  }
570
- const fontData = await readFile(f.path, "base64");
571
- f.key = `nuxt-og-image:fonts:${f.name}-${f.weight}.ttf.base64`;
572
- await fontStorage.setItem(`${basename(f.path)}.base64`, fontData);
570
+ const fontData = await readFile(f.path, f.path.endsWith(".base64") ? "utf-8" : "base64");
571
+ f.key = `nuxt-og-image:fonts:${f.name}-${f.weight}.${extension}.base64`;
572
+ await fontStorage.setItem(`${f.name}-${f.weight}.${extension}.base64`, fontData);
573
573
  delete f.path;
574
+ delete f.absolutePath;
574
575
  }
575
576
  return f;
576
577
  }))).filter(Boolean);
@@ -720,16 +721,6 @@ declare module '#nuxt-og-image/unocss-config' {
720
721
  nuxt.options.nitro = nuxt.options.nitro || {};
721
722
  nuxt.options.nitro.prerender = nuxt.options.nitro.prerender || {};
722
723
  nuxt.options.nitro.prerender.routes = nuxt.options.nitro.prerender.routes || [];
723
- normalisedFonts.filter((f) => !f.path && !f.key).forEach((entry, key) => {
724
- const { name: name2, weight } = entry;
725
- if (preset !== "cloudflare" && preset !== "cloudflare-module") {
726
- entry.path = `/__og-image__/font/${name2}/${weight}.ttf`;
727
- nuxt.options.nitro.prerender.routes.unshift(entry.path);
728
- }
729
- if (name2 === "Inter" && [400, 700].includes(Number(weight)))
730
- entry.key = `nuxt-og-image:fonts:inter-latin-ext-${weight}-normal.woff`;
731
- normalisedFonts[key] = entry;
732
- });
733
724
  }
734
725
  const hasColorModeModule = hasNuxtModule("@nuxtjs/color-mode");
735
726
  const colorModeOptions = hasColorModeModule ? await getNuxtModuleOptions("@nuxtjs/color-mode") : {};
@@ -1,6 +1,4 @@
1
- import { setHeader } from "h3";
2
1
  import { prefixStorage } from "unstorage";
3
- import { getExtension } from "../../../pure.mjs";
4
2
  import { useNitroOrigin, useStorage } from "#imports";
5
3
  const assets = prefixStorage(useStorage(), "/assets");
6
4
  export async function loadFont({ e }, font) {
@@ -8,8 +6,7 @@ export async function loadFont({ e }, font) {
8
6
  if (font.data)
9
7
  return font;
10
8
  if (font.key && await assets.hasItem(font.key)) {
11
- setHeader(e, "Content-Type", `font/${getExtension(font.path)}`);
12
- const fontData = await assets.getItemRaw(font.key);
9
+ const fontData = await assets.getItem(font.key);
13
10
  font.data = Buffer.from(fontData, "base64");
14
11
  return font;
15
12
  }
@@ -118,6 +118,7 @@ export interface FontConfig {
118
118
  weight?: string | number;
119
119
  path?: string;
120
120
  key?: string;
121
+ absolutePath?: boolean;
121
122
  }
122
123
  export interface ResolvedFontConfig extends FontConfig {
123
124
  cacheKey: string;
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.31",
4
+ "version": "3.0.0-rc.33",
5
5
  "packageManager": "pnpm@8.15.1",
6
6
  "description": "Enlightened OG Image generation for Nuxt.",
7
7
  "author": {
@@ -1 +0,0 @@
1
- {"id":"e8c2abb1-c2da-455e-a7e8-26f4f28b10f9","timestamp":1706770552577,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}