Skip to content

Commit

Permalink
chore: Update documentation and links
Browse files Browse the repository at this point in the history
Signed-off-by: Gordon Smith <[email protected]>
  • Loading branch information
GordonSmith committed Aug 13, 2024
1 parent a84bb3e commit b4911fd
Show file tree
Hide file tree
Showing 20 changed files with 117 additions and 290 deletions.
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ dist/
dist-test/
/docs/.vitepress/cache
/docs/.vitepress/dist
/docs/classes
/docs/interfaces
/docs/modules
/docs/.nojekyll
/docs/base91
/docs/duckdb
/docs/expat
/docs/graphviz
/docs/zstd
/docs/README.md
/emsdk*
/lib-*
Expand Down
10 changes: 5 additions & 5 deletions docs/.vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ export default {
{
text: 'WASM API',
items: [
{ text: 'Base91', link: '/base91/classes/Base91' },
{ text: 'DuckDB', link: '/duckdb/classes/DuckDB' },
{ text: 'Expat', link: '/expat/classes/Expat' },
{ text: 'Graphviz', link: '/graphviz/classes/Graphviz' },
{ text: 'Zstd', link: '/zstd/classes/Zstd' },
{ text: 'Base91', link: '/base91/src/base91/classes/Base91' },
{ text: 'DuckDB', link: '/duckdb/src/duckdb/classes/DuckDB' },
{ text: 'Expat', link: '/expat/src/expat/classes/Expat' },
{ text: 'Graphviz', link: '/graphviz/src/graphviz/classes/Graphviz' },
{ text: 'Zstd', link: '/zstd/src/zstd/classes/Zstd' },
]
}

Expand Down
10 changes: 5 additions & 5 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ hero:
features:
- title: Base 91
details: Similar to Base 64 but uses more characters resulting in smaller strings.
link: /base91/classes/Base91
link: /base91/src/base91/classes/Base91
- title: DuckDB
details: DuckDB - a fast in-process analytical database.
link: /duckdb/classes/DuckDB
link: /duckdb/src/duckdb/classes/DuckDB
- title: Expat
details: A popular stream-oriented XML parser library.
link: /expat/classes/Expat
link: /expat/src/expat/classes/Expat
- title: GraphViz
details: The Graphviz layout algorithms take descriptions of graphs in a simple text language, and make diagrams in useful formats, such as images and SVG for web pages or display in an interactive graph browser.
link: /graphviz/classes/Graphviz
link: /graphviz/src/graphviz/classes/Graphviz
- title: Zstd
details: Zstandard is a fast compression algorithm, providing high compression ratios and is backed by an extremely fast decoder.
link: /zstd/classes/Zstd
link: /zstd/src/zstd/classes/Zstd
---
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"uninstall-build-deps": "rimraf ./emsdk ./vcpkg ./src-expat ./src-vcpkg ./wasi-sdk ./wit-bindgen",
"uninstall": "rimraf --glob ./node_modules ./packages/**/node_modules ./package-lock.json",
"clean-build": "rimraf --glob .nyc_output bin build coverage output-* tmp vcpkg/vcpkg .nx",
"clean-docs": "rimraf docs/.vitepress/dist docs/classes docs/interfaces docs/modules docs/.nojekyll docs/README.md",
"clean-docs": "rimraf docs/.vitepress/dist docs/.vitepress/cache docs/base91 docs/duckdb docs/expat docs/graphviz docs/zstd docs/README.md",
"clean-root": "run-p clean-build clean-docs",
"clean": "lerna run clean",
"copy-res": "cp ./docs/*.png ./docs/.vitepress/dist",
Expand Down
20 changes: 12 additions & 8 deletions packages/base91/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
# @hpcc-js/wasm-graphviz
# @hpcc-js/wasm-base91

This package provides a WebAssembly wrapper around the [Graphviz](https://www.graphviz.org/) library. This allows for the rendering of DOT language graphs directly within a browser or NodeJS type environment.
This package provides a WebAssembly wrapper around the [Base91](https://base91.sourceforge.net/) library. This allows for the encoding and decoding of binary data to a more compact form than Base64.

## Installation

```sh
npm install @hpcc-js/wasm-graphviz
npm install @hpcc-js/wasm-base91
```

## Usage
## Quick Start

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

const graphviz = await Graphviz.load();
const svg = graphviz.dot(`digraph { a -> b; }`);
document.body.innerHTML = svg;
const base91 = await Base91.load();

const encoded_data = await base91.encode(data);
const decoded_data = await base91.decode(encoded_data);
```

## Reference

* [API Documentation](https://hpcc-systems.github.io/hpcc-js-wasm/base91/src/base91/classes/Base91.html)
2 changes: 1 addition & 1 deletion packages/base91/src/base91.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let g_base91: Promise<Base91>;
* See [Base91](https://base91.sourceforge.net/) for more details.
*
* ```ts
* import { Base91 } from "@hpcc-js/wasm/base91";
* import { Base91 } from "@hpcc-js/wasm-base91";
*
* const base91 = await Base91.load();
*
Expand Down
33 changes: 26 additions & 7 deletions packages/duckdb/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,39 @@
# @hpcc-js/wasm-graphviz
# @hpcc-js/wasm-duckdb

This package provides a WebAssembly wrapper around the [Graphviz](https://www.graphviz.org/) library. This allows for the rendering of DOT language graphs directly within a browser or NodeJS type environment.
This package rewraps the DuckDB webassembly distribution provided by DuckDB, this is purly a convenience to provide a consistent loading experience with the rest of the @hpcc-js.wasm library.
See [DuckDB](https://github.com/duckdb/duckdb) and [DuckDB-wasm](https://github.com/duckdb/duckdb-wasm) for more details.

## Installation

```sh
npm install @hpcc-js/wasm-graphviz
npm install @hpcc-js/wasm-duckdb
```

## Usage

```typescript
import { Graphviz } from "@hpcc-js/wasm-graphviz";
import { DuckDB } from "@hpcc-js/wasm-duckdb";

const graphviz = await Graphviz.load();
const svg = graphviz.dot(`digraph { a -> b; }`);
document.body.innerHTML = svg;
let duckdb = await DuckDB.load();
const c = await duckdb.db.connect();

const data = [
{ "col1": 1, "col2": "foo" },
{ "col1": 2, "col2": "bar" },
];
await duckdb.db.registerFileText("rows.json", JSON.stringify(data));
await c.insertJSONFromPath('rows.json', { name: 'rows' });

const arrowResult = await c.query("SELECT * FROM read_json_auto('rows.json')");
const result = arrowResult.toArray().map((row) => row.toJSON());
expect(result.length).to.equal(data.length);
for (let i = 0; i < result.length; i++) {
expect(result[i].col2).to.equal(data[i].col2);
}

c.close();
```

## Reference

* [API Documentation](https://hpcc-systems.github.io/hpcc-js-wasm/duckdb/src/duckdb/classes/DuckDB.html)
2 changes: 1 addition & 1 deletion packages/duckdb/src/duckdb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { AsyncDuckDB, ConsoleLogger } from "@duckdb/duckdb-wasm";
* See [DuckDB](https://github.com/duckdb/duckdb) for more details.
*
* ```ts
* import { DuckDB } from "@hpcc-js/wasm/duckdb";
* import { DuckDB } from "@hpcc-js/wasm-duckdb";
*
* let duckdb = await DuckDB.load();
* const c = await duckdb.db.connect();
Expand Down
29 changes: 22 additions & 7 deletions packages/expat/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
# @hpcc-js/wasm-graphviz
# @hpcc-js/wasm-expat

This package provides a WebAssembly wrapper around the [Graphviz](https://www.graphviz.org/) library. This allows for the rendering of DOT language graphs directly within a browser or NodeJS type environment.
This package provides a WebAssembly wrapper around the [libexpat](https://libexpat.github.io/) library. This provides efficent SAX XML parsing.

## Installation

```sh
npm install @hpcc-js/wasm-graphviz
npm install @hpcc-js/wasm-expat
```

## Usage

```typescript
import { Graphviz } from "@hpcc-js/wasm-graphviz";
import { Expat } from "@hpcc-js/wasm-expat";

const graphviz = await Graphviz.load();
const svg = graphviz.dot(`digraph { a -> b; }`);
document.body.innerHTML = svg;
const expat = await Expat.load();

const xml = ` \
<root>
<child xxx="yyy">content</child>
</root>
`;

const callback = {
startElement(tag, attrs) { console.log("start", tag, attrs); },
endElement(tag) { console.log("end", tag); },
characterData(content) { console.log("characterData", content); }
};

expat.parse(xml, callback);
```

## Reference

* [API Documentation](https://hpcc-systems.github.io/hpcc-js-wasm/expat/src/expat/classes/Expat.html)
2 changes: 1 addition & 1 deletion packages/expat/src/expat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function parseAttrs(attrs: string): Attributes {
* See [libexpat.github.io](https://libexpat.github.io/) for c++ details.
*
* ```ts
* import { Expat } from "@hpcc-js/wasm/expat";
* import { Expat } from "@hpcc-js/wasm-expat";
*
* const expat = await Expat.load();
*
Expand Down
59 changes: 0 additions & 59 deletions packages/expat/src/wasm-library.ts

This file was deleted.

1 change: 1 addition & 0 deletions packages/graphviz-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
This package provides a command line interface for the `@hpcc-js/wasm-graphviz` package.

To call `@hpcc-js/wasm-graphviz-cli` without installing:

```sh
npx @hpcc-js/wasm-graphviz-cli [options] fileOrDot
```
Expand Down
5 changes: 4 additions & 1 deletion packages/graphviz/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This package provides a WebAssembly wrapper around the [Graphviz](https://www.gr
npm install @hpcc-js/wasm-graphviz
```

## Usage
## Quick Start

```typescript
import { Graphviz } from "@hpcc-js/wasm-graphviz";
Expand All @@ -18,3 +18,6 @@ const svg = graphviz.dot(`digraph { a -> b; }`);
document.body.innerHTML = svg;
```

## Reference

* [API Documentation](https://hpcc-systems.github.io/hpcc-js-wasm/graphviz/src/graphviz/classes/Graphviz.html)
2 changes: 1 addition & 1 deletion packages/graphviz/src/graphviz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type Engine = "circo" | "dot" | "fdp" | "sfdp" | "neato" | "osage" | "pat
/**
* Example: Passing a web hosted Image to GraphViz:
* ```ts
* import { Graphviz } from "@hpcc-js/wasm/graphviz";
* import { Graphviz } from "@hpcc-js/wasm-graphviz";
*
* const graphviz = await Graphviz.load();
* const svg = graphviz.layout('digraph { a[image="https://.../image.png"]; }', "svg", "dot", {
Expand Down
Loading

0 comments on commit b4911fd

Please sign in to comment.