nuxt-og-image 3.0.0-beta.2 → 3.0.0-beta.21

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 (108) hide show
  1. package/dist/client/200.html +5 -5
  2. package/dist/client/404.html +5 -5
  3. package/dist/client/_nuxt/{IconCSS.5368a1a4.js → IconCSS.0fff2a4e.js} +1 -1
  4. package/dist/client/_nuxt/IconCSS.7e8f1f7b.css +1 -0
  5. package/dist/client/_nuxt/builds/latest.json +1 -1
  6. package/dist/client/_nuxt/builds/meta/067a31fa-8ddd-4061-85b5-6327dd434f4d.json +1 -0
  7. package/dist/client/_nuxt/entry.3a009184.css +1 -0
  8. package/dist/client/_nuxt/entry.3f6151e3.js +137 -0
  9. package/dist/client/_nuxt/{error-404.4a94a265.js → error-404.751c8eba.js} +1 -1
  10. package/dist/client/_nuxt/{error-500.70093e7d.js → error-500.bb72a49b.js} +1 -1
  11. package/dist/client/index.html +5 -5
  12. package/dist/module.d.mts +41 -24
  13. package/dist/module.d.ts +41 -24
  14. package/dist/module.json +2 -2
  15. package/dist/module.mjs +92 -75
  16. package/dist/runtime/cache.d.ts +7 -10
  17. package/dist/runtime/cache.mjs +38 -26
  18. package/dist/runtime/components/OgImage/OgImage.d.ts +5 -0
  19. package/dist/runtime/components/OgImage/{index.mjs → OgImage.mjs} +1 -1
  20. package/dist/runtime/components/OgImage/OgImageScreenshot.d.ts +5 -0
  21. package/dist/runtime/components/OgImage/{Screenshot.mjs → OgImageScreenshot.mjs} +1 -1
  22. package/dist/runtime/components/Templates/Official/SimpleBlog.vue +1 -0
  23. package/dist/runtime/composables/defineOgImage.d.ts +2 -23
  24. package/dist/runtime/composables/defineOgImage.mjs +32 -115
  25. package/dist/runtime/composables/defineOgImageComponent.d.ts +3 -0
  26. package/dist/runtime/composables/defineOgImageComponent.mjs +8 -0
  27. package/dist/runtime/composables/defineOgImageScreenshot.d.ts +2 -0
  28. package/dist/runtime/composables/defineOgImageScreenshot.mjs +14 -0
  29. package/dist/runtime/core/bindings/css-inline/node.d.ts +2 -5
  30. package/dist/runtime/core/bindings/css-inline/node.mjs +2 -10
  31. package/dist/runtime/core/bindings/resvg/wasm.mjs +2 -3
  32. package/dist/runtime/core/bindings/satori/wasm.mjs +7 -0
  33. package/dist/runtime/core/cache/emojis.d.ts +1 -0
  34. package/dist/runtime/core/cache/emojis.mjs +5 -0
  35. package/dist/runtime/core/cache/htmlPayload.d.ts +5 -0
  36. package/dist/runtime/core/cache/htmlPayload.mjs +6 -0
  37. package/dist/runtime/core/cache/prerender.d.ts +1 -1
  38. package/dist/runtime/core/font/fetch.d.ts +2 -3
  39. package/dist/runtime/core/font/fetch.mjs +10 -4
  40. package/dist/runtime/core/html/applyEmojis.d.ts +3 -0
  41. package/dist/runtime/core/html/applyEmojis.mjs +37 -0
  42. package/dist/runtime/core/html/applyInlineCss.d.ts +3 -0
  43. package/dist/runtime/core/html/applyInlineCss.mjs +32 -0
  44. package/dist/runtime/core/html/devIframeTemplate.d.ts +2 -0
  45. package/dist/runtime/core/html/{fetch.mjs → devIframeTemplate.mjs} +8 -31
  46. package/dist/runtime/core/html/fetchIsland.d.ts +3 -0
  47. package/dist/runtime/core/html/fetchIsland.mjs +17 -0
  48. package/dist/runtime/core/options/fetch.d.ts +1 -1
  49. package/dist/runtime/core/options/fetch.mjs +10 -5
  50. package/dist/runtime/core/options/normalise.d.ts +2 -2
  51. package/dist/runtime/core/renderers/chromium/index.mjs +6 -7
  52. package/dist/runtime/core/renderers/chromium/screenshot.d.ts +2 -3
  53. package/dist/runtime/core/renderers/chromium/screenshot.mjs +5 -4
  54. package/dist/runtime/core/renderers/satori/fonts.d.ts +2 -2
  55. package/dist/runtime/core/renderers/satori/fonts.mjs +2 -2
  56. package/dist/runtime/core/renderers/satori/index.d.ts +2 -3
  57. package/dist/runtime/core/renderers/satori/index.mjs +21 -18
  58. package/dist/runtime/core/renderers/satori/instances.d.ts +3 -0
  59. package/dist/runtime/core/renderers/satori/instances.mjs +15 -0
  60. package/dist/runtime/core/renderers/satori/plugins/emojis.mjs +15 -13
  61. package/dist/runtime/core/renderers/satori/plugins/imageSrc.mjs +8 -4
  62. package/dist/runtime/core/renderers/satori/utils.d.ts +2 -3
  63. package/dist/runtime/core/renderers/satori/vnodes.d.ts +2 -3
  64. package/dist/runtime/core/renderers/satori/vnodes.mjs +14 -6
  65. package/dist/runtime/core/utils/resolveRendererContext.d.ts +2 -6
  66. package/dist/runtime/core/utils/resolveRendererContext.mjs +34 -21
  67. package/dist/runtime/core/utils/wasm.d.ts +1 -0
  68. package/dist/runtime/core/utils/wasm.mjs +9 -0
  69. package/dist/runtime/nitro/plugins/nuxt-content.mjs +2 -2
  70. package/dist/runtime/nitro/plugins/prerender.mjs +2 -2
  71. package/dist/runtime/nuxt/plugins/nuxt-content-canonical-urls.mjs +2 -2
  72. package/dist/runtime/nuxt/plugins/route-rule-og-image.server.mjs +14 -47
  73. package/dist/runtime/nuxt/utils.d.ts +2 -0
  74. package/dist/runtime/nuxt/utils.mjs +55 -0
  75. package/dist/runtime/server/routes/__og-image__/debug.json.d.ts +0 -2
  76. package/dist/runtime/server/routes/__og-image__/debug.json.mjs +2 -7
  77. package/dist/runtime/server/routes/__og-image__/image.mjs +86 -0
  78. package/dist/runtime/types.d.ts +57 -24
  79. package/dist/runtime/utils.d.ts +3 -0
  80. package/dist/runtime/utils.mjs +11 -0
  81. package/package.json +17 -28
  82. package/virtual.d.ts +49 -0
  83. package/dist/client/_nuxt/IconCSS.8f429b14.css +0 -1
  84. package/dist/client/_nuxt/builds/meta/9c7e316c-59c6-4fd5-966f-dfb7242ba3f3.json +0 -1
  85. package/dist/client/_nuxt/entry.434c2c45.css +0 -1
  86. package/dist/client/_nuxt/entry.60cb5216.js +0 -137
  87. package/dist/client/grid.png +0 -0
  88. package/dist/runtime/components/OgImage/Cached.d.ts +0 -5
  89. package/dist/runtime/components/OgImage/Cached.mjs +0 -10
  90. package/dist/runtime/components/OgImage/Dynamic.d.ts +0 -8
  91. package/dist/runtime/components/OgImage/Dynamic.mjs +0 -10
  92. package/dist/runtime/components/OgImage/Screenshot.d.ts +0 -6
  93. package/dist/runtime/components/OgImage/Static.d.ts +0 -8
  94. package/dist/runtime/components/OgImage/Static.mjs +0 -10
  95. package/dist/runtime/components/OgImage/WithoutCache.d.ts +0 -5
  96. package/dist/runtime/components/OgImage/WithoutCache.mjs +0 -10
  97. package/dist/runtime/components/OgImage/index.d.ts +0 -5
  98. package/dist/runtime/core/bindings/css-inline/mock.d.ts +0 -5
  99. package/dist/runtime/core/bindings/css-inline/mock.mjs +0 -3
  100. package/dist/runtime/core/bindings/satori/yoga-wasm.mjs +0 -7
  101. package/dist/runtime/core/bindings/sharp/wasm.d.ts +0 -2
  102. package/dist/runtime/core/bindings/sharp/wasm.mjs +0 -2
  103. package/dist/runtime/core/html/fetch.d.ts +0 -3
  104. package/dist/runtime/server/routes/__og-image__/image-[path]-og.[extension].mjs +0 -44
  105. package/dist/runtime/utilts.d.ts +0 -2
  106. package/dist/runtime/utilts.mjs +0 -8
  107. /package/dist/runtime/core/bindings/satori/{yoga-wasm.d.ts → wasm.d.ts} +0 -0
  108. /package/dist/runtime/server/routes/__og-image__/{image-[path]-og.[extension].d.ts → image.d.ts} +0 -0
