Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@hpcc-js/wasm-graphviz

hpcc-systems38.6kApache-2.01.8.0TypeScript support: included

hpcc-js - WASM Graphviz

graphviz, typescript, webassembly, wasm, dot, neato, twopi

readme

@hpcc-js/wasm - Version 3

Test PR release-please Coverage Status

This repository contains a collection of useful c++ libraries compiled to WASM for (re)use in Node JS, Web Browsers and JavaScript Libraries:

Built with:

Homepage and Documents

Version 3 Changes

Converted this repository to a monorepo with the following packages:

  • @hpcc-js/wasm-base91
  • @hpcc-js/wasm-duckdb
  • @hpcc-js/wasm-expat
  • @hpcc-js/wasm-graphviz
  • @hpcc-js/wasm-graphviz-cli
  • @hpcc-js/wasm-zstd
  • @hpcc-js/wasm (meta package for backward compatibility)

Quick Start

import { Base91 } from "@hpcc-js/wasm-base91";
import { Graphviz } from "@hpcc-js/wasm-graphviz";
import { Zstd } from "@hpcc-js/wasm-zstd";

// Graphviz  ---
async function dot2svg() {
    const graphviz = await Graphviz.load();
    console.log("svg:  ", graphviz.dot('digraph G { Hello -> World }'));
}

dot2svg();

// Base91 + Zstd ---
const text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi.  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi.";
const data = new TextEncoder().encode(text);

async function compressDecompress() {
    const zstd = await Zstd.load();
    const compressed_data = zstd.compress(data);
    const base91 = await Base91.load();
    const base91Str = base91.encode(compressed_data);

    const compressed_data2 = base91.decode(base91Str);
    const data2 = zstd.decompress(compressed_data2);
    const text2 = new TextDecoder().decode(data2);

    console.log("Text Length:  ", text.length);
    console.log("Compressed Length:  ", compressed_data.length);
    console.log("Base91 Length:  ", base91Str.length);
    console.log("Passed:  ", text === text2);
}

compressDecompress();

Quick Migration from v1

v1.x.x

import { graphviz, wasmFolder } from "@hpcc-js/wasm";

wasmFolder("https://cdn.jsdelivr.net/npm/@hpcc-js/wasm/dist");

const dot = "digraph G { Hello -> World }";

graphviz.dot(dot).then(svg => {
    const div = document.getElementById("placeholder");
    div.innerHTML = svg;    
});

graphvizVersion.then(version => console.log(version));

v2.x.x

import { Graphviz } from "@hpcc-js/wasm";

const dot = "digraph G { Hello -> World }";

Graphviz.load().then(graphviz => {
    const svg = graphviz.dot(dot);
    const div = document.getElementById("placeholder");
    div.innerHTML = svg;    

    console.log(graphviz.version());
});

Notes:

  • wasmFolder is no longer needed
  • All wasm libraries have the same asynchronous load pattern
    • const instance = await <Wasm>.load();

v3.x.x

import { Graphviz } from "@hpcc-js/wasm-graphviz";

const dot = "digraph G { Hello -> World }";

Graphviz.load().then(graphviz => {
    const svg = graphviz.dot(dot);
    const div = document.getElementById("placeholder");
    div.innerHTML = svg;    

    console.log(graphviz.version());
});

Build Instructions

The following instructions are for building the entire repository from scratch. In general the instructions assume you are running from within a bash terminal.

  • Windows (With WSL2 and Git Bash installed)
  • Linux (native or WSL2)
  • MacOS
  • Docker

Pre-requisites

To get an idea of what pre-requisites are required, please see the following files:

Steps (Docker)

git clone https://github.com/hpcc-systems/hpcc-js-wasm.git
cd hpcc-js-wasm
npm ci
npm run build-docker

Steps (Windows, Linux, MacOS)

git clone https://github.com/hpcc-systems/hpcc-js-wasm.git
cd hpcc-js-wasm
npm ci
npm run install-build-deps
npm run build

