nuxt-og-image 2.0.0-beta.9 → 2.0.1

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 (120) hide show
  1. package/README.md +18 -517
  2. package/dist/client/200.html +2 -2
  3. package/dist/client/404.html +2 -2
  4. package/dist/client/_nuxt/IconCSS.685477c5.js +1 -0
  5. package/dist/client/_nuxt/IconCSS.b41b9663.css +1 -0
  6. package/dist/client/_nuxt/ImageLoader.7571516f.css +1 -0
  7. package/dist/client/_nuxt/ImageLoader.fb4e5eb3.js +1 -0
  8. package/dist/client/_nuxt/entry.0fc037e0.js +143 -0
  9. package/dist/client/_nuxt/entry.1311cc29.css +1 -0
  10. package/dist/client/_nuxt/{error-404.02537f9e.js → error-404.068f19dd.js} +1 -1
  11. package/dist/client/_nuxt/error-404.f3dd5020.css +1 -0
  12. package/dist/client/_nuxt/error-500.06915589.css +1 -0
  13. package/dist/client/_nuxt/{error-500.a60bf0b5.js → error-500.4d72610e.js} +1 -1
  14. package/dist/client/_nuxt/index.33389497.js +1 -0
  15. package/dist/client/_nuxt/index.ffbea0a9.css +1 -0
  16. package/dist/client/_nuxt/options.e1a971ea.js +1 -0
  17. package/dist/client/_nuxt/png.110ab8f5.js +1 -0
  18. package/dist/client/_nuxt/{shiki.aace8ca2.js → shiki.3fe159de.js} +1 -1
  19. package/dist/client/_nuxt/svg.1a58cdf3.js +1 -0
  20. package/dist/client/_nuxt/vnodes.42fbc6e6.js +1 -0
  21. package/dist/client/index.html +2 -2
  22. package/dist/client/options/index.html +2 -2
  23. package/dist/client/png/index.html +2 -2
  24. package/dist/client/svg/index.html +2 -2
  25. package/dist/client/vnodes/index.html +2 -2
  26. package/dist/module.d.ts +117 -11
  27. package/dist/module.json +2 -2
  28. package/dist/module.mjs +391 -114
  29. package/dist/runtime/browserUtil.d.ts +1 -0
  30. package/dist/runtime/browserUtil.mjs +7 -5
  31. package/dist/runtime/components/{OgImageDynamic.d.ts → OgImage/Cached.d.ts} +2 -2
  32. package/dist/runtime/components/OgImage/Cached.mjs +10 -0
  33. package/dist/runtime/components/OgImage/Dynamic.d.ts +8 -0
  34. package/dist/runtime/components/{OgImageDynamic.mjs → OgImage/Dynamic.mjs} +3 -3
  35. package/dist/runtime/components/{OgImageScreenshot.d.ts → OgImage/Screenshot.d.ts} +2 -2
  36. package/dist/runtime/components/{OgImageScreenshot.mjs → OgImage/Screenshot.mjs} +2 -2
  37. package/dist/runtime/components/OgImage/Static.d.ts +8 -0
  38. package/dist/runtime/components/{OgImageStatic.mjs → OgImage/Static.mjs} +3 -3
  39. package/dist/runtime/components/{OgImageStatic.d.ts → OgImage/WithoutCache.d.ts} +2 -2
  40. package/dist/runtime/components/OgImage/WithoutCache.mjs +10 -0
  41. package/dist/runtime/components/OgImage/index.d.ts +5 -0
  42. package/dist/runtime/components/OgImage/index.mjs +10 -0
  43. package/dist/runtime/components/OgImageTemplate/Fallback.vue +156 -0
  44. package/dist/runtime/composables/defineOgImage.d.ts +12 -4
  45. package/dist/runtime/composables/defineOgImage.mjs +31 -49
  46. package/dist/runtime/composables/util.d.ts +2 -0
  47. package/dist/runtime/composables/util.mjs +26 -0
  48. package/dist/runtime/nitro/middleware/og.png.mjs +54 -8
  49. package/dist/runtime/nitro/plugins/prerender.d.ts +3 -0
  50. package/dist/runtime/nitro/plugins/prerender.mjs +28 -0
  51. package/dist/runtime/nitro/providers/browser/lambda.d.ts +1 -1
  52. package/dist/runtime/nitro/providers/browser/lambda.mjs +3 -3
  53. package/dist/runtime/nitro/providers/browser/{node.mjs → playwright.mjs} +0 -9
  54. package/dist/runtime/nitro/providers/browser/universal.d.ts +1 -0
  55. package/dist/runtime/nitro/providers/browser/universal.mjs +33 -0
  56. package/dist/runtime/nitro/providers/inline-css/mock.d.ts +5 -0
  57. package/dist/runtime/nitro/providers/inline-css/mock.mjs +3 -0
  58. package/dist/runtime/nitro/providers/inline-css/node.d.ts +5 -0
  59. package/dist/runtime/nitro/providers/inline-css/node.mjs +11 -0
  60. package/dist/runtime/nitro/providers/png/resvg-node.d.ts +4 -0
  61. package/dist/runtime/nitro/providers/png/resvg-node.mjs +6 -0
  62. package/dist/runtime/nitro/providers/png/resvg-wasm.d.ts +3 -0
  63. package/dist/runtime/nitro/providers/png/resvg-wasm.mjs +11 -0
  64. package/dist/runtime/nitro/providers/{svg2png/universal.d.ts → png/svg2png.d.ts} +2 -3
  65. package/dist/runtime/nitro/providers/png/svg2png.mjs +11 -0
  66. package/dist/runtime/nitro/providers/satori/{webworker.d.ts → yoga-wasm.d.ts} +2 -3
  67. package/dist/runtime/nitro/providers/satori/{webworker.mjs → yoga-wasm.mjs} +4 -5
  68. package/dist/runtime/nitro/renderers/browser.d.ts +2 -2
  69. package/dist/runtime/nitro/renderers/browser.mjs +14 -12
  70. package/dist/runtime/nitro/renderers/satori/index.d.ts +2 -2
  71. package/dist/runtime/nitro/renderers/satori/index.mjs +27 -32
  72. package/dist/runtime/nitro/renderers/satori/plugins/emojis.d.ts +1 -1
  73. package/dist/runtime/nitro/renderers/satori/plugins/emojis.mjs +19 -6
  74. package/dist/runtime/nitro/renderers/satori/plugins/encoding.d.ts +1 -1
  75. package/dist/runtime/nitro/renderers/satori/plugins/encoding.mjs +5 -7
  76. package/dist/runtime/nitro/renderers/satori/plugins/flex.d.ts +1 -1
  77. package/dist/runtime/nitro/renderers/satori/plugins/flex.mjs +8 -10
  78. package/dist/runtime/nitro/renderers/satori/plugins/imageSrc.d.ts +1 -1
  79. package/dist/runtime/nitro/renderers/satori/plugins/imageSrc.mjs +45 -13
  80. package/dist/runtime/nitro/renderers/satori/plugins/twClasses.d.ts +1 -1
  81. package/dist/runtime/nitro/renderers/satori/plugins/twClasses.mjs +5 -7
  82. package/dist/runtime/nitro/renderers/satori/utils.d.ts +4 -5
  83. package/dist/runtime/nitro/renderers/satori/utils.mjs +28 -17
  84. package/dist/runtime/nitro/routes/debug.d.ts +8 -0
  85. package/dist/runtime/nitro/routes/debug.mjs +14 -0
  86. package/dist/runtime/nitro/routes/font.mjs +2 -2
  87. package/dist/runtime/nitro/routes/html.mjs +102 -26
  88. package/dist/runtime/nitro/routes/options.d.ts +2 -2
  89. package/dist/runtime/nitro/routes/options.mjs +21 -20
  90. package/dist/runtime/nitro/routes/svg.mjs +2 -2
  91. package/dist/runtime/nitro/routes/vnode.mjs +2 -2
  92. package/dist/runtime/nitro/utils-pure.d.ts +0 -1
  93. package/dist/runtime/nitro/utils-pure.mjs +1 -4
  94. package/dist/runtime/nitro/utils.d.ts +11 -11
  95. package/dist/runtime/nitro/utils.mjs +67 -53
  96. package/dist/runtime/public-assets/__nuxt_og_image__/browser-provider-not-supported.png +0 -0
  97. package/dist/runtime/public-assets-optional/resvg/resvg.wasm +0 -0
  98. package/dist/types.d.ts +6 -0
  99. package/package.json +38 -27
  100. package/dist/client/_nuxt/IconCSS.ef0613e7.js +0 -1
  101. package/dist/client/_nuxt/ImageLoader.a4418cab.js +0 -1
  102. package/dist/client/_nuxt/entry.09f25aaf.css +0 -1
  103. package/dist/client/_nuxt/entry.fc9150b0.js +0 -5
  104. package/dist/client/_nuxt/error-404.1469f10f.css +0 -1
  105. package/dist/client/_nuxt/error-500.92b94fae.css +0 -1
  106. package/dist/client/_nuxt/error-component.8148b615.js +0 -3
  107. package/dist/client/_nuxt/index.80f38ec7.js +0 -1
  108. package/dist/client/_nuxt/options.cc3fd02b.js +0 -1
  109. package/dist/client/_nuxt/png.62758167.js +0 -1
  110. package/dist/client/_nuxt/svg.853cdaad.js +0 -1
  111. package/dist/client/_nuxt/vnodes.69b24963.js +0 -1
  112. package/dist/runtime/components/OgImageBasic.island.vue +0 -92
  113. package/dist/runtime/nitro/providers/svg2png/universal.mjs +0 -9
  114. /package/dist/runtime/nitro/providers/browser/{node.d.ts → playwright.d.ts} +0 -0
  115. /package/dist/runtime/nitro/providers/satori/{node.d.ts → default.d.ts} +0 -0
  116. /package/dist/runtime/nitro/providers/satori/{node.mjs → default.mjs} +0 -0
  117. /package/dist/runtime/{public-assets → public-assets-optional/inter-font}/inter-latin-ext-400-normal.woff +0 -0
  118. /package/dist/runtime/{public-assets → public-assets-optional/inter-font}/inter-latin-ext-700-normal.woff +0 -0
  119. /package/dist/runtime/{public-assets → public-assets-optional/svg2png}/svg2png.wasm +0 -0
  120. /package/dist/runtime/{public-assets → public-assets-optional/yoga}/yoga.wasm +0 -0
