ts-graphviz 2.1.6-next-f8ba9a89f3ac9e916ded16f0a0618113a5eb4928 → 3.0.0

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,12 +1,169 @@
1
1
  # ts-graphviz
2
2
 
3
- ## 2.1.6-next-f8ba9a89f3ac9e916ded16f0a0618113a5eb4928
3
+ ## 3.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#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
8
+
9
+ Minimum required version is now Node.js 20+
10
+
11
+ ### ESM-Only Distribution
12
+
13
+ - **Remove CommonJS builds**: All packages now distribute only ESM (ECMAScript Modules)
14
+ - **Package exports**: Removed `require` fields from `package.json` exports
15
+ - **Module type**: All packages are now `"type": "module"`
16
+
17
+ ## 🔄 Migration Guide
18
+
19
+ ### For ESM Projects (Recommended)
20
+
21
+ ```json
22
+ {
23
+ "type": "module"
24
+ }
25
+ ```
26
+
27
+ ```typescript
28
+ // Import syntax remains unchanged
29
+ import { Digraph, Node, Edge, toDot } from "ts-graphviz";
30
+ import { toFile } from "ts-graphviz/adapter";
31
+ import { parse } from "ts-graphviz/ast";
32
+ ```
33
+
34
+ ### For CommonJS Projects
35
+
36
+ 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.
37
+
38
+ ### Before (CJS)
39
+
40
+ ```javascript
41
+ // JavaScript (CommonJS)
42
+ function createGraph() {
43
+ // Dynamic import is required because the packages no longer provide CommonJS builds.
44
+ const { Digraph, Node, Edge, toDot } = require("ts-graphviz");
45
+ const graph = new Digraph();
46
+ return toDot(graph);
47
+ }
48
+ ```
49
+
50
+ ### After (ESM)
51
+
52
+ ```javascript
53
+ async function createGraph() {
54
+ const { Digraph, Node, Edge, toDot } = await import("ts-graphviz");
55
+
56
+ const graph = new Digraph();
57
+ // Create your graph...
58
+ return toDot(graph);
59
+ }
60
+ ```
61
+
62
+ ```typescript
63
+ // TypeScript (CommonJS)
64
+ // Update tsconfig.json
65
+ {
66
+ "compilerOptions": {
67
+ "module": "Node16",
68
+ "moduleResolution": "Node16"
69
+ }
70
+ }
71
+
72
+ // Use dynamic imports
73
+ async function createGraph() {
74
+ const tsGraphviz = await import('ts-graphviz');
75
+ const { Digraph, Node, Edge, toDot } = tsGraphviz;
76
+
77
+ const graph = new Digraph();
78
+ // Create your graph...
79
+ return toDot(graph);
80
+ }
81
+ ```
82
+
83
+ ## 🎯 Benefits
84
+
85
+ - **Modern JavaScript**: Leveraging native ES modules for better performance
86
+ - **Smaller bundle sizes**: ESM enables better tree-shaking
87
+ - **Future-proof**: Aligning with the JavaScript ecosystem direction
88
+ - **Better TypeScript support**: Enhanced module resolution
89
+
90
+ ### Minor Changes
91
+
92
+ - [#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
93
+
94
+ To provide clarity on the environments in which ts-graphviz operates, we have categorized support levels:
95
+
96
+ ## Support Levels
97
+
98
+ ### Tier 1: Full Support
99
+
100
+ - **Definition**: Environments that are fully supported, with comprehensive automated testing and maintenance.
101
+ - **Environments**:
102
+ - **Node.js LTS versions**: All active Long-Term Support (LTS) versions.
103
+ - If a Node.js LTS version is released, we will ensure compatibility with it.
104
+ - If a Node.js LTS version is deprecated, we will drop support for it in the next major release.
105
+ - **Details**:
106
+ - We run automated tests on all LTS versions of Node.js.
107
+ - Full compatibility and performance are ensured.
108
+ - Critical issues are prioritized for fixes.
109
+
110
+ ### Tier 2: Active Support
111
+
112
+ - **Definition**: Environments that receive active support with limited automated testing.
113
+ - **Environments**:
114
+ - **Deno Latest LTS version**: The latest Long-Term Support (LTS) version of Deno.
115
+ - If a new Deno LTS version is released, we will ensure compatibility with it.
116
+ - If a Deno LTS version is deprecated, we will drop support for it in the next minor release.
117
+ - **Node.js Current Release**: The latest Node.js release outside the LTS schedule.
118
+ - If a new Node.js current release is available, we will ensure compatibility with it.
119
+ - If a Node.js current release is deprecated, we will drop support for it in the next minor release.
120
+ - **Details**:
121
+ - Compatibility is maintained, and issues are addressed.
122
+
123
+ ### Tier 3: Community Support
124
+
125
+ - **Definition**: Environments that are not officially tested but are supported on a best-effort basis.
126
+ - **Environments**:
127
+ - **Modern Browsers**: Latest versions of major browsers, including:
128
+ - Google Chrome
129
+ - Mozilla Firefox
130
+ - Microsoft Edge
131
+ - Apple Safari
132
+ - **Deno Current Release**: The latest Deno release outside the LTS schedule.
133
+ - **Details**:
134
+ - Installation methods are provided.
135
+ - No automated testing is performed.
136
+ - Issues reported by users will be addressed.
137
+ - Targeting the latest versions ensures compatibility with modern web standards.
138
+ - We will not actively test or maintain compatibility with older versions of browsers.
139
+
140
+ ### Patch Changes
141
+
142
+ - [#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
143
+
144
+ - Drop turbo
145
+ - Upgrade biome to 2.0
146
+ - Upgrade TypeScript to 5.8
147
+ - Upgrade Vite to 7.0
148
+ - Upgrade Vitest to 3.2
149
+ - Upgrade Peggy to 5.0 and drop ts-pegjs
150
+ - Implement new E2E test workflow
151
+
152
+ - [#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
153
+
154
+ - 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)]:
155
+ - @ts-graphviz/adapter@3.0.0
156
+ - @ts-graphviz/common@3.0.0
157
+ - @ts-graphviz/core@3.0.0
158
+ - @ts-graphviz/ast@3.0.0
159
+
160
+ ## 2.1.6
4
161
 
5
162
  ### Patch Changes
6
163
 
7
164
  - Updated dependencies [[`c043ba9`](https://github.com/ts-graphviz/ts-graphviz/commit/c043ba9bcc5194a89b976df1609c4e9875300f1e)]:
8
- - @ts-graphviz/ast@2.0.7-next-f8ba9a89f3ac9e916ded16f0a0618113a5eb4928
9
- - @ts-graphviz/core@2.0.7-next-f8ba9a89f3ac9e916ded16f0a0618113a5eb4928
165
+ - @ts-graphviz/ast@2.0.7
166
+ - @ts-graphviz/core@2.0.7
10
167
 
11
168
  ## 2.1.5
12
169
 
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-next-f8ba9a89f3ac9e916ded16f0a0618113a5eb4928",
3
+ "version": "3.0.0",
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-next-f8ba9a89f3ac9e916ded16f0a0618113a5eb4928",
56
- "@ts-graphviz/common": "^2.1.5",
57
- "@ts-graphviz/core": "^2.0.7-next-f8ba9a89f3ac9e916ded16f0a0618113a5eb4928"
48
+ "@ts-graphviz/adapter": "^3.0.0",
49
+ "@ts-graphviz/ast": "^3.0.0",
50
+ "@ts-graphviz/common": "^3.0.0",
51
+ "@ts-graphviz/core": "^3.0.0"
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]})});