changelog

Mono Repo Note:

This repository was converted to a mono repo as off @hpcc-js/wasm v2.19.0 and the @hpcc-js/wasm changelog is now maintained in the packages/wasm folder, see: packages/wasm/CHANGELOG.md.

This changelog is now a summary of all changes across all packages in the mono repo under the private name of @hpcc-js/wasm-root.

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

3.7.0 (2025-06-09)

Features

3.6.0 (2024-12-10)

Features

  • Bump DuckDB version to 1.1.3 (33d08e2)
  • Bump graphviz version to 12.2.0 (0427987)
  • Bump versions (2ae7438)

Bug Fixes

  • Ossar tests failing with new eslint file format (1e753a3)

3.5.1 (2024-09-29)

Bug Fixes

  • Graphviz targetting wrong platform (f5e992c)

3.5.0 (2024-09-29)

Features

Bug Fixes

  • Lint should not be run on push (5cc054b)

3.4.0 (2024-09-17)

Features

  • Add support for the canon output format (66bc3bb)

3.3.0 (2024-09-11)

Features

3.2.1 (2024-09-06)

Bug Fixes

  • Add missing DuckDB to wasm package (7f45a67), closes #257

3.2.0 (2024-08-30)

Features

  • Add llama.cpp web assembly support (5602a88)

Bug Fixes

  • Add -y option for publish (7cc8bd6)
  • Docs not building and deploying (2d5e89c)

3.1.1 (2024-08-15)

