nuxt-og-image 5.1.12 → 5.1.13

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 (37) hide show
  1. package/README.md +1 -1
  2. package/dist/client/200.html +1 -1
  3. package/dist/client/404.html +1 -1
  4. package/dist/client/_nuxt/{l5rcX3cq.js → B3LgXoKV.js} +1 -7
  5. package/dist/client/_nuxt/CPsbVDfV.js +1 -0
  6. package/dist/client/_nuxt/CjQm5wk3.js +4029 -0
  7. package/dist/client/_nuxt/D0TMZt8T.js +1 -0
  8. package/dist/client/_nuxt/builds/latest.json +1 -1
  9. package/dist/client/_nuxt/builds/meta/eb2c0390-3125-4af7-b189-e76a7dfe3017.json +1 -0
  10. package/dist/client/_nuxt/{entry.DNM8P-MU.css → entry.cdy4VsCK.css} +1 -1
  11. package/dist/client/_nuxt/error-404.Cu4JbXd7.css +1 -0
  12. package/dist/client/_nuxt/error-500.B79uceR7.css +1 -0
  13. package/dist/client/index.html +1 -1
  14. package/dist/content.cjs +6 -6
  15. package/dist/content.d.cts +13 -13
  16. package/dist/content.d.mts +13 -13
  17. package/dist/content.d.ts +13 -13
  18. package/dist/content.mjs +1 -1
  19. package/dist/module.cjs +6 -4
  20. package/dist/module.d.cts +5 -3
  21. package/dist/module.d.mts +5 -3
  22. package/dist/module.d.ts +5 -3
  23. package/dist/module.json +1 -1
  24. package/dist/module.mjs +8 -6
  25. package/dist/runtime/server/og-image/bindings/satori/wasm-fs.d.ts +1 -1
  26. package/dist/runtime/server/og-image/bindings/satori/wasm-fs.js +4 -8
  27. package/dist/runtime/server/og-image/bindings/satori/wasm.d.ts +1 -1
  28. package/dist/runtime/server/og-image/bindings/satori/wasm.js +4 -9
  29. package/dist/runtime/server/og-image/context.js +4 -5
  30. package/dist/runtime/server/util/wasm.d.ts +1 -1
  31. package/package.json +42 -41
  32. package/dist/client/_nuxt/CD9VIl4i.js +0 -4062
  33. package/dist/client/_nuxt/CI_lqgv7.js +0 -1
  34. package/dist/client/_nuxt/Dz8kdfgF.js +0 -1
  35. package/dist/client/_nuxt/builds/meta/71b0f7ea-9aae-4c28-bbd9-8eea71b82dfb.json +0 -1
  36. package/dist/client/_nuxt/error-404.C2mGI6Vt.css +0 -1
  37. package/dist/client/_nuxt/error-500.ClHbVBiL.css +0 -1
