wasm-html-to-image 0.1.2 โ†’ 0.1.4

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
@@ -17,7 +17,7 @@ No headless browsers (Chromium, Puppeteer, or Playwright) required. Runs seamles
17
17
 
18
18
  - โšก **Single Unified WASM Binary**: HTML parsing, CSS layout, vector painting, and image encoding execute entirely inside WebAssembly without copying intermediate framebuffers across JS boundaries.
19
19
  - ๐ŸŽจ **Versatile Inputs**: Renders HTML strings, remote Web URLs, multi-page HTML arrays, or raw image buffers (PNG, JPEG, WebP, GIF, AVIF, BMP, Data URLs).
20
- - ๐Ÿ“ฆ **Rich Output Formats**: Direct SVG vector streams, high-quality PNG, JPEG, WebP, AVIF, uncompressed RAW pixels, ThumbHash placeholders, and multi-page vector PDFs.
20
+ - ๐Ÿ“ฆ **Rich Output Formats**: Direct SVG vector streams, high-quality PNG, JPEG, WebP, AVIF, JXL, uncompressed RAW pixels, ThumbHash placeholders, and multi-page vector PDFs.
21
21
  - ๐Ÿš€ **Zero-Config Single Bundle**: Use `wasm-html-to-image/single` to call `render()` immediately without manual WASM loading or build setup.
22
22
  - ๐ŸŒ **Edge & Serverless Native**: Dedicated subpaths (`/workerd` for Cloudflare Workers, `/edge-light` for Vercel Edge) tailored for strict serverless constraints.
23
23
  - ๐Ÿงต **Multi-Threaded Worker Pool**: Process thousands of images in parallel using `wasm-html-to-image/workers` (Node.js worker threads / Web Workers).
@@ -149,6 +149,7 @@ All formats return a `RenderResult<T>` object containing `.data` (`Uint8Array` o
149
149
  | `jpeg` | `Uint8Array` | Skia render โ†’ JPEG encode (`quality`) | Decodes and compresses JPEG |
150
150
  | `webp` | `Uint8Array` | Skia render โ†’ WebP encode (`quality`) | Decodes and compresses WebP |
151
151
  | `avif` | `Uint8Array` | Skia render โ†’ AVIF encode (`quality`, `speed`) | Decodes and compresses AVIF |
152
+ | `jxl` | `Uint8Array` | Skia render โ†’ JXL encode (`quality`, `speed`) | Decodes and compresses JXL |
152
153
  | `raw` | `Uint8Array` | Uncompressed RGBA pixel bytes | Uncompressed RGBA pixel bytes |
153
154
  | `thumbhash` | `Uint8Array` | Computes ThumbHash from render | Computes ThumbHash from image |
154
155
  | `svg` | `string` | Skia vector drawing stream | Single `<image>` wrapper SVG |
@@ -207,10 +208,13 @@ app.listen(3000);
207
208
  Generate dynamic social preview images at the edge:
208
209
 
209
210
  ```typescript
210
- // wrangler.jsonc:
211
- // { "rules": [{ "type": "CompiledWasm", "globs": ["**/*.wasm"], "fallthrough": false }] }
211
+ // wrangler.jsonc: no "rules" needed on current Wrangler (v3/v4) โ€”
212
+ // `import ... from "*.wasm"` is bundled as WebAssembly.Module by default.
213
+ // Minimal wrangler.jsonc: { "main": "src/index.ts", "compatibility_date": "2026-09-01" }
214
+ // (Only configure "rules" yourself if you customize bundling rules or use a very old Wrangler.
215
+ // Note: @cloudflare/vite-plugin ignores "rules".)
212
216
 
213
- import { render } from "wasm-html-to-image/workerd";
217
+ import { render } from "wasm-html-to-image"; // auto-selects the workerd build on Cloudflare ("wasm-html-to-image/workerd" also works)
214
218
 
215
219
  export default {
216
220
  async fetch(request: Request): Promise<Response> {
package/dist/cli.js CHANGED
@@ -11,6 +11,7 @@ const OUTPUT_FORMATS = [
11
11
  "jpeg",
12
12
  "webp",
13
13
  "avif",
14
+ "jxl",
14
15
  "raw",
15
16
  "thumbhash",
16
17
  "none",
@@ -36,7 +37,7 @@ async function readInput(input) {
36
37
  }
37
38
  program
38
39
  .name("wasm-html-to-image")
39
- .description("HTML to image converter on the single unified WASM module (svg/pdf direct, png/jpeg/webp/avif/raw/thumbhash via encode or html_to_image)")
40
+ .description("HTML to image converter on the single unified WASM module (svg/pdf direct, png/jpeg/webp/avif/jxl/raw/thumbhash via encode or html_to_image)")
40
41
  .version("0.1.0")
41
42
  .argument("<input>", "input HTML/image file path or URL")
42
43
  .option("-o, --output <path>", "output file path")
package/dist/core.d.ts CHANGED
@@ -15,7 +15,7 @@ export type { DiagnosticMessage, FontDiagnostic, RenderDiagnostics, RenderLimits
15
15
  * (`converter_load_image` -> optional crop/resize -> `converter_encode`,
16
16
  * or `converter_encode_svg` / `converter_encode_pdf`).
17
17
  */
18
- export type OutputFormat = "svg" | "png" | "pdf" | "jpeg" | "webp" | "avif" | "raw" | "thumbhash" | "none";
18
+ export type OutputFormat = "svg" | "png" | "pdf" | "jpeg" | "webp" | "avif" | "jxl" | "raw" | "thumbhash" | "none";
19
19
  /** Result of rendering an HTML document or converting an image. */
20
20
  export interface RenderResult<T = Uint8Array | string> {
21
21
  /** Output binary or text (string for svg, Uint8Array for all others). */
@@ -6,6 +6,7 @@
6
6
  * satoru's `RenderDiagnostics` so playground-style consumers can switch
7
7
  * imports without reshaping reports.
8
8
  */
9
+ import type { OutputFormat } from "./core.js";
9
10
  /** Log severity, shared with the WASM `set_log_level` binding. */
10
11
  export declare enum LogLevel {
11
12
  None = 0,
@@ -47,7 +48,7 @@ export interface DiagnosticMessage {
47
48
  /** Full render diagnostics report (satoru-compatible). */
48
49
  export interface RenderDiagnostics {
49
50
  version: 1;
50
- format: "svg" | "png" | "webp" | "pdf";
51
+ format: OutputFormat;
51
52
  width: number;
52
53
  height?: number;
53
54
  mediaType: "screen" | "print";
@@ -6,6 +6,7 @@ export const FORMAT_INT = {
6
6
  pdf: 3,
7
7
  jpeg: 4,
8
8
  avif: 5,
9
+ jxl: 8,
9
10
  raw: 6,
10
11
  thumbhash: 7,
11
12
  none: -1,
Binary file