Bug Fixes

  • Graphviz not including html table support (#252) (11fd7e7)
  • Release Please Publish (#250) (ca67fa1)
  • UMD files were not backward compatible (11fd7e7)

3.1.0 (2024-08-14)

Features

Bug Fixes

3.0.0 (2024-08-13)

⚠ BREAKING CHANGES

  • Refactor public interfaces to follow common pattern Start using sfx-wasm bundler

Features

Bug Fixes

  • __filename and es6 modules (3d80a39)
  • __filename runtime error (969f62d)
  • _hpccwasmFolder override has erroneous "/" char. (1e4f67e)
  • "Last error" contains corrupt string (cc69093), closes #59
  • Add cli to "files" section (189ba5a)
  • Add index.js for type resolution (c370257)
  • Add missing export StackElement (d786b2a)
  • Add support for table based labels (e953069)
  • Add web worker unit test (f12f5e2)
  • build: Force scripts to have \n line endings (04e07ae)
  • Bundle yargs into cli.js (92dc2ba)
  • Convert JSDelivr purge to ESM (5712eb7)
  • Convert local import to be dynamic (af11237)
  • Dock path typo (9b217c8)
  • Docs failing to generate (5e6cf94)
  • Documentaion contains invalid links (65c3c4e), closes #226
  • Documentaion contains invalid links (225c175), closes #226
  • Env detection fails in next.js (7889083)
  • Error handling using GraphvizSync() layout (4ce3545), closes #125
  • Exclude sourcemaps from node_modules (a7772b3)
  • Expose specific node/browser packages (cb36fac), closes #115
  • Fix load cache II (98f2fcd)
  • Force pre-relase to true on "next" release. (c28b76a)
  • Global install missing yargs (a767e79)
  • graphviz: Add additional exports for Graphviz params (9d96281), closes #92
  • graphviz: Add missing options (and defaults) (f14588b)
  • Improve "require" and "commonjs" support (15e1ace)
  • Improve default wasmFolder heuristic (d85ddac)
  • Internal source maps can cause warnings in hosting packages (1a113ae)
  • Legacy browser loading fails (UMD) (1a4388a), closes #228
  • Limit dependabot.yml to only bump security issues (b41a764)
  • package: main points to non existant package (0128401), closes #114
  • publish: Auto releasing fails in GH Action (6af6f60)
  • Raw git demo fails (69ec4d5)
  • ReadMe: Minor formatting fix. (c0f8d9a)
  • readme: Update readme sample html to working version (c042ba9)
  • Remove "eval" code (4d5a0ee), closes #56
  • Rename version method for 2.x (13639ad)
  • Revert to es5 code generation (e29f5f4)
  • Rollback merging of NodeJS and Web builds (7c2c294)
  • Rollback wasmFolder heuristics (4f3d380)
  • security: Bump versions for latest security updates (caf6f1f)
  • Separate NodeJS module from Browser module (932dba5)
  • Site generation was failing (c64cd0f)
  • Sync cmake files (9229493)
  • Tag pre-release npm publish CI command (3785a32)
  • Test asset should fail (175325d)
  • test: Add helloworld.html example (7a0257a)
  • Typo in package.json (cbf98b0)
  • Typo in readme.md (8ab6955)
  • Update docker build (25e7410)
  • Update test/demo pages to work with es6 (70e0528), closes #146
  • vitepress failing to build docs (d179a54)
  • wasmBinary should be an ArrayBuffer (4b18e61)
  • wasmFolder caching issue (5e51fb5)
  • wasmFolder: Add default folder when "undefined" (233f97c)
  • wasmFolder: Remove trailing folder (e4e0e0f)

2.18.2 (2024-08-08)

Bug Fixes

  • Internal source maps can cause warnings in hosting packages (1a113ae)

2.18.1 (2024-08-06)

Bug Fixes

  • Documentaion contains invalid links (65c3c4e), closes #226
  • Documentaion contains invalid links (225c175), closes #226
  • Legacy browser loading fails (UMD) (1a4388a), closes #228

2.18.0 (2024-07-05)

Features

2.17.1 (2024-06-26)

Bug Fixes

  • Exclude sourcemaps from node_modules (a7772b3)
  • vitepress failing to build docs (d179a54)

2.17.0 (2024-06-25)

Features

2.16.2 (2024-04-29)

2.16.1 (2024-03-28)

2.16.0 (2024-02-11)

2.16.0-next.2 (2024-02-04)

Bug Fixes

  • Tag pre-release npm publish CI command (3785a32)

2.16.0-next.1 (2024-02-04)

Bug Fixes

  • Force pre-relase to true on "next" release. (c28b76a)

2.16.0-next.0 (2024-02-04)

Features

2.15.3 (2023-12-23)

2.15.2 (2023-12-22)

2.15.1 (2023-12-08)

Bug Fixes

  • Improve "require" and "commonjs" support (15e1ace)

2.15.0 (2023-11-25)

Features

  • Add nop and nop2 layout options (f71c4f1)

Bug Fixes

  • Limit dependabot.yml to only bump security issues (b41a764)
  • Site generation was failing (c64cd0f)

2.14.1 (2023-10-12)

2.14.0 (2023-09-13)

Features

Bug Fixes

2.13.1 (2023-07-31)

2.13.0 (2023-05-05)

Features

2.12.0 (2023-04-22)

Features

2.11.0 (2023-04-17)

Features

2.10.0 (2023-04-11)

Features

Bug Fixes

2.9.0 (2023-03-29)

Features

2.8.0 (2023-01-29)

Features

2.7.0 (2023-01-15)

Features

Bug Fixes

  • Convert local import to be dynamic (af11237)
  • Update test/demo pages to work with es6 (70e0528), closes #146

2.6.0 (2023-01-06)

Features

2.5.0 (2022-12-24)

Features

Bug Fixes

2.4.0 (2022-12-23)

Features

  • Add unload method to mirror load (9adf1f7)

2.3.0 (2022-12-06)

Features

Bug Fixes

2.2.0 (2022-11-26)

Features

2.1.1 (2022-11-13)

2.1.0 (2022-11-09)

Features

  • Bump GraphViz and emsdk versions (25aa1cc)

2.0.1 (2022-11-08)

Bug Fixes

  • Add index.js for type resolution (c370257)
  • Convert JSDelivr purge to ESM (5712eb7)

2.0.0 (2022-11-07)

⚠ BREAKING CHANGES

  • Refactor public interfaces to follow common pattern Start using sfx-wasm bundler

Update docs to use vitepress

Signed-off-by: Gordon Smith GordonJSmith@gmail.com

Features

  • Switch default to ESM Modules (02a4e0f)

1.20.1 (2022-11-06)

Bug Fixes

  • Rename version method for 2.x (13639ad)

1.20.0 (2022-11-06)

Features

  • Add self extracting wasm "sfx-graphviz" (2bc80f8)

1.19.1 (2022-11-04)

Bug Fixes

  • Add web worker unit test (f12f5e2)

1.19.0 (2022-11-02)

Features

Bug Fixes

  • Error handling using GraphvizSync() layout (4ce3545), closes #125

1.18.0 (2022-10-24)

Features

  • Bump GraphViz and Expat versions (763ed49)

1.17.1 (2022-10-23)

Bug Fixes

1.17.0 (2022-10-23)

Features

  • Bump GraphViz version to 6.0.2 (c5a8032)

1.16.5 (2022-09-24)

Bug Fixes

  • Rollback wasmFolder heuristics (4f3d380)

1.16.4 (2022-09-24)

Bug Fixes

  • __filename and es6 modules (3d80a39)

1.16.3 (2022-09-24)

Bug Fixes

  • __filename runtime error (969f62d)

1.16.2 (2022-09-24)

Bug Fixes

  • Improve default wasmFolder heuristic (d85ddac)

1.16.1 (2022-09-12)

1.16.0 (2022-09-10)

Features

1.15.7 (2022-09-08)

1.15.6 (2022-09-07)

Bug Fixes

  • Env detection fails in next.js (7889083)

1.15.5 (2022-09-07)

Bug Fixes

  • Expose specific node/browser packages (cb36fac), closes #115

1.15.4 (2022-08-28)

Bug Fixes

  • package: main points to non existant package (0128401), closes #114

1.15.3 (2022-08-21)

Bug Fixes

1.15.2 (2022-08-21)

Bug Fixes

  • wasmFolder caching issue (5e51fb5)

1.15.1 (2022-08-21)

1.14.2 (2022-08-21)

1.15.0 (2022-07-07)

Features

  • Bump versions to latest (ee76b82)

Bug Fixes

  • wasmBinary should be an ArrayBuffer (4b18e61)

1.14.1 (2022-04-04)

Bug Fixes

  • publish: Auto releasing fails in GH Action (6af6f60)

1.14.0 (2022-04-04)

Features

  • Add additional options to CLI (b05598b), closes #98

1.13.0 (2022-02-27)

Features

1.12.9 (2022-02-06)

Bug Fixes

  • graphviz: Add additional exports for Graphviz params (9d96281), closes #92

1.12.8 (2022-01-17)

1.12.7 (2021-12-09)

1.12.6 (2021-10-23)

1.12.5 (2021-10-17)

1.12.4 (2021-09-25)

1.12.3 (2021-09-19)

Bug Fixes

  • Global install missing yargs (a767e79)

1.12.2 (2021-09-19)

Bug Fixes

  • Bundle yargs into cli.js (92dc2ba)

1.12.1 (2021-09-19)

Bug Fixes

  • Add cli to "files" section (189ba5a)

1.12.0 (2021-09-19)

Features

  • Add Command Line Interface (caa0b11)

1.11.1 (2021-09-18)

Bug Fixes

  • graphviz: Add missing options (and defaults) (f14588b)

1.11.0 (2021-08-29)

Features

1.10.3 (2021-08-11)

Bug Fixes

  • Revert to es5 code generation (e29f5f4)

1.10.2 (2021-08-11)

Bug Fixes

  • Rollback merging of NodeJS and Web builds (7c2c294)

1.10.1 (2021-08-11)

1.10.0 (2021-08-11)

Features

  • Common up Node.js and Browser module code (48a6aff)

1.9.1 (2021-08-11)

Bug Fixes

  • Add missing export StackElement (d786b2a)

1.9.0 (2021-08-11)

Features

  • Include individual bundles (949c02f)

1.8.1 (2021-07-18)

Bug Fixes

1.8.0 (2021-07-17)

Features

1.7.1 (2021-07-12)

1.7.0 (2021-07-12)

Features

  • Bump versions to latest (b412b82)

1.6.0 (2021-06-21)

Features

Bug Fixes

  • build: Force scripts to have \n line endings (04e07ae)

1.5.3 (2021-06-04)

1.5.2 (2021-05-13)

Bug Fixes

  • security: Bump versions for latest security updates (caf6f1f)
  • test: Add helloworld.html example (7a0257a)

1.5.1 (2021-04-18)

1.5.0 (2021-04-18)

Features

  • graphviz: Bump version to 2.47.1 (0d542c6)

1.4.1 (2021-03-16)

Bug Fixes

  • "Last error" contains corrupt string (cc69093), closes #59

1.4.0 (2021-03-16)

Features

  • graphviz: Bump version to 2.47.0 (d4157aa)

Bug Fixes

1.3.0 (2021-02-22)

Features

  • wasmBinary: Allow pre-fetching of wasmBinary (c86bdd0), closes #53

1.2.1 (2021-02-14)

1.2.0 (2021-01-24)

Features

1.1.0 (2021-01-18)

Features

  • graphviz: Bump c++ versions (a4eaf51)

1.0.2 (2021-01-16)

1.0.1 (2020-12-17)

Bug Fixes

  • Separate NodeJS module from Browser module (932dba5)

1.0.0 (2020-12-17)

Features

  • graphviz: Bump version to 2.44.1 (e07624b)
  • Add support for Node JS (d558687)

Bug Fixes

0.3.15 (2020-12-16)

Features

  • Add support for yInvert and nop (2e34ce5)

0.3.14 (2020-05-18)

Bug Fixes

  • wasmFolder: Add default folder when "undefined" (233f97c)

0.3.13 (2020-04-12)

Features

  • graphviz: Bump version to 2.44.0 (8c484d9)

0.3.12 (2020-04-10)

Bug Fixes

  • _hpccwasmFolder override has erroneous "/" char. (1e4f67e)

0.3.11 (2020-04-06)

Features

  • xml: Add simple XML parser based on expat (cafb0f6)

0.3.10 (2020-03-20)

0.3.9 (2020-03-20)

0.3.8 (2020-03-05)

0.3.7 (2020-03-05)

Bug Fixes

  • Add support for table based labels (e953069)

0.3.6 (2020-03-02)

Features

  • Images: Add Image Support (b9c3015)

0.3.5 (2020-02-27)

Features

  • GraphViz: Add basic error handling (5e58238)

0.3.4 (2020-02-26)

Features

  • Add "Sync" version of Graphviz (f80a626), closes #8

0.3.3 (2020-02-20)

0.3.2 (2020-02-06)

Bug Fixes

  • wasmFolder: Remove trailing folder (e4e0e0f)

0.3.1 (2020-01-07)

Features

  • emsdk: Bump version to 1.5 (9692fed)
  • GraphViz: Bump version to 2.42.2 (782dfdf)

0.3.0 (2019-09-19)

Bug Fixes

  • ReadMe: Minor formatting fix. (c0f8d9a)

Features

  • graphviz: Add additional convenience methods (dda20f4)

0.1.3 (2019-06-14)

Bug Fixes

  • readme: Update readme sample html to working version (c042ba9)

0.1.2 (2019-06-14)

0.1.1 (2019-06-14)

0.1.0 (2019-06-14)

Features

  • GraphViz: Initial commit (2cf6182)