ts-graphviz
Advanced tools
Comparing version 1.2.4-dev.ebf0c074c to 1.3.1-dev.e5c510529
{ | ||
"name": "ts-graphviz", | ||
"version": "1.2.4-dev.ebf0c074c", | ||
"version": "1.3.1-dev.e5c510529", | ||
"author": "kamiazya <yuki@kamiazya.tech>", | ||
@@ -28,17 +28,42 @@ "description": "Graphviz library for TypeScript.", | ||
".": { | ||
"import": "./lib/index.js", | ||
"require": "./lib/index.cjs", | ||
"types": "./lib/index.d.ts" | ||
"require": { | ||
"default": "./lib/index.cjs", | ||
"types": "./lib/index.d.ts" | ||
}, | ||
"import": { | ||
"default": "./lib/index.js", | ||
"types": "./lib/index.d.ts" | ||
} | ||
}, | ||
"./ast": { | ||
"import": "./lib/ast/index.js", | ||
"require": "./lib/ast/index.cjs", | ||
"types": "./lib/ast/index.d.ts" | ||
} | ||
"require": { | ||
"default": "./lib/ast/index.cjs", | ||
"types": "./lib/ast/index.d.ts" | ||
}, | ||
"import": { | ||
"default": "./lib/ast/index.js", | ||
"types": "./lib/ast/index.d.ts" | ||
} | ||
}, | ||
"./adapter": { | ||
"deno": { | ||
"default": "./lib/adapter/deno/mod.js", | ||
"types": "./lib/adapter/deno/mod.d.ts" | ||
}, | ||
"node": { | ||
"require": "./lib/adapter/index.cjs", | ||
"import": "./lib/adapter/index.js", | ||
"types": "./lib/adapter/index.d.ts" | ||
} | ||
}, | ||
"./package.json": "./package.json" | ||
}, | ||
"imports": { | ||
"#lib/*": { | ||
"import": "./lib/*/index.js", | ||
"require": "./lib/*/index.cjs", | ||
"types": "./lib/*/index.d.ts" | ||
"typesVersions": { | ||
"*": { | ||
"ast": [ | ||
"lib/ast" | ||
], | ||
"adapter": [ | ||
"lib/adapter" | ||
] | ||
} | ||
@@ -53,3 +78,5 @@ }, | ||
"prebuild": "yarn build:peggy", | ||
"build": "tsc -p tsconfig.build.json && rollup -c", | ||
"build:deno": "cp -r src/adapter/deno lib/adapter/deno", | ||
"build:node": "tsc -p tsconfig.build.json && rollup -c", | ||
"build": "yarn build:node && yarn build:deno", | ||
"postbuild": "prettier --write ./lib/**/index.{js,cjs,d.ts}", | ||
@@ -56,0 +83,0 @@ "pretest": "yarn build:peggy", |
@@ -9,2 +9,3 @@ [![Codacy Badge](https://api.codacy.com/project/badge/Grade/d6485f9858ed4b3e8ef76611a2896bc4)](https://app.codacy.com/gh/ts-graphviz/ts-graphviz?utm_source=github.com&utm_medium=referral&utm_content=ts-graphviz/ts-graphviz&utm_campaign=Badge_Grade_Settings) | ||
![node version](https://img.shields.io/node/v/ts-graphviz) | ||
[![deno version](https://img.shields.io/badge/deno-^1.28.0-black?logo=deno)](https://github.com/denoland/deno) | ||
![npm](https://img.shields.io/npm/dm/ts-graphviz) | ||
@@ -23,3 +24,3 @@ [![All Contributors](https://img.shields.io/github/all-contributors/ts-graphviz/ts-graphviz?color=orange)](#contributors) | ||
> [English](https://github.com/ts-graphviz/ts-graphviz/blob/main/README.md) | [日本語](https://github.com/ts-graphviz/ts-graphviz/blob/main/README.ja.md) | ||
> [English](https://github.com/ts-graphviz/ts-graphviz/blob/main/README.md) | [日本語](https://github.com/ts-graphviz/ts-graphviz/blob/main/README_ja.md) | ||
@@ -39,2 +40,4 @@ ## Key Features ✨ | ||
### Node.js | ||
This package can then be installed using a package manager. | ||
@@ -51,2 +54,12 @@ | ||
### Deno 🦕 | ||
[Deno v1.28 and above supports npm](https://deno.land/manual/node/npm_specifiers). | ||
You can install and use the package by specifying the following: | ||
```ts | ||
import { toDot } from 'npm:ts-graphviz'; | ||
``` | ||
## Usage 📑 | ||
@@ -329,2 +342,52 @@ | ||
### `ts-graphviz/adapter` Module 🔌 | ||
> This module status is ![beta](https://img.shields.io/badge/-beta-orange). | ||
Provides an interface to run Graphviz dot commands. | ||
[Graphviz](https://graphviz.gitlab.io/) must be installed so that the dot command can be executed. | ||
Execute the dot command to output a DOT language string to a stream or file. | ||
![Adapter State Machine](./media/adapter-state-machine.svg) | ||
This module provides the following functions. | ||
- The `toStream` function converts **DOT** to **Stream**. | ||
```ts | ||
import { toStream } from 'ts-graphviz/adapter'; | ||
const dot = ` | ||
digraph example { | ||
node1 [ | ||
label = "My Node", | ||
] | ||
} | ||
`; | ||
const stream = await toStream(dot, { format: 'svg' }); | ||
// Node.js | ||
stream.pipe(process.stdout); | ||
// Deno | ||
await stream.pipeTo(Deno.stdout.writable); | ||
``` | ||
- Writes **DOT** to a file at the specified path `toFile` function | ||
```ts | ||
import { toFile } from 'ts-graphviz/adapter'; | ||
const dot = ` | ||
digraph example { | ||
node1 [ | ||
label = "My Node", | ||
] | ||
} | ||
`; | ||
await toFile(dot, './result.svg', { format: 'svg' }); | ||
``` | ||
> **Note** Designed to work with Node.js and Deno, Stream is runtime native. | ||
### `ts-graphviz/ast` Module 🔢 | ||
@@ -446,2 +509,13 @@ | ||
## Who's using `ts-graphviz` 📜 | ||
- [Apollo GraphQL](https://github.com/apollographql) | ||
- [AWS](https://github.com/aws) | ||
- [IBM (StrongLoop)](https://strongloop.com) | ||
- [The University of Tokyo](https://github.com/csg-tokyo) | ||
- [Transmute](https://github.com/transmute-industries) | ||
> **Note** Let us know that you're using `ts-graphviz` on [GitHub Discussions](https://github.com/ts-graphviz/ts-graphviz/discussions/736) 🙏 | ||
## Related Projects 💫 | ||
@@ -463,8 +537,9 @@ | ||
<tr> | ||
<td align="center"><a href="http://blog.kamiazya.tech/"><img src="https://avatars0.githubusercontent.com/u/35218186?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Yuki Yamazaki</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=kamiazya" title="Code">💻</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=kamiazya" title="Tests">⚠️</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=kamiazya" title="Documentation">📖</a> <a href="#ideas-kamiazya" title="Ideas, Planning, & Feedback">🤔</a></td> | ||
<td align="center"><a href="https://laysent.com"><img src="https://avatars2.githubusercontent.com/u/1191606?v=4?s=100" width="100px;" alt=""/><br /><sub><b>LaySent</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/issues?q=author%3Alaysent" title="Bug reports">🐛</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=laysent" title="Tests">⚠️</a></td> | ||
<td align="center"><a href="https://github.com/elasticdotventures"><img src="https://avatars0.githubusercontent.com/u/35611074?v=4?s=100" width="100px;" alt=""/><br /><sub><b>elasticdotventures</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=elasticdotventures" title="Documentation">📖</a></td> | ||
<td align="center"><a href="https://github.com/ChristianMurphy"><img src="https://avatars.githubusercontent.com/u/3107513?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Christian Murphy</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=ChristianMurphy" title="Code">💻</a> <a href="#ideas-ChristianMurphy" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=ChristianMurphy" title="Documentation">📖</a></td> | ||
<td align="center" valign="top" width="14.28%"><a href="http://blog.kamiazya.tech/"><img src="https://avatars0.githubusercontent.com/u/35218186?v=4?s=100" width="100px;" alt="Yuki Yamazaki"/><br /><sub><b>Yuki Yamazaki</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=kamiazya" title="Code">💻</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=kamiazya" title="Tests">⚠️</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=kamiazya" title="Documentation">📖</a> <a href="#ideas-kamiazya" title="Ideas, Planning, & Feedback">🤔</a></td> | ||
<td align="center" valign="top" width="14.28%"><a href="https://laysent.com"><img src="https://avatars2.githubusercontent.com/u/1191606?v=4?s=100" width="100px;" alt="LaySent"/><br /><sub><b>LaySent</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/issues?q=author%3Alaysent" title="Bug reports">🐛</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=laysent" title="Tests">⚠️</a></td> | ||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/elasticdotventures"><img src="https://avatars0.githubusercontent.com/u/35611074?v=4?s=100" width="100px;" alt="elasticdotventures"/><br /><sub><b>elasticdotventures</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=elasticdotventures" title="Documentation">📖</a></td> | ||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ChristianMurphy"><img src="https://avatars.githubusercontent.com/u/3107513?v=4?s=100" width="100px;" alt="Christian Murphy"/><br /><sub><b>Christian Murphy</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=ChristianMurphy" title="Code">💻</a> <a href="#ideas-ChristianMurphy" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/ts-graphviz/ts-graphviz/commits?author=ChristianMurphy" title="Documentation">📖</a></td> | ||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ArtemAdamenko"><img src="https://avatars.githubusercontent.com/u/2178516?v=4?s=100" width="100px;" alt="Artem"/><br /><sub><b>Artem</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/issues?q=author%3AArtemAdamenko" title="Bug reports">🐛</a></td> | ||
</tr> | ||
</tobdy> | ||
</tbody> | ||
</table> | ||
@@ -471,0 +546,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26
18647
573
558581