Skip to content

hpcc-systems/hpcc-js-wasm

Folders and files

NameName
Last commit message
Last commit date
Oct 17, 2023
Mar 29, 2023
Sep 13, 2023
Nov 17, 2022
Aug 21, 2022
Oct 10, 2023
Dec 30, 2022
Apr 11, 2023
Jan 29, 2023
Dec 30, 2022
Sep 13, 2023
Dec 30, 2022
Nov 7, 2022
Jul 8, 2022
Sep 13, 2023
Dec 30, 2022
Oct 12, 2023
Dec 30, 2022
Jan 18, 2021
Oct 10, 2023
Dec 30, 2022
Jan 12, 2023
Jan 12, 2023
Jan 12, 2023
Nov 26, 2022
Jan 12, 2023
Nov 7, 2022
Oct 18, 2023
Oct 18, 2023
Nov 8, 2022
Nov 7, 2022
Sep 13, 2023
Dec 30, 2022
Jul 8, 2022
Jan 7, 2023

Repository files navigation

@hpcc-js/wasm - Version 2

Tests Coverage Status

@hpcc-js/wasm is now an ESM by default package - this is a good thing, but does require some breaking changes.

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

Quick Migration Example

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/graphviz";

const graphviz = await Graphviz.load();

const dot = "digraph G { Hello -> World }";
const svg = graphviz.dot(dot);
console.log(graphviz.version());

Notes:

  • Import must specify which wasm library you are using
  • wasmFolder is no longer needed
  • All wasm libraries have the same asynchronous load pattern
    • const instance = await Wasm.load();

⚠⚠⚠ TypeScript Notes ⚠⚠⚠

When importing an ESM package AND referencing explicit exports (like @hpcc-js/wasm/graphviz or @hpcc-js/wasm/expat), you should change the following tsconfig.json setting:

  • moduleResolution: Node16

This will ensure the correct "types" are auto discovered.