ts-graphviz
Advanced tools
Comparing version 1.2.4-dev.23479be87 to 1.2.4-dev.727d397dd
{ | ||
"name": "ts-graphviz", | ||
"version": "1.2.4-dev.23479be87", | ||
"version": "1.2.4-dev.727d397dd", | ||
"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", |
@@ -22,3 +22,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) | ||
> [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) | ||
@@ -38,2 +38,4 @@ ## Key Features ✨ | ||
### Node.js | ||
This package can then be installed using a package manager. | ||
@@ -50,2 +52,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 📑 | ||
@@ -328,2 +340,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 🔢 | ||
@@ -330,0 +392,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
560
557523
26
18647