nuxt-og-image 6.3.2 → 6.3.4
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 +1 -1
- package/dist/chunks/tw4.mjs +1 -1
- package/dist/chunks/uno.cjs +1 -1
- package/dist/chunks/uno.mjs +1 -1
- package/dist/content.d.cts +3 -1
- package/dist/content.d.mts +3 -1
- package/dist/content.d.ts +3 -1
- package/dist/devtools/200.html +1 -1
- package/dist/devtools/404.html +1 -1
- package/dist/devtools/_nuxt/{C9JKABtj.js → 05VU1kAP.js} +1 -1
- package/dist/devtools/_nuxt/BWm573-p.js +3 -0
- package/dist/devtools/_nuxt/C4ssBbxk.js +23 -0
- package/dist/devtools/_nuxt/Cy0omYQh.js +152 -0
- package/dist/devtools/_nuxt/D6HqPJ2P.js +1 -0
- package/dist/devtools/_nuxt/{C-b6hTTf.js → DDRo8-tD.js} +1 -1
- package/dist/devtools/_nuxt/DJOUfd_s.js +2 -0
- package/dist/devtools/_nuxt/DO62csGn.js +1 -0
- package/dist/devtools/_nuxt/DevtoolsSection.BA22BKWd.css +1 -0
- package/dist/devtools/_nuxt/DevtoolsSnippet.5f9DiVqQ.css +1 -0
- package/dist/devtools/_nuxt/DggwDRkJ.js +4 -0
- package/dist/devtools/_nuxt/Dgwhb1xi.js +1 -0
- package/dist/devtools/_nuxt/DmsY5seq.js +3 -0
- package/dist/devtools/_nuxt/Dn8E1mDk.js +1 -0
- package/dist/devtools/_nuxt/{DA9abGfd.js → DziLl24l.js} +1 -1
- package/dist/devtools/_nuxt/builds/latest.json +1 -1
- package/dist/devtools/_nuxt/builds/meta/13f85b83-b220-4283-8efd-9b1adfb63ca9.json +1 -0
- package/dist/devtools/_nuxt/entry.D0N1PjT9.css +2 -0
- package/dist/devtools/_nuxt/{pages.CPczdJu3.css → pages.DjPHX4aO.css} +1 -1
- package/dist/devtools/_nuxt/renderer-select.Dd3SlzOB.css +1 -0
- package/dist/devtools/debug/index.html +1 -1
- package/dist/devtools/docs/index.html +1 -1
- package/dist/devtools/index.html +1 -1
- package/dist/devtools/templates/index.html +1 -1
- package/dist/module.cjs +1 -1
- package/dist/module.d.cts +3 -2
- package/dist/module.d.mts +3 -2
- package/dist/module.d.ts +3 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/app/composables/_defineOgImageRaw.js +13 -7
- package/dist/runtime/app/composables/defineOgImageScreenshot.js +3 -1
- package/dist/runtime/app/utils.d.ts +8 -3
- package/dist/runtime/app/utils.js +79 -10
- package/dist/runtime/server/og-image/bindings/takumi/wasm.d.ts +1 -1
- package/dist/runtime/server/og-image/bindings/takumi/wasm.js +1 -1
- package/dist/runtime/server/og-image/font-subsets.d.ts +24 -0
- package/dist/runtime/server/og-image/font-subsets.js +53 -0
- package/dist/runtime/server/og-image/fonts.d.ts +7 -0
- package/dist/runtime/server/og-image/fonts.js +5 -4
- package/dist/runtime/server/og-image/satori/renderer.js +38 -4
- package/dist/runtime/server/og-image/takumi/renderer.js +28 -12
- package/dist/runtime/types.d.ts +8 -1
- package/dist/shared/{nuxt-og-image.CYm-mAcA.mjs → nuxt-og-image.DW7_z3y5.mjs} +54 -13
- package/dist/shared/{nuxt-og-image.PUNoqZDW.cjs → nuxt-og-image.as-lQ2yV.cjs} +55 -14
- package/package.json +26 -25
- package/dist/devtools/_nuxt/BNA9K40e.js +0 -3
- package/dist/devtools/_nuxt/CD0R49mQ.js +0 -2
- package/dist/devtools/_nuxt/CaQt7uvw.js +0 -4
- package/dist/devtools/_nuxt/CoSxBJd8.js +0 -1
- package/dist/devtools/_nuxt/D0q6HvYk.js +0 -174
- package/dist/devtools/_nuxt/D2zWjF09.js +0 -3
- package/dist/devtools/_nuxt/DGG_4uof.js +0 -1
- package/dist/devtools/_nuxt/DevtoolsSnippet.CHln_zRX.css +0 -1
- package/dist/devtools/_nuxt/builds/meta/9d408b39-cc9a-4751-be86-2f2ab3ba2395.json +0 -1
- package/dist/devtools/_nuxt/entry.BPMZ_Jol.css +0 -2
- /package/dist/devtools/_nuxt/{Bx_VzvYa.js → BsRKQH5X.js} +0 -0
- /package/dist/devtools/_nuxt/{PnYIYlhI.js → CDaXKRRu.js} +0 -0
- /package/dist/devtools/_nuxt/{z1-BJQbH.js → CM-t-6ZT.js} +0 -0
- /package/dist/devtools/_nuxt/{CHHO6nw6.js → CP0tQR2M.js} +0 -0
- /package/dist/devtools/_nuxt/{BwW5PI4u.js → HWyD49jH.js} +0 -0
- /package/dist/devtools/_nuxt/{CDUvHTjX.js → PONEy9N-.js} +0 -0
|
@@ -146,7 +146,24 @@ const RuntimeCompatibility = {
|
|
|
146
146
|
"nitro-prerender": NodePrerenderRuntime,
|
|
147
147
|
"node-server": NodeRuntime,
|
|
148
148
|
"node-cluster": NodeRuntime,
|
|
149
|
+
"node-listener": NodeRuntime,
|
|
149
150
|
"bun": NodeRuntime,
|
|
151
|
+
"deno-server": NodeRuntime,
|
|
152
|
+
"deno-deploy": NodeRuntime,
|
|
153
|
+
// node-server extending presets
|
|
154
|
+
"alwaysdata": NodeRuntime,
|
|
155
|
+
"cleavr": NodeRuntime,
|
|
156
|
+
"digital-ocean": NodeRuntime,
|
|
157
|
+
"edgio": NodeRuntime,
|
|
158
|
+
"flight-control": NodeRuntime,
|
|
159
|
+
"heroku": NodeRuntime,
|
|
160
|
+
"iis-handler": NodeRuntime,
|
|
161
|
+
"iis-node": NodeRuntime,
|
|
162
|
+
"koyeb": NodeRuntime,
|
|
163
|
+
"platform-sh": NodeRuntime,
|
|
164
|
+
"render-com": NodeRuntime,
|
|
165
|
+
"zeabur": NodeRuntime,
|
|
166
|
+
"zerops": NodeRuntime,
|
|
150
167
|
"stackblitz": WebContainer,
|
|
151
168
|
"codesandbox": WebContainer,
|
|
152
169
|
"aws-amplify": awsLambda,
|
|
@@ -440,7 +457,7 @@ function patchWebAssemblyInstantiate(code) {
|
|
|
440
457
|
const PROVIDER_DEPENDENCIES = [
|
|
441
458
|
{
|
|
442
459
|
name: "satori",
|
|
443
|
-
description: "SVG-based renderer using Satori
|
|
460
|
+
description: "SVG-based renderer using Satori",
|
|
444
461
|
bindings: {
|
|
445
462
|
"node": [
|
|
446
463
|
{ name: "satori", description: "HTML to SVG renderer" },
|
|
@@ -458,7 +475,7 @@ const PROVIDER_DEPENDENCIES = [
|
|
|
458
475
|
},
|
|
459
476
|
{
|
|
460
477
|
name: "takumi",
|
|
461
|
-
description: "Rust-based high-performance renderer",
|
|
478
|
+
description: "Rust-based high-performance renderer (recommended)",
|
|
462
479
|
bindings: {
|
|
463
480
|
"node": [
|
|
464
481
|
{ name: "@takumi-rs/core", description: "Native Takumi renderer" }
|
|
@@ -577,9 +594,9 @@ async function promptForRendererSelection() {
|
|
|
577
594
|
const renderer = await logger.prompt("Which renderer would you like to use?", {
|
|
578
595
|
type: "select",
|
|
579
596
|
options: PROVIDER_DEPENDENCIES.map((p) => p.name),
|
|
580
|
-
initial: "
|
|
597
|
+
initial: "takumi"
|
|
581
598
|
});
|
|
582
|
-
return renderer || "
|
|
599
|
+
return renderer || "takumi";
|
|
583
600
|
}
|
|
584
601
|
async function validateProviderSetup(renderer, compatibility) {
|
|
585
602
|
const issues = [];
|
|
@@ -1600,9 +1617,11 @@ async function extractFontFacesSimple(css) {
|
|
|
1600
1617
|
return fonts.map((font) => {
|
|
1601
1618
|
const urlSource = font.sources.find((s) => s.type === "url");
|
|
1602
1619
|
let weight;
|
|
1620
|
+
let weightRange;
|
|
1603
1621
|
if (Array.isArray(font.weight)) {
|
|
1604
1622
|
const [min, max] = font.weight;
|
|
1605
1623
|
weight = min <= 400 && max >= 400 ? 400 : min;
|
|
1624
|
+
weightRange = [min, max];
|
|
1606
1625
|
} else {
|
|
1607
1626
|
weight = font.weight;
|
|
1608
1627
|
}
|
|
@@ -1613,7 +1632,8 @@ async function extractFontFacesSimple(css) {
|
|
|
1613
1632
|
weight,
|
|
1614
1633
|
style: font.style,
|
|
1615
1634
|
unicodeRange: font.unicodeRange,
|
|
1616
|
-
isWoff2: src.endsWith(".woff2")
|
|
1635
|
+
isWoff2: src.endsWith(".woff2"),
|
|
1636
|
+
weightRange
|
|
1617
1637
|
};
|
|
1618
1638
|
}).filter((f) => f.src);
|
|
1619
1639
|
}
|
|
@@ -1723,7 +1743,8 @@ async function parseAppCssFontFaces(nuxt) {
|
|
|
1723
1743
|
return results;
|
|
1724
1744
|
}
|
|
1725
1745
|
async function parseFontsFromTemplate(nuxt, options) {
|
|
1726
|
-
const
|
|
1746
|
+
const weightsKey = options.requiredWeights?.toSorted((a, b) => a - b).join(",") || "";
|
|
1747
|
+
const cacheKey = `${options.convertedWoff2Files.size}:${[...options.convertedWoff2Files.keys()].toSorted().join(",")}:${weightsKey}`;
|
|
1727
1748
|
const cache = nuxt._ogImageParsedFontsCache ||= /* @__PURE__ */ new Map();
|
|
1728
1749
|
const cached = cache.get(cacheKey);
|
|
1729
1750
|
if (cached)
|
|
@@ -1763,6 +1784,25 @@ async function parseFontsFromTemplate(nuxt, options) {
|
|
|
1763
1784
|
expandedFonts.push({ ...template, weight });
|
|
1764
1785
|
existingKeys.add(key);
|
|
1765
1786
|
}
|
|
1787
|
+
if (options.requiredWeights && options.requiredWeights.length > 0) {
|
|
1788
|
+
const variableFonts = expandedFonts.filter((f) => f.weightRange);
|
|
1789
|
+
for (const varFont of variableFonts) {
|
|
1790
|
+
const [min, max] = varFont.weightRange;
|
|
1791
|
+
for (const w of options.requiredWeights) {
|
|
1792
|
+
if (w < min || w > max)
|
|
1793
|
+
continue;
|
|
1794
|
+
const expandKey = `${varFont.family}-${w}-${varFont.style}`;
|
|
1795
|
+
if (existingKeys.has(expandKey))
|
|
1796
|
+
continue;
|
|
1797
|
+
const templates2 = expandedFonts.filter(
|
|
1798
|
+
(f) => f.family === varFont.family && f.style === varFont.style
|
|
1799
|
+
);
|
|
1800
|
+
for (const template of templates2)
|
|
1801
|
+
expandedFonts.push({ ...template, weight: w });
|
|
1802
|
+
existingKeys.add(expandKey);
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1766
1806
|
const defaultUnicodeRange = "U+0-FF, U+131, U+152-153, U+2BB-2BC, U+2C6, U+2DA, U+2DC, U+304, U+308, U+329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD";
|
|
1767
1807
|
const result = expandedFonts.map((font) => {
|
|
1768
1808
|
const fKey = `${font.family}-${font.weight}-${font.style}`;
|
|
@@ -2088,7 +2128,7 @@ async function resolveMissingFontFamilies(options) {
|
|
|
2088
2128
|
async function resolveOgImageFonts(options) {
|
|
2089
2129
|
const { nuxt, hasNuxtFonts, hasSatoriRenderer, hasTakumiRenderer, convertedWoff2Files, fontSubsets, fontRequirements, tw4FontVars, logger, ogFontsDir } = options;
|
|
2090
2130
|
const staticInterFonts = getStaticInterFonts(ogFontsDir);
|
|
2091
|
-
const allFonts = hasNuxtFonts ? await parseFontsFromTemplate(nuxt, { convertedWoff2Files }) : [];
|
|
2131
|
+
const allFonts = hasNuxtFonts ? await parseFontsFromTemplate(nuxt, { convertedWoff2Files, requiredWeights: fontRequirements.weights }) : [];
|
|
2092
2132
|
const detectedSubsets = extractSubsetNames(allFonts);
|
|
2093
2133
|
const effectiveSubsets = detectedSubsets.length > 0 ? detectedSubsets : fontSubsets || ["latin"];
|
|
2094
2134
|
const appCssFonts = await parseAppCssFontFaces(nuxt).catch(() => []);
|
|
@@ -2128,7 +2168,7 @@ async function resolveOgImageFonts(options) {
|
|
|
2128
2168
|
}
|
|
2129
2169
|
}
|
|
2130
2170
|
const nuxtFontFamilies = new Set(
|
|
2131
|
-
hasNuxtFonts ? (await parseFontsFromTemplate(nuxt, { convertedWoff2Files })).map((f) => f.family) : []
|
|
2171
|
+
hasNuxtFonts ? (await parseFontsFromTemplate(nuxt, { convertedWoff2Files, requiredWeights: fontRequirements.weights })).map((f) => f.family) : []
|
|
2132
2172
|
);
|
|
2133
2173
|
const fonts = !fontRequirements.hasDynamicBindings ? allFonts.filter(
|
|
2134
2174
|
(f) => nuxtFontFamilies.has(f.family) ? fontRequirements.styles.includes(f.style) : matchesFontRequirements(f, fontRequirements)
|
|
@@ -3632,7 +3672,7 @@ async function onInstall(nuxt) {
|
|
|
3632
3672
|
const installedProviders2 = await getInstalledProviders();
|
|
3633
3673
|
if (installedProviders2.length === 0) {
|
|
3634
3674
|
throw new Error(
|
|
3635
|
-
"[nuxt-og-image] No OG image provider dependencies found. Install a provider before running in CI:\n npm add @resvg/resvg-js satori yoga-wasm-web # for satori\n npm add
|
|
3675
|
+
"[nuxt-og-image] No OG image provider dependencies found. Install a provider before running in CI:\n npm add @resvg/resvg-js satori yoga-wasm-web # for satori\n npm add playwright-core # for browser\nSee: https://nuxtseo.com/og-image/getting-started"
|
|
3636
3676
|
);
|
|
3637
3677
|
}
|
|
3638
3678
|
return;
|
|
@@ -4445,7 +4485,8 @@ ${familyInfo}`);
|
|
|
4445
4485
|
runtime: {
|
|
4446
4486
|
browser: false,
|
|
4447
4487
|
// should already be false
|
|
4448
|
-
satori: false
|
|
4488
|
+
satori: false,
|
|
4489
|
+
takumi: false
|
|
4449
4490
|
}
|
|
4450
4491
|
});
|
|
4451
4492
|
if (!nuxt.options.dev) {
|
|
@@ -4703,7 +4744,7 @@ ${familyInfo}`);
|
|
|
4703
4744
|
}
|
|
4704
4745
|
}
|
|
4705
4746
|
await loadSfcCompiler();
|
|
4706
|
-
nuxt.hook("components:extend", (components) => {
|
|
4747
|
+
nuxt.hook("components:extend", async (components) => {
|
|
4707
4748
|
allNuxtComponents = components;
|
|
4708
4749
|
ogImageComponentCtx.components = [];
|
|
4709
4750
|
const invalidComponents = [];
|
|
@@ -4805,7 +4846,7 @@ Run: npx nuxt-og-image migrate v6`;
|
|
|
4805
4846
|
throw new Error(message);
|
|
4806
4847
|
}
|
|
4807
4848
|
}
|
|
4808
|
-
nuxt.hooks.
|
|
4849
|
+
await nuxt.hooks.callHook("nuxt-og-image:components", ogImageComponentCtx);
|
|
4809
4850
|
});
|
|
4810
4851
|
addTemplate({
|
|
4811
4852
|
filename: "nuxt-og-image/components.mjs",
|
|
@@ -4885,7 +4926,7 @@ export const resolve = (import.meta.dev || import.meta.prerender) ? devResolve :
|
|
|
4885
4926
|
return `export default ${JSON.stringify(fonts)}`;
|
|
4886
4927
|
};
|
|
4887
4928
|
nuxt.options.nitro.virtual["#og-image/fonts-available"] = async () => {
|
|
4888
|
-
const fonts = hasNuxtFonts ? await parseFontsFromTemplate(nuxt, { convertedWoff2Files }) : [];
|
|
4929
|
+
const fonts = hasNuxtFonts ? await parseFontsFromTemplate(nuxt, { convertedWoff2Files, requiredWeights: fontRequirementsState.weights }) : [];
|
|
4889
4930
|
return `export default ${JSON.stringify(fonts)}`;
|
|
4890
4931
|
};
|
|
4891
4932
|
nuxt.options.nitro.virtual["#og-image/font-requirements"] = async () => {
|
|
@@ -166,7 +166,24 @@ const RuntimeCompatibility = {
|
|
|
166
166
|
"nitro-prerender": NodePrerenderRuntime,
|
|
167
167
|
"node-server": NodeRuntime,
|
|
168
168
|
"node-cluster": NodeRuntime,
|
|
169
|
+
"node-listener": NodeRuntime,
|
|
169
170
|
"bun": NodeRuntime,
|
|
171
|
+
"deno-server": NodeRuntime,
|
|
172
|
+
"deno-deploy": NodeRuntime,
|
|
173
|
+
// node-server extending presets
|
|
174
|
+
"alwaysdata": NodeRuntime,
|
|
175
|
+
"cleavr": NodeRuntime,
|
|
176
|
+
"digital-ocean": NodeRuntime,
|
|
177
|
+
"edgio": NodeRuntime,
|
|
178
|
+
"flight-control": NodeRuntime,
|
|
179
|
+
"heroku": NodeRuntime,
|
|
180
|
+
"iis-handler": NodeRuntime,
|
|
181
|
+
"iis-node": NodeRuntime,
|
|
182
|
+
"koyeb": NodeRuntime,
|
|
183
|
+
"platform-sh": NodeRuntime,
|
|
184
|
+
"render-com": NodeRuntime,
|
|
185
|
+
"zeabur": NodeRuntime,
|
|
186
|
+
"zerops": NodeRuntime,
|
|
170
187
|
"stackblitz": WebContainer,
|
|
171
188
|
"codesandbox": WebContainer,
|
|
172
189
|
"aws-amplify": awsLambda,
|
|
@@ -460,7 +477,7 @@ function patchWebAssemblyInstantiate(code) {
|
|
|
460
477
|
const PROVIDER_DEPENDENCIES = [
|
|
461
478
|
{
|
|
462
479
|
name: "satori",
|
|
463
|
-
description: "SVG-based renderer using Satori
|
|
480
|
+
description: "SVG-based renderer using Satori",
|
|
464
481
|
bindings: {
|
|
465
482
|
"node": [
|
|
466
483
|
{ name: "satori", description: "HTML to SVG renderer" },
|
|
@@ -478,7 +495,7 @@ const PROVIDER_DEPENDENCIES = [
|
|
|
478
495
|
},
|
|
479
496
|
{
|
|
480
497
|
name: "takumi",
|
|
481
|
-
description: "Rust-based high-performance renderer",
|
|
498
|
+
description: "Rust-based high-performance renderer (recommended)",
|
|
482
499
|
bindings: {
|
|
483
500
|
"node": [
|
|
484
501
|
{ name: "@takumi-rs/core", description: "Native Takumi renderer" }
|
|
@@ -597,9 +614,9 @@ async function promptForRendererSelection() {
|
|
|
597
614
|
const renderer = await logger_js.logger.prompt("Which renderer would you like to use?", {
|
|
598
615
|
type: "select",
|
|
599
616
|
options: PROVIDER_DEPENDENCIES.map((p) => p.name),
|
|
600
|
-
initial: "
|
|
617
|
+
initial: "takumi"
|
|
601
618
|
});
|
|
602
|
-
return renderer || "
|
|
619
|
+
return renderer || "takumi";
|
|
603
620
|
}
|
|
604
621
|
async function validateProviderSetup(renderer, compatibility) {
|
|
605
622
|
const issues = [];
|
|
@@ -1620,9 +1637,11 @@ async function extractFontFacesSimple(css) {
|
|
|
1620
1637
|
return fonts.map((font) => {
|
|
1621
1638
|
const urlSource = font.sources.find((s) => s.type === "url");
|
|
1622
1639
|
let weight;
|
|
1640
|
+
let weightRange;
|
|
1623
1641
|
if (Array.isArray(font.weight)) {
|
|
1624
1642
|
const [min, max] = font.weight;
|
|
1625
1643
|
weight = min <= 400 && max >= 400 ? 400 : min;
|
|
1644
|
+
weightRange = [min, max];
|
|
1626
1645
|
} else {
|
|
1627
1646
|
weight = font.weight;
|
|
1628
1647
|
}
|
|
@@ -1633,7 +1652,8 @@ async function extractFontFacesSimple(css) {
|
|
|
1633
1652
|
weight,
|
|
1634
1653
|
style: font.style,
|
|
1635
1654
|
unicodeRange: font.unicodeRange,
|
|
1636
|
-
isWoff2: src.endsWith(".woff2")
|
|
1655
|
+
isWoff2: src.endsWith(".woff2"),
|
|
1656
|
+
weightRange
|
|
1637
1657
|
};
|
|
1638
1658
|
}).filter((f) => f.src);
|
|
1639
1659
|
}
|
|
@@ -1743,7 +1763,8 @@ async function parseAppCssFontFaces(nuxt) {
|
|
|
1743
1763
|
return results;
|
|
1744
1764
|
}
|
|
1745
1765
|
async function parseFontsFromTemplate(nuxt, options) {
|
|
1746
|
-
const
|
|
1766
|
+
const weightsKey = options.requiredWeights?.toSorted((a, b) => a - b).join(",") || "";
|
|
1767
|
+
const cacheKey = `${options.convertedWoff2Files.size}:${[...options.convertedWoff2Files.keys()].toSorted().join(",")}:${weightsKey}`;
|
|
1747
1768
|
const cache = nuxt._ogImageParsedFontsCache ||= /* @__PURE__ */ new Map();
|
|
1748
1769
|
const cached = cache.get(cacheKey);
|
|
1749
1770
|
if (cached)
|
|
@@ -1783,6 +1804,25 @@ async function parseFontsFromTemplate(nuxt, options) {
|
|
|
1783
1804
|
expandedFonts.push({ ...template, weight });
|
|
1784
1805
|
existingKeys.add(key);
|
|
1785
1806
|
}
|
|
1807
|
+
if (options.requiredWeights && options.requiredWeights.length > 0) {
|
|
1808
|
+
const variableFonts = expandedFonts.filter((f) => f.weightRange);
|
|
1809
|
+
for (const varFont of variableFonts) {
|
|
1810
|
+
const [min, max] = varFont.weightRange;
|
|
1811
|
+
for (const w of options.requiredWeights) {
|
|
1812
|
+
if (w < min || w > max)
|
|
1813
|
+
continue;
|
|
1814
|
+
const expandKey = `${varFont.family}-${w}-${varFont.style}`;
|
|
1815
|
+
if (existingKeys.has(expandKey))
|
|
1816
|
+
continue;
|
|
1817
|
+
const templates2 = expandedFonts.filter(
|
|
1818
|
+
(f) => f.family === varFont.family && f.style === varFont.style
|
|
1819
|
+
);
|
|
1820
|
+
for (const template of templates2)
|
|
1821
|
+
expandedFonts.push({ ...template, weight: w });
|
|
1822
|
+
existingKeys.add(expandKey);
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1786
1826
|
const defaultUnicodeRange = "U+0-FF, U+131, U+152-153, U+2BB-2BC, U+2C6, U+2DA, U+2DC, U+304, U+308, U+329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD";
|
|
1787
1827
|
const result = expandedFonts.map((font) => {
|
|
1788
1828
|
const fKey = `${font.family}-${font.weight}-${font.style}`;
|
|
@@ -2108,7 +2148,7 @@ async function resolveMissingFontFamilies(options) {
|
|
|
2108
2148
|
async function resolveOgImageFonts(options) {
|
|
2109
2149
|
const { nuxt, hasNuxtFonts, hasSatoriRenderer, hasTakumiRenderer, convertedWoff2Files, fontSubsets, fontRequirements, tw4FontVars, logger, ogFontsDir } = options;
|
|
2110
2150
|
const staticInterFonts = getStaticInterFonts(ogFontsDir);
|
|
2111
|
-
const allFonts = hasNuxtFonts ? await parseFontsFromTemplate(nuxt, { convertedWoff2Files }) : [];
|
|
2151
|
+
const allFonts = hasNuxtFonts ? await parseFontsFromTemplate(nuxt, { convertedWoff2Files, requiredWeights: fontRequirements.weights }) : [];
|
|
2112
2152
|
const detectedSubsets = extractSubsetNames(allFonts);
|
|
2113
2153
|
const effectiveSubsets = detectedSubsets.length > 0 ? detectedSubsets : fontSubsets || ["latin"];
|
|
2114
2154
|
const appCssFonts = await parseAppCssFontFaces(nuxt).catch(() => []);
|
|
@@ -2148,7 +2188,7 @@ async function resolveOgImageFonts(options) {
|
|
|
2148
2188
|
}
|
|
2149
2189
|
}
|
|
2150
2190
|
const nuxtFontFamilies = new Set(
|
|
2151
|
-
hasNuxtFonts ? (await parseFontsFromTemplate(nuxt, { convertedWoff2Files })).map((f) => f.family) : []
|
|
2191
|
+
hasNuxtFonts ? (await parseFontsFromTemplate(nuxt, { convertedWoff2Files, requiredWeights: fontRequirements.weights })).map((f) => f.family) : []
|
|
2152
2192
|
);
|
|
2153
2193
|
const fonts = !fontRequirements.hasDynamicBindings ? allFonts.filter(
|
|
2154
2194
|
(f) => nuxtFontFamilies.has(f.family) ? fontRequirements.styles.includes(f.style) : matchesFontRequirements(f, fontRequirements)
|
|
@@ -3652,7 +3692,7 @@ async function onInstall(nuxt) {
|
|
|
3652
3692
|
const installedProviders2 = await getInstalledProviders();
|
|
3653
3693
|
if (installedProviders2.length === 0) {
|
|
3654
3694
|
throw new Error(
|
|
3655
|
-
"[nuxt-og-image] No OG image provider dependencies found. Install a provider before running in CI:\n npm add @resvg/resvg-js satori yoga-wasm-web # for satori\n npm add
|
|
3695
|
+
"[nuxt-og-image] No OG image provider dependencies found. Install a provider before running in CI:\n npm add @resvg/resvg-js satori yoga-wasm-web # for satori\n npm add playwright-core # for browser\nSee: https://nuxtseo.com/og-image/getting-started"
|
|
3656
3696
|
);
|
|
3657
3697
|
}
|
|
3658
3698
|
return;
|
|
@@ -4143,7 +4183,7 @@ const module$1 = kit.defineNuxtModule({
|
|
|
4143
4183
|
await onUpgrade(nuxt, options, previousVersion);
|
|
4144
4184
|
},
|
|
4145
4185
|
async setup(config, nuxt) {
|
|
4146
|
-
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.
|
|
4186
|
+
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.as-lQ2yV.cjs', document.baseURI).href)));
|
|
4147
4187
|
const fixSharedPath = (p) => {
|
|
4148
4188
|
if (p.includes("/shared/runtime/"))
|
|
4149
4189
|
return p.replace("/shared/runtime/", "/runtime/");
|
|
@@ -4465,7 +4505,8 @@ ${familyInfo}`);
|
|
|
4465
4505
|
runtime: {
|
|
4466
4506
|
browser: false,
|
|
4467
4507
|
// should already be false
|
|
4468
|
-
satori: false
|
|
4508
|
+
satori: false,
|
|
4509
|
+
takumi: false
|
|
4469
4510
|
}
|
|
4470
4511
|
});
|
|
4471
4512
|
if (!nuxt.options.dev) {
|
|
@@ -4723,7 +4764,7 @@ ${familyInfo}`);
|
|
|
4723
4764
|
}
|
|
4724
4765
|
}
|
|
4725
4766
|
await loadSfcCompiler();
|
|
4726
|
-
nuxt.hook("components:extend", (components) => {
|
|
4767
|
+
nuxt.hook("components:extend", async (components) => {
|
|
4727
4768
|
allNuxtComponents = components;
|
|
4728
4769
|
ogImageComponentCtx.components = [];
|
|
4729
4770
|
const invalidComponents = [];
|
|
@@ -4825,7 +4866,7 @@ Run: npx nuxt-og-image migrate v6`;
|
|
|
4825
4866
|
throw new Error(message);
|
|
4826
4867
|
}
|
|
4827
4868
|
}
|
|
4828
|
-
nuxt.hooks.
|
|
4869
|
+
await nuxt.hooks.callHook("nuxt-og-image:components", ogImageComponentCtx);
|
|
4829
4870
|
});
|
|
4830
4871
|
kit.addTemplate({
|
|
4831
4872
|
filename: "nuxt-og-image/components.mjs",
|
|
@@ -4905,7 +4946,7 @@ export const resolve = (import.meta.dev || import.meta.prerender) ? devResolve :
|
|
|
4905
4946
|
return `export default ${JSON.stringify(fonts)}`;
|
|
4906
4947
|
};
|
|
4907
4948
|
nuxt.options.nitro.virtual["#og-image/fonts-available"] = async () => {
|
|
4908
|
-
const fonts = hasNuxtFonts ? await parseFontsFromTemplate(nuxt, { convertedWoff2Files }) : [];
|
|
4949
|
+
const fonts = hasNuxtFonts ? await parseFontsFromTemplate(nuxt, { convertedWoff2Files, requiredWeights: fontRequirementsState.weights }) : [];
|
|
4909
4950
|
return `export default ${JSON.stringify(fonts)}`;
|
|
4910
4951
|
};
|
|
4911
4952
|
nuxt.options.nitro.virtual["#og-image/font-requirements"] = async () => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-og-image",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "6.3.
|
|
4
|
+
"version": "6.3.4",
|
|
5
5
|
"description": "Enlightened OG Image generation for Nuxt.",
|
|
6
6
|
"author": {
|
|
7
7
|
"website": "https://harlanzw.com",
|
|
@@ -94,42 +94,40 @@
|
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
|
-
"@clack/prompts": "^1.
|
|
98
|
-
"@nuxt/devtools-kit": "^3.2.4",
|
|
97
|
+
"@clack/prompts": "^1.2.0",
|
|
99
98
|
"@nuxt/kit": "^4.4.2",
|
|
100
|
-
"@vue/compiler-sfc": "^3.5.
|
|
99
|
+
"@vue/compiler-sfc": "^3.5.32",
|
|
101
100
|
"chrome-launcher": "^1.2.1",
|
|
102
101
|
"consola": "^3.4.2",
|
|
103
102
|
"culori": "^4.0.2",
|
|
104
|
-
"defu": "^6.1.
|
|
105
|
-
"devalue": "^5.
|
|
103
|
+
"defu": "^6.1.7",
|
|
104
|
+
"devalue": "^5.7.1",
|
|
106
105
|
"exsolve": "^1.0.8",
|
|
107
106
|
"lightningcss": "^1.32.0",
|
|
108
107
|
"magic-string": "^0.30.21",
|
|
109
108
|
"magicast": "^0.5.2",
|
|
110
109
|
"mocked-exports": "^0.1.1",
|
|
111
|
-
"nuxt-site-config": "^4.0.
|
|
112
|
-
"nuxtseo-
|
|
113
|
-
"nuxtseo-shared": "^5.0.2",
|
|
110
|
+
"nuxt-site-config": "^4.0.8",
|
|
111
|
+
"nuxtseo-shared": "^5.1.2",
|
|
114
112
|
"nypm": "^0.6.5",
|
|
115
113
|
"ofetch": "^1.5.1",
|
|
116
114
|
"ohash": "^2.0.11",
|
|
117
|
-
"oxc-parser": "^0.
|
|
115
|
+
"oxc-parser": "^0.124.0",
|
|
118
116
|
"oxc-walker": "^0.7.0",
|
|
119
117
|
"pathe": "^2.0.3",
|
|
120
118
|
"pkg-types": "^2.3.0",
|
|
121
119
|
"radix3": "^1.1.2",
|
|
122
|
-
"sirv": "^3.0.2",
|
|
123
120
|
"std-env": "^4.0.0",
|
|
124
121
|
"strip-literal": "^3.1.0",
|
|
125
|
-
"tinyexec": "^1.
|
|
126
|
-
"tinyglobby": "^0.2.
|
|
122
|
+
"tinyexec": "^1.1.1",
|
|
123
|
+
"tinyglobby": "^0.2.16",
|
|
127
124
|
"ufo": "^1.6.3",
|
|
128
125
|
"ultrahtml": "^1.6.0",
|
|
129
126
|
"unplugin": "^3.0.0"
|
|
130
127
|
},
|
|
131
128
|
"devDependencies": {
|
|
132
|
-
"@antfu/eslint-config": "^
|
|
129
|
+
"@antfu/eslint-config": "^8.1.1",
|
|
130
|
+
"@fontsource/noto-sans-sc": "^5.2.9",
|
|
133
131
|
"@iconify-json/carbon": "^1.2.20",
|
|
134
132
|
"@iconify-json/logos": "^1.2.11",
|
|
135
133
|
"@iconify-json/noto": "^1.2.7",
|
|
@@ -138,12 +136,13 @@
|
|
|
138
136
|
"@img/sharp-linux-x64": "^0.34.5",
|
|
139
137
|
"@nuxt/content": "^3.12.0",
|
|
140
138
|
"@nuxt/devtools": "^3.2.4",
|
|
139
|
+
"@nuxt/devtools-kit": "^3.2.4",
|
|
141
140
|
"@nuxt/fonts": "^0.14.0",
|
|
142
141
|
"@nuxt/icon": "^2.2.1",
|
|
143
142
|
"@nuxt/image": "^2.0.0",
|
|
144
143
|
"@nuxt/module-builder": "^1.0.2",
|
|
145
|
-
"@nuxt/test-utils": "^4.0.
|
|
146
|
-
"@nuxt/ui": "^4.6.
|
|
144
|
+
"@nuxt/test-utils": "^4.0.2",
|
|
145
|
+
"@nuxt/ui": "^4.6.1",
|
|
147
146
|
"@nuxtjs/color-mode": "^4.0.0",
|
|
148
147
|
"@nuxtjs/eslint-config-typescript": "^12.1.0",
|
|
149
148
|
"@nuxtjs/i18n": "^10.2.4",
|
|
@@ -155,13 +154,13 @@
|
|
|
155
154
|
"@tailwindcss/vite": "^4.2.2",
|
|
156
155
|
"@takumi-rs/core": "1.0.0-beta.13",
|
|
157
156
|
"@takumi-rs/wasm": "1.0.0-beta.13",
|
|
158
|
-
"@unocss/nuxt": "^66.6.
|
|
157
|
+
"@unocss/nuxt": "^66.6.8",
|
|
159
158
|
"@vitejs/plugin-vue": "^6.0.5",
|
|
160
159
|
"@vueuse/nuxt": "^14.2.1",
|
|
161
160
|
"birpc": "^4.0.0",
|
|
162
161
|
"bumpp": "^11.0.1",
|
|
163
|
-
"eslint": "^10.
|
|
164
|
-
"eslint-plugin-harlanzw": "^0.12.
|
|
162
|
+
"eslint": "^10.2.0",
|
|
163
|
+
"eslint-plugin-harlanzw": "^0.12.1",
|
|
165
164
|
"fontless": "^0.2.1",
|
|
166
165
|
"get-image-colors": "^4.0.1",
|
|
167
166
|
"globby": "^16.2.0",
|
|
@@ -169,18 +168,20 @@
|
|
|
169
168
|
"jest-image-snapshot": "^6.5.2",
|
|
170
169
|
"lightningcss": "^1.32.0",
|
|
171
170
|
"nuxt": "^4.4.2",
|
|
172
|
-
"
|
|
173
|
-
"playwright
|
|
174
|
-
"
|
|
171
|
+
"nuxtseo-layer-devtools": "^5.1.2",
|
|
172
|
+
"playwright": "^1.59.1",
|
|
173
|
+
"playwright-core": "^1.59.1",
|
|
174
|
+
"sass": "^1.99.0",
|
|
175
175
|
"satori": "^0.26.0",
|
|
176
176
|
"sharp": "^0.34.5",
|
|
177
|
+
"sirv": "^3.0.2",
|
|
177
178
|
"tailwindcss": "^4.2.2",
|
|
178
179
|
"typescript": "^6.0.2",
|
|
179
180
|
"unifont": "^0.7.4",
|
|
180
|
-
"unocss": "^66.6.
|
|
181
|
-
"vitest": "^4.1.
|
|
181
|
+
"unocss": "^66.6.8",
|
|
182
|
+
"vitest": "^4.1.4",
|
|
182
183
|
"vue-tsc": "^3.2.6",
|
|
183
|
-
"wrangler": "^4.
|
|
184
|
+
"wrangler": "^4.81.0",
|
|
184
185
|
"yoga-wasm-web": "^0.3.3"
|
|
185
186
|
},
|
|
186
187
|
"scripts": {
|