nuxt-og-image 3.0.0-beta.45 → 3.0.0-beta.46
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.aba927ca.js → IconCSS.d9f41e05.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/1dade4b1-1b23-441e-85d5-65dfee40f5f7.json +1 -0
- package/dist/client/_nuxt/{entry.b64dd084.js → entry.ea909f2d.js} +52 -51
- package/dist/client/_nuxt/{error-404.8ae425bf.js → error-404.a54c84ea.js} +1 -1
- package/dist/client/_nuxt/{error-500.a5bb9a8b.js → error-500.d52d6657.js} +1 -1
- package/dist/client/index.html +4 -4
- package/dist/module.d.mts +11 -12
- package/dist/module.d.ts +11 -12
- package/dist/module.json +1 -1
- package/dist/module.mjs +98 -101
- package/dist/runtime/nuxt/utils.mjs +2 -2
- package/dist/runtime/server/routes/__og-image__/debug.json.d.ts +1 -0
- package/dist/runtime/server/routes/__og-image__/debug.json.mjs +3 -1
- package/dist/runtime/server/routes/__og-image__/image.mjs +0 -2
- package/dist/runtime/types.d.ts +10 -11
- package/package.json +3 -3
- package/dist/client/_nuxt/builds/meta/1157c25b-5f22-479c-8eb1-b4bd8b88c154.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.ea909f2d.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.ea909f2d.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,12 +3,12 @@
|
|
|
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.33a59bbf.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.ea909f2d.js">
|
|
7
7
|
<link rel="prefetch" as="style" href="/__nuxt-og-image/_nuxt/error-404.b751fa02.css">
|
|
8
|
-
<link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/error-404.
|
|
8
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/error-404.a54c84ea.js">
|
|
9
9
|
<link rel="prefetch" as="style" href="/__nuxt-og-image/_nuxt/error-500.69009e70.css">
|
|
10
|
-
<link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/error-500.
|
|
11
|
-
<script type="module" src="/__nuxt-og-image/_nuxt/entry.
|
|
10
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/error-500.d52d6657.js">
|
|
11
|
+
<script type="module" src="/__nuxt-og-image/_nuxt/entry.ea909f2d.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"}})();
|
|
12
12
|
</script></head>
|
|
13
13
|
<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>
|
|
14
14
|
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-og-image",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body>
|
package/dist/module.d.mts
CHANGED
|
@@ -87,19 +87,18 @@ interface FontConfig {
|
|
|
87
87
|
}
|
|
88
88
|
type InputFontConfig = (`${string}:${number}` | FontConfig);
|
|
89
89
|
interface RuntimeCompatibilitySchema {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
sharp: 'node' | false;
|
|
96
|
-
};
|
|
90
|
+
chromium: 'node' | false;
|
|
91
|
+
['css-inline']: 'node' | false;
|
|
92
|
+
resvg: 'node' | 'wasm' | 'wasm-fs' | false;
|
|
93
|
+
satori: 'node' | 'wasm' | 'wasm-fs' | false;
|
|
94
|
+
sharp: 'node' | false;
|
|
97
95
|
wasm?: WasmOptions;
|
|
98
96
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
type CompatibilityFlags = Partial<Omit<RuntimeCompatibilitySchema, 'wasm'>>;
|
|
98
|
+
interface CompatibilityFlagEnvOverrides {
|
|
99
|
+
dev?: CompatibilityFlags;
|
|
100
|
+
runtime?: CompatibilityFlags;
|
|
101
|
+
prerender?: CompatibilityFlags;
|
|
103
102
|
}
|
|
104
103
|
|
|
105
104
|
interface ModuleOptions {
|
|
@@ -170,7 +169,7 @@ interface ModuleOptions {
|
|
|
170
169
|
/**
|
|
171
170
|
* Manually modify the compatibility.
|
|
172
171
|
*/
|
|
173
|
-
compatibility?:
|
|
172
|
+
compatibility?: CompatibilityFlagEnvOverrides;
|
|
174
173
|
}
|
|
175
174
|
interface ModuleHooks {
|
|
176
175
|
'nuxt-og-image:components': (ctx: {
|
package/dist/module.d.ts
CHANGED
|
@@ -87,19 +87,18 @@ interface FontConfig {
|
|
|
87
87
|
}
|
|
88
88
|
type InputFontConfig = (`${string}:${number}` | FontConfig);
|
|
89
89
|
interface RuntimeCompatibilitySchema {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
sharp: 'node' | false;
|
|
96
|
-
};
|
|
90
|
+
chromium: 'node' | false;
|
|
91
|
+
['css-inline']: 'node' | false;
|
|
92
|
+
resvg: 'node' | 'wasm' | 'wasm-fs' | false;
|
|
93
|
+
satori: 'node' | 'wasm' | 'wasm-fs' | false;
|
|
94
|
+
sharp: 'node' | false;
|
|
97
95
|
wasm?: WasmOptions;
|
|
98
96
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
type CompatibilityFlags = Partial<Omit<RuntimeCompatibilitySchema, 'wasm'>>;
|
|
98
|
+
interface CompatibilityFlagEnvOverrides {
|
|
99
|
+
dev?: CompatibilityFlags;
|
|
100
|
+
runtime?: CompatibilityFlags;
|
|
101
|
+
prerender?: CompatibilityFlags;
|
|
103
102
|
}
|
|
104
103
|
|
|
105
104
|
interface ModuleOptions {
|
|
@@ -170,7 +169,7 @@ interface ModuleOptions {
|
|
|
170
169
|
/**
|
|
171
170
|
* Manually modify the compatibility.
|
|
172
171
|
*/
|
|
173
|
-
compatibility?:
|
|
172
|
+
compatibility?: CompatibilityFlagEnvOverrides;
|
|
174
173
|
}
|
|
175
174
|
interface ModuleHooks {
|
|
176
175
|
'nuxt-og-image:components': (ctx: {
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -7,14 +7,14 @@ 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 {
|
|
10
|
+
import { ensureDependencyInstalled } from 'nypm';
|
|
11
11
|
import { onDevToolsInitialized, extendServerRpc } from '@nuxt/devtools-kit';
|
|
12
12
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
13
13
|
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-beta.
|
|
17
|
+
const version = "3.0.0-beta.46";
|
|
18
18
|
|
|
19
19
|
const autodetectableProviders = {
|
|
20
20
|
azure_static: "azure",
|
|
@@ -31,60 +31,51 @@ const autodetectableStaticProviders = {
|
|
|
31
31
|
};
|
|
32
32
|
const NodeRuntime = {
|
|
33
33
|
// node-server runtime
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
34
|
+
"chromium": "node",
|
|
35
|
+
"css-inline": "node",
|
|
36
|
+
"resvg": "node",
|
|
37
|
+
"satori": "node",
|
|
38
|
+
"sharp": "node"
|
|
39
|
+
// will be disabled if they're missing the dependency
|
|
41
40
|
};
|
|
42
41
|
const cloudflare = {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
wasm: {
|
|
42
|
+
"chromium": false,
|
|
43
|
+
"css-inline": false,
|
|
44
|
+
"resvg": "wasm",
|
|
45
|
+
"satori": "node",
|
|
46
|
+
"sharp": false,
|
|
47
|
+
"wasm": {
|
|
51
48
|
esmImport: true
|
|
52
49
|
}
|
|
53
50
|
};
|
|
54
51
|
const awsLambda = {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
// 0.33.x has issues
|
|
62
|
-
}
|
|
52
|
+
"chromium": false,
|
|
53
|
+
"css-inline": "node",
|
|
54
|
+
"resvg": "node",
|
|
55
|
+
"satori": "node",
|
|
56
|
+
"sharp": false
|
|
57
|
+
// 0.33.x has issues
|
|
63
58
|
};
|
|
64
59
|
const RuntimeCompatibility = {
|
|
65
60
|
"nitro-dev": NodeRuntime,
|
|
66
61
|
"nitro-prerender": NodeRuntime,
|
|
67
62
|
"node-server": NodeRuntime,
|
|
68
63
|
"stackblitz": {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"sharp": false
|
|
75
|
-
}
|
|
64
|
+
"chromium": false,
|
|
65
|
+
"css-inline": false,
|
|
66
|
+
"resvg": "wasm-fs",
|
|
67
|
+
"satori": "wasm-fs",
|
|
68
|
+
"sharp": false
|
|
76
69
|
},
|
|
77
70
|
"aws-lambda": awsLambda,
|
|
78
|
-
"netlify":
|
|
71
|
+
"netlify": awsLambda,
|
|
79
72
|
"netlify-edge": {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
},
|
|
87
|
-
wasm: {
|
|
73
|
+
"chromium": false,
|
|
74
|
+
"css-inline": false,
|
|
75
|
+
"resvg": "wasm",
|
|
76
|
+
"satori": "node",
|
|
77
|
+
"sharp": false,
|
|
78
|
+
"wasm": {
|
|
88
79
|
rollup: {
|
|
89
80
|
targetEnv: "auto-inline",
|
|
90
81
|
sync: ["@resvg/resvg-wasm/index_bg.wasm"]
|
|
@@ -94,14 +85,12 @@ const RuntimeCompatibility = {
|
|
|
94
85
|
"firebase": awsLambda,
|
|
95
86
|
"vercel": awsLambda,
|
|
96
87
|
"vercel-edge": {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
},
|
|
104
|
-
wasm: {
|
|
88
|
+
"chromium": false,
|
|
89
|
+
"css-inline": false,
|
|
90
|
+
"resvg": "wasm",
|
|
91
|
+
"satori": "node",
|
|
92
|
+
"sharp": false,
|
|
93
|
+
"wasm": {
|
|
105
94
|
// lowers workers kb size
|
|
106
95
|
esmImport: true
|
|
107
96
|
}
|
|
@@ -130,15 +119,21 @@ function getPresetNitroPresetCompatibility(target) {
|
|
|
130
119
|
}
|
|
131
120
|
function applyNitroPresetCompatibility(nitroConfig, options) {
|
|
132
121
|
const target = resolveNitroPreset(nitroConfig);
|
|
133
|
-
const compatibility =
|
|
122
|
+
const compatibility = getPresetNitroPresetCompatibility(target);
|
|
134
123
|
const { resolve } = options;
|
|
135
|
-
|
|
136
|
-
|
|
124
|
+
const satoriEnabled = typeof options.compatibility?.satori !== "undefined" ? !!options.compatibility.satori : !!compatibility.satori;
|
|
125
|
+
const chromiumEnabled = typeof options.compatibility?.chromium !== "undefined" ? !!options.compatibility.chromium : !!compatibility.chromium;
|
|
126
|
+
nitroConfig.alias["#nuxt-og-image/renderers/satori"] = satoriEnabled ? resolve("./runtime/core/renderers/satori") : "unenv/runtime/mock/empty";
|
|
127
|
+
nitroConfig.alias["#nuxt-og-image/renderers/chromium"] = chromiumEnabled ? resolve("./runtime/core/renderers/chromium") : "unenv/runtime/mock/empty";
|
|
128
|
+
const resolvedCompatibility = {};
|
|
137
129
|
function applyBinding(key) {
|
|
138
|
-
|
|
139
|
-
if (binding ===
|
|
140
|
-
|
|
141
|
-
|
|
130
|
+
let binding = options.compatibility?.[key];
|
|
131
|
+
if (typeof binding === "undefined")
|
|
132
|
+
binding = compatibility[key];
|
|
133
|
+
resolvedCompatibility[key] = binding;
|
|
134
|
+
return {
|
|
135
|
+
[`#nuxt-og-image/bindings/${key}`]: binding === false ? "unenv/runtime/mock/empty" : resolve(`./runtime/core/bindings/${key}/${binding}`)
|
|
136
|
+
};
|
|
142
137
|
}
|
|
143
138
|
nitroConfig.alias = defu(
|
|
144
139
|
applyBinding("chromium"),
|
|
@@ -148,25 +143,28 @@ function applyNitroPresetCompatibility(nitroConfig, options) {
|
|
|
148
143
|
applyBinding("css-inline"),
|
|
149
144
|
nitroConfig.alias || {}
|
|
150
145
|
);
|
|
151
|
-
if (Object.values(compatibility
|
|
146
|
+
if (Object.values(compatibility).includes("wasm")) {
|
|
152
147
|
nitroConfig.experimental = nitroConfig.experimental || {};
|
|
153
148
|
nitroConfig.experimental.wasm = true;
|
|
154
149
|
}
|
|
155
150
|
nitroConfig.rollupConfig = nitroConfig.rollupConfig || {};
|
|
156
151
|
nitroConfig.wasm = defu(compatibility.wasm, nitroConfig.wasm);
|
|
157
|
-
nitroConfig.virtual["#nuxt-og-image/compatibility"] = () => `export default ${JSON.stringify(
|
|
152
|
+
nitroConfig.virtual["#nuxt-og-image/compatibility"] = () => `export default ${JSON.stringify(resolvedCompatibility)}`;
|
|
158
153
|
addTemplate({
|
|
159
154
|
filename: "nuxt-og-image/compatibility.mjs",
|
|
160
155
|
getContents() {
|
|
161
|
-
return `export default ${JSON.stringify(
|
|
156
|
+
return `export default ${JSON.stringify(resolvedCompatibility)}`;
|
|
162
157
|
},
|
|
163
158
|
options: { mode: "server" }
|
|
164
159
|
});
|
|
165
|
-
return
|
|
160
|
+
return resolvedCompatibility;
|
|
166
161
|
}
|
|
167
162
|
function ensureDependencies(dep, nuxt = useNuxt()) {
|
|
168
163
|
return Promise.all(dep.map((d) => {
|
|
169
|
-
return
|
|
164
|
+
return ensureDependencyInstalled(d, {
|
|
165
|
+
cwd: nuxt.options.rootDir,
|
|
166
|
+
dev: true
|
|
167
|
+
});
|
|
170
168
|
}));
|
|
171
169
|
}
|
|
172
170
|
|
|
@@ -278,13 +276,11 @@ function setupGenerateHandler(options, resolve, nuxt = useNuxt()) {
|
|
|
278
276
|
nuxt.hooks.hook("nitro:config", async (nitroConfig) => {
|
|
279
277
|
applyNitroPresetCompatibility(nitroConfig, {
|
|
280
278
|
compatibility: {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
"sharp": false
|
|
287
|
-
}
|
|
279
|
+
"chromium": false,
|
|
280
|
+
"satori": false,
|
|
281
|
+
"css-inline": false,
|
|
282
|
+
"resvg": false,
|
|
283
|
+
"sharp": false
|
|
288
284
|
},
|
|
289
285
|
resolve
|
|
290
286
|
});
|
|
@@ -406,51 +402,52 @@ const module = defineNuxtModule({
|
|
|
406
402
|
const hasSharpDependency = !!await tryResolveModule("sharp");
|
|
407
403
|
const userConfiguredExtension = config.defaults.extension;
|
|
408
404
|
const hasConfiguredJpegs = userConfiguredExtension && ["jpeg", "jpg"].includes(userConfiguredExtension);
|
|
409
|
-
config.defaults.extension = userConfiguredExtension || (hasSharpDependency && targetCompatibility.
|
|
405
|
+
config.defaults.extension = userConfiguredExtension || (hasSharpDependency && targetCompatibility.sharp ? "jpg" : "png");
|
|
410
406
|
if (hasConfiguredJpegs && config.defaults.renderer !== "chromium") {
|
|
411
|
-
if (hasSharpDependency && !targetCompatibility.
|
|
407
|
+
if (hasSharpDependency && !targetCompatibility.sharp) {
|
|
412
408
|
logger.warn(`Rendering JPEGs requires sharp which does not work with ${preset}. Images will be rendered as PNG at runtime.`);
|
|
413
|
-
config.compatibility = defu({
|
|
414
|
-
runtime: {
|
|
415
|
-
|
|
416
|
-
}
|
|
417
|
-
}, config.compatibility);
|
|
409
|
+
config.compatibility = defu(config.compatibility, {
|
|
410
|
+
runtime: { sharp: false }
|
|
411
|
+
});
|
|
418
412
|
} else if (!hasSharpDependency) {
|
|
419
413
|
logger.warn("You have enabled `JPEG` images. These require the `sharp` dependency which is missing, installing it for you.");
|
|
420
414
|
await ensureDependencies(["sharp"]);
|
|
421
415
|
logger.warn("Support for `sharp` is limited so check the compatibility guide.");
|
|
422
416
|
}
|
|
423
417
|
} else if (!hasSharpDependency) {
|
|
424
|
-
config.compatibility = defu({
|
|
418
|
+
config.compatibility = defu(config.compatibility, {
|
|
425
419
|
runtime: { sharp: false },
|
|
426
420
|
dev: { sharp: false },
|
|
427
421
|
prerender: { sharp: false }
|
|
428
|
-
}
|
|
422
|
+
});
|
|
429
423
|
}
|
|
430
|
-
const
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
424
|
+
const isUndefinedOrTruthy = (v) => typeof v === "undefined" || v !== false;
|
|
425
|
+
if (isUndefinedOrTruthy(config.compatibility?.prerender?.chromium) && isUndefinedOrTruthy(config.compatibility?.runtime?.chromium)) {
|
|
426
|
+
const hasChromeLocally = !!Launcher.getFirstInstallation();
|
|
427
|
+
const hasPlaywrightDependency = !!await tryResolveModule("playwright");
|
|
428
|
+
if (!hasChromeLocally && !hasPlaywrightDependency) {
|
|
429
|
+
if (nuxt.options._generate || config.defaults?.renderer === "chromium")
|
|
430
|
+
await ensureChromium(logger);
|
|
431
|
+
else if (nuxt.options.build)
|
|
432
|
+
logger.info("You are missing a chromium install. You will not be able to prerender images using the chromium render.");
|
|
433
|
+
config.compatibility = defu(config.compatibility, {
|
|
434
|
+
runtime: { chromium: false },
|
|
435
|
+
dev: { chromium: false },
|
|
436
|
+
prerender: { chromium: false }
|
|
437
|
+
});
|
|
438
|
+
} else if (hasChromeLocally) {
|
|
439
|
+
config.compatibility = defu(config.compatibility, {
|
|
440
|
+
runtime: { chromium: false },
|
|
441
|
+
dev: { chromium: "node" },
|
|
442
|
+
prerender: { chromium: "node" }
|
|
443
|
+
});
|
|
444
|
+
} else if (hasPlaywrightDependency && targetCompatibility.chromium) {
|
|
445
|
+
config.compatibility = defu(config.compatibility, {
|
|
446
|
+
runtime: { chromium: "node" },
|
|
447
|
+
dev: { chromium: "node" },
|
|
448
|
+
prerender: { chromium: "node" }
|
|
449
|
+
});
|
|
450
|
+
}
|
|
454
451
|
}
|
|
455
452
|
await installNuxtSiteConfig();
|
|
456
453
|
if (hasNuxtModule("@nuxt/content"))
|
|
@@ -66,9 +66,9 @@ export function normaliseOptions(_options) {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
if (["jpeg", "jpg"].includes(options.extension || "") && !compatibility.
|
|
69
|
+
if (["jpeg", "jpg"].includes(options.extension || "") && !compatibility.sharp)
|
|
70
70
|
options.extension = "png";
|
|
71
|
-
if (options.renderer === "chromium" && !compatibility.
|
|
71
|
+
if (options.renderer === "chromium" && !compatibility.chromium)
|
|
72
72
|
options.renderer = "satori";
|
|
73
73
|
return options;
|
|
74
74
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineEventHandler, setHeader } from "h3";
|
|
2
2
|
import { useOgImageRuntimeConfig } from "../../../utils.mjs";
|
|
3
3
|
import { useSiteConfig } from "#imports";
|
|
4
|
+
import compatibility from "#nuxt-og-image/compatibility";
|
|
4
5
|
import { componentNames } from "#nuxt-og-image/component-names.mjs";
|
|
5
6
|
export default defineEventHandler(async (e) => {
|
|
6
7
|
setHeader(e, "Content-Type", "application/json");
|
|
@@ -12,6 +13,7 @@ export default defineEventHandler(async (e) => {
|
|
|
12
13
|
source: siteConfig._context.url || "unknown"
|
|
13
14
|
},
|
|
14
15
|
componentNames,
|
|
15
|
-
runtimeConfig
|
|
16
|
+
runtimeConfig,
|
|
17
|
+
compatibility
|
|
16
18
|
};
|
|
17
19
|
});
|
|
@@ -6,7 +6,6 @@ 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";
|
|
10
9
|
export default defineEventHandler(async (e) => {
|
|
11
10
|
const ctx = await resolveRendererContext(e);
|
|
12
11
|
if (ctx instanceof H3Error)
|
|
@@ -24,7 +23,6 @@ export default defineEventHandler(async (e) => {
|
|
|
24
23
|
compatibilityHints.push("Inlining CSS is only supported in Node based environments.");
|
|
25
24
|
setHeader(e, "Content-Type", "application/json");
|
|
26
25
|
return {
|
|
27
|
-
compatibility,
|
|
28
26
|
compatibilityHints,
|
|
29
27
|
cacheKey: ctx.key,
|
|
30
28
|
options: ctx.options,
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -114,19 +114,18 @@ export interface FontConfig {
|
|
|
114
114
|
}
|
|
115
115
|
export type InputFontConfig = (`${string}:${number}` | FontConfig);
|
|
116
116
|
export interface RuntimeCompatibilitySchema {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
sharp: 'node' | false;
|
|
123
|
-
};
|
|
117
|
+
chromium: 'node' | false;
|
|
118
|
+
['css-inline']: 'node' | false;
|
|
119
|
+
resvg: 'node' | 'wasm' | 'wasm-fs' | false;
|
|
120
|
+
satori: 'node' | 'wasm' | 'wasm-fs' | false;
|
|
121
|
+
sharp: 'node' | false;
|
|
124
122
|
wasm?: WasmOptions;
|
|
125
123
|
}
|
|
126
|
-
export
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
124
|
+
export type CompatibilityFlags = Partial<Omit<RuntimeCompatibilitySchema, 'wasm'>>;
|
|
125
|
+
export interface CompatibilityFlagEnvOverrides {
|
|
126
|
+
dev?: CompatibilityFlags;
|
|
127
|
+
runtime?: CompatibilityFlags;
|
|
128
|
+
prerender?: CompatibilityFlags;
|
|
130
129
|
}
|
|
131
130
|
export type RendererOptions = Omit<OgImageOptions, 'extension'> & {
|
|
132
131
|
extension: Omit<OgImageOptions['extension'], 'html'>;
|
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.46",
|
|
5
5
|
"packageManager": "pnpm@8.11.0",
|
|
6
6
|
"description": "Enlightened OG Image generation for Nuxt.",
|
|
7
7
|
"author": {
|
|
@@ -65,7 +65,6 @@
|
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@antfu/eslint-config": "2.3.4",
|
|
68
|
-
"@img/sharp-linux-x64": "0.33.0",
|
|
69
68
|
"@nuxt/content": "^2.9.0",
|
|
70
69
|
"@nuxt/devtools": "1.0.4",
|
|
71
70
|
"@nuxt/module-builder": "^0.5.4",
|
|
@@ -82,7 +81,7 @@
|
|
|
82
81
|
"nuxt-icon": "0.6.7",
|
|
83
82
|
"playwright": "^1.40.1",
|
|
84
83
|
"sass": "^1.69.5",
|
|
85
|
-
"sharp": "0.33.0",
|
|
84
|
+
"sharp": "^0.33.0",
|
|
86
85
|
"vitest": "^1.0.1"
|
|
87
86
|
},
|
|
88
87
|
"build": {
|
|
@@ -95,6 +94,7 @@
|
|
|
95
94
|
]
|
|
96
95
|
},
|
|
97
96
|
"scripts": {
|
|
97
|
+
"stub": "nuxt-build-module build --stub",
|
|
98
98
|
"build": "pnpm dev:prepare && pnpm build:module && pnpm build:client",
|
|
99
99
|
"build:client": "nuxi generate client",
|
|
100
100
|
"build:module": "nuxt-build-module build",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"id":"1157c25b-5f22-479c-8eb1-b4bd8b88c154","timestamp":1701917734346,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|