nuxt-og-image 1.5.1 → 1.5.2

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/module.json CHANGED
@@ -5,5 +5,5 @@
5
5
  "bridge": false
6
6
  },
7
7
  "configKey": "ogImage",
8
- "version": "1.5.1"
8
+ "version": "1.5.2"
9
9
  }
package/dist/module.mjs CHANGED
@@ -9,7 +9,7 @@ import { resolve, relative } from 'pathe';
9
9
  import { tinyws } from 'tinyws';
10
10
  import sirv from 'sirv';
11
11
  import { pathExists, copy, mkdirp } from 'fs-extra';
12
- import { isCI, provider } from 'std-env';
12
+ import { provider } from 'std-env';
13
13
  import playwrightCore from 'playwright-core';
14
14
  import { existsSync } from 'node:fs';
15
15
  import { createBirpcGroup } from 'birpc';
@@ -37,10 +37,10 @@ async function createBrowser() {
37
37
  headless: true
38
38
  });
39
39
  } catch (e) {
40
- if (process.dev)
40
+ if (process.dev) {
41
41
  console.warn("Failed to load chromium instance. Ensure you have chrome installed, otherwise add the dependency: `npm add -D playwright`.");
42
- if (isCI) {
43
- console.error("Failed to load browser instance. Please open an issue at: https://github.com/harlan-zw/nuxt-og-image/issues.");
42
+ } else {
43
+ console.error("Failed to load browser instance. Please open an issue with the exception: https://github.com/harlan-zw/nuxt-og-image/issues.");
44
44
  throw e;
45
45
  }
46
46
  }
@@ -1,4 +1,3 @@
1
- import { isCI } from "std-env";
2
1
  import playwrightCore from "playwright-core";
3
2
  export default async function createBrowser() {
4
3
  try {
@@ -22,10 +21,10 @@ export default async function createBrowser() {
22
21
  headless: true
23
22
  });
24
23
  } catch (e) {
25
- if (process.dev)
24
+ if (process.dev) {
26
25
  console.warn("Failed to load chromium instance. Ensure you have chrome installed, otherwise add the dependency: `npm add -D playwright`.");
27
- if (isCI) {
28
- console.error("Failed to load browser instance. Please open an issue at: https://github.com/harlan-zw/nuxt-og-image/issues.");
26
+ } else {
27
+ console.error("Failed to load browser instance. Please open an issue with the exception: https://github.com/harlan-zw/nuxt-og-image/issues.");
29
28
  throw e;
30
29
  }
31
30
  }
@@ -1,4 +1,4 @@
1
- import { createError, defineEventHandler, getQuery } from "h3";
1
+ import { createError, defineEventHandler, getHeaders, getQuery } from "h3";
2
2
  import { useHostname } from "../utils.mjs";
3
3
  import { getRouteRules } from "#internal/nitro";
4
4
  import { defaults } from "#nuxt-og-image/config";
@@ -18,7 +18,9 @@ export const inferOgImageOptions = (html) => {
18
18
  export default defineEventHandler(async (e) => {
19
19
  const query = getQuery(e);
20
20
  const path = query.path || "/";
21
- const fetchOptions = process.dev || process.env.prerender ? {} : {
21
+ const fetchOptions = process.dev || process.env.prerender ? {
22
+ headers: getHeaders(e)
23
+ } : {
22
24
  baseURL: useHostname(e)
23
25
  };
24
26
  const html = await globalThis.$fetch(path, {
@@ -1,5 +1,5 @@
1
1
  import { existsSync, promises as fsp } from "node:fs";
2
- import { getQuery, getRequestHeader } from "h3";
2
+ import { getHeaders, getQuery, getRequestHeader } from "h3";
3
3
  import { join } from "pathe";
4
4
  import { assetDirs } from "#nuxt-og-image/config";
5
5
  import { useRuntimeConfig } from "#internal/nitro";
@@ -37,7 +37,9 @@ export function wasmLoader(key, fallback, baseUrl) {
37
37
  };
38
38
  }
39
39
  export function fetchOptions(e, path) {
40
- const fetchOptions2 = process.dev || process.env.prerender ? {} : {
40
+ const fetchOptions2 = process.dev || process.env.prerender ? {
41
+ headers: getHeaders(e)
42
+ } : {
41
43
  baseURL: useHostname(e)
42
44
  };
43
45
  return globalThis.$fetch("/api/og-image-options", {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-og-image",
3
3
  "type": "module",
4
- "version": "1.5.1",
4
+ "version": "1.5.2",
5
5
  "packageManager": "pnpm@7.8.0",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",