@ts-graphviz/adapter 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +54 -266
- package/README.md +1 -1
- package/lib/create-command-and-args.d.ts +1 -1
- package/lib/create-command-args.d.ts +2 -2
- package/lib/deno.d.ts +2 -1
- package/lib/node.d.ts +1 -1
- package/lib/to-file.node.d.ts +1 -1
- package/lib/to-stream.node.d.ts +1 -1
- package/lib/types.d.ts +5 -2
- package/media/adapter-state-machine.svg +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,304 +1,92 @@
|
|
|
1
1
|
# @ts-graphviz/adapter
|
|
2
2
|
|
|
3
|
-
## 2.0.
|
|
4
|
-
|
|
5
|
-
### Major Changes
|
|
6
|
-
|
|
7
|
-
- [#956](https://github.com/ts-graphviz/ts-graphviz/pull/956) [`1e4f57a`](https://github.com/ts-graphviz/ts-graphviz/commit/1e4f57aee8a97fa79240c002ef4925b0fa6a0548) Thanks [@kamiazya](https://github.com/kamiazya)! - # ts-graphviz v2
|
|
8
|
-
|
|
9
|
-
## Why?
|
|
10
|
-
|
|
11
|
-
### Dropping support for Node.js 14 & 16
|
|
12
|
-
|
|
13
|
-
We are introducing a major version upgrade to ts-graphviz to ensure better performance, security, and compatibility with the latest improvements in the JavaScript ecosystem. With this upgrade, we will no longer support Node.js 14 & 16, which has reached its End-of-Life (EOL), and set the new minimum guaranteed version to **Node.js 18**.
|
|
14
|
-
|
|
15
|
-
This major version upgrade is necessary due to the following reasons:
|
|
16
|
-
|
|
17
|
-
1. **Breaking Change**: Dropping support for Node.js 14 & 16 is considered a breaking change, which requires a major version upgrade according to semantic versioning principles.
|
|
18
|
-
|
|
19
|
-
2. **Improved Stability and Performance**: By focusing on LTS versions, we can provide a library that benefits from the stability, long-term support, and performance improvements provided by newer Node.js versions.
|
|
20
|
-
|
|
21
|
-
3. **Security**: Ensuring that our library is compatible with the latest supported Node.js versions helps to minimize potential security vulnerabilities.
|
|
22
|
-
|
|
23
|
-
To help our users understand our approach to Node.js version support, we have established a clear [Node.js Version Support Policy](#nodejs-version-support-policy) for ts-graphviz.
|
|
24
|
-
|
|
25
|
-
We encourage our users to update their projects to the latest LTS version of Node.js to ensure the best performance, security, and compatibility with ts-graphviz.
|
|
26
|
-
|
|
27
|
-
## Key Concepts
|
|
28
|
-
|
|
29
|
-
ts-graphviz is a TypeScript library designed to create, manipulate, and render Graphviz DOT language graphs.
|
|
30
|
-
|
|
31
|
-
It is built around several key concepts that make it modular, extensible, and easy to use:
|
|
32
|
-
|
|
33
|
-
1. **TypeScript-First Design & Type Definitions**: ts-graphviz is designed with TypeScript as its primary language, providing strong typing and ensuring seamless integration with TypeScript projects. This enables users to leverage the full power of TypeScript's type system and tooling while working with Graphviz graphs. The library includes comprehensive type definitions for DOT language elements, making it easier to work with Graphviz elements in a type-safe manner.
|
|
34
|
-
|
|
35
|
-
2. **Object-Oriented API**: ts-graphviz provides an object-oriented API for creating and manipulating graph elements like graphs, nodes, and edges. This enables users to work with complex graph structures intuitively and efficiently.
|
|
36
|
-
|
|
37
|
-
3. **Modular Design[New in v2]**: The library is split into multiple packages, each serving a specific purpose. This modular design allows users to pick and choose the functionality they need, resulting in improved maintainability and flexibility.
|
|
38
|
-
|
|
39
|
-
4. **AST Support**: ts-graphviz includes a module for processing DOT language at the Abstract Syntax Tree (AST) level. This feature allows users to parse and generate DOT language while preserving its structure, making it easier to manipulate and transform graphs programmatically.
|
|
40
|
-
|
|
41
|
-
5. **Runtime Adapter**: The library provides adapter functions that enable users to execute Graphviz commands across different runtime environments, such as Node.js and Deno. These adapter functions serve as a wrapper, allowing for seamless integration with various platforms.
|
|
42
|
-
|
|
43
|
-
6. **Extensibility**: ts-graphviz has been designed with extensibility in mind, allowing users to extend its functionality with custom implementations for specific use cases.
|
|
44
|
-
|
|
45
|
-
7. **Multi-Paradigm Support**: ts-graphviz is designed to accommodate various programming paradigms, such as Object-Oriented Programming, Declarative Programming, and Functional Programming. This ensures that users can choose the programming style that best suits their needs and preferences, making it adaptable and versatile across different use cases and development approaches.
|
|
46
|
-
|
|
47
|
-
By combining these key concepts, ts-graphviz aims to provide a powerful and user-friendly tool for working with Graphviz DOT language in TypeScript projects.
|
|
48
|
-
|
|
49
|
-
# What's changed?
|
|
50
|
-
|
|
51
|
-
## Package splitting and monorepo-ization
|
|
52
|
-
|
|
53
|
-
### Purpose
|
|
54
|
-
|
|
55
|
-
The purpose of package splitting and monorepo-ization in the ts-graphviz v2 is to achieve the following objectives:
|
|
56
|
-
|
|
57
|
-
- **Improved modularity**: By separating functionality into distinct packages, the library becomes more modular. This allows users to install and use only the specific components they need, reducing unnecessary dependencies and improving overall performance.
|
|
58
|
-
- **Easier maintainability**: Splitting the library into smaller packages makes it easier for developers to maintain and update each package independently. This allows for faster bug fixes, feature enhancements, and more efficient development cycles.
|
|
59
|
-
- **Clearer dependencies**: Package splitting results in a more explicit dependency structure between components, making it easier for developers to understand and manage dependencies within the project.
|
|
60
|
-
- **Increased flexibility**: With a modular package structure, users can choose to use only the features they need, making it easier to integrate ts-graphviz into a broader range of projects and applications.
|
|
61
|
-
- **Simplified collaboration**: By breaking down the library into separate packages within a monorepo, contributors can focus on specific areas of interest without interfering with other parts of the library. This facilitates collaboration and encourages more developers to contribute to the project.
|
|
62
|
-
- **Centralized management**: Monorepo-ization allows for the centralized management of all the packages. This enables developers to track issues, manage pull requests, and maintain documentation in a single location, increasing efficiency and reducing overhead.
|
|
63
|
-
- **Consistent versioning and releases**: Monorepo-ization ensures that versioning and release processes are consistent across all packages, making it easier to maintain and update the library as a whole.
|
|
64
|
-
|
|
65
|
-
Overall, package splitting and monorepo-ization aim to create a more robust, maintainable, and user-friendly library that better serves the needs of the ts-graphviz community.
|
|
66
|
-
|
|
67
|
-
### Packages
|
|
68
|
-
|
|
69
|
-
In v2 of ts-graphviz, the library functionality will be split into several packages. The packages to be split are as follows:
|
|
70
|
-
|
|
71
|
-
- **@ts-graphviz/common**: Contains type information related to DOT language attributes, attribute values, and models.
|
|
72
|
-
- **@ts-graphviz/ast**: Includes the module for processing DOT language at the AST (Abstract Syntax Tree) level.
|
|
73
|
-
- **@ts-graphviz/core**: Comprises the implementation of models and functions provided to users.
|
|
74
|
-
- **@ts-graphviz/adapter**: Handles runtime-dependent processing. For example, it provides I/O processing related to image generation in Graphviz on different runtimes, such as Node.js and Deno.
|
|
75
|
-
|
|
76
|
-
To ensure that existing users are not affected, the ts-graphviz package will remain available. This change will result in a clear division of functionality and will improve the scalability and maintainability of the project. However, users of previous versions and users who wish to use the library without extending it will be able to continue to use the ts-graphviz package as is.
|
|
77
|
-
|
|
78
|
-
- **ts-graphviz**: The main package that serves as the entry point for users. It provides a high-level API for creating, manipulating, and rendering Graphviz DOT language graphs. This package depends on the other packages to provide its functionality.
|
|
79
|
-
|
|
80
|
-
Please note that while we strive to maintain compatibility, there might be some minor differences or limitations in the compatibility package compared to the original ts-graphviz library. It is essential to review the documentation and update your code accordingly if needed, but only when you decide to migrate to the new package structure.
|
|
81
|
-
|
|
82
|
-
### Dependency graph
|
|
83
|
-
|
|
84
|
-
| Package | Summary | Description |
|
|
85
|
-
| -------------------------------------------------------------------------- | ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
86
|
-
| [ts-graphviz](https://www.npmjs.com/package/ts-graphviz) | Graphviz library for TypeScript | The main package that serves as the entry point for users. It provides a high-level API for creating, manipulating, and rendering Graphviz DOT language graphs. |
|
|
87
|
-
| [@ts-graphviz/common](https://www.npmjs.com/package/@ts-graphviz/common) | Graphviz Types and Utilities | Contains type information related to DOT language attributes, attribute values, and models. |
|
|
88
|
-
| [@ts-graphviz/ast](https://www.npmjs.com/package/@ts-graphviz/ast) | Graphviz AST(Abstract Syntax Tree) Utilities | Includes the module for processing DOT language at the AST (Abstract Syntax Tree) level. |
|
|
89
|
-
| [@ts-graphviz/core](https://www.npmjs.com/package/@ts-graphviz/core) | Graphviz Models for Object-Oriented Programming | Comprises the implementation of models and functions provided to users. |
|
|
90
|
-
| [@ts-graphviz/adapter](https://www.npmjs.com/package/@ts-graphviz/adapter) | Graphviz Runtime adapters for Cross Platform | Handles runtime-dependent processing, such as input/output processing and Renderer implementations for different environments. |
|
|
91
|
-
|
|
92
|
-

|
|
93
|
-
|
|
94
|
-
## Node.js Version Support Update
|
|
3
|
+
## 2.0.2
|
|
95
4
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
To minimize disruption for our users, we have established a clear **Node.js Version Support Policy** for our library. This policy helps users understand our approach to Node.js version support and what to expect when using our library.
|
|
99
|
-
|
|
100
|
-
We encourage our users to update their projects to the latest LTS version of Node.js to ensure the best performance, security, and compatibility with ts-graphviz.
|
|
101
|
-
|
|
102
|
-
### Node.js Version Support Policy
|
|
103
|
-
|
|
104
|
-
Our goal is to provide a stable and secure library for our users while keeping up with improvements in the JavaScript ecosystem. To achieve this, we have established the following Node.js version support policy for ts-graphviz:
|
|
105
|
-
|
|
106
|
-
1. **Minimum Guaranteed Version**: We guarantee support for the latest Node.js version that has entered Long-Term Support (LTS) at the time of a major release of our library. This ensures that our library benefits from the stability and long-term support provided by LTS versions.
|
|
107
|
-
|
|
108
|
-
2. **End-of-Life (EOL) Policy**: We will cease support for Node.js versions when they reach their EOL, as defined by the Node.js release schedule. This helps us focus on providing a secure and up-to-date library while minimizing the maintenance burden of supporting outdated versions.
|
|
109
|
-
|
|
110
|
-
3. **Version Support Communication**: We will communicate our Node.js version support policy in our library's documentation and release notes. When a new major version is released or when a Node.js version enters EOL, we will inform our users through release notes, blog posts, or other relevant channels.
|
|
111
|
-
|
|
112
|
-
4. **Migration Guides** : When introducing breaking changes due to Node.js version support updates, we will provide migration guides to help our users transition their projects to the new requirements smoothly.
|
|
113
|
-
|
|
114
|
-
### Migration Guides
|
|
115
|
-
|
|
116
|
-
#### Update Node.js Version
|
|
117
|
-
|
|
118
|
-
To migrate to the new Node.js version support policy, follow these steps:
|
|
119
|
-
|
|
120
|
-
1. **Check Node.js Version**: First, check the version of Node.js used in your project by running the following command in your terminal:
|
|
121
|
-
```sh
|
|
122
|
-
node -v
|
|
123
|
-
```
|
|
124
|
-
2. **Update Node.js**: If your project is using Node.js 14 or 16, update it to the latest LTS version of Node.js (Node.js 18) by following the installation instructions provided on the official Node.js website or using a version manager like nvm or n.
|
|
125
|
-
3. **Update Dependencies**: After updating Node.js, review your project's dependencies to ensure that they are compatible with the new Node.js version. Update any dependencies that require changes to work with the latest LTS version of Node.js.
|
|
126
|
-
4. **Test and Verify**: Test your project with the updated Node.js version to ensure that it works as expected. Verify that all functionality is intact and that there are no compatibility issues with the new Node.js version.
|
|
127
|
-
|
|
128
|
-
By following these steps, you can migrate your project to the latest LTS version of Node.js and ensure compatibility with ts-graphviz.
|
|
5
|
+
### Patch Changes
|
|
129
6
|
|
|
130
|
-
|
|
7
|
+
- [#1003](https://github.com/ts-graphviz/ts-graphviz/pull/1003) [`24f4174`](https://github.com/ts-graphviz/ts-graphviz/commit/24f4174a76eaef50fc7d30ae3401c1b23b00789b) Thanks [@dependabot](https://github.com/apps/dependabot)! - build(deps-dev): bump vite from 5.1.3 to 5.2.8
|
|
131
8
|
|
|
132
|
-
|
|
133
|
-
Please modify to use `Attribute.keys`.
|
|
9
|
+
- [#1004](https://github.com/ts-graphviz/ts-graphviz/pull/1004) [`fabb8c8`](https://github.com/ts-graphviz/ts-graphviz/commit/fabb8c8b9f3ded57d41d7d4f1d669084ab4e91c9) Thanks [@kamiazya](https://github.com/kamiazya)! - Fix documentation build failed
|
|
134
10
|
|
|
135
|
-
|
|
136
|
-
-
|
|
137
|
-
+ import { Attribute } from '@ts-graphviz/common';
|
|
11
|
+
- Updated dependencies [[`24f4174`](https://github.com/ts-graphviz/ts-graphviz/commit/24f4174a76eaef50fc7d30ae3401c1b23b00789b), [`fabb8c8`](https://github.com/ts-graphviz/ts-graphviz/commit/fabb8c8b9f3ded57d41d7d4f1d669084ab4e91c9)]:
|
|
12
|
+
- @ts-graphviz/common@2.1.1
|
|
138
13
|
|
|
139
|
-
|
|
140
|
-
+ const foo: Attribute.keys = ...;
|
|
141
|
-
```
|
|
14
|
+
## 2.0.1
|
|
142
15
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
To migrate from the `ts-graphviz/adapter` module to the `@ts-graphviz/adapter` module, follow these steps:
|
|
16
|
+
### Patch Changes
|
|
146
17
|
|
|
147
|
-
|
|
18
|
+
- [#967](https://github.com/ts-graphviz/ts-graphviz/pull/967) [`cb5517a`](https://github.com/ts-graphviz/ts-graphviz/commit/cb5517a0236ce33527d200df9770390f4eb40064) Thanks [@dependabot](https://github.com/apps/dependabot)! - build(deps-dev): bump webpack from 5.90.2 to 5.90.3
|
|
148
19
|
|
|
149
|
-
|
|
150
|
-
- import { } from 'ts-graphviz/adapter';
|
|
151
|
-
+ import { } from '@ts-graphviz/adapter';
|
|
152
|
-
```
|
|
20
|
+
- [#971](https://github.com/ts-graphviz/ts-graphviz/pull/971) [`0589b4f`](https://github.com/ts-graphviz/ts-graphviz/commit/0589b4f8849290d2c4a39beceb9b633f059f2e3f) Thanks [@dependabot](https://github.com/apps/dependabot)! - build(deps): bump actions/download-artifact from 4.1.3 to 4.1.4
|
|
153
21
|
|
|
154
|
-
|
|
22
|
+
- [#979](https://github.com/ts-graphviz/ts-graphviz/pull/979) [`5ce6b59`](https://github.com/ts-graphviz/ts-graphviz/commit/5ce6b59fa395bc344de2bfb15061b158a9ea5586) Thanks [@dependabot](https://github.com/apps/dependabot)! - build(deps): bump actions/upload-artifact from 3.1.0 to 4.3.1
|
|
155
23
|
|
|
156
|
-
|
|
157
|
-
- "ts-graphviz": "^1.0.0",
|
|
158
|
-
+ "ts-graphviz": "^2.0.0",
|
|
159
|
-
+ "@ts-graphviz/adapter": "^2.0.0",
|
|
160
|
-
```
|
|
24
|
+
- [#980](https://github.com/ts-graphviz/ts-graphviz/pull/980) [`122336b`](https://github.com/ts-graphviz/ts-graphviz/commit/122336bede1033f73a2a94c82d499fda238f6b2e) Thanks [@dependabot](https://github.com/apps/dependabot)! - build(deps): bump ossf/scorecard-action from 2.1.2 to 2.3.1
|
|
161
25
|
|
|
162
|
-
|
|
26
|
+
- [#981](https://github.com/ts-graphviz/ts-graphviz/pull/981) [`b5f36fa`](https://github.com/ts-graphviz/ts-graphviz/commit/b5f36faf9cf70dfc263130c4480dc21770475c5a) Thanks [@dependabot](https://github.com/apps/dependabot)! - build(deps): bump github/codeql-action from 2.2.4 to 3.24.6
|
|
163
27
|
|
|
164
|
-
|
|
165
|
-
- import { } from 'ts-graphviz/adapter';
|
|
166
|
-
+ import { } from '@ts-graphviz/adapter';
|
|
167
|
-
```
|
|
28
|
+
- [#982](https://github.com/ts-graphviz/ts-graphviz/pull/982) [`c55f2d0`](https://github.com/ts-graphviz/ts-graphviz/commit/c55f2d0dfa851d318cc16a36499c69c0a34f1588) Thanks [@dependabot](https://github.com/apps/dependabot)! - build(deps): bump actions/checkout from 3.1.0 to 4.1.1
|
|
168
29
|
|
|
169
|
-
|
|
30
|
+
- [#986](https://github.com/ts-graphviz/ts-graphviz/pull/986) [`81a50ff`](https://github.com/ts-graphviz/ts-graphviz/commit/81a50ff94b461f44256f2eea5b86af5eb26afd94) Thanks [@dependabot](https://github.com/apps/dependabot)! - build(deps): bump actions/dependency-review-action from 2.5.1 to 4.1.3
|
|
170
31
|
|
|
171
|
-
|
|
32
|
+
- [#993](https://github.com/ts-graphviz/ts-graphviz/pull/993) [`a16f047`](https://github.com/ts-graphviz/ts-graphviz/commit/a16f047dfdd5db73f3e25847cf3fb2f8075aaf11) Thanks [@kamiazya](https://github.com/kamiazya)! - ## Some changes
|
|
172
33
|
|
|
173
|
-
|
|
34
|
+
- Add scorecard workflow https://github.com/ts-graphviz/ts-graphviz/pull/975
|
|
35
|
+
- Update devcontainer.json to remove deno.cache path https://github.com/ts-graphviz/ts-graphviz/pull/974
|
|
174
36
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
+ import { } from '@ts-graphviz/ast';
|
|
178
|
-
```
|
|
37
|
+
- Updated dependencies [[`cb5517a`](https://github.com/ts-graphviz/ts-graphviz/commit/cb5517a0236ce33527d200df9770390f4eb40064), [`0589b4f`](https://github.com/ts-graphviz/ts-graphviz/commit/0589b4f8849290d2c4a39beceb9b633f059f2e3f), [`5ce6b59`](https://github.com/ts-graphviz/ts-graphviz/commit/5ce6b59fa395bc344de2bfb15061b158a9ea5586), [`122336b`](https://github.com/ts-graphviz/ts-graphviz/commit/122336bede1033f73a2a94c82d499fda238f6b2e), [`b5f36fa`](https://github.com/ts-graphviz/ts-graphviz/commit/b5f36faf9cf70dfc263130c4480dc21770475c5a), [`c55f2d0`](https://github.com/ts-graphviz/ts-graphviz/commit/c55f2d0dfa851d318cc16a36499c69c0a34f1588), [`81a50ff`](https://github.com/ts-graphviz/ts-graphviz/commit/81a50ff94b461f44256f2eea5b86af5eb26afd94), [`391e98e`](https://github.com/ts-graphviz/ts-graphviz/commit/391e98edf70bb43c1feb4a00f832fa9d96dd9d39), [`a16f047`](https://github.com/ts-graphviz/ts-graphviz/commit/a16f047dfdd5db73f3e25847cf3fb2f8075aaf11), [`a16f047`](https://github.com/ts-graphviz/ts-graphviz/commit/a16f047dfdd5db73f3e25847cf3fb2f8075aaf11)]:
|
|
38
|
+
- @ts-graphviz/common@2.1.0
|
|
179
39
|
|
|
180
|
-
|
|
40
|
+
## 2.0.0
|
|
181
41
|
|
|
182
|
-
|
|
183
|
-
- "ts-graphviz": "^1.0.0",
|
|
184
|
-
+ "ts-graphviz": "^2.0.0",
|
|
185
|
-
+ "@ts-graphviz/ast": "^2.0.0",
|
|
186
|
-
```
|
|
42
|
+
### Initial release
|
|
187
43
|
|
|
188
|
-
|
|
44
|
+
> It is part of the ts-graphviz library, which is split into modular packages to improve maintainability, flexibility, and ease of use.
|
|
189
45
|
|
|
190
|
-
|
|
191
|
-
- import { } from 'ts-graphviz/ast';
|
|
192
|
-
+ import { } from '@ts-graphviz/ast';
|
|
193
|
-
```
|
|
46
|
+
Provides an interface to run Graphviz dot commands.
|
|
194
47
|
|
|
195
|
-
|
|
48
|
+
[Graphviz](https://graphviz.gitlab.io/) must be installed so that the dot command can be executed.
|
|
196
49
|
|
|
197
|
-
|
|
50
|
+
Execute the dot command to output a DOT language string to a stream or file.
|
|
198
51
|
|
|
199
|
-
|
|
52
|
+
## Usage
|
|
200
53
|
|
|
201
|
-
|
|
54
|
+
This module provides the following functions.
|
|
202
55
|
|
|
203
|
-
|
|
204
|
-
-import { $keywords } from 'ts-graphviz';
|
|
205
|
-
+import { $keywords } from '@ts-graphviz/common';
|
|
206
|
-
-import { toFile } from 'ts-graphviz/adapter';
|
|
207
|
-
+import { toFile } from '@ts-graphviz/adapter';
|
|
56
|
+
- The `toStream` function converts **DOT** to **Stream**.
|
|
208
57
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
+// 1. Declare the '@ts-graphviz/adapter' module.
|
|
212
|
-
+declare module '@ts-graphviz/adapter' {
|
|
213
|
-
export namespace Layout {
|
|
214
|
-
// 2. Define the $values interface in the Layout namespace.
|
|
215
|
-
// 3. Inherit from $keywords<'my-custom-algorithm'> and specify the name of the new layout engine in <...>.
|
|
216
|
-
export interface $values extends $keywords<'my-custom-algorithm'> {}
|
|
217
|
-
}
|
|
58
|
+
```ts
|
|
59
|
+
import { toStream } from "@ts-graphviz/adapter";
|
|
218
60
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
61
|
+
const dot = `
|
|
62
|
+
digraph example {
|
|
63
|
+
node1 [
|
|
64
|
+
label = "My Node",
|
|
65
|
+
]
|
|
223
66
|
}
|
|
224
|
-
|
|
67
|
+
`;
|
|
225
68
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
69
|
+
const stream = await toStream(dot, { format: "svg" });
|
|
70
|
+
// Node.js
|
|
71
|
+
stream.pipe(process.stdout);
|
|
72
|
+
// Deno
|
|
73
|
+
await stream.pipeTo(Deno.stdout.writable);
|
|
230
74
|
```
|
|
231
75
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
```diff
|
|
235
|
-
- import { digraph, toDot, attribute as _, $keywords } from 'ts-graphviz';
|
|
236
|
-
+ import { $keywords } from '@ts-graphviz'/common;
|
|
237
|
-
+ import { digraph, toDot, attribute as _ } from 'ts-graphviz';
|
|
238
|
-
|
|
239
|
-
-// 1. Declare the 'ts-graphviz' module.
|
|
240
|
-
-declare module 'ts-graphviz' {
|
|
241
|
-
+// 1. Declare the '@ts-graphviz/common' module.
|
|
242
|
-
+declare module '@ts-graphviz/common' {
|
|
243
|
-
export namespace GraphAttributeKey {
|
|
244
|
-
// 2. Define the $values interface in the GraphAttributeKey namespace.
|
|
245
|
-
// 3. Inherit from $keywords<'hoge'> and specify the name of the new attribute in <...>.
|
|
246
|
-
export interface $values extends $keywords<'hoge'> {}
|
|
247
|
-
}
|
|
76
|
+
- Writes **DOT** to a file at the specified path `toFile` function
|
|
248
77
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
// 5. Inherit from $keywords<'hoge'> and specify the name of the new attribute in <...>.
|
|
252
|
-
export interface $keys extends $keywords<'hoge'> {}
|
|
78
|
+
```ts
|
|
79
|
+
import { toFile } from "@ts-graphviz/adapter";
|
|
253
80
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
81
|
+
const dot = `
|
|
82
|
+
digraph example {
|
|
83
|
+
node1 [
|
|
84
|
+
label = "My Node",
|
|
85
|
+
]
|
|
259
86
|
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
console.log(
|
|
263
|
-
toDot(
|
|
264
|
-
digraph((g) => {
|
|
265
|
-
g.set(_.hoge, 'fuga');
|
|
266
|
-
}),
|
|
267
|
-
),
|
|
268
|
-
);
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
## Development
|
|
272
|
-
|
|
273
|
-
### Package manager
|
|
274
|
-
|
|
275
|
-
Migration from yarn v1 to pnpm has been done for package management.
|
|
276
|
-
|
|
277
|
-
### Build tool and Test suite
|
|
278
|
-
|
|
279
|
-
To enhance the development experience, the build tool has been changed from rollup to vite, and the test suite from jest to vitest. This was done because jest lacked standard support for monorepo integration and TypeScript, requiring the installation of additional plugins. However, vite and vitest handle these challenges more elegantly, providing a smoother and more efficient development workflow.
|
|
280
|
-
|
|
281
|
-
### Release flow
|
|
282
|
-
|
|
283
|
-
The release flow has been updated to use the changeset tool to manage changes and releases.
|
|
284
|
-
|
|
285
|
-
This tool allows for a more streamlined and automated release process, making it easier to manage versioning and changelogs across multiple packages within the monorepo.
|
|
87
|
+
`;
|
|
286
88
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
The linter and formatter have been updated to use biome, respectively.
|
|
290
|
-
|
|
291
|
-
This change was made to ensure consistent code style and formatting across the entire codebase, making it easier to maintain and contribute to the project.
|
|
292
|
-
|
|
293
|
-
## API Changes
|
|
294
|
-
|
|
295
|
-
- The status of the ModelContext API and other APIs that were provided in beta and alpha have been removed. This is a temporary measure to ensure compliance with the `@microsoft/api-extractor` specification used internally in the d.ts file rollup.
|
|
296
|
-
|
|
297
|
-
### Patch Changes
|
|
298
|
-
|
|
299
|
-
- [#966](https://github.com/ts-graphviz/ts-graphviz/pull/966) [`d579034`](https://github.com/ts-graphviz/ts-graphviz/commit/d579034d3b834eceafa4aa290c0e0d4fd74a5192) Thanks [@dependabot](https://github.com/apps/dependabot)! - build(deps-dev): bump vite-plugin-dts from 3.7.2 to 3.7.3
|
|
300
|
-
|
|
301
|
-
- [#970](https://github.com/ts-graphviz/ts-graphviz/pull/970) [`54f4565`](https://github.com/ts-graphviz/ts-graphviz/commit/54f45653d89640a16b6baa1a005e963b349fd2cd) Thanks [@dependabot](https://github.com/apps/dependabot)! - build(deps-dev): bump @types/node from 20.11.20 to 20.11.24
|
|
89
|
+
await toFile(dot, "./result.svg", { format: "svg" });
|
|
90
|
+
```
|
|
302
91
|
|
|
303
|
-
|
|
304
|
-
- @ts-graphviz/common@2.0.0
|
|
92
|
+
> **Note** Designed to work with Node.js and Deno, Stream is runtime native.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @ts-graphviz/adapter
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> It is part of the ts-graphviz library, which is split into modular packages to improve maintainability, flexibility, and ease of use.
|
|
4
4
|
|
|
5
5
|
Provides an interface to run Graphviz dot commands.
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Attribute, AttributeKey } from '@ts-graphviz/common';
|
|
2
|
-
import { Layout, Options } from './types.js';
|
|
1
|
+
import type { Attribute, AttributeKey } from '@ts-graphviz/common';
|
|
2
|
+
import type { Layout, Options } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* escapeValue is a function that escapes a given Attribute value of a given AttributeKey.
|
|
5
5
|
* It checks the type of the value and adds quotes if the value is of type string and contains whitespace.
|
package/lib/deno.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference lib="dom" />
|
|
2
|
+
export type * from './types.js';
|
|
2
3
|
/**
|
|
3
4
|
* @module @ts-graphviz/adapter
|
|
4
5
|
*/
|
|
5
|
-
import { Layout, Options } from './types.js';
|
|
6
|
+
import type { Layout, Options } from './types.js';
|
|
6
7
|
/**
|
|
7
8
|
* Execute the Graphviz dot command and make a Stream of the results.
|
|
8
9
|
*/
|
package/lib/node.d.ts
CHANGED
package/lib/to-file.node.d.ts
CHANGED
package/lib/to-stream.node.d.ts
CHANGED
package/lib/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $keywords, $keywordsValidation, EdgeAttributesObject, GraphAttributesObject, NodeAttributesObject, SubgraphAttributesObject } from '@ts-graphviz/common';
|
|
1
|
+
import type { $keywords, $keywordsValidation, EdgeAttributesObject, GraphAttributesObject, NodeAttributesObject, SubgraphAttributesObject } from '@ts-graphviz/common';
|
|
2
2
|
export type Format = Format.values;
|
|
3
3
|
export declare namespace Format {
|
|
4
4
|
type values = Exclude<keyof $values, keyof $exclude | symbol | number>;
|
|
@@ -17,6 +17,7 @@ export declare namespace Layout {
|
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* NeatoOptions interface provides options for the neato layout.
|
|
20
|
+
* @public
|
|
20
21
|
*/
|
|
21
22
|
export interface NeatoOptions {
|
|
22
23
|
layout: 'neato';
|
|
@@ -31,6 +32,7 @@ export interface NeatoOptions {
|
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
33
34
|
* FdpOptions interface provides options for the fdp layout.
|
|
35
|
+
* @public
|
|
34
36
|
*/
|
|
35
37
|
export interface FdpOptions {
|
|
36
38
|
layout: 'fdp';
|
|
@@ -64,10 +66,10 @@ export interface FdpOptions {
|
|
|
64
66
|
temperature?: number;
|
|
65
67
|
}
|
|
66
68
|
/**
|
|
67
|
-
* @description
|
|
68
69
|
* This interface describes an optional parameter called "layout" which is used to set a layout engine.
|
|
69
70
|
* The default value for this parameter is 'dot', and it must be an option of the Layout type,
|
|
70
71
|
* excluding 'neato' and 'fdp'.
|
|
72
|
+
* @public
|
|
71
73
|
*/
|
|
72
74
|
export interface OtherOptions {
|
|
73
75
|
/**
|
|
@@ -79,6 +81,7 @@ export interface OtherOptions {
|
|
|
79
81
|
}
|
|
80
82
|
/**
|
|
81
83
|
* This interface represents the CommonOptions for setting output format.
|
|
84
|
+
* @public
|
|
82
85
|
*/
|
|
83
86
|
export interface CommonOptions {
|
|
84
87
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="172pt" height="211pt" viewBox="0 0 172.44 211.09"><g class="graph" transform="translate(4 207.09)"><path fill="#fff" stroke="transparent" d="M-4 4v-211.09h172.
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="172pt" height="211pt" viewBox="0 0 172.44 211.09"><g class="graph" transform="translate(4 207.09)"><path fill="#fff" stroke="transparent" d="M-4 4v-211.09h172.44V4z"/><g class="node"><circle cx="89.85" cy="-171.89" r="31.4" fill="none" stroke="#000"/><text x="89.85" y="-168.19" font-family="Times,serif" font-size="14" text-anchor="middle">DOT</text></g><g class="node"><circle cx="44.85" cy="-44.85" r="44.69" fill="none" stroke="#000"/><text x="44.85" y="-41.15" font-family="Times,serif" font-size="14" text-anchor="middle">Stream</text></g><g class="edge"><path fill="none" stroke="#000" d="M66.46-151.09c-7.72 7.95-15.4 17.76-19.61 28.4-2.87 7.24-4.54 15.17-5.4 23.11"/><path stroke="#000" d="m44.94-99.32-4.18 9.73-2.8-10.21z"/><text x="80.35" y="-111.49" font-family="Times,serif" font-size="14" text-anchor="middle">toStream</text></g><g class="node"><circle cx="135.85" cy="-44.85" r="28.7" fill="none" stroke="#000"/><text x="135.85" y="-41.15" font-family="Times,serif" font-size="14" text-anchor="middle">File</text></g><g class="edge"><path fill="none" stroke="#000" d="M104.32-144.01c3.38 6.84 6.79 14.26 9.53 21.32 4.95 12.76 9.35 27.09 12.89 39.89"/><path stroke="#000" d="m130.18-83.48-.79 10.56-5.97-8.75z"/><text x="139.85" y="-111.49" font-family="Times,serif" font-size="14" text-anchor="middle">toFile</text></g></g></svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-graphviz/adapter",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Graphviz Runtime adapters for Cross Platform",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"graphviz",
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
"module": "./lib/node.js",
|
|
52
52
|
"types": "./lib/node.d.ts",
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@ts-graphviz/common": "^2.
|
|
54
|
+
"@ts-graphviz/common": "^2.1.1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/node": "^20.11.24",
|
|
58
58
|
"typescript": "^5.3.3",
|
|
59
|
-
"vite": "^5.
|
|
59
|
+
"vite": "^5.2.8",
|
|
60
60
|
"vite-plugin-dts": "^3.7.3"
|
|
61
61
|
},
|
|
62
62
|
"engines": {
|