package/dist/module.d.mts CHANGED
@@ -79,11 +79,13 @@ interface ModuleOptions {
79
79
  */
80
80
  compatibility?: CompatibilityFlagEnvOverrides;
81
81
  /**
82
- * Use an alternative host for downloading Google Fonts. This is used to support China where Google Fonts is blocked.
82
+ * Use an alternative host for downloading Google Fonts.
83
83
  *
84
- * When `true` is set will use `fonts.font.im`, otherwise will use a string as the host.
84
+ * Provide a custom mirror host (e.g., your own proxy server).
85
+ * Note: The mirror must serve TTF fonts for Satori compatibility.
86
+ * For China users, consider using local font files via the `path` option instead.
85
87
  */
86
- googleFontMirror?: true | string;
88
+ googleFontMirror?: string;
87
89
  /**
88
90
  * Only allow the prerendering and dev runtimes to generate images.
89
91
  */
package/dist/module.d.ts CHANGED
@@ -79,11 +79,13 @@ interface ModuleOptions {
79
79
  */
80
80
  compatibility?: CompatibilityFlagEnvOverrides;
81
81
  /**
82
- * Use an alternative host for downloading Google Fonts. This is used to support China where Google Fonts is blocked.
82
+ * Use an alternative host for downloading Google Fonts.
83
83
  *
84
- * When `true` is set will use `fonts.font.im`, otherwise will use a string as the host.
84
+ * Provide a custom mirror host (e.g., your own proxy server).
85
+ * Note: The mirror must serve TTF fonts for Satori compatibility.
86
+ * For China users, consider using local font files via the `path` option instead.
85
87
  */
86
- googleFontMirror?: true | string;
88
+ googleFontMirror?: string;
87
89
  /**
88
90
  * Only allow the prerendering and dev runtimes to generate images.
89
91
  */
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "nuxt": ">=3.16.0"
5
5
  },
6
6
  "configKey": "ogImage",
7
- "version": "5.1.12",
7
+ "version": "5.1.13",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -42,7 +42,7 @@ async function downloadFont(font, storage, mirror) {
42
42
  const key = `${name}-${style}-${weight}.ttf.base64`;
43
43
  if (await storage.hasItem(key))
44
44
  return { success: true };
45
- const host = typeof mirror === "undefined" ? "fonts.googleapis.com" : mirror === true ? "fonts.font.im" : mirror;
45
+ const host = mirror || "fonts.googleapis.com";
46
46
  const cssUrl = `https://${host}/css2?family=${name}:${style === "ital" ? `ital,wght@1,${weight}` : `wght@${weight}`}`;
47
47
  const css = await $fetch(cssUrl, {
48
48
  timeout: 10 * 1e3,
@@ -323,8 +323,10 @@ function setupDevToolsUI(options, resolve, nuxt = useNuxt()) {
323
323
  });
324
324
  } else {
325
325
  nuxt.hook("vite:extendConfig", (config) => {
326
- config.server = config.server || {};
327
- config.server.proxy = config.server.proxy || {};
326
+ if (!config.server) {
327
+ config.server = {};
328
+ }
329
+ config.server.proxy ||= {};
328
330
  config.server.proxy[DEVTOOLS_UI_ROUTE] = {
329
331
  target: `http://localhost:${DEVTOOLS_UI_LOCAL_PORT}${DEVTOOLS_UI_ROUTE}`,
330
332
  changeOrigin: true,
@@ -534,7 +536,7 @@ function isProviderEnabledForEnv(provider, nuxt, config) {
534
536
  return nuxt.options.dev && config.compatibility?.dev?.[provider] !== false || !nuxt.options.dev && (config.compatibility?.runtime?.[provider] !== false || config.compatibility?.prerender?.[provider] !== false);
535
537
  }
536
538
  const defaultComponentDirs = ["OgImage", "og-image", "OgImageTemplate"];
537
- const module = defineNuxtModule({
539
+ const module$1 = defineNuxtModule({
538
540
  meta: {
539
541
  name: "nuxt-og-image",
540
542
  compatibility: {
@@ -685,7 +687,7 @@ const module = defineNuxtModule({
685
687
  if (result.success) {
686
688
  f.key = `nuxt-og-image:fonts:${fontFileBase}.ttf.base64`;
687
689
  } else {
688
- const mirrorMsg = config.googleFontMirror ? `using mirror host \`${result.host}\`` : "Consider setting `googleFontMirror: true` if you are in China or behind a firewall.";
690
+ const mirrorMsg = config.googleFontMirror ? `using mirror host \`${result.host}\`` : "Consider using local font files via the `path` option if you are in China or behind a firewall.";
689
691
  logger.warn(`Failed to download font ${fontKey} ${mirrorMsg}`);
690
692
  if (result.error)
691
693
  logger.warn(` Error: ${result.error.message || result.error}`);
@@ -1004,4 +1006,4 @@ export {}
1004
1006
  }
1005
1007
  });
1006
1008
 
1007
- export { module as default };
1009
+ export { module$1 as default };
@@ -1,4 +1,4 @@
1
- import _satori from 'satori/wasm';
1
+ import _satori from 'satori';
2
2
  declare const _default: {
3
3
  initWasmPromise: Promise<void>;
4
4
  satori: typeof _satori;
@@ -1,13 +1,9 @@
1
- import _satori, { init } from "satori/wasm";
2
- import initYoga from "yoga-wasm-web";
1
+ import _satori, { init } from "satori";
3
2
  import { readWasmFile } from "../../../util/wasm.js";
4
- const wasm = readWasmFile("yoga-wasm-web/dist/yoga.wasm").then(async (yoga) => await initYoga(yoga));
3
+ const wasmBinary = readWasmFile("yoga-wasm-web/dist/yoga.wasm");
5
4
  export default {
6
- initWasmPromise: new Promise((resolve) => {
7
- wasm.then((yoga) => {
8
- init(yoga);
9
- resolve();
10
- });
5
+ initWasmPromise: wasmBinary.then(async (wasm) => {
6
+ await init(wasm);
11
7
  }),
12
8
  satori: _satori
13
9
  };
@@ -1,4 +1,4 @@
1
- import _satori from 'satori/wasm';
1
+ import _satori from 'satori';
2
2
  declare const _default: {
3
3
  initWasmPromise: Promise<void>;
4
4
  satori: typeof _satori;
@@ -1,13 +1,8 @@
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));
1
+ import _satori, { init } from "satori";
2
+ const wasmBinary = import("yoga-wasm-web/dist/yoga.wasm?module").then((yoga) => yoga.default || yoga);
5
3
  export default {
6
- initWasmPromise: new Promise((resolve) => {
7
- wasm.then((yoga) => {
8
- init(yoga);
9
- resolve();
10
- });
4
+ initWasmPromise: wasmBinary.then(async (wasm) => {
5
+ await init(wasm);
11
6
  }),
12
7
  satori: _satori
13
8
  };
@@ -71,20 +71,19 @@ export async function resolveContext(e) {
71
71
  }
72
72
  }
73
73
  queryParams = separateProps(queryParams);
74
- let basePath = withoutTrailingSlash(
74
+ const basePath = withoutTrailingSlash(
75
75
  path.replace(`/__og-image__/image`, "").replace(`/__og-image__/static`, "").replace(`/og.${extension}`, "")
76
76
  );
77
- if (queryParams._query && typeof queryParams._query === "object")
78
- basePath = withQuery(basePath, queryParams._query);
77
+ const basePathWithQuery = queryParams._query && typeof queryParams._query === "object" ? withQuery(basePath, queryParams._query) : basePath;
79
78
  const isDebugJsonPayload = extension === "json" && runtimeConfig.debug;
80
- const key = resolvePathCacheKey(e, basePath);
79
+ const key = resolvePathCacheKey(e, basePathWithQuery);
81
80
  let options = queryParams.options;
82
81
  if (!options) {
83
82
  if (import.meta.prerender) {
84
83
  options = await prerenderOptionsCache.getItem(key);
85
84
  }
86
85
  if (!options) {
87
- const payload = await fetchPathHtmlAndExtractOptions(e, basePath, key);
86
+ const payload = await fetchPathHtmlAndExtractOptions(e, basePathWithQuery, key);
88
87
  if (payload instanceof Error)
89
88
  return payload;
90
89
  options = payload;
@@ -1,2 +1,2 @@
1
1
  export declare function importWasm(input: any): Promise<any>;
2
- export declare function readWasmFile(input: string): Promise<Buffer<ArrayBufferLike>>;
2
+ export declare function readWasmFile(input: string): Promise<NonSharedBuffer>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-og-image",
3
3
  "type": "module",
4
- "version": "5.1.12",
4
+ "version": "5.1.13",
5
5
  "description": "Enlightened OG Image generation for Nuxt.",
6
6
  "author": {
7
7
  "website": "https://harlanzw.com",
@@ -48,75 +48,76 @@
48
48
  "unstorage": "^1.15.0"
49
49
  },
50
50
  "dependencies": {
51
- "@nuxt/devtools-kit": "^2.6.5",
52
- "@nuxt/kit": "^4.1.3",
51
+ "@nuxt/devtools-kit": "^3.1.1",
52
+ "@nuxt/kit": "^4.2.2",
53
53
  "@resvg/resvg-js": "^2.6.2",
54
54
  "@resvg/resvg-wasm": "^2.6.2",
55
- "@unocss/core": "^66.5.3",
56
- "@unocss/preset-wind3": "^66.5.3",
55
+ "@unocss/core": "^66.5.10",
56
+ "@unocss/preset-wind3": "^66.5.10",
57
57
  "chrome-launcher": "^1.2.1",
58
58
  "consola": "^3.4.2",
59
59
  "defu": "^6.1.4",
60
- "execa": "^9.6.0",
60
+ "execa": "^9.6.1",
61
61
  "image-size": "^2.0.2",
62
- "magic-string": "^0.30.19",
62
+ "magic-string": "^0.30.21",
63
63
  "mocked-exports": "^0.1.1",
64
- "nuxt-site-config": "^3.2.9",
64
+ "nuxt-site-config": "^3.2.11",
65
65
  "nypm": "^0.6.2",
66
- "ofetch": "^1.4.1",
66
+ "ofetch": "^1.5.1",
67
67
  "ohash": "^2.0.11",
68
68
  "pathe": "^2.0.3",
69
69
  "pkg-types": "^2.3.0",
70
- "playwright-core": "^1.56.0",
70
+ "playwright-core": "^1.57.0",
71
71
  "radix3": "^1.1.2",
72
- "satori": "^0.15.2",
72
+ "satori": "^0.18.3",
73
73
  "satori-html": "^0.3.2",
74
74
  "sirv": "^3.0.2",
75
75
  "std-env": "^3.10.0",
76
76
  "strip-literal": "^3.1.0",
77
77
  "ufo": "^1.6.1",
78
- "unplugin": "^2.3.10",
79
- "unwasm": "^0.3.11",
78
+ "unplugin": "^2.3.11",
79
+ "unwasm": "^0.5.2",
80
80
  "yoga-wasm-web": "^0.3.3"
81
81
  },
82
82
  "devDependencies": {
83
- "@antfu/eslint-config": "^5.4.1",
84
- "@css-inline/css-inline": "^0.17.0",
83
+ "@antfu/eslint-config": "^6.6.1",
84
+ "@css-inline/css-inline": "^0.18.0",
85
85
  "@headlessui/vue": "^1.7.23",
86
- "@iconify-json/carbon": "^1.2.14",
87
- "@iconify-json/logos": "^1.2.9",
86
+ "@iconify-json/carbon": "^1.2.15",
87
+ "@iconify-json/logos": "^1.2.10",
88
88
  "@iconify-json/noto": "^1.2.7",
89
89
  "@iconify-json/ri": "^1.2.6",
90
90
  "@iconify-json/tabler": "^1.2.23",
91
- "@img/sharp-linux-x64": "^0.34.4",
92
- "@nuxt/content": "^3.7.1",
93
- "@nuxt/devtools": "^2.6.5",
94
- "@nuxt/devtools-ui-kit": "^2.6.5",
95
- "@nuxt/icon": "^2.0.0",
96
- "@nuxt/image": "^1.11.0",
91
+ "@img/sharp-linux-x64": "^0.34.5",
92
+ "@nuxt/content": "^3.9.0",
93
+ "@nuxt/devtools": "^3.1.1",
94
+ "@nuxt/devtools-ui-kit": "^3.1.1",
95
+ "@nuxt/icon": "^2.1.0",
96
+ "@nuxt/image": "^2.0.0",
97
97
  "@nuxt/module-builder": "^1.0.2",
98
- "@nuxt/test-utils": "^3.19.2",
99
- "@nuxt/ui": "^4.0.1",
100
- "@nuxtjs/color-mode": "^3.5.2",
98
+ "@nuxt/test-utils": "^3.21.0",
99
+ "@nuxt/ui": "^4.2.1",
100
+ "@nuxtjs/color-mode": "^4.0.0",
101
101
  "@nuxtjs/eslint-config-typescript": "^12.1.0",
102
- "@nuxtjs/i18n": "^10.1.1",
102
+ "@nuxtjs/i18n": "^10.2.1",
103
103
  "@nuxtjs/tailwindcss": "^6.14.0",
104
- "@unocss/nuxt": "^66.5.3",
105
- "@unocss/preset-icons": "^66.5.3",
106
- "@unocss/runtime": "^66.5.3",
107
- "@vueuse/nuxt": "^13.9.0",
108
- "bumpp": "^10.3.1",
109
- "eslint": "^9.37.0",
110
- "happy-dom": "^20.0.0",
104
+ "@unocss/nuxt": "^66.5.10",
105
+ "@unocss/preset-icons": "^66.5.10",
106
+ "@unocss/runtime": "^66.5.10",
107
+ "@vueuse/nuxt": "^14.1.0",
108
+ "bumpp": "^10.3.2",
109
+ "eslint": "^9.39.1",
110
+ "globby": "^16.0.0",
111
+ "happy-dom": "^20.0.11",
111
112
  "jest-image-snapshot": "^6.5.1",
112
- "nuxt": "^4.1.3",
113
- "playwright": "^1.56.0",
114
- "sass": "^1.93.2",
115
- "sharp": "^0.34.4",
113
+ "nuxt": "^4.2.2",
114
+ "playwright": "^1.57.0",
115
+ "sass": "^1.96.0",
116
+ "sharp": "^0.34.5",
116
117
  "typescript": "^5.9.3",
117
- "unocss": "^66.5.3",
118
- "vitest": "^3.2.4",
119
- "vue-tsc": "^3.1.1"
118
+ "unocss": "^66.5.10",
119
+ "vitest": "^4.0.15",
120
+ "vue-tsc": "^3.1.8"
120
121
  },
121
122
  "scripts": {
122
123
  "stub": "nuxt-build-module build --stub && nuxt-module-build prepare",