nuxt-og-image 3.0.0-rc.7 → 3.0.0-rc.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 +4 -4
- package/dist/client/404.html +4 -4
- package/dist/client/_nuxt/{IconCSS.0eb8cd4b.js → IconCSS.ad457eae.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/d8d0c16f-2709-4917-9aad-088138ea1bcf.json +1 -0
- package/dist/client/_nuxt/{entry.5e4ce219.js → entry.6876d7da.js} +3 -3
- package/dist/client/_nuxt/{error-404.69185016.js → error-404.1dded965.js} +1 -1
- package/dist/client/_nuxt/{error-500.0ed0878b.js → error-500.e54daf55.js} +1 -1
- package/dist/client/index.html +4 -4
- package/dist/module.json +1 -1
- package/dist/module.mjs +4 -2
- package/dist/runtime/core/html/devIframeTemplate.mjs +3 -2
- package/dist/runtime/core/renderers/satori/index.mjs +1 -1
- package/dist/runtime/server/routes/__og-image__/font-[name]-[weight].[extension].mjs +18 -1
- package/dist/runtime/server/routes/__og-image__/image.mjs +3 -0
- package/package.json +1 -1
- package/dist/client/_nuxt/builds/meta/17a46b2c-8a3e-4291-8b7c-d7877f1c67c4.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.
|
|
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.6876d7da.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.
|
|
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.6876d7da.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};
|
package/dist/client/index.html
CHANGED
|
@@ -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.
|
|
6
|
+
<link rel="modulepreload" as="script" crossorigin href="/__nuxt-og-image/_nuxt/entry.6876d7da.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.
|
|
9
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/error-404.1dded965.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.
|
|
12
|
-
<script type="module" src="/__nuxt-og-image/_nuxt/entry.
|
|
11
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/error-500.e54daf55.js">
|
|
12
|
+
<script type="module" src="/__nuxt-og-image/_nuxt/entry.6876d7da.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
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.
|
|
17
|
+
const version = "3.0.0-rc.8";
|
|
18
18
|
|
|
19
19
|
const autodetectableProviders = {
|
|
20
20
|
azure_static: "azure",
|
|
@@ -662,7 +662,9 @@ ${componentImports}
|
|
|
662
662
|
normalisedFonts.filter((f) => !f.path && !f.key).forEach((entry, key) => {
|
|
663
663
|
const { name, weight } = entry;
|
|
664
664
|
entry.path = `/__og-image__/font/${name.toLowerCase()}/${weight}.ttf`;
|
|
665
|
-
nuxt.options.nitro.prerender.routes.
|
|
665
|
+
nuxt.options.nitro.prerender.routes.unshift(entry.path);
|
|
666
|
+
if (name === "Inter" && [400, 700].includes(Number(weight)))
|
|
667
|
+
entry.key = `nuxt-og-image:fonts:inter-latin-ext-${weight}-normal.woff`;
|
|
666
668
|
normalisedFonts[key] = entry;
|
|
667
669
|
});
|
|
668
670
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHeadCore } from "@unhead/vue";
|
|
2
2
|
import { renderSSRHead } from "@unhead/ssr";
|
|
3
|
-
import { useOgImageRuntimeConfig } from "../../utils.mjs";
|
|
3
|
+
import { normaliseFontInput, useOgImageRuntimeConfig } from "../../utils.mjs";
|
|
4
4
|
import { applyEmojis } from "./applyEmojis.mjs";
|
|
5
5
|
import { fetchIsland } from "./fetchIsland.mjs";
|
|
6
6
|
import { theme } from "#nuxt-og-image/unocss-config.mjs";
|
|
@@ -11,7 +11,8 @@ export async function devIframeTemplate(ctx) {
|
|
|
11
11
|
const head = createHeadCore();
|
|
12
12
|
head.push(island.head);
|
|
13
13
|
let defaultFontFamily = "sans-serif";
|
|
14
|
-
const
|
|
14
|
+
const normalisedFonts = normaliseFontInput([...options.fonts || [], ...fonts]);
|
|
15
|
+
const firstFont = normalisedFonts[0];
|
|
15
16
|
if (firstFont)
|
|
16
17
|
defaultFontFamily = firstFont.name;
|
|
17
18
|
await applyEmojis(ctx, island);
|
|
@@ -10,7 +10,7 @@ export async function createSvg(event) {
|
|
|
10
10
|
const { fonts, satoriOptions } = useOgImageRuntimeConfig();
|
|
11
11
|
const vnodes = await createVNodes(event);
|
|
12
12
|
await event._nitro.hooks.callHook("nuxt-og-image:satori:vnodes", vnodes, event);
|
|
13
|
-
const normalisedFonts = normaliseFontInput([...
|
|
13
|
+
const normalisedFonts = normaliseFontInput([...event.options.fonts || [], ...fonts]);
|
|
14
14
|
const localFontPromises = [];
|
|
15
15
|
const preloadedFonts = [];
|
|
16
16
|
for (const font of normalisedFonts) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { createError, defineEventHandler, proxyRequest, sendRedirect } from "h3";
|
|
1
|
+
import { createError, defineEventHandler, proxyRequest, sendRedirect, setHeader } from "h3";
|
|
2
2
|
import { parseURL } from "ufo";
|
|
3
|
+
import { getExtension, normaliseFontInput, useOgImageRuntimeConfig } from "../../../utils.mjs";
|
|
4
|
+
import { assets } from "#internal/nitro/virtual/server-assets";
|
|
3
5
|
export default defineEventHandler(async (e) => {
|
|
4
6
|
const path = parseURL(e.path).pathname;
|
|
5
7
|
const [_name, _weight] = path.split("/font/")[1].split(".")[0].split("/");
|
|
@@ -7,6 +9,21 @@ export default defineEventHandler(async (e) => {
|
|
|
7
9
|
return "Provide a font name and weight";
|
|
8
10
|
const name = _name[0].toUpperCase() + _name.slice(1);
|
|
9
11
|
const weight = Math.round(Number.parseInt(_weight) / 100) * 100;
|
|
12
|
+
const config = useOgImageRuntimeConfig();
|
|
13
|
+
const normalisedFonts = normaliseFontInput(config.fonts);
|
|
14
|
+
const font = normalisedFonts.find((font2) => font2.name === name && weight === Number(font2.weight));
|
|
15
|
+
if (!font) {
|
|
16
|
+
return createError({
|
|
17
|
+
statusCode: 404,
|
|
18
|
+
statusMessage: `[Nuxt OG Image] Font ${name}:${weight} not found`
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
if (import.meta.dev || import.meta.prerender) {
|
|
22
|
+
if (font.key && await assets.hasItem(font.key)) {
|
|
23
|
+
setHeader(e, "Content-Type", `font/${getExtension(font.path)}`);
|
|
24
|
+
return assets.getItemRaw(font.key);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
10
27
|
const css = await globalThis.$fetch(`https://fonts.googleapis.com/css2?family=${name}:wght@${weight}`, {
|
|
11
28
|
headers: {
|
|
12
29
|
// Make sure it returns TTF.
|
|
@@ -22,6 +22,9 @@ export default defineEventHandler(async (e) => {
|
|
|
22
22
|
compatibilityHints.push("Inlining CSS is only supported in Node based environments.");
|
|
23
23
|
setHeader(e, "Content-Type", "application/json");
|
|
24
24
|
return {
|
|
25
|
+
siteConfig: {
|
|
26
|
+
url: e.context.siteConfig.get().url
|
|
27
|
+
},
|
|
25
28
|
compatibilityHints,
|
|
26
29
|
cacheKey: ctx.key,
|
|
27
30
|
options: ctx.options,
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"id":"17a46b2c-8a3e-4291-8b7c-d7877f1c67c4","timestamp":1702287239204,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|