1
0

run npm install to generate a package lock

This commit is contained in:
sashinexists
2024-12-07 13:18:31 +11:00
parent e7d08a91b5
commit 23437d228e
2501 changed files with 290663 additions and 0 deletions

10
node_modules/graphviz-wasm/.editorconfig generated vendored Normal file
View File

@@ -0,0 +1,10 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

3
node_modules/graphviz-wasm/dist/constants.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
declare const DEFAULT_ENGINE = "dot";
declare const DEFAULT_FORMAT = "svg";
export { DEFAULT_ENGINE, DEFAULT_FORMAT };

5
node_modules/graphviz-wasm/dist/constants.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
/* MAIN */
const DEFAULT_ENGINE = 'dot';
const DEFAULT_FORMAT = 'svg';
/* EXPORT */
export { DEFAULT_ENGINE, DEFAULT_FORMAT };

6
node_modules/graphviz-wasm/dist/generate.d.ts generated vendored Normal file
View File

@@ -0,0 +1,6 @@
import type { Engine, Format } from './types';
declare const generate: (GRAPHVIZ_BASE64: string) => {
loadWASM: () => Promise<void>;
layout: (source: string, format?: Format, engine?: Engine) => string;
};
export default generate;

30
node_modules/graphviz-wasm/dist/generate.js generated vendored Normal file
View File

@@ -0,0 +1,30 @@
/* IMPORT */
import decode from 'decode-base64';
import once from 'function-once';
import wrapper from '../graphviz/wrapper.js';
import { DEFAULT_ENGINE, DEFAULT_FORMAT } from './constants.js';
/* MAIN */
const generate = (GRAPHVIZ_BASE64) => {
const Graphviz = {
/* LIFECYCLE API */
loadWASM: once(async () => {
const GRAPHVIZ_BUFFER = decode(GRAPHVIZ_BASE64);
const instance = await wrapper({ wasmBinary: GRAPHVIZ_BUFFER });
Graphviz.layout = (source, format = DEFAULT_FORMAT, engine = DEFAULT_ENGINE) => {
const graphviz = new instance.Graphviz();
const result = graphviz.layout(source, format, engine);
instance.destroy(graphviz);
if (!result)
throw new Error(instance.Graphviz.prototype.lastError());
return result;
};
}),
/* API */
layout: (source, format = DEFAULT_FORMAT, engine = DEFAULT_ENGINE) => {
throw new Error('[graphviz] You need to call and await "graphviz.loadWASM" first');
}
};
return Graphviz;
};
/* EXPORT */
export default generate;

7
node_modules/graphviz-wasm/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
import type { Engine, Format } from './types';
declare const Graphviz: {
loadWASM: () => Promise<void>;
layout: (source: string, format?: Format, engine?: Engine) => string;
};
export default Graphviz;
export type { Engine, Format };

7
node_modules/graphviz-wasm/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
/* IMPORT */
import GRAPHVIZ_BASE64 from '../graphviz/graphviz.js';
import generate from './generate.js';
/* MAIN */
const Graphviz = generate(GRAPHVIZ_BASE64);
/* EXPORT */
export default Graphviz;

3
node_modules/graphviz-wasm/dist/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
type Engine = 'circo' | 'dot' | 'fdp' | 'neato' | 'osage' | 'patchwork' | 'sfdp' | 'twopi';
type Format = 'dot_json' | 'dot' | 'json' | 'plain-ext' | 'plain' | 'svg' | 'xdot_json';
export type { Engine, Format };

2
node_modules/graphviz-wasm/dist/types.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
/* MAIN */
export {};

1
node_modules/graphviz-wasm/graphviz/graphviz.js generated vendored Normal file

File diff suppressed because one or more lines are too long

BIN
node_modules/graphviz-wasm/graphviz/graphviz.wasm generated vendored Normal file

Binary file not shown.

8
node_modules/graphviz-wasm/graphviz/update.sh generated vendored Executable file
View File

@@ -0,0 +1,8 @@
# CWD
cd graphviz
# Update WASM
wget -O graphviz.wasm https://unpkg.com/@hpcc-js/wasm/dist/graphvizlib.wasm
# Update TS
echo "export default '$(base64 graphviz.wasm)';" > graphviz.js

14
node_modules/graphviz-wasm/graphviz/wrapper.js generated vendored Normal file

File diff suppressed because one or more lines are too long

21
node_modules/graphviz-wasm/license generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2021-present Fabio Spampinato
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

