Skip to content

About

Build tooling and browser/WASM modifications for Tinymist's VS Code Web extension. Builds the WASM target and bundles selected Typst packages and fonts into a VSIX.

Topics

Resources

Contributing

Stars

0 stars

Watchers

1 watching

Forks

 
 

Latest commit

 

History

1,973 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tinymist WASM Bundler

GitHub licenseActions status

Edit Typst in the browser—or on restricted devices—without installing or hosting a separate Tinymist backend. Tinymist WASM Bundler builds upstream Tinymist for WebAssembly and packages it as a VS Code Web extension, with selected Typst packages and optional fonts bundled into the VSIX for use at runtime. The Tinymist language service remains the upstream project; this repository provides the browser/WASM build and bundling tooling.

Browser/WASM build

The browser target runs Tinymist as a VS Code Web Extension. Typst packages and optional fonts selected in the manifest are embedded in the VSIX at build time. At runtime, the extension uses those bundled assets; packages that were not included are not downloaded.

The WASM module cannot make network requests or access the host filesystem directly. VS Code reads workspace files through its extension API and passes their contents to the compiler. This describes the WASM boundary, not a security guarantee for documents or the surrounding extension.

To use the extension on a machine without package or font downloads, build the VSIX on a machine with the required tools and transfer it for local installation. The bundled assets need no runtime downloads.

Quick start: prebuilt browser starter

The easiest way to try the browser build is to download the prebuilt tinymist-web-<version>.vsix from the latest browser starter release. Install that VSIX in Visual Studio Code with the Install from VSIX... command described below. The release is ready to use without first running a custom build.

The starter bundle is deliberately compact while covering common Typst workflows:

  • Diagrams and charts: CeTZ (0.3.4 for Fletcher compatibility and 0.5.3 for current projects), Fletcher, and Lilaq.
  • Code blocks: Codly and its language definitions.
  • Writing and structure: Glossarium, CTheorems, and Showybox.
  • Technical and scientific documents: Kalt (with its Sertyp dependency), Physica, and Unify.
  • Presentations: Touying.
  • Extra fonts: Inter and JetBrains Mono, each with regular and italic variable faces. Typst’s built-in fonts are included automatically. The bundle also includes the small helper packages these libraries need, such as Oxifmt, Elembic, Sertyp, Tiptoe, UniWarn, and Zero.

Treat this as a useful starting point, not a fixed set. You can add or remove packages and fonts in wasm-assets.toml and build your own VSIX whenever you need. The customization and local build steps below work with your edited manifest; you do not need a fork or a special release to make a custom bundle.

Customize bundled packages and fonts

The default package list is in wasm-assets.toml. Start by copying it:

cp wasm-assets.toml my-wasm-assets.toml

Edit the [packages] table in my-wasm-assets.toml. Keys are the actual Typst package names; no aliases or Cargo version prefixes are needed. Use a single version string, a list of versions, or "latest":

[packages]
cetz = ["0.3.4", "0.5.3"]
zero = ["0.6.1", "0.7.1"]
codly = "2.0.0"
fletcher = "latest"

Typst imports still require a concrete version. When you run --update-lock, "latest" is resolved against the Typst Universe index and the selected version is recorded in the lock. Normal locked builds keep using that selected version until you deliberately update the lock.

You can also bundle a package directly from a local directory or Git repository:

[packages]
my_local_package = { path = "../my-local-package", namespace = "local" }
my_git_package = { git = "https://github.com/example/typst-package.git", rev = "0123456789abcdef0123456789abcdef01234567", subdirectory = "package", namespace = "local" }

A local path is relative to the manifest file and must contain the package’s typst.toml. For Git sources, specify exactly one of rev, tag, or branch; the lock records the resolved commit. A full commit ID in rev is the most explicit choice. Use arrays to select multiple local or Git versions of the same package too.

For published Typst packages, do not add per-package license tables: the builder reads the SPDX expression from typst.toml and the LICENSE file from the package source. It retrieves canonical SPDX texts when LICENSE is only a short identifier. Package license details are stored in the lock. Use [package.metadata.tinymist.dependency-metadata.<package-name>] only for exceptional overrides.

Typst’s built-in text fonts are compiled into the web build and need no configuration. Add extra fonts under [package.metadata.tinymist.fonts.<name>]. Each extra font needs a file URL and explicit license information; only bundle fonts whose licenses permit redistribution.

For example, add an extra font like this (merge it into the copied manifest):

[package.metadata.tinymist.fonts.MyFontRegular]
file = "MyFont-Regular.ttf"
url = "https://example.org/fonts/MyFont-Regular.ttf"
license = "SIL OFL 1.1"
license-url = "https://example.org/fonts/OFL.txt"

For a non-standard package without a discoverable license notice, provide an explicit license override under [package.metadata.tinymist.dependency-metadata.<package-name>]. The package and font names/URLs above are placeholders. Package sources, versions, checksums and license notice hashes are recorded in the adjacent lock file.

Each manifest has a neighbouring .lock.json file. It records SHA-256 hashes for registry package archives or deterministic local/Git package contents, downloaded font files, and license notices. When you first use a custom manifest, or change its dependencies or fonts, generate/update that lock as part of the build with --update-lock. Keep the TOML file and its lock file together. For normal repeat builds, leave off --update-lock so the recorded checksums are enforced.

Build a browser VSIX

Clone this repository and enter its directory:

git clone https://github.com/Uhrendoktor/tinymist-wasm-bundler.git
cd tinymist-wasm-bundler

Build with the default package/font list:

node scripts/build-browser.mjs

Or build your custom manifest and choose the VSIX output path:

node scripts/build-browser.mjs \
  --manifest "$PWD/my-wasm-assets.toml" \
  --output "$PWD/dist/tinymist-web-custom.vsix" \
  --update-lock

Use --update-lock on the first build after changing the manifest. For later reproducible builds, run the same command without that flag. The script installs the repository’s pinned JavaScript dependencies, makes sure the WASM Rust target is installed, builds the browser extension, and prints the resulting VSIX path and SHA-256 checksum.

You need Node.js 20.11 or newer (Node.js 24 is used in CI), Rust and rustup, npm, and the usual native build tools. On Linux x86_64 and macOS/other POSIX systems, the script bootstraps the pinned Yarn and wasm-pack tools. On Windows, install Yarn 1.22.22 and wasm-pack 0.15.1 yourself and put them on PATH.

The custom manifest can be stored outside the repository too. The full configuration reference, lock-file commands, host prerequisites, and runtime limitations are in the browser WASM asset guide.

Install the VSIX in Visual Studio Code

Copy the generated .vsix file to the computer where you want to use the extension. You do not need to install it from the Marketplace.

  1. Open Visual Studio Code.
  2. Open the Extensions view with Ctrl+Shift+X (Windows/Linux) or Cmd+Shift+X (macOS).
  3. Select the ... menu in the Extensions view and choose Install from VSIX…. You can also open the Command Palette and run Extensions: Install from VSIX….
  4. Select the VSIX you built, for example dist/tinymist-web-custom.vsix.
  5. Reload or restart VS Code if it asks you to.

You can also install it from a terminal when the code command is on your PATH:

code --install-extension ./dist/tinymist-web-custom.vsix

After installation, open a .typ file or a Typst workspace to use the extension. For more information about VS Code’s local VSIX installation, see the official VS Code documentation.

About

Build tooling and browser/WASM modifications for Tinymist's VS Code Web extension. Builds the WASM target and bundles selected Typst packages and fonts into a VSIX.

Topics

Resources

Contributing

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages