@ethercorps/sveltekit-og 4.0.0-next.4 → 4.0.0
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 +49 -10
- package/package.json +66 -68
package/README.md
CHANGED
|
@@ -13,7 +13,39 @@ pnpm install @ethercorps/sveltekit-og
|
|
|
13
13
|
|
|
14
14
|
## Usage
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
- Add `rollupWasm` to `build.rollupOptions.plugins` in `vite.cofig.js` file.
|
|
17
|
+
-
|
|
18
|
+
```ts
|
|
19
|
+
import { sveltekit } from '@sveltejs/kit/vite';
|
|
20
|
+
import { defineConfig } from 'vitest/config';
|
|
21
|
+
import { rollupWasm } from './src/lib/plugin.js';
|
|
22
|
+
|
|
23
|
+
export default defineConfig({
|
|
24
|
+
plugins: [sveltekit()],
|
|
25
|
+
build: {
|
|
26
|
+
rollupOptions: {
|
|
27
|
+
plugins: [rollupWasm()],
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
- For node adapter update config with `rollupWasm`
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
export default defineConfig({
|
|
37
|
+
plugins: [sveltekit()],
|
|
38
|
+
build: {
|
|
39
|
+
rollupOptions: {
|
|
40
|
+
plugins: [
|
|
41
|
+
rollupWasm({ esmImport: false })
|
|
42
|
+
],
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
- Create a file at `/src/routes/og/+server.ts`. Alternatively, you can use JavaScript by removing the types from this example.
|
|
17
49
|
|
|
18
50
|
```typescript
|
|
19
51
|
// src/routes/og/+server.ts
|
|
@@ -81,8 +113,8 @@ By default, `@ethercorps/sveltekit-og` includes only 'Noto Sans' font. If you ne
|
|
|
81
113
|
|
|
82
114
|
## Examples
|
|
83
115
|
|
|
84
|
-
- `ImageResponse` · [_source_](/src/routes/+server.ts) · [_demo_](https://sveltekit-og
|
|
85
|
-
- `Component Rendering` · [_source_](/src/routes/sc/+server.ts) · [_demo_](https://sveltekit-og
|
|
116
|
+
- `ImageResponse` · [_source_](/src/routes/+server.ts) · [_demo_](https://vercel.sveltekit-og.dev)
|
|
117
|
+
- `Component Rendering` · [_source_](/src/routes/sc/+server.ts) · [_demo_](https://vercel.sveltekit-og.dev/sc)
|
|
86
118
|
|
|
87
119
|
## API Reference
|
|
88
120
|
|
|
@@ -92,9 +124,8 @@ The package exposes an `ImageResponse` constructors, with the following options
|
|
|
92
124
|
import {ImageResponse} from '@ethercorps/sveltekit-og'
|
|
93
125
|
import {SvelteComponent} from "svelte";
|
|
94
126
|
|
|
95
|
-
// ...
|
|
96
127
|
ImageResponse(
|
|
97
|
-
element : string,
|
|
128
|
+
element : string | Component,
|
|
98
129
|
options : {
|
|
99
130
|
width ? : number = 1200
|
|
100
131
|
height ? : number = 630,
|
|
@@ -106,17 +137,27 @@ ImageResponse(
|
|
|
106
137
|
style: 'normal' | 'italic'
|
|
107
138
|
}[]
|
|
108
139
|
debug ? : boolean = false
|
|
109
|
-
graphemeImages ? : Record<string, string>;
|
|
110
|
-
loadAdditionalAsset ? : (languageCode: string, segment: string) => Promise<SatoriOptions["fonts"] | string | undefined>;
|
|
111
140
|
// Options that will be passed to the HTTP response
|
|
112
141
|
status ? : number = 200
|
|
113
142
|
statusText ? : string
|
|
114
143
|
headers ? : Record<string, string>
|
|
115
|
-
}
|
|
144
|
+
},
|
|
145
|
+
// Component props if components.
|
|
146
|
+
ComponentProps<Component>
|
|
147
|
+
)
|
|
116
148
|
```
|
|
117
149
|
|
|
118
150
|
## Changelog
|
|
119
151
|
|
|
152
|
+
### v4.0.0 (Breaking Changes)
|
|
153
|
+
|
|
154
|
+
> Just install @ethercorps/sveltekit-og
|
|
155
|
+
|
|
156
|
+
> Support for NodeJS, Deno, Cloudflare Pages, Cloudflare Workers, Vercel and Netlify.
|
|
157
|
+
|
|
158
|
+
> No support for Bun tried and failed.
|
|
159
|
+
|
|
160
|
+
|
|
120
161
|
### v3.0.0 (Breaking Changes)
|
|
121
162
|
|
|
122
163
|
> Just install @ethercorps/sveltekit-og
|
|
@@ -159,8 +200,6 @@ This project will not be possible without the following projects:
|
|
|
159
200
|
- [Satori & @vercel/og](https://github.com/vercel/satori)
|
|
160
201
|
- [Noto by Google Fonts](https://fonts.google.com/noto)
|
|
161
202
|
|
|
162
|
-
[//]: # (- [svg2png-wasm](https://github.com/ssssota/svg2png-wasm))
|
|
163
|
-
|
|
164
203
|
## Authors
|
|
165
204
|
|
|
166
205
|
- [@theetherGit](https://www.github.com/theetherGit)
|
package/package.json
CHANGED
|
@@ -1,70 +1,68 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
},
|
|
69
|
-
"packageManager": "pnpm@10.12.1"
|
|
2
|
+
"name": "@ethercorps/sveltekit-og",
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"exports": {
|
|
5
|
+
".": {
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"svelte": "./dist/index.js",
|
|
8
|
+
"import": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"./plugin": {
|
|
11
|
+
"types": "./dist/plugin.d.ts",
|
|
12
|
+
"import": "./dist/plugin.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"!dist/**/*.test.*",
|
|
18
|
+
"!dist/**/*.spec.*"
|
|
19
|
+
],
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@sveltejs/adapter-vercel": "^5.10.2",
|
|
22
|
+
"@sveltejs/kit": "^2.48.5",
|
|
23
|
+
"@sveltejs/package": "^2.5.4",
|
|
24
|
+
"@sveltejs/vite-plugin-svelte": "^4.0.4",
|
|
25
|
+
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
26
|
+
"@typescript-eslint/parser": "^5.62.0",
|
|
27
|
+
"css-tree": "^2.3.1",
|
|
28
|
+
"eslint": "^8.57.1",
|
|
29
|
+
"eslint-config-prettier": "^8.10.0",
|
|
30
|
+
"eslint-plugin-svelte": "^2.46.1",
|
|
31
|
+
"prettier": "^3.6.2",
|
|
32
|
+
"prettier-plugin-svelte": "^3.4.0",
|
|
33
|
+
"publint": "^0.1.16",
|
|
34
|
+
"rollup-plugin-visualizer": "^5.14.0",
|
|
35
|
+
"svelte": "^5.43.12",
|
|
36
|
+
"svelte-check": "^4.3.2",
|
|
37
|
+
"tslib": "^2.8.1",
|
|
38
|
+
"typescript": "^5.9.3",
|
|
39
|
+
"vite": "^5.4.19",
|
|
40
|
+
"vitest": "^1.6.1"
|
|
41
|
+
},
|
|
42
|
+
"main": "./dist/index.js",
|
|
43
|
+
"svelte": "./dist/index.js",
|
|
44
|
+
"types": "./dist/index.d.ts",
|
|
45
|
+
"type": "module",
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@resvg/resvg-wasm": "^2.6.2",
|
|
48
|
+
"satori": "^0.10.14",
|
|
49
|
+
"satori-html": "0.3.2",
|
|
50
|
+
"std-env": "^3.9.0",
|
|
51
|
+
"unwasm": "^0.5.0"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"@sveltejs/kit": ">=2.0.0"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"dev": "vite dev",
|
|
58
|
+
"build": "vite build && npm run package",
|
|
59
|
+
"preview": "vite preview",
|
|
60
|
+
"package": "svelte-kit sync && svelte-package && publint",
|
|
61
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
62
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
|
63
|
+
"test": "vitest",
|
|
64
|
+
"lint": "prettier --plugin-search-dir . --check . && eslint .",
|
|
65
|
+
"format": "prettier --plugin-search-dir . --write .",
|
|
66
|
+
"publishBeta": "npm publish --tag beta"
|
|
67
|
+
}
|
|
70
68
|
}
|