nuxt-og-image 3.0.0-rc.22 → 3.0.0-rc.24

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.hBpxE0F3.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.ArGB1S_f.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.hBpxE0F3.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.ArGB1S_f.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,12 +1,12 @@
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.4NCgbL5v.css">
4
- <link rel="modulepreload" as="script" crossorigin href="/__nuxt-og-image/_nuxt/entry.hBpxE0F3.js">
4
+ <link rel="modulepreload" as="script" crossorigin href="/__nuxt-og-image/_nuxt/entry.ArGB1S_f.js">
5
5
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/vanilla-picker-NKbIFE8h.vtyeXros.js">
6
6
  <link rel="prefetch" as="style" href="/__nuxt-og-image/_nuxt/error-404.DkXpI38i.css">
7
- <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/error-404.ijR0h6rZ.js">
7
+ <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/error-404.08qzHJIB.js">
8
8
  <link rel="prefetch" as="style" href="/__nuxt-og-image/_nuxt/error-500.SLhS9LVu.css">
9
- <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/error-500.HSqygLPT.js">
10
- <script type="module" src="/__nuxt-og-image/_nuxt/entry.hBpxE0F3.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"}})();
9
+ <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/error-500.lmEGWhBr.js">
10
+ <script type="module" src="/__nuxt-og-image/_nuxt/entry.ArGB1S_f.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
11
  </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>
12
12
  <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-og-image",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
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.21"
8
+ "version": "3.0.0-rc.23"
9
9
  }
package/dist/module.mjs CHANGED
@@ -7,6 +7,7 @@ import { hash } from 'ohash';
7
7
  import { relative, dirname } from 'pathe';
8
8
  import { defu } from 'defu';
9
9
  import { Launcher } from 'chrome-launcher';
10
+ import { readPackageJSON } from 'pkg-types';
10
11
  import { ensureDependencyInstalled } from 'nypm';
11
12
  import { onDevToolsInitialized, extendServerRpc } from '@nuxt/devtools-kit';
12
13
  import { readFile, writeFile } from 'node:fs/promises';
@@ -14,8 +15,6 @@ import { createHash } from 'node:crypto';
14
15
  import { execa } from 'execa';
15
16
  import terminate from 'terminate';
16
17
 
