You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ts-graphviz/11-advanced-topics/02-package-architecture.md
+29-1Lines changed: 29 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,35 @@ description: Package architecture of ts-graphviz.
17
17
18
18
-**`@ts-graphviz/react`**: Allows defining graphs using React's declarative UI paradigm, expressing DOT language models with JSX.
19
19
20
-
## Dependency Graph
20
+
## Exposing Internal Modules as Submodules
21
+
22
+
**ts-graphviz** publishes some of its internal modules as submodules within the main package. Specifically, the following import paths are available to access these internal modules:
23
+
24
+
-**`ts-graphviz/ast`** or **`@ts-graphviz/ast`**
25
+
-**`ts-graphviz/adapter`** or **`@ts-graphviz/adapter`**
26
+
27
+
This allows users to choose the module import style that best fits their project's needs. By using the `ts-graphviz/<module-name>` style, you can limit your dependencies to the `ts-graphviz` library itself, with internal packages (e.g., `@ts-graphviz/adapter`, `@ts-graphviz/ast`) being managed centrally by the `ts-graphviz` package. On the other hand, using the `@ts-graphviz/<module-name>` style enables you to manage dependencies on a per-module basis, allowing you to selectively install specific modules as needed.
28
+
29
+
:::tip Managing Dependencies When Choosing Import Paths
30
+
31
+
When using package managers that enforce strict dependency management (e.g., pnpm), the choice of import path can significantly impact how dependencies are handled. Consider the following points:
32
+
33
+
-**Using `ts-graphviz/<module-name>` Style**:
34
+
-**Advantages**: Limits dependencies to the `ts-graphviz` library itself, with internal packages (e.g., `@ts-graphviz/adapter`, `@ts-graphviz/ast`) being managed centrally by the `ts-graphviz` package. This prevents dependency conflicts and ensures that stable versions recommended by the library are used.
35
+
-**Recommended Scenarios**: When you want to minimize dependencies or when the internal packages managed by `ts-graphviz` do not have specific version requirements.
36
+
37
+
-**Using `@ts-graphviz/<module-name>` Style**:
38
+
-**Advantages**: Allows you to manage dependencies on a per-module basis, installing only the specific modules you need, which can help keep your application lightweight.
39
+
-**Caveats**: Requires you to manage internal dependencies (e.g., `@ts-graphviz/adapter`, `@ts-graphviz/ast`) separately within your package manager. This can complicate version management.
40
+
-**Recommended Scenarios**: When you need to use specific modules only or require detailed control over your dependencies.
41
+
42
+
**Summary**:
43
+
- If you prefer **simple dependency management**, use the `ts-graphviz/<module-name>` style.
44
+
- If you require **fine-grained control over dependencies** or only need specific modules, opt for the `@ts-graphviz/<module-name>` style.
45
+
46
+
This approach allows you to manage dependencies in a way that best suits your project's requirements.
47
+
:::
48
+
21
49
22
50
The relationships between packages can be visualized as follows:
0 commit comments