@ethercorps/sveltekit-og 3.0.0-next.15 → 3.0.0-next.17
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/helpers/create.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Component } from 'svelte';
|
|
2
2
|
import type { ComponentOptions, ImageOptions, VNode } from '../types.js';
|
|
3
|
-
export declare function createVNode(element: string |
|
|
4
|
-
export declare function createSvg(element: string |
|
|
5
|
-
export declare function createPng(element: string |
|
|
3
|
+
export declare function createVNode(element: string | Component, componentOptions?: ComponentOptions): Promise<VNode>;
|
|
4
|
+
export declare function createSvg(element: string | Component, imageOptions: ImageOptions, componentOptions?: ComponentOptions): Promise<string>;
|
|
5
|
+
export declare function createPng(element: string | Component, imageOptions: ImageOptions, componentOptions?: ComponentOptions): Promise<Uint8Array<ArrayBufferLike>>;
|
package/dist/helpers/create.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { html } from 'satori-html';
|
|
2
2
|
import { loadDynamicAsset } from './emoji.js';
|
|
3
3
|
import { default_fonts, DEFAULT_WIDTH } from '../helpers/defaults.js';
|
|
4
4
|
import { useResvg, useSatori } from '../providers/instances.js';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { render } from 'svelte/server';
|
|
6
|
+
function svelteComponentToJsx(component, props = {}) {
|
|
7
|
+
const { body, head } = render(component, { props });
|
|
8
|
+
return html(body + head);
|
|
9
|
+
}
|
|
7
10
|
export async function createVNode(element, componentOptions) {
|
|
8
|
-
return typeof element === 'string' ?
|
|
11
|
+
return typeof element === 'string' ? html(element.replaceAll('\n', '').trim()) : svelteComponentToJsx(element, componentOptions?.props);
|
|
9
12
|
}
|
|
10
13
|
export async function createSvg(element, imageOptions, componentOptions) {
|
|
11
14
|
const [satori, vnodes] = await Promise.all([useSatori(), createVNode(element, componentOptions)]);
|
package/dist/helpers/defaults.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Resvg as _Resvg, initWasm } from '@resvg/resvg-wasm'
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
|
-
initWasmPromise: initWasm(import('
|
|
4
|
+
initWasmPromise: initWasm(import('./resvg.wasm?module').then(r => r.default || r)),
|
|
5
5
|
Resvg: _Resvg,
|
|
6
6
|
}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethercorps/sveltekit-og",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.17",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite dev",
|
|
6
6
|
"build": "vite build && npm run package",
|
|
@@ -27,41 +27,40 @@
|
|
|
27
27
|
"!dist/**/*.spec.*"
|
|
28
28
|
],
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@sveltejs/adapter-auto": "^3.
|
|
31
|
-
"@sveltejs/adapter-vercel": "^5.
|
|
32
|
-
"@sveltejs/kit": "^2.
|
|
33
|
-
"@sveltejs/package": "^2.3.
|
|
34
|
-
"@sveltejs/vite-plugin-svelte": "^
|
|
30
|
+
"@sveltejs/adapter-auto": "^3.3.1",
|
|
31
|
+
"@sveltejs/adapter-vercel": "^5.7.2",
|
|
32
|
+
"@sveltejs/kit": "^2.21.2",
|
|
33
|
+
"@sveltejs/package": "^2.3.11",
|
|
34
|
+
"@sveltejs/vite-plugin-svelte": "^4.0.4",
|
|
35
35
|
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
36
36
|
"@typescript-eslint/parser": "^5.62.0",
|
|
37
37
|
"css-tree": "^2.3.1",
|
|
38
|
-
"eslint": "^8.57.
|
|
38
|
+
"eslint": "^8.57.1",
|
|
39
39
|
"eslint-config-prettier": "^8.10.0",
|
|
40
|
-
"eslint-plugin-svelte": "^2.
|
|
41
|
-
"prettier": "^
|
|
42
|
-
"prettier-plugin-svelte": "^
|
|
40
|
+
"eslint-plugin-svelte": "^2.46.1",
|
|
41
|
+
"prettier": "^3.5.3",
|
|
42
|
+
"prettier-plugin-svelte": "^3.4.0",
|
|
43
43
|
"publint": "^0.1.16",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
44
|
+
"rollup-plugin-visualizer": "^5.14.0",
|
|
45
|
+
"satori-html": "0.3.2",
|
|
46
|
+
"svelte": "^5.33.14",
|
|
47
|
+
"svelte-check": "^4.2.1",
|
|
48
|
+
"tslib": "^2.8.1",
|
|
49
|
+
"typescript": "^5.8.3",
|
|
50
|
+
"vite": "^5.4.19",
|
|
51
|
+
"vite-plugin-wasm": "^3.4.1",
|
|
52
|
+
"vitest": "^1.6.1"
|
|
51
53
|
},
|
|
52
54
|
"main": "./dist/index.js",
|
|
53
55
|
"svelte": "./dist/index.js",
|
|
54
56
|
"types": "./dist/index.d.ts",
|
|
55
57
|
"type": "module",
|
|
56
58
|
"dependencies": {
|
|
57
|
-
"@
|
|
58
|
-
"satori": "^0.10.
|
|
59
|
-
"std-env": "^3.
|
|
60
|
-
"unwasm": "^0.3.9",
|
|
61
|
-
"@resvg/resvg-wasm": "^2.6.2"
|
|
59
|
+
"@resvg/resvg-wasm": "^2.6.2",
|
|
60
|
+
"satori": "^0.10.14",
|
|
61
|
+
"std-env": "^3.9.0"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"svelte": "^4.0.0",
|
|
65
64
|
"unwasm": "^0.3.9",
|
|
66
65
|
"vite-plugin-wasm": "^3.3.0"
|
|
67
66
|
}
|