17
- const version = "3.0.0-rc.21";
18
-
19
18
  const autodetectableProviders = {
20
19
  azure_static: "azure",
21
20
  cloudflare_pages: "cloudflare-pages",
@@ -415,7 +414,9 @@ const module = defineNuxtModule({
415
414
  };
416
415
  },
417
416
  async setup(config, nuxt) {
418
- const logger = useLogger("nuxt-og-image");
417
+ const { resolve } = createResolver(import.meta.url);
418
+ const { name, version } = await readPackageJSON(resolve("../package.json"));
419
+ const logger = useLogger(name);
419
420
  logger.level = config.debug || nuxt.options.debug ? 4 : 3;
420
421
  if (config.enabled === false) {
421
422
  logger.debug("The module is disabled, skipping setup.");
@@ -425,7 +426,6 @@ const module = defineNuxtModule({
425
426
  logger.warn("Nuxt OG Image is enabled but SSR is disabled.\n\nYou should enable SSR (`ssr: true`) or disable the module (`ogImage: { enabled: false }`).");
426
427
  return;
427
428
  }
428
- const { resolve } = createResolver(import.meta.url);
429
429
  nuxt.options.build.transpile.push(resolve("./runtime"));
430
430
  const preset = resolveNitroPreset(nuxt.options.nitro);
431
431
  const targetCompatibility = getPresetNitroPresetCompatibility(preset);
@@ -543,12 +543,12 @@ const module = defineNuxtModule({
543
543
  handler: resolve("./runtime/server/routes/__og-image__/image")
544
544
  });
545
545
  nuxt.options.optimization.treeShake.composables.client["nuxt-og-image"] = [];
546
- ["defineOgImage", "defineOgImageComponent", "defineOgImageScreenshot"].forEach((name) => {
546
+ ["defineOgImage", "defineOgImageComponent", "defineOgImageScreenshot"].forEach((name2) => {
547
547
  addImports({
548
- name,
549
- from: resolve(`./runtime/composables/${name}`)
548
+ name: name2,
549
+ from: resolve(`./runtime/composables/${name2}`)
550
550
  });
551
- nuxt.options.optimization.treeShake.composables.client["nuxt-og-image"].push(name);
551
+ nuxt.options.optimization.treeShake.composables.client["nuxt-og-image"].push(name2);
552
552
  });
553
553
  await addComponentsDir({
554
554
  path: resolve("./runtime/components/Templates/Community"),
@@ -559,10 +559,10 @@ const module = defineNuxtModule({
559
559
  // new
560
560
  "OgImage",
561
561
  "OgImageScreenshot"
562
- ].forEach((name) => {
562
+ ].forEach((name2) => {
563
563
  addComponent({
564
- name,
565
- filePath: resolve(`./runtime/components/OgImage/${name}`),
564
+ name: name2,
565
+ filePath: resolve(`./runtime/components/OgImage/${name2}`),
566
566
  ...config.componentOptions
567
567
  });
568
568
  });
@@ -624,7 +624,10 @@ const module = defineNuxtModule({
624
624
  extendTypes("nuxt-og-image", ({ typesPath }) => {
625
625
  const componentImports = ogImageComponentCtx.components.map((component) => {
626
626
  const relativeComponentPath = relative(resolve(nuxt.options.rootDir, nuxt.options.buildDir, "module"), component.path);
627
- return ` '${component.pascalName}': typeof import('${relativeComponentPath}')['default']`;
627
+ const name2 = config.componentDirs.reduce((name3, dir) => {
628
+ return name3.replace(new RegExp(`^${dir}`), "");
629
+ }, component.pascalName);
630
+ return ` '${name2}': typeof import('${relativeComponentPath}')['default']`;
628
631
  }).join("\n");
629
632
  return `
630
633
  declare module 'nitropack' {
@@ -663,12 +666,12 @@ ${componentImports}
663
666
  nuxt.options.nitro.prerender = nuxt.options.nitro.prerender || {};
664
667
  nuxt.options.nitro.prerender.routes = nuxt.options.nitro.prerender.routes || [];
665
668
  normalisedFonts.filter((f) => !f.path && !f.key).forEach((entry, key) => {
666
- const { name, weight } = entry;
669
+ const { name: name2, weight } = entry;
667
670
  if (preset !== "cloudflare") {
668
- entry.path = `/__og-image__/font/${name}/${weight}.ttf`;
671
+ entry.path = `/__og-image__/font/${name2}/${weight}.ttf`;
669
672
  nuxt.options.nitro.prerender.routes.unshift(entry.path);
670
673
  }
671
- if (name === "Inter" && [400, 700].includes(Number(weight)))
674
+ if (name2 === "Inter" && [400, 700].includes(Number(weight)))
672
675
  entry.key = `nuxt-og-image:fonts:inter-latin-ext-${weight}-normal.woff`;
673
676
  normalisedFonts[key] = entry;
674
677
  });
@@ -693,7 +696,9 @@ ${componentImports}
693
696
  // convert the fonts to uniform type to fix ts issue
694
697
  fonts: normalisedFonts,
695
698
  hasNuxtIcon: hasNuxtModule("nuxt-icon"),
696
- colorPreference
699
+ colorPreference,
700
+ // @ts-expect-error runtime type
701
+ isNuxtContentDocumentDriven: !!nuxt.options.content?.documentDriven
697
702
  };
698
703
  nuxt.hooks.callHook("nuxt-og-image:runtime-config", runtimeConfig);
699
704
  nuxt.options.runtimeConfig["nuxt-og-image"] = runtimeConfig;
@@ -2,14 +2,17 @@ import { defineNitroPlugin } from "nitropack/dist/runtime/plugin";
2
2
  import { defu } from "defu";
3
3
  import { getOgImagePath, useOgImageRuntimeConfig } from "../../utils.mjs";
4
4
  export default defineNitroPlugin((nitroApp) => {
5
+ const { isNuxtContentDocumentDriven, defaults } = useOgImageRuntimeConfig();
5
6
  nitroApp.hooks.hook("content:file:afterParse", async (content) => {
6
7
  if (content._draft || content._extension !== "md" || content._partial || content.indexable === false || content.index === false)
7
8
  return;
8
- if (content.path && content.ogImage) {
9
+ let path = content.path;
10
+ if (isNuxtContentDocumentDriven)
11
+ path = content._path;
12
+ if (path && content.ogImage) {
9
13
  const ogImageConfig = typeof content.ogImage === "object" ? content.ogImage : {};
10
- const { defaults } = useOgImageRuntimeConfig();
11
14
  const optionsWithDefault = defu(ogImageConfig, defaults);
12
- const src = getOgImagePath(content.path, optionsWithDefault);
15
+ const src = getOgImagePath(path, optionsWithDefault);
13
16
  const payload = {
14
17
  title: content.title,
15
18
  excerpt: content.description || content.excerpt,
@@ -28,6 +28,7 @@ export interface OgImageRuntimeConfig {
28
28
  fonts: FontConfig[];
29
29
  hasNuxtIcon: boolean;
30
30
  colorPreference: 'light' | 'dark';
31
+ isNuxtContentDocumentDriven: boolean;
31
32
  }
32
33
  export interface OgImageComponent {
33
34
  path?: 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.22",
4
+ "version": "3.0.0-rc.24",
5
5
  "packageManager": "pnpm@8.14.0",
6
6
  "description": "Enlightened OG Image generation for Nuxt.",
7
7
  "author": {
@@ -48,12 +48,13 @@
48
48
  "execa": "^8.0.1",
49
49
  "floating-vue": "2.0.0-beta.24",
50
50
  "image-size": "^1.1.1",
51
- "nuxt-site-config": "^2.2.0",
52
- "nuxt-site-config-kit": "^2.2.0",
51
+ "nuxt-site-config": "^2.2.5",
52
+ "nuxt-site-config-kit": "^2.2.5",
53
53
  "nypm": "^0.3.4",
54
54
  "ofetch": "^1.3.3",
55
55
  "ohash": "^1.1.3",
56
56
  "pathe": "^1.1.1",
57
+ "pkg-types": "^1.0.3",
57
58
  "playwright-core": "^1.40.1",
58
59
  "radix3": "^1.1.0",
59
60
  "satori": "0.10.11",
@@ -1 +0,0 @@
1
- {"id":"185665d2-7763-4db7-8b4f-c0990ede9ef9","timestamp":1704518888423,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}