nuxt-og-image 5.1.9 → 5.1.10

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.
Files changed (186) hide show
  1. package/package.json +42 -47
  2. package/dist/client/200.html +0 -1
  3. package/dist/client/404.html +0 -1
  4. package/dist/client/_nuxt/B6E6ObS_.js +0 -8
  5. package/dist/client/_nuxt/B8PEiB0p.js +0 -1
  6. package/dist/client/_nuxt/C0O1sPH1.js +0 -4017
  7. package/dist/client/_nuxt/C83k_r4_.js +0 -1
  8. package/dist/client/_nuxt/CVO1_9PV.js +0 -1
  9. package/dist/client/_nuxt/Cp-IABpG.js +0 -1
  10. package/dist/client/_nuxt/D0r3Knsf.js +0 -1
  11. package/dist/client/_nuxt/DAn4LZxu.js +0 -1
  12. package/dist/client/_nuxt/builds/latest.json +0 -1
  13. package/dist/client/_nuxt/builds/meta/9c728642-f464-4f02-9cbc-65fa9d60f818.json +0 -1
  14. package/dist/client/_nuxt/entry.Hpb5KO2G.css +0 -1
  15. package/dist/client/_nuxt/error-404.D1qMyH7R.css +0 -1
  16. package/dist/client/_nuxt/error-500.C-aGJHmP.css +0 -1
  17. package/dist/client/index.html +0 -1
  18. package/dist/content.cjs +0 -22
  19. package/dist/content.d.cts +0 -52
  20. package/dist/content.d.mts +0 -52
  21. package/dist/content.d.ts +0 -52
  22. package/dist/content.mjs +0 -18
  23. package/dist/module.cjs +0 -1017
  24. package/dist/module.d.cts +0 -109
  25. package/dist/module.d.mts +0 -109
  26. package/dist/module.d.ts +0 -109
  27. package/dist/module.json +0 -12
  28. package/dist/module.mjs +0 -997
  29. package/dist/runtime/app/components/OgImage/OgImage.d.ts +0 -3
  30. package/dist/runtime/app/components/OgImage/OgImage.js +0 -10
  31. package/dist/runtime/app/components/OgImage/OgImageScreenshot.d.ts +0 -3
  32. package/dist/runtime/app/components/OgImage/OgImageScreenshot.js +0 -10
  33. package/dist/runtime/app/components/Templates/Community/BrandedLogo.vue +0 -22
  34. package/dist/runtime/app/components/Templates/Community/BrandedLogo.vue.d.ts +0 -9
  35. package/dist/runtime/app/components/Templates/Community/Frame.vue +0 -58
  36. package/dist/runtime/app/components/Templates/Community/Frame.vue.d.ts +0 -18
  37. package/dist/runtime/app/components/Templates/Community/Nuxt.vue +0 -179
  38. package/dist/runtime/app/components/Templates/Community/Nuxt.vue.d.ts +0 -7
  39. package/dist/runtime/app/components/Templates/Community/NuxtSeo.vue +0 -103
  40. package/dist/runtime/app/components/Templates/Community/NuxtSeo.vue.d.ts +0 -11
  41. package/dist/runtime/app/components/Templates/Community/Pergel.vue +0 -98
  42. package/dist/runtime/app/components/Templates/Community/Pergel.vue.d.ts +0 -7
  43. package/dist/runtime/app/components/Templates/Community/SimpleBlog.vue +0 -27
  44. package/dist/runtime/app/components/Templates/Community/SimpleBlog.vue.d.ts +0 -6
  45. package/dist/runtime/app/components/Templates/Community/UnJs.vue +0 -99
  46. package/dist/runtime/app/components/Templates/Community/UnJs.vue.d.ts +0 -13
  47. package/dist/runtime/app/components/Templates/Community/Wave.vue +0 -28
  48. package/dist/runtime/app/components/Templates/Community/Wave.vue.d.ts +0 -8
  49. package/dist/runtime/app/components/Templates/Community/WithEmoji.vue +0 -21
  50. package/dist/runtime/app/components/Templates/Community/WithEmoji.vue.d.ts +0 -9
  51. package/dist/runtime/app/composables/defineOgImage.d.ts +0 -2
  52. package/dist/runtime/app/composables/defineOgImage.js +0 -43
  53. package/dist/runtime/app/composables/defineOgImageComponent.d.ts +0 -3
  54. package/dist/runtime/app/composables/defineOgImageComponent.js +0 -8
  55. package/dist/runtime/app/composables/defineOgImageScreenshot.d.ts +0 -2
  56. package/dist/runtime/app/composables/defineOgImageScreenshot.js +0 -14
  57. package/dist/runtime/app/composables/mock.d.ts +0 -5
  58. package/dist/runtime/app/composables/mock.js +0 -20
  59. package/dist/runtime/app/plugins/__zero-runtime/og-image-canonical-urls.server.d.ts +0 -2
  60. package/dist/runtime/app/plugins/__zero-runtime/og-image-canonical-urls.server.js +0 -9
  61. package/dist/runtime/app/plugins/__zero-runtime/route-rule-og-image.server.d.ts +0 -2
  62. package/dist/runtime/app/plugins/__zero-runtime/route-rule-og-image.server.js +0 -9
  63. package/dist/runtime/app/plugins/og-image-canonical-urls.server.d.ts +0 -2
  64. package/dist/runtime/app/plugins/og-image-canonical-urls.server.js +0 -7
  65. package/dist/runtime/app/plugins/route-rule-og-image.server.d.ts +0 -2
  66. package/dist/runtime/app/plugins/route-rule-og-image.server.js +0 -7
  67. package/dist/runtime/app/utils/plugins.d.ts +0 -3
  68. package/dist/runtime/app/utils/plugins.js +0 -92
  69. package/dist/runtime/app/utils.d.ts +0 -7
  70. package/dist/runtime/app/utils.js +0 -93
  71. package/dist/runtime/assets/Inter-normal-400.ttf.base64 +0 -1
  72. package/dist/runtime/assets/Inter-normal-700.ttf.base64 +0 -1
  73. package/dist/runtime/logger.d.ts +0 -2
  74. package/dist/runtime/logger.js +0 -8
  75. package/dist/runtime/mock/empty.d.ts +0 -2
  76. package/dist/runtime/mock/empty.js +0 -2
  77. package/dist/runtime/mock/proxy-cjs.d.ts +0 -2
  78. package/dist/runtime/mock/proxy-cjs.js +0 -2
  79. package/dist/runtime/server/og-image/bindings/chromium/chrome-launcher.d.ts +0 -2
  80. package/dist/runtime/server/og-image/bindings/chromium/chrome-launcher.js +0 -9
  81. package/dist/runtime/server/og-image/bindings/chromium/on-demand.d.ts +0 -2
  82. package/dist/runtime/server/og-image/bindings/chromium/on-demand.js +0 -40
  83. package/dist/runtime/server/og-image/bindings/chromium/playwright.d.ts +0 -2
  84. package/dist/runtime/server/og-image/bindings/chromium/playwright.js +0 -6
  85. package/dist/runtime/server/og-image/bindings/css-inline/node.d.ts +0 -8
  86. package/dist/runtime/server/og-image/bindings/css-inline/node.js +0 -7
  87. package/dist/runtime/server/og-image/bindings/css-inline/wasm-fs.d.ts +0 -7
  88. package/dist/runtime/server/og-image/bindings/css-inline/wasm-fs.js +0 -8
  89. package/dist/runtime/server/og-image/bindings/css-inline/wasm.d.ts +0 -7
  90. package/dist/runtime/server/og-image/bindings/css-inline/wasm.js +0 -7
  91. package/dist/runtime/server/og-image/bindings/resvg/node.d.ts +0 -6
  92. package/dist/runtime/server/og-image/bindings/resvg/node.js +0 -5
  93. package/dist/runtime/server/og-image/bindings/resvg/wasm-fs.d.ts +0 -40
  94. package/dist/runtime/server/og-image/bindings/resvg/wasm-fs.js +0 -6
  95. package/dist/runtime/server/og-image/bindings/resvg/wasm.d.ts +0 -40
  96. package/dist/runtime/server/og-image/bindings/resvg/wasm.js +0 -5
  97. package/dist/runtime/server/og-image/bindings/satori/node.d.ts +0 -6
  98. package/dist/runtime/server/og-image/bindings/satori/node.js +0 -5
  99. package/dist/runtime/server/og-image/bindings/satori/wasm-fs.d.ts +0 -6
  100. package/dist/runtime/server/og-image/bindings/satori/wasm-fs.js +0 -13
  101. package/dist/runtime/server/og-image/bindings/satori/wasm.d.ts +0 -6
  102. package/dist/runtime/server/og-image/bindings/satori/wasm.js +0 -13
  103. package/dist/runtime/server/og-image/bindings/sharp/node.d.ts +0 -2
  104. package/dist/runtime/server/og-image/bindings/sharp/node.js +0 -2
  105. package/dist/runtime/server/og-image/cache/lru.d.ts +0 -9
  106. package/dist/runtime/server/og-image/cache/lru.js +0 -15
  107. package/dist/runtime/server/og-image/cache/mock.d.ts +0 -9
  108. package/dist/runtime/server/og-image/cache/mock.js +0 -9
  109. package/dist/runtime/server/og-image/chromium/renderer.d.ts +0 -3
  110. package/dist/runtime/server/og-image/chromium/renderer.js +0 -24
  111. package/dist/runtime/server/og-image/chromium/screenshot.d.ts +0 -4
  112. package/dist/runtime/server/og-image/chromium/screenshot.js +0 -54
  113. package/dist/runtime/server/og-image/context.d.ts +0 -5
  114. package/dist/runtime/server/og-image/context.js +0 -283
  115. package/dist/runtime/server/og-image/instances.d.ts +0 -2
  116. package/dist/runtime/server/og-image/instances.js +0 -10
  117. package/dist/runtime/server/og-image/satori/font.d.ts +0 -3
  118. package/dist/runtime/server/og-image/satori/font.js +0 -40
  119. package/dist/runtime/server/og-image/satori/instances.d.ts +0 -41
  120. package/dist/runtime/server/og-image/satori/instances.js +0 -23
  121. package/dist/runtime/server/og-image/satori/plugins/classes.d.ts +0 -2
  122. package/dist/runtime/server/og-image/satori/plugins/classes.js +0 -17
  123. package/dist/runtime/server/og-image/satori/plugins/emojis.d.ts +0 -2
  124. package/dist/runtime/server/og-image/satori/plugins/emojis.js +0 -28
  125. package/dist/runtime/server/og-image/satori/plugins/encoding.d.ts +0 -2
  126. package/dist/runtime/server/og-image/satori/plugins/encoding.js +0 -17
  127. package/dist/runtime/server/og-image/satori/plugins/flex.d.ts +0 -2
  128. package/dist/runtime/server/og-image/satori/plugins/flex.js +0 -60
  129. package/dist/runtime/server/og-image/satori/plugins/imageSrc.d.ts +0 -2
  130. package/dist/runtime/server/og-image/satori/plugins/imageSrc.js +0 -107
  131. package/dist/runtime/server/og-image/satori/plugins/nuxt-icon.d.ts +0 -2
  132. package/dist/runtime/server/og-image/satori/plugins/nuxt-icon.js +0 -20
  133. package/dist/runtime/server/og-image/satori/plugins/unocss.d.ts +0 -2
  134. package/dist/runtime/server/og-image/satori/plugins/unocss.js +0 -55
  135. package/dist/runtime/server/og-image/satori/renderer.d.ts +0 -4
  136. package/dist/runtime/server/og-image/satori/renderer.js +0 -123
  137. package/dist/runtime/server/og-image/satori/transforms/emojis.d.ts +0 -3
  138. package/dist/runtime/server/og-image/satori/transforms/emojis.js +0 -3595
  139. package/dist/runtime/server/og-image/satori/transforms/inlineCss.d.ts +0 -3
  140. package/dist/runtime/server/og-image/satori/transforms/inlineCss.js +0 -51
  141. package/dist/runtime/server/og-image/satori/utils.d.ts +0 -3
  142. package/dist/runtime/server/og-image/satori/utils.js +0 -24
  143. package/dist/runtime/server/og-image/satori/vnodes.d.ts +0 -2
  144. package/dist/runtime/server/og-image/satori/vnodes.js +0 -40
  145. package/dist/runtime/server/og-image/templates/html.d.ts +0 -2
  146. package/dist/runtime/server/og-image/templates/html.js +0 -112
  147. package/dist/runtime/server/plugins/__zero-runtime/nuxt-content-v2.d.ts +0 -2
  148. package/dist/runtime/server/plugins/__zero-runtime/nuxt-content-v2.js +0 -9
  149. package/dist/runtime/server/plugins/nuxt-content-v2.d.ts +0 -2
  150. package/dist/runtime/server/plugins/nuxt-content-v2.js +0 -5
  151. package/dist/runtime/server/plugins/prerender.d.ts +0 -2
  152. package/dist/runtime/server/plugins/prerender.js +0 -38
  153. package/dist/runtime/server/routes/__zero-runtime/font.d.ts +0 -2
  154. package/dist/runtime/server/routes/__zero-runtime/font.js +0 -8
  155. package/dist/runtime/server/routes/__zero-runtime/image.d.ts +0 -2
  156. package/dist/runtime/server/routes/__zero-runtime/image.js +0 -8
  157. package/dist/runtime/server/routes/debug.json.d.ts +0 -7
  158. package/dist/runtime/server/routes/debug.json.js +0 -15
  159. package/dist/runtime/server/routes/font.d.ts +0 -2
  160. package/dist/runtime/server/routes/font.js +0 -3
  161. package/dist/runtime/server/routes/image.d.ts +0 -2
  162. package/dist/runtime/server/routes/image.js +0 -3
  163. package/dist/runtime/server/tsconfig.json +0 -3
  164. package/dist/runtime/server/util/cache.d.ts +0 -10
  165. package/dist/runtime/server/util/cache.js +0 -74
  166. package/dist/runtime/server/util/encoding.d.ts +0 -3
  167. package/dist/runtime/server/util/encoding.js +0 -15
  168. package/dist/runtime/server/util/eventHandlers.d.ts +0 -3
  169. package/dist/runtime/server/util/eventHandlers.js +0 -156
  170. package/dist/runtime/server/util/kit.d.ts +0 -6
  171. package/dist/runtime/server/util/kit.js +0 -32
  172. package/dist/runtime/server/util/logger.d.ts +0 -1
  173. package/dist/runtime/server/util/logger.js +0 -6
  174. package/dist/runtime/server/util/options.d.ts +0 -2
  175. package/dist/runtime/server/util/options.js +0 -18
  176. package/dist/runtime/server/util/plugins.d.ts +0 -2
  177. package/dist/runtime/server/util/plugins.js +0 -56
  178. package/dist/runtime/server/util/wasm.d.ts +0 -2
  179. package/dist/runtime/server/util/wasm.js +0 -16
  180. package/dist/runtime/server/utils.d.ts +0 -4
  181. package/dist/runtime/server/utils.js +0 -20
  182. package/dist/runtime/shared.d.ts +0 -15
  183. package/dist/runtime/shared.js +0 -132
  184. package/dist/runtime/types.d.ts +0 -187
  185. package/dist/runtime/types.js +0 -0
  186. package/dist/types.d.mts +0 -9
