npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@brief-jetzt/wasm-typst

v0.18.0

Published

[![CI](https://github.com/brief-jetzt/wasm-typst/actions/workflows/CI.yml/badge.svg)](https://github.com/brief-jetzt/wasm-typst/actions/workflows/CI.yml) [![CD](https://github.com/brief-jetzt/wasm-typst/actions/workflows/CD.yml/badge.svg)](https://github.

Readme

CI CD version downloads License

wasm bindings for typst

This package allows you to use the typst library in the browser.

Usage

The package ships an ergonomic wrapper. Each renderer owns its own wasm instance, so you can create as many as you need:

npm install @brief-jetzt/wasm-typst
import { createTypstRenderer } from "@brief-jetzt/wasm-typst";

const renderer = createTypstRenderer({
  fonts: [{ path: "MyFont.ttf", data: fontBytes }], // Uint8Array; optional
  sources: {
    "main.typ": "#set text(font: \"My Font\")\nHello #sys.inputs.name",
  },
  // files: { "logo.png": pngBytes },  // optional binary assets
});

const { output, diagnostics } = renderer.render({
  type: "pdf", // or "svg" | "svg-pages" | "png-pages"
  input: { name: "world" }, // typst sys.inputs
  // now: Temporal.Instant | Date | epoch millis — feeds datetime.today() and
  // the PDF timestamp; defaults to Date.now(). Fix it for reproducible output.
});
// output: Uint8Array (pdf) or string (svg); one entry per page for the -pages types
// diagnostics: Diagnostic[] ([] when clean), errors first:
//   { severity: "error" | "warning", message, path?, start?, end?, line?, column?, hints }

renderer.updateSource("main.typ", "Changed");
renderer.update({ sources: { "main.typ": "..." } }); // shallow-merge

// Single-page PNG (thumbnails etc.), 2 pixels per typographic point:
const png = renderer.renderPng(0, 2);

// Editor/IDE helpers (byte offsets into the given source):
renderer.autocomplete("main.typ", 3, true); // { from, completions: [{ kind, label, apply?, detail? }] }?
renderer.tooltip("main.typ", 13); // { kind: "text" | "code", text }?
renderer.goToDefinition(0, 35, 27); // click (page, xMm, yMm) -> { path, cursor }?
renderer.jumpFromCursor("main.typ", 3); // cursor -> [{ page, x, y }] in mm

// Editing on the rendered page, precise to the character (byte offsets, mm):
renderer.caretPosition("main.typ", 3); // cursor -> { page, x, y, height }?
renderer.selectionRects("main.typ", 0, 5); // range -> [{ page, x, y, width, height }]
renderer.cursorAt("main.typ", 0, 30, 27); // nearest cursor to (page, xMm, yMm), also beside the text

renderer.dispose(); // frees the wasm instance (or `using renderer = ...`)

Development

Running tests:

npm test

Building the package (runs wasm-pack build, then bundles the TS glue into pkg/):

npm ci
npm run build

You can then install the package in another npm project:

cd <your-npm-project>
npm install <path-to-this-repo>/pkg

If you are installing it in a project that already has @brief-jetzt/wasm-typst installed, you may want to modify it's package.json: Make sure that the local dependency has the prefix @brief-jetzt set, so that your import statements keep working:

  "dependencies": {
    "@brief-jetzt/wasm-typst": "file:../../wasm-typst/pkg",
  }

Run npm i.