nuxt-og-image 3.0.0-rc.64 → 3.0.0-rc.65

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 (31) hide show
  1. package/README.md +67 -67
  2. package/dist/client/200.html +6 -6
  3. package/dist/client/404.html +6 -6
  4. package/dist/client/_nuxt/{Dr4yXoA7.js → DVxyIIKo.js} +1 -1
  5. package/dist/client/_nuxt/{B-hN5syD.js → WfFM8TlZ.js} +1 -1
  6. package/dist/client/_nuxt/builds/latest.json +1 -1
  7. package/dist/client/_nuxt/builds/meta/5876a781-42f1-459e-a560-bbe16edad6b7.json +1 -0
  8. package/dist/client/_nuxt/{entry.BCfFhbeW.css → entry.BJu2ITzA.css} +1 -1
  9. package/dist/client/_nuxt/{CAOxhcmA.js → xettH10j.js} +3 -3
  10. package/dist/client/index.html +6 -6
  11. package/dist/module.json +1 -1
  12. package/dist/module.mjs +8 -4
  13. package/dist/runtime/nitro/og-image/context.js +1 -1
  14. package/dist/runtime/nitro/og-image/satori/plugins/imageSrc.js +4 -0
  15. package/dist/runtime/nitro/tsconfig.json +3 -3
  16. package/dist/runtime/nitro/util/logger.d.ts +1 -0
  17. package/dist/runtime/nitro/util/logger.js +6 -0
  18. package/dist/runtime/nuxt/components/Templates/Community/BrandedLogo.vue +29 -29
  19. package/dist/runtime/nuxt/components/Templates/Community/Frame.vue +64 -64
  20. package/dist/runtime/nuxt/components/Templates/Community/Nuxt.vue +185 -185
  21. package/dist/runtime/nuxt/components/Templates/Community/NuxtSeo.vue +137 -137
  22. package/dist/runtime/nuxt/components/Templates/Community/Pergel.vue +103 -103
  23. package/dist/runtime/nuxt/components/Templates/Community/SimpleBlog.vue +35 -35
  24. package/dist/runtime/nuxt/components/Templates/Community/UnJs.vue +108 -108
  25. package/dist/runtime/nuxt/components/Templates/Community/Wave.vue +34 -34
  26. package/dist/runtime/nuxt/components/Templates/Community/WithEmoji.vue +28 -28
  27. package/dist/runtime/nuxt/plugins/og-image-canonical-urls.server.js +1 -1
  28. package/dist/runtime/nuxt/utils.js +6 -4
  29. package/package.json +1 -1
  30. package/virtual.d.ts +49 -49
  31. package/dist/client/_nuxt/builds/meta/5b462863-5844-4458-a933-139db1c25626.json +0 -1
@@ -1,7 +1,7 @@
1
1
  <!DOCTYPE html><html data-capo=""><head><meta charset="utf-8">
2
2
  <meta name="viewport" content="width=device-width, initial-scale=1">
3
- <link rel="stylesheet" href="/__nuxt-og-image/_nuxt/entry.BCfFhbeW.css">
4
- <link rel="modulepreload" as="script" crossorigin href="/__nuxt-og-image/_nuxt/CAOxhcmA.js">
3
+ <link rel="stylesheet" href="/__nuxt-og-image/_nuxt/entry.BJu2ITzA.css">
4
+ <link rel="modulepreload" as="script" crossorigin href="/__nuxt-og-image/_nuxt/xettH10j.js">
5
5
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/DXFkqnOI.js">
6
6
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/BigF1UXR.js">
7
7
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/CowR2XfX.js">
@@ -259,8 +259,8 @@
259
259
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/Br6ll-O0.js">
260
260
  <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/B6E6ObS_.js">
261
261
  <link rel="prefetch" as="style" href="/__nuxt-og-image/_nuxt/error-404.B3wjZPBT.css">
262
- <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/Dr4yXoA7.js">
262
+ <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/DVxyIIKo.js">
263
263
  <link rel="prefetch" as="style" href="/__nuxt-og-image/_nuxt/error-500.Dxoa4Ooo.css">
