@awflow/avatar-export 1.0.0 → 1.0.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 +18 -2
- package/dist/sprite.d.ts +1 -1
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -40,7 +40,14 @@ Write the bytes anywhere: `await Bun.write('linh.png', png)`,
|
|
|
40
40
|
## Browsers
|
|
41
41
|
|
|
42
42
|
Load the wasm once with `init` before the first export. It takes a
|
|
43
|
-
`fetch()` response (or its promise), an `ArrayBuffer`, typed array or a `URL
|
|
43
|
+
`fetch()` response (or its promise), an `ArrayBuffer`, typed array or a `URL`.
|
|
44
|
+
The wasm file comes from `@resvg/resvg-wasm`, which this package depends on.
|
|
45
|
+
Importing it by path from your own code needs it as a direct dependency under
|
|
46
|
+
strict package managers (pnpm), at the exact version this package uses:
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
npm install @resvg/resvg-wasm@2.6.2
|
|
50
|
+
```
|
|
44
51
|
|
|
45
52
|
```ts
|
|
46
53
|
import { init, toPng } from '@awflow/avatar-export'
|
|
@@ -65,6 +72,13 @@ that names the limit.
|
|
|
65
72
|
GIF counts time in hundredths of a second and browsers slow down frames
|
|
66
73
|
shorter than 2/100 s, so keep GIFs at 50 fps or less. APNG timing is exact.
|
|
67
74
|
|
|
75
|
+
Rasterising is synchronous CPU work on the calling thread. On a recent laptop
|
|
76
|
+
a 1024 px, 60-frame export takes about 13 s as a GIF and 17 s as an APNG, and
|
|
77
|
+
a sheet of 256 tiles at 256 px about 11 s. The worst case the limits allow,
|
|
78
|
+
600 frames at 1024 px, is minutes of CPU. On a server, cap `size`, `fps` and
|
|
79
|
+
`seconds` well below `LIMITS` for untrusted input, and run exports in a worker
|
|
80
|
+
or a queue rather than on the request path.
|
|
81
|
+
|
|
68
82
|
## Docs
|
|
69
83
|
|
|
70
84
|
Full documentation: <https://github.com/awflow/agent-avatar#readme>
|
|
@@ -72,7 +86,9 @@ Full documentation: <https://github.com/awflow/agent-avatar#readme>
|
|
|
72
86
|
## Credits
|
|
73
87
|
|
|
74
88
|
Built on Peek by Doan Labs (MIT). Rasterising by
|
|
75
|
-
[resvg](https://github.com/linebender/resvg)
|
|
89
|
+
[resvg](https://github.com/linebender/resvg) through
|
|
90
|
+
[`@resvg/resvg-wasm`](https://www.npmjs.com/package/@resvg/resvg-wasm)
|
|
91
|
+
(MPL-2.0), GIF encoding by
|
|
76
92
|
[gifenc](https://github.com/mattdesl/gifenc), compression by
|
|
77
93
|
[fflate](https://github.com/101arrowz/fflate).
|
|
78
94
|
|
package/dist/sprite.d.ts
CHANGED
|
@@ -12,4 +12,4 @@ export type SpriteSettings = {
|
|
|
12
12
|
* (columns - 1) * gap, height likewise for the rows used. The same options
|
|
13
13
|
* apply to every tile. The sheet's area is at most LIMITS.maxSheet pixels. Name i sits at column i % columns, row i / columns.
|
|
14
14
|
*/
|
|
15
|
-
export declare function toSprite(names: string[], opts?: AvatarOptions, o?: SpriteSettings): Promise<Uint8Array>;
|
|
15
|
+
export declare function toSprite(names: readonly string[], opts?: AvatarOptions, o?: SpriteSettings): Promise<Uint8Array>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awflow/avatar-export",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"bin": {
|
|
@@ -21,13 +21,16 @@
|
|
|
21
21
|
"LICENSE"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@awflow/avatar": "^1.0.
|
|
24
|
+
"@awflow/avatar": "^1.0.1",
|
|
25
25
|
"@resvg/resvg-wasm": "2.6.2",
|
|
26
26
|
"fflate": "0.8.3",
|
|
27
27
|
"gifenc": "1.0.3"
|
|
28
28
|
},
|
|
29
29
|
"description": "Rasterise AWFlow avatars to PNG, APNG, GIF and sprite sheets, in Node and the browser.",
|
|
30
30
|
"license": "MIT",
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=20"
|
|
33
|
+
},
|
|
31
34
|
"author": "AWFlow",
|
|
32
35
|
"homepage": "https://github.com/awflow/agent-avatar",
|
|
33
36
|
"repository": {
|