33
node_modules/graphviz-wasm/package.json generated vendored Executable file
View File

@@ -0,0 +1,33 @@
{
"name": "graphviz-wasm",
"repository": "github:fabiospampinato/graphviz-wasm",
"description": "A port of Graphviz to WASM.",
"version": "3.0.2",
"type": "module",
"main": "dist/index.js",
"exports": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"clean": "tsex clean",
"compile": "tsex compile",
"compile:watch": "tsex compile --watch",
"test": "tsex test",
"test:watch": "tsex test --watch",
"update": "bash graphviz/update.sh",
"prepublishOnly": "tsex prepare"
},
"keywords": [
"graphviz",
"wasm",
"dot"
],
"dependencies": {
"decode-base64": "^3.0.1",
"function-once": "^3.0.0"
},
"devDependencies": {
"fava": "^0.2.1",
"tsex": "^3.0.1",
"typescript": "^5.1.6"
}
}

47
node_modules/graphviz-wasm/readme.md generated vendored Normal file
View File

@@ -0,0 +1,47 @@
# Graphviz WASM
A port of Graphviz to WASM.
Note: this is currently just a light wrapper around [`@hpcc-js/wasm`](https://www.npmjs.com/package/@hpcc-js/wasm), you might want to consider just using that directly. The plan is to eventually generate custom bindings to graphviz, optimized for speed and size, and depending on your use case you'd import the right one.
## Install
```sh
npm install --save graphviz-wasm
```
## Usage
This is how you'd use the library:
```ts
import graphviz from 'graphviz-wasm';
await graphviz.loadWASM (); // First of all you need to load the WASM instance and wait for it
const dot = `
strict graph {
a -- b
a -- b
b -- a [color=blue]
}
`;
const svg = graphviz.layout ( dot );
```
This is the interface of the `layout` method:
```ts
type Engine = 'circo' | 'dot' | 'fdp' | 'neato' | 'osage' | 'patchwork' | 'sfdp' | 'twopi';
type Format = 'dot_json' | 'dot' | 'json' | 'plain-ext' | 'plain' | 'svg' | 'xdot_json';
type layout = ( source: string, format: Format = 'svg', engine: Engine = 'dot' ) => string;
```
## License
- **Graphviz**: EPL © [Graphviz](https://gitlab.com/graphviz/graphviz/-/blob/main/LICENSE).
- **WASM Port**: Apache © [hpcc-js-wasm](https://github.com/hpcc-systems/hpcc-js-wasm/blob/trunk/LICENSE).
- **Rest**: MIT © Fabio Spampinato.

10
node_modules/graphviz-wasm/src/constants.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
/* MAIN */
const DEFAULT_ENGINE = 'dot';
const DEFAULT_FORMAT = 'svg';
/* EXPORT */
export {DEFAULT_ENGINE, DEFAULT_FORMAT};

55
node_modules/graphviz-wasm/src/generate.ts generated vendored Normal file
View File

@@ -0,0 +1,55 @@
/* IMPORT */
import decode from 'decode-base64';
import once from 'function-once';
import wrapper from '../graphviz/wrapper.js';
import {DEFAULT_ENGINE, DEFAULT_FORMAT} from './constants';
import type {Engine, Format} from './types';
/* MAIN */
const generate = ( GRAPHVIZ_BASE64: string ) => {
const Graphviz = {
/* LIFECYCLE API */
loadWASM: once ( async (): Promise<void> => {
const GRAPHVIZ_BUFFER = decode ( GRAPHVIZ_BASE64 );
const instance = await wrapper ({ wasmBinary: GRAPHVIZ_BUFFER });
Graphviz.layout = ( source: string, format: Format = DEFAULT_FORMAT, engine: Engine = DEFAULT_ENGINE ): string => {
const graphviz = new instance.Graphviz ();
const result = graphviz.layout ( source, format, engine );
instance.destroy ( graphviz );
if ( !result ) throw new Error ( instance.Graphviz.prototype.lastError () );
return result;
};
}),
/* API */
layout: ( source: string, format: Format = DEFAULT_FORMAT, engine: Engine = DEFAULT_ENGINE ): string => {
throw new Error ( '[graphviz] You need to call and await "graphviz.loadWASM" first' );
}
};
return Graphviz;
};
/* EXPORT */
export default generate;

15
node_modules/graphviz-wasm/src/index.ts generated vendored Executable file
View File

@@ -0,0 +1,15 @@
/* IMPORT */
import GRAPHVIZ_BASE64 from '../graphviz/graphviz.js';
import generate from './generate';
import type {Engine, Format} from './types';
/* MAIN */
const Graphviz = generate ( GRAPHVIZ_BASE64 );
/* EXPORT */
export default Graphviz;
export type {Engine, Format};

10
node_modules/graphviz-wasm/src/types.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
/* MAIN */
type Engine = 'circo' | 'dot' | 'fdp' | 'neato' | 'osage' | 'patchwork' | 'sfdp' | 'twopi';
type Format = 'dot_json' | 'dot' | 'json' | 'plain-ext' | 'plain' | 'svg' | 'xdot_json';
/* EXPORT */
export type {Engine, Format};

17
node_modules/graphviz-wasm/test/fixtures/input.txt generated vendored Normal file
View File

@@ -0,0 +1,17 @@
graph Foo {
a -- b;
b -- c;
c -- d;
d -- e;
e -- f;
a -- f;
a -- c;
a -- d;
a -- e;
b -- d;
b -- e;
b -- f;
c -- e;
c -- f;
d -- f;
}

124
node_modules/graphviz-wasm/test/fixtures/output.txt generated vendored Normal file
View File

@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.50.0 (20211209.1537)
-->
<!-- Title: Foo Pages: 1 -->
<svg width="255pt" height="404pt"
viewBox="0.00 0.00 254.93 404.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 400)">
<title>Foo</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-400 250.93,-400 250.93,4 -4,4"/>
<!-- a -->
<g id="node1" class="node">
<title>a</title>
<ellipse fill="none" stroke="black" cx="123" cy="-378" rx="27" ry="18"/>
<text text-anchor="middle" x="123" y="-373.8" font-family="Times,serif" font-size="14.00">a</text>
</g>
<!-- b -->
<g id="node2" class="node">
<title>b</title>
<ellipse fill="none" stroke="black" cx="123" cy="-306" rx="27" ry="18"/>
<text text-anchor="middle" x="123" y="-301.8" font-family="Times,serif" font-size="14.00">b</text>
</g>
<!-- a&#45;&#45;b -->
<g id="edge1" class="edge">
<title>a&#45;&#45;b</title>
<path fill="none" stroke="black" d="M123,-359.7C123,-348.85 123,-334.92 123,-324.1"/>
</g>
<!-- c -->
<g id="node3" class="node">
<title>c</title>
<ellipse fill="none" stroke="black" cx="207" cy="-234" rx="27" ry="18"/>
<text text-anchor="middle" x="207" y="-229.8" font-family="Times,serif" font-size="14.00">c</text>
</g>
<!-- a&#45;&#45;c -->
<g id="edge7" class="edge">
<title>a&#45;&#45;c</title>
<path fill="none" stroke="black" d="M134.14,-361.51C141.48,-351.08 151.15,-336.93 159,-324 174.03,-299.24 189.63,-269.42 198.81,-251.36"/>
</g>
<!-- d -->
<g id="node4" class="node">
<title>d</title>
<ellipse fill="none" stroke="black" cx="207" cy="-162" rx="27" ry="18"/>
<text text-anchor="middle" x="207" y="-157.8" font-family="Times,serif" font-size="14.00">d</text>
</g>
<!-- a&#45;&#45;d -->
<g id="edge8" class="edge">
<title>a&#45;&#45;d</title>
<path fill="none" stroke="black" d="M142.09,-364.91C170.87,-345.35 224.05,-303.69 243,-252 248.51,-236.98 247.7,-231.29 243,-216 238.62,-201.75 228.96,-187.9 220.75,-177.93"/>
</g>
<!-- e -->
<g id="node5" class="node">
<title>e</title>
<ellipse fill="none" stroke="black" cx="141" cy="-90" rx="27" ry="18"/>
<text text-anchor="middle" x="141" y="-85.8" font-family="Times,serif" font-size="14.00">e</text>
</g>
<!-- a&#45;&#45;e -->
<g id="edge9" class="edge">
<title>a&#45;&#45;e</title>
<path fill="none" stroke="black" d="M109.25,-362.07C101.04,-352.1 91.38,-338.25 87,-324 82.3,-308.71 84.87,-303.86 87,-288 96.22,-219.46 122.73,-141.04 134.83,-107.55"/>
</g>
<!-- f -->
<g id="node6" class="node">
<title>f</title>
<ellipse fill="none" stroke="black" cx="141" cy="-18" rx="27" ry="18"/>
<text text-anchor="middle" x="141" y="-13.8" font-family="Times,serif" font-size="14.00">f</text>
</g>
<!-- a&#45;&#45;f -->
<g id="edge6" class="edge">
<title>a&#45;&#45;f</title>
<path fill="none" stroke="black" d="M102.69,-365.91C67.75,-345.17 0,-296.97 0,-235 0,-235 0,-235 0,-161 0,-94.3 79.31,-47.77 118.97,-28.68"/>
</g>
<!-- b&#45;&#45;c -->
<g id="edge2" class="edge">
<title>b&#45;&#45;c</title>
<path fill="none" stroke="black" d="M139.2,-291.5C154.07,-279.11 175.99,-260.84 190.85,-248.46"/>
</g>
<!-- b&#45;&#45;d -->
<g id="edge10" class="edge">
<title>b&#45;&#45;d</title>
<path fill="none" stroke="black" d="M131.19,-288.64C140.37,-270.58 155.97,-240.76 171,-216 178.85,-203.07 188.52,-188.92 195.86,-178.49"/>
</g>
<!-- b&#45;&#45;e -->
<g id="edge11" class="edge">
<title>b&#45;&#45;e</title>
<path fill="none" stroke="black" d="M124.44,-287.85C127.81,-247.78 136.17,-148.38 139.55,-108.23"/>
</g>
<!-- b&#45;&#45;f -->
<g id="edge12" class="edge">
<title>b&#45;&#45;f</title>
<path fill="none" stroke="black" d="M117.55,-288.15C105.8,-249.13 81.03,-149.95 105,-72 109.38,-57.75 119.04,-43.9 127.25,-33.93"/>
</g>
<!-- c&#45;&#45;d -->
<g id="edge3" class="edge">
<title>c&#45;&#45;d</title>
<path fill="none" stroke="black" d="M207,-215.7C207,-204.85 207,-190.92 207,-180.1"/>
</g>
<!-- c&#45;&#45;e -->
<g id="edge13" class="edge">
<title>c&#45;&#45;e</title>
<path fill="none" stroke="black" d="M194.78,-217.46C187.18,-207.25 177.63,-193.35 171,-180 159.11,-156.05 150.14,-126.26 145.23,-107.94"/>
</g>
<!-- c&#45;&#45;f -->
<g id="edge14" class="edge">
<title>c&#45;&#45;f</title>
<path fill="none" stroke="black" d="M220.75,-218.07C228.96,-208.1 238.62,-194.25 243,-180 247.7,-164.71 247.41,-159.38 243,-144 228.95,-95 183.32,-52.49 158.12,-32.01"/>
</g>
<!-- d&#45;&#45;e -->
<g id="edge4" class="edge">
<title>d&#45;&#45;e</title>
<path fill="none" stroke="black" d="M193,-146.15C181.8,-134.28 166.17,-117.7 154.98,-105.82"/>
</g>
<!-- d&#45;&#45;f -->
<g id="edge15" class="edge">
<title>d&#45;&#45;f</title>
<path fill="none" stroke="black" d="M202.77,-144.06C197.86,-125.74 188.89,-95.95 177,-72 170.37,-58.65 160.82,-44.75 153.22,-34.54"/>
</g>
<!-- e&#45;&#45;f -->
<g id="edge5" class="edge">
<title>e&#45;&#45;f</title>
<path fill="none" stroke="black" d="M141,-71.7C141,-60.85 141,-46.92 141,-36.1"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.0 KiB

25
node_modules/graphviz-wasm/test/index.js generated vendored Normal file
View File

@@ -0,0 +1,25 @@
/* IMPORT */
import {describe} from 'fava';
import fs from 'node:fs';
import Graphviz from '../dist/index.js';
/* MAIN */
describe ( 'Graphviz', it => {
it ( 'renders dot to svg', async t => {
const input = fs.readFileSync ( './test/fixtures/input.txt', 'utf8' );
const output = fs.readFileSync ( './test/fixtures/output.txt', 'utf8' );
await Graphviz.loadWASM ();
const result = Graphviz.layout ( input );
t.is ( result, output );
});
});

7
node_modules/graphviz-wasm/tsconfig.json generated vendored Executable file
View File

@@ -0,0 +1,7 @@
{
"extends": "tsex/tsconfig.json",
"compilerOptions": {
"noImplicitAny": false,
"noUnusedParameters": false
}
}