package/dist/module.d.ts CHANGED
@@ -24,30 +24,136 @@ interface ScreenshotOptions {
24
24
  }
25
25
  interface OgImageOptions extends Partial<ScreenshotOptions> {
26
26
  provider?: 'browser' | 'satori';
27
- static?: boolean;
28
27
  title?: string;
29
28
  description?: string;
30
29
  component?: string | null;
31
30
  alt?: string;
31
+ cache?: boolean;
32
+ cacheKey?: string;
33
+ cacheTtl?: number;
34
+ /**
35
+ * @deprecated Use `cache` instead
36
+ */
37
+ static?: boolean;
32
38
  [key: string]: any;
33
39
  }
40
+ interface FontConfig {
41
+ name: string;
42
+ weight: number;
43
+ path?: string;
44
+ }
45
+ type InputFontConfig = (`${string}:${number}` | FontConfig);
46
+
47
+ interface RuntimeCompatibilitySchema {
48
+ browser: false | 'playwright' | 'lambda' | 'universal';
49
+ satori: false | 'default' | 'yoga-wasm';
50
+ wasm: 'inline' | 'import' | 'fetch';
51
+ png: 'resvg-wasm' | 'svg2png' | 'resvg-node';
52
+ inlineCss?: 'node' | 'mock';
53
+ node?: boolean;
54
+ wasmImportQuery?: string;
55
+ }
34
56
 
