nuxt-og-image 6.1.2 → 6.2.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/README.md +4 -1
- package/dist/chunks/tw4.cjs +4 -3
- package/dist/chunks/tw4.mjs +4 -3
- package/dist/chunks/uno.cjs +4 -3
- package/dist/chunks/uno.mjs +4 -3
- package/dist/content.cjs +14 -15
- package/dist/content.d.cts +9 -29
- package/dist/content.d.mts +9 -29
- package/dist/content.d.ts +9 -29
- package/dist/content.mjs +13 -15
- package/dist/devtools/200.html +1 -0
- package/dist/devtools/404.html +1 -0
- package/dist/devtools/_fonts/4ppnHhMi-pBsWSPo7mY0avYxlDoAg1N3PTzCwXLZ5rA-d9oibkGnTd1JL3tc_xnaVgBLYmOB8kjrK2cvZaqwj9s.woff2 +0 -0
- package/dist/devtools/_fonts/4qBuU9MRVUlPZNPSF7Xom_sK8RBEnfYu-9VXFrdq8A8-8TDwLE1HAj1sQn7XxVWtM_7sIaPM-DTdO3Pf8U2DF1U.woff2 +0 -0
- package/dist/devtools/_fonts/6dYsbWUd_BpKJ7mdDihgOcya1gHXLpJBuMYXux3WMjE-q3fYNS8YbW5n7ZeXI2vSNgkRWW5VDPKAl51SNTjG2qk.woff2 +0 -0
- package/dist/devtools/_fonts/Lr-hqqZZsYmCt0ITUlr1CUrWim9fsKvoDFZliMxgNHY-iTa_Yt_PzhOY9TX7ZXdSlEPim6iRt92xhECwaxWxd5w.woff2 +0 -0
- package/dist/devtools/_fonts/OknHvWI6KtYn1JQBzX7eSpNDBQ8520F9TvSUJYkVf6A-xeZn9253svK_8Q2LD0XEruY_MnEsuCRO5LenPoggC0Y.woff2 +0 -0
- package/dist/devtools/_fonts/PV2hrQG6wq5BlIPDjdL1IcOflycaghyt5MHzlBqZtlo-lb_WexLz3VZqfTN0oi554iBH5tT2j2UFEV-XErCAS3E.woff2 +0 -0
- package/dist/devtools/_fonts/UA7OtwYHwGN_HjcVGTdmiQxUit7FlqkCwxVUWSeXVnQ-B4OXCFOL_tWrYODpQTc07aMaj0c2cewTOmBRWR9tD-A.woff2 +0 -0
- package/dist/devtools/_fonts/VE4cDVCv5MxbFM7ZLoLCGbIpNd71zhp7MDI9lmN5Y7I-xZyDYCUVrd6LV8eVGF3Um3UZjBFuUtDGtvdyTBBRYBo.woff2 +0 -0
- package/dist/devtools/_fonts/fVoGbnMbBFd5L9BBp9fUPavUSkZ_EmsQNSyadkT-108-U4T0khaeLQSIhtt9eVvaCEKJjtWJ4ioRJOf8hvqkWY0.woff2 +0 -0
- package/dist/devtools/_fonts/lQAxeCEs1R0Lw-H9XRU1RlOARQN8J6npRsPjyEDMe5s-_DUSLEkO3tKTuun_gSnDLoQPVEnpOnyqZMOw0ByZ6PA.woff2 +0 -0
- package/dist/devtools/_fonts/lntlqNHKLV2n82yTwMde70QqOjcfLE2XJ5oKZ3vRPWc-z6TxpIZQdWXztWLr9_OFWqt_WJJoeGtuK_-XQMZGQwE.woff2 +0 -0
- package/dist/devtools/_fonts/qxAYvKsXWeYv731eb-h5TRurcdIP_W44mpNdX-HABAk-zUDeMEFlNtNbrwvT9JxLEBg0TphGy70O6RfIoIX_ZwU.woff2 +0 -0
- package/dist/devtools/_nuxt/B78iZWPg.js +1 -0
- package/dist/{client/_nuxt/D1lfPgTt.js → devtools/_nuxt/BGlUVBvU.js} +1 -1
- package/dist/devtools/_nuxt/BL4rmk_W.js +3 -0
- package/dist/devtools/_nuxt/BXH6Xx3v.js +3860 -0
- package/dist/devtools/_nuxt/CIJ7xJ8b.js +1 -0
- package/dist/devtools/_nuxt/CSSHjAxs.js +1 -0
- package/dist/{client/_nuxt/Cktc5--N.js → devtools/_nuxt/CsKs7wwl.js} +1 -1
- package/dist/{client/_nuxt/Vmj2QZYx.js → devtools/_nuxt/CstUYNOH.js} +1 -1
- package/dist/devtools/_nuxt/CxnX_MvN.js +173 -0
- package/dist/devtools/_nuxt/CzeCuK1q.js +1 -0
- package/dist/devtools/_nuxt/D7bfXIZ-.js +6 -0
- package/dist/devtools/_nuxt/DCmYAnXe.js +2 -0
- package/dist/devtools/_nuxt/DevtoolsSection.Bxijw5im.css +1 -0
- package/dist/devtools/_nuxt/DevtoolsSnippet.CbB_PUej.css +1 -0
- package/dist/{client/_nuxt/Dk-IKZND.js → devtools/_nuxt/DmM2Yt1_.js} +1 -1
- package/dist/devtools/_nuxt/builds/latest.json +1 -0
- package/dist/devtools/_nuxt/builds/meta/22b67a5a-b859-4a85-ad96-a4de4f79168b.json +1 -0
- package/dist/devtools/_nuxt/entry.CYlLP9qU.css +2 -0
- package/dist/devtools/_nuxt/error-404.BGfO7-QM.css +1 -0
- package/dist/devtools/_nuxt/error-500.CIongMTI.css +1 -0
- package/dist/{client/_nuxt/CwCh3_ha.js → devtools/_nuxt/o_f3Li2p.js} +1 -1
- package/dist/devtools/_nuxt/pages.BAzvGALH.css +1 -0
- package/dist/{client/_nuxt/templates.DAFgwCzd.css → devtools/_nuxt/templates.C7e57cTp.css} +1 -1
- package/dist/devtools/_nuxt/u4npBYiO.js +3 -0
- package/dist/devtools/_nuxt/ws2lPK1y.js +1 -0
- package/dist/{client/_nuxt/OW9R-PIP.js → devtools/_nuxt/ynN9sMNI.js} +1 -1
- package/dist/devtools/debug/index.html +1 -0
- package/dist/devtools/docs/index.html +1 -0
- package/dist/devtools/index.html +1 -0
- package/dist/devtools/templates/index.html +1 -0
- package/dist/module.cjs +4 -3
- package/dist/module.json +1 -1
- package/dist/module.mjs +4 -3
- package/dist/runtime/server/og-image/bindings/font-assets/cloudflare.js +8 -5
- package/dist/runtime/server/og-image/browser/screenshot.js +3 -3
- package/dist/runtime/server/og-image/context.js +2 -2
- package/dist/runtime/server/og-image/core/plugins/imageSrc.js +4 -4
- package/dist/runtime/server/og-image/fonts.d.ts +5 -10
- package/dist/runtime/server/og-image/fonts.js +15 -6
- package/dist/runtime/server/og-image/satori/renderer.js +1 -1
- package/dist/runtime/server/og-image/takumi/renderer.js +2 -2
- package/dist/runtime/server/util/kit.d.ts +1 -1
- package/dist/runtime/server/util/kit.js +2 -5
- package/dist/runtime/shared/urlEncoding.d.ts +7 -0
- package/dist/runtime/shared/urlEncoding.js +13 -1
- package/dist/runtime/shared.d.ts +1 -1
- package/dist/runtime/shared.js +1 -1
- package/dist/shared/{nuxt-og-image.DuUfHPCI.mjs → nuxt-og-image.Bd7Znc-u.mjs} +82 -158
- package/dist/shared/{nuxt-og-image.DFZD-Kf4.cjs → nuxt-og-image.CBzKFXjI.cjs} +86 -162
- package/package.json +16 -14
- package/dist/client/200.html +0 -1
- package/dist/client/404.html +0 -1
- package/dist/client/_fonts/0xp3SbCWC1OhX7q1-uF6kilMZFm-alJNkUtkLTPCy_A-tN9KwPUWhhXvtqh74sU9FIkI4W6hsbm85r0X24hjOfM.woff2 +0 -0
- package/dist/client/_fonts/4HA9tc4y8BVQeLXvLn3JgQqilAj1xrAnUSprQGHIPSw-ZPswEL_UDOYaxTLQDUySPjoOHDxhD83pD19HMfKfK9s.woff2 +0 -0
- package/dist/client/_fonts/Bmul3LaKlc7BUKqJHE_UmEoF40Sg_2ga52yJjwyDcKs-TnYmYl1DNYkiWMu0Vx49DakCPBuiCCj9zoLIuQjUdKY.woff2 +0 -0
- package/dist/client/_fonts/DfgmjWGpWte3Q3a54Nevr_BYmMM5YEJXRI1CdI2VwO0-ox5RadQfCyVTmKl_hubTaIJjtRw9oaQz2GDBeZR6l1M.woff2 +0 -0
- package/dist/client/_fonts/LK8hREFNeTe-EIzvbfgusJBg3CJ7Q7NFgYIiGb2LZ8-qiyWl0ATLJjOsRPZC_7a8mTMFxEMKEv6JTK_kHtMzbM.woff2 +0 -0
- package/dist/client/_fonts/Lc_5lWuBuZcZ166p1-s-mnGkMJwIYJE_QDCkws8iCkI-r45Qbm2hCykrfOZ0kowz__uTTTUOPDN9hz34QcRNTY4.woff2 +0 -0
- package/dist/client/_fonts/UBlOS9e0BmJuiF5yVs0YcJrFWaa-iN8zx9TP_lmKs8c-iH3Naewt5UjJ0AQ38QZs4lkEo4zdjMIVkLs4y7EiwIE.woff2 +0 -0
- package/dist/client/_fonts/gRxGIWazSFZVyzU0s62U9IArK3RJLkOoUmXx0C8Npsw-kMFNQG6iwjw2nvqS3ut9jMSVn__HlJ28slvxjE4hYfc.woff2 +0 -0
- package/dist/client/_fonts/hIKtJJBMNYGPUppSYZpyuF6c24cKhBkhsgaCTgzYgqw-jRJyBPlfGDXClyrgfO6GK_Pfs1RmTsB-wWX6MOgpsRA.woff2 +0 -0
- package/dist/client/_fonts/iEvApgDRmzKzNqOYocBTrmcHZmuGAJloawKDP1S0nyE-T3oc_9We24QGwfw5naik4cM0g7VxylWVaQwKm4dy3cw.woff2 +0 -0
- package/dist/client/_fonts/kokcBTWRechd97ZdVUpUxrOFbsRt8whO21yA1vQ6iJ8-O7CCbVvFgg_MFLTdyFF9FMeMvIoEmxJLubqVDYTUoWY.woff2 +0 -0
- package/dist/client/_fonts/oFzdhjQtZFydTZ757bmiVFXgReR2bBSYm_CjQ7B1Jjs-F6oFbDhOWKYJbgrlC93wkLkPlIV7mzgvqwqEDxQMeHA.woff2 +0 -0
- package/dist/client/_nuxt/BKAklG_t.js +0 -1
- package/dist/client/_nuxt/C8-_X1H0.js +0 -1
- package/dist/client/_nuxt/CZ3ilSZL.js +0 -3860
- package/dist/client/_nuxt/CZT7uv4X.js +0 -1
- package/dist/client/_nuxt/CfKtH86J.js +0 -3
- package/dist/client/_nuxt/CoV50A8g.js +0 -6
- package/dist/client/_nuxt/DHgFLo6c.js +0 -2
- package/dist/client/_nuxt/JeQLwE-R.js +0 -1
- package/dist/client/_nuxt/OSectionBlock.BVHnMsIr.css +0 -1
- package/dist/client/_nuxt/W-5Wci_Y.js +0 -1
- package/dist/client/_nuxt/builds/latest.json +0 -1
- package/dist/client/_nuxt/builds/meta/1e1bd3b0-a510-4582-8d5c-6be1220c8d28.json +0 -1
- package/dist/client/_nuxt/entry.CjxjoX5J.css +0 -2
- package/dist/client/_nuxt/error-404.DFn4r7cG.css +0 -1
- package/dist/client/_nuxt/error-500.DDG-bAQG.css +0 -1
- package/dist/client/_nuxt/pages.CVzrVadZ.css +0 -1
- package/dist/client/_nuxt/uVtaRSp0.js +0 -174
- package/dist/client/debug/index.html +0 -1
- package/dist/client/docs/index.html +0 -1
- package/dist/client/index.html +0 -1
- package/dist/client/templates/index.html +0 -1
- /package/dist/{client/_nuxt/CM-t-6ZT.js → devtools/_nuxt/C5jzcy9i.js} +0 -0
- /package/dist/{client/_nuxt/HWyD49jH.js → devtools/_nuxt/CCTv7mmB.js} +0 -0
- /package/dist/{client/_nuxt/DMFL1JmN.js → devtools/_nuxt/CnH6h21e.js} +0 -0
- /package/dist/{client/_nuxt/BsRKQH5X.js → devtools/_nuxt/CuJezOxb.js} +0 -0
- /package/dist/{client/_nuxt/CDaXKRRu.js → devtools/_nuxt/E8AZ6HoH.js} +0 -0
- /package/dist/{client → devtools}/_nuxt/IFrameLoader.HTWy4e5S.css +0 -0
- /package/dist/{client/_nuxt/PONEy9N-.js → devtools/_nuxt/O5eLyffU.js} +0 -0
|
@@ -2,7 +2,7 @@ import * as fs from 'node:fs';
|
|
|
2
2
|
import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, rmSync } from 'node:fs';
|
|
3
3
|
import { readdir, readFile, writeFile, mkdir } from 'node:fs/promises';
|
|
4
4
|
import { pathToFileURL } from 'node:url';
|
|
5
|
-
import { resolvePath, useNuxt, addTemplate, updateTemplates,
|
|
5
|
+
import { resolvePath, useNuxt, addTemplate, updateTemplates, addTypeTemplate, defineNuxtModule, createResolver, addImports, hasNuxtModule, hasNuxtModuleCompatibility, getNuxtModuleVersion, addVitePlugin, addBuildPlugin, addServerHandler, addPlugin, addComponentsDir, addServerPlugin } from '@nuxt/kit';
|
|
6
6
|
import { defu } from 'defu';
|
|
7
7
|
import { installNuxtSiteConfig } from 'nuxt-site-config/kit';
|
|
8
8
|
import { hash } from 'ohash';
|
|
@@ -10,11 +10,12 @@ import { basename, join, dirname, relative, isAbsolute, resolve } from 'pathe';
|
|
|
10
10
|
import { readPackageJSON } from 'pkg-types';
|
|
11
11
|
import { createHash } from 'node:crypto';
|
|
12
12
|
import { parseAndWalk } from 'oxc-walker';
|
|
13
|
-
import {
|
|
13
|
+
import { resolveNitroPreset, getNuxtModuleOptions, isNuxtGenerate } from 'nuxtseo-shared/kit';
|
|
14
14
|
import { logger } from '../../dist/runtime/logger.js';
|
|
15
15
|
import { Launcher } from 'chrome-launcher';
|
|
16
|
+
import { isCI } from 'std-env';
|
|
16
17
|
import { detectPackageManager, addDependency } from 'nypm';
|
|
17
|
-
import {
|
|
18
|
+
import { setupDevToolsUI as setupDevToolsUI$1, setupDevToolsRpc } from 'nuxtseo-shared/devtools';
|
|
18
19
|
import { createStorage } from 'unstorage';
|
|
19
20
|
import fsDriver from 'unstorage/drivers/fs-lite';
|
|
20
21
|
import { resolveColorMix, GRADIENT_COLOR_SPACE_RE, splitCssDeclarations } from '../../dist/runtime/server/og-image/utils/css.js';
|
|
@@ -81,19 +82,6 @@ function getRegisteredBaseNames(registeredPascalName) {
|
|
|
81
82
|
return names;
|
|
82
83
|
}
|
|
83
84
|
|
|
84
|
-
const autodetectableProviders = {
|
|
85
|
-
azure_static: "azure",
|
|
86
|
-
cloudflare_pages: "cloudflare-pages",
|
|
87
|
-
netlify: "netlify",
|
|
88
|
-
stormkit: "stormkit",
|
|
89
|
-
vercel: "vercel",
|
|
90
|
-
cleavr: "cleavr",
|
|
91
|
-
stackblitz: "stackblitz"
|
|
92
|
-
};
|
|
93
|
-
const autodetectableStaticProviders = {
|
|
94
|
-
netlify: "netlify-static",
|
|
95
|
-
vercel: "vercel-static"
|
|
96
|
-
};
|
|
97
85
|
const NodeRuntime = {
|
|
98
86
|
// node-server runtime
|
|
99
87
|
browser: "on-demand",
|
|
@@ -200,23 +188,13 @@ const RuntimeCompatibility = {
|
|
|
200
188
|
"cloudflare-module": cloudflare,
|
|
201
189
|
"cloudflare-durable": cloudflare
|
|
202
190
|
};
|
|
203
|
-
function
|
|
204
|
-
return options?.static ? autodetectableStaticProviders[provider] : autodetectableProviders[provider];
|
|
205
|
-
}
|
|
206
|
-
function resolveNitroPreset(nitroConfig) {
|
|
207
|
-
if (provider === "stackblitz" || provider === "codesandbox")
|
|
208
|
-
return provider;
|
|
191
|
+
function resolveOgImagePreset(nitroConfig) {
|
|
209
192
|
const nuxt = useNuxt();
|
|
210
193
|
if (nuxt.options.dev)
|
|
211
194
|
return "nitro-dev";
|
|
212
195
|
if (nuxt.options.nitro.static)
|
|
213
196
|
return "nitro-prerender";
|
|
214
|
-
|
|
215
|
-
if (nitroConfig && nitroConfig?.preset)
|
|
216
|
-
preset = nitroConfig.preset;
|
|
217
|
-
if (!preset)
|
|
218
|
-
preset = env.NITRO_PRESET || env.SERVER_PRESET || detectTarget() || "node-server";
|
|
219
|
-
return preset.replace("_", "-");
|
|
197
|
+
return resolveNitroPreset(nitroConfig);
|
|
220
198
|
}
|
|
221
199
|
function getPresetNitroPresetCompatibility(target) {
|
|
222
200
|
const normalizedTarget = target.replace(RE_LEGACY_SUFFIX, "");
|
|
@@ -228,7 +206,7 @@ function getPresetNitroPresetCompatibility(target) {
|
|
|
228
206
|
return compatibility;
|
|
229
207
|
}
|
|
230
208
|
async function applyNitroPresetCompatibility(nitroConfig, options) {
|
|
231
|
-
const target =
|
|
209
|
+
const target = resolveOgImagePreset(nitroConfig);
|
|
232
210
|
const compatibility = getPresetNitroPresetCompatibility(target);
|
|
233
211
|
const { resolve, detectedRenderers } = options;
|
|
234
212
|
const satoriEnabled = detectedRenderers.has("satori");
|
|
@@ -271,7 +249,7 @@ async function applyNitroPresetCompatibility(nitroConfig, options) {
|
|
|
271
249
|
await applyBinding("sharp"),
|
|
272
250
|
nitroConfig.alias || {}
|
|
273
251
|
);
|
|
274
|
-
if (Object.values(
|
|
252
|
+
if (Object.values(resolvedCompatibility).includes("wasm")) {
|
|
275
253
|
nitroConfig.experimental = nitroConfig.experimental || {};
|
|
276
254
|
nitroConfig.experimental.wasm = true;
|
|
277
255
|
}
|
|
@@ -320,7 +298,7 @@ async function setupBuildHandler(config, resolve, getDetectedRenderers, nuxt = u
|
|
|
320
298
|
nuxt.hooks.hook("nitro:init", async (nitro) => {
|
|
321
299
|
const renderers = getDetectedRenderers();
|
|
322
300
|
await applyNitroPresetCompatibility(nitro.options, { compatibility: config.compatibility?.runtime, resolve, detectedRenderers: renderers });
|
|
323
|
-
const target =
|
|
301
|
+
const target = resolveOgImagePreset(nitro.options);
|
|
324
302
|
const normalizedTarget = target.replace(RE_LEGACY_SUFFIX, "");
|
|
325
303
|
const isEdgePreset = ["cloudflare", "cloudflare-pages", "cloudflare-pages-static", "cloudflare-module", "cloudflare-durable", "vercel-edge", "netlify-edge"].includes(normalizedTarget);
|
|
326
304
|
const isCloudflarePreset = normalizedTarget.startsWith("cloudflare");
|
|
@@ -353,9 +331,10 @@ async function setupBuildHandler(config, resolve, getDetectedRenderers, nuxt = u
|
|
|
353
331
|
}
|
|
354
332
|
}
|
|
355
333
|
}
|
|
356
|
-
const [resvgHash, yogaHash] = await Promise.all([
|
|
334
|
+
const [resvgHash, yogaHash, takumiHash] = await Promise.all([
|
|
357
335
|
resolveFilePathSha1("@resvg/resvg-wasm/index_bg.wasm"),
|
|
358
|
-
resolveFilePathSha1("satori/yoga.wasm")
|
|
336
|
+
resolveFilePathSha1("satori/yoga.wasm"),
|
|
337
|
+
resolveFilePathSha1("@takumi-rs/wasm/takumi_wasm_bg.wasm")
|
|
359
338
|
]);
|
|
360
339
|
for (const entry of wasmEntries) {
|
|
361
340
|
if (!existsSync(entry))
|
|
@@ -373,7 +352,7 @@ async function setupBuildHandler(config, resolve, getDetectedRenderers, nuxt = u
|
|
|
373
352
|
if (compatibility.wasm?.esmImport) {
|
|
374
353
|
const postfix = normalizedTarget === "vercel-edge" ? "?module" : "";
|
|
375
354
|
const wasmPath = isCloudflarePagesOrModule ? `../wasm/` : `./wasm/`;
|
|
376
|
-
contents = contents.replaceAll('"@resvg/resvg-wasm/index_bg.wasm?module"', `"${wasmPath}index_bg-${resvgHash}.wasm${postfix}"`).replaceAll('"satori/yoga.wasm?module"', `"${wasmPath}yoga-${yogaHash}.wasm${postfix}"`).replaceAll('"yoga-wasm-web/dist/yoga.wasm?module"', `"${wasmPath}yoga-${yogaHash}.wasm${postfix}"`);
|
|
355
|
+
contents = contents.replaceAll('"@resvg/resvg-wasm/index_bg.wasm?module"', `"${wasmPath}index_bg-${resvgHash}.wasm${postfix}"`).replaceAll('"satori/yoga.wasm?module"', `"${wasmPath}yoga-${yogaHash}.wasm${postfix}"`).replaceAll('"@takumi-rs/wasm/takumi_wasm_bg.wasm?module"', `"${wasmPath}takumi_wasm_bg-${takumiHash}.wasm${postfix}"`).replaceAll('"yoga-wasm-web/dist/yoga.wasm?module"', `"${wasmPath}yoga-${yogaHash}.wasm${postfix}"`);
|
|
377
356
|
if (postfix) {
|
|
378
357
|
contents = contents.replaceAll(RE_WASM_IMPORT, `import("$1${postfix}")`);
|
|
379
358
|
}
|
|
@@ -387,7 +366,7 @@ async function setupBuildHandler(config, resolve, getDetectedRenderers, nuxt = u
|
|
|
387
366
|
});
|
|
388
367
|
}
|
|
389
368
|
async function resolveFilePathSha1(path) {
|
|
390
|
-
const _path = await resolvePath(path);
|
|
369
|
+
const _path = await resolvePath(path).catch(() => path);
|
|
391
370
|
return sha1(existsSync(_path) ? await readFile(_path) : Buffer.from(path));
|
|
392
371
|
}
|
|
393
372
|
function sha1(source) {
|
|
@@ -538,7 +517,7 @@ function getProviderDependencies(provider, binding = "node") {
|
|
|
538
517
|
return deps.map((d) => d.name);
|
|
539
518
|
}
|
|
540
519
|
function getRecommendedBindingFromPreset(provider) {
|
|
541
|
-
const preset =
|
|
520
|
+
const preset = resolveOgImagePreset();
|
|
542
521
|
const compatibility = getPresetNitroPresetCompatibility(preset);
|
|
543
522
|
return getRecommendedBinding(provider, compatibility);
|
|
544
523
|
}
|
|
@@ -621,7 +600,7 @@ async function validateProviderSetup(renderer, compatibility) {
|
|
|
621
600
|
function setupDevHandler(options, resolve, getDetectedRenderers, nuxt = useNuxt()) {
|
|
622
601
|
nuxt.hooks.hook("nitro:init", async (nitro) => {
|
|
623
602
|
const detectedRenderers = new Set(getDetectedRenderers());
|
|
624
|
-
const targetCompatibility = getPresetNitroPresetCompatibility(
|
|
603
|
+
const targetCompatibility = getPresetNitroPresetCompatibility(resolveOgImagePreset(nitro.options));
|
|
625
604
|
for (const renderer of ["satori", "takumi", "browser"]) {
|
|
626
605
|
if (!detectedRenderers.has(renderer)) {
|
|
627
606
|
const binding = getRecommendedBinding(renderer, targetCompatibility);
|
|
@@ -634,8 +613,6 @@ function setupDevHandler(options, resolve, getDetectedRenderers, nuxt = useNuxt(
|
|
|
634
613
|
});
|
|
635
614
|
}
|
|
636
615
|
|
|
637
|
-
const DEVTOOLS_UI_ROUTE = "/__nuxt-og-image";
|
|
638
|
-
const DEVTOOLS_UI_LOCAL_PORT = 3030;
|
|
639
616
|
const RE_TILDE_SLASH = /^~\//;
|
|
640
617
|
const RE_WORD_CHARS_ONLY = /^\w+$/;
|
|
641
618
|
const RE_SCRIPT_SETUP = /<script\s+setup[^>]*>\n?/;
|
|
@@ -718,31 +695,13 @@ p {
|
|
|
718
695
|
`;
|
|
719
696
|
}
|
|
720
697
|
function setupDevToolsUI(options, resolve$1, nuxt = useNuxt(), cssFramework = "none") {
|
|
721
|
-
|
|
698
|
+
setupDevToolsUI$1({
|
|
699
|
+
route: "/__nuxt-og-image",
|
|
700
|
+
name: "nuxt-og-image",
|
|
701
|
+
title: "OG Image",
|
|
702
|
+
icon: "carbon:image-search"
|
|
703
|
+
}, resolve$1, nuxt);
|
|
722
704
|
const communityTemplatesDir = resolve$1("./runtime/app/components/Templates/Community");
|
|
723
|
-
const isProductionBuild = existsSync(clientPath);
|
|
724
|
-
if (isProductionBuild) {
|
|
725
|
-
nuxt.hook("vite:serverCreated", async (server) => {
|
|
726
|
-
const sirv = await import('sirv').then((r) => r.default || r);
|
|
727
|
-
server.middlewares.use(
|
|
728
|
-
DEVTOOLS_UI_ROUTE,
|
|
729
|
-
sirv(clientPath, { dev: true, single: true })
|
|
730
|
-
);
|
|
731
|
-
});
|
|
732
|
-
} else {
|
|
733
|
-
nuxt.hook("vite:extendConfig", (config) => {
|
|
734
|
-
if (!config.server) {
|
|
735
|
-
config.server = {};
|
|
736
|
-
}
|
|
737
|
-
config.server.proxy ||= {};
|
|
738
|
-
config.server.proxy[DEVTOOLS_UI_ROUTE] = {
|
|
739
|
-
target: `http://localhost:${DEVTOOLS_UI_LOCAL_PORT}${DEVTOOLS_UI_ROUTE}`,
|
|
740
|
-
changeOrigin: true,
|
|
741
|
-
followRedirects: true,
|
|
742
|
-
rewrite: (path) => path.replace(DEVTOOLS_UI_ROUTE, "")
|
|
743
|
-
};
|
|
744
|
-
});
|
|
745
|
-
}
|
|
746
705
|
const useNitro = new Promise((resolve2) => {
|
|
747
706
|
nuxt.hooks.hook("nitro:init", resolve2);
|
|
748
707
|
});
|
|
@@ -768,61 +727,60 @@ ${content}`, "utf-8");
|
|
|
768
727
|
}
|
|
769
728
|
return true;
|
|
770
729
|
}
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
dotNotationName = `${baseName}.${renderer}.vue`;
|
|
784
|
-
}
|
|
785
|
-
const dir = join(nuxt.options.srcDir, "components", dirName || "");
|
|
786
|
-
if (!existsSync(dir)) {
|
|
787
|
-
mkdirSync(dir, { recursive: true });
|
|
788
|
-
}
|
|
789
|
-
const newPath = join(dir, dotNotationName);
|
|
790
|
-
const templatePath = join(communityTemplatesDir, dotNotationName);
|
|
791
|
-
const template = (await readFile(templatePath, "utf-8")).replace("{{ title }}", `{{ title }} - Ejected!`);
|
|
792
|
-
await writeFile(newPath, template, { encoding: "utf-8" });
|
|
793
|
-
await updateTemplates({ filter: (t) => t.filename.includes("nuxt-og-image/components.mjs") });
|
|
794
|
-
const nitro = await useNitro;
|
|
795
|
-
await nitro.hooks.callHook("rollup:reload");
|
|
796
|
-
return newPath;
|
|
797
|
-
},
|
|
798
|
-
async createComponent({ name, renderer, pageFile }) {
|
|
799
|
-
const validRenderers = ["satori", "browser", "takumi"];
|
|
800
|
-
if (!validRenderers.includes(renderer))
|
|
801
|
-
throw new Error(`Invalid renderer: ${renderer}`);
|
|
802
|
-
if (!RE_WORD_CHARS_ONLY.test(name))
|
|
803
|
-
throw new Error(`Invalid component name: ${name}`);
|
|
804
|
-
const baseDir = existsSync(join(nuxt.options.srcDir, "app")) ? join(nuxt.options.srcDir, "app") : nuxt.options.srcDir;
|
|
805
|
-
const outputDir = join(baseDir, "components", "OgImage");
|
|
806
|
-
if (!existsSync(outputDir))
|
|
807
|
-
mkdirSync(outputDir, { recursive: true });
|
|
808
|
-
const filename = `${name}.${renderer}.vue`;
|
|
809
|
-
const outputPath = join(outputDir, filename);
|
|
810
|
-
if (existsSync(outputPath))
|
|
811
|
-
throw new Error(`File already exists: ${relative(nuxt.options.rootDir, outputPath)}`);
|
|
812
|
-
const template = getStarterTemplate(renderer, cssFramework);
|
|
813
|
-
await writeFile(outputPath, template, { encoding: "utf-8" });
|
|
814
|
-
await insertDefineOgImage(name, pageFile);
|
|
815
|
-
await updateTemplates({ filter: (t) => t.filename.includes("nuxt-og-image/components.mjs") });
|
|
816
|
-
const nitro = await useNitro;
|
|
817
|
-
await nitro.hooks.callHook("rollup:reload");
|
|
818
|
-
return outputPath;
|
|
819
|
-
},
|
|
820
|
-
async addOgImageToPage(componentName, pageFile) {
|
|
821
|
-
if (!RE_WORD_CHARS_ONLY.test(componentName))
|
|
822
|
-
throw new Error(`Invalid component name: ${componentName}`);
|
|
823
|
-
return insertDefineOgImage(componentName, pageFile);
|
|
730
|
+
setupDevToolsRpc("nuxt-og-image", {
|
|
731
|
+
async ejectCommunityTemplate(path) {
|
|
732
|
+
const [dirName, componentName] = path.split("/");
|
|
733
|
+
const nameWithoutExt = componentName?.replace(".vue", "") || "";
|
|
734
|
+
let dotNotationName;
|
|
735
|
+
if (nameWithoutExt.includes(".")) {
|
|
736
|
+
dotNotationName = `${nameWithoutExt}.vue`;
|
|
737
|
+
} else {
|
|
738
|
+
const rendererMatch = nameWithoutExt.match(RE_RENDERER_SUFFIX);
|
|
739
|
+
const renderer = rendererMatch?.[1]?.toLowerCase() || "satori";
|
|
740
|
+
const baseName = nameWithoutExt.replace(RE_RENDERER_SUFFIX, "");
|
|
741
|
+
dotNotationName = `${baseName}.${renderer}.vue`;
|
|
824
742
|
}
|
|
825
|
-
|
|
743
|
+
const dir = join(nuxt.options.srcDir, "components", dirName || "");
|
|
744
|
+
if (!existsSync(dir)) {
|
|
745
|
+
mkdirSync(dir, { recursive: true });
|
|
746
|
+
}
|
|
747
|
+
const newPath = join(dir, dotNotationName);
|
|
748
|
+
const templatePath = join(communityTemplatesDir, dotNotationName);
|
|
749
|
+
const template = (await readFile(templatePath, "utf-8")).replace("{{ title }}", `{{ title }} - Ejected!`);
|
|
750
|
+
await writeFile(newPath, template, { encoding: "utf-8" });
|
|
751
|
+
await updateTemplates({ filter: (t) => t.filename.includes("nuxt-og-image/components.mjs") });
|
|
752
|
+
const nitro = await useNitro;
|
|
753
|
+
await nitro.hooks.callHook("rollup:reload");
|
|
754
|
+
return newPath;
|
|
755
|
+
},
|
|
756
|
+
async createComponent({ name, renderer, pageFile }) {
|
|
757
|
+
const validRenderers = ["satori", "browser", "takumi"];
|
|
758
|
+
if (!validRenderers.includes(renderer))
|
|
759
|
+
throw new Error(`Invalid renderer: ${renderer}`);
|
|
760
|
+
if (!RE_WORD_CHARS_ONLY.test(name))
|
|
761
|
+
throw new Error(`Invalid component name: ${name}`);
|
|
762
|
+
const baseDir = existsSync(join(nuxt.options.srcDir, "app")) ? join(nuxt.options.srcDir, "app") : nuxt.options.srcDir;
|
|
763
|
+
const outputDir = join(baseDir, "components", "OgImage");
|
|
764
|
+
if (!existsSync(outputDir))
|
|
765
|
+
mkdirSync(outputDir, { recursive: true });
|
|
766
|
+
const filename = `${name}.${renderer}.vue`;
|
|
767
|
+
const outputPath = join(outputDir, filename);
|
|
768
|
+
if (existsSync(outputPath))
|
|
769
|
+
throw new Error(`File already exists: ${relative(nuxt.options.rootDir, outputPath)}`);
|
|
770
|
+
const template = getStarterTemplate(renderer, cssFramework);
|
|
771
|
+
await writeFile(outputPath, template, { encoding: "utf-8" });
|
|
772
|
+
await insertDefineOgImage(name, pageFile);
|
|
773
|
+
await updateTemplates({ filter: (t) => t.filename.includes("nuxt-og-image/components.mjs") });
|
|
774
|
+
const nitro = await useNitro;
|
|
775
|
+
await nitro.hooks.callHook("rollup:reload");
|
|
776
|
+
return outputPath;
|
|
777
|
+
},
|
|
778
|
+
async addOgImageToPage(componentName, pageFile) {
|
|
779
|
+
if (!RE_WORD_CHARS_ONLY.test(componentName))
|
|
780
|
+
throw new Error(`Invalid component name: ${componentName}`);
|
|
781
|
+
return insertDefineOgImage(componentName, pageFile);
|
|
782
|
+
}
|
|
783
|
+
}, nuxt).then((rpc) => {
|
|
826
784
|
let cssRefreshTimer;
|
|
827
785
|
nuxt.hook("builder:watch", (e, watchPath) => {
|
|
828
786
|
if (!e || !watchPath)
|
|
@@ -856,15 +814,6 @@ ${content}`, "utf-8");
|
|
|
856
814
|
}
|
|
857
815
|
});
|
|
858
816
|
});
|
|
859
|
-
addCustomTab({
|
|
860
|
-
name: "nuxt-og-image",
|
|
861
|
-
title: "OG Image",
|
|
862
|
-
icon: "carbon:image-search",
|
|
863
|
-
view: {
|
|
864
|
-
type: "iframe",
|
|
865
|
-
src: DEVTOOLS_UI_ROUTE
|
|
866
|
-
}
|
|
867
|
-
});
|
|
868
817
|
}
|
|
869
818
|
|
|
870
819
|
const _warnedVars = /* @__PURE__ */ new Set();
|
|
@@ -3483,29 +3432,6 @@ ${importStatements}
|
|
|
3483
3432
|
};
|
|
3484
3433
|
});
|
|
3485
3434
|
|
|
3486
|
-
async function getNuxtModuleOptions(module, nuxt = useNuxt()) {
|
|
3487
|
-
const moduleMeta = ({ name: module } ) || {};
|
|
3488
|
-
const { nuxtModule } = await loadNuxtModuleInstance(module, nuxt);
|
|
3489
|
-
let moduleEntry;
|
|
3490
|
-
for (const m of nuxt.options.modules) {
|
|
3491
|
-
if (Array.isArray(m) && m.length >= 2) {
|
|
3492
|
-
const _module = m[0];
|
|
3493
|
-
const _moduleEntryName = typeof _module === "string" ? _module : (await _module.getMeta?.())?.name || "";
|
|
3494
|
-
if (_moduleEntryName === moduleMeta.name)
|
|
3495
|
-
moduleEntry = m;
|
|
3496
|
-
}
|
|
3497
|
-
}
|
|
3498
|
-
let inlineOptions = {};
|
|
3499
|
-
if (moduleEntry)
|
|
3500
|
-
inlineOptions = moduleEntry[1];
|
|
3501
|
-
if (nuxtModule.getOptions)
|
|
3502
|
-
return nuxtModule.getOptions(inlineOptions, nuxt);
|
|
3503
|
-
return inlineOptions;
|
|
3504
|
-
}
|
|
3505
|
-
function isNuxtGenerate(nuxt = useNuxt()) {
|
|
3506
|
-
return nuxt.options.nitro.static || nuxt.options.nitro.preset === "static";
|
|
3507
|
-
}
|
|
3508
|
-
|
|
3509
3435
|
const warnings = [];
|
|
3510
3436
|
const counts = {
|
|
3511
3437
|
config: /* @__PURE__ */ new Map(),
|
|
@@ -3841,7 +3767,7 @@ async function onUpgrade(nuxt, _options, previousVersion) {
|
|
|
3841
3767
|
}
|
|
3842
3768
|
if (detectedRenderers.size === 0)
|
|
3843
3769
|
detectedRenderers.add("satori");
|
|
3844
|
-
const preset =
|
|
3770
|
+
const preset = resolveOgImagePreset();
|
|
3845
3771
|
const compatibility = getPresetNitroPresetCompatibility(preset);
|
|
3846
3772
|
for (const renderer of detectedRenderers) {
|
|
3847
3773
|
const validation = await validateProviderSetup(renderer, compatibility);
|
|
@@ -4131,6 +4057,9 @@ const module$1 = defineNuxtModule({
|
|
|
4131
4057
|
},
|
|
4132
4058
|
"@nuxt/fonts": {
|
|
4133
4059
|
optional: true
|
|
4060
|
+
},
|
|
4061
|
+
"nuxt-site-config": {
|
|
4062
|
+
version: ">=3.2"
|
|
4134
4063
|
}
|
|
4135
4064
|
},
|
|
4136
4065
|
defaults() {
|
|
@@ -4222,7 +4151,7 @@ Or pin to a specific version in package.json:
|
|
|
4222
4151
|
}
|
|
4223
4152
|
nuxt.options.alias["#og-image"] = resolve("./runtime");
|
|
4224
4153
|
nuxt.options.alias["#og-image-cache"] = resolve("./runtime/server/og-image/cache/lru");
|
|
4225
|
-
const preset =
|
|
4154
|
+
const preset = resolveOgImagePreset(nuxt.options.nitro);
|
|
4226
4155
|
const targetCompatibility = getPresetNitroPresetCompatibility(preset);
|
|
4227
4156
|
const normalizedPreset = preset.replace(RE_LEGACY_SUFFIX, "");
|
|
4228
4157
|
const isCloudflareWorkers = ["cloudflare", "cloudflare-module", "cloudflare-durable"].includes(normalizedPreset);
|
|
@@ -4866,7 +4795,7 @@ export const resolve = (import.meta.dev || import.meta.prerender) ? devResolve :
|
|
|
4866
4795
|
if (hasNuxtFonts && fontContext) {
|
|
4867
4796
|
persistFontUrlMapping({ fontContext, buildDir: nuxt.options.buildDir, logger });
|
|
4868
4797
|
}
|
|
4869
|
-
if (!fontProcessingDone && convertedWoff2Files.size === 0 &&
|
|
4798
|
+
if (!fontProcessingDone && convertedWoff2Files.size === 0 && hasSatoriRenderer() && hasNuxtFonts) {
|
|
4870
4799
|
if (pendingFontRequirements.length > 0)
|
|
4871
4800
|
await Promise.all(pendingFontRequirements);
|
|
4872
4801
|
await convertWoff2ToTtf({
|
|
@@ -4935,7 +4864,7 @@ export const rootDir = ${JSON.stringify(nuxt.options.rootDir)}`;
|
|
|
4935
4864
|
});
|
|
4936
4865
|
nuxt.hook("vite:compiled", async () => {
|
|
4937
4866
|
persistFontUrlMapping({ fontContext, buildDir: nuxt.options.buildDir, logger });
|
|
4938
|
-
if (fontProcessingDone || !hasSatoriRenderer()
|
|
4867
|
+
if (fontProcessingDone || !hasSatoriRenderer())
|
|
4939
4868
|
return;
|
|
4940
4869
|
if (pendingFontRequirements.length === 0)
|
|
4941
4870
|
return;
|
|
@@ -4991,11 +4920,6 @@ export const rootDir = ${JSON.stringify(nuxt.options.rootDir)}`;
|
|
|
4991
4920
|
const buildCachePath = typeof config.buildCache === "object" && config.buildCache.base ? config.buildCache.base : "node_modules/.cache/nuxt-seo/og-image";
|
|
4992
4921
|
const buildCacheDir = config.buildCache ? join(nuxt.options.rootDir, buildCachePath) : void 0;
|
|
4993
4922
|
nuxt.hooks.hook("modules:done", async () => {
|
|
4994
|
-
if (!isNuxtGenerate() && nuxt.options.build) {
|
|
4995
|
-
nuxt.options.nitro = nuxt.options.nitro || {};
|
|
4996
|
-
nuxt.options.nitro.prerender = nuxt.options.nitro.prerender || {};
|
|
4997
|
-
nuxt.options.nitro.prerender.routes = nuxt.options.nitro.prerender.routes || [];
|
|
4998
|
-
}
|
|
4999
4923
|
const hasColorModeModule = hasNuxtModule("@nuxtjs/color-mode");
|
|
5000
4924
|
const colorModeOptions = hasColorModeModule ? await getNuxtModuleOptions("@nuxtjs/color-mode") : {};
|
|
5001
4925
|
let colorPreference = colorModeOptions.preference;
|