nuxt-og-image 7.0.7 → 7.1.1
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/context.js +1 -1
- 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/shared/urlEncoding.js +13 -5
- package/dist/shared/{nuxt-og-image.CS4ArVpM.mjs → nuxt-og-image.Dr6blNqj.mjs} +225 -99
- package/package.json +65 -56
- 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.
|
|
4
|
+
"version": "7.1.1",
|
|
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,21 +58,21 @@
|
|
|
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
|
-
"
|
|
62
|
-
"nuxt": "^4.6.1 || ^5.0.0",
|
|
68
|
+
"nuxt": "^4.6.1 || ^5.0.0-0",
|
|
63
69
|
"playwright-core": "^1.64.0",
|
|
64
70
|
"satori": "^0.47.1",
|
|
65
71
|
"sharp": "^0.35.5",
|
|
66
72
|
"tailwindcss": "^4.3.3",
|
|
67
73
|
"unifont": "^1.0.3",
|
|
68
74
|
"unstorage": "^1.17.5",
|
|
75
|
+
"valibot": "^1.0.0",
|
|
69
76
|
"zod": "^4.6.6"
|
|
70
77
|
},
|
|
71
78
|
"peerDependenciesMeta": {
|
|
@@ -93,9 +100,6 @@
|
|
|
93
100
|
"fontless": {
|
|
94
101
|
"optional": true
|
|
95
102
|
},
|
|
96
|
-
"nitropack": {
|
|
97
|
-
"optional": true
|
|
98
|
-
},
|
|
99
103
|
"playwright-core": {
|
|
100
104
|
"optional": true
|
|
101
105
|
},
|
|
@@ -111,17 +115,20 @@
|
|
|
111
115
|
"unifont": {
|
|
112
116
|
"optional": true
|
|
113
117
|
},
|
|
118
|
+
"valibot": {
|
|
119
|
+
"optional": true
|
|
120
|
+
},
|
|
114
121
|
"zod": {
|
|
115
122
|
"optional": true
|
|
116
123
|
}
|
|
117
124
|
},
|
|
118
125
|
"dependencies": {
|
|
119
126
|
"@clack/prompts": "^1.8.1",
|
|
120
|
-
"@nuxt/kit": "^4.6.
|
|
121
|
-
"@vue/compiler-sfc": "^3.5.
|
|
127
|
+
"@nuxt/kit": "^4.6.2",
|
|
128
|
+
"@vue/compiler-sfc": "^3.5.44",
|
|
122
129
|
"consola": "^3.4.2",
|
|
123
130
|
"defu": "^6.1.7",
|
|
124
|
-
"devalue": "^6.0.
|
|
131
|
+
"devalue": "^6.0.3",
|
|
125
132
|
"exsolve": "^1.1.3",
|
|
126
133
|
"fnv1a-64": "^0.1.2",
|
|
127
134
|
"lightningcss": "^1.33.0",
|
|
@@ -129,13 +136,13 @@
|
|
|
129
136
|
"magic-string": "^1.4.3",
|
|
130
137
|
"magicast": "^0.5.5",
|
|
131
138
|
"mocked-exports": "^0.1.1",
|
|
132
|
-
"nuxt-site-config": "^5.0.
|
|
133
|
-
"nuxtseo-shared": "^6.0.
|
|
134
|
-
"nypm": "^0.6.
|
|
139
|
+
"nuxt-site-config": "^5.0.4",
|
|
140
|
+
"nuxtseo-shared": "^6.0.4",
|
|
141
|
+
"nypm": "^0.6.11",
|
|
135
142
|
"object-identity": "^0.2.3",
|
|
136
143
|
"ofetch": "^1.5.1",
|
|
137
144
|
"ohash": "^2.0.12",
|
|
138
|
-
"oxc-parser": "^0.
|
|
145
|
+
"oxc-parser": "^0.155.0",
|
|
139
146
|
"oxc-walker": "^1.1.1",
|
|
140
147
|
"pathe": "^2.0.3",
|
|
141
148
|
"radix3": "^1.1.2",
|
|
@@ -147,24 +154,24 @@
|
|
|
147
154
|
"unplugin": "^3.4.0"
|
|
148
155
|
},
|
|
149
156
|
"devDependencies": {
|
|
150
|
-
"@antfu/eslint-config": "^
|
|
157
|
+
"@antfu/eslint-config": "^10.0.0",
|
|
151
158
|
"@fontsource/noto-sans-sc": "^5.3.1",
|
|
152
|
-
"@iconify-json/carbon": "^1.2.
|
|
153
|
-
"@iconify-json/logos": "^1.2.
|
|
159
|
+
"@iconify-json/carbon": "^1.2.29",
|
|
160
|
+
"@iconify-json/logos": "^1.2.17",
|
|
154
161
|
"@iconify-json/noto": "^1.2.9",
|
|
155
162
|
"@iconify-json/ri": "^1.2.10",
|
|
156
163
|
"@iconify-json/tabler": "^1.2.42",
|
|
157
164
|
"@iconify/types": "^2.0.0",
|
|
158
165
|
"@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.
|
|
166
|
+
"@nuxt/content": "^3.16.2",
|
|
167
|
+
"@nuxt/devtools": "4.0.0-beta.7",
|
|
168
|
+
"@nuxt/devtools-kit": "4.0.0-beta.7",
|
|
169
|
+
"@nuxt/fonts": "^1.2.0",
|
|
170
|
+
"@nuxt/icon": "^2.6.1",
|
|
171
|
+
"@nuxt/image": "^2.2.0",
|
|
165
172
|
"@nuxt/module-builder": "^1.0.3",
|
|
166
|
-
"@nuxt/test-utils": "^4.3.
|
|
167
|
-
"@nuxt/ui": "^4.
|
|
173
|
+
"@nuxt/test-utils": "^4.3.4",
|
|
174
|
+
"@nuxt/ui": "^4.12.0",
|
|
168
175
|
"@nuxtjs/color-mode": "^4.0.1",
|
|
169
176
|
"@nuxtjs/eslint-config-typescript": "^12.1.0",
|
|
170
177
|
"@nuxtjs/i18n": "^10.6.0",
|
|
@@ -172,50 +179,52 @@
|
|
|
172
179
|
"@resvg/resvg-js": "^2.6.2",
|
|
173
180
|
"@resvg/resvg-wasm": "^2.6.2",
|
|
174
181
|
"@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.
|
|
182
|
+
"@takumi-rs/core": "^2.19.0",
|
|
183
|
+
"@takumi-rs/helpers": "^2.19.0",
|
|
184
|
+
"@takumi-rs/wasm": "^2.19.0",
|
|
185
|
+
"@unocss/config": "^66.11.0",
|
|
186
|
+
"@unocss/core": "^66.11.0",
|
|
187
|
+
"@unocss/nuxt": "^66.11.0",
|
|
188
|
+
"@unocss/preset-icons": "^66.11.0",
|
|
189
|
+
"@unocss/preset-wind": "^66.11.0",
|
|
190
|
+
"@unocss/preset-wind4": "^66.11.0",
|
|
184
191
|
"@vitejs/plugin-vue": "^6.0.10",
|
|
185
|
-
"@vue/compiler-core": "^3.5.
|
|
192
|
+
"@vue/compiler-core": "^3.5.44",
|
|
186
193
|
"@vueuse/nuxt": "^15.0.0",
|
|
187
194
|
"aws4fetch": "^1.0.20",
|
|
188
195
|
"birpc": "^4.2.0",
|
|
189
196
|
"bumpp": "^12.3.0",
|
|
190
197
|
"chrome-launcher": "^1.2.2",
|
|
191
|
-
"eslint": "^10.
|
|
198
|
+
"eslint": "^10.13.0",
|
|
192
199
|
"eslint-plugin-harlanzw": "^0.23.0",
|
|
193
|
-
"fontless": "^1.3.
|
|
200
|
+
"fontless": "^1.3.4",
|
|
194
201
|
"globby": "^16.2.4",
|
|
195
|
-
"happy-dom": "^21.0.
|
|
202
|
+
"happy-dom": "^21.0.4",
|
|
196
203
|
"hookable": "^6.1.2",
|
|
197
204
|
"jest-image-snapshot": "^6.5.2",
|
|
205
|
+
"less": "^4.9.1",
|
|
198
206
|
"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.
|
|
207
|
+
"nitropack": "^2.13.5",
|
|
208
|
+
"nuxt": "4.6.2",
|
|
209
|
+
"nuxtseo-layer-devtools": "^6.0.2",
|
|
210
|
+
"playwright": "^1.64.1",
|
|
211
|
+
"playwright-core": "^1.64.1",
|
|
212
|
+
"sass": "^1.106.1",
|
|
213
|
+
"satori": "^0.63.2",
|
|
206
214
|
"sharp": "^0.35.5",
|
|
207
215
|
"sirv": "^3.0.2",
|
|
208
216
|
"tailwindcss": "^4.3.3",
|
|
209
217
|
"typescript": "6.0.3",
|
|
210
218
|
"unbuild": "^3.6.1",
|
|
211
219
|
"unifont": "^1.0.3",
|
|
212
|
-
"unocss": "^66.
|
|
213
|
-
"
|
|
214
|
-
"
|
|
215
|
-
"
|
|
220
|
+
"unocss": "^66.11.0",
|
|
221
|
+
"valibot": "^1.4.2",
|
|
222
|
+
"vite": "^8.3.5",
|
|
223
|
+
"vitest": "^5.0.5",
|
|
224
|
+
"vue": "^3.5.44",
|
|
216
225
|
"vue-tsc": "^3.3.13",
|
|
217
|
-
"wrangler": "^4.
|
|
218
|
-
"zod": "^4.6.
|
|
226
|
+
"wrangler": "^4.152.0",
|
|
227
|
+
"zod": "^4.6.7"
|
|
219
228
|
},
|
|
220
229
|
"scripts": {
|
|
221
230
|
"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
|
-
}
|