nuxt-og-image 2.0.0-beta.21 → 2.0.0-beta.23
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/README.md +84 -15
- package/dist/client/200.html +2 -2
- package/dist/client/404.html +2 -2
- package/dist/client/_nuxt/IconCSS.43d4aac0.js +1 -0
- package/dist/client/_nuxt/{ImageLoader.97400b2b.js → ImageLoader.2a785570.js} +1 -1
- package/dist/client/_nuxt/{entry.7e98a020.css → entry.18f17aaf.css} +1 -1
- package/dist/client/_nuxt/{entry.c8bf4454.js → entry.c18651be.js} +2 -2
- package/dist/client/_nuxt/{error-404.7660b68a.js → error-404.fff71201.js} +1 -1
- package/dist/client/_nuxt/{error-500.776f22a1.js → error-500.3c055c8c.js} +1 -1
- package/dist/client/_nuxt/{error-component.d4668032.js → error-component.cb35ddb1.js} +2 -2
- package/dist/client/_nuxt/{index.77081a6c.js → index.5951bf19.js} +1 -1
- package/dist/client/_nuxt/{options.b6164a5b.js → options.5fc0b357.js} +1 -1
- package/dist/client/_nuxt/{png.b914f6c4.js → png.949f30be.js} +1 -1
- package/dist/client/_nuxt/{shiki.ba10b978.js → shiki.3298b095.js} +1 -1
- package/dist/client/_nuxt/{svg.1e41877e.js → svg.57b8aba8.js} +1 -1
- package/dist/client/_nuxt/{vnodes.a857bced.js → vnodes.f66bf3d7.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/client/options/index.html +2 -2
- package/dist/client/png/index.html +2 -2
- package/dist/client/svg/index.html +2 -2
- package/dist/client/vnodes/index.html +2 -2
- package/dist/module.d.ts +15 -5
- package/dist/module.json +1 -1
- package/dist/module.mjs +194 -84
- package/dist/runtime/browserUtil.mjs +5 -3
- package/dist/runtime/composables/defineOgImage.mjs +10 -7
- package/dist/runtime/nitro/middleware/og.png.mjs +43 -15
- package/dist/runtime/nitro/plugins/prerender.mjs +1 -3
- package/dist/runtime/nitro/providers/browser/lambda.d.ts +1 -1
- package/dist/runtime/nitro/providers/browser/lambda.mjs +5 -5
- package/dist/runtime/nitro/providers/browser/playwright.mjs +22 -0
- package/dist/runtime/nitro/providers/browser/universal.d.ts +1 -0
- package/dist/runtime/nitro/providers/png/resvg.d.ts +4 -0
- package/dist/runtime/nitro/providers/png/resvg.mjs +11 -0
- package/dist/runtime/nitro/providers/png/svg2png.mjs +11 -0
- package/dist/runtime/nitro/providers/satori/{webworker.mjs → yoga-wasm.mjs} +4 -5
- package/dist/runtime/nitro/renderers/browser.mjs +7 -6
- package/dist/runtime/nitro/renderers/satori/index.mjs +15 -13
- package/dist/runtime/nitro/renderers/satori/plugins/imageSrc.mjs +27 -3
- package/dist/runtime/nitro/routes/debug.d.ts +4 -0
- package/dist/runtime/nitro/routes/debug.mjs +9 -0
- package/dist/runtime/nitro/routes/html.mjs +11 -3
- package/dist/runtime/nitro/routes/options.mjs +15 -14
- package/dist/runtime/nitro/utils.d.ts +4 -7
- package/dist/runtime/nitro/utils.mjs +42 -34
- package/dist/runtime/public-assets/__nuxt_og_image__/browser-provider-not-supported.png +0 -0
- package/dist/runtime/public-assets-optional/resvg/resvg.wasm +0 -0
- package/package.json +15 -8
- package/dist/client/_nuxt/IconCSS.ecebf6a5.js +0 -1
- package/dist/runtime/nitro/providers/svg2png/universal.mjs +0 -12
- /package/dist/runtime/nitro/providers/browser/{node.d.ts → playwright.d.ts} +0 -0
- /package/dist/runtime/nitro/providers/browser/{node.mjs → universal.mjs} +0 -0
- /package/dist/runtime/nitro/providers/{svg2png/universal.d.ts → png/svg2png.d.ts} +0 -0
- /package/dist/runtime/nitro/providers/satori/{node.d.ts → default.d.ts} +0 -0
- /package/dist/runtime/nitro/providers/satori/{node.mjs → default.mjs} +0 -0
- /package/dist/runtime/nitro/providers/satori/{webworker.d.ts → yoga-wasm.d.ts} +0 -0
- /package/dist/runtime/{public-assets → public-assets-optional/inter-font}/inter-latin-ext-400-normal.woff +0 -0
- /package/dist/runtime/{public-assets → public-assets-optional/inter-font}/inter-latin-ext-700-normal.woff +0 -0
- /package/dist/runtime/{public-assets → public-assets-optional/svg2png}/svg2png.wasm +0 -0
- /package/dist/runtime/{public-assets → public-assets-optional/yoga}/yoga.wasm +0 -0
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import satori, { init } from "satori/wasm";
|
|
2
2
|
import initYoga from "yoga-wasm-web";
|
|
3
3
|
import { wasmLoader } from "../../utils.mjs";
|
|
4
|
+
const YogaLoader = wasmLoader("/* NUXT_OG_IMAGE_YOGA_WASM */", "/yoga.wasm");
|
|
4
5
|
export default async function(nodes, options) {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
init(yoga);
|
|
9
|
-
}
|
|
6
|
+
const yogaWasm = await YogaLoader.load({ baseUrl: options.baseUrl });
|
|
7
|
+
const yoga = await initYoga(yogaWasm);
|
|
8
|
+
init(yoga);
|
|
10
9
|
return await satori(nodes, options);
|
|
11
10
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { withBase } from "ufo";
|
|
2
2
|
import { screenshot } from "../../browserUtil.mjs";
|
|
3
|
-
import
|
|
3
|
+
import loadBrowserLauncherChunk from "#nuxt-og-image/browser";
|
|
4
4
|
import { useRuntimeConfig } from "#imports";
|
|
5
5
|
export default {
|
|
6
6
|
name: "browser",
|
|
@@ -12,14 +12,15 @@ export default {
|
|
|
12
12
|
},
|
|
13
13
|
createPng: async function createPng(basePath, options) {
|
|
14
14
|
const url = new URL(basePath);
|
|
15
|
-
const
|
|
16
|
-
if (!
|
|
15
|
+
const launchBrowser = await loadBrowserLauncherChunk();
|
|
16
|
+
if (!launchBrowser) {
|
|
17
17
|
throw new Error("Failed to load browser. Is the `browserProvider` enabled?");
|
|
18
18
|
}
|
|
19
|
-
const browser = await
|
|
19
|
+
const browser = await launchBrowser();
|
|
20
|
+
let res = null;
|
|
20
21
|
if (browser) {
|
|
21
22
|
try {
|
|
22
|
-
|
|
23
|
+
res = await screenshot(browser, {
|
|
23
24
|
...options,
|
|
24
25
|
host: withBase(useRuntimeConfig().app.baseURL, url.origin),
|
|
25
26
|
path: `/api/og-image-html?path=${url.pathname}`
|
|
@@ -28,6 +29,6 @@ export default {
|
|
|
28
29
|
browser.close();
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
|
-
return
|
|
32
|
+
return res;
|
|
32
33
|
}
|
|
33
34
|
};
|
|
@@ -7,9 +7,9 @@ import twClasses from "./plugins/twClasses.mjs";
|
|
|
7
7
|
import flex from "./plugins/flex.mjs";
|
|
8
8
|
import emojis from "./plugins/emojis.mjs";
|
|
9
9
|
import encoding from "./plugins/encoding.mjs";
|
|
10
|
-
import
|
|
10
|
+
import loadPngCreator from "#nuxt-og-image/png";
|
|
11
11
|
import loadSatori from "#nuxt-og-image/satori";
|
|
12
|
-
import { useRuntimeConfig } from "#internal/nitro";
|
|
12
|
+
import { useNitroApp, useRuntimeConfig } from "#internal/nitro";
|
|
13
13
|
const satoriFonts = [];
|
|
14
14
|
let fontLoadPromise = null;
|
|
15
15
|
function loadFonts(fonts) {
|
|
@@ -21,20 +21,22 @@ export default {
|
|
|
21
21
|
name: "satori",
|
|
22
22
|
createPng: async function createPng(baseUrl, options) {
|
|
23
23
|
const svg = await this.createSvg(baseUrl, options);
|
|
24
|
-
const
|
|
25
|
-
return
|
|
24
|
+
const pngCreator = await loadPngCreator();
|
|
25
|
+
return pngCreator(svg, { baseUrl, ...options });
|
|
26
26
|
},
|
|
27
27
|
createVNode: async function createVNode(baseUrl, options) {
|
|
28
28
|
const url = parseURL(baseUrl);
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
const nitroApp = useNitroApp();
|
|
30
|
+
const html = await (await nitroApp.localFetch(`/api/og-image-html?path=${url.pathname}&options=${encodeURI(JSON.stringify(options))}`)).text();
|
|
31
|
+
let body = html.match(/<body[^>]*>([\s\S]*)<\/body>/)?.[1] || "";
|
|
32
|
+
try {
|
|
33
|
+
body = twemoji.parse(body, {
|
|
34
|
+
folder: "svg",
|
|
35
|
+
ext: ".svg"
|
|
36
|
+
});
|
|
37
|
+
} catch (e) {
|
|
38
|
+
}
|
|
39
|
+
const satoriTree = convertHtmlToSatori(body);
|
|
38
40
|
await walkSatoriTree(url, satoriTree, [
|
|
39
41
|
// @todo add user land support
|
|
40
42
|
emojis(url),
|
|
@@ -1,17 +1,41 @@
|
|
|
1
1
|
import { withBase } from "ufo";
|
|
2
2
|
import { defineSatoriTransformer } from "../utils.mjs";
|
|
3
3
|
import { readPublicAssetBase64 } from "../../../utils.mjs";
|
|
4
|
+
import { useNitroApp } from "#internal/nitro";
|
|
4
5
|
export default defineSatoriTransformer((url) => {
|
|
5
6
|
return {
|
|
6
7
|
filter: (node) => node.type === "img",
|
|
7
8
|
transform: async (node) => {
|
|
8
9
|
const src = node.props?.src;
|
|
9
10
|
if (src && src.startsWith("/")) {
|
|
11
|
+
let updated = false;
|
|
10
12
|
const file = await readPublicAssetBase64(src);
|
|
11
|
-
if (file)
|
|
13
|
+
if (file) {
|
|
12
14
|
node.props.src = file;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
updated = true;
|
|
16
|
+
}
|
|
17
|
+
if (!updated) {
|
|
18
|
+
try {
|
|
19
|
+
const response = await globalThis.$fetch(src);
|
|
20
|
+
node.props.src = response.arrayBuffer();
|
|
21
|
+
updated = true;
|
|
22
|
+
} catch (e) {
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (!updated) {
|
|
26
|
+
const nitroApp = useNitroApp();
|
|
27
|
+
try {
|
|
28
|
+
const response = await nitroApp.localFetch(src);
|
|
29
|
+
if (response.status === 200) {
|
|
30
|
+
node.props.src = response.arrayBuffer();
|
|
31
|
+
updated = true;
|
|
32
|
+
}
|
|
33
|
+
} catch (e) {
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (!updated) {
|
|
37
|
+
node.props.src = `${withBase(src, `${url.protocol}//${url.host}`)}?${Date.now()}`;
|
|
38
|
+
}
|
|
15
39
|
}
|
|
16
40
|
}
|
|
17
41
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { defineEventHandler, setHeader } from "h3";
|
|
2
|
+
import { useRuntimeConfig } from "#imports";
|
|
3
|
+
export default defineEventHandler(async (e) => {
|
|
4
|
+
setHeader(e, "Content-Type", "application/json");
|
|
5
|
+
const runtimeConfig = useRuntimeConfig()["nuxt-og-image"];
|
|
6
|
+
return {
|
|
7
|
+
runtimeConfig
|
|
8
|
+
};
|
|
9
|
+
});
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { withBase } from "ufo";
|
|
2
2
|
import { renderSSRHead } from "@unhead/ssr";
|
|
3
3
|
import { createHeadCore } from "@unhead/vue";
|
|
4
|
-
import { defineEventHandler, getQuery, sendRedirect } from "h3";
|
|
5
|
-
import { fetchOptions,
|
|
4
|
+
import { createError, defineEventHandler, getQuery, sendRedirect } from "h3";
|
|
5
|
+
import { fetchOptions, useHostname } from "../utils.mjs";
|
|
6
6
|
import { useRuntimeConfig } from "#imports";
|
|
7
|
+
import { useNitroApp } from "#internal/nitro";
|
|
7
8
|
export default defineEventHandler(async (e) => {
|
|
8
9
|
const { fonts, defaults } = useRuntimeConfig()["nuxt-og-image"];
|
|
9
10
|
const query = getQuery(e);
|
|
@@ -19,7 +20,14 @@ export default defineEventHandler(async (e) => {
|
|
|
19
20
|
const pathWithoutBase = path.replace(new RegExp(`^${useRuntimeConfig().app.baseURL}`), "");
|
|
20
21
|
return sendRedirect(e, withBase(pathWithoutBase, useHostname(e)));
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
+
if (!options.component) {
|
|
24
|
+
throw createError({
|
|
25
|
+
statusCode: 500,
|
|
26
|
+
statusMessage: `Nuxt OG Image trying to render an invalid component. Received options ${JSON.stringify(options)}`
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
const nitroApp = useNitroApp();
|
|
30
|
+
const island = await (await nitroApp.localFetch(`/__nuxt_island/${options.component}?props=${encodeURI(JSON.stringify(options))}`)).json();
|
|
23
31
|
const head = createHeadCore();
|
|
24
32
|
head.push(island.head);
|
|
25
33
|
head.push({
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { createError, defineEventHandler,
|
|
1
|
+
import { createError, defineEventHandler, getQuery } from "h3";
|
|
2
2
|
import { withoutBase } from "ufo";
|
|
3
3
|
import { extractOgImageOptions } from "../utils.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { getRouteRules } from "#internal/nitro";
|
|
4
|
+
import { getRouteRules, useNitroApp } from "#internal/nitro";
|
|
6
5
|
import { useRuntimeConfig } from "#imports";
|
|
7
6
|
export default defineEventHandler(async (e) => {
|
|
8
7
|
const query = getQuery(e);
|
|
9
8
|
const path = withoutBase(query.path || "/", useRuntimeConfig().app.baseURL);
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
const nitro = useNitroApp();
|
|
10
|
+
let html;
|
|
11
|
+
try {
|
|
12
|
+
html = await (await nitro.localFetch(path)).text();
|
|
13
|
+
} catch (err) {
|
|
14
|
+
throw createError({
|
|
15
|
+
statusCode: 500,
|
|
16
|
+
statusMessage: `Failed to read the path ${path} for og-image extraction. ${err.message}.`
|
|
17
|
+
});
|
|
18
|
+
}
|
|
18
19
|
const extractedPayload = extractOgImageOptions(html);
|
|
19
20
|
if (!extractedPayload) {
|
|
20
21
|
throw createError({
|
|
@@ -23,8 +24,10 @@ export default defineEventHandler(async (e) => {
|
|
|
23
24
|
});
|
|
24
25
|
}
|
|
25
26
|
e.node.req.url = path;
|
|
27
|
+
const oldRouteRules = e.context._nitro.routeRules;
|
|
26
28
|
e.context._nitro.routeRules = void 0;
|
|
27
29
|
const routeRules = getRouteRules(e)?.ogImage;
|
|
30
|
+
e.context._nitro.routeRules = oldRouteRules;
|
|
28
31
|
e.node.req.url = e.path;
|
|
29
32
|
if (routeRules === false)
|
|
30
33
|
return false;
|
|
@@ -35,8 +38,6 @@ export default defineEventHandler(async (e) => {
|
|
|
35
38
|
// use route rules
|
|
36
39
|
...routeRules || {},
|
|
37
40
|
// use provided data
|
|
38
|
-
...extractedPayload
|
|
39
|
-
// use query data
|
|
40
|
-
...query
|
|
41
|
+
...extractedPayload
|
|
41
42
|
};
|
|
42
43
|
});
|
|
@@ -3,16 +3,13 @@ import { Buffer } from 'node:buffer';
|
|
|
3
3
|
import type { H3Event } from 'h3';
|
|
4
4
|
import type { OgImageOptions } from '../../types';
|
|
5
5
|
export * from './util-hostname';
|
|
6
|
-
export declare function wasmLoader(asyncModuleLoad: Promise<any
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
export declare function wasmLoader(asyncModuleLoad: Promise<any> | Buffer | string, fallback: string): {
|
|
7
|
+
load(options: {
|
|
8
|
+
baseUrl: string;
|
|
9
|
+
}): Promise<any>;
|
|
9
10
|
};
|
|
10
11
|
export declare function fetchOptions(e: H3Event, path: string): Promise<OgImageOptions>;
|
|
11
12
|
export declare function base64ToArrayBuffer(base64: string): ArrayBuffer;
|
|
12
|
-
export declare function renderIsland(payload: OgImageOptions): Promise<{
|
|
13
|
-
html: string;
|
|
14
|
-
head: any;
|
|
15
|
-
}>;
|
|
16
13
|
export declare function readPublicAsset(file: string, encoding?: BufferEncoding): Promise<string | Buffer | undefined>;
|
|
17
14
|
export declare function readPublicAssetBase64(file: string): Promise<string | undefined>;
|
|
18
15
|
export * from './utils-pure';
|
|
@@ -1,66 +1,74 @@
|
|
|
1
1
|
import { existsSync, promises as fsp } from "node:fs";
|
|
2
2
|
import { Buffer } from "node:buffer";
|
|
3
|
-
import {
|
|
3
|
+
import { getQuery } from "h3";
|
|
4
4
|
import { join } from "pathe";
|
|
5
|
-
import {
|
|
6
|
-
import { useRuntimeConfig } from "#imports";
|
|
5
|
+
import { prefixStorage } from "unstorage";
|
|
6
|
+
import { useRuntimeConfig, useStorage } from "#imports";
|
|
7
|
+
import { useNitroApp } from "#internal/nitro";
|
|
7
8
|
export * from "./util-hostname.mjs";
|
|
8
|
-
export function wasmLoader(asyncModuleLoad, fallback
|
|
9
|
+
export function wasmLoader(asyncModuleLoad, fallback) {
|
|
9
10
|
let promise;
|
|
10
|
-
let
|
|
11
|
+
let wasm;
|
|
11
12
|
return {
|
|
12
|
-
|
|
13
|
-
if (loaded)
|
|
14
|
-
return true;
|
|
13
|
+
async load(options) {
|
|
15
14
|
if (typeof promise !== "undefined")
|
|
16
15
|
return promise;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
async load() {
|
|
16
|
+
if (wasm)
|
|
17
|
+
return wasm;
|
|
20
18
|
promise = promise || new Promise(async (resolve) => {
|
|
21
|
-
let wasm;
|
|
22
19
|
try {
|
|
23
20
|
wasm = await asyncModuleLoad;
|
|
24
21
|
if (typeof wasm === "string")
|
|
25
22
|
wasm = void 0;
|
|
26
23
|
} catch (e) {
|
|
27
24
|
}
|
|
28
|
-
if (!wasm)
|
|
29
|
-
wasm = await readPublicAsset(fallback);
|
|
30
25
|
if (!wasm) {
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
wasm = await readPublicAsset(fallback, "base64");
|
|
27
|
+
if (wasm)
|
|
28
|
+
wasm = Buffer.from(wasm, "base64");
|
|
29
|
+
}
|
|
30
|
+
if (!wasm) {
|
|
31
|
+
const url = new URL(options.baseUrl);
|
|
32
|
+
wasm = await (await globalThis.$fetch(fallback, { baseURL: url.origin })).arrayBuffer();
|
|
33
|
+
wasm = Buffer.from(wasm);
|
|
33
34
|
}
|
|
34
|
-
loaded = true;
|
|
35
35
|
resolve(wasm);
|
|
36
36
|
});
|
|
37
37
|
return promise;
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
export function fetchOptions(e, path) {
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
export async function fetchOptions(e, path) {
|
|
42
|
+
const { runtimeCacheStorage } = useRuntimeConfig()["nuxt-og-image"];
|
|
43
|
+
const cache = runtimeCacheStorage ? prefixStorage(useStorage(), "og-image-cache:options") : false;
|
|
44
|
+
let options;
|
|
45
|
+
if (cache && await cache.hasItem(path)) {
|
|
46
|
+
const cachedValue = await cache.getItem(path);
|
|
47
|
+
if (cachedValue && cachedValue.value && cachedValue.expiresAt < Date.now())
|
|
48
|
+
options = cachedValue.value;
|
|
49
|
+
else
|
|
50
|
+
await cache.removeItem(path);
|
|
51
|
+
}
|
|
52
|
+
if (!options) {
|
|
53
|
+
const nitro = useNitroApp();
|
|
54
|
+
options = await (await nitro.localFetch(`/api/og-image-options?path=${path}`)).json();
|
|
55
|
+
if (cache) {
|
|
56
|
+
await cache.setItem(path, {
|
|
57
|
+
value: options,
|
|
58
|
+
expiresAt: Date.now() + (options.static ? 60 * 60 * 1e3 : 5 * 1e3)
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
...options,
|
|
64
|
+
// use query data
|
|
65
|
+
...getQuery(e)
|
|
46
66
|
};
|
|
47
|
-
return globalThis.$fetch("/api/og-image-options", {
|
|
48
|
-
query: {
|
|
49
|
-
...getQuery(e),
|
|
50
|
-
path
|
|
51
|
-
},
|
|
52
|
-
...fetchOptions2
|
|
53
|
-
});
|
|
54
67
|
}
|
|
55
68
|
export function base64ToArrayBuffer(base64) {
|
|
56
69
|
const buffer = Buffer.from(base64, "base64");
|
|
57
70
|
return new Uint8Array(buffer).buffer;
|
|
58
71
|
}
|
|
59
|
-
export function renderIsland(payload) {
|
|
60
|
-
return globalThis.$fetch(`/__nuxt_island/${payload.component}`, {
|
|
61
|
-
query: { props: JSON.stringify(payload) }
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
72
|
function r(base, key) {
|
|
65
73
|
return join(base, key.replace(/:/g, "/"));
|
|
66
74
|
}
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-og-image",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.23",
|
|
5
5
|
"packageManager": "pnpm@8.1.0",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://github.com/sponsors/harlan-zw",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@nuxt/kit": "3.4.2",
|
|
30
|
+
"@resvg/resvg-wasm": "^2.4.1",
|
|
30
31
|
"@types/fs-extra": "^11.0.1",
|
|
31
32
|
"birpc": "^0.2.11",
|
|
32
33
|
"chalk": "^5.2.0",
|
|
@@ -36,15 +37,17 @@
|
|
|
36
37
|
"fast-glob": "^3.2.12",
|
|
37
38
|
"flatted": "^3.2.7",
|
|
38
39
|
"fs-extra": "^11.1.1",
|
|
40
|
+
"globby": "^13.1.4",
|
|
39
41
|
"launch-editor": "^2.6.0",
|
|
42
|
+
"nypm": "^0.2.0",
|
|
40
43
|
"ofetch": "^1.0.1",
|
|
41
|
-
"ohash": "^1.1.
|
|
44
|
+
"ohash": "^1.1.2",
|
|
42
45
|
"pathe": "^1.1.0",
|
|
43
|
-
"playwright-core": "^1.
|
|
46
|
+
"playwright-core": "^1.33.0",
|
|
44
47
|
"radix3": "^1.0.1",
|
|
45
|
-
"satori": "0.
|
|
48
|
+
"satori": "0.7.2",
|
|
46
49
|
"satori-html": "^0.3.2",
|
|
47
|
-
"sirv": "^2.0.
|
|
50
|
+
"sirv": "^2.0.3",
|
|
48
51
|
"std-env": "^3.3.2",
|
|
49
52
|
"svg2png-wasm": "^1.3.4",
|
|
50
53
|
"tinyws": "^0.1.0",
|
|
@@ -55,18 +58,22 @@
|
|
|
55
58
|
},
|
|
56
59
|
"devDependencies": {
|
|
57
60
|
"@antfu/eslint-config": "^0.38.5",
|
|
58
|
-
"@nuxt/devtools-edge": "0.4.
|
|
61
|
+
"@nuxt/devtools-edge": "0.4.2-28041905.19fda12",
|
|
59
62
|
"@nuxt/module-builder": "^0.3.0",
|
|
60
63
|
"@nuxt/test-utils": "3.4.2",
|
|
61
64
|
"@nuxtjs/eslint-config-typescript": "^12.0.0",
|
|
62
65
|
"@types/ws": "^8.5.4",
|
|
63
66
|
"bumpp": "^9.1.0",
|
|
64
|
-
"eslint": "8.
|
|
67
|
+
"eslint": "8.39.0",
|
|
65
68
|
"jest-image-snapshot": "^6.1.0",
|
|
66
69
|
"nuxt": "^3.4.2",
|
|
67
|
-
"puppeteer": "^19.10.1",
|
|
68
70
|
"vitest": "^0.30.1"
|
|
69
71
|
},
|
|
72
|
+
"resolutions": {
|
|
73
|
+
"nitropack": "npm:nitropack-edge@2.4.0-28027501.1cf01bf",
|
|
74
|
+
"unstorage": "^1.5.0",
|
|
75
|
+
"unenv": "^1.4.1"
|
|
76
|
+
},
|
|
70
77
|
"scripts": {
|
|
71
78
|
"build": "pnpm dev:prepare && pnpm build:module && pnpm build:client",
|
|
72
79
|
"build:client": "nuxi generate client",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as p,b as u,e as l,f as t,o as f,h as m,i as d,u as o,j as _}from"./entry.c8bf4454.js";const x=p({__name:"IconCSS",props:{name:{type:String,required:!0},size:{type:String,default:""}},setup(i){const s=i;u(e=>({"57550bb0":o(r)}));const n=l();n?.nuxtIcon?.aliases;const c=t(()=>(n?.nuxtIcon?.aliases||{})[s.name]||s.name),r=t(()=>`url('https://api.iconify.design/${c.value.replace(":","/")}.svg')`),a=t(()=>{if(!s.size&&typeof n.nuxtIcon?.size=="boolean"&&!n.nuxtIcon?.size)return;const e=s.size||n.nuxtIcon?.size||"1em";return String(Number(e))===e?`${e}px`:e});return(e,z)=>(f(),m("span",{style:d({width:o(a),height:o(a)})},null,4))}}),g=_(x,[["__scopeId","data-v-de762dfd"]]);export{g as default};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { initialize, svg2png } from "svg2png-wasm";
|
|
2
|
-
import { wasmLoader } from "../../utils.mjs";
|
|
3
|
-
export default async function(svg, options) {
|
|
4
|
-
const loader = wasmLoader("/* NUXT_OG_IMAGE_SVG2PNG_WASM */", "/svg2png.wasm", options.baseUrl);
|
|
5
|
-
if (!await loader.loaded()) {
|
|
6
|
-
await initialize(await loader.load()).catch((e) => {
|
|
7
|
-
if (!e.message.trim().endsWith("function can be used only once."))
|
|
8
|
-
throw e;
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
return await svg2png(svg, options);
|
|
12
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|