Skip to content

Commit 8e97b0e

Browse files
committed
fix: Add some minimal function docs
There are a few places where the dep graph function names are not quite enough to explain the intent / usages (or at least, I could not easily understand) This patch adds some small docstrings so that IDEs can show them, rather than needing to open the dep graph source / docs.
1 parent 3c45b93 commit 8e97b0e

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/core/create-from-json.ts

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import { DepGraphImpl } from './dep-graph';
99

1010
export const SUPPORTED_SCHEMA_RANGE = '^1.0.0';
1111

12+
/**
13+
* Create a DepGraph instance from a JSON representation of a dep graph. This
14+
* is typically used after passing the graph over the wire as `DepGraphData`.
15+
*/
1216
export function createFromJSON(depGraphData: DepGraphData): DepGraph {
1317
validateDepGraphData(depGraphData);
1418

src/core/dep-graph.ts

+10
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,16 @@ class DepGraphImpl implements types.DepGraphInternal {
6464
return this._rootNodeId;
6565
}
6666

67+
/**
68+
* Get all unique packages in the graph (including the root package)
69+
*/
6770
public getPkgs(): types.PkgInfo[] {
6871
return this._pkgList;
6972
}
7073

74+
/**
75+
* Get all unique packages in the graph (excluding the root package)
76+
*/
7177
public getDepPkgs(): types.PkgInfo[] {
7278
return this._depPkgsList;
7379
}
@@ -199,6 +205,10 @@ class DepGraphImpl implements types.DepGraphInternal {
199205
return nodes.map((node) => this.getNodePkg(node));
200206
}
201207

208+
/**
209+
* Create a JSON representation of a dep graph. This is typically used to
210+
* send the dep graph over the wire
211+
*/
202212
public toJSON(): types.DepGraphData {
203213
const nodeIds = this._graph.nodes();
204214

0 commit comments

Comments
 (0)