@ethercorps/sveltekit-og 1.0.0 → 1.1.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.
- package/README.md +22 -21
- package/package.json +10 -4
package/README.md
CHANGED
|
@@ -4,13 +4,14 @@ About
|
|
|
4
4
|
Generate Open Graph Images dynamically from HTML/CSS without a browser in SvelteKit.
|
|
5
5
|
|
|
6
6
|
## v1.0.0 Update (Breaking Changes)
|
|
7
|
+
|
|
7
8
|
Finally, We have added html to react like element like object converter out of the box and with svelte compiler.
|
|
8
9
|
Now you can use `{ toReactElement }` with `"@ethercorps/sveltekit-og"` like:
|
|
9
10
|
|
|
10
11
|
```typescript
|
|
11
12
|
// +page.server.js
|
|
12
13
|
|
|
13
|
-
import { toReactElement, satori } from
|
|
14
|
+
import { toReactElement, satori } from '@ethercorps/sveltekit-og';
|
|
14
15
|
|
|
15
16
|
const htmlString = `
|
|
16
17
|
<div tw="bg-gray-50 flex w-full">
|
|
@@ -34,33 +35,33 @@ const newNode = toReactElement(htmlString);
|
|
|
34
35
|
|
|
35
36
|
/** @type {import('./$types').PageServerLoad} */
|
|
36
37
|
export async function load() {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
38
|
+
const fontFile400 = await fetch(
|
|
39
|
+
'https://og-playground.vercel.app/inter-latin-ext-400-normal.woff'
|
|
40
|
+
);
|
|
41
|
+
const fontData400 = await fontFile400.arrayBuffer();
|
|
42
|
+
const svg = await satori(newNode, {
|
|
43
|
+
height: 350,
|
|
44
|
+
width: 500,
|
|
45
|
+
fonts: [
|
|
46
|
+
{
|
|
47
|
+
name: 'sans serif',
|
|
48
|
+
data: fontData400,
|
|
49
|
+
style: 'normal',
|
|
50
|
+
weight: 700
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return { svg };
|
|
55
56
|
}
|
|
56
57
|
```
|
|
57
58
|
|
|
58
59
|
- We have changed to function based instead of class based ImageResponse and componentToImageResponse.
|
|
59
60
|
- Removed `@resvg/resvg-wasm` with `@resvg/resvg-js` because of internal errors.
|
|
60
61
|
- Removed `satori-html` because now we have `toReactElement` out of the box with svelte compiler.
|
|
61
|
-
|
|
62
|
+
> If you find a problem related to undefined a please check [_vite.config.js_](/vite.config.ts) and add ` define: { _a: 'undefined' } in config.`
|
|
62
63
|
|
|
63
|
-
> If you find any issue and have suggestion for this project please open a ticket and if you want to contribute please create a new discussion.
|
|
64
|
+
> If you find any issue and have suggestion for this project please open a ticket and if you want to contribute please create a new discussion.
|
|
64
65
|
|
|
65
66
|
## Quick Start
|
|
66
67
|
|
package/package.json
CHANGED
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethercorps/sveltekit-og",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@playwright/test": "^1.28.1",
|
|
7
7
|
"@sveltejs/adapter-auto": "next",
|
|
8
|
-
"@sveltejs/kit": "next",
|
|
8
|
+
"@sveltejs/kit": "1.0.0-next.581",
|
|
9
9
|
"@sveltejs/package": "next",
|
|
10
10
|
"@typescript-eslint/eslint-plugin": "^5.46.0",
|
|
11
11
|
"@typescript-eslint/parser": "^5.46.0",
|
|
12
|
+
"autoprefixer": "^10.4.13",
|
|
13
|
+
"brace": "^0.11.1",
|
|
12
14
|
"eslint": "^8.29.0",
|
|
13
15
|
"eslint-config-prettier": "^8.5.0",
|
|
14
16
|
"eslint-plugin-svelte3": "^4.0.0",
|
|
17
|
+
"monaco-editor": "^0.34.1",
|
|
18
|
+
"postcss": "^8.4.19",
|
|
15
19
|
"prettier": "^2.8.1",
|
|
16
|
-
"prettier-plugin-svelte": "^2.
|
|
20
|
+
"prettier-plugin-svelte": "^2.9.0",
|
|
21
|
+
"prismjs": "^1.29.0",
|
|
17
22
|
"svelte": "^3.54.0",
|
|
18
23
|
"svelte-check": "^2.10.2",
|
|
19
24
|
"svelte-preprocess": "^4.10.7",
|
|
25
|
+
"tailwindcss": "^3.2.4",
|
|
20
26
|
"tslib": "^2.4.1",
|
|
21
27
|
"typescript": "^4.9.4",
|
|
22
|
-
"vite": "^
|
|
28
|
+
"vite": "^4.0.0"
|
|
23
29
|
},
|
|
24
30
|
"type": "module",
|
|
25
31
|
"dependencies": {
|