@wroud/di-tools-analyzer
is a powerful tool designed to enhance your experience with the @wroud/di
dependency injection library. This tool provides capabilities to analyze the service container built with @wroud/di
, allowing you to gain deeper insights into your application's dependency graph.
- Data Collection: Collect detailed information about the service container in a serializable JSON format.
- Visualization: Utilize D3.js to visualize the collected data, making it easier to understand the relationships and dependencies between services.
-
Integration: Seamlessly integrate with
@wroud/di
, providing an easy-to-use interface for analyzing and visualizing your service container.
You can install @wroud/di-tools-analyzer
using npm, yarn, pnpm, or bun:
npm install @wroud/di-tools-analyzer
Install via yarn
yarn add @wroud/di-tools-analyzer
import { ServiceContainerBuilder } from "@wroud/di";
import { getDependenciesGraph, createChart } from "@wroud/di-tools-analyzer";
const builder = new ServiceContainerBuilder();
// Register your services
// Collect dependencies graph
const data = await getDependenciesGraph(builder);
// Serialize the data if needed
const jsonData = JSON.stringify(data);
// Visualize
const svg = document.createElement("svg");
const width = 512;
const height = 512;
const chart = createChart(svg, width, height); // Initialize D3.js
chart.update(graph); // Render graph
For detailed usage and API reference, visit the documentation site.
This project is licensed under the MIT License. See the LICENSE file for details.