nuxt-og-image 3.0.0-beta.43 → 3.0.0-beta.44
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 +5 -5
- package/dist/client/404.html +5 -5
- package/dist/client/_nuxt/IconCSS.4bbe2613.css +1 -0
- package/dist/client/_nuxt/IconCSS.855a731a.js +1 -0
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/aba354ee-8e7d-4534-b1f4-f69d823bd874.json +1 -0
- package/dist/client/_nuxt/{entry.47aab0b4.css → entry.33a59bbf.css} +1 -1
- package/dist/client/_nuxt/{entry.e02bad90.js → entry.98ab6fd3.js} +58 -58
- package/dist/client/_nuxt/{error-404.3bd94f61.js → error-404.efd8f51b.js} +1 -1
- package/dist/client/_nuxt/{error-500.f289d6ba.js → error-500.4c054c3e.js} +1 -1
- package/dist/client/index.html +5 -5
- package/dist/module.d.mts +10 -19
- package/dist/module.d.ts +10 -19
- package/dist/module.json +1 -1
- package/dist/module.mjs +90 -37
- package/dist/runtime/components/Templates/Community/Pergel.vue +104 -0
- package/dist/runtime/composables/defineOgImage.mjs +2 -3
- package/dist/runtime/nuxt/plugins/route-rule-og-image.server.mjs +1 -2
- package/dist/runtime/nuxt/utils.d.ts +2 -1
- package/dist/runtime/nuxt/utils.mjs +22 -1
- package/dist/runtime/server/routes/__og-image__/image.mjs +8 -5
- package/dist/runtime/types.d.ts +16 -3
- package/package.json +3 -3
- package/dist/client/_nuxt/IconCSS.7e8f1f7b.css +0 -1
- package/dist/client/_nuxt/IconCSS.b3381402.js +0 -1
- package/dist/client/_nuxt/builds/meta/db835b47-d685-41ef-bf6b-0c7f22ed1aff.json +0 -1
- package/dist/runtime/core/options/normalise.d.ts +0 -2
- package/dist/runtime/core/options/normalise.mjs +0 -27
- /package/dist/runtime/core/bindings/resvg/{stackblitz.d.ts → wasm-fs.d.ts} +0 -0
- /package/dist/runtime/core/bindings/resvg/{stackblitz.mjs → wasm-fs.mjs} +0 -0
- /package/dist/runtime/core/bindings/satori/{stackblitz.d.ts → wasm-fs.d.ts} +0 -0
- /package/dist/runtime/core/bindings/satori/{stackblitz.mjs → wasm-fs.mjs} +0 -0
|
@@ -6,25 +6,28 @@ import { applyInlineCss } from "../../../core/html/applyInlineCss.mjs";
|
|
|
6
6
|
import { useOgImageBufferCache } from "../../../cache.mjs";
|
|
7
7
|
import { useOgImageRuntimeConfig } from "../../../utils.mjs";
|
|
8
8
|
import { useSiteConfig } from "#imports";
|
|
9
|
+
import compatibility from "#nuxt-og-image/compatibility";
|
|
9
10
|
export default defineEventHandler(async (e) => {
|
|
10
11
|
const ctx = await resolveRendererContext(e);
|
|
11
12
|
if (ctx instanceof H3Error)
|
|
12
13
|
return ctx;
|
|
13
14
|
const { isDebugJsonPayload, extension, options, renderer } = ctx;
|
|
14
15
|
const { debug, baseCacheKey } = useOgImageRuntimeConfig();
|
|
15
|
-
const
|
|
16
|
+
const compatibilityHints = [];
|
|
16
17
|
if (isDebugJsonPayload) {
|
|
17
18
|
const queryExtension = getQuery(e).extension || ctx.options.extension;
|
|
18
19
|
if (["jpeg", "jpg"].includes(queryExtension) && options.renderer === "satori")
|
|
19
|
-
|
|
20
|
+
compatibilityHints.push("Converting PNGs to JPEGs requires Sharp which only runs on Node based systems.");
|
|
20
21
|
if (options.renderer === "chromium")
|
|
21
|
-
|
|
22
|
+
compatibilityHints.push("Using Chromium to generate images is only supported in Node based environments. It's recommended to only use this if you're prerendering");
|
|
22
23
|
if (await applyInlineCss(ctx, await fetchIsland(ctx)))
|
|
23
|
-
|
|
24
|
+
compatibilityHints.push("Inlining CSS is only supported in Node based environments.");
|
|
24
25
|
setHeader(e, "Content-Type", "application/json");
|
|
25
26
|
return {
|
|
26
27
|
compatibility,
|
|
27
|
-
|
|
28
|
+
compatibilityHints,
|
|
29
|
+
cacheKey: ctx.key,
|
|
30
|
+
options: ctx.options,
|
|
28
31
|
siteConfig: useSiteConfig(e),
|
|
29
32
|
...options.renderer === "satori" ? await renderer.debug(ctx) : void 0
|
|
30
33
|
};
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { ResvgRenderOptions } from '@resvg/resvg-js';
|
|
|
4
4
|
import type { SatoriOptions } from 'satori';
|
|
5
5
|
import type { AllowedComponentProps, Component, ComponentCustomProps, VNodeProps } from '@vue/runtime-core';
|
|
6
6
|
import type { SharpOptions } from 'sharp';
|
|
7
|
-
import type { NitroApp } from 'nitropack';
|
|
7
|
+
import type { NitroApp, WasmOptions } from 'nitropack';
|
|
8
8
|
import type { OgImageComponents } from '#nuxt-og-image/components';
|
|
9
9
|
export interface OgImageRenderEventContext {
|
|
10
10
|
e: H3Event;
|
|
@@ -22,8 +22,6 @@ export interface OgImageRuntimeConfig {
|
|
|
22
22
|
satoriOptions: SatoriOptions;
|
|
23
23
|
resvgOptions: ResvgRenderOptions;
|
|
24
24
|
sharpOptions: SharpOptions;
|
|
25
|
-
runtimeSatori: boolean;
|
|
26
|
-
runtimeChromium: boolean;
|
|
27
25
|
defaults: OgImageOptions;
|
|
28
26
|
debug: boolean;
|
|
29
27
|
baseCacheKey: string;
|
|
@@ -115,6 +113,21 @@ export interface FontConfig {
|
|
|
115
113
|
key?: string;
|
|
116
114
|
}
|
|
117
115
|
export type InputFontConfig = (`${string}:${number}` | FontConfig);
|
|
116
|
+
export interface RuntimeCompatibilitySchema {
|
|
117
|
+
bindings: {
|
|
118
|
+
chromium: 'node' | false;
|
|
119
|
+
['css-inline']: 'node' | false;
|
|
120
|
+
resvg: 'node' | 'wasm' | 'wasm-fs' | false;
|
|
121
|
+
satori: 'node' | 'wasm' | 'wasm-fs' | false;
|
|
122
|
+
sharp: 'node' | false;
|
|
123
|
+
};
|
|
124
|
+
wasm?: WasmOptions;
|
|
125
|
+
}
|
|
126
|
+
export interface CompatibilityConfig {
|
|
127
|
+
dev?: Partial<RuntimeCompatibilitySchema>;
|
|
128
|
+
runtime?: Partial<RuntimeCompatibilitySchema>;
|
|
129
|
+
prerender?: Partial<RuntimeCompatibilitySchema>;
|
|
130
|
+
}
|
|
118
131
|
export type RendererOptions = Omit<OgImageOptions, 'extension'> & {
|
|
119
132
|
extension: Omit<OgImageOptions['extension'], 'html'>;
|
|
120
133
|
};
|
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-beta.
|
|
4
|
+
"version": "3.0.0-beta.44",
|
|
5
5
|
"packageManager": "pnpm@8.11.0",
|
|
6
6
|
"description": "Enlightened OG Image generation for Nuxt.",
|
|
7
7
|
"author": {
|
|
@@ -64,7 +64,6 @@
|
|
|
64
64
|
"yoga-wasm-web": "^0.3.3"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"sharp": "0.33.0",
|
|
68
67
|
"@antfu/eslint-config": "2.3.4",
|
|
69
68
|
"@img/sharp-linux-x64": "0.33.0",
|
|
70
69
|
"@nuxt/content": "^2.9.0",
|
|
@@ -80,9 +79,10 @@
|
|
|
80
79
|
"eslint": "8.55.0",
|
|
81
80
|
"jest-image-snapshot": "^6.3.0",
|
|
82
81
|
"nuxt": "^3.8.2",
|
|
83
|
-
"nuxt-icon": "0.6.
|
|
82
|
+
"nuxt-icon": "0.6.7",
|
|
84
83
|
"playwright": "^1.40.1",
|
|
85
84
|
"sass": "^1.69.5",
|
|
85
|
+
"sharp": "0.33.0",
|
|
86
86
|
"vitest": "^1.0.1"
|
|
87
87
|
},
|
|
88
88
|
"build": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
span[data-v-6fdb97b6]{background-color:currentColor;display:inline-block;-webkit-mask-image:var(--79268360);mask-image:var(--79268360);-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;vertical-align:middle}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as _,h as f,i as m,j as c,r as d,o as I,c as v,n as x,_ as S}from"./entry.e02bad90.js";const y=_({__name:"IconCSS",props:{name:{type:String,required:!0},size:{type:String,default:""}},setup(u){f(e=>({79268360:p.value}));const t=m(),s=u,l=c(()=>{var e,n;return(n=(e=t.nuxtIcon)==null?void 0:e.aliases)!=null&&n[s.name]?t.nuxtIcon.aliases[s.name]:s.name}),r=c(()=>d(l.value)),p=c(()=>{var o,a;const e=(a=(o=t.nuxtIcon)==null?void 0:o.iconifyApiOptions)==null?void 0:a.url;if(e)try{new URL(e)}catch{console.warn("Nuxt IconCSS: Invalid custom Iconify API URL");return}return`url('${e||"https://api.iconify.design"}/${r.value.prefix}/${r.value.name}.svg')`}),i=c(()=>{var n,o,a;if(!s.size&&typeof((n=t.nuxtIcon)==null?void 0:n.size)=="boolean"&&!((o=t.nuxtIcon)!=null&&o.size))return;const e=s.size||((a=t.nuxtIcon)==null?void 0:a.size)||"1em";return String(Number(e))===e?`${e}px`:e});return(e,n)=>(I(),v("span",{style:x({width:i.value,height:i.value})},null,4))}});const b=S(y,[["__scopeId","data-v-6fdb97b6"]]);export{b as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"id":"db835b47-d685-41ef-bf6b-0c7f22ed1aff","timestamp":1701880683741,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { useOgImageRuntimeConfig } from "../../utils.mjs";
|
|
2
|
-
import { unref } from "#imports";
|
|
3
|
-
import { componentNames } from "#build/og-image-component-names.mjs";
|
|
4
|
-
export function normaliseOptions(_options) {
|
|
5
|
-
const { runtimeSatori } = useOgImageRuntimeConfig();
|
|
6
|
-
const options = { ...unref(_options) };
|
|
7
|
-
if (options.static)
|
|
8
|
-
options.cache = options.cache || options.static;
|
|
9
|
-
if (options.provider === "satori")
|
|
10
|
-
options.renderer = options.renderer || "satori";
|
|
11
|
-
else if (options.provider === "browser")
|
|
12
|
-
options.renderer = options.renderer || "chromium";
|
|
13
|
-
options.renderer = options.renderer || "satori";
|
|
14
|
-
if (options.renderer === "satori" && !runtimeSatori)
|
|
15
|
-
options.renderer = "chromium";
|
|
16
|
-
if (options.component && componentNames) {
|
|
17
|
-
const originalName = options.component;
|
|
18
|
-
for (const component of componentNames) {
|
|
19
|
-
if (component.pascalName.endsWith(originalName) || component.kebabName.endsWith(originalName)) {
|
|
20
|
-
options.component = component.pascalName;
|
|
21
|
-
options.componentHash = component.hash;
|
|
22
|
-
break;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return options;
|
|
27
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|