@takumi-rs/image-response 1.8.6 → 2.0.0-beta.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 +11 -16
- package/package.json +21 -12
package/README.md
CHANGED
|
@@ -27,23 +27,20 @@ export function GET(request: Request) {
|
|
|
27
27
|
}
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
Pass custom fonts per response; identical fonts are registered once and reused automatically.
|
|
31
31
|
|
|
32
32
|
```tsx
|
|
33
|
-
import {
|
|
34
|
-
|
|
35
|
-
const ogImage = createImageResponse({
|
|
36
|
-
fonts: [
|
|
37
|
-
{
|
|
38
|
-
data: () => fetch("/fonts/Inter-Regular.ttf").then((res) => res.arrayBuffer()),
|
|
39
|
-
key: "inter-regular",
|
|
40
|
-
name: "Inter",
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
});
|
|
33
|
+
import { ImageResponse } from "@takumi-rs/image-response";
|
|
44
34
|
|
|
45
35
|
export function GET() {
|
|
46
|
-
return
|
|
36
|
+
return new ImageResponse(<OgImage />, {
|
|
37
|
+
fonts: [
|
|
38
|
+
{
|
|
39
|
+
data: () => fetch("/fonts/Inter-Regular.ttf").then((res) => res.arrayBuffer()),
|
|
40
|
+
name: "Inter",
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
});
|
|
47
44
|
}
|
|
48
45
|
```
|
|
49
46
|
|
|
@@ -85,9 +82,7 @@ export function GET(request: Request) {
|
|
|
85
82
|
}
|
|
86
83
|
```
|
|
87
84
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
`loadDefaultFonts` is only supported by the native `@takumi-rs/core` renderer. It has no effect when using the WASM renderer.
|
|
85
|
+
Images can likewise be provided up front via `images`, keyed by `src`, each with bytes or a sync/async loader.
|
|
91
86
|
|
|
92
87
|
### Bring-Your-Own-Renderer (BYOR)
|
|
93
88
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takumi-rs/image-response",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.0",
|
|
4
4
|
"license": "(MIT OR Apache-2.0)",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Kane Wang",
|
|
@@ -16,27 +16,36 @@
|
|
|
16
16
|
"type": "module",
|
|
17
17
|
"main": "./dist/index.cjs",
|
|
18
18
|
"module": "./dist/index.mjs",
|
|
19
|
-
"types": "./dist/index.d.
|
|
19
|
+
"types": "./dist/index.d.cts",
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
"import": {
|
|
23
|
+
"types": "./dist/index.d.mts",
|
|
24
|
+
"default": "./dist/index.mjs"
|
|
25
|
+
},
|
|
26
|
+
"require": {
|
|
27
|
+
"types": "./dist/index.d.cts",
|
|
28
|
+
"default": "./dist/index.cjs"
|
|
29
|
+
}
|
|
26
30
|
},
|
|
27
31
|
"./wasm": {
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
"import": {
|
|
33
|
+
"types": "./dist/index.d.mts",
|
|
34
|
+
"default": "./dist/index.mjs"
|
|
35
|
+
},
|
|
36
|
+
"require": {
|
|
37
|
+
"types": "./dist/index.d.cts",
|
|
38
|
+
"default": "./dist/index.cjs"
|
|
39
|
+
}
|
|
32
40
|
}
|
|
33
41
|
},
|
|
34
42
|
"scripts": {
|
|
35
43
|
"build": "tsdown",
|
|
36
|
-
"prepublishOnly": "jq '.dependencies[\"takumi-js\"] = .version' package.json > tmp.json && mv tmp.json package.json"
|
|
44
|
+
"prepublishOnly": "jq '.dependencies[\"takumi-js\"] = .version' package.json > tmp.json && mv tmp.json package.json",
|
|
45
|
+
"publish-lint": "attw --pack . && publint --strict ."
|
|
37
46
|
},
|
|
38
47
|
"dependencies": {
|
|
39
|
-
"takumi-js": "
|
|
48
|
+
"takumi-js": "2.0.0-beta.0"
|
|
40
49
|
},
|
|
41
50
|
"devDependencies": {
|
|
42
51
|
"@types/bun": "catalog:",
|