ts-graphviz 2.1.6 → 3.0.1

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 CHANGED
@@ -1,5 +1,174 @@
1
1
  # ts-graphviz
2
2
 
3
+ ## 3.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1480](https://github.com/ts-graphviz/ts-graphviz/pull/1480) [`ab5d0c7`](https://github.com/ts-graphviz/ts-graphviz/commit/ab5d0c75620a0fd1bf36373716b26c2d433a0bc6) Thanks [@kamiazya](https://github.com/kamiazya)! - Fix CI workflow to prevent publishing stable releases with @next tag
8
+
9
+ - Updated dependencies [[`ab5d0c7`](https://github.com/ts-graphviz/ts-graphviz/commit/ab5d0c75620a0fd1bf36373716b26c2d433a0bc6)]:
10
+ - @ts-graphviz/adapter@3.0.1
11
+ - @ts-graphviz/ast@3.0.1
12
+ - @ts-graphviz/common@3.0.1
13
+ - @ts-graphviz/core@3.0.1
14
+
15
+ ## 3.0.0
16
+
17
+ ### Major Changes
18
+
19
+ - [#1363](https://github.com/ts-graphviz/ts-graphviz/pull/1363) [`9328563`](https://github.com/ts-graphviz/ts-graphviz/commit/932856396ed0dede1dfc6737344a628f9667d07c) Thanks [@kamiazya](https://github.com/kamiazya)! - 🚨 Breaking Changes: Drop Node.js 18 support
20
+
21
+ Minimum required version is now Node.js 20+
22
+
23
+ ### ESM-Only Distribution
24
+
25
+ - **Remove CommonJS builds**: All packages now distribute only ESM (ECMAScript Modules)
26
+ - **Package exports**: Removed `require` fields from `package.json` exports
27
+ - **Module type**: All packages are now `"type": "module"`
28
+
29
+ ## 🔄 Migration Guide
30
+
31
+ ### For ESM Projects (Recommended)
32
+
33
+ ```json
34
+ {
35
+ "type": "module"
36
+ }
37
+ ```
38
+
39
+ ```typescript
40
+ // Import syntax remains unchanged
41
+ import { Digraph, Node, Edge, toDot } from "ts-graphviz";
42
+ import { toFile } from "ts-graphviz/adapter";
43
+ import { parse } from "ts-graphviz/ast";
44
+ ```
45
+
46
+ ### For CommonJS Projects
47
+
48
+ If you are using CommonJS (CJS) and need to migrate to ESM, you will need to update your project to support dynamic imports. This is necessary because the packages no longer provide CommonJS builds.
49
+
50
+ ### Before (CJS)
51
+
52
+ ```javascript
53
+ // JavaScript (CommonJS)
54
+ function createGraph() {
55
+ // Dynamic import is required because the packages no longer provide CommonJS builds.
56
+ const { Digraph, Node, Edge, toDot } = require("ts-graphviz");
57
+ const graph = new Digraph();
58
+ return toDot(graph);
59
+ }
60
+ ```
61
+
62
+ ### After (ESM)
63
+
64
+ ```javascript
65
+ async function createGraph() {
66
+ const { Digraph, Node, Edge, toDot } = await import("ts-graphviz");
67
+
68
+ const graph = new Digraph();
69
+ // Create your graph...
70
+ return toDot(graph);
71
+ }
72
+ ```
73
+
74
+ ```typescript
75
+ // TypeScript (CommonJS)
76
+ // Update tsconfig.json
77
+ {
78
+ "compilerOptions": {
79
+ "module": "Node16",
80
+ "moduleResolution": "Node16"
81
+ }
82
+ }
83
+
84
+ // Use dynamic imports
85
+ async function createGraph() {
86
+ const tsGraphviz = await import('ts-graphviz');
87
+ const { Digraph, Node, Edge, toDot } = tsGraphviz;
88
+
89
+ const graph = new Digraph();
90
+ // Create your graph...
91
+ return toDot(graph);
92
+ }
93
+ ```
94
+
95
+ ## 🎯 Benefits
96
+
97
+ - **Modern JavaScript**: Leveraging native ES modules for better performance
98
+ - **Smaller bundle sizes**: ESM enables better tree-shaking
99
+ - **Future-proof**: Aligning with the JavaScript ecosystem direction
100
+ - **Better TypeScript support**: Enhanced module resolution
101
+
102
+ ### Minor Changes
103
+
104
+ - [#1363](https://github.com/ts-graphviz/ts-graphviz/pull/1363) [`9328563`](https://github.com/ts-graphviz/ts-graphviz/commit/932856396ed0dede1dfc6737344a628f9667d07c) Thanks [@kamiazya](https://github.com/kamiazya)! - Define Supported environment and Support levels
105
+
106
+ To provide clarity on the environments in which ts-graphviz operates, we have categorized support levels:
107
+
108
+ ## Support Levels
109
+
110
+ ### Tier 1: Full Support
111
+
112
+ - **Definition**: Environments that are fully supported, with comprehensive automated testing and maintenance.
113
+ - **Environments**:
114
+ - **Node.js LTS versions**: All active Long-Term Support (LTS) versions.
115
+ - If a Node.js LTS version is released, we will ensure compatibility with it.
116
+ - If a Node.js LTS version is deprecated, we will drop support for it in the next major release.
117
+ - **Details**:
118
+ - We run automated tests on all LTS versions of Node.js.
119
+ - Full compatibility and performance are ensured.
120
+ - Critical issues are prioritized for fixes.
121
+
122
+ ### Tier 2: Active Support
123
+
124
+ - **Definition**: Environments that receive active support with limited automated testing.
125
+ - **Environments**:
126
+ - **Deno Latest LTS version**: The latest Long-Term Support (LTS) version of Deno.
127
+ - If a new Deno LTS version is released, we will ensure compatibility with it.
128
+ - If a Deno LTS version is deprecated, we will drop support for it in the next minor release.
129
+ - **Node.js Current Release**: The latest Node.js release outside the LTS schedule.
130
+ - If a new Node.js current release is available, we will ensure compatibility with it.
131
+ - If a Node.js current release is deprecated, we will drop support for it in the next minor release.
132
+ - **Details**:
133
+ - Compatibility is maintained, and issues are addressed.
134
+
135
+ ### Tier 3: Community Support
136
+
137
+ - **Definition**: Environments that are not officially tested but are supported on a best-effort basis.
138
+ - **Environments**:
139
+ - **Modern Browsers**: Latest versions of major browsers, including:
140
+ - Google Chrome
141
+ - Mozilla Firefox
142
+ - Microsoft Edge
143
+ - Apple Safari
144
+ - **Deno Current Release**: The latest Deno release outside the LTS schedule.
145
+ - **Details**:
146
+ - Installation methods are provided.
147
+ - No automated testing is performed.
148
+ - Issues reported by users will be addressed.
149
+ - Targeting the latest versions ensures compatibility with modern web standards.
150
+ - We will not actively test or maintain compatibility with older versions of browsers.
151
+
152
+ ### Patch Changes
153
+
154
+ - [#1363](https://github.com/ts-graphviz/ts-graphviz/pull/1363) [`9328563`](https://github.com/ts-graphviz/ts-graphviz/commit/932856396ed0dede1dfc6737344a628f9667d07c) Thanks [@kamiazya](https://github.com/kamiazya)! - Update Develop Environment
155
+
156
+ - Drop turbo
157
+ - Upgrade biome to 2.0
158
+ - Upgrade TypeScript to 5.8
159
+ - Upgrade Vite to 7.0
160
+ - Upgrade Vitest to 3.2
161
+ - Upgrade Peggy to 5.0 and drop ts-pegjs
162
+ - Implement new E2E test workflow
163
+
164
+ - [#1363](https://github.com/ts-graphviz/ts-graphviz/pull/1363) [`9328563`](https://github.com/ts-graphviz/ts-graphviz/commit/932856396ed0dede1dfc6737344a628f9667d07c) Thanks [@kamiazya](https://github.com/kamiazya)! - New GitHub Action main workflow and tests
165
+
166
+ - Updated dependencies [[`9328563`](https://github.com/ts-graphviz/ts-graphviz/commit/932856396ed0dede1dfc6737344a628f9667d07c), [`9328563`](https://github.com/ts-graphviz/ts-graphviz/commit/932856396ed0dede1dfc6737344a628f9667d07c), [`9328563`](https://github.com/ts-graphviz/ts-graphviz/commit/932856396ed0dede1dfc6737344a628f9667d07c), [`9328563`](https://github.com/ts-graphviz/ts-graphviz/commit/932856396ed0dede1dfc6737344a628f9667d07c), [`9328563`](https://github.com/ts-graphviz/ts-graphviz/commit/932856396ed0dede1dfc6737344a628f9667d07c), [`9328563`](https://github.com/ts-graphviz/ts-graphviz/commit/932856396ed0dede1dfc6737344a628f9667d07c), [`9328563`](https://github.com/ts-graphviz/ts-graphviz/commit/932856396ed0dede1dfc6737344a628f9667d07c)]:
167
+ - @ts-graphviz/adapter@3.0.0
168
+ - @ts-graphviz/common@3.0.0
169
+ - @ts-graphviz/core@3.0.0
170
+ - @ts-graphviz/ast@3.0.0
171
+
3
172
  ## 2.1.6
4
173
 
5
174
  ### Patch Changes
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  <div align="center">
2
2
 
3
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
- [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](http://makeapullrequest.com)
5
- [![CI](https://github.com/ts-graphviz/ts-graphviz/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/ts-graphviz/ts-graphviz/actions/workflows/ci.yaml)
3
+ [![Main](https://github.com/ts-graphviz/ts-graphviz/actions/workflows/main.yaml/badge.svg)](https://github.com/ts-graphviz/ts-graphviz/actions/workflows/main.yaml)
4
+ [![CodeQL](https://github.com/ts-graphviz/ts-graphviz/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/ts-graphviz/ts-graphviz/actions/workflows/codeql-analysis.yml)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/ts-graphviz/ts-graphviz/blob/main/LICENSE)
6
6
  [![All Contributors](https://img.shields.io/github/all-contributors/ts-graphviz/ts-graphviz?color=orange)](#contributors-)
7
7
 
8
8
  [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/8396/badge)](https://www.bestpractices.dev/projects/8396)
@@ -11,8 +11,8 @@
11
11
 
12
12
  [![npm version](https://badge.fury.io/js/ts-graphviz.svg)](https://badge.fury.io/js/ts-graphviz)
13
13
  ![node version](https://img.shields.io/node/v/ts-graphviz)
14
- [![deno version](https://img.shields.io/badge/deno-^1.28.0-black?logo=deno)](https://github.com/denoland/deno)
15
- ![npm](https://img.shields.io/npm/dm/ts-graphviz)
14
+ [![deno version](https://img.shields.io/badge/deno-lts-black?logo=deno)](https://github.com/denoland/deno)
15
+ [![npm](https://img.shields.io/npm/dm/ts-graphviz)](https://npmtrends.com/ts-graphviz)
16
16
 
17
17
  # ts-graphviz
18
18
 
@@ -22,8 +22,8 @@
22
22
 
23
23
  [![GitHub](https://img.shields.io/badge/-GitHub-181717?logo=GitHub&style=flat)](https://github.com/ts-graphviz/ts-graphviz)
24
24
  [![npm](https://img.shields.io/badge/-npm-CB3837?logo=npm&style=flat)](https://www.npmjs.com/package/ts-graphviz)
25
- [![yarn](https://img.shields.io/badge/-yarn-ffffff?logo=Yarn&style=flat)](https://yarnpkg.com/package/ts-graphviz)
26
- [![Refarence](https://img.shields.io/badge/-Refarence-3178C6?logo=TypeScript&style=flat&logoColor=fff)](https://ts-graphviz.github.io/ts-graphviz/)
25
+ [![Reference](https://img.shields.io/badge/-API_Reference-3178C6?logo=TypeScript&style=flat&logoColor=fff)](https://ts-graphviz.github.io/ts-graphviz/)
26
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/ts-graphviz/ts-graphviz)
27
27
 
28
28
  [![Sponsor](https://img.shields.io/badge/-GitHub%20Sponsor-fff?logo=GitHub%20Sponsors&style=flat)](https://github.com/sponsors/ts-graphviz)
29
29
  [![OpenCollective](https://img.shields.io/badge/-OpenCollective-7FADF2?logo=opencollective&style=flat&logoColor=white)](https://opencollective.com/ts-graphviz)
@@ -664,6 +664,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
664
664
  </tr>
665
665
  <tr>
666
666
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/hao2013"><img src="https://avatars.githubusercontent.com/u/67059492?v=4?s=100" width="100px;" alt="hao2013"/><br /><sub><b>hao2013</b></sub></a><br /><a href="#maintenance-hao2013" title="Maintenance">🚧</a> <a href="https://github.com/ts-graphviz/ts-graphviz/pulls?q=is%3Apr+reviewed-by%3Ahao2013" title="Reviewed Pull Requests">👀</a></td>
667
+ <td align="center" valign="top" width="14.28%"><a href="http://www.walterra.dev"><img src="https://avatars.githubusercontent.com/u/230104?v=4?s=100" width="100px;" alt="Walter Rafelsberger"/><br /><sub><b>Walter Rafelsberger</b></sub></a><br /><a href="#question-walterra" title="Answering Questions">💬</a></td>
668
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/grsjst"><img src="https://avatars.githubusercontent.com/u/4739018?v=4?s=100" width="100px;" alt="grsjst"/><br /><sub><b>grsjst</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/issues?q=author%3Agrsjst" title="Bug reports">🐛</a></td>
669
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/stephenirven"><img src="https://avatars.githubusercontent.com/u/4293560?v=4?s=100" width="100px;" alt="Steve"/><br /><sub><b>Steve</b></sub></a><br /><a href="https://github.com/ts-graphviz/ts-graphviz/issues?q=author%3Astephenirven" title="Bug reports">🐛</a></td>
667
670
  </tr>
668
671
  </tbody>
669
672
  </table>
@@ -706,6 +709,10 @@ Please support ts-graphviz on [Open Collective](https://opencollective.com/ts-gr
706
709
 
707
710
  > **Note** Even just a dollar is enough motivation to develop 😊
708
711
 
712
+ ## Changelog 📜
713
+
714
+ See [CHANGELOG.md](https://github.com/ts-graphviz/ts-graphviz/blob/main/packages/ts-graphviz/CHANGELOG.md) for more details.
715
+
709
716
  ## ts-graphviz for Enterprise 🏢
710
717
 
711
718
  Available as part of the Tidelift Subscription.
@@ -1,7 +1,7 @@
1
1
  export * from '@ts-graphviz/common';
2
2
  export * from '@ts-graphviz/core';
3
- export * from './types.js';
4
3
  export * from './attribute.js';
5
- export * from './model-factory.js';
6
4
  export * from './from-dot.js';
5
+ export * from './model-factory.js';
7
6
  export * from './to-dot.js';
7
+ export * from './types.js';
@@ -9,6 +9,12 @@ const j = new Proxy(
9
9
  get: (r, t) => t
10
10
  }
11
11
  );
12
+ function A(r, t) {
13
+ const e = h(r, t?.parse);
14
+ if (Array.isArray(e) || e.type === "Attribute" || e.type === "AttributeList" || e.type === "Comment" || e.type === "NodeRef" || e.type === "NodeRefGroup" || e.type === "Literal")
15
+ throw new Error();
16
+ return m(e, t?.convert);
17
+ }
12
18
  function f(r, t) {
13
19
  return (...e) => {
14
20
  const a = r ? this.Digraph : this.Graph, p = e.find((o) => typeof o == "string"), u = e.find(
@@ -25,20 +31,14 @@ function n(r, t = d) {
25
31
  graph: f.call(t, !1, r)
26
32
  });
27
33
  }
28
- const s = n(!1), A = s.digraph, C = s.graph, D = n(!0);
29
- function z(r) {
34
+ const s = n(!1), C = s.digraph, D = s.graph, z = n(!0);
35
+ function G(r) {
30
36
  const t = y(r);
31
37
  return Object.freeze({
32
38
  ...n(!1, t),
33
39
  strict: n(!0, t)
34
40
  });
35
41
  }
36
- function G(r, t) {
37
- const e = h(r, t?.parse);
38
- if (Array.isArray(e) || e.type === "Attribute" || e.type === "AttributeList" || e.type === "Comment" || e.type === "NodeRef" || e.type === "NodeRefGroup" || e.type === "Literal")
39
- throw new Error();
40
- return m(e, t?.convert);
41
- }
42
42
  function O(r, t) {
43
43
  const e = g(r, t?.convert);
44
44
  return b(e, t?.print);
@@ -46,10 +46,10 @@ function O(r, t) {
46
46
  l();
47
47
  export {
48
48
  j as attribute,
49
- A as digraph,
50
- G as fromDot,
51
- C as graph,
52
- D as strict,
49
+ C as digraph,
50
+ A as fromDot,
51
+ D as graph,
52
+ z as strict,
53
53
  O as toDot,
54
- z as withContext
54
+ G as withContext
55
55
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-graphviz",
3
- "version": "2.1.6",
3
+ "version": "3.0.1",
4
4
  "description": "Graphviz library for TypeScript",
5
5
  "keywords": [
6
6
  "graphviz",
@@ -32,37 +32,31 @@
32
32
  "exports": {
33
33
  ".": {
34
34
  "types": "./lib/ts-graphviz.d.ts",
35
- "require": "./lib/ts-graphviz.cjs",
36
35
  "default": "./lib/ts-graphviz.js"
37
36
  },
38
37
  "./ast": {
39
38
  "types": "./lib/ast.d.ts",
40
- "require": "./lib/ast.cjs",
41
39
  "default": "./lib/ast.js"
42
40
  },
43
41
  "./adapter": {
44
42
  "types": "./lib/adapter.d.ts",
45
- "require": "./lib/adapter.cjs",
46
43
  "default": "./lib/adapter.js"
47
44
  },
48
45
  "./package.json": "./package.json"
49
46
  },
50
- "main": "./lib/ts-graphviz.cjs",
51
- "module": "./lib/ts-graphviz.js",
52
- "types": "lib/ts-graphviz.d.ts",
53
47
  "dependencies": {
54
- "@ts-graphviz/adapter": "^2.0.6",
55
- "@ts-graphviz/ast": "^2.0.7",
56
- "@ts-graphviz/common": "^2.1.5",
57
- "@ts-graphviz/core": "^2.0.7"
48
+ "@ts-graphviz/ast": "^3.0.1",
49
+ "@ts-graphviz/common": "^3.0.1",
50
+ "@ts-graphviz/core": "^3.0.1",
51
+ "@ts-graphviz/adapter": "^3.0.1"
58
52
  },
59
53
  "devDependencies": {
60
- "typescript": "^5.4.5",
61
- "vite": "^5.4.8",
62
- "vite-plugin-dts": "^4.2.1"
54
+ "typescript": "^5.8.2",
55
+ "vite": "^7.0.2",
56
+ "vite-plugin-dts": "^4.5.3"
63
57
  },
64
58
  "engines": {
65
- "node": ">=18"
59
+ "node": ">=20"
66
60
  },
67
61
  "publishConfig": {
68
62
  "access": "public",
@@ -71,5 +65,7 @@
71
65
  "runkitExampleFilename": "example/runkit.cjs",
72
66
  "scripts": {
73
67
  "build": "vite build"
74
- }
68
+ },
69
+ "module": "./lib/ts-graphviz.js",
70
+ "types": "lib/ts-graphviz.d.ts"
75
71
  }
package/lib/adapter.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@ts-graphviz/adapter");Object.keys(t).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
package/lib/ast.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@ts-graphviz/ast");Object.keys(t).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@ts-graphviz/core"),n=require("@ts-graphviz/common"),c=require("@ts-graphviz/ast"),h=new Proxy(Object.freeze({}),{get:(t,e)=>e});function u(t,e){return(...r)=>{const l=t?this.Digraph:this.Graph,y=r.find(o=>typeof o=="string"),d=r.find(o=>typeof o=="object"),f=r.find(o=>typeof o=="function"),a=new l(y,e,d);return a.with(this),typeof f=="function"&&f(a),a}}function i(t,e=n.RootModelsContext){return Object.freeze({digraph:u.call(e,!0,t),graph:u.call(e,!1,t)})}const p=i(!1),b=p.digraph,g=p.graph,O=i(!0);function j(t){const e=n.createModelsContext(t);return Object.freeze({...i(!1,e),strict:i(!0,e)})}function m(t,e){const r=c.parse(t,e?.parse);if(Array.isArray(r)||r.type==="Attribute"||r.type==="AttributeList"||r.type==="Comment"||r.type==="NodeRef"||r.type==="NodeRefGroup"||r.type==="Literal")throw new Error;return c.toModel(r,e?.convert)}function w(t,e){const r=c.fromModel(t,e?.convert);return c.stringify(r,e?.print)}s.registerDefault();exports.attribute=h;exports.digraph=b;exports.fromDot=m;exports.graph=g;exports.strict=O;exports.toDot=w;exports.withContext=j;Object.keys(s).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>s[t]})});Object.keys(n).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>n[t]})});