Skip to content

Commit

Permalink
docs: graph workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
scarf005 committed Feb 20, 2024
1 parent cf0b21e commit 7e5e87a
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions graph/mod.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,47 @@
// deno-lint-ignore-file no-unused-vars
import type { getDecls } from "./decls.ts"
import type { DeclDeps, getDeclDeps } from "./decl_deps.ts"
import type { declDepsToGraph, Graph } from "./graph.ts"
import type { graphToTopDeclDeps, TopDeclDeps } from "./top_decl_deps.ts"

/**
* @module
*
* ## `stackgraph/graph` Workflow
*
* ### Terminology
*
* - `decl`: top-level declaration (variable, function, class)
* - `deps`: reference to another `decl`
* - `decl deps`: Map of `decl` and its `deps`
* - `graph`: directed graph made with `decl deps`
* - `top decl deps`:
* - inversed `graph` folded into record
* - with leaf `decl` as keys
* - and all path `decl` as values
*
* ### Getting `decl`s
*
* 1. get all declarations from source file
* 2. filter out decl entrypoints with {@link getDecls}
*
* ### Getting `decl deps`
*
* using {@link getDeclDeps}:
*
* 1. search all deps from each decl
* 2. for each deps, do step 1
* 3. collect them into {@link DeclDeps}
*
* ### Getting `graph`
*
* generate {@link Graph} using {@link declDepsToGraph}
*
* ### Getting `top decl deps`
*
* generate {@link TopDeclDeps} using {@link graphToTopDeclDeps}
*/

export * from "./decls.ts"

export * from "./decl_deps.ts"
Expand Down

0 comments on commit 7e5e87a

Please sign in to comment.