nuxt-og-image 7.0.6 → 7.1.0
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/chunks/tw4.mjs +1 -2
- package/dist/chunks/uno.mjs +5 -3
- package/dist/content-valibot.d.mts +9 -0
- package/dist/content-valibot.d.ts +9 -0
- package/dist/content-valibot.mjs +11 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -2
- package/dist/runtime/app/client-utils.d.ts +1 -1
- package/dist/runtime/app/client-utils.js +27 -9
- package/dist/runtime/app/composables/_defineOgImageRaw.js +2 -3
- package/dist/runtime/app/utils.js +13 -5
- package/dist/runtime/server/og-image/bindings/font-assets/dev-prerender.js +4 -3
- package/dist/runtime/server/og-image/bindings/takumi/node-dev.d.ts +0 -2
- package/dist/runtime/server/og-image/bindings/takumi/node-dev.js +84 -59
- package/dist/runtime/server/og-image/bindings/takumi/node.d.ts +0 -2
- package/dist/runtime/server/og-image/bindings/takumi/node.js +1 -3
- package/dist/runtime/server/og-image/bindings/takumi/wasm.d.ts +0 -2
- package/dist/runtime/server/og-image/bindings/takumi/wasm.js +1 -3
- package/dist/runtime/server/og-image/core/plugins/imageSrc.js +5 -3
- package/dist/runtime/server/og-image/dev-font-state.d.ts +11 -0
- package/dist/runtime/server/og-image/dev-font-state.js +18 -0
- package/dist/runtime/server/og-image/devtools.js +2 -1
- package/dist/runtime/server/og-image/fonts.d.ts +9 -6
- package/dist/runtime/server/og-image/fonts.js +69 -38
- package/dist/runtime/server/og-image/satori/renderer.js +3 -3
- package/dist/runtime/server/og-image/satori/vnodes.js +2 -2
- package/dist/runtime/server/og-image/takumi/instances.d.ts +0 -2
- package/dist/runtime/server/og-image/takumi/instances.js +0 -3
- package/dist/runtime/server/og-image/takumi/renderer.js +89 -168
- package/dist/runtime/server/og-image/templates/html.js +2 -2
- package/dist/runtime/server/routes/debug.json.js +6 -6
- package/dist/runtime/server/routes/static-font.js +3 -3
- package/dist/runtime/server/signing-secret.js +19 -7
- package/dist/runtime/server/util/cloudflareAssets.js +1 -1
- package/dist/runtime/server/util/fetchLocalAsset.d.ts +1 -1
- package/dist/runtime/server/util/fetchLocalAsset.js +16 -10
- package/dist/shared/{nuxt-og-image.C4hc520M.mjs → nuxt-og-image.Dr6blNqj.mjs} +232 -100
- package/package.json +65 -52
- package/skills/nuxt-og-image/SKILL.md +2 -1
- package/types/virtual.d.ts +5 -0
- package/dist/runtime/server/og-image/bindings/takumi/resource-urls.d.ts +0 -2
- package/dist/runtime/server/og-image/bindings/takumi/resource-urls.js +0 -91
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-og-image",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.0
|
|
4
|
+
"version": "7.1.0",
|
|
5
5
|
"description": "Enlightened OG Image generation for Nuxt.",
|
|
6
6
|
"author": {
|
|
7
7
|
"website": "https://harlanzw.com",
|
|
@@ -23,7 +23,11 @@
|
|
|
23
23
|
"types": "./dist/types.d.mts",
|
|
24
24
|
"import": "./dist/module.mjs"
|
|
25
25
|
},
|
|
26
|
-
"./content": "./dist/content.mjs"
|
|
26
|
+
"./content": "./dist/content.mjs",
|
|
27
|
+
"./content/valibot": {
|
|
28
|
+
"types": "./dist/content-valibot.d.mts",
|
|
29
|
+
"default": "./dist/content-valibot.mjs"
|
|
30
|
+
}
|
|
27
31
|
},
|
|
28
32
|
"main": "./dist/module.mjs",
|
|
29
33
|
"typesVersions": {
|
|
@@ -33,6 +37,9 @@
|
|
|
33
37
|
],
|
|
34
38
|
"content": [
|
|
35
39
|
"./dist/content.d.mts"
|
|
40
|
+
],
|
|
41
|
+
"content/valibot": [
|
|
42
|
+
"dist/content-valibot.d.mts"
|
|
36
43
|
]
|
|
37
44
|
}
|
|
38
45
|
},
|
|
@@ -51,14 +58,14 @@
|
|
|
51
58
|
"peerDependencies": {
|
|
52
59
|
"@resvg/resvg-js": "^2.6.2",
|
|
53
60
|
"@resvg/resvg-wasm": "^2.6.2",
|
|
54
|
-
"@takumi-rs/core": "^2.
|
|
55
|
-
"@takumi-rs/wasm": "^2.
|
|
56
|
-
"@unhead/vue": "^3.
|
|
57
|
-
"@unocss/config": "^66.
|
|
58
|
-
"@unocss/core": "^66.
|
|
61
|
+
"@takumi-rs/core": "^2.19.0",
|
|
62
|
+
"@takumi-rs/wasm": "^2.19.0",
|
|
63
|
+
"@unhead/vue": "^3.5.0",
|
|
64
|
+
"@unocss/config": "^66.11.0",
|
|
65
|
+
"@unocss/core": "^66.11.0",
|
|
59
66
|
"chrome-launcher": "^1.2.2",
|
|
60
67
|
"fontless": "^1.3.2",
|
|
61
|
-
"nitropack": "^2.13.
|
|
68
|
+
"nitropack": "^2.13.5",
|
|
62
69
|
"nuxt": "^4.6.1 || ^5.0.0",
|
|
63
70
|
"playwright-core": "^1.64.0",
|
|
64
71
|
"satori": "^0.47.1",
|
|
@@ -66,6 +73,7 @@
|
|
|
66
73
|
"tailwindcss": "^4.3.3",
|
|
67
74
|
"unifont": "^1.0.3",
|
|
68
75
|
"unstorage": "^1.17.5",
|
|
76
|
+
"valibot": "^1.0.0",
|
|
69
77
|
"zod": "^4.6.6"
|
|
70
78
|
},
|
|
71
79
|
"peerDependenciesMeta": {
|
|
@@ -111,17 +119,20 @@
|
|
|
111
119
|
"unifont": {
|
|
112
120
|
"optional": true
|
|
113
121
|
},
|
|
122
|
+
"valibot": {
|
|
123
|
+
"optional": true
|
|
124
|
+
},
|
|
114
125
|
"zod": {
|
|
115
126
|
"optional": true
|
|
116
127
|
}
|
|
117
128
|
},
|
|
118
129
|
"dependencies": {
|
|
119
130
|
"@clack/prompts": "^1.8.1",
|
|
120
|
-
"@nuxt/kit": "^4.6.
|
|
121
|
-
"@vue/compiler-sfc": "^3.5.
|
|
131
|
+
"@nuxt/kit": "^4.6.2",
|
|
132
|
+
"@vue/compiler-sfc": "^3.5.44",
|
|
122
133
|
"consola": "^3.4.2",
|
|
123
134
|
"defu": "^6.1.7",
|
|
124
|
-
"devalue": "^6.0.
|
|
135
|
+
"devalue": "^6.0.3",
|
|
125
136
|
"exsolve": "^1.1.3",
|
|
126
137
|
"fnv1a-64": "^0.1.2",
|
|
127
138
|
"lightningcss": "^1.33.0",
|
|
@@ -129,13 +140,13 @@
|
|
|
129
140
|
"magic-string": "^1.4.3",
|
|
130
141
|
"magicast": "^0.5.5",
|
|
131
142
|
"mocked-exports": "^0.1.1",
|
|
132
|
-
"nuxt-site-config": "^5.0.
|
|
133
|
-
"nuxtseo-shared": "^6.0.
|
|
134
|
-
"nypm": "^0.6.
|
|
143
|
+
"nuxt-site-config": "^5.0.4",
|
|
144
|
+
"nuxtseo-shared": "^6.0.4",
|
|
145
|
+
"nypm": "^0.6.11",
|
|
135
146
|
"object-identity": "^0.2.3",
|
|
136
147
|
"ofetch": "^1.5.1",
|
|
137
148
|
"ohash": "^2.0.12",
|
|
138
|
-
"oxc-parser": "^0.
|
|
149
|
+
"oxc-parser": "^0.155.0",
|
|
139
150
|
"oxc-walker": "^1.1.1",
|
|
140
151
|
"pathe": "^2.0.3",
|
|
141
152
|
"radix3": "^1.1.2",
|
|
@@ -147,24 +158,24 @@
|
|
|
147
158
|
"unplugin": "^3.4.0"
|
|
148
159
|
},
|
|
149
160
|
"devDependencies": {
|
|
150
|
-
"@antfu/eslint-config": "^
|
|
161
|
+
"@antfu/eslint-config": "^10.0.0",
|
|
151
162
|
"@fontsource/noto-sans-sc": "^5.3.1",
|
|
152
|
-
"@iconify-json/carbon": "^1.2.
|
|
153
|
-
"@iconify-json/logos": "^1.2.
|
|
163
|
+
"@iconify-json/carbon": "^1.2.29",
|
|
164
|
+
"@iconify-json/logos": "^1.2.17",
|
|
154
165
|
"@iconify-json/noto": "^1.2.9",
|
|
155
166
|
"@iconify-json/ri": "^1.2.10",
|
|
156
167
|
"@iconify-json/tabler": "^1.2.42",
|
|
157
168
|
"@iconify/types": "^2.0.0",
|
|
158
169
|
"@img/sharp-linux-x64": "^0.35.5",
|
|
159
|
-
"@nuxt/content": "^3.16.
|
|
160
|
-
"@nuxt/devtools": "4.0.0-beta.
|
|
161
|
-
"@nuxt/devtools-kit": "4.0.0-beta.
|
|
162
|
-
"@nuxt/fonts": "^1.0
|
|
163
|
-
"@nuxt/icon": "^2.
|
|
164
|
-
"@nuxt/image": "^2.
|
|
170
|
+
"@nuxt/content": "^3.16.2",
|
|
171
|
+
"@nuxt/devtools": "4.0.0-beta.7",
|
|
172
|
+
"@nuxt/devtools-kit": "4.0.0-beta.7",
|
|
173
|
+
"@nuxt/fonts": "^1.2.0",
|
|
174
|
+
"@nuxt/icon": "^2.6.1",
|
|
175
|
+
"@nuxt/image": "^2.2.0",
|
|
165
176
|
"@nuxt/module-builder": "^1.0.3",
|
|
166
|
-
"@nuxt/test-utils": "^4.3.
|
|
167
|
-
"@nuxt/ui": "^4.
|
|
177
|
+
"@nuxt/test-utils": "^4.3.4",
|
|
178
|
+
"@nuxt/ui": "^4.12.0",
|
|
168
179
|
"@nuxtjs/color-mode": "^4.0.1",
|
|
169
180
|
"@nuxtjs/eslint-config-typescript": "^12.1.0",
|
|
170
181
|
"@nuxtjs/i18n": "^10.6.0",
|
|
@@ -172,50 +183,52 @@
|
|
|
172
183
|
"@resvg/resvg-js": "^2.6.2",
|
|
173
184
|
"@resvg/resvg-wasm": "^2.6.2",
|
|
174
185
|
"@tailwindcss/vite": "^4.3.3",
|
|
175
|
-
"@takumi-rs/core": "^2.
|
|
176
|
-
"@takumi-rs/helpers": "^2.
|
|
177
|
-
"@takumi-rs/wasm": "^2.
|
|
178
|
-
"@unocss/config": "^66.
|
|
179
|
-
"@unocss/core": "^66.
|
|
180
|
-
"@unocss/nuxt": "^66.
|
|
181
|
-
"@unocss/preset-icons": "^66.
|
|
182
|
-
"@unocss/preset-wind": "^66.
|
|
183
|
-
"@unocss/preset-wind4": "^66.
|
|
186
|
+
"@takumi-rs/core": "^2.19.0",
|
|
187
|
+
"@takumi-rs/helpers": "^2.19.0",
|
|
188
|
+
"@takumi-rs/wasm": "^2.19.0",
|
|
189
|
+
"@unocss/config": "^66.11.0",
|
|
190
|
+
"@unocss/core": "^66.11.0",
|
|
191
|
+
"@unocss/nuxt": "^66.11.0",
|
|
192
|
+
"@unocss/preset-icons": "^66.11.0",
|
|
193
|
+
"@unocss/preset-wind": "^66.11.0",
|
|
194
|
+
"@unocss/preset-wind4": "^66.11.0",
|
|
184
195
|
"@vitejs/plugin-vue": "^6.0.10",
|
|
185
|
-
"@vue/compiler-core": "^3.5.
|
|
196
|
+
"@vue/compiler-core": "^3.5.44",
|
|
186
197
|
"@vueuse/nuxt": "^15.0.0",
|
|
187
198
|
"aws4fetch": "^1.0.20",
|
|
188
199
|
"birpc": "^4.2.0",
|
|
189
200
|
"bumpp": "^12.3.0",
|
|
190
201
|
"chrome-launcher": "^1.2.2",
|
|
191
|
-
"eslint": "^10.
|
|
202
|
+
"eslint": "^10.13.0",
|
|
192
203
|
"eslint-plugin-harlanzw": "^0.23.0",
|
|
193
|
-
"fontless": "^1.3.
|
|
204
|
+
"fontless": "^1.3.4",
|
|
194
205
|
"globby": "^16.2.4",
|
|
195
|
-
"happy-dom": "^21.0.
|
|
206
|
+
"happy-dom": "^21.0.4",
|
|
196
207
|
"hookable": "^6.1.2",
|
|
197
208
|
"jest-image-snapshot": "^6.5.2",
|
|
209
|
+
"less": "^4.9.1",
|
|
198
210
|
"lightningcss": "^1.33.0",
|
|
199
|
-
"nitropack": "^2.13.
|
|
200
|
-
"nuxt": "4.6.
|
|
201
|
-
"nuxtseo-layer-devtools": "^
|
|
202
|
-
"playwright": "^1.64.
|
|
203
|
-
"playwright-core": "^1.64.
|
|
204
|
-
"sass": "^1.
|
|
205
|
-
"satori": "^0.
|
|
211
|
+
"nitropack": "^2.13.5",
|
|
212
|
+
"nuxt": "4.6.2",
|
|
213
|
+
"nuxtseo-layer-devtools": "^6.0.2",
|
|
214
|
+
"playwright": "^1.64.1",
|
|
215
|
+
"playwright-core": "^1.64.1",
|
|
216
|
+
"sass": "^1.106.1",
|
|
217
|
+
"satori": "^0.63.2",
|
|
206
218
|
"sharp": "^0.35.5",
|
|
207
219
|
"sirv": "^3.0.2",
|
|
208
220
|
"tailwindcss": "^4.3.3",
|
|
209
221
|
"typescript": "6.0.3",
|
|
210
222
|
"unbuild": "^3.6.1",
|
|
211
223
|
"unifont": "^1.0.3",
|
|
212
|
-
"unocss": "^66.
|
|
213
|
-
"
|
|
214
|
-
"
|
|
215
|
-
"
|
|
224
|
+
"unocss": "^66.11.0",
|
|
225
|
+
"valibot": "^1.4.2",
|
|
226
|
+
"vite": "^8.3.5",
|
|
227
|
+
"vitest": "^5.0.5",
|
|
228
|
+
"vue": "^3.5.44",
|
|
216
229
|
"vue-tsc": "^3.3.13",
|
|
217
|
-
"wrangler": "^4.
|
|
218
|
-
"zod": "^4.6.
|
|
230
|
+
"wrangler": "^4.152.0",
|
|
231
|
+
"zod": "^4.6.7"
|
|
219
232
|
},
|
|
220
233
|
"scripts": {
|
|
221
234
|
"bench:edge-startup": "nuxt build bench/fixtures/edge-startup && node bench/edge-startup.mjs bench/fixtures/edge-startup/.netlify/edge-functions/server/server.js",
|
|
@@ -122,7 +122,8 @@ v7 changes that v6 examples still show:
|
|
|
122
122
|
- Satori 0.47.1+ uses native layout. A bare `<div>` is no longer a flex column. Add `flex flex-col` where the template needs it.
|
|
123
123
|
- Custom fonts need `@nuxt/fonts` 1.0+. With an older version, images fall back to Inter.
|
|
124
124
|
- Takumi v1 is removed. Use `@takumi-rs/core` or `@takumi-rs/wasm` `^2.15.0`. Merge `takumi.fetchedResources` and `takumi.persistentImages` into `takumi.images`.
|
|
125
|
-
- `defineOgImageSchema()`
|
|
125
|
+
- For Zod collections, install Zod 4 and import `defineOgImageSchema()` from `nuxt-og-image/content`.
|
|
126
|
+
- For Valibot collections, install `valibot` and `@valibot/to-json-schema`. Import the helper from `nuxt-og-image/content/valibot`.
|
|
126
127
|
- `getOgImageUrl(event, ...)` takes the Nuxt `RequestEvent`. Import `defineEventHandler` from `nuxt/server`, not the h3 auto-import.
|
|
127
128
|
- `chrome-launcher` is no longer installed. Without it, the browser renderer downloads Chromium instead of using a local Chrome. Run `pnpm add -D chrome-launcher`. Without `playwright-core`, a browser renderer build fails.
|
|
128
129
|
- The DevTools panel needs `nuxtseo-devtools-host` as a dev dependency: `pnpm add -D nuxtseo-devtools-host@^1`.
|
package/types/virtual.d.ts
CHANGED
|
@@ -2,6 +2,11 @@ declare module '#build/nuxt-og-image/client-config.mjs' {
|
|
|
2
2
|
export const hasServerRuntime: boolean
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
+
declare module '#build/nuxt-og-image/component-hashes.mjs' {
|
|
6
|
+
export const defaultComponentName: string | undefined
|
|
7
|
+
export const componentHashes: Record<string, string>
|
|
8
|
+
}
|
|
9
|
+
|
|
5
10
|
declare module '#og-image-virtual/signing.mjs' {
|
|
6
11
|
export const rendersImages: boolean
|
|
7
12
|
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
function isWhitespace(char) {
|
|
2
|
-
return char === " " || char === "\n" || char === " " || char === "\r" || char === "\f";
|
|
3
|
-
}
|
|
4
|
-
function findUrlFunction(value, start) {
|
|
5
|
-
for (let i = start; i <= value.length - 4; i++) {
|
|
6
|
-
if ((value[i] === "u" || value[i] === "U") && (value[i + 1] === "r" || value[i + 1] === "R") && (value[i + 2] === "l" || value[i + 2] === "L") && value[i + 3] === "(") {
|
|
7
|
-
return i;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
return -1;
|
|
11
|
-
}
|
|
12
|
-
function readQuotedUrl(value, start, quote) {
|
|
13
|
-
let i = start + 1;
|
|
14
|
-
while (i < value.length) {
|
|
15
|
-
const char = value[i];
|
|
16
|
-
if (char === "\\") {
|
|
17
|
-
i += 2;
|
|
18
|
-
continue;
|
|
19
|
-
}
|
|
20
|
-
if (char === quote) {
|
|
21
|
-
const url = value.slice(start + 1, i);
|
|
22
|
-
i++;
|
|
23
|
-
while (isWhitespace(value[i]))
|
|
24
|
-
i++;
|
|
25
|
-
return value[i] === ")" ? { end: i + 1, url } : null;
|
|
26
|
-
}
|
|
27
|
-
i++;
|
|
28
|
-
}
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
function readUnquotedUrl(value, start) {
|
|
32
|
-
const end = value.indexOf(")", start);
|
|
33
|
-
return end === -1 ? null : { end: end + 1, url: value.slice(start, end) };
|
|
34
|
-
}
|
|
35
|
-
function collectCssUrls(value, urls) {
|
|
36
|
-
let index = 0;
|
|
37
|
-
while (index < value.length) {
|
|
38
|
-
const start = findUrlFunction(value, index);
|
|
39
|
-
if (start === -1)
|
|
40
|
-
return;
|
|
41
|
-
let urlStart = start + 4;
|
|
42
|
-
while (isWhitespace(value[urlStart]))
|
|
43
|
-
urlStart++;
|
|
44
|
-
const quote = value[urlStart];
|
|
45
|
-
const result = quote === "'" || quote === '"' ? readQuotedUrl(value, urlStart, quote) : readUnquotedUrl(value, urlStart);
|
|
46
|
-
if (!result) {
|
|
47
|
-
index = start + 4;
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
const url = result.url.trim();
|
|
51
|
-
if (isFetchableResourceUrl(url))
|
|
52
|
-
urls.add(url);
|
|
53
|
-
index = result.end;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function isFetchableResourceUrl(value) {
|
|
57
|
-
return typeof value === "string" && (value.startsWith("/") || /^https?:\/\//i.test(value));
|
|
58
|
-
}
|
|
59
|
-
function collectUrlsFromValue(value, urls) {
|
|
60
|
-
if (typeof value !== "string") {
|
|
61
|
-
if (Array.isArray(value)) {
|
|
62
|
-
for (const item of value)
|
|
63
|
-
collectUrlsFromValue(item, urls);
|
|
64
|
-
}
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
collectCssUrls(value, urls);
|
|
68
|
-
}
|
|
69
|
-
function collectStyleUrls(style, urls) {
|
|
70
|
-
if (!style || typeof style !== "object")
|
|
71
|
-
return;
|
|
72
|
-
for (const value of Object.values(style))
|
|
73
|
-
collectUrlsFromValue(value, urls);
|
|
74
|
-
}
|
|
75
|
-
function collectNodeUrls(node, urls) {
|
|
76
|
-
collectStyleUrls(node.style, urls);
|
|
77
|
-
collectStyleUrls(node.preset, urls);
|
|
78
|
-
collectUrlsFromValue(node.tw, urls);
|
|
79
|
-
if (node.type === "image" && isFetchableResourceUrl(node.src))
|
|
80
|
-
urls.add(node.src);
|
|
81
|
-
if (node.type === "container") {
|
|
82
|
-
for (const child of node.children || [])
|
|
83
|
-
collectNodeUrls(child, urls);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
export function extractResourceUrls(nodes) {
|
|
87
|
-
const urls = /* @__PURE__ */ new Set();
|
|
88
|
-
for (const node of Array.isArray(nodes) ? nodes : [nodes])
|
|
89
|
-
collectNodeUrls(node, urls);
|
|
90
|
-
return [...urls];
|
|
91
|
-
}
|