nuxt-og-image 5.1.10 → 5.1.11

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 (195) hide show
  1. package/dist/client/200.html +1 -0
  2. package/dist/client/404.html +1 -0
  3. package/dist/client/_nuxt/B8PEiB0p.js +1 -0
  4. package/dist/client/_nuxt/CVO1_9PV.js +1 -0
  5. package/dist/client/_nuxt/Cp-IABpG.js +1 -0
  6. package/dist/client/_nuxt/CvR-yWOW.js +4062 -0
  7. package/dist/client/_nuxt/D0r3Knsf.js +1 -0
  8. package/dist/client/_nuxt/DEnNbrAc.js +1 -0
  9. package/dist/client/_nuxt/DeGaHs8e.js +1 -0
  10. package/dist/client/_nuxt/builds/latest.json +1 -0
  11. package/dist/client/_nuxt/builds/meta/fc37de2c-ce5a-4687-b9b5-2020cf8f035c.json +1 -0
  12. package/dist/client/_nuxt/entry.DykVEqUW.css +1 -0
  13. package/dist/client/_nuxt/error-404.C93MUFlo.css +1 -0
  14. package/dist/client/_nuxt/error-500.D-IxLaDc.css +1 -0
  15. package/dist/client/_nuxt/l5rcX3cq.js +8 -0
  16. package/dist/client/index.html +1 -0
  17. package/dist/content.cjs +22 -0
  18. package/dist/content.d.cts +46 -0
  19. package/dist/content.d.mts +46 -0
  20. package/dist/content.d.ts +46 -0
  21. package/dist/content.mjs +18 -0
  22. package/dist/module.cjs +1018 -0
  23. package/dist/module.d.cts +109 -0
  24. package/dist/module.d.mts +109 -0
  25. package/dist/module.d.ts +109 -0
  26. package/dist/module.json +12 -0
  27. package/dist/module.mjs +998 -0
  28. package/dist/runtime/app/components/OgImage/OgImage.d.ts +3 -0
  29. package/dist/runtime/app/components/OgImage/OgImage.js +10 -0
  30. package/dist/runtime/app/components/OgImage/OgImageScreenshot.d.ts +3 -0
  31. package/dist/runtime/app/components/OgImage/OgImageScreenshot.js +10 -0
  32. package/dist/runtime/app/components/Templates/Community/BrandedLogo.d.vue.ts +12 -0
  33. package/dist/runtime/app/components/Templates/Community/BrandedLogo.vue +22 -0
  34. package/dist/runtime/app/components/Templates/Community/BrandedLogo.vue.d.ts +12 -0
  35. package/dist/runtime/app/components/Templates/Community/Frame.d.vue.ts +20 -0
  36. package/dist/runtime/app/components/Templates/Community/Frame.vue +58 -0
  37. package/dist/runtime/app/components/Templates/Community/Frame.vue.d.ts +20 -0
  38. package/dist/runtime/app/components/Templates/Community/Nuxt.d.vue.ts +11 -0
  39. package/dist/runtime/app/components/Templates/Community/Nuxt.vue +179 -0
  40. package/dist/runtime/app/components/Templates/Community/Nuxt.vue.d.ts +11 -0
  41. package/dist/runtime/app/components/Templates/Community/NuxtSeo.d.vue.ts +14 -0
  42. package/dist/runtime/app/components/Templates/Community/NuxtSeo.vue +103 -0
  43. package/dist/runtime/app/components/Templates/Community/NuxtSeo.vue.d.ts +14 -0
  44. package/dist/runtime/app/components/Templates/Community/Pergel.d.vue.ts +11 -0
  45. package/dist/runtime/app/components/Templates/Community/Pergel.vue +98 -0
  46. package/dist/runtime/app/components/Templates/Community/Pergel.vue.d.ts +11 -0
  47. package/dist/runtime/app/components/Templates/Community/SimpleBlog.d.vue.ts +8 -0
  48. package/dist/runtime/app/components/Templates/Community/SimpleBlog.vue +27 -0
  49. package/dist/runtime/app/components/Templates/Community/SimpleBlog.vue.d.ts +8 -0
  50. package/dist/runtime/app/components/Templates/Community/UnJs.d.vue.ts +20 -0
  51. package/dist/runtime/app/components/Templates/Community/UnJs.vue +99 -0
  52. package/dist/runtime/app/components/Templates/Community/UnJs.vue.d.ts +20 -0
  53. package/dist/runtime/app/components/Templates/Community/Wave.d.vue.ts +10 -0
  54. package/dist/runtime/app/components/Templates/Community/Wave.vue +28 -0
  55. package/dist/runtime/app/components/Templates/Community/Wave.vue.d.ts +10 -0
  56. package/dist/runtime/app/components/Templates/Community/WithEmoji.d.vue.ts +12 -0
  57. package/dist/runtime/app/components/Templates/Community/WithEmoji.vue +21 -0
  58. package/dist/runtime/app/components/Templates/Community/WithEmoji.vue.d.ts +12 -0
  59. package/dist/runtime/app/composables/defineOgImage.d.ts +2 -0
  60. package/dist/runtime/app/composables/defineOgImage.js +43 -0
  61. package/dist/runtime/app/composables/defineOgImageComponent.d.ts +3 -0
  62. package/dist/runtime/app/composables/defineOgImageComponent.js +8 -0
  63. package/dist/runtime/app/composables/defineOgImageScreenshot.d.ts +2 -0
  64. package/dist/runtime/app/composables/defineOgImageScreenshot.js +14 -0
  65. package/dist/runtime/app/composables/mock.d.ts +5 -0
  66. package/dist/runtime/app/composables/mock.js +20 -0
  67. package/dist/runtime/app/plugins/__zero-runtime/og-image-canonical-urls.server.d.ts +2 -0
  68. package/dist/runtime/app/plugins/__zero-runtime/og-image-canonical-urls.server.js +9 -0
  69. package/dist/runtime/app/plugins/__zero-runtime/route-rule-og-image.server.d.ts +2 -0
  70. package/dist/runtime/app/plugins/__zero-runtime/route-rule-og-image.server.js +9 -0
  71. package/dist/runtime/app/plugins/og-image-canonical-urls.server.d.ts +2 -0
  72. package/dist/runtime/app/plugins/og-image-canonical-urls.server.js +7 -0
  73. package/dist/runtime/app/plugins/route-rule-og-image.server.d.ts +2 -0
  74. package/dist/runtime/app/plugins/route-rule-og-image.server.js +7 -0
  75. package/dist/runtime/app/utils/plugins.d.ts +3 -0
  76. package/dist/runtime/app/utils/plugins.js +92 -0
  77. package/dist/runtime/app/utils.d.ts +7 -0
  78. package/dist/runtime/app/utils.js +94 -0
  79. package/dist/runtime/assets/Inter-normal-400.ttf.base64 +1 -0
  80. package/dist/runtime/assets/Inter-normal-700.ttf.base64 +1 -0
  81. package/dist/runtime/logger.d.ts +2 -0
  82. package/dist/runtime/logger.js +8 -0
  83. package/dist/runtime/mock/empty.d.ts +2 -0
  84. package/dist/runtime/mock/empty.js +2 -0
  85. package/dist/runtime/mock/proxy-cjs.d.ts +2 -0
  86. package/dist/runtime/mock/proxy-cjs.js +2 -0
  87. package/dist/runtime/server/og-image/bindings/chromium/chrome-launcher.d.ts +2 -0
  88. package/dist/runtime/server/og-image/bindings/chromium/chrome-launcher.js +9 -0
  89. package/dist/runtime/server/og-image/bindings/chromium/on-demand.d.ts +2 -0
  90. package/dist/runtime/server/og-image/bindings/chromium/on-demand.js +40 -0
  91. package/dist/runtime/server/og-image/bindings/chromium/playwright.d.ts +2 -0
  92. package/dist/runtime/server/og-image/bindings/chromium/playwright.js +6 -0
  93. package/dist/runtime/server/og-image/bindings/css-inline/node.d.ts +8 -0
  94. package/dist/runtime/server/og-image/bindings/css-inline/node.js +7 -0
  95. package/dist/runtime/server/og-image/bindings/css-inline/wasm-fs.d.ts +7 -0
  96. package/dist/runtime/server/og-image/bindings/css-inline/wasm-fs.js +8 -0
  97. package/dist/runtime/server/og-image/bindings/css-inline/wasm.d.ts +7 -0
  98. package/dist/runtime/server/og-image/bindings/css-inline/wasm.js +7 -0
  99. package/dist/runtime/server/og-image/bindings/resvg/node.d.ts +6 -0
  100. package/dist/runtime/server/og-image/bindings/resvg/node.js +5 -0
  101. package/dist/runtime/server/og-image/bindings/resvg/wasm-fs.d.ts +40 -0
  102. package/dist/runtime/server/og-image/bindings/resvg/wasm-fs.js +6 -0
  103. package/dist/runtime/server/og-image/bindings/resvg/wasm.d.ts +40 -0
  104. package/dist/runtime/server/og-image/bindings/resvg/wasm.js +5 -0
  105. package/dist/runtime/server/og-image/bindings/satori/node.d.ts +6 -0
  106. package/dist/runtime/server/og-image/bindings/satori/node.js +5 -0
  107. package/dist/runtime/server/og-image/bindings/satori/wasm-fs.d.ts +6 -0
  108. package/dist/runtime/server/og-image/bindings/satori/wasm-fs.js +13 -0
  109. package/dist/runtime/server/og-image/bindings/satori/wasm.d.ts +6 -0
  110. package/dist/runtime/server/og-image/bindings/satori/wasm.js +13 -0
  111. package/dist/runtime/server/og-image/bindings/sharp/node.d.ts +2 -0
  112. package/dist/runtime/server/og-image/bindings/sharp/node.js +2 -0
  113. package/dist/runtime/server/og-image/cache/lru.d.ts +9 -0
  114. package/dist/runtime/server/og-image/cache/lru.js +15 -0
  115. package/dist/runtime/server/og-image/cache/mock.d.ts +9 -0
  116. package/dist/runtime/server/og-image/cache/mock.js +9 -0
  117. package/dist/runtime/server/og-image/chromium/renderer.d.ts +3 -0
  118. package/dist/runtime/server/og-image/chromium/renderer.js +24 -0
  119. package/dist/runtime/server/og-image/chromium/screenshot.d.ts +4 -0
  120. package/dist/runtime/server/og-image/chromium/screenshot.js +54 -0
  121. package/dist/runtime/server/og-image/context.d.ts +5 -0
  122. package/dist/runtime/server/og-image/context.js +283 -0
  123. package/dist/runtime/server/og-image/instances.d.ts +2 -0
  124. package/dist/runtime/server/og-image/instances.js +10 -0
  125. package/dist/runtime/server/og-image/satori/font.d.ts +3 -0
  126. package/dist/runtime/server/og-image/satori/font.js +40 -0
  127. package/dist/runtime/server/og-image/satori/instances.d.ts +41 -0
  128. package/dist/runtime/server/og-image/satori/instances.js +23 -0
  129. package/dist/runtime/server/og-image/satori/plugins/classes.d.ts +2 -0
  130. package/dist/runtime/server/og-image/satori/plugins/classes.js +17 -0
  131. package/dist/runtime/server/og-image/satori/plugins/emojis.d.ts +2 -0
  132. package/dist/runtime/server/og-image/satori/plugins/emojis.js +28 -0
  133. package/dist/runtime/server/og-image/satori/plugins/encoding.d.ts +2 -0
  134. package/dist/runtime/server/og-image/satori/plugins/encoding.js +17 -0
  135. package/dist/runtime/server/og-image/satori/plugins/flex.d.ts +2 -0
  136. package/dist/runtime/server/og-image/satori/plugins/flex.js +60 -0
  137. package/dist/runtime/server/og-image/satori/plugins/imageSrc.d.ts +2 -0
  138. package/dist/runtime/server/og-image/satori/plugins/imageSrc.js +107 -0
  139. package/dist/runtime/server/og-image/satori/plugins/nuxt-icon.d.ts +2 -0
  140. package/dist/runtime/server/og-image/satori/plugins/nuxt-icon.js +20 -0
  141. package/dist/runtime/server/og-image/satori/plugins/unocss.d.ts +2 -0
  142. package/dist/runtime/server/og-image/satori/plugins/unocss.js +55 -0
  143. package/dist/runtime/server/og-image/satori/renderer.d.ts +4 -0
  144. package/dist/runtime/server/og-image/satori/renderer.js +123 -0
  145. package/dist/runtime/server/og-image/satori/transforms/emojis.d.ts +3 -0
  146. package/dist/runtime/server/og-image/satori/transforms/emojis.js +3595 -0
  147. package/dist/runtime/server/og-image/satori/transforms/inlineCss.d.ts +3 -0
  148. package/dist/runtime/server/og-image/satori/transforms/inlineCss.js +51 -0
  149. package/dist/runtime/server/og-image/satori/utils.d.ts +3 -0
  150. package/dist/runtime/server/og-image/satori/utils.js +24 -0
  151. package/dist/runtime/server/og-image/satori/vnodes.d.ts +2 -0
  152. package/dist/runtime/server/og-image/satori/vnodes.js +40 -0
  153. package/dist/runtime/server/og-image/templates/html.d.ts +2 -0
  154. package/dist/runtime/server/og-image/templates/html.js +112 -0
  155. package/dist/runtime/server/plugins/__zero-runtime/nuxt-content-v2.d.ts +2 -0
  156. package/dist/runtime/server/plugins/__zero-runtime/nuxt-content-v2.js +9 -0
  157. package/dist/runtime/server/plugins/nuxt-content-v2.d.ts +2 -0
  158. package/dist/runtime/server/plugins/nuxt-content-v2.js +5 -0
  159. package/dist/runtime/server/plugins/prerender.d.ts +2 -0
  160. package/dist/runtime/server/plugins/prerender.js +38 -0
  161. package/dist/runtime/server/routes/__zero-runtime/font.d.ts +2 -0
  162. package/dist/runtime/server/routes/__zero-runtime/font.js +8 -0
  163. package/dist/runtime/server/routes/__zero-runtime/image.d.ts +2 -0
  164. package/dist/runtime/server/routes/__zero-runtime/image.js +8 -0
  165. package/dist/runtime/server/routes/debug.json.d.ts +7 -0
  166. package/dist/runtime/server/routes/debug.json.js +15 -0
  167. package/dist/runtime/server/routes/font.d.ts +2 -0
  168. package/dist/runtime/server/routes/font.js +3 -0
  169. package/dist/runtime/server/routes/image.d.ts +2 -0
  170. package/dist/runtime/server/routes/image.js +3 -0
  171. package/dist/runtime/server/tsconfig.json +3 -0
  172. package/dist/runtime/server/util/cache.d.ts +10 -0
  173. package/dist/runtime/server/util/cache.js +74 -0
  174. package/dist/runtime/server/util/encoding.d.ts +3 -0
  175. package/dist/runtime/server/util/encoding.js +15 -0
  176. package/dist/runtime/server/util/eventHandlers.d.ts +3 -0
  177. package/dist/runtime/server/util/eventHandlers.js +156 -0
  178. package/dist/runtime/server/util/kit.d.ts +6 -0
  179. package/dist/runtime/server/util/kit.js +32 -0
  180. package/dist/runtime/server/util/logger.d.ts +1 -0
  181. package/dist/runtime/server/util/logger.js +6 -0
  182. package/dist/runtime/server/util/options.d.ts +2 -0
  183. package/dist/runtime/server/util/options.js +18 -0
  184. package/dist/runtime/server/util/plugins.d.ts +2 -0
  185. package/dist/runtime/server/util/plugins.js +56 -0
  186. package/dist/runtime/server/util/wasm.d.ts +2 -0
  187. package/dist/runtime/server/util/wasm.js +16 -0
  188. package/dist/runtime/server/utils.d.ts +4 -0
  189. package/dist/runtime/server/utils.js +20 -0
  190. package/dist/runtime/shared.d.ts +15 -0
  191. package/dist/runtime/shared.js +132 -0
  192. package/dist/runtime/types.d.ts +187 -0
  193. package/dist/runtime/types.js +0 -0
  194. package/dist/types.d.mts +9 -0
  195. package/package.json +1 -1
