@ethercorps/sveltekit-og 4.0.0-next.4 → 4.1.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 CHANGED
@@ -13,7 +13,39 @@ pnpm install @ethercorps/sveltekit-og
13
13
 
14
14
  ## Usage
15
15
 
16
- Create a file at `/src/routes/og/+server.ts`. Alternatively, you can use JavaScript by removing the types from this example.
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-five.vercel.app)
85
- - `Component Rendering` · [_source_](/src/routes/sc/+server.ts) · [_demo_](https://sveltekit-og-five.vercel.app/sc)
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
- } {props})
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]&#40;https://github.com/ssssota/svg2png-wasm&#41;)
163
-
164
203
  ## Authors
165
204
 
166
205
  - [@theetherGit](https://www.github.com/theetherGit)
package/dist/plugin.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { unwasm, type UnwasmPluginOptions } from "unwasm/plugin";
2
+ import type { Plugin as VitePlugin } from "vite";
2
3
  type Plugin = ReturnType<typeof unwasm>;
3
4
  export declare function rollupWasm(options?: UnwasmPluginOptions): Plugin;
5
+ export declare function sveltekitOG(options?: UnwasmPluginOptions): VitePlugin;
4
6
  export {};
package/dist/plugin.js CHANGED
@@ -6,3 +6,17 @@ export function rollupWasm(options) {
6
6
  ...options
7
7
  });
8
8
  }
9
+ export function sveltekitOG(options) {
10
+ return {
11
+ name: 'vite-plugin-sveltekit-og',
12
+ config() {
13
+ return {
14
+ build: {
15
+ rollupOptions: {
16
+ plugins: [rollupWasm(options)]
17
+ }
18
+ }
19
+ };
20
+ }
21
+ };
22
+ }
package/package.json CHANGED
@@ -1,70 +1,68 @@
1
1
  {
2
- "name": "@ethercorps/sveltekit-og",
3
- "version": "4.0.0-next.4",
4
- "scripts": {
5
- "dev": "vite dev",
6
- "build": "vite build && npm run package",
7
- "preview": "vite preview",
8
- "package": "svelte-kit sync && svelte-package && publint",
9
- "prepublishOnly": "npm run package",
10
- "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
11
- "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
12
- "test": "vitest",
13
- "lint": "prettier --plugin-search-dir . --check . && eslint .",
14
- "format": "prettier --plugin-search-dir . --write .",
15
- "publishBeta": "npm publish --tag beta"
16
- },
17
- "exports": {
18
- ".": {
19
- "types": "./dist/index.d.ts",
20
- "svelte": "./dist/index.js",
21
- "import": "./dist/index.js"
22
- },
23
- "./plugin": {
24
- "types": "./dist/plugin.d.ts",
25
- "import": "./dist/plugin.js"
26
- }
27
- },
28
- "files": [
29
- "dist",
30
- "!dist/**/*.test.*",
31
- "!dist/**/*.spec.*"
32
- ],
33
- "devDependencies": {
34
- "@sveltejs/adapter-vercel": "^5.10.2",
35
- "@sveltejs/kit": "^2.48.5",
36
- "@sveltejs/package": "^2.5.4",
37
- "@sveltejs/vite-plugin-svelte": "^4.0.4",
38
- "@typescript-eslint/eslint-plugin": "^5.62.0",
39
- "@typescript-eslint/parser": "^5.62.0",
40
- "css-tree": "^2.3.1",
41
- "eslint": "^8.57.1",
42
- "eslint-config-prettier": "^8.10.0",
43
- "eslint-plugin-svelte": "^2.46.1",
44
- "prettier": "^3.6.2",
45
- "prettier-plugin-svelte": "^3.4.0",
46
- "publint": "^0.1.16",
47
- "rollup-plugin-visualizer": "^5.14.0",
48
- "svelte": "^5.43.12",
49
- "svelte-check": "^4.3.2",
50
- "tslib": "^2.8.1",
51
- "typescript": "^5.9.3",
52
- "vite": "^5.4.19",
53
- "vitest": "^1.6.1"
54
- },
55
- "main": "./dist/index.js",
56
- "svelte": "./dist/index.js",
57
- "types": "./dist/index.d.ts",
58
- "type": "module",
59
- "dependencies": {
60
- "@resvg/resvg-wasm": "^2.6.2",
61
- "satori": "^0.10.14",
62
- "satori-html": "0.3.2",
63
- "std-env": "^3.9.0",
64
- "unwasm": "^0.5.0"
65
- },
66
- "peerDependencies": {
67
- "@sveltejs/kit": ">=2.0.0"
68
- },
69
- "packageManager": "pnpm@10.12.1"
2
+ "name": "@ethercorps/sveltekit-og",
3
+ "version": "4.1.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
  }