264
- <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/B-hN5syD.js">
265
- <script type="module" src="/__nuxt-og-image/_nuxt/CAOxhcmA.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" id="__NUXT_DATA__" data-ssr="false">[{"serverRendered":1},false]</script>
266
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-og-image",buildId:"5b462863-5844-4458-a933-139db1c25626",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
264
+ <link rel="prefetch" as="script" crossorigin href="/__nuxt-og-image/_nuxt/WfFM8TlZ.js">
265
+ <script type="module" src="/__nuxt-og-image/_nuxt/xettH10j.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" id="__NUXT_DATA__" data-ssr="false">[{"serverRendered":1},false]</script>
266
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-og-image",buildId:"5876a781-42f1-459e-a560-bbe16edad6b7",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
package/dist/module.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "bridge": false
6
6
  },
7
7
  "configKey": "ogImage",
8
- "version": "3.0.0-rc.63",
8
+ "version": "3.0.0-rc.64",
9
9
  "builder": {
10
10
  "@nuxt/module-builder": "0.8.1",
11
11
  "unbuild": "2.0.0"
package/dist/module.mjs CHANGED
@@ -122,7 +122,7 @@ function resolveNitroPreset(nitroConfig) {
122
122
  if (nitroConfig && nitroConfig?.preset)
123
123
  preset = nitroConfig.preset;
124
124
  if (!preset)
125
- preset = env.NITRO_PRESET || detectTarget() || "node-server";
125
+ preset = env.NITRO_PRESET || env.SERVER_PRESET || detectTarget() || "node-server";
126
126
  return preset.replace("_", "-");
127
127
  }
128
128
  function getPresetNitroPresetCompatibility(target) {
@@ -370,15 +370,19 @@ async function setupBuildHandler(config, resolve, nuxt = useNuxt()) {
370
370
  ].filter(existsSync)[0] || serverEntry;
371
371
  }
372
372
  const contents = await readFile(serverEntry, "utf-8");
373
- const resvgHash = sha1(await readFile(await resolvePath("@resvg/resvg-wasm/index_bg.wasm")));
374
- const yogaHash = sha1(await readFile(await resolvePath("yoga-wasm-web/dist/yoga.wasm")));
375
- const cssInlineHash = sha1(await readFile(await resolvePath("@css-inline/css-inline-wasm/index_bg.wasm")));
373
+ const resvgHash = await resolveFilePathSha1("@resvg/resvg-wasm/index_bg.wasm");
374
+ const yogaHash = await resolveFilePathSha1("yoga-wasm-web/dist/yoga.wasm");
375
+ const cssInlineHash = await resolveFilePathSha1("@css-inline/css-inline-wasm/index_bg.wasm");
376
376
  const postfix = target === "vercel-edge" ? "?module" : "";
377
377
  const path = isCloudflarePagesOrModule ? `../wasm/` : `./wasm/`;
378
378
  await writeFile(serverEntry, contents.replaceAll('"@resvg/resvg-wasm/index_bg.wasm?module"', `"${path}index_bg-${resvgHash}.wasm${postfix}"`).replaceAll('"@css-inline/css-inline-wasm/index_bg.wasm?module"', `"${path}index_bg-${cssInlineHash}.wasm${postfix}"`).replaceAll('"yoga-wasm-web/dist/yoga.wasm?module"', `"${path}yoga-${yogaHash}.wasm${postfix}"`), { encoding: "utf-8" });
379
379
  });
380
380
  });
381
381
  }
382
+ async function resolveFilePathSha1(path) {
383
+ const _path = await resolvePath(path);
384
+ return sha1(existsSync(_path) ? await readFile(_path) : path);
385
+ }
382
386
  function sha1(source) {
383
387
  return createHash("sha1").update(source).digest("hex").slice(0, 16);
384
388
  }
@@ -3,7 +3,7 @@ import { createError, getQuery } from "h3";
3
3
  import { defu } from "defu";
4
4
  import { normalizeKey } from "unstorage";
5
5
  import { hash } from "ohash";
