nuxt-og-image 2.0.26 → 2.1.0-beta.0

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 (32) hide show
  1. package/dist/client/200.html +4 -4
  2. package/dist/client/404.html +4 -4
  3. package/dist/client/_nuxt/{IconCSS.fb90e69a.js → IconCSS.5509e16a.js} +1 -1
  4. package/dist/client/_nuxt/{ImageLoader.9c38acd9.js → ImageLoader.9e9d6e15.js} +1 -1
  5. package/dist/client/_nuxt/entry.ed5c26c6.js +135 -0
  6. package/dist/client/_nuxt/{error-404.0a1715ef.js → error-404.3dee6d7e.js} +1 -1
  7. package/dist/client/_nuxt/{error-500.e5a203da.js → error-500.8daad474.js} +1 -1
  8. package/dist/client/_nuxt/{index.532d8eff.js → index.6fdad60d.js} +1 -1
  9. package/dist/client/_nuxt/{options.d4d86b2e.js → options.7f107e61.js} +1 -1
  10. package/dist/client/_nuxt/{png.1ee49492.js → png.2a205b6d.js} +1 -1
  11. package/dist/client/_nuxt/{shiki.303b2a09.js → shiki.aa1b8621.js} +1 -1
  12. package/dist/client/_nuxt/{svg.f181ef45.js → svg.3f435c63.js} +1 -1
  13. package/dist/client/_nuxt/{vnodes.accdbda6.js → vnodes.63fa6e05.js} +1 -1
  14. package/dist/client/index.html +4 -4
  15. package/dist/client/options/index.html +4 -4
  16. package/dist/client/png/index.html +4 -4
  17. package/dist/client/svg/index.html +4 -4
  18. package/dist/client/vnodes/index.html +4 -4
  19. package/dist/module.d.mts +1 -1
  20. package/dist/module.d.ts +1 -1
  21. package/dist/module.json +1 -1
  22. package/dist/module.mjs +10 -9
  23. package/dist/runtime/composables/defineOgImage.d.ts +2 -0
  24. package/dist/runtime/nitro/providers/{inline-css/node.d.ts → css-inline/css-inline.d.ts} +1 -1
  25. package/dist/runtime/nitro/providers/css-inline/css-inline.mjs +10 -0
  26. package/dist/runtime/nitro/routes/html.mjs +4 -4
  27. package/dist/runtime/nitro/utils-pure.mjs +1 -1
  28. package/package.json +18 -18
  29. package/dist/client/_nuxt/entry.6bb89c31.js +0 -136
  30. package/dist/runtime/nitro/providers/inline-css/node.mjs +0 -11
  31. /package/dist/runtime/nitro/providers/{inline-css → css-inline}/mock.d.ts +0 -0
  32. /package/dist/runtime/nitro/providers/{inline-css → css-inline}/mock.mjs +0 -0
@@ -1,4 +1,4 @@
1
- declare function nodeFn(html: string, options: any): any;
1
+ declare function nodeFn(html: string, options: any): string;
2
2
  declare namespace nodeFn {
3
3
  var __mock: boolean;
4
4
  }
@@ -0,0 +1,10 @@
1
+ import { inline } from "css-inline";
2
+ function nodeFn(html, options) {
3
+ return inline(html, {
4
+ ...options,
5
+ load_remote_stylesheets: false,
6
+ keep_style_tags: false
7
+ });
8
+ }
9
+ nodeFn.__mock = false;
10
+ export default nodeFn;
@@ -7,7 +7,7 @@ import twemoji from "twemoji";
7
7
  import { defu } from "defu";
8
8
  import { fetchOptionsCached } from "../utils.mjs";
9
9
  import { useNitroOrigin, useRuntimeConfig } from "#imports";
