nuxt-og-image 1.0.0-beta.4 → 1.0.0-beta.5
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
package/dist/module.mjs
CHANGED
|
@@ -69,10 +69,7 @@ function exposeConfig(alias, filename, config) {
|
|
|
69
69
|
}
|
|
70
70
|
function extractOgImageOptions(html) {
|
|
71
71
|
const options = html.match(/<script id="nuxt-og-image-options" type="application\/json">(.+?)<\/script>/)?.[1];
|
|
72
|
-
|
|
73
|
-
return JSON.parse(options);
|
|
74
|
-
}
|
|
75
|
-
return false;
|
|
72
|
+
return options ? JSON.parse(options) : false;
|
|
76
73
|
}
|
|
77
74
|
function stripOgImageOptions(html) {
|
|
78
75
|
return html.replace(/<script id="nuxt-og-image-options" type="application\/json">(.*?)<\/script>/, "");
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { OgImageOptions } from '../../../../types';
|
|
2
|
+
export declare function extractOgImageOptions(html: string): any;
|
|
2
3
|
export declare const inferOgImageOptions: (html: string) => OgImageOptions;
|
|
3
4
|
declare const _default: import("h3").EventHandler<false | OgImageOptions | undefined>;
|
|
4
5
|
export default _default;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { parseURL, withoutTrailingSlash } from "ufo";
|
|
2
2
|
import { defineEventHandler, getQuery } from "h3";
|
|
3
|
-
import { extractOgImageOptions } from "../../../../utils";
|
|
4
3
|
import { getRouteRules } from "#internal/nitro";
|
|
5
4
|
import { defaults } from "#nuxt-og-image/config";
|
|
5
|
+
export function extractOgImageOptions(html) {
|
|
6
|
+
const options = html.match(/<script id="nuxt-og-image-options" type="application\/json">(.+?)<\/script>/)?.[1];
|
|
7
|
+
return options ? JSON.parse(options) : false;
|
|
8
|
+
}
|
|
6
9
|
export const inferOgImageOptions = (html) => {
|
|
7
10
|
const options = {};
|
|
8
11
|
const title = html.match(/<meta property="og:title" content="(.*?)">/)?.[1];
|