d2/d2js
2025-01-14 14:31:21 -06:00
..
js.go update format 2025-01-14 14:31:21 -06:00
README.md init 2025-01-14 14:31:20 -06:00

D2 as a Javascript library

D2 is runnable as a Javascript library, on both the client and server side. This means you can run D2 entirely on the browser.

This is achieved by a JS wrapper around a WASM file.

Install

NPM

npm install @terrastruct/d2

Yarn

yarn add @terrastruct/d2

Build

GOOS=js GOARCH=wasm go build -ldflags='-s -w' -trimpath -o main.wasm ./d2js

API

todo