10
- import loadInlineCSS from "#nuxt-og-image/inline-css";
10
+ import loadCSSInline from "#nuxt-og-image/css-inline";
11
11
  export default defineEventHandler(async (e) => {
12
12
  const { fonts, satoriOptions } = useRuntimeConfig()["nuxt-og-image"];
13
13
  const query = getQuery(e);
@@ -130,8 +130,8 @@ img.emoji {
130
130
  <head>${headChunk.headTags}</head>
131
131
  <body ${headChunk.bodyAttrs}>${headChunk.bodyTagsOpen}<div style="position: relative; display: flex; margin: 0 auto; width: ${options.width}px; height: ${options.height}px; overflow: hidden;">${html}</div>${headChunk.bodyTags}</body>
132
132
  </html>`;
133
- const inlineCss = loadInlineCSS();
134
- if (!inlineCss.__mock) {
133
+ const cssInline = loadCSSInline();
134
+ if (!cssInline.__mock) {
135
135
  let hasInlineStyles = false;
136
136
  const stylesheets = htmlTemplate.match(/<link rel="stylesheet" href=".*?">/g);
137
137
  if (stylesheets) {
@@ -157,7 +157,7 @@ img.emoji {
157
157
  }
158
158
  if (hasInlineStyles) {
159
159
  try {
160
- htmlTemplate = await inlineCss(htmlTemplate, {
160
+ htmlTemplate = await cssInline(htmlTemplate, {
161
161
  url: nitroOrigin
162
162
  });
163
163
  } catch {
@@ -12,7 +12,7 @@ function decodeObjectHtmlEntities(obj) {
12
12
  return obj;
13
13
  }
14
14
  export function extractAndNormaliseOgImageOptions(path, html, routeRules, defaults) {
15
- const htmlPayload = html.match(/<script id="nuxt-og-image-options" type="application\/json">(.+?)<\/script>/)?.[1];
15
+ const htmlPayload = html.match(/<script.+id="nuxt-og-image-options"[^>]*>(.+?)<\/script>/)?.[1];
16
16
  if (!htmlPayload)
17
17
  return false;
18
18
  let options;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "nuxt-og-image",
3
3
  "type": "module",
4
- "version": "2.0.26",
5
- "packageManager": "pnpm@8.7.4",
4
+ "version": "2.1.0-beta.0",
5
+ "packageManager": "pnpm@8.7.6",
6
6
  "description": "Enlightened OG Image generation for Nuxt.",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -27,31 +27,31 @@
27
27
  "dist"
28
28
  ],
29
29
  "dependencies": {
30
- "@nuxt/kit": "^3.7.1",
30
+ "@nuxt/kit": "^3.7.3",
31
31
  "@resvg/resvg-js": "^2.4.1",
32
32
  "@resvg/resvg-wasm": "^2.4.1",
33
- "@types/fs-extra": "^11.0.1",
33
+ "@types/fs-extra": "^11.0.2",
34
34
  "birpc": "0.2.14",
35
35
  "chalk": "^5.3.0",
36
36
  "chrome-launcher": "^1.0.0",
37
+ "css-inline": "^0.10.5",
37
38
  "defu": "^6.1.2",
38
39
  "execa": "^8.0.1",
39
40
  "fast-glob": "^3.3.1",
40
- "flatted": "^3.2.7",
41
+ "flatted": "^3.2.9",
41
42
  "fs-extra": "^11.1.1",
42
43
  "globby": "^13.2.2",
43
44
  "image-size": "^1.0.2",
44
- "inline-css": "^4.0.2",
45
45
  "launch-editor": "^2.6.0",
46
- "nuxt-site-config": "^1.1.0",
47
- "nuxt-site-config-kit": "^1.1.0",
48
- "nypm": "^0.3.2",
46
+ "nuxt-site-config": "^1.3.0",
47
+ "nuxt-site-config-kit": "^1.3.0",
48
+ "nypm": "^0.3.3",
49
49
  "ofetch": "^1.3.3",
50
50
  "ohash": "^1.1.3",
51
51
  "pathe": "^1.1.1",
52
- "playwright-core": "^1.37.1",
52
+ "playwright-core": "^1.38.0",
53
53
  "radix3": "^1.1.0",
54
- "satori": "0.10.4",
54
+ "satori": "0.10.7",
55
55
  "satori-html": "^0.3.2",
56
56
  "sirv": "^2.0.3",
57
57
  "std-env": "^3.4.3",
@@ -60,23 +60,23 @@
60
60
  "tinyws": "^0.1.0",
61
61
  "twemoji": "^14.0.2",
62
62
  "ufo": "^1.3.0",
63
- "ws": "^8.14.1",
63
+ "ws": "^8.14.2",
64
64
  "yoga-wasm-web": "^0.3.3"
65
65
  },
66
66
  "devDependencies": {
67
- "@antfu/eslint-config": "^0.41.0",
68
- "@nuxt/devtools": "0.8.3",
67
+ "@antfu/eslint-config": "^0.43.0",
68
+ "@nuxt/devtools": "0.8.4",
69
69
  "@nuxt/module-builder": "^0.5.1",
70
- "@nuxt/test-utils": "3.7.1",
70
+ "@nuxt/test-utils": "3.7.3",
71
71
  "@nuxtjs/eslint-config-typescript": "^12.1.0",
72
72
  "@types/ws": "^8.5.5",
73
73
  "bumpp": "^9.2.0",
74
74
  "eslint": "8.49.0",
75
75
  "jest-image-snapshot": "^6.2.0",
76
- "nuxt": "^3.7.1",
76
+ "nuxt": "^3.7.3",
77
77
  "nuxt-icon": "^0.5.0",
78
- "playwright": "^1.37.1",
79
- "sass": "^1.66.1",
78
+ "playwright": "^1.38.0",
79
+ "sass": "^1.67.0",
80
80
  "vitest": "^0.34.4"
81
81
  },
82
82
  "scripts": {