35
57
  interface ModuleOptions {
36
58
  /**
37
- * The hostname of your website.
38
- * @deprecated use `siteUrl`
59
+ * Whether the og:image images should be generated.
60
+ *
61
+ * @default true
62
+ */
63
+ enabled: boolean;
64
+ /**
65
+ * Default data used within the payload to generate the OG Image.
66
+ *
67
+ * You can use this to change the default template, image sizing and more.
68
+ *
69
+ * @default { component: 'OgImageTemplateFallback', width: 1200, height: 630, cache: true, cacheTtl: 24 * 60 * 60 * 1000 }
39
70
  */
40
- host?: string;
41
- siteUrl: string;
42
71
  defaults: OgImageOptions;
43
- fonts: `${string}:${number}`[];
72
+ /**
73
+ * Fonts to use when rendering the og:image.
74
+ *
75
+ * @example ['Roboto:400,700', { path: 'path/to/font.ttf', weight: 400, name: 'MyFont' }]
76
+ */
77
+ fonts: InputFontConfig[];
78
+ /**
79
+ * Options to pass to satori.
80
+ *
81
+ * @see https://github.com/vercel/satori/blob/main/src/satori.ts#L18
82
+ */
44
83
  satoriOptions: Partial<SatoriOptions>;
45
- forcePrerender: boolean;
46
- satoriProvider: boolean;
47
- browserProvider: boolean;
48
- experimentalInlineWasm: boolean;
49
- experimentalRuntimeBrowser: boolean;
84
+ /**
85
+ * Should the playground at <path>/__og_image__ be enabled in development.
86
+ *
87
+ * @default true
88
+ */
50
89
  playground: boolean;
90
+ /**
91
+ * Include Satori runtime.
92
+ *
93
+ * @default true
94
+ */
95
+ runtimeSatori: boolean;
96
+ /**
97
+ * Include the Browser runtime.
98
+ * This will need to be manually enabled for production environments.
99
+ *
100
+ * @default `process.dev`
101
+ */
102
+ runtimeBrowser: boolean;
103
+ /**
104
+ * Enables debug logs and a debug endpoint.
105
+ *
106
+ * @false false
107
+ */
108
+ debug: boolean;
109
+ /**
110
+ * Modify the cache behavior.
111
+ *
112
+ * Passing a boolean will enable or disable the runtime cache with the default options.
113
+ *
114
+ * Providing a record will allow you to configure the runtime cache fully.
115
+ *
116
+ * @default true
117
+ * @see https://nitro.unjs.io/guide/storage#mountpoints
118
+ * @example { driver: 'redis', host: 'localhost', port: 6379, password: 'password' }
119
+ */
120
+ runtimeCacheStorage: boolean | (Record<string, any> & {
121
+ driver: string;
122
+ });
123
+ /**
124
+ * Extra component directories that should be used to resolve components.
125
+ *
126
+ * @default ['OgImage', 'OgImageTemplate']
127
+ */
128
+ componentDirs: string[];
129
+ /**
130
+ * Manually modify the deployment compatibility.
131
+ *
132
+ * @default { browser: 'playwright', satori: 'default', wasm: 'fetch', png: 'resvg-node' }
133
+ */
134
+ runtimeCompatibility: RuntimeCompatibilitySchema;
135
+ /**
136
+ * The url of your site.
137
+ * Used to generate absolute URLs for the og:image.
138
+ *
139
+ * Note: This is only required when prerendering your site.
140
+ *
141
+ * @deprecated Provide `url` through site config instead: `{ site: { url: <value> }}`.
142
+ * This is powered by the `nuxt-site-config` module.
143
+ * @see https://github.com/harlan-zw/nuxt-site-config
144
+ */
145
+ host?: string;
146
+ /**
147
+ * The url of your site.
148
+ * Used to generate absolute URLs for the og:image.
149
+ *
150
+ * Note: This is only required when prerendering your site.
151
+ *
152
+ * @deprecated Provide `url` through site config instead: `{ site: { url: <value> }}`.
153
+ * This is powered by the `nuxt-site-config` module.
154
+ * @see https://github.com/harlan-zw/nuxt-site-config
155
+ */
156
+ siteUrl?: string;
51
157
  }
52
158
  interface ModuleHooks {
53
159
  'og-image:config': (config: ModuleOptions) => Promise<void> | void;
package/dist/module.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "nuxt-og-image",
3
3
  "compatibility": {
4
- "nuxt": "^3.3.1",
4
+ "nuxt": "^3.6.1",
5
5
  "bridge": false
6
6
  },
7
7
  "configKey": "ogImage",
8
- "version": "2.0.0-beta.9"
8
+ "version": "2.0.1"
9
9
  }