6
- import { useNitroApp } from "nitropack/runtime/app";
6
+ import { useNitroApp } from "nitropack/runtime";
7
7
  import { parse } from "devalue";
8
8
  import { separateProps, useOgImageRuntimeConfig } from "../../shared.js";
9
9
  import { createNitroRouteRuleMatcher } from "../util/kit.js";
@@ -2,6 +2,7 @@ import { withBase } from "ufo";
2
2
  import sizeOf from "image-size";
3
3
  import { defineSatoriTransformer } from "../utils.js";
4
4
  import { toBase64Image } from "../../../../pure.js";
5
+ import { logger } from "../../../util/logger.js";
5
6
  import { useNitroOrigin, useStorage } from "#imports";
6
7
  async function resolveLocalFilePathImage(publicStoragePath, src) {
7
8
  const key = `${publicStoragePath}${src.replace("./", ":").replace("/", ":")}`;
@@ -17,6 +18,9 @@ export default defineSatoriTransformer([
17
18
  const isRelative = src.startsWith("/");
18
19
  let dimensions;
19
20
  let imageBuffer;
21
+ if (src.endsWith(".webp")) {
22
+ logger.warn("Using WebP images with Satori is not supported. Please consider switching image format or use the chromium renderer.", src);
23
+ }
20
24
  if (isRelative) {
21
25
  if (import.meta.prerender || import.meta.dev) {
22
26
  imageBuffer = await resolveLocalFilePathImage(publicStoragePath, src);
@@ -1,3 +1,3 @@
1
- {
2
- "extends": "../../../.nuxt/tsconfig.server.json"
3
- }
1
+ {
2
+ "extends": "../../../.nuxt/tsconfig.server.json"
3
+ }
@@ -0,0 +1 @@
1
+ export declare const logger: import("consola").ConsolaInstance;
@@ -0,0 +1,6 @@
1
+ import { createConsola } from "consola";
2
+ export const logger = createConsola({
3
+ defaults: {
4
+ tag: "Nuxt OG Image"
5
+ }
6
+ });
@@ -1,29 +1,29 @@
1
- <script setup lang="ts">
2
- /**
3
- * @credits Full Stack Heroes <https://fullstackheroes.com/>
4
- */
5
-
6
- withDefaults(defineProps<{
7
- title?: string
8
- logo?: string
9
- }>(), {
10
- title: 'title',
11
- logo: 'https://nuxt.com/assets/design-kit/logo-white.png',
12
- })
13
- </script>
14
-
15
- <template>
16
- <div
17
- :style="{ backgroundImage: 'linear-gradient(to right, #24243e, #302b63, #0f0c29)' }"
18
- class="h-full w-full flex items-start justify-start"
19
- >
20
- <div class="flex items-start justify-start h-full">
21
- <div class="flex flex-col justify-between w-full h-full p-20">
22
- <img :src="logo" height="50">
23
- <h1 class="text-[60px] text-white font-bold text-left">
24
- {{ title }}
25
- </h1>
26
- </div>
27
- </div>
28
- </div>
29
- </template>
1
+ <script setup lang="ts">
2
+ /**
3
+ * @credits Full Stack Heroes <https://fullstackheroes.com/>
4
+ */
5
+
6
+ withDefaults(defineProps<{
7
+ title?: string
8
+ logo?: string
9
+ }>(), {
10
+ title: 'title',
11
+ logo: 'https://nuxt.com/assets/design-kit/logo-white.png',
12
+ })
13
+ </script>
14
+
15
+ <template>
16
+ <div
17
+ :style="{ backgroundImage: 'linear-gradient(to right, #24243e, #302b63, #0f0c29)' }"
18
+ class="h-full w-full flex items-start justify-start"
19
+ >
20
+ <div class="flex items-start justify-start h-full">
21
+ <div class="flex flex-col justify-between w-full h-full p-20">
22
+ <img :src="logo" height="50">
23
+ <h1 class="text-[60px] text-white font-bold text-left">
24
+ {{ title }}
25
+ </h1>
26
+ </div>
27
+ </div>
28
+ </div>
29
+ </template>
@@ -1,64 +1,64 @@
1
- <script setup lang="ts">
2
- /**
3
- * @credits @arashsheyda <https://github.com/arashsheyda>
4
- */
5
-
6
- withDefaults(defineProps<{
7
- title?: string
8
- description?: string
9
- bg?: string
10
- icon?: string
11
- logo?: string
12
- image?: string
13
- username?: string
14
- socials?: { name: string, icon: string }[]
15
- }>(), {
16
- bg: 'linear-gradient(to bottom right, #171717, #131313)',
17
- })
18
- </script>
19
-
20
- <template>
21
- <div
22
- class="relative h-full w-full flex items-center justify-center bg-neutral-900 text-white border-2 border-white"
23
- :style="{ backgroundImage: bg }"
24
- >
25
- <div
26
- v-if="image"
27
- class="absolute inset-0 w-full h-full bg-center opacity-10"
28
- :style="{ backgroundImage: `url(${image})` }"
29
- />
30
- <div class="flex flex-col items-center text-center">
31
- <h1 class="flex gap-4 text-7xl font-bold">
32
- <Icon
33
- v-if="icon"
34
- :name="icon"
35
- />
36
- {{ title }}
37
- </h1>
38
- <p class="text-2xl max-w-3xl">
39
- {{ description }}
40
- </p>
41
- </div>
42
-
43
- <img
44
- v-if="logo"
45
- :src="logo"
46
- class="absolute bottom-0 left-0 p-5"
47
- style="height: 125px; width: 153px;"
48
- >
49
- <div class="absolute bottom-5 right-5 flex gap-4">
50
- <div
51
- v-if="username"
52
- class="absolute bottom-12 right-8 font-bold"
53
- >
54
- {{ username }}
55
- </div>
56
- <Icon
57
- v-for="social of socials"
58
- :key="social.name"
59
- :name="social.icon!"
60
- class="w-7 h-7"
61
- />
62
- </div>
63
- </div>
64
- </template>
1
+ <script setup lang="ts">
2
+ /**
3
+ * @credits @arashsheyda <https://github.com/arashsheyda>
4
+ */
5
+
6
+ withDefaults(defineProps<{
7
+ title?: string
8
+ description?: string
9
+ bg?: string
10
+ icon?: string
11
+ logo?: string
12
+ image?: string
13
+ username?: string
14
+ socials?: { name: string, icon: string }[]
15
+ }>(), {
16
+ bg: 'linear-gradient(to bottom right, #171717, #131313)',
17
+ })
18
+ </script>
19
+
20
+ <template>
21
+ <div
22
+ class="relative h-full w-full flex items-center justify-center bg-neutral-900 text-white border-2 border-white"
23
+ :style="{ backgroundImage: bg }"
24
+ >
25
+ <div
26
+ v-if="image"
27
+ class="absolute inset-0 w-full h-full bg-center opacity-10"
28
+ :style="{ backgroundImage: `url(${image})` }"
29
+ />
30
+ <div class="flex flex-col items-center text-center">
31
+ <h1 class="flex gap-4 text-7xl font-bold">
32
+ <Icon
33
+ v-if="icon"
34
+ :name="icon"
35
+ />
36
+ {{ title }}
37
+ </h1>
38
+ <p class="text-2xl max-w-3xl">
39
+ {{ description }}
40
+ </p>
41
+ </div>
42
+
43
+ <img
44
+ v-if="logo"
45
+ :src="logo"
46
+ class="absolute bottom-0 left-0 p-5"
47
+ style="height: 125px; width: 153px;"
48
+ >
49
+ <div class="absolute bottom-5 right-5 flex gap-4">
50
+ <div
51
+ v-if="username"
52
+ class="absolute bottom-12 right-8 font-bold"
53
+ >
54
+ {{ username }}
55
+ </div>
56
+ <Icon
57
+ v-for="social of socials"
58
+ :key="social.name"
59
+ :name="social.icon!"
60
+ class="w-7 h-7"
61
+ />
62
+ </div>
63
+ </div>
64
+ </template>