Binary file
@@ -1,5 +0,0 @@
1
- import type { OgImageOptions } from '../../types';
2
- declare const _default: import("vue").DefineComponent<OgImageOptions, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<OgImageOptions>>, {
3
- [x: string]: any;
4
- }, {}>;
5
- export default _default;
@@ -1,10 +0,0 @@
1
- import { defineComponent } from "vue";
2
- import { defineOgImageCached } from "#imports";
3
- export default defineComponent({
4
- name: "OgImageCached",
5
- async setup(_, { attrs }) {
6
- if (import.meta.server)
7
- await defineOgImageCached(attrs);
8
- return () => null;
9
- }
10
- });
@@ -1,8 +0,0 @@
1
- import type { OgImageOptions } from '../../types';
2
- /**
3
- * @deprecated Use OgImageWithoutCache
4
- */
5
- declare const _default: import("vue").DefineComponent<OgImageOptions, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<OgImageOptions>>, {
6
- [x: string]: any;
7
- }, {}>;
8
- export default _default;
@@ -1,10 +0,0 @@
1
- import { defineComponent } from "vue";
2
- import { defineOgImageWithoutCache } from "#imports";
3
- export default defineComponent({
4
- name: "OgImageDynamic",
5
- async setup(_, { attrs }) {
6
- if (import.meta.server)
7
- await defineOgImageWithoutCache(attrs);
8
- return () => null;
9
- }
10
- });
@@ -1,6 +0,0 @@
1
- import type { OgImageScreenshotOptions } from '../../types';
2
- declare const _default: import("vue").DefineComponent<OgImageScreenshotOptions, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<OgImageScreenshotOptions>>, {
3
- [x: string]: any;
4
- [x: number]: any;
5
- }, {}>;
6
- export default _default;
@@ -1,8 +0,0 @@
1
- import type { OgImageOptions } from '../../types';
2
- /**
3
- * @deprecated Use OgImageCached instead
4
- */
5
- declare const _default: import("vue").DefineComponent<OgImageOptions, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<OgImageOptions>>, {
6
- [x: string]: any;
7
- }, {}>;
8
- export default _default;
@@ -1,10 +0,0 @@
1
- import { defineComponent } from "vue";
2
- import { defineOgImageCached } from "#imports";
3
- export default defineComponent({
4
- name: "OgImageStatic",
5
- async setup(_, { attrs }) {
6
- if (import.meta.server)
7
- await defineOgImageCached(attrs);
8
- return () => null;
9
- }
10
- });
@@ -1,5 +0,0 @@
1
- import type { OgImageOptions } from '../../types';
2
- declare const _default: import("vue").DefineComponent<OgImageOptions, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<OgImageOptions>>, {
3
- [x: string]: any;
4
- }, {}>;
5
- export default _default;
@@ -1,10 +0,0 @@
1
- import { defineComponent } from "vue";
2
- import { defineOgImageWithoutCache } from "#imports";
3
- export default defineComponent({
4
- name: "OgImageWithoutCache",
5
- async setup(_, { attrs }) {
6
- if (import.meta.server)
7
- defineOgImageWithoutCache(attrs);
8
- return () => null;
9
- }
10
- });
@@ -1,5 +0,0 @@
1
- import type { OgImageOptions } from '../../types';
2
- declare const _default: import("vue").DefineComponent<OgImageOptions, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<OgImageOptions>>, {
3
- [x: string]: any;
4
- }, {}>;
5
- export default _default;
@@ -1,5 +0,0 @@
1
- declare const mockFn: {
2
- (s: string): string;
3
- __mock: boolean;
4
- };
5
- export default mockFn;
@@ -1,3 +0,0 @@
1
- const mockFn = (s) => s;
2
- mockFn.__mock = true;
3
- export default mockFn;
@@ -1,7 +0,0 @@
1
- import _satori, { init } from "satori/wasm";
2
- import initYoga from "yoga-wasm-web";
3
- import YogaWasm from "yoga-wasm-web/dist/yoga.wasm";
4
- export default {
5
- initWasmPromise: initYoga(YogaWasm).then((yoga) => init(yoga)),
6
- satori: _satori
7
- };
@@ -1,2 +0,0 @@
1
- import sharp from '@img/sharp-wasm32/package.json';
2
- export default sharp;
@@ -1,2 +0,0 @@
1
- import sharp from "@img/sharp-wasm32/package.json";
2
- export default sharp;
@@ -1,3 +0,0 @@
1
- import { type H3Event } from 'h3';
2
- import type { RendererOptions, RuntimeOgImageOptions } from '../../types';
3
- export declare function fetchHTML(e: H3Event, options: RuntimeOgImageOptions | RendererOptions): Promise<string>;
@@ -1,44 +0,0 @@
1
- import { H3Error, createError, defineEventHandler, setHeader } from "h3";
2
- import { resolveRendererContext } from "../../../core/utils/resolveRendererContext.mjs";
3
- import { fetchHTML } from "../../../core/html/fetch.mjs";
4
- export default defineEventHandler(async (e) => {
5
- const ctx = await resolveRendererContext(e);
6
- if (ctx instanceof H3Error)
7
- return ctx;
8
- const { extension, options, renderer } = ctx;
9
- if (!options.cacheTtl || import.meta.dev) {
10
- setHeader(e, "Cache-Control", "no-cache, no-store, must-revalidate");
11
- setHeader(e, "Pragma", "no-cache");
12
- setHeader(e, "Expires", "0");
13
- }
14
- switch (extension) {
15
- case "html":
16
- setHeader(e, "Content-Type", `text/html`);
17
- return fetchHTML(e, options);
18
- case "json":
19
- setHeader(e, "Content-Type", "application/json");
20
- return {
21
- ...ctx,
22
- siteConfig: useSiteConfig(e),
23
- vnodes: options.renderer === "satori" ? await renderer.createImage(e, { ...options, extension: "json" }) : void 0
24
- };
25
- case "svg":
26
- case "png":
27
- case "jpeg":
28
- case "jpg":
29
- if (!renderer.supportedFormats.includes(options.extension)) {
30
- return createError({
31
- statusCode: 400,
32
- statusMessage: `Generating ${options.extension}'s with ${renderer.name} is not supported.`
33
- });
34
- }
35
- setHeader(e, "Content-Type", `image/${options.extension === "svg" ? "svg+xml" : options.extension}`);
36
- break;
37
- default:
38
- return createError({
39
- statusCode: 400,
40
- statusMessage: `Invalid request for og.${options.extension}.`
41
- });
42
- }
43
- return renderer.createImage(e, options);
44
- });
@@ -1,2 +0,0 @@
1
- export declare function getOgImagePath(pagePath: string, extension?: string): string;
2
- export declare function isInternalRoute(path: string): boolean;
@@ -1,8 +0,0 @@
1
- import { joinURL } from "ufo";
2
- export function getOgImagePath(pagePath, extension = "png") {
3
- return joinURL("/__og-image__/image", pagePath, `og.${extension}`);
4
- }
5
- export function isInternalRoute(path) {
6
- const lastSegment = path.split("/").pop() || path;
7
- return lastSegment.includes(".") || path.startsWith("/__") || path.startsWith("@");
8
- }