@@ -1,20 +0,0 @@
1
- import { logger } from "../../../util/logger.js";
2
- import { defineSatoriTransformer } from "../utils.js";
3
- export default defineSatoriTransformer([
4
- // need to make sure parent div has flex for the emoji to render inline
5
- {
6
- filter: (node) => node.type === "span" && node.props?.class?.includes("iconify"),
7
- transform: (node, e) => {
8
- if (import.meta.dev) {
9
- logger.warn(`When using the Nuxt Icon components in \`${e.options.component}\` you must provide \`mode="svg"\` to ensure correct rendering.`);
10
- }
11
- }
12
- },
13
- // need to make sure parent div has flex for the emoji to render inline
14
- {
15
- filter: (node) => node.type === "svg" && node.props?.class?.includes("iconify"),
16
- transform: (node) => {
17
- node.props.class = String(node.props.class).split(" ").filter((c) => !c.startsWith("iconify")).join(" ");
18
- }
19
- }
20
- ]);
@@ -1,2 +0,0 @@
1
- declare const _default: import("../../../../types.js").SatoriTransformer | import("../../../../types.js").SatoriTransformer[];
2
- export default _default;
@@ -1,55 +0,0 @@
1
- import { defineSatoriTransformer } from "../utils.js";
2
- function safeSplit(s) {
3
- const [key, value] = s.split(":");
4
- return [String(key || "").trim(), String(value || "").trim()];
5
- }
6
- export default defineSatoriTransformer({
7
- filter: (node) => !!node.props?.class,
8
- transform: async (node, ctx) => {
9
- const classes = node.props.class || "";
10
- const styles = node.props.style || {};
11
- const replacedClasses = /* @__PURE__ */ new Set();
12
- for (const token of classes.split(" ").filter((c) => c.trim())) {
13
- const parsedToken = await ctx.unocss.parseToken(token);
14
- if (parsedToken) {
15
- const inlineStyles = String(parsedToken?.[0]?.[2]).split(";").filter((s) => !!s?.trim());
16
- const vars = {
17
- "--color-gray-50": "249 250 251",
18
- "--color-gray-100": "243 244 246",
19
- "--color-gray-200": "229 231 235",
20
- "--color-gray-300": "209 213 219",
21
- "--color-gray-400": "156 163 175",
22
- "--color-gray-500": "107 114 128",
23
- "--color-gray-600": "75 85 99",
24
- "--color-gray-700": "55 65 81",
25
- "--color-gray-800": "31 41 55",
26
- "--color-gray-900": "17 24 39",
27
- "--color-gray-950": "3 7 18"
28
- };
29
- inlineStyles.filter((s) => s.startsWith("--")).forEach((s) => {
30
- const [key, value] = safeSplit(s);
31
- vars[key] = value;
32
- });
33
- inlineStyles.filter((s) => !s.startsWith("--")).forEach((s) => {
34
- const [key, value] = safeSplit(s);
35
- const camelCasedKey = key.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
36
- if (!styles[camelCasedKey])
37
- styles[camelCasedKey] = value.replace(/var\((.*?)\)/g, (_, k) => vars[k.trim()]);
38
- if (styles[camelCasedKey] && styles[camelCasedKey].includes("/")) {
39
- const [rgb, opacity] = styles[camelCasedKey].split("/");
40
- if (rgb && opacity) {
41
- if (opacity.trim() === "1)")
42
- styles[camelCasedKey] = rgb.replace(/(\d+) (\d+) (\d+).*/, (_, r, g, b) => `${r}, ${g}, ${b})`);
43
- else
44
- styles[camelCasedKey] = `${rgb.replace("rgb", "rgba").replaceAll(" ", ", ")}${opacity.trim()}`;
45
- }
46
- }
47
- });
48
- replacedClasses.add(token);
49
- }
50
- }
51
- node.props.class = classes.split(" ").filter((c) => !replacedClasses.has(c)).join(" ");
52
- node.props.tw = classes.split(" ").filter((c) => !replacedClasses.has(c)).join(" ");
53
- node.props.style = styles;
54
- }
55
- });
@@ -1,4 +0,0 @@
1
- import type { OgImageRenderEventContext, Renderer } from '../../../types.js';
2
- export declare function createSvg(event: OgImageRenderEventContext): Promise<string | void>;
3
- declare const SatoriRenderer: Renderer;
4
- export default SatoriRenderer;
@@ -1,123 +0,0 @@
1
- import { fontCache } from "#og-image-cache";
2
- import { theme } from "#og-image-virtual/unocss-config.mjs";
3
- import compatibility from "#og-image/compatibility";
4
- import { defu } from "defu";
5
- import { sendError } from "h3";
6
- import { normaliseFontInput } from "../../../shared.js";
7
- import { useOgImageRuntimeConfig } from "../../utils.js";
8
- import { loadFont } from "./font.js";
9
- import { useResvg, useSatori, useSharp } from "./instances.js";
10
- import { createVNodes } from "./vnodes.js";
11
- const fontPromises = {};
12
- async function resolveFonts(event) {
13
- const { fonts } = useOgImageRuntimeConfig();
14
- const normalisedFonts = normaliseFontInput([...event.options.fonts || [], ...fonts]);
15
- const localFontPromises = [];
16
- const preloadedFonts = [];
17
- if (fontCache) {
18
- for (const font of normalisedFonts) {
19
- if (await fontCache.hasItem(font.cacheKey)) {
20
- font.data = await fontCache.getItemRaw(font.cacheKey) || void 0;
21
- preloadedFonts.push(font);
22
- } else {
23
- if (!fontPromises[font.cacheKey]) {
24
- fontPromises[font.cacheKey] = loadFont(event, font).then(async (_font) => {
25
- if (_font?.data)
26
- await fontCache?.setItemRaw(_font.cacheKey, _font.data);
27
- return _font;
28
- });
29
- }
30
- localFontPromises.push(fontPromises[font.cacheKey]);
31
- }
32
- }
33
- }
34
- const awaitedFonts = await Promise.all(localFontPromises);
35
- return [...preloadedFonts, ...awaitedFonts].map((_f) => {
36
- return { name: _f.name, data: _f.data, style: _f.style, weight: Number(_f.weight) };
37
- });
38
- }
39
- export async function createSvg(event) {
40
- const { options } = event;
41
- const { satoriOptions: _satoriOptions } = useOgImageRuntimeConfig();
42
- const [satori, vnodes, fonts] = await Promise.all([
43
- useSatori(),
44
- createVNodes(event),
45
- resolveFonts(event)
46
- ]);
47
- await event._nitro.hooks.callHook("nuxt-og-image:satori:vnodes", vnodes, event);
48
- const satoriOptions = defu(options.satori, _satoriOptions, {
49
- fonts,
50
- tailwindConfig: { theme },
51
- embedFont: true,
52
- width: options.width,
53
- height: options.height
54
- });
55
- return satori(vnodes, satoriOptions).catch((err) => {
56
- return sendError(event.e, err, import.meta.dev);
57
- });
58
- }
59
- async function createPng(event) {
60
- const { resvgOptions } = useOgImageRuntimeConfig();
61
- const svg = await createSvg(event);
62
- if (!svg)
63
- throw new Error("Failed to create SVG");
64
- const Resvg = await useResvg();
65
- const resvg = new Resvg(svg, defu(
66
- event.options.resvg,
67
- resvgOptions
68
- ));
69
- const pngData = resvg.render();
70
- return pngData.asPng();
71
- }
72
- async function createJpeg(event) {
73
- const { sharpOptions } = useOgImageRuntimeConfig();
74
- if (compatibility.sharp === false) {
75
- if (import.meta.dev) {
76
- throw new Error("Sharp dependency is not accessible. Please check you have it installed and are using a compatible runtime.");
77
- } else {
78
- console.error("Sharp dependency is not accessible. Please check you have it installed and are using a compatible runtime. Falling back to png.");
79
- }
80
- return createPng(event);
81
- }
82
- const svg = await createSvg(event);
83
- if (!svg) {
84
- throw new Error("Failed to create SVG for JPEG rendering.");
85
- }
86
- const svgBuffer = Buffer.from(svg);
87
- const sharp = await useSharp().catch(() => {
88
- if (import.meta.dev) {
89
- throw new Error("Sharp dependency could not be loaded. Please check you have it installed and are using a compatible runtime.");
90
- }
91
- return null;
92
- });
93
- if (!sharp) {
94
- console.error("Sharp dependency is not accessible. Please check you have it installed and are using a compatible runtime. Falling back to png.");
95
- return createPng(event);
96
- }
97
- const options = defu(event.options.sharp, sharpOptions);
98
- return sharp(svgBuffer, options).jpeg(options).toBuffer();
99
- }
100
- const SatoriRenderer = {
101
- name: "satori",
102
- supportedFormats: ["png", "jpeg", "jpg", "json"],
103
- async createImage(e) {
104
- switch (e.extension) {
105
- case "png":
106
- return createPng(e);
107
- case "jpeg":
108
- case "jpg":
109
- return createJpeg(e);
110
- }
111
- },
112
- async debug(e) {
113
- const [vnodes, svg] = await Promise.all([
114
- createVNodes(e),
115
- createSvg(e)
116
- ]);
117
- return {
118
- vnodes,
119
- svg
120
- };
121
- }
122
- };
123
- export default SatoriRenderer;
@@ -1,3 +0,0 @@
1
- import type { NuxtIslandResponse } from 'nuxt/app';
2
- import type { OgImageRenderEventContext } from '../../../../types.js';
3
- export declare function applyEmojis(ctx: OgImageRenderEventContext, island: NuxtIslandResponse): Promise<string | boolean>;