@@ -0,0 +1,2 @@
1
+ export declare const logger: import("consola").ConsolaInstance;
2
+ export declare const gray: (s: string) => string;
@@ -0,0 +1,8 @@
1
+ import { createConsola } from "consola";
2
+ import { colorize } from "consola/utils";
3
+ export const logger = createConsola({
4
+ defaults: {
5
+ tag: "@nuxtjs/og-image"
6
+ }
7
+ });
8
+ export const gray = (s) => colorize("gray", s);
@@ -0,0 +1,2 @@
1
+ import empty from 'mocked-exports/empty';
2
+ export default empty;
@@ -0,0 +1,2 @@
1
+ import empty from "mocked-exports/empty";
2
+ export default empty;
@@ -0,0 +1,2 @@
1
+ import proxy from 'mocked-exports/proxy-cjs';
2
+ export default proxy;
@@ -0,0 +1,2 @@
1
+ import proxy from "mocked-exports/proxy-cjs";
2
+ export default proxy;
@@ -0,0 +1,2 @@
1
+ import type { Browser } from 'playwright-core';
2
+ export declare function createBrowser(): Promise<Browser | void>;
@@ -0,0 +1,9 @@
1
+ import { Launcher } from "chrome-launcher";
2
+ import playwrightCore from "playwright-core";
3
+ const chromePath = Launcher.getFirstInstallation();
4
+ export async function createBrowser() {
5
+ return playwrightCore.chromium.launch({
6
+ headless: true,
7
+ executablePath: chromePath
8
+ });
9
+ }
@@ -0,0 +1,2 @@
1
+ import type { Browser } from 'playwright-core';
2
+ export declare function createBrowser(): Promise<Browser | void>;
@@ -0,0 +1,40 @@
1
+ import { createConsola } from "consola";
2
+ import { execa } from "execa";
3
+ import playwrightCore from "playwright-core";
4
+ let installedChromium = false;
5
+ let installChromiumPromise;
6
+ export async function createBrowser() {
7
+ if (installChromiumPromise)
8
+ await installChromiumPromise;
9
+ if (!installedChromium) {
10
+ installChromiumPromise = new Promise((_resolve) => {
11
+ const logger = createConsola().withTag("Nuxt OG Image");
12
+ logger.info("Installing Chromium install for og:image generation...");
13
+ const installChromeProcess = execa("npx", ["playwright", "install", "chromium"], {
14
+ stdio: "pipe"
15
+ });
16
+ if (installChromeProcess.stderr) {
17
+ installChromeProcess.stderr.pipe(process.stderr);
18
+ }
19
+ if (installChromeProcess.stdout) {
20
+ installChromeProcess.stdout.pipe(process.stdout);
21
+ }
22
+ new Promise((resolve) => {
23
+ installChromeProcess.on("exit", (e) => {
24
+ if (e !== 0)
25
+ logger.error("Failed to install Playwright dependency for og:image generation. Trying anyway...");
26
+ resolve();
27
+ });
28
+ }).then(() => {
29
+ installChromeProcess.kill();
30
+ logger.info("Installed Chromium install for og:image generation.");
31
+ _resolve();
32
+ });
33
+ }).then(() => {
34
+ installedChromium = true;
35
+ });
36
+ }
37
+ return await playwrightCore.chromium.launch({
38
+ headless: true
39
+ });
40
+ }
@@ -0,0 +1,2 @@
1
+ import type { Browser } from 'playwright-core';
2
+ export declare function createBrowser(): Promise<Browser | void>;
@@ -0,0 +1,6 @@
1
+ import playwright from "playwright";
2
+ export async function createBrowser() {
3
+ return await playwright.chromium.launch({
4
+ headless: true
5
+ });
6
+ }
@@ -0,0 +1,8 @@
1
+ import { inline } from '@css-inline/css-inline';
2
+ declare const _default: {
3
+ initWasmPromise: Promise<void>;
4
+ cssInline: {
5
+ inline: typeof inline;
6
+ };
7
+ };
8
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import { inline } from "@css-inline/css-inline";
2
+ export default {
3
+ initWasmPromise: Promise.resolve(),
4
+ cssInline: {
5
+ inline
6
+ }
7
+ };
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ initWasmPromise: any;
3
+ cssInline: {
4
+ inline: any;
5
+ };
6
+ };
7
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import { initWasm, inline } from "@css-inline/css-inline-wasm";
2
+ import { readWasmFile } from "../../../util/wasm.js";
3
+ export default {
4
+ initWasmPromise: initWasm(readWasmFile("@css-inline/css-inline-wasm/index_bg.wasm")),
5
+ cssInline: {
6
+ inline
7
+ }
8
+ };
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ initWasmPromise: any;
3
+ cssInline: {
4
+ inline: any;
5
+ };
6
+ };
7
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import { initWasm, inline } from "@css-inline/css-inline-wasm";
2
+ export default {
3
+ initWasmPromise: initWasm(import("@css-inline/css-inline-wasm/index_bg.wasm?module").then((r) => r.default || r)),
4
+ cssInline: {
5
+ inline
6
+ }
7
+ };
@@ -0,0 +1,6 @@
1
+ import { Resvg as _Resvg } from '@resvg/resvg-js';
2
+ declare const _default: {
3
+ initWasmPromise: Promise<void>;
4
+ Resvg: typeof _Resvg;
5
+ };
6
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { Resvg as _Resvg } from "@resvg/resvg-js";
2
+ export default {
3
+ initWasmPromise: Promise.resolve(),
4
+ Resvg: _Resvg
5
+ };
@@ -0,0 +1,40 @@
1
+ declare const _default: {
2
+ initWasmPromise: Promise<void>;
3
+ Resvg: new (svg: Uint8Array | string, options?: import("@resvg/resvg-wasm").ResvgRenderOptions) => {
4
+ free(): void;
5
+ render(): {
6
+ free(): void;
7
+ asPng(): Uint8Array;
8
+ readonly height: number;
9
+ readonly pixels: Uint8Array;
10
+ readonly width: number;
11
+ };
12
+ toString(): string;
13
+ innerBBox(): {
14
+ free(): void;
15
+ height: number;
16
+ width: number;
17
+ x: number;
18
+ y: number;
19
+ } | undefined;
20
+ getBBox(): {
21
+ free(): void;
22
+ height: number;
23
+ width: number;
24
+ x: number;
25
+ y: number;
26
+ } | undefined;
27
+ cropByBBox(bbox: {
28
+ free(): void;
29
+ height: number;
30
+ width: number;
31
+ x: number;
32
+ y: number;
33
+ }): void;
34
+ imagesToResolve(): any[];
35
+ resolveImage(href: string, buffer: Uint8Array): void;
36
+ readonly height: number;
37
+ readonly width: number;
38
+ };
39
+ };
40
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { Resvg as _Resvg, initWasm } from "@resvg/resvg-wasm";
2
+ import { readWasmFile } from "../../../util/wasm.js";
3
+ export default {
4
+ initWasmPromise: initWasm(readWasmFile("@resvg/resvg-wasm/index_bg.wasm")),
5
+ Resvg: _Resvg
6
+ };
@@ -0,0 +1,40 @@
1
+ declare const _default: {
2
+ initWasmPromise: Promise<void>;
3
+ Resvg: new (svg: Uint8Array | string, options?: import("@resvg/resvg-wasm").ResvgRenderOptions) => {
4
+ free(): void;
5
+ render(): {
6
+ free(): void;
7
+ asPng(): Uint8Array;
8
+ readonly height: number;
9
+ readonly pixels: Uint8Array;
10
+ readonly width: number;
11
+ };
12
+ toString(): string;
13
+ innerBBox(): {
14
+ free(): void;
15
+ height: number;
16
+ width: number;
17
+ x: number;
18
+ y: number;
19
+ } | undefined;
20
+ getBBox(): {
21
+ free(): void;
22
+ height: number;
23
+ width: number;
24
+ x: number;
25
+ y: number;
26
+ } | undefined;
27
+ cropByBBox(bbox: {
28
+ free(): void;
29
+ height: number;
30
+ width: number;
31
+ x: number;
32
+ y: number;
33
+ }): void;
34
+ imagesToResolve(): any[];
35
+ resolveImage(href: string, buffer: Uint8Array): void;
36
+ readonly height: number;
37
+ readonly width: number;
38
+ };
39
+ };
40
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { Resvg as _Resvg, initWasm } from "@resvg/resvg-wasm";
2
+ export default {
3
+ initWasmPromise: initWasm(import("@resvg/resvg-wasm/index_bg.wasm?module").then((r) => r.default || r)),
4
+ Resvg: _Resvg
5
+ };
@@ -0,0 +1,6 @@
1
+ import _satori from 'satori';
2
+ declare const _default: {
3
+ initWasmPromise: Promise<void>;
4
+ satori: typeof _satori;
5
+ };
6
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import _satori from "satori";
2
+ export default {
3
+ initWasmPromise: Promise.resolve(),
4
+ satori: _satori
5
+ };
@@ -0,0 +1,6 @@
1
+ import _satori from 'satori/wasm';
2
+ declare const _default: {
3
+ initWasmPromise: Promise<void>;
4
+ satori: typeof _satori;
5
+ };
6
+ export default _default;
@@ -0,0 +1,13 @@
1
+ import _satori, { init } from "satori/wasm";
2
+ import initYoga from "yoga-wasm-web";
3
+ import { readWasmFile } from "../../../util/wasm.js";
4
+ const wasm = readWasmFile("yoga-wasm-web/dist/yoga.wasm").then(async (yoga) => await initYoga(yoga));
5
+ export default {
6
+ initWasmPromise: new Promise((resolve) => {
7
+ wasm.then((yoga) => {
8
+ init(yoga);
9
+ resolve();
10
+ });
11
+ }),
12
+ satori: _satori
13
+ };
@@ -0,0 +1,6 @@
1
+ import _satori from 'satori/wasm';
2
+ declare const _default: {
3
+ initWasmPromise: Promise<void>;
4
+ satori: typeof _satori;
5
+ };
6
+ export default _default;
@@ -0,0 +1,13 @@
1
+ import { init } from "satori";
2
+ import _satori from "satori/wasm";
3
+ import initYoga from "yoga-wasm-web";
4
+ const wasm = import("yoga-wasm-web/dist/yoga.wasm?module").then(async (yoga) => await initYoga(yoga.default || yoga));
5
+ export default {
6
+ initWasmPromise: new Promise((resolve) => {
7
+ wasm.then((yoga) => {
8
+ init(yoga);
9
+ resolve();
10
+ });
11
+ }),
12
+ satori: _satori
13
+ };
@@ -0,0 +1,2 @@
1
+ import sharp from 'sharp';
2
+ export default sharp;
@@ -0,0 +1,2 @@
1
+ import sharp from "sharp";
2
+ export default sharp;
@@ -0,0 +1,9 @@
1
+ import type { Storage } from 'unstorage';
2
+ import type { OgImageOptions } from '../../../types.js';
3
+ export declare const htmlPayloadCache: Storage<{
4
+ expiresAt: number;
5
+ value: OgImageOptions;
6
+ }>;
7
+ export declare const prerenderOptionsCache: Storage<OgImageOptions> | undefined;
8
+ export declare const fontCache: Storage<BufferSource>;
9
+ export declare const emojiCache: Storage<string>;
@@ -0,0 +1,15 @@
1
+ import { createStorage } from "unstorage";
2
+ import lruCacheDriver from "unstorage/drivers/lru-cache";
3
+ export const htmlPayloadCache = createStorage({
4
+ // short cache time so we don't need many entries at runtime
5
+ driver: lruCacheDriver({ max: import.meta.prerender ? 1e4 : 50 })
6
+ });
7
+ export const prerenderOptionsCache = import.meta.prerender ? createStorage({
8
+ driver: lruCacheDriver({ max: 1e4 })
9
+ }) : void 0;
10
+ export const fontCache = createStorage({
11
+ driver: lruCacheDriver({ max: 10 })
12
+ });
13
+ export const emojiCache = createStorage({
14
+ driver: lruCacheDriver({ max: 1e3 })
15
+ });
@@ -0,0 +1,9 @@
1
+ import type { Storage } from 'unstorage';
2
+ import type { OgImageOptions } from '../../../types.js';
3
+ export declare const htmlPayloadCache: Storage<{
4
+ expiresAt: number;
5
+ value: OgImageOptions;
6
+ }>;
7
+ export declare const prerenderOptionsCache: Storage<OgImageOptions> | undefined;
8
+ export declare const fontCache: Storage<OgImageOptions<"NuxtSeo">>;
9
+ export declare const emojiCache: Storage<string>;
@@ -0,0 +1,9 @@
1
+ import { createStorage } from "unstorage";
2
+ import memoryDriver from "unstorage/drivers/memory";
3
+ const storage = createStorage({
4
+ driver: memoryDriver()
5
+ });
6
+ export const htmlPayloadCache = storage;
7
+ export const prerenderOptionsCache = storage;
8
+ export const fontCache = storage;
9
+ export const emojiCache = storage;
@@ -0,0 +1,3 @@
1
+ import type { Renderer } from '../../../types.js';
2
+ declare const ChromiumRenderer: Renderer;
3
+ export default ChromiumRenderer;
@@ -0,0 +1,24 @@
1
+ import { createBrowser } from "#og-image/bindings/chromium";
2
+ import { createError } from "h3";
3
+ import { createScreenshot } from "./screenshot.js";
4
+ const ChromiumRenderer = {
5
+ name: "chromium",
6
+ supportedFormats: ["png", "jpeg", "jpg"],
7
+ async debug() {
8
+ return {};
9
+ },
10
+ async createImage(ctx) {
11
+ const browser = await createBrowser();
12
+ const screenshot = await createScreenshot(ctx, browser).catch((e) => e);
13
+ await browser.close();
14
+ if (screenshot instanceof Error) {
15
+ return createError({
16
+ statusCode: 400,
17
+ cause: screenshot,
18
+ statusMessage: `[Nuxt OG Image] Failed to create screenshot ${screenshot.message}.`
19
+ });
20
+ }
21
+ return screenshot;
22
+ }
23
+ };
24
+ export default ChromiumRenderer;
@@ -0,0 +1,4 @@
1
+ import type { Buffer } from 'node:buffer';
2
+ import type { Browser } from 'playwright-core';
3
+ import type { OgImageRenderEventContext } from '../../../types.js';
4
+ export declare function createScreenshot({ basePath, e, options, extension }: OgImageRenderEventContext, browser: Browser): Promise<Buffer>;
@@ -0,0 +1,54 @@
1
+ import { useNitroOrigin } from "#site-config/server/composables";
2
+ import { joinURL, withQuery } from "ufo";
3
+ import { toValue } from "vue";
4
+ import { useOgImageRuntimeConfig } from "../../utils.js";
5
+ export async function createScreenshot({ basePath, e, options, extension }, browser) {
6
+ const { colorPreference } = useOgImageRuntimeConfig();
7
+ const path = options.component === "PageScreenshot" ? basePath : joinURL("/__og-image__/image", basePath, `og.html`);
8
+ const page = await browser.newPage({
9
+ colorScheme: colorPreference || "no-preference",
10
+ baseURL: useNitroOrigin(e)
11
+ });
12
+ try {
13
+ if (import.meta.prerender && !options.html) {
14
+ options.html = await e.$fetch(path).catch(() => void 0);
15
+ }
16
+ await page.setViewportSize({
17
+ width: toValue(options.width) || 1200,
18
+ height: toValue(options.height) || 630
19
+ });
20
+ if (options.html) {
21
+ const html = options.html;
22
+ await page.evaluate((html2) => {
23
+ document.open("text/html");
24
+ document.write(html2);
25
+ document.close();
26
+ }, html);
27
+ await page.waitForLoadState("networkidle");
28
+ } else {
29
+ await page.goto(withQuery(path, options.props), {
30
+ timeout: 1e4,
31
+ waitUntil: "networkidle"
32
+ });
33
+ }
34
+ const screenshotOptions = {
35
+ timeout: 1e4,
36
+ animations: "disabled",
37
+ type: extension === "png" ? "png" : "jpeg"
38
+ };
39
+ const _options = options.screenshot || {};
40
+ if (_options.delay)
41
+ await page.waitForTimeout(_options.delay);
42
+ if (_options.mask) {
43
+ await page.evaluate((mask) => {
44
+ for (const el of document.querySelectorAll(mask))
45
+ el.style.display = "none";
46
+ }, _options.mask);
47
+ }
48
+ if (_options.selector)
49
+ return await page.locator(_options.selector).screenshot(screenshotOptions);
50
+ return await page.screenshot(screenshotOptions);
51
+ } finally {
52
+ await page.close();
53
+ }
54
+ }
@@ -0,0 +1,5 @@
1
+ import type { H3Error, H3Event } from 'h3';
2
+ import type { OgImageOptions, OgImageRenderEventContext } from '../../types.js';
3
+ export declare function resolvePathCacheKey(e: H3Event, path: string): string;
4
+ export declare function resolveContext(e: H3Event): Promise<H3Error | OgImageRenderEventContext>;
5
+ export declare function extractAndNormaliseOgImageOptions(html: string): OgImageOptions | false;