nuxt-og-image 6.7.5 → 6.7.6
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.cjs +2 -2
- package/dist/chunks/tw4.mjs +2 -2
- package/dist/chunks/uno.cjs +20 -5
- package/dist/chunks/uno.mjs +19 -5
- package/dist/module.cjs +2 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/app/utils/plugins.js +4 -10
- package/dist/runtime/server/og-image/bindings/browser/chrome-launcher.d.ts +1 -1
- package/dist/runtime/server/og-image/bindings/browser/cloudflare.d.ts +1 -1
- package/dist/runtime/server/og-image/bindings/browser/on-demand.d.ts +1 -1
- package/dist/runtime/server/og-image/bindings/browser/playwright.d.ts +1 -1
- package/dist/runtime/server/og-image/bindings/font-assets/cloudflare.d.ts +1 -1
- package/dist/runtime/server/og-image/bindings/font-assets/cloudflare.js +1 -1
- package/dist/runtime/server/og-image/bindings/font-assets/dev-prerender.d.ts +1 -1
- package/dist/runtime/server/og-image/bindings/font-assets/dev-prerender.js +2 -2
- package/dist/runtime/server/og-image/bindings/font-assets/node.d.ts +1 -1
- package/dist/runtime/server/og-image/bindings/font-assets/node.js +1 -1
- package/dist/runtime/server/og-image/bindings/resvg/node-dev.js +18 -64
- package/dist/runtime/server/og-image/bindings/takumi/node-dev.js +26 -83
- package/dist/runtime/server/og-image/bindings/worker-queue.d.ts +34 -0
- package/dist/runtime/server/og-image/bindings/worker-queue.js +150 -0
- package/dist/runtime/server/og-image/browser/renderer.js +1 -1
- package/dist/runtime/server/og-image/context.d.ts +1 -1
- package/dist/runtime/server/og-image/context.js +2 -3
- package/dist/runtime/server/og-image/core/plugins/imageSrc.js +1 -1
- package/dist/runtime/server/og-image/core/transforms/emojis/local.d.ts +2 -17
- package/dist/runtime/server/og-image/core/transforms/emojis/local.js +1 -1
- package/dist/runtime/server/og-image/devtools.d.ts +1 -1
- package/dist/runtime/server/og-image/devtools.js +1 -1
- package/dist/runtime/server/og-image/fonts.d.ts +1 -1
- package/dist/runtime/server/og-image/templates/html.js +1 -1
- package/dist/runtime/server/plugins/prerender.d.ts +1 -1
- package/dist/runtime/server/plugins/prerender.js +2 -2
- package/dist/runtime/server/routes/__zero-runtime/image.d.ts +1 -1
- package/dist/runtime/server/routes/__zero-runtime/image.js +1 -1
- package/dist/runtime/server/routes/debug.json.d.ts +1 -10
- package/dist/runtime/server/routes/debug.json.js +1 -1
- package/dist/runtime/server/routes/image.d.ts +1 -1
- package/dist/runtime/server/routes/image.js +1 -1
- package/dist/runtime/server/routes/resolve.d.ts +1 -1
- package/dist/runtime/server/routes/resolve.js +1 -1
- package/dist/runtime/server/util/cache.d.ts +1 -6
- package/dist/runtime/server/util/cache.js +2 -2
- package/dist/runtime/server/util/cloudflare.d.ts +1 -1
- package/dist/runtime/server/util/cloudflareAssets.d.ts +1 -1
- package/dist/runtime/server/util/cloudflareAssets.js +1 -1
- package/dist/runtime/server/util/eventHandlers.d.ts +1 -1
- package/dist/runtime/server/util/eventHandlers.js +1 -1
- package/dist/runtime/server/util/fetchLocalAsset.d.ts +1 -1
- package/dist/runtime/server/util/kit.d.ts +7 -3
- package/dist/runtime/server/util/kit.js +4 -18
- package/dist/runtime/server/util/options.js +1 -1
- package/dist/runtime/server/util/query.d.ts +1 -1
- package/dist/runtime/server/utils.d.ts +1 -1
- package/dist/runtime/server/utils.js +1 -1
- package/dist/runtime/types.d.ts +11 -9
- package/dist/shared/{nuxt-og-image.D3mV8OQ9.mjs → nuxt-og-image.BIbfn5xQ.mjs} +111 -83
- package/dist/shared/{nuxt-og-image.Cctpuv4O.cjs → nuxt-og-image.CdpC3njh.cjs} +113 -82
- package/package.json +38 -27
- package/types/virtual.d.ts +15 -0
|
@@ -8,11 +8,11 @@ const kit = require('@nuxt/kit');
|
|
|
8
8
|
const defu = require('defu');
|
|
9
9
|
const fnv1a64 = require('fnv1a-64');
|
|
10
10
|
const kit$2 = require('nuxt-site-config/kit');
|
|
11
|
+
const kit$1 = require('nuxtseo-shared/kit');
|
|
11
12
|
const pathe = require('pathe');
|
|
12
13
|
const pkgTypes = require('pkg-types');
|
|
13
14
|
const stdEnv = require('std-env');
|
|
14
15
|
const oxcWalker = require('oxc-walker');
|
|
15
|
-
const kit$1 = require('nuxtseo-shared/kit');
|
|
16
16
|
const logger_js = require('../../dist/runtime/logger.js');
|
|
17
17
|
const chromeLauncher = require('chrome-launcher');
|
|
18
18
|
const nypm = require('nypm');
|
|
@@ -328,23 +328,32 @@ async function setupBuildHandler(config, resolve, getDetectedRenderers, getCompa
|
|
|
328
328
|
nuxt.options.nitro.storage = nuxt.options.nitro.storage || {};
|
|
329
329
|
if (typeof config.runtimeCacheStorage === "object")
|
|
330
330
|
nuxt.options.nitro.storage["nuxt-og-image"] = config.runtimeCacheStorage;
|
|
331
|
-
nuxt.
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
331
|
+
const nitroConfig = nuxt.options.nitro;
|
|
332
|
+
const mockCode = `import proxy from 'mocked-exports/proxy';export default proxy;export * from 'mocked-exports/proxy';`;
|
|
333
|
+
nitroConfig.virtual = nitroConfig.virtual || {};
|
|
334
|
+
nitroConfig.virtual["playwright-core"] = mockCode;
|
|
335
|
+
nitroConfig.virtual.electron = mockCode;
|
|
336
|
+
nitroConfig.virtual["electron/index"] = mockCode;
|
|
337
|
+
nitroConfig.virtual["electron/index.js"] = mockCode;
|
|
338
|
+
nitroConfig.virtual.bufferutil = mockCode;
|
|
339
|
+
nitroConfig.virtual["utf-8-validate"] = mockCode;
|
|
340
|
+
nitroConfig.virtual["chromium-bidi"] = mockCode;
|
|
341
|
+
nitroConfig.virtual["chromium-bidi/lib/cjs/bidiMapper/BidiMapper"] = mockCode;
|
|
342
|
+
nitroConfig.virtual["chromium-bidi/lib/cjs/bidiMapper/BidiMapper.js"] = mockCode;
|
|
343
|
+
nitroConfig.virtual.queue = mockCode;
|
|
344
|
+
await applyNitroPresetCompatibility(nitroConfig, {
|
|
345
|
+
compatibility: config.compatibility?.runtime,
|
|
346
|
+
resolve,
|
|
347
|
+
detectedRenderers: getDetectedRenderers(),
|
|
348
|
+
metadata: getCompatibilityMeta()
|
|
344
349
|
});
|
|
345
350
|
nuxt.hooks.hook("nitro:init", async (nitro) => {
|
|
346
|
-
|
|
347
|
-
|
|
351
|
+
await applyNitroPresetCompatibility(nitro.options, {
|
|
352
|
+
compatibility: config.compatibility?.runtime,
|
|
353
|
+
resolve,
|
|
354
|
+
detectedRenderers: getDetectedRenderers(),
|
|
355
|
+
metadata: getCompatibilityMeta()
|
|
356
|
+
});
|
|
348
357
|
const target = resolveOgImagePreset(nitro.options);
|
|
349
358
|
const normalizedTarget = target.replace(RE_LEGACY_SUFFIX, "");
|
|
350
359
|
const isEdgePreset = ["cloudflare", "cloudflare-pages", "cloudflare-pages-static", "cloudflare-module", "cloudflare-durable", "vercel-edge", "netlify-edge"].includes(normalizedTarget);
|
|
@@ -669,10 +678,10 @@ async function validateProviderSetup(renderer, compatibility) {
|
|
|
669
678
|
return { valid: issues.length === 0, issues };
|
|
670
679
|
}
|
|
671
680
|
|
|
672
|
-
function setupDevHandler(options, resolve, getDetectedRenderers, getCompatibilityMeta = () => ({}), nuxt = kit.useNuxt()) {
|
|
673
|
-
|
|
681
|
+
async function setupDevHandler(options, resolve, getDetectedRenderers, getCompatibilityMeta = () => ({}), nuxt = kit.useNuxt()) {
|
|
682
|
+
const applyCompatibility = async (nitroConfig) => {
|
|
674
683
|
const detectedRenderers = new Set(getDetectedRenderers());
|
|
675
|
-
const targetCompatibility = getPresetNitroPresetCompatibility(resolveOgImagePreset(
|
|
684
|
+
const targetCompatibility = getPresetNitroPresetCompatibility(resolveOgImagePreset(nitroConfig));
|
|
676
685
|
for (const renderer of ["satori", "takumi", "browser"]) {
|
|
677
686
|
if (!detectedRenderers.has(renderer)) {
|
|
678
687
|
const binding = getRecommendedBinding(renderer, targetCompatibility);
|
|
@@ -681,8 +690,10 @@ function setupDevHandler(options, resolve, getDetectedRenderers, getCompatibilit
|
|
|
681
690
|
detectedRenderers.add(renderer);
|
|
682
691
|
}
|
|
683
692
|
}
|
|
684
|
-
await applyNitroPresetCompatibility(
|
|
685
|
-
}
|
|
693
|
+
await applyNitroPresetCompatibility(nitroConfig, { compatibility: options.compatibility?.dev, resolve, detectedRenderers, metadata: getCompatibilityMeta() });
|
|
694
|
+
};
|
|
695
|
+
await applyCompatibility(nuxt.options.nitro);
|
|
696
|
+
nuxt.hooks.hook("nitro:init", (nitro) => applyCompatibility(nitro.options));
|
|
686
697
|
}
|
|
687
698
|
|
|
688
699
|
const RE_TILDE_SLASH = /^~\//;
|
|
@@ -2201,7 +2212,7 @@ async function downloadStaticFonts(options) {
|
|
|
2201
2212
|
results.push(...familyResults);
|
|
2202
2213
|
}
|
|
2203
2214
|
}
|
|
2204
|
-
if (unresolvedFamilies.length > 0) {
|
|
2215
|
+
if (options.warnOnMissingStaticFonts !== false && unresolvedFamilies.length > 0) {
|
|
2205
2216
|
const providerList = fontlessCtx.providerNames.join(", ") || "none";
|
|
2206
2217
|
const localFonts = await listLocalPublicFontFiles(options.nuxt).catch(() => []);
|
|
2207
2218
|
const matchedLocal = unresolvedFamilies.map((family) => {
|
|
@@ -2333,7 +2344,8 @@ async function convertWoff2ToTtf(options) {
|
|
|
2333
2344
|
families,
|
|
2334
2345
|
nuxt,
|
|
2335
2346
|
logger,
|
|
2336
|
-
fontSubsets
|
|
2347
|
+
fontSubsets,
|
|
2348
|
+
warnOnMissingStaticFonts
|
|
2337
2349
|
});
|
|
2338
2350
|
for (const font of downloaded) {
|
|
2339
2351
|
const key = `${font.family}-${font.weight}-${font.style}`;
|
|
@@ -2472,6 +2484,34 @@ function setupGenerateHandler(_options, resolve, _getDetectedRenderers, nuxt = k
|
|
|
2472
2484
|
});
|
|
2473
2485
|
}
|
|
2474
2486
|
|
|
2487
|
+
async function resolveOptionalModulePath(id, rootDir, fallbackPackages = []) {
|
|
2488
|
+
const rootUrl = kit.directoryToURL(rootDir);
|
|
2489
|
+
const direct = await kit.tryResolveModule(id, rootUrl);
|
|
2490
|
+
if (direct)
|
|
2491
|
+
return direct;
|
|
2492
|
+
for (const pkg of fallbackPackages) {
|
|
2493
|
+
const pkgJson = await kit.tryResolveModule(`${pkg}/package.json`, rootUrl);
|
|
2494
|
+
if (!pkgJson)
|
|
2495
|
+
continue;
|
|
2496
|
+
const nested = await kit.tryResolveModule(id, kit.directoryToURL(pathe.dirname(pkgJson)));
|
|
2497
|
+
if (nested)
|
|
2498
|
+
return nested;
|
|
2499
|
+
}
|
|
2500
|
+
}
|
|
2501
|
+
async function importResolvedModule(id, resolvedPath) {
|
|
2502
|
+
return await (resolvedPath ? import(node_url.pathToFileURL(resolvedPath).href) : import(id));
|
|
2503
|
+
}
|
|
2504
|
+
async function importOptionalPeer(id, resolvedPath, usage) {
|
|
2505
|
+
try {
|
|
2506
|
+
return await importResolvedModule(id, resolvedPath);
|
|
2507
|
+
} catch (cause) {
|
|
2508
|
+
throw new Error(
|
|
2509
|
+
`[nuxt-og-image] Missing optional peer dependency "${id}". Install it to use ${usage}.`,
|
|
2510
|
+
{ cause }
|
|
2511
|
+
);
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2514
|
+
|
|
2475
2515
|
const ONE_WEEK_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
2476
2516
|
function setupPrerenderHandler(options, resolve, getDetectedRenderers, getCompatibilityMeta = () => ({}), nuxt = kit.useNuxt()) {
|
|
2477
2517
|
nuxt.hooks.hook("nitro:init", async (nitro) => {
|
|
@@ -4451,7 +4491,7 @@ function getComponentTypeExpression(component, nuxt) {
|
|
|
4451
4491
|
return `typeof import('${relativeComponentPath}')['default']`;
|
|
4452
4492
|
}
|
|
4453
4493
|
function registerTypeTemplates(ctx) {
|
|
4454
|
-
const { nuxt, config, componentCtx } = ctx;
|
|
4494
|
+
const { nuxt, config, componentCtx, nitroCompatibility } = ctx;
|
|
4455
4495
|
nuxt.hook("prepare:types", ({ tsConfig }) => {
|
|
4456
4496
|
tsConfig.include = tsConfig.include || [];
|
|
4457
4497
|
tsConfig.include.push("./module/nuxt-og-image-components.d.ts");
|
|
@@ -4502,7 +4542,7 @@ ${lines.join("\n")}
|
|
|
4502
4542
|
getContents: (data) => {
|
|
4503
4543
|
const typesPath = pathe.relative(pathe.resolve(data.nuxt.options.rootDir, data.nuxt.options.buildDir, "types"), pathe.resolve("runtime/types"));
|
|
4504
4544
|
return `declare module '#og-image-virtual/public-assets.mjs' {
|
|
4505
|
-
import type { H3Event } from 'h3'
|
|
4545
|
+
import type { H3Event } from '#nuxtseo/h3'
|
|
4506
4546
|
import type { FontConfig } from '${typesPath}'
|
|
4507
4547
|
export function resolve(event: H3Event, font: FontConfig): Promise<BufferSource>
|
|
4508
4548
|
}
|
|
@@ -4581,7 +4621,7 @@ declare module '#og-image-virtual/tw4-theme.mjs' {
|
|
|
4581
4621
|
getContents: (data) => {
|
|
4582
4622
|
const typesPath = pathe.relative(pathe.resolve(data.nuxt.options.rootDir, data.nuxt.options.buildDir, "types"), pathe.resolve("runtime/types"));
|
|
4583
4623
|
return `declare module '#og-image/bindings/browser' {
|
|
4584
|
-
import type { H3Event } from 'h3'
|
|
4624
|
+
import type { H3Event } from '#nuxtseo/h3'
|
|
4585
4625
|
export function createBrowser(event?: H3Event): Promise<any>
|
|
4586
4626
|
}
|
|
4587
4627
|
|
|
@@ -4641,61 +4681,34 @@ declare module '#og-image-cache' {
|
|
|
4641
4681
|
filename: "types/og-image-augments.d.ts",
|
|
4642
4682
|
getContents: (data) => {
|
|
4643
4683
|
const typesPath = pathe.relative(pathe.resolve(data.nuxt.options.rootDir, data.nuxt.options.buildDir, "types"), pathe.resolve("runtime/types"));
|
|
4684
|
+
const nitroAugmentations = kit$1.renderNitroTypeAugmentations(nitroCompatibility, {
|
|
4685
|
+
nitroInterfaces: {
|
|
4686
|
+
NitroApp: `_ogImageCacheBackendWarned?: boolean
|
|
4687
|
+
_ogImageIconsData?: OgImageIconsData`,
|
|
4688
|
+
NitroRuntimeConfig: `'nuxt-og-image': OgImageRuntimeConfig
|
|
4689
|
+
ogImage?: {
|
|
4690
|
+
secret?: string
|
|
4691
|
+
}`
|
|
4692
|
+
},
|
|
4693
|
+
routeRules: "ogImage?: false | OgImageOptions & Record<string, any>",
|
|
4694
|
+
routeConfig: "ogImage?: false | OgImageOptions & Record<string, any>",
|
|
4695
|
+
runtimeHooks: `'nuxt-og-image:context': (ctx: OgImageRenderEventContext) => void | Promise<void>
|
|
4696
|
+
'nuxt-og-image:satori:vnodes': (vnodes: VNode, ctx: OgImageRenderEventContext) => void | Promise<void>`,
|
|
4697
|
+
eventContext: `_nitro?: {
|
|
4698
|
+
routeRules?: import('${nitroCompatibility.nitroTypesModule}').NitroRouteRules
|
|
4699
|
+
}
|
|
4700
|
+
_ogImagePrerenderPaths?: Map<string, string>`
|
|
4701
|
+
});
|
|
4644
4702
|
return `/// <reference path="./og-image-virtual.d.ts" />
|
|
4645
4703
|
/// <reference path="./og-image-bindings.d.ts" />
|
|
4646
|
-
import type { OgImageOptions, OgImageRenderEventContext, VNode } from '${typesPath}'
|
|
4704
|
+
import type { OgImageIconsData, OgImageOptions, OgImageRenderEventContext, OgImageRuntimeConfig, VNode } from '${typesPath}'
|
|
4647
4705
|
|
|
4648
|
-
|
|
4649
|
-
interface NitroRuntimeConfig {
|
|
4650
|
-
'nuxt-og-image': OgImageRuntimeConfig
|
|
4651
|
-
ogImage?: {
|
|
4652
|
-
secret?: string
|
|
4653
|
-
}
|
|
4654
|
-
}
|
|
4655
|
-
interface NitroRouteRules {
|
|
4656
|
-
ogImage?: false | OgImageOptions & Record<string, any>
|
|
4657
|
-
}
|
|
4658
|
-
interface NitroRouteConfig {
|
|
4659
|
-
ogImage?: false | OgImageOptions & Record<string, any>
|
|
4660
|
-
}
|
|
4661
|
-
interface NitroRuntimeHooks {
|
|
4662
|
-
'nuxt-og-image:context': (ctx: OgImageRenderEventContext) => void | Promise<void>
|
|
4663
|
-
'nuxt-og-image:satori:vnodes': (vnodes: VNode, ctx: OgImageRenderEventContext) => void | Promise<void>
|
|
4664
|
-
}
|
|
4665
|
-
}
|
|
4666
|
-
|
|
4667
|
-
declare module 'nitropack/types' {
|
|
4668
|
-
interface NitroRuntimeConfig {
|
|
4669
|
-
'nuxt-og-image': OgImageRuntimeConfig
|
|
4670
|
-
ogImage?: {
|
|
4671
|
-
secret?: string
|
|
4672
|
-
}
|
|
4673
|
-
}
|
|
4674
|
-
interface NitroRouteRules {
|
|
4675
|
-
ogImage?: false | OgImageOptions & Record<string, any>
|
|
4676
|
-
}
|
|
4677
|
-
interface NitroRouteConfig {
|
|
4678
|
-
ogImage?: false | OgImageOptions & Record<string, any>
|
|
4679
|
-
}
|
|
4680
|
-
interface NitroRuntimeHooks {
|
|
4681
|
-
'nuxt-og-image:context': (ctx: OgImageRenderEventContext) => void | Promise<void>
|
|
4682
|
-
'nuxt-og-image:satori:vnodes': (vnodes: VNode, ctx: OgImageRenderEventContext) => void | Promise<void>
|
|
4683
|
-
}
|
|
4684
|
-
}
|
|
4685
|
-
|
|
4686
|
-
declare module 'h3' {
|
|
4687
|
-
interface H3EventContext {
|
|
4688
|
-
_nitro?: {
|
|
4689
|
-
routeRules?: import('nitropack').NitroRouteRules
|
|
4690
|
-
}
|
|
4691
|
-
_ogImagePrerenderPaths?: Map<string, string>
|
|
4692
|
-
}
|
|
4693
|
-
}
|
|
4706
|
+
${nitroAugmentations}
|
|
4694
4707
|
|
|
4695
4708
|
export {}
|
|
4696
4709
|
`;
|
|
4697
4710
|
}
|
|
4698
|
-
});
|
|
4711
|
+
}, { nitro: true, nuxt: true });
|
|
4699
4712
|
}
|
|
4700
4713
|
|
|
4701
4714
|
const RE_INLINE_CONFIG = /const\s+inlineConfig\s*=\s*(\{[\s\S]*?\n\})/;
|
|
@@ -4790,7 +4803,7 @@ const module$1 = kit.defineNuxtModule({
|
|
|
4790
4803
|
await onUpgrade(nuxt, options, previousVersion);
|
|
4791
4804
|
},
|
|
4792
4805
|
async setup(config, nuxt) {
|
|
4793
|
-
const _resolver = kit.createResolver((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/nuxt-og-image.
|
|
4806
|
+
const _resolver = kit.createResolver((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/nuxt-og-image.CdpC3njh.cjs', document.baseURI).href)));
|
|
4794
4807
|
const fixSharedPath = (p) => {
|
|
4795
4808
|
return p.replace(/\/shared\/runtime(\/|$)/, "/runtime$1").replace(/\/shared\/client(\/|$)/, "/client$1").replace(/\/shared\/devtools(\/|$)/, "/devtools$1");
|
|
4796
4809
|
};
|
|
@@ -4810,6 +4823,12 @@ const module$1 = kit.defineNuxtModule({
|
|
|
4810
4823
|
});
|
|
4811
4824
|
return;
|
|
4812
4825
|
}
|
|
4826
|
+
const nitroCompatibility = kit$1.setupNitroRuntimeCompatibility(nuxt);
|
|
4827
|
+
const setRuntimeAlias = (id, path) => {
|
|
4828
|
+
nuxt.options.alias[id] = path;
|
|
4829
|
+
nuxt.options.nitro.alias ||= {};
|
|
4830
|
+
nuxt.options.nitro.alias[id] = path;
|
|
4831
|
+
};
|
|
4813
4832
|
if (config.enabled && !nuxt.options.ssr) {
|
|
4814
4833
|
logger_js.logger.warn("Nuxt OG Image is enabled but SSR is disabled.\n\nYou should enable SSR (`ssr: true`) or disable the module (`ogImage: { enabled: false }`).");
|
|
4815
4834
|
return;
|
|
@@ -4886,8 +4905,7 @@ Or pin to a specific version in package.json:
|
|
|
4886
4905
|
break;
|
|
4887
4906
|
}
|
|
4888
4907
|
}
|
|
4889
|
-
|
|
4890
|
-
nuxt.options.alias["#og-image-cache"] = resolve("./runtime/server/og-image/cache/lru");
|
|
4908
|
+
setRuntimeAlias("#og-image-cache", resolve("./runtime/server/og-image/cache/lru"));
|
|
4891
4909
|
const preset = resolveOgImagePreset(nuxt.options.nitro);
|
|
4892
4910
|
const targetCompatibility = getPresetNitroPresetCompatibility(preset);
|
|
4893
4911
|
const runtimeCompatibilityMeta = {};
|
|
@@ -4908,11 +4926,11 @@ Or pin to a specific version in package.json:
|
|
|
4908
4926
|
let buildEmojiSet;
|
|
4909
4927
|
if (config.defaults.emojis === false) {
|
|
4910
4928
|
logger_js.logger.debug("Emoji support disabled.");
|
|
4911
|
-
|
|
4929
|
+
setRuntimeAlias("#og-image/emoji-transform", resolve("./runtime/server/og-image/core/transforms/emojis/noop"));
|
|
4912
4930
|
buildEmojiSet = void 0;
|
|
4913
4931
|
} else {
|
|
4914
4932
|
buildEmojiSet = config.defaults.emojis || "noto";
|
|
4915
|
-
|
|
4933
|
+
setRuntimeAlias("#og-image/emoji-transform", resolve("./runtime/server/og-image/core/transforms/emojis/fetch"));
|
|
4916
4934
|
}
|
|
4917
4935
|
const { detectCssProvider } = await Promise.resolve().then(function () { return cssProvider; });
|
|
4918
4936
|
const cssFramework = detectCssProvider(nuxt);
|
|
@@ -4920,6 +4938,10 @@ Or pin to a specific version in package.json:
|
|
|
4920
4938
|
if (cssFramework === "unocss") {
|
|
4921
4939
|
logger_js.logger.debug("UnoCSS detected, using UnoCSS provider for OG image styling");
|
|
4922
4940
|
const { setUnoConfig, setUnoRootDir, createUnoProvider } = await import('../chunks/uno.cjs');
|
|
4941
|
+
const [unocssCorePath, unocssConfigPath] = await Promise.all([
|
|
4942
|
+
resolveOptionalModulePath("@unocss/core", nuxt.options.rootDir, ["@unocss/nuxt", "unocss"]),
|
|
4943
|
+
resolveOptionalModulePath("@unocss/config", nuxt.options.rootDir, ["@unocss/nuxt", "unocss"])
|
|
4944
|
+
]);
|
|
4923
4945
|
setUnoRootDir(nuxt.options.rootDir);
|
|
4924
4946
|
nuxt.hook("unocss:config", (config2) => {
|
|
4925
4947
|
setUnoConfig(config2);
|
|
@@ -4931,6 +4953,8 @@ Or pin to a specific version in package.json:
|
|
|
4931
4953
|
config2.content.pipeline.exclude.push(...excludePatterns);
|
|
4932
4954
|
});
|
|
4933
4955
|
cssProvider$1 = createUnoProvider({
|
|
4956
|
+
unocssCorePath,
|
|
4957
|
+
unocssConfigPath,
|
|
4934
4958
|
async resolveCssPath() {
|
|
4935
4959
|
for (const cssEntry of nuxt.options.css) {
|
|
4936
4960
|
const cssPath = typeof cssEntry === "string" ? cssEntry : cssEntry?.src;
|
|
@@ -5134,7 +5158,7 @@ ${familyInfo}`);
|
|
|
5134
5158
|
});
|
|
5135
5159
|
if (!nuxt.options.dev) {
|
|
5136
5160
|
kit.addBuildPlugin(TreeShakeComposablesPlugin, { server: true, client: true, build: true });
|
|
5137
|
-
|
|
5161
|
+
setRuntimeAlias("#og-image-cache", resolve("./runtime/server/og-image/cache/mock"));
|
|
5138
5162
|
}
|
|
5139
5163
|
}
|
|
5140
5164
|
const basePath = config.zeroRuntime ? "./runtime/server/routes/__zero-runtime" : "./runtime/server/routes";
|
|
@@ -5700,7 +5724,8 @@ export const rootDir = ${JSON.stringify(nuxt.options.rootDir)}`;
|
|
|
5700
5724
|
registerTypeTemplates({
|
|
5701
5725
|
nuxt,
|
|
5702
5726
|
config,
|
|
5703
|
-
componentCtx: ogImageComponentCtx
|
|
5727
|
+
componentCtx: ogImageComponentCtx,
|
|
5728
|
+
nitroCompatibility
|
|
5704
5729
|
});
|
|
5705
5730
|
const cacheEnabled = typeof config.runtimeCacheStorage !== "undefined" && config.runtimeCacheStorage !== false;
|
|
5706
5731
|
const cacheVersion = config.cacheVersion === false ? "" : config.cacheVersion ?? version;
|
|
@@ -5804,7 +5829,7 @@ export const rootDir = ${JSON.stringify(nuxt.options.rootDir)}`;
|
|
|
5804
5829
|
const getDetectedRenderers = () => ogImageComponentCtx.detectedRenderers;
|
|
5805
5830
|
const getCompatibilityMeta = () => runtimeCompatibilityMeta;
|
|
5806
5831
|
if (nuxt.options.dev) {
|
|
5807
|
-
setupDevHandler(config, resolver, getDetectedRenderers, getCompatibilityMeta);
|
|
5832
|
+
await setupDevHandler(config, resolver, getDetectedRenderers, getCompatibilityMeta);
|
|
5808
5833
|
setupDevToolsUI(config, resolve, nuxt, cssFramework || "none");
|
|
5809
5834
|
const useNitro = new Promise((resolveNitro) => {
|
|
5810
5835
|
nuxt.hooks.hook("nitro:init", resolveNitro);
|
|
@@ -5840,6 +5865,9 @@ export const rootDir = ${JSON.stringify(nuxt.options.rootDir)}`;
|
|
|
5840
5865
|
} else if (nuxt.options.build) {
|
|
5841
5866
|
await setupBuildHandler(config, resolver, getDetectedRenderers, getCompatibilityMeta);
|
|
5842
5867
|
}
|
|
5868
|
+
setRuntimeAlias("#og-image/app", resolve("./runtime/app"));
|
|
5869
|
+
setRuntimeAlias("#og-image/shared", resolve("./runtime/shared"));
|
|
5870
|
+
setRuntimeAlias("#og-image/types", resolve("./runtime/types"));
|
|
5843
5871
|
if (nuxt.options.build)
|
|
5844
5872
|
kit.addServerPlugin(resolve("./runtime/server/plugins/prerender"));
|
|
5845
5873
|
setupPrerenderHandler(config, resolver, getDetectedRenderers, getCompatibilityMeta);
|
|
@@ -5858,10 +5886,13 @@ exports.extractPropertyInitialValues = extractPropertyInitialValues;
|
|
|
5858
5886
|
exports.extractUniversalVars = extractUniversalVars;
|
|
5859
5887
|
exports.extractVariantBaseClasses = extractVariantBaseClasses;
|
|
5860
5888
|
exports.extractVarsFromCss = extractVarsFromCss;
|
|
5889
|
+
exports.importOptionalPeer = importOptionalPeer;
|
|
5890
|
+
exports.importResolvedModule = importResolvedModule;
|
|
5861
5891
|
exports.loadLightningCss = loadLightningCss;
|
|
5862
5892
|
exports.module = module$1;
|
|
5863
5893
|
exports.postProcessStyles = postProcessStyles;
|
|
5864
5894
|
exports.resolveExtractedVars = resolveExtractedVars;
|
|
5895
|
+
exports.resolveOptionalModulePath = resolveOptionalModulePath;
|
|
5865
5896
|
exports.resolveVariantPrefixes = resolveVariantPrefixes;
|
|
5866
5897
|
exports.resolveVarsDeep = resolveVarsDeep;
|
|
5867
5898
|
exports.simplifyCss = simplifyCss;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-og-image",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "6.7.
|
|
4
|
+
"version": "6.7.6",
|
|
5
5
|
"description": "Enlightened OG Image generation for Nuxt.",
|
|
6
6
|
"author": {
|
|
7
7
|
"website": "https://harlanzw.com",
|
|
@@ -53,6 +53,8 @@
|
|
|
53
53
|
"@takumi-rs/core": "^1.0.0-beta.3 || ^2.0.0",
|
|
54
54
|
"@takumi-rs/wasm": "^1.0.0-beta.3 || ^2.0.0",
|
|
55
55
|
"@unhead/vue": "^2.0.5 || ^3.0.0",
|
|
56
|
+
"@unocss/config": "^66.7.5",
|
|
57
|
+
"@unocss/core": "^66.7.5",
|
|
56
58
|
"fontless": "^0.2.0",
|
|
57
59
|
"nitropack": "^2.13.4",
|
|
58
60
|
"playwright-core": "^1.50.0",
|
|
@@ -76,6 +78,12 @@
|
|
|
76
78
|
"@takumi-rs/wasm": {
|
|
77
79
|
"optional": true
|
|
78
80
|
},
|
|
81
|
+
"@unocss/config": {
|
|
82
|
+
"optional": true
|
|
83
|
+
},
|
|
84
|
+
"@unocss/core": {
|
|
85
|
+
"optional": true
|
|
86
|
+
},
|
|
79
87
|
"fontless": {
|
|
80
88
|
"optional": true
|
|
81
89
|
},
|
|
@@ -104,33 +112,31 @@
|
|
|
104
112
|
"dependencies": {
|
|
105
113
|
"@clack/prompts": "^1.7.0",
|
|
106
114
|
"@nuxt/kit": "^4.5.1",
|
|
107
|
-
"@unocss/config": "^66.7.5",
|
|
108
|
-
"@unocss/core": "^66.7.5",
|
|
109
115
|
"@vue/compiler-sfc": "^3.5.40",
|
|
110
116
|
"chrome-launcher": "^1.2.1",
|
|
111
117
|
"consola": "^3.4.2",
|
|
112
118
|
"defu": "^6.1.7",
|
|
113
|
-
"devalue": "^5.
|
|
119
|
+
"devalue": "^5.9.0",
|
|
114
120
|
"exsolve": "^1.1.1",
|
|
115
121
|
"fnv1a-64": "^0.1.2",
|
|
116
122
|
"lightningcss": "^1.33.0",
|
|
117
123
|
"magic-string": "^1.1.0",
|
|
118
|
-
"magicast": "^0.5.
|
|
124
|
+
"magicast": "^0.5.4",
|
|
119
125
|
"mocked-exports": "^0.1.1",
|
|
120
|
-
"nuxt-site-config": "^4.1.
|
|
121
|
-
"nuxtseo-shared": "^5.3.
|
|
122
|
-
"nypm": "^0.6.
|
|
126
|
+
"nuxt-site-config": "^4.1.4",
|
|
127
|
+
"nuxtseo-shared": "^5.3.8",
|
|
128
|
+
"nypm": "^0.6.9",
|
|
123
129
|
"object-identity": "^0.2.3",
|
|
124
130
|
"ofetch": "^1.5.1",
|
|
125
131
|
"ohash": "^2.0.11",
|
|
126
132
|
"oxc-parser": "^0.142.0",
|
|
127
|
-
"oxc-walker": "^1.
|
|
133
|
+
"oxc-walker": "^1.1.1",
|
|
128
134
|
"pathe": "^2.0.3",
|
|
129
135
|
"pkg-types": "^2.3.1",
|
|
130
136
|
"radix3": "^1.1.2",
|
|
131
137
|
"std-env": "^4.2.0",
|
|
132
|
-
"strip-literal": "^
|
|
133
|
-
"tinyexec": "^1.
|
|
138
|
+
"strip-literal": "^4.0.0",
|
|
139
|
+
"tinyexec": "^1.3.0",
|
|
134
140
|
"ufo": "^1.6.4",
|
|
135
141
|
"ultrahtml": "^1.7.0",
|
|
136
142
|
"unplugin": "^3.3.0"
|
|
@@ -138,44 +144,46 @@
|
|
|
138
144
|
"devDependencies": {
|
|
139
145
|
"@antfu/eslint-config": "^9.2.0",
|
|
140
146
|
"@fontsource/noto-sans-sc": "^5.3.0",
|
|
141
|
-
"@iconify-json/carbon": "^1.2.
|
|
147
|
+
"@iconify-json/carbon": "^1.2.25",
|
|
142
148
|
"@iconify-json/logos": "^1.2.11",
|
|
143
149
|
"@iconify-json/noto": "^1.2.7",
|
|
144
150
|
"@iconify-json/ri": "^1.2.10",
|
|
145
|
-
"@iconify-json/tabler": "^1.2.
|
|
151
|
+
"@iconify-json/tabler": "^1.2.38",
|
|
146
152
|
"@iconify/types": "^2.0.0",
|
|
147
153
|
"@img/sharp-linux-x64": "^0.35.3",
|
|
148
154
|
"@nuxt/content": "^3.15.2",
|
|
149
155
|
"@nuxt/devtools": "4.0.0-alpha.9",
|
|
150
156
|
"@nuxt/devtools-kit": "4.0.0-alpha.9",
|
|
151
157
|
"@nuxt/fonts": "^0.14.0",
|
|
152
|
-
"@nuxt/icon": "^2.
|
|
153
|
-
"@nuxt/image": "^2.
|
|
158
|
+
"@nuxt/icon": "^2.4.1",
|
|
159
|
+
"@nuxt/image": "^2.1.0",
|
|
154
160
|
"@nuxt/module-builder": "^1.0.3",
|
|
155
161
|
"@nuxt/test-utils": "^4.1.0",
|
|
156
162
|
"@nuxt/ui": "^4.10.0",
|
|
157
163
|
"@nuxtjs/color-mode": "^4.0.1",
|
|
158
164
|
"@nuxtjs/eslint-config-typescript": "^12.1.0",
|
|
159
|
-
"@nuxtjs/i18n": "^10.
|
|
165
|
+
"@nuxtjs/i18n": "^10.6.0",
|
|
160
166
|
"@nuxtjs/tailwindcss": "7.0.0-beta.1",
|
|
161
167
|
"@resvg/resvg-js": "^2.6.2",
|
|
162
168
|
"@resvg/resvg-wasm": "^2.6.2",
|
|
163
169
|
"@tailwindcss/vite": "^4.3.3",
|
|
164
|
-
"@takumi-rs/core": "^2.5.
|
|
170
|
+
"@takumi-rs/core": "^2.5.4",
|
|
165
171
|
"@takumi-rs/core-v1": "npm:@takumi-rs/core@1.8.7",
|
|
166
|
-
"@takumi-rs/helpers": "^2.5.
|
|
172
|
+
"@takumi-rs/helpers": "^2.5.4",
|
|
167
173
|
"@takumi-rs/helpers-v1": "npm:@takumi-rs/helpers@1.8.7",
|
|
168
|
-
"@takumi-rs/wasm": "^2.5.
|
|
174
|
+
"@takumi-rs/wasm": "^2.5.4",
|
|
169
175
|
"@takumi-rs/wasm-v1": "npm:@takumi-rs/wasm@1.8.7",
|
|
176
|
+
"@unocss/config": "^66.7.5",
|
|
177
|
+
"@unocss/core": "^66.7.5",
|
|
170
178
|
"@unocss/nuxt": "^66.7.5",
|
|
171
179
|
"@unocss/preset-icons": "^66.7.5",
|
|
172
180
|
"@unocss/preset-wind": "^66.7.5",
|
|
173
181
|
"@unocss/preset-wind4": "^66.7.5",
|
|
174
182
|
"@vitejs/plugin-vue": "^6.0.8",
|
|
175
183
|
"@vue/compiler-core": "^3.5.40",
|
|
176
|
-
"@vueuse/nuxt": "^14.
|
|
184
|
+
"@vueuse/nuxt": "^14.4.0",
|
|
177
185
|
"birpc": "^4.0.0",
|
|
178
|
-
"bumpp": "^12.
|
|
186
|
+
"bumpp": "^12.1.1",
|
|
179
187
|
"eslint": "^10.8.0",
|
|
180
188
|
"eslint-plugin-harlanzw": "^0.17.1",
|
|
181
189
|
"fontless": "^0.2.1",
|
|
@@ -187,9 +195,9 @@
|
|
|
187
195
|
"lightningcss": "^1.33.0",
|
|
188
196
|
"nitropack": "^2.13.4",
|
|
189
197
|
"nuxt": "^4.5.1",
|
|
190
|
-
"nuxtseo-layer-devtools": "^5.3.
|
|
191
|
-
"playwright": "^1.62.
|
|
192
|
-
"playwright-core": "^1.62.
|
|
198
|
+
"nuxtseo-layer-devtools": "^5.3.8",
|
|
199
|
+
"playwright": "^1.62.1",
|
|
200
|
+
"playwright-core": "^1.62.1",
|
|
193
201
|
"sass": "^1.102.0",
|
|
194
202
|
"satori": "^0.29.0",
|
|
195
203
|
"sharp": "^0.35.3",
|
|
@@ -201,8 +209,8 @@
|
|
|
201
209
|
"unocss": "^66.7.5",
|
|
202
210
|
"vitest": "^4.1.10",
|
|
203
211
|
"vue": "^3.5.40",
|
|
204
|
-
"vue-tsc": "^3.3.
|
|
205
|
-
"wrangler": "^4.
|
|
212
|
+
"vue-tsc": "^3.3.9",
|
|
213
|
+
"wrangler": "^4.118.0",
|
|
206
214
|
"yoga-wasm-web": "^0.3.3",
|
|
207
215
|
"zod": "^4.4.3"
|
|
208
216
|
},
|
|
@@ -219,9 +227,12 @@
|
|
|
219
227
|
"prepare:fixtures": "node scripts/prepare-fixtures.mjs",
|
|
220
228
|
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare playground && nuxt prepare client && pnpm run prepare:fixtures && pnpm run build:client",
|
|
221
229
|
"release": "pnpm build && bumpp -x \"npx changelogen --output=CHANGELOG.md\"",
|
|
222
|
-
"typecheck": "
|
|
230
|
+
"typecheck": "pnpm stub && nuxt typecheck",
|
|
223
231
|
"test": "pnpm run prepare:fixtures && vitest",
|
|
232
|
+
"test:run": "pnpm test -- --run && pnpm test:nuxt5",
|
|
233
|
+
"test:nuxt5": "pnpm pack --out test/fixtures/nuxt5/nuxt-og-image.tgz && pnpm --dir test/fixtures/nuxt5 install --frozen-lockfile && pnpm --dir test/fixtures/nuxt5 test",
|
|
224
234
|
"test:chrome": "HAS_CHROME=true vitest",
|
|
235
|
+
"test:packed-install": "node scripts/smoke-packed-install.mjs",
|
|
225
236
|
"test:takumi:e2e": "node scripts/test-takumi-e2e.mjs",
|
|
226
237
|
"test:takumi:e2e:matrix": "node scripts/test-takumi-e2e.mjs --matrix",
|
|
227
238
|
"test:takumi:e2e:compare": "node scripts/test-takumi-e2e.mjs --compare"
|
package/types/virtual.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
declare module '#nuxtseo/h3' {
|
|
2
|
+
export * from 'h3'
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
declare module '#nuxtseo/nitro' {
|
|
6
|
+
export * from 'nitropack/runtime'
|
|
7
|
+
}
|
|
8
|
+
|
|
1
9
|
declare module '#og-image/components' {
|
|
2
10
|
import type { Component } from 'vue'
|
|
3
11
|
|
|
@@ -63,6 +71,13 @@ declare module '#og-image/island-hash' {
|
|
|
63
71
|
}): string
|
|
64
72
|
}
|
|
65
73
|
|
|
74
|
+
declare module '#og-image/nitro-fetch' {
|
|
75
|
+
import type { FetchOptions, FetchRequest } from 'ofetch'
|
|
76
|
+
import type { H3Event } from '#nuxtseo/h3'
|
|
77
|
+
|
|
78
|
+
export function fetchWithEvent<T>(event: H3Event, request: FetchRequest, options?: FetchOptions): Promise<T>
|
|
79
|
+
}
|
|
80
|
+
|
|
66
81
|
declare module '#og-image/font-requirements' {
|
|
67
82
|
export const fontRequirements: {
|
|
68
83
|
weights: number[]
|